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 /****************************************************************************/
14 // Exporter writing networks using the openDRIVE format
15 /****************************************************************************/
16 #ifndef NWWriter_OpenDrive_h
17 #define NWWriter_OpenDrive_h
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 #include <config.h>
24 
27 #include <netbuild/NBEdge.h>
28 
29 
30 // ===========================================================================
31 // class declarations
32 // ===========================================================================
33 class NBNetBuilder;
34 class NBEdge;
35 class OptionsCont;
36 class PositionVector;
37 class OutputDevice;
39 class ShapeContainer;
40 
41 
42 // ===========================================================================
43 // class definitions
44 // ===========================================================================
51 public:
57  static void writeNetwork(const OptionsCont& oc, NBNetBuilder& nb);
58 
59 protected:
61  static void writeNormalEdge(OutputDevice& device, const NBEdge* e,
62  int edgeID, int fromNodeID, int toNodeID,
63  const bool origNames,
64  const double straightThresh,
65  const ShapeContainer& shc);
66 
68  static int writeInternalEdge(OutputDevice& device, OutputDevice& junctionDevice,
69  const NBEdge* inEdge, int nodeID,
70  int edgeID, int inEdgeID, int outEdgeID,
71  int connectionID,
72  const std::vector<NBEdge::Connection>& parallel,
73  const bool isOuterEdge,
74  const double straightThresh,
75  const std::string& centerMark);
76 
77  static void addPedestrianConnection(const NBEdge* inEdge, const NBEdge* outEdge, std::vector<NBEdge::Connection>& parallel);
78 
80  static double writeGeomLines(const PositionVector& shape, OutputDevice& device, OutputDevice& elevationDevice, double offset = 0);
81 
82  /* @brief write geometry as sequence of lines and bezier curves
83  *
84  * @param[in] straightThresh angular changes below threshold are considered to be straight and no curve will be fitted between the segments
85  * @param[out] length Return the total length of the reference line
86  */
87  static bool writeGeomSmooth(const PositionVector& shape, double speed, OutputDevice& device, OutputDevice& elevationDevice, double straightThresh, double& length);
88 
90  static double writeGeomPP3(OutputDevice& device,
91  OutputDevice& elevationDevice,
92  PositionVector init,
93  double length,
94  double offset = 0);
95 
96  static void writeElevationProfile(const PositionVector& shape, OutputDevice& device, const OutputDevice_String& elevationDevice);
97 
98  static void writeEmptyCenterLane(OutputDevice& device, const std::string& mark, double markWidth);
99  static int getID(const std::string& origID, StringBijection<int>& map, int& lastID);
100 
101  static std::string getLaneType(SVCPermissions permissions);
102 
104  static PositionVector getLeftLaneBorder(const NBEdge* edge, int laneIndex = -1, double widthOffset = 0);
105  static PositionVector getRightLaneBorder(const NBEdge* edge, int laneIndex = -1);
106 
108  static void checkLaneGeometries(const NBEdge* e);
109 
111  static void writeRoadObjects(OutputDevice& device, const NBEdge* e, const ShapeContainer& shc);
112 };
113 
114 
115 #endif
116 
117 /****************************************************************************/
118 
NWWriter_OpenDrive::addPedestrianConnection
static void addPedestrianConnection(const NBEdge *inEdge, const NBEdge *outEdge, std::vector< NBEdge::Connection > &parallel)
Definition: NWWriter_OpenDrive.cpp:325
OutputDevice_String
An output device that encapsulates an ofstream.
Definition: OutputDevice_String.h:39
NBNetBuilder
Instance responsible for building networks.
Definition: NBNetBuilder.h:109
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:63
StringBijection.h
NWWriter_OpenDrive::writeEmptyCenterLane
static void writeEmptyCenterLane(OutputDevice &device, const std::string &mark, double markWidth)
Definition: NWWriter_OpenDrive.cpp:505
NWWriter_OpenDrive::writeNetwork
static void writeNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Writes the network into a openDRIVE-file.
Definition: NWWriter_OpenDrive.cpp:55
NWWriter_OpenDrive::getRightLaneBorder
static PositionVector getRightLaneBorder(const NBEdge *edge, int laneIndex=-1)
Definition: NWWriter_OpenDrive.cpp:595
ShapeContainer
Storage for geometrical objects.
Definition: ShapeContainer.h:49
NWWriter_OpenDrive::writeGeomLines
static double writeGeomLines(const PositionVector &shape, OutputDevice &device, OutputDevice &elevationDevice, double offset=0)
write geometry as sequence of lines (sumo style)
Definition: NWWriter_OpenDrive.cpp:483
PositionVector
A list of positions.
Definition: PositionVector.h:45
NWWriter_OpenDrive::getLeftLaneBorder
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)
Definition: NWWriter_OpenDrive.cpp:562
NBEdge
The representation of a single edge during network building.
Definition: NBEdge.h:91
NWWriter_OpenDrive::getID
static int getID(const std::string &origID, StringBijection< int > &map, int &lastID)
Definition: NWWriter_OpenDrive.cpp:516
StringBijection< int >
SVCPermissions
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
Definition: SUMOVehicleClass.h:218
SUMOVehicleClass.h
NWWriter_OpenDrive::writeNormalEdge
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
Definition: NWWriter_OpenDrive.cpp:221
OptionsCont
A storage for options typed value containers)
Definition: OptionsCont.h:89
NWWriter_OpenDrive::getLaneType
static std::string getLaneType(SVCPermissions permissions)
Definition: NWWriter_OpenDrive.cpp:526
NWWriter_OpenDrive::checkLaneGeometries
static void checkLaneGeometries(const NBEdge *e)
check if the lane geometries are compatible with OpenDRIVE assumptions (colinear stop line)
Definition: NWWriter_OpenDrive.cpp:853
NWWriter_OpenDrive::writeElevationProfile
static void writeElevationProfile(const PositionVector &shape, OutputDevice &device, const OutputDevice_String &elevationDevice)
Definition: NWWriter_OpenDrive.cpp:831
config.h
NWWriter_OpenDrive
Exporter writing networks using the openDRIVE format.
Definition: NWWriter_OpenDrive.h:50
NWWriter_OpenDrive::writeGeomSmooth
static bool writeGeomSmooth(const PositionVector &shape, double speed, OutputDevice &device, OutputDevice &elevationDevice, double straightThresh, double &length)
Definition: NWWriter_OpenDrive.cpp:697
NWWriter_OpenDrive::writeGeomPP3
static double writeGeomPP3(OutputDevice &device, OutputDevice &elevationDevice, PositionVector init, double length, double offset=0)
write geometry as a single bezier curve (paramPoly3)
Definition: NWWriter_OpenDrive.cpp:601
NBEdge.h
NWWriter_OpenDrive::writeRoadObjects
static void writeRoadObjects(OutputDevice &device, const NBEdge *e, const ShapeContainer &shc)
write road objects referenced as edge parameters
Definition: NWWriter_OpenDrive.cpp:874
NWWriter_OpenDrive::writeInternalEdge
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
Definition: NWWriter_OpenDrive.cpp:341