46 #ifdef CHECK_MEMORY_LEAKS
48 #endif // CHECK_MEMORY_LEAKS
61 if (!oc.
isSet(
"opendrive-output")) {
71 device <<
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
72 device <<
"<OpenDRIVE>\n";
74 std::string dstr(ctime(&now));
78 device <<
" <header revMajor=\"1\" revMinor=\"3\" name=\"\" version=\"1.00\" date=\"" << dstr.substr(0, dstr.length() - 1)
79 <<
"\" north=\"" << b.
ymax() <<
"\" south=\"" << b.
ymin() <<
"\" east=\"" << b.
xmax() <<
"\" west=\"" << b.
xmin()
80 <<
"\" maxRoad=\"" << ec.
size() <<
"\" maxJunc=\"" << nc.
size() <<
"\" maxPrg=\"0\"/>\n";
82 for (std::map<std::string, NBEdge*>::const_iterator i = ec.
begin(); i != ec.
end(); ++i) {
83 const NBEdge* e = (*i).second;
85 device <<
" <link>\n";
86 device <<
" <predecessor elementType=\"junction\" elementId=\"" <<
getID(e->
getFromNode()->
getID(), nodeMap, nodeID) <<
"\"/>\n";
87 device <<
" <successor elementType=\"junction\" elementId=\"" <<
getID(e->
getToNode()->
getID(), nodeMap, nodeID) <<
"\"/>\n";
88 device <<
" </link>\n";
89 device <<
" <type s=\"0\" type=\"town\"/>\n";
90 const std::vector<NBEdge::Lane>& lanes = e->
getLanes();
91 unsigned int li = (
unsigned int)lanes.size() - 1;
99 device <<
" <elevationProfile><elevation s=\"0\" a=\"0\" b=\"0\" c=\"0\" d=\"0\"/></elevationProfile>\n";
100 device <<
" <lateralProfile/>\n";
101 device <<
" <lanes>\n";
102 device <<
" <laneSection s=\"0\">\n";
104 device <<
" <right>\n";
106 device <<
" <lane id=\"-" << e->
getNumLanes() - j <<
"\" type=\"driving\" level=\"0\">\n";
107 device <<
" <link>\n";
108 device <<
" <predecessor id=\"-1\"/>\n";
109 device <<
" <successor id=\"-1\"/>\n";
110 device <<
" </link>\n";
111 device <<
" <width sOffset=\"0\" a=\"" << e->
getLaneWidth(j) <<
"\" b=\"0\" c=\"0\" d=\"0\"/>\n";
112 std::string markType =
"broken";
116 device <<
" <roadMark sOffset=\"0\" type=\"" << markType <<
"\" weight=\"standard\" color=\"standard\" width=\"0.13\"/>\n";
117 device <<
" </lane>\n";
119 device <<
" </right>\n";
120 device <<
" </laneSection>\n";
121 device <<
" </lanes>\n";
122 device <<
" <objects/>\n";
123 device <<
" <signals/>\n";
124 device <<
" </road>\n";
128 for (std::map<std::string, NBNode*>::const_iterator i = nc.
begin(); i != nc.
end(); ++i) {
131 for (std::vector<NBEdge*>::const_iterator j = incoming.begin(); j != incoming.end(); ++j) {
132 const std::vector<NBEdge::Connection>& elv = (*j)->getConnections();
133 for (std::vector<NBEdge::Connection>::const_iterator k = elv.begin(); k != elv.end(); ++k) {
134 if ((*k).toEdge == 0) {
150 device <<
" <road name=\"" << c.
id <<
"\" length=\"" << shape.
length() <<
"\" id=\"" <<
getID(c.
id, edgeMap, edgeID) <<
"\" junction=\"" <<
getID(n->
getID(), nodeMap, nodeID) <<
"\">\n";
151 device <<
" <link>\n";
152 device <<
" <predecessor elementType=\"road\" elementId=\"" <<
getID((*j)->getID(), edgeMap, edgeID) <<
"\"/>\n";
153 device <<
" <successor elementType=\"road\" elementId=\"" <<
getID((*k).toEdge->getID(), edgeMap, edgeID) <<
"\"/>\n";
154 device <<
" </link>\n";
155 device <<
" <type s=\"0\" type=\"town\"/>\n";
157 device <<
" <elevationProfile><elevation s=\"0\" a=\"0\" b=\"0\" c=\"0\" d=\"0\"/></elevationProfile>\n";
158 device <<
" <lateralProfile/>\n";
159 device <<
" <lanes>\n";
160 device <<
" <laneSection s=\"0\">\n";
162 device <<
" <right>\n";
163 device <<
" <lane id=\"-1\" type=\"driving\" level=\"0\">\n";
164 device <<
" <link>\n";
165 device <<
" <predecessor id=\"-" << (*j)->getNumLanes() - c.
fromLane <<
"\"/>\n";
167 device <<
" </link>\n";
168 device <<
" <width sOffset=\"0\" a=\"" << width <<
"\" b=\"0\" c=\"0\" d=\"0\"/>\n";
169 device <<
" <roadMark sOffset=\"0\" type=\"none\" weight=\"standard\" color=\"standard\" width=\"0.13\"/>\n";
170 device <<
" </lane>\n";
171 device <<
" </right>\n";
172 device <<
" </laneSection>\n";
173 device <<
" </lanes>\n";
174 device <<
" <objects/>\n";
175 device <<
" <signals/>\n";
176 device <<
" </road>\n";
182 for (std::map<std::string, NBNode*>::const_iterator i = nc.
begin(); i != nc.
end(); ++i) {
184 device <<
" <junction name=\"" << n->
getID() <<
"\" id=\"" <<
getID(n->
getID(), nodeMap, nodeID) <<
"\">\n";
185 unsigned int index = 0;
187 for (std::vector<NBEdge*>::const_iterator j = incoming.begin(); j != incoming.end(); ++j) {
188 const std::vector<NBEdge::Connection>& elv = (*j)->getConnections();
189 for (std::vector<NBEdge::Connection>::const_iterator k = elv.begin(); k != elv.end(); ++k) {
190 if ((*k).toEdge == 0) {
193 device <<
" <connection id=\"" << index <<
"\" incomingRoad=\"" <<
getID((*j)->getID(), edgeMap, edgeID)
194 <<
"\" connectingRoad=\"" <<
getID((*k).id, edgeMap, edgeID) <<
"\" contactPoint=\"start\"/>\n";
198 device <<
" </junction>\n";
201 device <<
"</OpenDRIVE>\n";
208 device <<
" <planView>\n";
210 for (
unsigned int j = 0; j < shape.size() - 1; ++j) {
214 device <<
" <geometry s=\"" << offset <<
"\" x=\"" << p.
x() <<
"\" y=\"" << p.
y() <<
"\" hdg=\"" << hdg <<
"\" length=\"" << l.
length() <<
"\"><line/></geometry>\n";
217 device <<
" </planView>\n";
223 device <<
" <center>\n";
224 device <<
" <lane id=\"0\" type=\"none\" level= \"0\">\n";
225 device <<
" <link/>\n";
226 device <<
" <roadMark sOffset=\"0\" type=\"" << mark <<
"\" weight=\"standard\" color=\"standard\" width=\"" << markWidth <<
"\"/>\n";
227 device <<
" <width sOffset=\"0\" a=\"0\" b=\"0\" c=\"0\" d=\"0\"/>\n";
228 device <<
" </lane>\n";
229 device <<
" </center>\n";
236 return map.
get(origID);
238 map.
insert(origID, lastID++);
static void writePlanView(const PositionVector &shape, OutputDevice &device)
const PositionVector & getLaneShape(unsigned int i) const
Returns the shape of the nth lane.
const Position & p2() const
const EdgeVector & getIncomingEdges() const
Returns this node's incoming edges.
A structure which describes a connection between edges or lanes.
int toLane
The lane the connections yields in.
const SUMOReal SUMO_const_laneWidth
NBEdge * toEdge
The edge the connections yields in.
SUMOReal ymin() const
Returns minimum y-coordinate.
const std::vector< NBEdge::Lane > & getLanes() const
Returns the lane definitions.
The representation of a single edge during network building.
static std::string escapeXML(const std::string &orig)
Replaces the standard escapes by their XML entities.
SUMOReal xmin() const
Returns minimum x-coordinate.
SUMOReal getLaneWidth() const
Returns the default width of lanes of this edge.
SUMOReal x() const
Returns the x-position.
SUMOReal xmax() const
Returns maximum x-coordinate.
A class that stores a 2D geometrical boundary.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
const std::string & getID() const
Returns the id.
unsigned int size() const
Returns the number of known nodes.
Line lineAt(int pos) const
const Position & p1() const
static void writeNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Writes the network into a openDRIVE-file.
std::map< std::string, NBEdge * >::const_iterator end() const
Returns the pointer to the end of the stored edges.
int fromLane
The lane the connections starts at.
A point in 2D or 3D with translation and scaling methods.
NBEdgeCont & getEdgeCont()
Returns the edge container.
unsigned int getNumLanes() const
Returns the number of lanes.
void insert(const std::string str, const T key)
static void writeEmptyCenterLane(OutputDevice &device, const std::string &mark, SUMOReal markWidth)
Storage for edges, including some functionality operating on multiple edges.
std::map< std::string, NBNode * >::const_iterator end() const
Returns the pointer to the end of the stored nodes.
const Boundary & getConvBoundary() const
Returns the converted boundary.
std::map< std::string, NBEdge * >::const_iterator begin() const
Returns the pointer to the begin of the stored edges.
T get(const std::string &str)
SUMOReal length() const
Returns the length.
NBNode * getToNode() const
Returns the destination node of the edge.
NBNodeCont & getNodeCont()
Returns the node container.
Instance responsible for building networks.
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
bool hasString(const std::string &str)
SUMOReal y() const
Returns the y-position.
A storage for options typed value containers)
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
Represents a single node (junction) during network building.
void move2side(SUMOReal amount)
Static storage of an output device and its base (abstract) implementation.
SUMOReal ymax() const
Returns maximum y-coordinate.
Container for nodes during the netbuilding process.
static int getID(const std::string &origID, StringBijection< int > &map, int &lastID)
const std::string & getStreetName() const
Returns the street name of this edge.
void append(const PositionVector &v)
std::map< std::string, NBNode * >::const_iterator begin() const
Returns the pointer to the begin of the stored nodes.
unsigned int size() const
Returns the number of edges.
SUMOReal getLength() const
Returns the computed length of the edge.
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
NBNode * getFromNode() const
Returns the origin node of the edge.