Eclipse 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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // Exporter writing networks using the openDRIVE format
16 /****************************************************************************/
17 #ifndef NWWriter_OpenDrive_h
18 #define NWWriter_OpenDrive_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
28 #include <netbuild/NBEdge.h>
29 
30 
31 // ===========================================================================
32 // class declarations
33 // ===========================================================================
34 class NBNetBuilder;
35 class NBEdge;
36 class OptionsCont;
37 class PositionVector;
38 class OutputDevice;
40 class ShapeContainer;
41 
42 
43 // ===========================================================================
44 // class definitions
45 // ===========================================================================
52 public:
58  static void writeNetwork(const OptionsCont& oc, NBNetBuilder& nb);
59 
60 protected:
62  static void writeNormalEdge(OutputDevice& device, const NBEdge* e,
63  int edgeID, int fromNodeID, int toNodeID,
64  const bool origNames,
65  const double straightThresh,
66  const ShapeContainer& shc);
67 
69  static int writeInternalEdge(OutputDevice& device, OutputDevice& junctionDevice,
70  const NBEdge* inEdge, int nodeID,
71  int edgeID, int inEdgeID, int outEdgeID,
72  int connectionID,
73  const std::vector<NBEdge::Connection>& parallel,
74  const bool isOuterEdge,
75  const double straightThresh,
76  const std::string& centerMark);
77 
78  static void addPedestrianConnection(const NBEdge* inEdge, const NBEdge* outEdge, std::vector<NBEdge::Connection>& parallel);
79 
81  static double writeGeomLines(const PositionVector& shape, OutputDevice& device, OutputDevice& elevationDevice, double offset = 0);
82 
83  /* @brief write geometry as sequence of lines and bezier curves
84  *
85  * @param[in] straightThresh angular changes below threshold are considered to be straight and no curve will be fitted between the segments
86  * @param[out] length Return the total length of the reference line
87  */
88  static bool writeGeomSmooth(const PositionVector& shape, double speed, OutputDevice& device, OutputDevice& elevationDevice, double straightThresh, double& length);
89 
91  static double writeGeomPP3(OutputDevice& device,
92  OutputDevice& elevationDevice,
93  PositionVector init,
94  double length,
95  double offset = 0);
96 
97  static void writeElevationProfile(const PositionVector& shape, OutputDevice& device, const OutputDevice_String& elevationDevice);
98 
99  static void writeEmptyCenterLane(OutputDevice& device, const std::string& mark, double markWidth);
100  static int getID(const std::string& origID, StringBijection<int>& map, int& lastID);
101 
102  static std::string getLaneType(SVCPermissions permissions);
103 
105  static PositionVector getLeftLaneBorder(const NBEdge* edge, int laneIndex = -1, double widthOffset = 0);
106  static PositionVector getRightLaneBorder(const NBEdge* edge, int laneIndex = -1);
107 
109  static void checkLaneGeometries(const NBEdge* e);
110 
112  static void writeRoadObjects(OutputDevice& device, const NBEdge* e, const ShapeContainer& shc);
113 };
114 
115 
116 #endif
117 
118 /****************************************************************************/
119 
static void writeEmptyCenterLane(OutputDevice &device, const std::string &mark, double markWidth)
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:86
Storage for geometrical objects.
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)
static void writeRoadObjects(OutputDevice &device, const NBEdge *e, const ShapeContainer &shc)
write road objects referenced as edge parameters
A list of positions.
static PositionVector getRightLaneBorder(const NBEdge *edge, int laneIndex=-1)
Exporter writing networks using the openDRIVE format.
static void writeNormalEdge(OutputDevice &device, const NBEdge *e, int edgeID, int fromNodeID, int toNodeID, const bool origNames, const double straightThresh, const ShapeContainer &shc)
write normal edge to device
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:110
A storage for options typed value containers)
Definition: OptionsCont.h:90
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:64
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.