50 #ifdef CHECK_MEMORY_LEAKS
52 #endif // CHECK_MEMORY_LEAKS
65 if (!oc.
isSet(
"output-file")) {
69 device.
writeXMLHeader(
"net",
NWFrame::MAJOR_VERSION +
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo-sim.org/xsd/net_file.xsd\"");
80 bool origNames = oc.
getBool(
"output.original-names");
81 if (!oc.
getBool(
"no-internal-links")) {
83 for (std::map<std::string, NBNode*>::const_iterator i = nc.
begin(); i != nc.
end(); ++i) {
92 bool noNames = !oc.
getBool(
"output.street-names");
93 for (std::map<std::string, NBEdge*>::const_iterator i = ec.
begin(); i != ec.
end(); ++i) {
94 writeEdge(device, *(*i).second, noNames, origNames);
102 std::set<NBNode*> roundaboutNodes;
103 const bool checkLaneFoesAll = oc.
getBool(
"check-lane-foes.all");
104 const bool checkLaneFoesRoundabout = !checkLaneFoesAll && oc.
getBool(
"check-lane-foes.roundabout");
105 if (checkLaneFoesRoundabout) {
107 for (std::vector<EdgeVector>::const_iterator i = roundabouts.begin(); i != roundabouts.end(); ++i) {
108 for (EdgeVector::const_iterator j = (*i).begin(); j != (*i).end(); ++j) {
109 roundaboutNodes.insert((*j)->getToNode());
113 for (std::map<std::string, NBNode*>::const_iterator i = nc.
begin(); i != nc.
end(); ++i) {
114 const bool checkLaneFoes = checkLaneFoesAll || (checkLaneFoesRoundabout && roundaboutNodes.count((*i).second) > 0);
118 const bool includeInternal = !oc.
getBool(
"no-internal-links");
119 if (includeInternal) {
122 for (std::map<std::string, NBNode*>::const_iterator i = nc.
begin(); i != nc.
end(); ++i) {
131 unsigned int numConnections = 0;
132 for (std::map<std::string, NBEdge*>::const_iterator it_edge = ec.
begin(); it_edge != ec.
end(); it_edge++) {
133 NBEdge* from = it_edge->second;
135 const std::vector<NBEdge::Connection> connections = from->
getConnections();
136 numConnections += (
unsigned int)connections.size();
137 for (std::vector<NBEdge::Connection>::const_iterator it_c = connections.begin(); it_c != connections.end(); it_c++) {
141 if (numConnections > 0) {
144 if (includeInternal) {
147 for (std::map<std::string, NBNode*>::const_iterator i = nc.
begin(); i != nc.
end(); ++i) {
155 for (std::map<std::string, NBNode*>::const_iterator i = nc.
begin(); i != nc.
end(); ++i) {
162 std::vector<std::vector<std::string> > edgeIDs;
163 for (std::vector<EdgeVector>::const_iterator i = roundabouts.begin(); i != roundabouts.end(); ++i) {
164 std::vector<std::string> tEdgeIDs;
165 for (EdgeVector::const_iterator j = (*i).begin(); j != (*i).end(); ++j) {
166 tEdgeIDs.push_back((*j)->getID());
168 std::sort(tEdgeIDs.begin(), tEdgeIDs.end());
169 edgeIDs.push_back(tEdgeIDs);
171 std::sort(edgeIDs.begin(), edgeIDs.end());
173 for (std::vector<std::vector<std::string> >::const_iterator i = edgeIDs.begin(); i != edgeIDs.end(); ++i) {
176 if (roundabouts.size() != 0) {
181 for (std::map<std::string, NBDistrict*>::const_iterator i = dc.
begin(); i != dc.
end(); i++) {
184 if (dc.
size() != 0) {
195 for (EdgeVector::const_iterator i = incoming.begin(); i != incoming.end(); i++) {
196 const std::vector<NBEdge::Connection>& elv = (*i)->getConnections();
197 if (elv.size() > 0) {
198 bool haveVia =
false;
200 std::string internalEdgeID =
"";
202 std::map<NBEdge*, SUMOReal> lengthSum;
203 std::map<NBEdge*, int> numLanes;
204 for (std::vector<NBEdge::Connection>::const_iterator k = elv.begin(); k != elv.end(); ++k) {
206 numLanes[(*k).toEdge] += 1;
209 for (std::vector<NBEdge::Connection>::const_iterator k = elv.begin(); k != elv.end(); ++k) {
210 if ((*k).toEdge == 0) {
214 if (toEdge != (*k).toEdge) {
215 internalEdgeID = (*k).id;
220 toEdge = (*k).toEdge;
228 const NBEdge::Lane& successor = (*k).toEdge->getLanes()[(*k).toLane];
229 const SUMOReal length = lengthSum[toEdge] / numLanes[toEdge];
230 writeLane(into, internalEdgeID, (*k).getInternalLaneID(), (*k).vmax,
233 length, (*k).internalLaneIndex, origNames);
234 haveVia = haveVia || (*k).haveVia;
240 for (std::vector<NBEdge::Connection>::const_iterator k = elv.begin(); k != elv.end(); ++k) {
244 if ((*k).toEdge == 0) {
291 const std::vector<NBEdge::Lane>& lanes = e.
getLanes();
304 for (
unsigned int i = 0; i < (
unsigned int) lanes.size(); i++) {
308 length, i, origNames);
319 const std::string& origID,
SUMOReal length,
unsigned int index,
bool origNames) {
330 }
else if (speed < 0) {
334 length = length - offset;
346 if (origNames && origID !=
"") {
365 std::string incLanes;
367 for (std::vector<NBEdge*>::const_iterator i = incoming.begin(); i != incoming.end(); ++i) {
368 unsigned int noLanes = (*i)->getNumLanes();
369 for (
unsigned int j = 0; j < noLanes; j++) {
370 incLanes += (*i)->getLaneID(j);
371 if (i != incoming.end() - 1 || j < noLanes - 1) {
378 std::string intLanes;
381 for (EdgeVector::const_iterator i = incoming.begin(); i != incoming.end(); i++) {
382 const std::vector<NBEdge::Connection>& elv = (*i)->getConnections();
383 for (std::vector<NBEdge::Connection>::const_iterator k = elv.begin(); k != elv.end(); ++k) {
384 if ((*k).toEdge == 0) {
391 intLanes += (*k).getInternalLaneID();
393 intLanes += (*k).viaID +
"_0";
417 std::vector<std::string> internalLaneIDs;
418 for (EdgeVector::const_iterator i = incoming.begin(); i != incoming.end(); i++) {
419 const std::vector<NBEdge::Connection>& elv = (*i)->getConnections();
420 for (std::vector<NBEdge::Connection>::const_iterator k = elv.begin(); k != elv.end(); ++k) {
421 if ((*k).toEdge != 0) {
422 internalLaneIDs.push_back((*k).getInternalLaneID());
427 for (std::vector<NBEdge*>::const_iterator i = incoming.begin(); i != incoming.end(); i++) {
428 const std::vector<NBEdge::Connection>& elv = (*i)->getConnections();
429 for (std::vector<NBEdge::Connection>::const_iterator k = elv.begin(); k != elv.end(); ++k) {
430 if ((*k).toEdge == 0 || !(*k).haveVia) {
437 std::string incLanes = (*k).getInternalLaneID();
438 if ((*k).foeIncomingLanes.length() != 0) {
439 incLanes +=
" " + (*k).foeIncomingLanes;
442 const std::vector<unsigned int>& foes = (*k).foeInternalLinks;
443 std::vector<std::string> foeIDs;
444 for (std::vector<unsigned int>::const_iterator it = foes.begin(); it != foes.end(); ++it) {
445 foeIDs.push_back(internalLaneIDs[*it]);
468 if (style !=
PLAIN) {
469 if (includeInternal) {
496 for (std::vector<NBEdge*>::const_iterator i = incoming.begin(); i != incoming.end(); ++i) {
498 const std::vector<NBEdge::Connection>& connections = from->
getConnections();
499 for (std::vector<NBEdge::Connection>::const_iterator j = connections.begin(); j != connections.end(); ++j) {
519 const std::string& from,
const std::string& to,
520 int fromLane,
int toLane,
const std::string& via) {
538 std::vector<std::string> nodeIDs;
539 for (std::vector<std::string>::const_iterator i = edgeIDs.begin(); i != edgeIDs.end(); ++i) {
542 std::sort(nodeIDs.begin(), nodeIDs.end());
564 for (i = 0; i < sources.size(); i++) {
571 for (i = 0; i < sinks.size(); i++) {
584 if (time == std::floor(time)) {
594 for (NBConnectionProhibits::const_iterator j = prohibitions.begin(); j != prohibitions.end(); j++) {
597 for (NBConnectionVector::const_iterator k = prohibiting.begin(); k != prohibiting.end(); k++) {
616 std::vector<NBTrafficLightLogic*> logics = tllCont.
getComputed();
617 for (std::vector<NBTrafficLightLogic*>::iterator it = logics.begin(); it != logics.end(); it++) {
624 const std::map<std::string, std::string>& params = (*it)->getMap();
625 for (std::map<std::string, std::string>::const_iterator i = params.begin(); i != params.end(); ++i) {
632 const std::vector<NBTrafficLightLogic::PhaseDefinition>& phases = (*it)->getPhases();
633 for (std::vector<NBTrafficLightLogic::PhaseDefinition>::const_iterator j = phases.begin(); j != phases.end(); ++j) {
641 if (logics.size() > 0) {
670 }
else if (permissions == 0) {
676 if (encoding.second) {