SUMO - Simulation of Urban MObility
NWWriter_OpenDrive.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
17 // Exporter writing networks using the openDRIVE format
18 /****************************************************************************/
19 #ifndef NWWriter_OpenDrive_h
20 #define NWWriter_OpenDrive_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #ifdef _MSC_VER
27 #include <windows_config.h>
28 #else
29 #include <config.h>
30 #endif
31 
34 #include <netbuild/NBEdge.h>
35 
36 
37 // ===========================================================================
38 // class declarations
39 // ===========================================================================
40 class NBNetBuilder;
41 class NBEdge;
42 class OptionsCont;
43 class PositionVector;
44 class OutputDevice;
46 
47 
48 // ===========================================================================
49 // class definitions
50 // ===========================================================================
57 public:
63  static void writeNetwork(const OptionsCont& oc, NBNetBuilder& nb);
64 
65 protected:
67  static void writeNormalEdge(OutputDevice& device, const NBEdge* e,
68  int edgeID, int fromNodeID, int toNodeID,
69  const bool origNames,
70  const double straightThresh);
71 
73  static int writeInternalEdge(OutputDevice& device, OutputDevice& junctionDevice,
74  const NBEdge* inEdge, int nodeID,
75  int edgeID, int inEdgeID, int outEdgeID,
76  int connectionID,
77  const std::vector<NBEdge::Connection>& parallel,
78  const bool isOuterEdge,
79  const double straightThresh,
80  const std::string& centerMark);
81 
82  static void addPedestrianConnection(const NBEdge* inEdge, const NBEdge* outEdge, std::vector<NBEdge::Connection>& parallel);
83 
85  static double writeGeomLines(const PositionVector& shape, OutputDevice& device, OutputDevice& elevationDevice, double offset = 0);
86 
87  /* @brief write geometry as sequence of lines and bezier curves
88  *
89  * @param[in] straightThresh angular changes below threshold are considered to be straight and no curve will be fitted between the segments
90  * @param[out] length Return the total length of the reference line
91  */
92  static bool writeGeomSmooth(const PositionVector& shape, double speed, OutputDevice& device, OutputDevice& elevationDevice, double straightThresh, double& length);
93 
95  static double writeGeomPP3(OutputDevice& device,
96  OutputDevice& elevationDevice,
97  PositionVector init,
98  double length,
99  double offset = 0);
100 
101  static void writeElevationProfile(const PositionVector& shape, OutputDevice& device, const OutputDevice_String& elevationDevice);
102 
103  static void writeEmptyCenterLane(OutputDevice& device, const std::string& mark, double markWidth);
104  static int getID(const std::string& origID, StringBijection<int>& map, int& lastID);
105 
106  static std::string getLaneType(SVCPermissions permissions);
107 
109  static PositionVector getLeftLaneBorder(const NBEdge* edge, int laneIndex = -1, double widthOffset = 0);
110  static PositionVector getRightLaneBorder(const NBEdge* edge, int laneIndex = -1);
111 
113  static void checkLaneGeometries(const NBEdge* e);
114 };
115 
116 
117 #endif
118 
119 /****************************************************************************/
120 
static void writeEmptyCenterLane(OutputDevice &device, const std::string &mark, double markWidth)
static void writeNormalEdge(OutputDevice &device, const NBEdge *e, int edgeID, int fromNodeID, int toNodeID, const bool origNames, const double straightThresh)
write normal edge to device
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
The representation of a single edge during network building.
Definition: NBEdge.h:70
static void writeNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Writes the network into a openDRIVE-file.
static double writeGeomPP3(OutputDevice &device, OutputDevice &elevationDevice, PositionVector init, double length, double offset=0)
write geometry as a single bezier curve (paramPoly3)
static bool writeGeomSmooth(const PositionVector &shape, double speed, OutputDevice &device, OutputDevice &elevationDevice, double straightThresh, double &length)
A list of positions.
static PositionVector getRightLaneBorder(const NBEdge *edge, int laneIndex=-1)
Exporter writing networks using the openDRIVE format.
static PositionVector getLeftLaneBorder(const NBEdge *edge, int laneIndex=-1, double widthOffset=0)
get the left border of the given lane (the leftmost one by default)
static std::string getLaneType(SVCPermissions permissions)
static double writeGeomLines(const PositionVector &shape, OutputDevice &device, OutputDevice &elevationDevice, double offset=0)
write geometry as sequence of lines (sumo style)
Instance responsible for building networks.
Definition: NBNetBuilder.h:115
A storage for options typed value containers)
Definition: OptionsCont.h:98
static void addPedestrianConnection(const NBEdge *inEdge, const NBEdge *outEdge, std::vector< NBEdge::Connection > &parallel)
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:70
static void checkLaneGeometries(const NBEdge *e)
check if the lane geometries are compatible with OpenDRIVE assumptions (colinear stop line) ...
static int writeInternalEdge(OutputDevice &device, OutputDevice &junctionDevice, const NBEdge *inEdge, int nodeID, int edgeID, int inEdgeID, int outEdgeID, int connectionID, const std::vector< NBEdge::Connection > &parallel, const bool isOuterEdge, const double straightThresh, const std::string &centerMark)
write internal edge to device, return next connectionID
static int getID(const std::string &origID, StringBijection< int > &map, int &lastID)
static void writeElevationProfile(const PositionVector &shape, OutputDevice &device, const OutputDevice_String &elevationDevice)
An output device that encapsulates an ofstream.