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-2018 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 
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 
67  static int writeInternalEdge(OutputDevice& device, OutputDevice& junctionDevice,
68  const NBEdge* inEdge, int nodeID,
69  int edgeID, int inEdgeID, int outEdgeID,
70  int connectionID,
71  const std::vector<NBEdge::Connection>& parallel,
72  const bool isOuterEdge,
73  const double straightThresh,
74  const std::string& centerMark);
75 
76  static void addPedestrianConnection(const NBEdge* inEdge, const NBEdge* outEdge, std::vector<NBEdge::Connection>& parallel);
77 
79  static double writeGeomLines(const PositionVector& shape, OutputDevice& device, OutputDevice& elevationDevice, double offset = 0);
80 
81  /* @brief write geometry as sequence of lines and bezier curves
82  *
83  * @param[in] straightThresh angular changes below threshold are considered to be straight and no curve will be fitted between the segments
84  * @param[out] length Return the total length of the reference line
85  */
86  static bool writeGeomSmooth(const PositionVector& shape, double speed, OutputDevice& device, OutputDevice& elevationDevice, double straightThresh, double& length);
87 
89  static double writeGeomPP3(OutputDevice& device,
90  OutputDevice& elevationDevice,
91  PositionVector init,
92  double length,
93  double offset = 0);
94 
95  static void writeElevationProfile(const PositionVector& shape, OutputDevice& device, const OutputDevice_String& elevationDevice);
96 
97  static void writeEmptyCenterLane(OutputDevice& device, const std::string& mark, double markWidth);
98  static int getID(const std::string& origID, StringBijection<int>& map, int& lastID);
99 
100  static std::string getLaneType(SVCPermissions permissions);
101 
103  static PositionVector getLeftLaneBorder(const NBEdge* edge, int laneIndex = -1, double widthOffset = 0);
104  static PositionVector getRightLaneBorder(const NBEdge* edge, int laneIndex = -1);
105 
107  static void checkLaneGeometries(const NBEdge* e);
108 };
109 
110 
111 #endif
112 
113 /****************************************************************************/
114 
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:65
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:109
A storage for options typed value containers)
Definition: OptionsCont.h:92
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.