Eclipse SUMO - Simulation of Urban MObility
NLHandler.cpp
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 /****************************************************************************/
19 // The XML-Handler for network loading
20 /****************************************************************************/
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
26 #include <string>
27 #include "NLHandler.h"
28 #include "NLEdgeControlBuilder.h"
30 #include "NLDetectorBuilder.h"
31 #include "NLTriggerBuilder.h"
35 #include <utils/common/SUMOTime.h>
38 #include <utils/common/RGBColor.h>
40 #include <microsim/MSGlobals.h>
41 #include <microsim/MSLane.h>
42 #include <microsim/MSJunction.h>
49 #include <utils/shapes/Shape.h>
51 
52 
53 // ===========================================================================
54 // method definitions
55 // ===========================================================================
56 NLHandler::NLHandler(const std::string& file, MSNet& net,
57  NLDetectorBuilder& detBuilder,
58  NLTriggerBuilder& triggerBuilder,
59  NLEdgeControlBuilder& edgeBuilder,
60  NLJunctionControlBuilder& junctionBuilder) :
61  MSRouteHandler(file, true),
62  myNet(net), myActionBuilder(net),
63  myCurrentIsInternalToSkip(false),
64  myDetectorBuilder(detBuilder), myTriggerBuilder(triggerBuilder),
65  myEdgeControlBuilder(edgeBuilder), myJunctionControlBuilder(junctionBuilder),
66  myAmParsingTLLogicOrJunction(false), myCurrentIsBroken(false),
67  myHaveWarnedAboutInvalidTLType(false),
68  myHaveSeenInternalEdge(false),
69  myHaveSeenNeighs(false),
70  myHaveSeenAdditionalSpeedRestrictions(false),
71  myLefthand(false),
72  myNetworkVersion(0),
73  myNetIsLoaded(false) {
74 }
75 
76 
78 
79 
80 void
82  const SUMOSAXAttributes& attrs) {
83  try {
84  switch (element) {
85  case SUMO_TAG_NET: {
86  bool ok;
87  myLefthand = attrs.getOpt<bool>(SUMO_ATTR_LEFTHAND, nullptr, ok, false);
88  myNetworkVersion = attrs.get<double>(SUMO_ATTR_VERSION, nullptr, ok, false);
89  break;
90  }
91  case SUMO_TAG_EDGE:
92  beginEdgeParsing(attrs);
93  break;
94  case SUMO_TAG_LANE:
95  addLane(attrs);
96  break;
97  case SUMO_TAG_NEIGH:
100  }
101  myHaveSeenNeighs = true;
102  break;
103  case SUMO_TAG_JUNCTION:
104  openJunction(attrs);
105  initJunctionLogic(attrs);
106  break;
107  case SUMO_TAG_PHASE:
108  addPhase(attrs);
109  break;
110  case SUMO_TAG_CONNECTION:
111  addConnection(attrs);
112  break;
113  case SUMO_TAG_TLLOGIC:
114  initTrafficLightLogic(attrs);
115  break;
116  case SUMO_TAG_REQUEST:
117  addRequest(attrs);
118  break;
119  case SUMO_TAG_WAUT:
120  openWAUT(attrs);
121  break;
123  addWAUTSwitch(attrs);
124  break;
126  addWAUTJunction(attrs);
127  break;
128  case SUMO_TAG_E1DETECTOR:
130  addE1Detector(attrs);
131  break;
132  case SUMO_TAG_E2DETECTOR:
134  addE2Detector(attrs);
135  break;
136  case SUMO_TAG_E3DETECTOR:
138  beginE3Detector(attrs);
139  break;
140  case SUMO_TAG_DET_ENTRY:
141  addE3Entry(attrs);
142  break;
143  case SUMO_TAG_DET_EXIT:
144  addE3Exit(attrs);
145  break;
147  addInstantE1Detector(attrs);
148  break;
149  case SUMO_TAG_VSS:
151  break;
152  case SUMO_TAG_CALIBRATOR:
154  break;
155  case SUMO_TAG_REROUTER:
157  break;
158  case SUMO_TAG_BUS_STOP:
159  case SUMO_TAG_TRAIN_STOP:
163  break;
166  break;
170  break;
171  case SUMO_TAG_ACCESS:
173  break;
177  break;
178  case SUMO_TAG_VTYPEPROBE:
179  addVTypeProbeDetector(attrs);
180  break;
181  case SUMO_TAG_ROUTEPROBE:
182  addRouteProbeDetector(attrs);
183  break;
186  break;
189  break;
190  case SUMO_TAG_TIMEDEVENT:
192  break;
193  case SUMO_TAG_VAPORIZER:
195  break;
196  case SUMO_TAG_LOCATION:
197  setLocation(attrs);
198  break;
199  case SUMO_TAG_TAZ:
200  addDistrict(attrs);
201  break;
202  case SUMO_TAG_TAZSOURCE:
203  addDistrictEdge(attrs, true);
204  break;
205  case SUMO_TAG_TAZSINK:
206  addDistrictEdge(attrs, false);
207  break;
208  case SUMO_TAG_ROUNDABOUT:
209  addRoundabout(attrs);
210  break;
211  case SUMO_TAG_TYPE: {
212  bool ok = true;
213  myCurrentTypeID = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, ok);
214  break;
215  }
216  case SUMO_TAG_RESTRICTION: {
217  bool ok = true;
218  const SUMOVehicleClass svc = getVehicleClassID(attrs.get<std::string>(SUMO_ATTR_VCLASS, myCurrentTypeID.c_str(), ok));
219  const double speed = attrs.get<double>(SUMO_ATTR_SPEED, myCurrentTypeID.c_str(), ok);
220  if (ok) {
221  myNet.addRestriction(myCurrentTypeID, svc, speed);
222  }
223  if (myNetIsLoaded) {
225  }
226  break;
227  }
228  case SUMO_TAG_STOPOFFSET: {
229  bool ok = true;
230  std::map<SVCPermissions, double> stopOffsets = parseStopOffsets(attrs, ok);
231  if (!ok) {
233  } else {
235  }
236  break;
237  }
238  default:
239  break;
240  }
241  } catch (InvalidArgument& e) {
242  WRITE_ERROR(e.what());
243  }
244  MSRouteHandler::myStartElement(element, attrs);
245  if (element == SUMO_TAG_PARAM && !myCurrentIsBroken) {
246  addParam(attrs);
247  }
248 }
249 
250 
251 void
253  switch (element) {
254  case SUMO_TAG_EDGE:
255  closeEdge();
256  break;
257  case SUMO_TAG_LANE:
260  myLastParameterised.pop_back();
261  }
262  break;
263  case SUMO_TAG_JUNCTION:
264  if (!myCurrentIsBroken) {
265  try {
268  } catch (InvalidArgument& e) {
269  WRITE_ERROR(e.what());
270  }
271  }
273  break;
274  case SUMO_TAG_TLLOGIC:
275  if (!myCurrentIsBroken) {
276  try {
278  } catch (InvalidArgument& e) {
279  WRITE_ERROR(e.what());
280  }
281  }
283  break;
284  case SUMO_TAG_WAUT:
285  closeWAUT();
286  break;
287  case SUMO_TAG_E3DETECTOR:
289  endE3Detector();
290  break;
293  myLastParameterised.pop_back();
294  break;
295  case SUMO_TAG_BUS_STOP:
296  case SUMO_TAG_TRAIN_STOP:
300  myLastParameterised.pop_back();
301  break;
302  case SUMO_TAG_NET:
303  // build junction graph
304  for (JunctionGraph::iterator it = myJunctionGraph.begin(); it != myJunctionGraph.end(); ++it) {
305  MSEdge* edge = MSEdge::dictionary(it->first);
306  MSJunction* from = myJunctionControlBuilder.retrieve(it->second.first);
307  MSJunction* to = myJunctionControlBuilder.retrieve(it->second.second);
308  if (from == nullptr) {
309  WRITE_ERROR("Unknown from-node '" + it->second.first + "' for edge '" + it->first + "'.");
310  return;
311  }
312  if (to == nullptr) {
313  WRITE_ERROR("Unknown to-node '" + it->second.second + "' for edge '" + it->first + "'.");
314  return;
315  }
316  if (edge != nullptr) {
317  edge->setJunctions(from, to);
318  from->addOutgoing(edge);
319  to->addIncoming(edge);
320  }
321  }
322  myNetIsLoaded = true;
323  break;
324  default:
325  break;
326  }
328 }
329 
330 
331 
332 // ---- the root/edge - element
333 void
335  bool ok = true;
336  myCurrentIsBroken = false;
337  // get the id, report an error if not given or empty...
338  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, ok);
339  if (!ok) {
340  myCurrentIsBroken = true;
341  return;
342  }
343  // omit internal edges if not wished
344  if (id[0] == ':') {
345  myHaveSeenInternalEdge = true;
348  return;
349  }
350  std::string junctionID = SUMOXMLDefinitions::getJunctionIDFromInternalEdge(id);
351  myJunctionGraph[id] = std::make_pair(junctionID, junctionID);
352  } else {
353  myJunctionGraph[id] = std::make_pair(
354  attrs.get<std::string>(SUMO_ATTR_FROM, id.c_str(), ok),
355  attrs.get<std::string>(SUMO_ATTR_TO, id.c_str(), ok));
356  if (!ok) {
357  myCurrentIsBroken = true;
358  return;
359  }
360  }
362  // parse the function
363  const SumoXMLEdgeFunc func = attrs.getEdgeFunc(ok);
364  if (!ok) {
365  WRITE_ERROR("Edge '" + id + "' has an invalid type.");
366  myCurrentIsBroken = true;
367  return;
368  }
369  // get the street name
370  const std::string streetName = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), ok, "");
371  // get the edge type
372  const std::string edgeType = attrs.getOpt<std::string>(SUMO_ATTR_TYPE, id.c_str(), ok, "");
373  // get the edge priority (only for visualization)
374  const int priority = attrs.getOpt<int>(SUMO_ATTR_PRIORITY, id.c_str(), ok, -1); // default taken from netbuild/NBFrame option 'default.priority'
375  // get the bidi-edge
376  const std::string bidi = attrs.getOpt<std::string>(SUMO_ATTR_BIDI, id.c_str(), ok, "");
377  // get the kilometrage/mileage (for visualization and output)
378  const double distance = attrs.getOpt<double>(SUMO_ATTR_DISTANCE, id.c_str(), ok, 0);
379  if (!ok) {
380  myCurrentIsBroken = true;
381  return;
382  }
383  //
384  try {
385  myEdgeControlBuilder.beginEdgeParsing(id, func, streetName, edgeType, priority, bidi, distance);
386  } catch (InvalidArgument& e) {
387  WRITE_ERROR(e.what());
388  myCurrentIsBroken = true;
389  }
390 
391  if (func == EDGEFUNC_CROSSING) {
392  //get the crossingEdges attribute (to implement the other side of the road pushbutton)
393  const std::string crossingEdges = attrs.getOpt<std::string>(SUMO_ATTR_CROSSING_EDGES, id.c_str(), ok, "");
394  if (!crossingEdges.empty()) {
395  std::vector<std::string> crossingEdgesVector;
396  StringTokenizer edges(crossingEdges);
397  while (edges.hasNext()) {
398  crossingEdgesVector.push_back(edges.next());
399  }
400  myEdgeControlBuilder.addCrossingEdges(crossingEdgesVector);
401  }
402  }
405 }
406 
407 
408 void
410  myLastParameterised.clear();
411  // omit internal edges if not wished and broken edges
413  return;
414  }
415  try {
417  MSEdge::dictionary(e->getID(), e);
419  } catch (InvalidArgument& e) {
420  WRITE_ERROR(e.what());
421  }
422 }
423 
424 
425 // ---- the root/edge/lanes/lane - element
426 void
428  // omit internal edges if not wished and broken edges
430  return;
431  }
432  bool ok = true;
433  // get the id, report an error if not given or empty...
434  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, ok);
435  if (!ok) {
436  myCurrentIsBroken = true;
437  return;
438  }
439  const double maxSpeed = attrs.get<double>(SUMO_ATTR_SPEED, id.c_str(), ok);
440  const double length = attrs.get<double>(SUMO_ATTR_LENGTH, id.c_str(), ok);
441  const std::string allow = attrs.getOpt<std::string>(SUMO_ATTR_ALLOW, id.c_str(), ok, "", false);
442  const std::string disallow = attrs.getOpt<std::string>(SUMO_ATTR_DISALLOW, id.c_str(), ok, "");
443  const double width = attrs.getOpt<double>(SUMO_ATTR_WIDTH, id.c_str(), ok, SUMO_const_laneWidth);
444  const PositionVector shape = attrs.get<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), ok);
445  const int index = attrs.get<int>(SUMO_ATTR_INDEX, id.c_str(), ok);
446  const bool isRampAccel = attrs.getOpt<bool>(SUMO_ATTR_ACCELERATION, id.c_str(), ok, false);
447  const std::string type = attrs.getOpt<std::string>(SUMO_ATTR_TYPE, id.c_str(), ok, "");
448  if (shape.size() < 2) {
449  WRITE_ERROR("Shape of lane '" + id + "' is broken.\n Can not build according edge.");
450  myCurrentIsBroken = true;
451  return;
452  }
453  const SVCPermissions permissions = parseVehicleClasses(allow, disallow, myNetworkVersion);
454  if (permissions != SVCAll) {
456  }
457  myCurrentIsBroken |= !ok;
458  if (!myCurrentIsBroken) {
459  try {
460  MSLane* lane = myEdgeControlBuilder.addLane(id, maxSpeed, length, shape, width, permissions, index, isRampAccel, type);
461  // insert the lane into the lane-dictionary, checking
462  if (!MSLane::dictionary(id, lane)) {
463  delete lane;
464  WRITE_ERROR("Another lane with the id '" + id + "' exists.");
465  myCurrentIsBroken = true;
466  myLastParameterised.push_back(nullptr);
467  } else {
468  myLastParameterised.push_back(lane);
469  }
470  } catch (InvalidArgument& e) {
471  WRITE_ERROR(e.what());
472  }
473  }
474 }
475 
476 
477 // ---- the root/junction - element
478 void
480  myCurrentIsBroken = false;
481  bool ok = true;
482  // get the id, report an error if not given or empty...
483  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, ok);
484  if (!ok) {
485  myCurrentIsBroken = true;
486  return;
487  }
488  PositionVector shape;
489  if (attrs.hasAttribute(SUMO_ATTR_SHAPE)) {
490  // inner junctions have no shape
491  shape = attrs.getOpt<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), ok, PositionVector());
492  if (shape.size() > 2) {
493  shape.closePolygon();
494  }
495  }
496  double x = attrs.get<double>(SUMO_ATTR_X, id.c_str(), ok);
497  double y = attrs.get<double>(SUMO_ATTR_Y, id.c_str(), ok);
498  double z = attrs.getOpt<double>(SUMO_ATTR_Z, id.c_str(), ok, 0);
499  bool typeOK = true;
500  SumoXMLNodeType type = attrs.getNodeType(typeOK);
501  if (!typeOK) {
502  WRITE_ERROR("An unknown or invalid junction type occurred in junction '" + id + "'.");
503  ok = false;
504  }
505  std::string key = attrs.getOpt<std::string>(SUMO_ATTR_KEY, id.c_str(), ok, "");
506  // incoming lanes
507  std::vector<MSLane*> incomingLanes;
508  parseLanes(id, attrs.getStringSecure(SUMO_ATTR_INCLANES, ""), incomingLanes, ok);
509  // internal lanes
510  std::vector<MSLane*> internalLanes;
512  parseLanes(id, attrs.getStringSecure(SUMO_ATTR_INTLANES, ""), internalLanes, ok);
513  }
514  if (!ok) {
515  myCurrentIsBroken = true;
516  } else {
517  try {
518  myJunctionControlBuilder.openJunction(id, key, type, Position(x, y, z), shape, incomingLanes, internalLanes);
519  } catch (InvalidArgument& e) {
520  WRITE_ERROR(e.what() + std::string("\n Can not build according junction."));
521  myCurrentIsBroken = true;
522  }
523  }
524 }
525 
526 
527 void
528 NLHandler::parseLanes(const std::string& junctionID,
529  const std::string& def, std::vector<MSLane*>& into, bool& ok) {
530  StringTokenizer st(def);
531  while (ok && st.hasNext()) {
532  std::string laneID = st.next();
533  MSLane* lane = MSLane::dictionary(laneID);
534  if (!MSGlobals::gUsingInternalLanes && laneID[0] == ':') {
535  continue;
536  }
537  if (lane == nullptr) {
538  WRITE_ERROR("An unknown lane ('" + laneID + "') was tried to be set as incoming to junction '" + junctionID + "'.");
539  ok = false;
540  continue;
541  }
542  into.push_back(lane);
543  }
544 }
545 // ----
546 
547 void
549  bool ok = true;
550  const std::string key = attrs.get<std::string>(SUMO_ATTR_KEY, nullptr, ok);
551  // circumventing empty string test
552  const std::string val = attrs.hasAttribute(SUMO_ATTR_VALUE) ? attrs.getString(SUMO_ATTR_VALUE) : "";
553  if (myLastParameterised.size() > 0 && myLastParameterised.back() != nullptr) {
554  myLastParameterised.back()->setParameter(key, val);
555  }
556  // set
557  if (ok && myAmParsingTLLogicOrJunction) {
558  assert(key != "");
559  assert(val != "");
561  }
562 }
563 
564 
565 void
567  myCurrentIsBroken = false;
568  bool ok = true;
569  // get the id, report an error if not given or empty...
570  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, ok);
571  if (!ok) {
572  myCurrentIsBroken = true;
573  return;
574  }
575  SUMOTime t = attrs.getOptSUMOTimeReporting(SUMO_ATTR_REF_TIME, id.c_str(), ok, 0);
576  std::string pro = attrs.get<std::string>(SUMO_ATTR_START_PROG, id.c_str(), ok);
577  if (!ok) {
578  myCurrentIsBroken = true;
579  }
580  if (!myCurrentIsBroken) {
581  myCurrentWAUTID = id;
582  try {
584  } catch (InvalidArgument& e) {
585  WRITE_ERROR(e.what());
586  myCurrentIsBroken = true;
587  }
588  }
589 }
590 
591 
592 void
594  bool ok = true;
596  std::string to = attrs.get<std::string>(SUMO_ATTR_TO, myCurrentWAUTID.c_str(), ok);
597  if (!ok) {
598  myCurrentIsBroken = true;
599  }
600  if (!myCurrentIsBroken) {
601  try {
603  } catch (InvalidArgument& e) {
604  WRITE_ERROR(e.what());
605  myCurrentIsBroken = true;
606  }
607  }
608 }
609 
610 
611 void
613  bool ok = true;
614  std::string wautID = attrs.get<std::string>(SUMO_ATTR_WAUT_ID, nullptr, ok);
615  std::string junctionID = attrs.get<std::string>(SUMO_ATTR_JUNCTION_ID, nullptr, ok);
616  std::string procedure = attrs.getOpt<std::string>(SUMO_ATTR_PROCEDURE, nullptr, ok, "");
617  bool synchron = attrs.getOpt<bool>(SUMO_ATTR_SYNCHRON, nullptr, ok, false);
618  if (!ok) {
619  myCurrentIsBroken = true;
620  }
621  try {
622  if (!myCurrentIsBroken) {
623  myJunctionControlBuilder.getTLLogicControlToUse().addWAUTJunction(wautID, junctionID, procedure, synchron);
624  }
625  } catch (InvalidArgument& e) {
626  WRITE_ERROR(e.what());
627  myCurrentIsBroken = true;
628  }
629 }
630 
631 
632 void
634  if (myCurrentIsBroken) {
635  return;
636  }
637  bool ok = true;
638  int request = attrs.get<int>(SUMO_ATTR_INDEX, nullptr, ok);
639  bool cont = false;
640  cont = attrs.getOpt<bool>(SUMO_ATTR_CONT, nullptr, ok, false);
641  std::string response = attrs.get<std::string>(SUMO_ATTR_RESPONSE, nullptr, ok);
642  std::string foes = attrs.get<std::string>(SUMO_ATTR_FOES, nullptr, ok);
643  if (!ok) {
644  return;
645  }
646  // store received information
647  if (request >= 0 && response.length() > 0) {
648  try {
649  myJunctionControlBuilder.addLogicItem(request, response, foes, cont);
650  } catch (InvalidArgument& e) {
651  WRITE_ERROR(e.what());
652  }
653  }
654 }
655 
656 
657 void
659  if (myCurrentIsBroken) {
660  return;
661  }
663  bool ok = true;
664  // we either a have a junction or a legacy network with ROWLogic
665  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, ok);
666  if (ok) {
668  }
669 }
670 
671 
672 void
674  myCurrentIsBroken = false;
676  bool ok = true;
677  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, ok);
678  std::string programID = attrs.getOpt<std::string>(SUMO_ATTR_PROGRAMID, id.c_str(), ok, "<unknown>");
680  std::string typeS;
681  if (myJunctionControlBuilder.getTLLogicControlToUse().get(id, programID) == nullptr) {
682  // SUMO_ATTR_TYPE is not needed when only modifying the offset of an
683  // existing program
684  typeS = attrs.get<std::string>(SUMO_ATTR_TYPE, id.c_str(), ok);
685  if (!ok) {
686  myCurrentIsBroken = true;
687  return;
688  }
689  if (SUMOXMLDefinitions::TrafficLightTypes.hasString(typeS)) {
691  } else {
692  WRITE_ERROR("Traffic light '" + id + "' has unknown type '" + typeS + "'.");
693  }
694  if (MSGlobals::gUseMesoSim && type == TLTYPE_ACTUATED) {
696  WRITE_WARNING("Traffic light type '" + toString(type) + "' cannot be used in mesoscopic simulation. Using '" + toString(TLTYPE_STATIC) + "' as fallback");
698  }
699  type = TLTYPE_STATIC;
700  }
701  }
702  //
703  const SUMOTime offset = attrs.getOptSUMOTimeReporting(SUMO_ATTR_OFFSET, id.c_str(), ok, 0);
704  if (!ok) {
705  myCurrentIsBroken = true;
706  return;
707  }
708  myJunctionControlBuilder.initTrafficLightLogic(id, programID, type, offset);
709 }
710 
711 
712 void
714  // try to get the phase definition
715  bool ok = true;
716  std::string state = attrs.get<std::string>(SUMO_ATTR_STATE, nullptr, ok);
717  if (!ok) {
718  return;
719  }
720  // try to get the phase duration
722  if (duration == 0) {
724  + " for tlLogic '" + myJunctionControlBuilder.getActiveKey()
725  + "' program '" + myJunctionControlBuilder.getActiveSubKey() + "' is zero.");
726  return;
727  }
728  // if the traffic light is an actuated traffic light, try to get
729  // the minimum and maximum durations
730  const SUMOTime minDuration = attrs.getOptSUMOTimeReporting(
732  const SUMOTime maxDuration = attrs.getOptSUMOTimeReporting(
734 
735 
736  const std::vector<int> nextPhases = attrs.getOptIntVector(SUMO_ATTR_NEXT, nullptr, ok);
737  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, nullptr, ok, "");
738 
739  //SOTL attributes
740  //If the type attribute is not present, the parsed phase is of type "undefined" (MSPhaseDefinition constructor),
741  //in this way SOTL traffic light logic can recognize the phase as unsuitable or decides other
742  //behaviors. See SOTL traffic light logic implementations.
743  if (attrs.hasAttribute(SUMO_ATTR_TYPE)) {
744  std::string phaseTypeString;
745  bool transient_notdecisional_bit;
746  bool commit_bit;
747  MSPhaseDefinition::LaneIdVector laneIdVector;
748  try {
749  phaseTypeString = attrs.get<std::string>(SUMO_ATTR_TYPE, "phase", ok, false);
750  } catch (EmptyData&) {
751  MsgHandler::getWarningInstance()->inform("Empty type definition. Assuming phase type as SUMOSOTL_TagAttrDefinitions::SOTL_ATTL_TYPE_TRANSIENT");
752  transient_notdecisional_bit = false;
753  }
754  if (phaseTypeString.find("decisional") != std::string::npos) {
755  transient_notdecisional_bit = false;
756  } else if (phaseTypeString.find("transient") != std::string::npos) {
757  transient_notdecisional_bit = true;
758  } else {
759  MsgHandler::getWarningInstance()->inform("SOTL_ATTL_TYPE_DECISIONAL nor SOTL_ATTL_TYPE_TRANSIENT. Assuming phase type as SUMOSOTL_TagAttrDefinitions::SOTL_ATTL_TYPE_TRANSIENT");
760  transient_notdecisional_bit = false;
761  }
762  commit_bit = (phaseTypeString.find("commit") != std::string::npos);
763 
764  if (phaseTypeString.find("target") != std::string::npos) {
765  std::string delimiter(" ,;");
766  //Phase declared as target, getting targetLanes attribute
767  try {
769  std::string targetLanesString = attrs.getStringSecure(SUMO_ATTR_TARGETLANE, "");
770  //TOKENIZING
771  MSPhaseDefinition::LaneIdVector targetLanesVector;
772  //Skip delimiters at the beginning
773  std::string::size_type firstPos = targetLanesString.find_first_not_of(delimiter, 0);
774  //Find first "non-delimiter".
775  std::string::size_type pos = targetLanesString.find_first_of(delimiter, firstPos);
776 
777  while (std::string::npos != pos || std::string::npos != firstPos) {
778  //Found a token, add it to the vector
779  targetLanesVector.push_back(targetLanesString.substr(firstPos, pos - firstPos));
780 
781  //Skip delimiters
782  firstPos = targetLanesString.find_first_not_of(delimiter, pos);
783 
784  //Find next "non-delimiter"
785  pos = targetLanesString.find_first_of(delimiter, firstPos);
786  }
787  //Adding the SOTL parsed phase to have a new MSPhaseDefinition that is SOTL compliant for target phases
788  myJunctionControlBuilder.addPhase(duration, state, nextPhases, minDuration, maxDuration, name, transient_notdecisional_bit, commit_bit, &targetLanesVector);
789  } catch (EmptyData&) {
790  MsgHandler::getErrorInstance()->inform("Missing targetLane definition for the target phase.");
791  return;
792  }
793  } else {
794  //Adding the SOTL parsed phase to have a new MSPhaseDefinition that is SOTL compliant for non target phases
795  myJunctionControlBuilder.addPhase(duration, state, nextPhases, minDuration, maxDuration, name, transient_notdecisional_bit, commit_bit);
796  }
797  } else {
798  //Adding the standard parsed phase to have a new MSPhaseDefinition
799  myJunctionControlBuilder.addPhase(duration, state, nextPhases, minDuration, maxDuration, name);
800  }
801 }
802 
803 
804 void
806  bool ok = true;
807  // get the id, report an error if not given or empty...
808  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, ok);
809  if (!ok) {
810  return;
811  }
812  const SUMOTime frequency = attrs.getSUMOTimeReporting(SUMO_ATTR_FREQUENCY, id.c_str(), ok);
813  const double position = attrs.get<double>(SUMO_ATTR_POSITION, id.c_str(), ok);
814  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), ok, false);
815  const std::string vTypes = attrs.getOpt<std::string>(SUMO_ATTR_VTYPES, id.c_str(), ok, "");
816  const std::string lane = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), ok);
817  const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), ok);
818  if (!ok) {
819  return;
820  }
821  try {
822  myDetectorBuilder.buildInductLoop(id, lane, position, frequency,
824  friendlyPos, vTypes);
825  } catch (InvalidArgument& e) {
826  WRITE_ERROR(e.what());
827  } catch (IOError& e) {
828  WRITE_ERROR(e.what());
829  }
830 }
831 
832 
833 void
835  bool ok = true;
836  // get the id, report an error if not given or empty...
837  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, ok);
838  if (!ok) {
839  return;
840  }
841  const double position = attrs.get<double>(SUMO_ATTR_POSITION, id.c_str(), ok);
842  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), ok, false);
843  const std::string lane = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), ok);
844  const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), ok);
845  const std::string vTypes = attrs.getOpt<std::string>(SUMO_ATTR_VTYPES, id.c_str(), ok, "");
846  if (!ok) {
847  return;
848  }
849  try {
850  myDetectorBuilder.buildInstantInductLoop(id, lane, position, FileHelpers::checkForRelativity(file, getFileName()), friendlyPos, vTypes);
851  } catch (InvalidArgument& e) {
852  WRITE_ERROR(e.what());
853  } catch (IOError& e) {
854  WRITE_ERROR(e.what());
855  }
856 }
857 
858 
859 void
861  WRITE_WARNING("VTypeProbes are deprecated. Use fcd-output devices (assigned to the vType) instead.");
862  bool ok = true;
863  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, ok);
864  SUMOTime frequency = attrs.getSUMOTimeReporting(SUMO_ATTR_FREQUENCY, id.c_str(), ok);
865  std::string type = attrs.getStringSecure(SUMO_ATTR_TYPE, "");
866  std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), ok);
867  if (!ok) {
868  return;
869  }
870  try {
872  } catch (InvalidArgument& e) {
873  WRITE_ERROR(e.what());
874  } catch (IOError& e) {
875  WRITE_ERROR(e.what());
876  }
877 }
878 
879 
880 void
882  bool ok = true;
883  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, ok);
884  SUMOTime frequency = attrs.getSUMOTimeReporting(SUMO_ATTR_FREQUENCY, id.c_str(), ok);
885  SUMOTime begin = attrs.getOptSUMOTimeReporting(SUMO_ATTR_BEGIN, id.c_str(), ok, -1);
886  std::string edge = attrs.get<std::string>(SUMO_ATTR_EDGE, id.c_str(), ok);
887  std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), ok);
888  const std::string vTypes = attrs.getOpt<std::string>(SUMO_ATTR_VTYPES, id.c_str(), ok, "");
889  if (!ok) {
890  return;
891  }
892  try {
893  myDetectorBuilder.buildRouteProbe(id, edge, frequency, begin,
895  } catch (InvalidArgument& e) {
896  WRITE_ERROR(e.what());
897  } catch (IOError& e) {
898  WRITE_ERROR(e.what());
899  }
900 }
901 
902 
903 
904 void
906 
907  // check whether this is a detector connected to a tls and optionally to a link
908  bool ok = true;
909  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, ok);
910  const std::string lsaid = attrs.getOpt<std::string>(SUMO_ATTR_TLID, id.c_str(), ok, "");
911  const std::string toLane = attrs.getOpt<std::string>(SUMO_ATTR_TO, id.c_str(), ok, "");
912  const SUMOTime haltingTimeThreshold = attrs.getOptSUMOTimeReporting(SUMO_ATTR_HALTING_TIME_THRESHOLD, id.c_str(), ok, TIME2STEPS(1));
913  const double haltingSpeedThreshold = attrs.getOpt<double>(SUMO_ATTR_HALTING_SPEED_THRESHOLD, id.c_str(), ok, 5.0f / 3.6f);
914  const double jamDistThreshold = attrs.getOpt<double>(SUMO_ATTR_JAM_DIST_THRESHOLD, id.c_str(), ok, 10.0f);
915  double position = attrs.getOpt<double>(SUMO_ATTR_POSITION, id.c_str(), ok, std::numeric_limits<double>::max());
916  const double length = attrs.getOpt<double>(SUMO_ATTR_LENGTH, id.c_str(), ok, std::numeric_limits<double>::max());
917  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), ok, false);
918  const bool showDetector = attrs.getOpt<bool>(SUMO_ATTR_SHOW_DETECTOR, id.c_str(), ok, true);
919  const std::string contStr = attrs.getOpt<std::string>(SUMO_ATTR_CONT, id.c_str(), ok, "");
920  if (contStr != "") {
921  WRITE_WARNING("Ignoring deprecated argument 'cont' for E2 detector '" + id + "'");
922  }
923  std::string lane = attrs.getOpt<std::string>(SUMO_ATTR_LANE, id.c_str(), ok, "");
924  const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), ok);
925  const std::string vTypes = attrs.getOpt<std::string>(SUMO_ATTR_VTYPES, id.c_str(), ok, "");
926 
927  double endPosition = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), ok, std::numeric_limits<double>::max());
928  const std::string lanes = attrs.getOpt<std::string>(SUMO_ATTR_LANES, id.c_str(), ok, ""); // lanes has priority to lane
929  if (!ok) {
930  return;
931  }
932 
933  bool lanesGiven = lanes != "";
934  bool laneGiven = lane != "";
935  if (!(lanesGiven || laneGiven)) {
936  // in absence of any lane-specification assume specification by id
937  WRITE_WARNING("Trying to specify detector's lane by the given id since the argument 'lane' is missing.")
938  lane = id;
939  laneGiven = true;
940  }
941  bool lengthGiven = length != std::numeric_limits<double>::max();
942  bool posGiven = position != std::numeric_limits<double>::max();
943  bool endPosGiven = endPosition != std::numeric_limits<double>::max();
944  bool lsaGiven = lsaid != "";
945  bool toLaneGiven = toLane != "";
946 
947  MSLane* clane = nullptr;
948  std::vector<MSLane*> clanes;
949  if (lanesGiven) {
950  // If lanes is given, endPos and startPos are required. lane, and length are ignored
951  std::string seps = " ,\t\n";
952  StringTokenizer st = StringTokenizer(lanes, seps, true);
953 // std::cout << "Parsing lanes..." << std::endl;
954  while (st.hasNext()) {
955  std::string nextLaneID = st.next();
956 // std::cout << "Next: " << nextLaneID << std::endl;
957  if (nextLaneID.find_first_of(seps) != nextLaneID.npos) {
958  continue;
959  }
960  clane = myDetectorBuilder.getLaneChecking(nextLaneID, SUMO_TAG_E2DETECTOR, id);
961  clanes.push_back(clane);
962  }
963  if (clanes.size() == 0) {
964  throw InvalidArgument("Malformed argument 'lanes' for E2Detector '" + id + "'.\nSpecify 'lanes' as a sequence of lane-IDs seperated by whitespace or comma (',')");
965  }
966  if (laneGiven) {
967  WRITE_WARNING("Ignoring argument 'lane' for E2Detector '" + id + "' since argument 'lanes' was given.\n"
968  "Usage combinations for positional specification: [lane, pos, length], [lane, endPos, length], or [lanes, pos, endPos]");
969  }
970  if (lengthGiven) {
971  WRITE_WARNING("Ignoring argument 'length' for E2Detector '" + id + "' since argument 'lanes' was given.\n"
972  "Usage combinations for positional specification: [lane, pos, length], [lane, endPos, length], or [lanes, pos, endPos]");
973  }
974  if (!posGiven) {
975  // assuming start pos == lane start
976  position = 0;
977  WRITE_WARNING("Missing argument 'pos' for E2Detector '" + id + "'. Assuming detector start == lane start of lane '" + clanes[0]->getID() + "'.");
978  }
979  if (!endPosGiven) {
980  // assuming end pos == lane end
981  endPosition = clanes[clanes.size() - 1]->getLength();
982  WRITE_WARNING("Missing argument 'endPos' for E2Detector '" + id + "'. Assuming detector end == lane end of lane '" + clanes[clanes.size() - 1]->getID() + "'.");
983  }
984 
985  } else {
986  if (!laneGiven) {
987  std::stringstream ss;
988  ss << "Missing argument 'lane' for E2Detector '" << id << "'."
989  << "\nUsage combinations for positional specification: [lane, pos, length], [lane, endPos, length], or [lanes, pos, endPos]";
990  throw InvalidArgument(ss.str());
991  }
993 
994  if (posGiven) {
995  // start pos is given
996  if (endPosGiven && lengthGiven) {
997  std::stringstream ss;
998  ss << "Ignoring argument 'endPos' for E2Detector '" << id << "' since argument 'pos' was given."
999  << "\nUsage combinations for positional specification: [lane, pos, length], [lane, endPos, length], or [lanes, pos, endPos]";
1000  WRITE_WARNING(ss.str());
1001  endPosition = std::numeric_limits<double>::max();
1002  }
1003  if (!lengthGiven && !endPosGiven) {
1004  std::stringstream ss;
1005  ss << "Missing arguments 'length'/'endPos' for E2Detector '" << id << "'. Assuming detector end == lane end of lane '" << lane << "'.";
1006  WRITE_WARNING(ss.str());
1007  endPosition = clane->getLength();
1008  }
1009  } else if (endPosGiven) {
1010  // endPos is given, pos is not given
1011  if (!lengthGiven) {
1012  std::stringstream ss;
1013  ss << "Missing arguments 'length'/'pos' for E2Detector '" << id << "'. Assuming detector start == lane start of lane '" << lane << "'.";
1014  WRITE_WARNING(ss.str());
1015  }
1016  } else {
1017  std::stringstream ss;
1018  if (lengthGiven && fabs(length - clane->getLength()) > NUMERICAL_EPS) {
1019  ss << "Incomplete positional specification for E2Detector '" << id << "'."
1020  << "\nUsage combinations for positional specification: [lane, pos, length], [lane, endPos, length], or [lanes, pos, endPos]";
1021  throw InvalidArgument(ss.str());
1022  }
1023  endPosition = clane->getLength();
1024  position = 0;
1025  ss << "Missing arguments 'pos'/'endPos' for E2Detector '" << id << "'. Assuming that the detector covers the whole lane '" << lane << "'.";
1026  WRITE_WARNING(ss.str());
1027  }
1028  }
1029 
1030  // Frequency
1031 
1032  SUMOTime frequency;
1033  if (!lsaGiven) {
1034  frequency = attrs.getSUMOTimeReporting(SUMO_ATTR_FREQUENCY, id.c_str(), ok);
1035  if (!ok) {
1036  return;
1037  }
1038  } else {
1039  frequency = attrs.getSUMOTimeReporting(SUMO_ATTR_FREQUENCY, id.c_str(), ok, false);
1040  }
1041 
1042  // TLS
1043  MSTLLogicControl::TLSLogicVariants* tlls = nullptr;
1044  if (lsaGiven) {
1045  tlls = &myJunctionControlBuilder.getTLLogic(lsaid);
1046  if (tlls->getActive() == nullptr) {
1047  throw InvalidArgument("The detector '" + id + "' refers to an unknown lsa '" + lsaid + "'.");
1048  }
1049  if (frequency != -1) {
1050  WRITE_WARNING("Ignoring argument 'frequency' for E2Detector '" + id + "' since argument 'tl' was given.");
1051  frequency = -1;
1052  }
1053  }
1054 
1055  // Link
1056  MSLane* cToLane = nullptr;
1057  if (toLaneGiven) {
1058  cToLane = myDetectorBuilder.getLaneChecking(toLane, SUMO_TAG_E2DETECTOR, id);
1059  }
1060 
1061  // File
1062  std::string filename;
1063  try {
1064  filename = FileHelpers::checkForRelativity(file, getFileName());
1065  } catch (IOError& e) {
1066  WRITE_ERROR(e.what());
1067  }
1068 
1069  // Build detector
1070  if (lanesGiven) {
1071  // specification by a lane sequence
1072  myDetectorBuilder.buildE2Detector(id, clanes, position, endPosition, filename, frequency,
1073  haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold,
1074  vTypes, friendlyPos, showDetector,
1075  tlls, cToLane);
1076  } else {
1077  // specification by start or end lane
1078  myDetectorBuilder.buildE2Detector(id, clane, position, endPosition, length, filename, frequency,
1079  haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold,
1080  vTypes, friendlyPos, showDetector,
1081  tlls, cToLane);
1082  }
1083 
1084 }
1085 
1086 
1087 void
1089  bool ok = true;
1090  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, ok);
1091  const SUMOTime frequency = attrs.getSUMOTimeReporting(SUMO_ATTR_FREQUENCY, id.c_str(), ok);
1092  const SUMOTime haltingTimeThreshold = attrs.getOptSUMOTimeReporting(SUMO_ATTR_HALTING_TIME_THRESHOLD, id.c_str(), ok, TIME2STEPS(1));
1093  const double haltingSpeedThreshold = attrs.getOpt<double>(SUMO_ATTR_HALTING_SPEED_THRESHOLD, id.c_str(), ok, 5.0f / 3.6f);
1094  const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), ok);
1095  const std::string vTypes = attrs.getOpt<std::string>(SUMO_ATTR_VTYPES, id.c_str(), ok, "");
1096  const bool openEntry = attrs.getOpt<bool>(SUMO_ATTR_OPEN_ENTRY, id.c_str(), ok, false);
1097  if (!ok) {
1098  return;
1099  }
1100  try {
1103  frequency, haltingSpeedThreshold, haltingTimeThreshold, vTypes, openEntry);
1104  } catch (InvalidArgument& e) {
1105  WRITE_ERROR(e.what());
1106  } catch (IOError& e) {
1107  WRITE_ERROR(e.what());
1108  }
1109 }
1110 
1111 
1112 void
1114  bool ok = true;
1115  const double position = attrs.get<double>(SUMO_ATTR_POSITION, myDetectorBuilder.getCurrentE3ID().c_str(), ok);
1116  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, myDetectorBuilder.getCurrentE3ID().c_str(), ok, false);
1117  const std::string lane = attrs.get<std::string>(SUMO_ATTR_LANE, myDetectorBuilder.getCurrentE3ID().c_str(), ok);
1118  if (!ok) {
1119  return;
1120  }
1121  myDetectorBuilder.addE3Entry(lane, position, friendlyPos);
1122 }
1123 
1124 
1125 void
1127  bool ok = true;
1128  const double position = attrs.get<double>(SUMO_ATTR_POSITION, myDetectorBuilder.getCurrentE3ID().c_str(), ok);
1129  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, myDetectorBuilder.getCurrentE3ID().c_str(), ok, false);
1130  const std::string lane = attrs.get<std::string>(SUMO_ATTR_LANE, myDetectorBuilder.getCurrentE3ID().c_str(), ok);
1131  if (!ok) {
1132  return;
1133  }
1134  myDetectorBuilder.addE3Exit(lane, position, friendlyPos);
1135 }
1136 
1137 
1138 void
1139 NLHandler::addEdgeLaneMeanData(const SUMOSAXAttributes& attrs, int objecttype) {
1140  bool ok = true;
1141  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, ok);
1142  const double maxTravelTime = attrs.getOpt<double>(SUMO_ATTR_MAX_TRAVELTIME, id.c_str(), ok, 100000);
1143  const double minSamples = attrs.getOpt<double>(SUMO_ATTR_MIN_SAMPLES, id.c_str(), ok, 0);
1144  const double haltingSpeedThreshold = attrs.getOpt<double>(SUMO_ATTR_HALTING_SPEED_THRESHOLD, id.c_str(), ok, POSITION_EPS);
1145  const std::string excludeEmpty = attrs.getOpt<std::string>(SUMO_ATTR_EXCLUDE_EMPTY, id.c_str(), ok, "false");
1146  const bool withInternal = attrs.getOpt<bool>(SUMO_ATTR_WITH_INTERNAL, id.c_str(), ok, false);
1147  const bool trackVehicles = attrs.getOpt<bool>(SUMO_ATTR_TRACK_VEHICLES, id.c_str(), ok, false);
1148  const std::string detectPersonsString = attrs.getOpt<std::string>(SUMO_ATTR_DETECT_PERSONS, id.c_str(), ok, "");
1149  const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), ok);
1150  const std::string type = attrs.getOpt<std::string>(SUMO_ATTR_TYPE, id.c_str(), ok, "performance");
1151  std::string vtypes = attrs.getOpt<std::string>(SUMO_ATTR_VTYPES, id.c_str(), ok, "");
1152  const SUMOTime frequency = attrs.getOptSUMOTimeReporting(SUMO_ATTR_FREQUENCY, id.c_str(), ok, -1);
1153  const SUMOTime begin = attrs.getOptSUMOTimeReporting(SUMO_ATTR_BEGIN, id.c_str(), ok, string2time(OptionsCont::getOptions().getString("begin")));
1154  const SUMOTime end = attrs.getOptSUMOTimeReporting(SUMO_ATTR_END, id.c_str(), ok, string2time(OptionsCont::getOptions().getString("end")));
1155  if (!ok) {
1156  return;
1157  }
1158  int detectPersons = 0;
1159  for (std::string mode : StringTokenizer(detectPersonsString).getVector()) {
1160  if (SUMOXMLDefinitions::PersonModeValues.hasString(mode)) {
1161  detectPersons |= SUMOXMLDefinitions::PersonModeValues.get(mode);
1162  } else {
1163  WRITE_ERROR("Invalid person mode '" + mode + "' in edgeData definition '" + id + "'");
1164  return;
1165  }
1166  }
1167  try {
1168  myDetectorBuilder.createEdgeLaneMeanData(id, frequency, begin, end,
1169  type, objecttype == SUMO_TAG_MEANDATA_LANE,
1170  // equivalent to TplConvert::_2bool used in SUMOSAXAttributes::getBool
1171  excludeEmpty[0] != 't' && excludeEmpty[0] != 'T' && excludeEmpty[0] != '1' && excludeEmpty[0] != 'x',
1172  excludeEmpty == "defaults", withInternal, trackVehicles, detectPersons,
1173  maxTravelTime, minSamples, haltingSpeedThreshold, vtypes,
1175  } catch (InvalidArgument& e) {
1176  WRITE_ERROR(e.what());
1177  } catch (IOError& e) {
1178  WRITE_ERROR(e.what());
1179  }
1180 }
1181 
1182 
1183 void
1185  bool ok = true;
1186  const std::string fromID = attrs.get<std::string>(SUMO_ATTR_FROM, nullptr, ok);
1187  const std::string toID = attrs.get<std::string>(SUMO_ATTR_TO, nullptr, ok);
1188  if (!MSGlobals::gUsingInternalLanes && (fromID[0] == ':' || toID[0] == ':')) {
1189  std::string tlID = attrs.getOpt<std::string>(SUMO_ATTR_TLID, nullptr, ok, "");
1190  if (tlID != "") {
1191  int tlLinkIdx = attrs.get<int>(SUMO_ATTR_TLLINKINDEX, nullptr, ok);
1193  }
1194  return;
1195  }
1196 
1197  MSLink* link = nullptr;
1198  try {
1199  const int fromLaneIdx = attrs.get<int>(SUMO_ATTR_FROM_LANE, nullptr, ok);
1200  const double foeVisibilityDistance = attrs.getOpt<double>(SUMO_ATTR_VISIBILITY_DISTANCE, nullptr, ok, 4.5);
1201  const int toLaneIdx = attrs.get<int>(SUMO_ATTR_TO_LANE, nullptr, ok);
1202  LinkDirection dir = parseLinkDir(attrs.get<std::string>(SUMO_ATTR_DIR, nullptr, ok));
1203  LinkState state = parseLinkState(attrs.get<std::string>(SUMO_ATTR_STATE, nullptr, ok));
1204  bool keepClear = attrs.getOpt<bool>(SUMO_ATTR_KEEP_CLEAR, nullptr, ok, true);
1205  std::string tlID = attrs.getOpt<std::string>(SUMO_ATTR_TLID, nullptr, ok, "");
1206  std::string viaID = attrs.getOpt<std::string>(SUMO_ATTR_VIA, nullptr, ok, "");
1207 
1208  MSEdge* from = MSEdge::dictionary(fromID);
1209  if (from == nullptr) {
1210  WRITE_ERROR("Unknown from-edge '" + fromID + "' in connection.");
1211  return;
1212  }
1213  MSEdge* to = MSEdge::dictionary(toID);
1214  if (to == nullptr) {
1215  WRITE_ERROR("Unknown to-edge '" + toID + "' in connection.");
1216  return;
1217  }
1218  if (fromLaneIdx < 0 || fromLaneIdx >= (int)from->getLanes().size() ||
1219  toLaneIdx < 0 || toLaneIdx >= (int)to->getLanes().size()) {
1220  WRITE_ERROR("Invalid lane index in connection from '" + from->getID() + "' to '" + to->getID() + "'.");
1221  return;
1222  }
1223  MSLane* fromLane = from->getLanes()[fromLaneIdx];
1224  MSLane* toLane = to->getLanes()[toLaneIdx];
1225  assert(fromLane);
1226  assert(toLane);
1227 
1228  MSTrafficLightLogic* logic = nullptr;
1229  int tlLinkIdx = -1;
1230  if (tlID != "") {
1231  tlLinkIdx = attrs.get<int>(SUMO_ATTR_TLLINKINDEX, nullptr, ok);
1232  // make sure that the index is in range
1234  if ((tlLinkIdx < 0 || tlLinkIdx >= (int)logic->getCurrentPhaseDef().getState().size())
1235  && logic->getLogicType() != TLTYPE_RAIL_SIGNAL
1236  && logic->getLogicType() != TLTYPE_RAIL_CROSSING) {
1237  WRITE_ERROR("Invalid " + toString(SUMO_ATTR_TLLINKINDEX) + " '" + toString(tlLinkIdx) +
1238  "' in connection controlled by '" + tlID + "'");
1239  return;
1240  }
1241  if (!ok) {
1242  return;
1243  }
1244  }
1245  double length;
1246  // build the link
1247  MSLane* via = nullptr;
1248  if (viaID != "" && MSGlobals::gUsingInternalLanes) {
1249  via = MSLane::dictionary(viaID);
1250  if (via == nullptr) {
1251  WRITE_ERROR("An unknown lane ('" + viaID +
1252  "') should be set as a via-lane for lane '" + toLane->getID() + "'.");
1253  return;
1254  }
1255  length = via->getLength();
1256  } else {
1257  length = fromLane->getShape()[-1].distanceTo(toLane->getShape()[0]);
1258  }
1259  link = new MSLink(fromLane, toLane, via, dir, state, length, foeVisibilityDistance, keepClear, logic, tlLinkIdx);
1260  if (via != nullptr) {
1261  via->addIncomingLane(fromLane, link);
1262  } else {
1263  toLane->addIncomingLane(fromLane, link);
1264  }
1265  toLane->addApproachingLane(fromLane, myNetworkVersion < 0.25);
1266 
1267  // if a traffic light is responsible for it, inform the traffic light
1268  // check whether this link is controlled by a traffic light
1269  // we can not reuse logic here because it might be an inactive one
1270  if (tlID != "") {
1271  myJunctionControlBuilder.getTLLogic(tlID).addLink(link, fromLane, tlLinkIdx);
1272  }
1273  // add the link
1274  fromLane->addLink(link);
1275 
1276  } catch (InvalidArgument& e) {
1277  WRITE_ERROR(e.what());
1278  }
1279 }
1280 
1281 
1283 NLHandler::parseLinkDir(const std::string& dir) {
1284  if (SUMOXMLDefinitions::LinkDirections.hasString(dir)) {
1286  } else {
1287  throw InvalidArgument("Unrecognised link direction '" + dir + "'.");
1288  }
1289 }
1290 
1291 
1292 LinkState
1293 NLHandler::parseLinkState(const std::string& state) {
1294  if (SUMOXMLDefinitions::LinkStates.hasString(state)) {
1295  return SUMOXMLDefinitions::LinkStates.get(state);
1296  } else {
1297  if (state == "t") { // legacy networks
1298  // WRITE_WARNING("Obsolete link state 't'. Use 'o' instead");
1300  } else {
1301  throw InvalidArgument("Unrecognised link state '" + state + "'.");
1302  }
1303  }
1304 }
1305 
1306 
1307 // ----------------------------------
1308 void
1310  if (myNetIsLoaded) {
1311  //WRITE_WARNING("POIs and Polygons should be loaded using option --po-files")
1312  return;
1313  }
1314  bool ok = true;
1315  PositionVector s = attrs.get<PositionVector>(SUMO_ATTR_NET_OFFSET, nullptr, ok);
1316  Boundary convBoundary = attrs.get<Boundary>(SUMO_ATTR_CONV_BOUNDARY, nullptr, ok);
1317  Boundary origBoundary = attrs.get<Boundary>(SUMO_ATTR_ORIG_BOUNDARY, nullptr, ok);
1318  std::string proj = attrs.get<std::string>(SUMO_ATTR_ORIG_PROJ, nullptr, ok);
1319  if (ok) {
1320  Position networkOffset = s[0];
1321  GeoConvHelper::init(proj, networkOffset, origBoundary, convBoundary);
1322  if (OptionsCont::getOptions().getBool("fcd-output.geo") && !GeoConvHelper::getFinal().usingGeoProjection()) {
1323  WRITE_WARNING("no valid geo projection loaded from network. fcd-output.geo will not work");
1324  }
1325  }
1326 }
1327 
1328 
1329 void
1331  bool ok = true;
1332  myCurrentIsBroken = false;
1333  // get the id, report an error if not given or empty...
1334  myCurrentDistrictID = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, ok);
1335  if (!ok) {
1336  myCurrentIsBroken = true;
1337  return;
1338  }
1339  try {
1340  MSEdge* sink = myEdgeControlBuilder.buildEdge(myCurrentDistrictID + "-sink", EDGEFUNC_CONNECTOR, "", "", -1, 0);
1341  if (!MSEdge::dictionary(myCurrentDistrictID + "-sink", sink)) {
1342  delete sink;
1343  throw InvalidArgument("Another edge with the id '" + myCurrentDistrictID + "-sink' exists.");
1344  }
1345  sink->initialize(new std::vector<MSLane*>());
1346  MSEdge* source = myEdgeControlBuilder.buildEdge(myCurrentDistrictID + "-source", EDGEFUNC_CONNECTOR, "", "", -1, 0);
1347  if (!MSEdge::dictionary(myCurrentDistrictID + "-source", source)) {
1348  delete source;
1349  throw InvalidArgument("Another edge with the id '" + myCurrentDistrictID + "-source' exists.");
1350  }
1351  source->initialize(new std::vector<MSLane*>());
1352  if (attrs.hasAttribute(SUMO_ATTR_EDGES)) {
1353  std::vector<std::string> desc = attrs.getStringVector(SUMO_ATTR_EDGES);
1354  for (std::vector<std::string>::const_iterator i = desc.begin(); i != desc.end(); ++i) {
1355  MSEdge* edge = MSEdge::dictionary(*i);
1356  // check whether the edge exists
1357  if (edge == nullptr) {
1358  throw InvalidArgument("The edge '" + *i + "' within district '" + myCurrentDistrictID + "' is not known.");
1359  }
1360  source->addSuccessor(edge);
1361  edge->addSuccessor(sink);
1362  }
1363  }
1364  RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, myCurrentDistrictID.c_str(), ok, RGBColor::parseColor("1.0,.33,.33"));
1365  source->setParameter("tazColor", toString(color));
1366  sink->setParameter("tazColor", toString(color));
1367 
1368  if (attrs.hasAttribute(SUMO_ATTR_SHAPE)) {
1370  if (shape.size() != 0) {
1371  if (!myNet.getShapeContainer().addPolygon(myCurrentDistrictID, "taz", color, 0, 0, "", false, shape, false, false, 1.0)) {
1372  WRITE_WARNING("Skipping visualization of taz '" + myCurrentDistrictID + "', polygon already exists.");
1373  }
1374  }
1375  }
1376  } catch (InvalidArgument& e) {
1377  WRITE_ERROR(e.what());
1378  myCurrentIsBroken = true;
1379  }
1380 }
1381 
1382 
1383 void
1384 NLHandler::addDistrictEdge(const SUMOSAXAttributes& attrs, bool isSource) {
1385  if (myCurrentIsBroken) {
1386  // earlier error
1387  return;
1388  }
1389  bool ok = true;
1390  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, myCurrentDistrictID.c_str(), ok);
1391  MSEdge* succ = MSEdge::dictionary(id);
1392  if (succ != nullptr) {
1393  // connect edge
1394  if (isSource) {
1395  MSEdge::dictionary(myCurrentDistrictID + "-source")->addSuccessor(succ);
1396  } else {
1397  succ->addSuccessor(MSEdge::dictionary(myCurrentDistrictID + "-sink"));
1398  }
1399  } else {
1400  WRITE_ERROR("At district '" + myCurrentDistrictID + "': succeeding edge '" + id + "' does not exist.");
1401  }
1402 }
1403 
1404 
1405 void
1407  if (attrs.hasAttribute(SUMO_ATTR_EDGES)) {
1408  std::vector<std::string> edgeIDs = attrs.getStringVector(SUMO_ATTR_EDGES);
1409  for (std::vector<std::string>::iterator it = edgeIDs.begin(); it != edgeIDs.end(); ++it) {
1410  MSEdge* edge = MSEdge::dictionary(*it);
1411  if (edge == nullptr) {
1412  WRITE_ERROR("Unknown edge '" + (*it) + "' in roundabout");
1413  } else {
1414  edge->markAsRoundabout();
1415  }
1416  }
1417  } else {
1418  WRITE_ERROR("Empty edges in roundabout.");
1419  }
1420 }
1421 
1422 
1423 // ----------------------------------
1424 void
1426  try {
1428  } catch (InvalidArgument& e) {
1429  WRITE_ERROR(e.what());
1430  }
1431 }
1432 
1433 
1434 void
1436  if (!myCurrentIsBroken) {
1437  try {
1439  } catch (InvalidArgument& e) {
1440  WRITE_ERROR(e.what());
1441  myCurrentIsBroken = true;
1442  }
1443  }
1444  myCurrentWAUTID = "";
1445 }
1446 
1447 
1448 Position
1449 NLShapeHandler::getLanePos(const std::string& poiID, const std::string& laneID, double lanePos, double lanePosLat) {
1450  MSLane* lane = MSLane::dictionary(laneID);
1451  if (lane == nullptr) {
1452  WRITE_ERROR("Lane '" + laneID + "' to place poi '" + poiID + "' on is not known.");
1453  return Position::INVALID;
1454  }
1455  if (lanePos < 0) {
1456  lanePos = lane->getLength() + lanePos;
1457  }
1458  if (lanePos < 0 || lanePos > lane->getLength()) {
1459  WRITE_WARNING("lane position " + toString(lanePos) + " for poi '" + poiID + "' is not valid.");
1460  }
1461  return lane->geometryPositionAtOffset(lanePos, -lanePosLat);
1462 }
1463 /****************************************************************************/
SUMO_TAG_TRAIN_STOP
@ SUMO_TAG_TRAIN_STOP
A train stop (alias for bus stop)
Definition: SUMOXMLDefinitions.h:99
NLHandler::openJunction
virtual void openJunction(const SUMOSAXAttributes &attrs)
opens a junction for processing
Definition: NLHandler.cpp:479
MSTLLogicControl::addWAUTSwitch
void addWAUTSwitch(const std::string &wautid, SUMOTime when, const std::string &to)
Adds a WAUT switch step to a previously built WAUT.
Definition: MSTLLogicControl.cpp:701
NLJunctionControlBuilder::initTrafficLightLogic
void initTrafficLightLogic(const std::string &id, const std::string &programID, TrafficLightType type, SUMOTime offset)
Begins the reading of a traffic lights logic.
Definition: NLJunctionControlBuilder.cpp:388
NLHandler::myHaveSeenInternalEdge
bool myHaveSeenInternalEdge
whether the loaded network contains internal lanes
Definition: NLHandler.h:331
SUMO_ATTR_TYPE
@ SUMO_ATTR_TYPE
Definition: SUMOXMLDefinitions.h:381
SUMOSAXAttributes::getStringVector
const std::vector< std::string > getStringVector(int attr) const
Tries to read given attribute assuming it is a string vector.
Definition: SUMOSAXAttributes.cpp:113
SUMO_ATTR_JUNCTION_ID
@ SUMO_ATTR_JUNCTION_ID
Definition: SUMOXMLDefinitions.h:758
NLHandler::myLastEdgeParameters
Parameterised myLastEdgeParameters
Definition: NLHandler.h:327
SUMOVehicleClass
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
Definition: SUMOVehicleClass.h:133
SUMO_TAG_STOPOFFSET
@ SUMO_TAG_STOPOFFSET
Information on vClass specific stop offsets at lane end.
Definition: SUMOXMLDefinitions.h:230
GUIGlObject.h
MSLane::dictionary
static bool dictionary(const std::string &id, MSLane *lane)
Static (sic!) container methods {.
Definition: MSLane.cpp:1866
SUMO_ATTR_ACCELERATION
@ SUMO_ATTR_ACCELERATION
Definition: SUMOXMLDefinitions.h:892
SUMOSAXAttributes::hasAttribute
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list.
NLDetectorBuilder::getLaneChecking
MSLane * getLaneChecking(const std::string &laneID, SumoXMLTag type, const std::string &detid)
Returns the named lane.
Definition: NLDetectorBuilder.cpp:514
SUMO_ATTR_HALTING_SPEED_THRESHOLD
@ SUMO_ATTR_HALTING_SPEED_THRESHOLD
Definition: SUMOXMLDefinitions.h:751
NLEdgeControlBuilder::addLane
virtual MSLane * addLane(const std::string &id, double maxSpeed, double length, const PositionVector &shape, double width, SVCPermissions permissions, int index, bool isRampAccel, const std::string &type)
Adds a lane to the current edge.
Definition: NLEdgeControlBuilder.cpp:79
SUMO_TAG_WAUT_SWITCH
@ SUMO_TAG_WAUT_SWITCH
Definition: SUMOXMLDefinitions.h:171
getVehicleClassID
SUMOVehicleClass getVehicleClassID(const std::string &name)
Returns the class id of the abstract class given by its name.
Definition: SUMOVehicleClass.cpp:200
SUMO_ATTR_DISALLOW
@ SUMO_ATTR_DISALLOW
Definition: SUMOXMLDefinitions.h:783
WRITE_WARNING
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:275
NLHandler::addRequest
void addRequest(const SUMOSAXAttributes &attrs)
adds a request item to the current junction logic
Definition: NLHandler.cpp:633
SUMOXMLDefinitions::LinkStates
static StringBijection< LinkState > LinkStates
link states
Definition: SUMOXMLDefinitions.h:1386
SUMOTime.h
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:82
NLEdgeControlBuilder::addNeigh
virtual void addNeigh(const std::string id)
Adds a neighbor to the current lane.
Definition: NLEdgeControlBuilder.cpp:157
LINKSTATE_TL_OFF_BLINKING
@ LINKSTATE_TL_OFF_BLINKING
The link is controlled by a tls which is off and blinks, has to brake.
Definition: SUMOXMLDefinitions.h:1151
SUMOSAXAttributes::getString
virtual std::string getString(int id) const =0
Returns the string-value of the named (by its enum-value) attribute.
SUMO_ATTR_LENGTH
@ SUMO_ATTR_LENGTH
Definition: SUMOXMLDefinitions.h:393
SUMO_ATTR_INCLANES
@ SUMO_ATTR_INCLANES
Definition: SUMOXMLDefinitions.h:415
NLTriggerBuilder::parseAndBeginParkingArea
void parseAndBeginParkingArea(MSNet &net, const SUMOSAXAttributes &attrs)
Parses his values and builds a parking area.
Definition: NLTriggerBuilder.cpp:228
NLEdgeControlBuilder
Interface for building edges.
Definition: NLEdgeControlBuilder.h:57
NLDetectorBuilder::buildInductLoop
void buildInductLoop(const std::string &id, const std::string &lane, double pos, SUMOTime splInterval, const std::string &device, bool friendlyPos, const std::string &vTypes)
Builds an e1 detector and adds it to the net.
Definition: NLDetectorBuilder.cpp:94
MSJunction
The base class for an intersection.
Definition: MSJunction.h:60
EDGEFUNC_CROSSING
@ EDGEFUNC_CROSSING
Definition: SUMOXMLDefinitions.h:1083
GeomConvHelper.h
NLHandler::myLefthand
bool myLefthand
whether the loaded network was built for left hand traffic
Definition: NLHandler.h:340
NUMERICAL_EPS
#define NUMERICAL_EPS
Definition: config.h:148
MSNet::getShapeContainer
ShapeContainer & getShapeContainer()
Returns the shapes container.
Definition: MSNet.h:459
NLDetectorBuilder::addE3Entry
void addE3Entry(const std::string &lane, double pos, bool friendlyPos)
Builds an entry point of an e3 detector.
Definition: NLDetectorBuilder.cpp:297
SUMO_ATTR_NET_OFFSET
@ SUMO_ATTR_NET_OFFSET
Definition: SUMOXMLDefinitions.h:827
Position::INVALID
static const Position INVALID
used to indicate that a position is valid
Definition: Position.h:284
SUMO_TAG_PARAM
@ SUMO_TAG_PARAM
parameter associated to a certain key
Definition: SUMOXMLDefinitions.h:169
StringTokenizer::hasNext
bool hasNext()
returns the information whether further substrings exist
Definition: StringTokenizer.cpp:94
NLHandler::myCurrentDistrictID
std::string myCurrentDistrictID
The id of the current district.
Definition: NLHandler.h:306
TLTYPE_STATIC
@ TLTYPE_STATIC
Definition: SUMOXMLDefinitions.h:1198
NLHandler::myHaveSeenNeighs
bool myHaveSeenNeighs
whether the loaded network contains explicit neighbor lanes
Definition: NLHandler.h:334
SUMOSAXAttributes::get
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
Definition: SUMOSAXAttributes.h:492
SUMO_ATTR_TO_LANE
@ SUMO_ATTR_TO_LANE
Definition: SUMOXMLDefinitions.h:720
MSJunctionLogic.h
NLTriggerBuilder::addAccess
void addAccess(MSNet &net, const SUMOSAXAttributes &attrs)
Parses the values and adds an access point to the currently parsed stopping place.
Definition: NLTriggerBuilder.cpp:202
SUMOSAXAttributes::getOptIntVector
const std::vector< int > getOptIntVector(int attr, const char *objectid, bool &ok, bool report=true) const
convenience function to avoid the default argument and the template stuff at getOpt<>
Definition: SUMOSAXAttributes.cpp:142
MsgHandler.h
SUMO_ATTR_OPEN_ENTRY
@ SUMO_ATTR_OPEN_ENTRY
Definition: SUMOXMLDefinitions.h:754
SUMO_TAG_TAZSOURCE
@ SUMO_TAG_TAZSOURCE
a source within a district (connection road)
Definition: SUMOXMLDefinitions.h:135
MSNet
The simulated network and simulation perfomer.
Definition: MSNet.h:91
NLHandler::myTriggerBuilder
NLTriggerBuilder & myTriggerBuilder
The trigger builder to use.
Definition: NLHandler.h:297
SUMO_TAG_CONTAINER_STOP
@ SUMO_TAG_CONTAINER_STOP
A container stop.
Definition: SUMOXMLDefinitions.h:105
SUMO_TAG_LANE_AREA_DETECTOR
@ SUMO_TAG_LANE_AREA_DETECTOR
alternative tag for e2 detector
Definition: SUMOXMLDefinitions.h:71
NLJunctionControlBuilder::closeJunctionLogic
void closeJunctionLogic()
Ends the building of a junction logic (row-logic)
Definition: NLJunctionControlBuilder.cpp:421
NLHandler::addInstantE1Detector
virtual void addInstantE1Detector(const SUMOSAXAttributes &attrs)
Builds an e1 detector using the given specification.
Definition: NLHandler.cpp:834
SUMO_ATTR_START_PROG
@ SUMO_ATTR_START_PROG
Definition: SUMOXMLDefinitions.h:762
MSTLLogicControl::addWAUTJunction
void addWAUTJunction(const std::string &wautid, const std::string &tls, const std::string &proc, bool synchron)
Adds a tls to the list of tls to be switched by the named WAUT.
Definition: MSTLLogicControl.cpp:717
SUMO_ATTR_Z
@ SUMO_ATTR_Z
Definition: SUMOXMLDefinitions.h:400
NLHandler::addRouteProbeDetector
virtual void addRouteProbeDetector(const SUMOSAXAttributes &attrs)
Builds a routeProbe-detector using the given specification.
Definition: NLHandler.cpp:881
NLHandler::beginE3Detector
void beginE3Detector(const SUMOSAXAttributes &attrs)
Starts building of an e3 detector using the given specification.
Definition: NLHandler.cpp:1088
SUMOSAXHandler.h
NLHandler::setLocation
void setLocation(const SUMOSAXAttributes &attrs)
Parses network location description.
Definition: NLHandler.cpp:1309
SUMO_TAG_LANE
@ SUMO_TAG_LANE
begin/end of the description of a single lane
Definition: SUMOXMLDefinitions.h:49
SUMO_ATTR_REF_TIME
@ SUMO_ATTR_REF_TIME
Definition: SUMOXMLDefinitions.h:761
MsgHandler::inform
virtual void inform(std::string msg, bool addType=true)
adds a new error to the list
Definition: MsgHandler.cpp:118
TrafficLightType
TrafficLightType
Definition: SUMOXMLDefinitions.h:1197
NLHandler::addE2Detector
virtual void addE2Detector(const SUMOSAXAttributes &attrs)
Builds an e2 detector using the given specification.
Definition: NLHandler.cpp:905
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:34
SUMO_ATTR_EDGE
@ SUMO_ATTR_EDGE
Definition: SUMOXMLDefinitions.h:423
SUMO_ATTR_TLID
@ SUMO_ATTR_TLID
link,node: the traffic light id responsible for this link
Definition: SUMOXMLDefinitions.h:682
GeoConvHelper.h
NLEdgeControlBuilder::addCrossingEdges
virtual void addCrossingEdges(const std::vector< std::string > &)
add the crossingEdges in a crossing edge if present
Definition: NLEdgeControlBuilder.cpp:229
SUMO_TAG_WAUT_JUNCTION
@ SUMO_TAG_WAUT_JUNCTION
Definition: SUMOXMLDefinitions.h:172
SumoXMLEdgeFunc
SumoXMLEdgeFunc
Numbers representing special SUMO-XML-attribute values for representing edge functions used in netbui...
Definition: SUMOXMLDefinitions.h:1079
NLHandler::addDistrictEdge
void addDistrictEdge(const SUMOSAXAttributes &attrs, bool isSource)
Definition: NLHandler.cpp:1384
NLHandler::addParam
void addParam(const SUMOSAXAttributes &attrs)
Definition: NLHandler.cpp:548
NLHandler::addDistrict
void addDistrict(const SUMOSAXAttributes &attrs)
Definition: NLHandler.cpp:1330
MSJunction::addOutgoing
void addOutgoing(MSEdge *edge)
Definition: MSJunction.h:121
SUMO_ATTR_COLOR
@ SUMO_ATTR_COLOR
A color information.
Definition: SUMOXMLDefinitions.h:704
EmptyData
Definition: UtilExceptions.h:68
OptionsCont::getOptions
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:57
SUMO_ATTR_MINDURATION
@ SUMO_ATTR_MINDURATION
Definition: SUMOXMLDefinitions.h:732
StringTokenizer::next
std::string next()
returns the next substring when it exists. Otherwise the behaviour is undefined
Definition: StringTokenizer.cpp:99
FileHelpers::checkForRelativity
static std::string checkForRelativity(const std::string &filename, const std::string &basePath)
Returns the path from a configuration so that it is accessable from the current working directory.
Definition: FileHelpers.cpp:152
SUMO_const_laneWidth
const double SUMO_const_laneWidth
Definition: StdDefs.h:49
MSGlobals::gUseMesoSim
static bool gUseMesoSim
Definition: MSGlobals.h:90
SUMO_ATTR_SPEED
@ SUMO_ATTR_SPEED
Definition: SUMOXMLDefinitions.h:384
NLEdgeControlBuilder::buildEdge
virtual MSEdge * buildEdge(const std::string &id, const SumoXMLEdgeFunc function, const std::string &streetName, const std::string &edgeType, const int priority, const double distance)
Builds an edge instance (MSEdge in this case)
Definition: NLEdgeControlBuilder.cpp:224
NLTriggerBuilder
Builds trigger objects for microsim.
Definition: NLTriggerBuilder.h:61
SUMO_ATTR_VISIBILITY_DISTANCE
@ SUMO_ATTR_VISIBILITY_DISTANCE
foe visibility distance of a link
Definition: SUMOXMLDefinitions.h:710
SUMO_ATTR_ID
@ SUMO_ATTR_ID
Definition: SUMOXMLDefinitions.h:378
MSEdge::setJunctions
void setJunctions(MSJunction *from, MSJunction *to)
Definition: MSEdge.cpp:1019
MSJunction::addIncoming
void addIncoming(MSEdge *edge)
Definition: MSJunction.h:117
MSPhaseDefinition::LaneIdVector
std::vector< std::string > LaneIdVector
Definition: MSPhaseDefinition.h:66
SUMO_TAG_DET_ENTRY
@ SUMO_TAG_DET_ENTRY
an e3 entry point
Definition: SUMOXMLDefinitions.h:81
NLTriggerBuilder::parseAndAddLotEntry
void parseAndAddLotEntry(const SUMOSAXAttributes &attrs)
Parses his values and adds a lot entry to current parking area.
Definition: NLTriggerBuilder.cpp:258
NLHandler::openWAUT
virtual void openWAUT(const SUMOSAXAttributes &attrs)
Definition: NLHandler.cpp:566
SUMO_ATTR_LANE
@ SUMO_ATTR_LANE
Definition: SUMOXMLDefinitions.h:637
NLHandler::myNetIsLoaded
bool myNetIsLoaded
whether the location element was already loadee
Definition: NLHandler.h:346
NLHandler::addPhase
void addPhase(const SUMOSAXAttributes &attrs)
adds a phase to the traffic lights logic currently build
Definition: NLHandler.cpp:713
LinkDirection
LinkDirection
The different directions a link between two lanes may take (or a stream between two edges)....
Definition: SUMOXMLDefinitions.h:1176
NLHandler::myLastParameterised
std::vector< Parameterised * > myLastParameterised
Definition: NLHandler.h:328
NLHandler::closeEdge
virtual void closeEdge()
Closes the process of building an edge.
Definition: NLHandler.cpp:409
TLTYPE_RAIL_SIGNAL
@ TLTYPE_RAIL_SIGNAL
Definition: SUMOXMLDefinitions.h:1199
SUMO_ATTR_ENDPOS
@ SUMO_ATTR_ENDPOS
Definition: SUMOXMLDefinitions.h:798
NLHandler::myCurrentIsBroken
bool myCurrentIsBroken
Definition: NLHandler.h:323
SUMO_TAG_PHASE
@ SUMO_TAG_PHASE
a single phase description
Definition: SUMOXMLDefinitions.h:143
NLHandler::parseLinkState
LinkState parseLinkState(const std::string &state)
Parses the given character into an enumeration typed link state.
Definition: NLHandler.cpp:1293
SUMOSAXAttributes::getSUMOTimeReporting
SUMOTime getSUMOTimeReporting(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is a SUMOTime.
Definition: SUMOSAXAttributes.cpp:63
NLHandler::myEdgeControlBuilder
NLEdgeControlBuilder & myEdgeControlBuilder
The edge builder to use.
Definition: NLHandler.h:300
PositionVector
A list of positions.
Definition: PositionVector.h:45
SUMO_TAG_PARKING_SPACE
@ SUMO_TAG_PARKING_SPACE
A parking space for a single vehicle within a parking area.
Definition: SUMOXMLDefinitions.h:109
NLEdgeControlBuilder::addStopOffsets
void addStopOffsets(const std::map< SVCPermissions, double > &stopOffsets)
process a stopOffset element (originates either from the active edge or lane).
Definition: NLEdgeControlBuilder.cpp:92
NLHandler::myJunctionGraph
JunctionGraph myJunctionGraph
Definition: NLHandler.h:350
GeoConvHelper::init
static bool init(OptionsCont &oc)
Initialises the processing and the final instance using the given options.
Definition: GeoConvHelper.cpp:200
NLJunctionControlBuilder::getActiveSubKey
const std::string & getActiveSubKey() const
Returns the active sub key.
Definition: NLJunctionControlBuilder.cpp:479
SUMO_ATTR_FILE
@ SUMO_ATTR_FILE
Definition: SUMOXMLDefinitions.h:664
NLHandler::myEndElement
virtual void myEndElement(int element)
Called when a closing tag occurs.
Definition: NLHandler.cpp:252
SUMO_ATTR_DIR
@ SUMO_ATTR_DIR
The abstract direction of a link.
Definition: SUMOXMLDefinitions.h:706
MSLane::addLink
void addLink(MSLink *link)
Delayed initialization.
Definition: MSLane.cpp:239
SUMOXMLDefinitions::LinkDirections
static StringBijection< LinkDirection > LinkDirections
link directions
Definition: SUMOXMLDefinitions.h:1389
SumoXMLTag
SumoXMLTag
Numbers representing SUMO-XML - element names.
Definition: SUMOXMLDefinitions.h:41
NLHandler::myHaveWarnedAboutInvalidTLType
bool myHaveWarnedAboutInvalidTLType
Definition: NLHandler.h:325
SUMO_TAG_MEANDATA_EDGE
@ SUMO_TAG_MEANDATA_EDGE
an edge based mean data detector
Definition: SUMOXMLDefinitions.h:77
MSTLLogicControl::TLSLogicVariants::getActive
MSTrafficLightLogic * getActive() const
Definition: MSTLLogicControl.cpp:200
NLHandler::addConnection
void addConnection(const SUMOSAXAttributes &attrs)
adds a connection
Definition: NLHandler.cpp:1184
NLJunctionControlBuilder::closeJunction
void closeJunction(const std::string &basePath)
Closes (ends) the processing of the current junction.
Definition: NLJunctionControlBuilder.cpp:106
RGBColor.h
SUMO_ATTR_ORIG_BOUNDARY
@ SUMO_ATTR_ORIG_BOUNDARY
Definition: SUMOXMLDefinitions.h:829
SUMO_ATTR_EXCLUDE_EMPTY
@ SUMO_ATTR_EXCLUDE_EMPTY
Definition: SUMOXMLDefinitions.h:807
SUMO_ATTR_NEXT
@ SUMO_ATTR_NEXT
succesor phase index
Definition: SUMOXMLDefinitions.h:736
SUMO_ATTR_BEGIN
@ SUMO_ATTR_BEGIN
weights: time range begin
Definition: SUMOXMLDefinitions.h:678
NLJunctionControlBuilder
Builder of microsim-junctions and tls.
Definition: NLJunctionControlBuilder.h:62
SUMO_ATTR_TO
@ SUMO_ATTR_TO
Definition: SUMOXMLDefinitions.h:640
SUMO_TAG_LOCATION
@ SUMO_TAG_LOCATION
Definition: SUMOXMLDefinitions.h:263
SUMO_ATTR_TRACK_VEHICLES
@ SUMO_ATTR_TRACK_VEHICLES
Definition: SUMOXMLDefinitions.h:809
NLTriggerBuilder::parseAndBuildStoppingPlace
void parseAndBuildStoppingPlace(MSNet &net, const SUMOSAXAttributes &attrs, const SumoXMLTag element)
Parses the values and builds a stopping places for busses, trains or container vehicles.
Definition: NLTriggerBuilder.cpp:174
MSTrafficLightLogic.h
NLHandler.h
NLDetectorBuilder::createEdgeLaneMeanData
void createEdgeLaneMeanData(const std::string &id, SUMOTime frequency, SUMOTime begin, SUMOTime end, const std::string &type, const bool useLanes, const bool withEmpty, const bool printDefaults, const bool withInternal, const bool trackVehicles, const int detectPersons, const double maxTravelTime, const double minSamples, const double haltSpeed, const std::string &vTypes, const std::string &device)
Creates edge based mean data collector using the given specification.
Definition: NLDetectorBuilder.cpp:451
parseVehicleClasses
SVCPermissions parseVehicleClasses(const std::string &allowedS)
Parses the given definition of allowed vehicle classes into the given containers Deprecated classes g...
Definition: SUMOVehicleClass.cpp:222
NLHandler::myActionBuilder
NLDiscreteEventBuilder myActionBuilder
A builder for object actions.
Definition: NLHandler.h:287
NLHandler::addEdgeLaneMeanData
virtual void addEdgeLaneMeanData(const SUMOSAXAttributes &attrs, int objecttype)
Builds edge or lane base mean data collector using the given specification.
Definition: NLHandler.cpp:1139
SUMO_ATTR_INTLANES
@ SUMO_ATTR_INTLANES
Definition: SUMOXMLDefinitions.h:416
RGBColor
Definition: RGBColor.h:39
LinkState
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic,...
Definition: SUMOXMLDefinitions.h:1137
SUMO_TAG_NEIGH
@ SUMO_TAG_NEIGH
begin/end of the description of a neighboring lane
Definition: SUMOXMLDefinitions.h:51
NLJunctionControlBuilder::getNumberOfLoadedPhases
int getNumberOfLoadedPhases() const
return the number of phases loaded so far (for error reporting)
Definition: NLJunctionControlBuilder.h:275
NLJunctionControlBuilder::getTLLogic
MSTLLogicControl::TLSLogicVariants & getTLLogic(const std::string &id) const
Returns a previously build tls logic.
Definition: NLJunctionControlBuilder.cpp:198
Shape.h
Parameterised::getParametersMap
const std::map< std::string, std::string > & getParametersMap() const
Returns the inner key/value map.
Definition: Parameterised.cpp:106
Parameterised::updateParameters
void updateParameters(const std::map< std::string, std::string > &mapArg)
Adds or updates all given parameters from the map.
Definition: Parameterised.cpp:58
MSTLLogicControl::get
TLSLogicVariants & get(const std::string &id) const
Returns the variants of a named tls.
Definition: MSTLLogicControl.cpp:589
SUMO_TAG_TYPE
@ SUMO_TAG_TYPE
type
Definition: SUMOXMLDefinitions.h:210
SUMO_TAG_CHARGING_STATION
@ SUMO_TAG_CHARGING_STATION
A Charging Station.
Definition: SUMOXMLDefinitions.h:111
NLTriggerBuilder::parseAndBuildLaneSpeedTrigger
void parseAndBuildLaneSpeedTrigger(MSNet &net, const SUMOSAXAttributes &attrs, const std::string &base)
Parses his values and builds a lane speed trigger.
Definition: NLTriggerBuilder.cpp:109
NLHandler::parseLinkDir
LinkDirection parseLinkDir(const std::string &dir)
Parses the given character into an enumeration typed link direction.
Definition: NLHandler.cpp:1283
NLDiscreteEventBuilder::addAction
void addAction(const SUMOSAXAttributes &attrs, const std::string &basePath)
Builds an action and saves it for further use.
Definition: NLDiscreteEventBuilder.cpp:57
MSTLLogicControl::TLSLogicVariants::addLink
void addLink(MSLink *link, MSLane *lane, int pos)
Definition: MSTLLogicControl.cpp:225
SUMO_ATTR_KEEP_CLEAR
@ SUMO_ATTR_KEEP_CLEAR
Whether vehicles must keep the junction clear.
Definition: SUMOXMLDefinitions.h:696
GeoConvHelper::getFinal
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
Definition: GeoConvHelper.h:105
SVCPermissions
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
Definition: SUMOVehicleClass.h:218
SUMO_ATTR_SYNCHRON
@ SUMO_ATTR_SYNCHRON
Definition: SUMOXMLDefinitions.h:760
NLEdgeControlBuilder::closeLane
void closeLane()
Closes the building of a lane; The edge is completely described by now and may not be opened again.
Definition: NLEdgeControlBuilder.cpp:176
MSNet::setPermissionsFound
void setPermissionsFound()
Labels the network to contain vehicle class permissions.
Definition: MSNet.h:203
TIME2STEPS
#define TIME2STEPS(x)
Definition: SUMOTime.h:58
MSJunction.h
MsgHandler::getWarningInstance
static MsgHandler * getWarningInstance()
Returns the instance to add warnings to.
Definition: MsgHandler.cpp:68
SUMO_TAG_VSS
@ SUMO_TAG_VSS
A variable speed sign.
Definition: SUMOXMLDefinitions.h:89
NLEdgeControlBuilder::beginEdgeParsing
void beginEdgeParsing(const std::string &id, const SumoXMLEdgeFunc function, const std::string &streetName, const std::string &edgeType, int priority, const std::string &bidi, double distance)
Begins building of an MSEdge.
Definition: NLEdgeControlBuilder.cpp:58
SUMO_ATTR_FOES
@ SUMO_ATTR_FOES
Definition: SUMOXMLDefinitions.h:742
SUMO_TAG_REQUEST
@ SUMO_TAG_REQUEST
description of a logic request within the junction
Definition: SUMOXMLDefinitions.h:129
NLJunctionControlBuilder::closeTrafficLightLogic
virtual void closeTrafficLightLogic(const std::string &basePath)
Ends the building of a traffic lights logic.
Definition: NLJunctionControlBuilder.cpp:204
SumoXMLNodeType
SumoXMLNodeType
Numbers representing special SUMO-XML-attribute values for representing node- (junction-) types used ...
Definition: SUMOXMLDefinitions.h:1054
StringBijection::get
T get(const std::string &str) const
Definition: StringBijection.h:97
StringTokenizer
Definition: StringTokenizer.h:61
MSEdge::dictionary
static bool dictionary(const std::string &id, MSEdge *edge)
Inserts edge into the static dictionary Returns true if the key id isn't already in the dictionary....
Definition: MSEdge.cpp:765
NLHandler::myCurrentWAUTID
std::string myCurrentWAUTID
The id of the currently processed WAUT.
Definition: NLHandler.h:312
NLHandler::addE1Detector
virtual void addE1Detector(const SUMOSAXAttributes &attrs)
Builds an e1 detector using the given specification.
Definition: NLHandler.cpp:805
NLHandler::myJunctionControlBuilder
NLJunctionControlBuilder & myJunctionControlBuilder
The junction builder to use.
Definition: NLHandler.h:303
PositionVector::closePolygon
void closePolygon()
ensures that the last position equals the first
Definition: PositionVector.cpp:1231
RGBColor::parseColor
static RGBColor parseColor(std::string coldef)
Parses a color information.
Definition: RGBColor.cpp:176
MSEdge::initialize
void initialize(const std::vector< MSLane * > *lanes)
Initialize the edge.
Definition: MSEdge.cpp:94
SUMO_ATTR_CONT
@ SUMO_ATTR_CONT
Definition: SUMOXMLDefinitions.h:748
SUMO_ATTR_WIDTH
@ SUMO_ATTR_WIDTH
Definition: SUMOXMLDefinitions.h:386
NLHandler::NLHandler
NLHandler(const std::string &file, MSNet &net, NLDetectorBuilder &detBuilder, NLTriggerBuilder &triggerBuilder, NLEdgeControlBuilder &edgeBuilder, NLJunctionControlBuilder &junctionBuilder)
Constructor.
Definition: NLHandler.cpp:56
SUMO_ATTR_EDGES
@ SUMO_ATTR_EDGES
the edges of a route
Definition: SUMOXMLDefinitions.h:427
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:41
MSTLLogicControl::addWAUT
void addWAUT(SUMOTime refTime, const std::string &id, const std::string &startProg)
Adds a WAUT definition.
Definition: MSTLLogicControl.cpp:685
SUMO_TAG_PARKING_AREA
@ SUMO_TAG_PARKING_AREA
A parking area.
Definition: SUMOXMLDefinitions.h:107
MSLane::getLength
double getLength() const
Returns the lane's length.
Definition: MSLane.h:540
NLJunctionControlBuilder::openJunction
void openJunction(const std::string &id, const std::string &key, const SumoXMLNodeType type, const Position pos, const PositionVector &shape, const std::vector< MSLane * > &incomingLanes, const std::vector< MSLane * > &internalLanes)
Begins the processing of the named junction.
Definition: NLJunctionControlBuilder.cpp:87
SUMO_ATTR_BIDI
@ SUMO_ATTR_BIDI
Definition: SUMOXMLDefinitions.h:394
SUMORouteHandler::myEndElement
virtual void myEndElement(int element)
Called when a closing tag occurs.
Definition: SUMORouteHandler.cpp:215
SUMO_ATTR_ORIG_PROJ
@ SUMO_ATTR_ORIG_PROJ
Definition: SUMOXMLDefinitions.h:830
SUMO_ATTR_SHOW_DETECTOR
@ SUMO_ATTR_SHOW_DETECTOR
Definition: SUMOXMLDefinitions.h:753
OutputDevice.h
SUMO_TAG_EDGE
@ SUMO_TAG_EDGE
begin/end of the description of an edge
Definition: SUMOXMLDefinitions.h:47
NLHandler::addLane
void addLane(const SUMOSAXAttributes &attrs)
adds a lane to the previously opened edge
Definition: NLHandler.cpp:427
NLDetectorBuilder.h
SUMOXMLDefinitions::PersonModeValues
static StringBijection< PersonMode > PersonModeValues
person modes
Definition: SUMOXMLDefinitions.h:1383
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
NLHandler::~NLHandler
virtual ~NLHandler()
Destructor.
Definition: NLHandler.cpp:77
NLJunctionControlBuilder::retrieve
MSJunction * retrieve(const std::string id)
try to retrieve junction by id
Definition: NLJunctionControlBuilder.cpp:494
MSGlobals.h
UtilExceptions.h
SUMO_ATTR_Y
@ SUMO_ATTR_Y
Definition: SUMOXMLDefinitions.h:399
MSLane::addApproachingLane
void addApproachingLane(MSLane *lane, bool warnMultiCon)
Definition: MSLane.cpp:2214
MSEdge
A road/street connecting two junctions.
Definition: MSEdge.h:78
EDGEFUNC_CONNECTOR
@ EDGEFUNC_CONNECTOR
Definition: SUMOXMLDefinitions.h:1082
SUMO_TAG_REROUTER
@ SUMO_TAG_REROUTER
A rerouter.
Definition: SUMOXMLDefinitions.h:95
NLDetectorBuilder::buildInstantInductLoop
void buildInstantInductLoop(const std::string &id, const std::string &lane, double pos, const std::string &device, bool friendlyPos, const std::string &vTypes)
Builds an instantenous induction and adds it to the net.
Definition: NLDetectorBuilder.cpp:111
NLHandler::addWAUTJunction
void addWAUTJunction(const SUMOSAXAttributes &attrs)
Definition: NLHandler.cpp:612
NLJunctionControlBuilder::addParam
void addParam(const std::string &key, const std::string &value)
Adds a parameter.
Definition: NLJunctionControlBuilder.cpp:457
MSTrafficLightLogic
The parent class for traffic light logics.
Definition: MSTrafficLightLogic.h:55
SUMOSAXAttributes::getOpt
T getOpt(int attr, const char *objectid, bool &ok, T defaultValue, bool report=true) const
Tries to read given attribute assuming it is an int.
Definition: SUMOSAXAttributes.h:518
SUMO_TAG_MEANDATA_LANE
@ SUMO_TAG_MEANDATA_LANE
a lane based mean data detector
Definition: SUMOXMLDefinitions.h:79
NLEdgeControlBuilder.h
SUMO_ATTR_DISTANCE
@ SUMO_ATTR_DISTANCE
Definition: SUMOXMLDefinitions.h:395
NLTriggerBuilder::getCurrentStop
MSStoppingPlace * getCurrentStop()
Definition: NLTriggerBuilder.cpp:575
NLHandler::myCurrentIsInternalToSkip
bool myCurrentIsInternalToSkip
Information whether the currently parsed edge is internal and not wished, here.
Definition: NLHandler.h:290
NLTriggerBuilder::endStoppingPlace
virtual void endStoppingPlace()
End a stopping place.
Definition: NLTriggerBuilder.cpp:489
NLDetectorBuilder::beginE3Detector
void beginE3Detector(const std::string &id, const std::string &device, SUMOTime splInterval, double haltingSpeedThreshold, SUMOTime haltingTimeThreshold, const std::string &vTypes, bool openEntry)
Stores temporary the initial information about an e3 detector to build.
Definition: NLDetectorBuilder.cpp:286
SUMO_ATTR_MIN_SAMPLES
@ SUMO_ATTR_MIN_SAMPLES
Definition: SUMOXMLDefinitions.h:812
SUMO_ATTR_TIME
@ SUMO_ATTR_TIME
trigger: the time of the step
Definition: SUMOXMLDefinitions.h:676
SUMO_ATTR_FRIENDLY_POS
@ SUMO_ATTR_FRIENDLY_POS
Definition: SUMOXMLDefinitions.h:765
string2time
SUMOTime string2time(const std::string &r)
Definition: SUMOTime.cpp:44
SUMO_ATTR_DETECT_PERSONS
@ SUMO_ATTR_DETECT_PERSONS
Definition: SUMOXMLDefinitions.h:810
SUMO_ATTR_LEFTHAND
@ SUMO_ATTR_LEFTHAND
Definition: SUMOXMLDefinitions.h:881
NLTriggerBuilder.h
SUMO_ATTR_FREQUENCY
@ SUMO_ATTR_FREQUENCY
Definition: SUMOXMLDefinitions.h:662
SUMO_ATTR_POSITION
@ SUMO_ATTR_POSITION
Definition: SUMOXMLDefinitions.h:660
NLDetectorBuilder::endE3Detector
void endE3Detector()
Builds of an e3 detector using collected values.
Definition: NLDetectorBuilder.cpp:334
NLJunctionControlBuilder::getTLLogicControlToUse
MSTLLogicControl & getTLLogicControlToUse() const
Returns the used tls control.
Definition: NLJunctionControlBuilder.cpp:464
SUMO_ATTR_FROM_LANE
@ SUMO_ATTR_FROM_LANE
Definition: SUMOXMLDefinitions.h:719
SUMO_ATTR_INDEX
@ SUMO_ATTR_INDEX
Definition: SUMOXMLDefinitions.h:804
NLHandler::myNet
MSNet & myNet
The net to fill (preinitialised)
Definition: NLHandler.h:209
MSGlobals::gUsingInternalLanes
static bool gUsingInternalLanes
Information whether the simulation regards internal lanes.
Definition: MSGlobals.h:68
SUMO_ATTR_FROM
@ SUMO_ATTR_FROM
Definition: SUMOXMLDefinitions.h:639
SUMO_TAG_RESTRICTION
@ SUMO_TAG_RESTRICTION
begin/end of the description of an edge restriction
Definition: SUMOXMLDefinitions.h:61
SUMO_ATTR_LANES
@ SUMO_ATTR_LANES
Definition: SUMOXMLDefinitions.h:638
SUMO_TAG_TLLOGIC
@ SUMO_TAG_TLLOGIC
a traffic light logic
Definition: SUMOXMLDefinitions.h:141
SUMO_TAG_TAZ
@ SUMO_TAG_TAZ
a traffic assignment zone
Definition: SUMOXMLDefinitions.h:133
ShapeContainer::addPolygon
virtual bool addPolygon(const std::string &id, const std::string &type, const RGBColor &color, double layer, double angle, const std::string &imgFile, bool relativePath, const PositionVector &shape, bool geo, bool fill, double lineWidth, bool ignorePruning=false)
Builds a polygon using the given values and adds it to the container.
Definition: ShapeContainer.cpp:64
NLDetectorBuilder::buildE2Detector
void buildE2Detector(const std::string &id, MSLane *lane, double pos, double endPos, double length, const std::string &device, SUMOTime frequency, SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold, const std::string &vTypes, bool friendlyPos, bool showDetector, MSTLLogicControl::TLSLogicVariants *tlls=0, MSLane *toLane=0)
Builds a new E2 detector and adds it to the net's detector control. Also performs some consistency ch...
Definition: NLDetectorBuilder.cpp:127
MSLane::addIncomingLane
void addIncomingLane(MSLane *lane, MSLink *viaLink)
Definition: MSLane.cpp:2204
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:47
TLTYPE_RAIL_CROSSING
@ TLTYPE_RAIL_CROSSING
Definition: SUMOXMLDefinitions.h:1200
NLHandler::addE3Entry
void addE3Entry(const SUMOSAXAttributes &attrs)
Adds an entry to the currently processed e3 detector.
Definition: NLHandler.cpp:1113
NLHandler::myDetectorBuilder
NLDetectorBuilder & myDetectorBuilder
The detector builder to use.
Definition: NLHandler.h:294
StringUtils.h
SUMO_TAG_BUS_STOP
@ SUMO_TAG_BUS_STOP
A bus stop.
Definition: SUMOXMLDefinitions.h:97
SUMO_TAG_ENTRY_EXIT_DETECTOR
@ SUMO_TAG_ENTRY_EXIT_DETECTOR
alternative tag for e3 detector
Definition: SUMOXMLDefinitions.h:75
MSRouteHandler::myStartElement
virtual void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
Definition: MSRouteHandler.cpp:132
SUMO_TAG_TAZSINK
@ SUMO_TAG_TAZSINK
a sink within a district (connection road)
Definition: SUMOXMLDefinitions.h:137
MSLane::getShape
const PositionVector & getShape() const
Returns this lane's shape.
Definition: MSLane.h:477
SUMO_ATTR_STATE
@ SUMO_ATTR_STATE
The state of a link.
Definition: SUMOXMLDefinitions.h:708
MSTLLogicControl::closeWAUT
void closeWAUT(const std::string &wautid)
Closes loading of a WAUT.
Definition: MSTLLogicControl.cpp:755
SUMO_ATTR_PRIORITY
@ SUMO_ATTR_PRIORITY
Definition: SUMOXMLDefinitions.h:382
SUMO_ATTR_DURATION
@ SUMO_ATTR_DURATION
Definition: SUMOXMLDefinitions.h:667
SUMO_ATTR_VIA
@ SUMO_ATTR_VIA
Definition: SUMOXMLDefinitions.h:723
SUMOSAXAttributes::getOptSUMOTimeReporting
SUMOTime getOptSUMOTimeReporting(int attr, const char *objectid, bool &ok, SUMOTime defaultValue, bool report=true) const
Tries to read given attribute assuming it is a SUMOTime.
Definition: SUMOSAXAttributes.cpp:90
NLHandler::myCurrentTypeID
std::string myCurrentTypeID
The id of the currently processed edge type.
Definition: NLHandler.h:315
SUMO_ATTR_HALTING_TIME_THRESHOLD
@ SUMO_ATTR_HALTING_TIME_THRESHOLD
Definition: SUMOXMLDefinitions.h:750
NLHandler::initJunctionLogic
void initJunctionLogic(const SUMOSAXAttributes &attrs)
begins the reading of a junction row logic
Definition: NLHandler.cpp:658
NLHandler::addVTypeProbeDetector
virtual void addVTypeProbeDetector(const SUMOSAXAttributes &attrs)
Builds a vtype-detector using the given specification.
Definition: NLHandler.cpp:860
SUMO_ATTR_TLLINKINDEX
@ SUMO_ATTR_TLLINKINDEX
link: the index of the link within the traffic light
Definition: SUMOXMLDefinitions.h:686
SUMO_ATTR_VTYPES
@ SUMO_ATTR_VTYPES
Definition: SUMOXMLDefinitions.h:632
SUMO_ATTR_RESPONSE
@ SUMO_ATTR_RESPONSE
Definition: SUMOXMLDefinitions.h:411
SUMO_ATTR_CONV_BOUNDARY
@ SUMO_ATTR_CONV_BOUNDARY
Definition: SUMOXMLDefinitions.h:828
MSTLLogicControl::TLSLogicVariants::ignoreLinkIndex
void ignoreLinkIndex(int pos)
Definition: MSTLLogicControl.cpp:232
InvalidArgument
Definition: UtilExceptions.h:56
SUMO_TAG_NET
@ SUMO_TAG_NET
root element of a network file
Definition: SUMOXMLDefinitions.h:45
GenericSAXHandler::getFileName
const std::string & getFileName() const
returns the current file name
Definition: GenericSAXHandler.cpp:74
SUMO_TAG_VAPORIZER
@ SUMO_TAG_VAPORIZER
vaporizer of vehicles
Definition: SUMOXMLDefinitions.h:218
NLShapeHandler::getLanePos
Position getLanePos(const std::string &poiID, const std::string &laneID, double lanePos, double lanePosLat)
get position for a given laneID (Has to be implemented in all child)
Definition: NLHandler.cpp:1449
SUMO_ATTR_KEY
@ SUMO_ATTR_KEY
Definition: SUMOXMLDefinitions.h:408
SUMO_ATTR_WITH_INTERNAL
@ SUMO_ATTR_WITH_INTERNAL
Definition: SUMOXMLDefinitions.h:808
NLJunctionControlBuilder::addPhase
void addPhase(SUMOTime duration, const std::string &state, const std::vector< int > &nextPhases, SUMOTime min, SUMOTime max, const std::string &name)
Adds a phase to the currently built traffic lights logic.
Definition: NLJunctionControlBuilder.cpp:411
SVCAll
const SVCPermissions SVCAll
all VClasses are allowed
Definition: SUMOVehicleClass.cpp:146
SUMO_ATTR_MAX_TRAVELTIME
@ SUMO_ATTR_MAX_TRAVELTIME
Definition: SUMOXMLDefinitions.h:811
SUMO_TAG_WAUT
@ SUMO_TAG_WAUT
Definition: SUMOXMLDefinitions.h:170
SUMO_ATTR_VALUE
@ SUMO_ATTR_VALUE
Definition: SUMOXMLDefinitions.h:779
NLHandler::myStartElement
virtual void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
Definition: NLHandler.cpp:81
SUMOSAXAttributes::getNodeType
virtual SumoXMLNodeType getNodeType(bool &ok) const =0
Returns the value of the named attribute.
MSRouteHandler
Parser and container for routes during their loading.
Definition: MSRouteHandler.h:53
NLDetectorBuilder::getCurrentE3ID
std::string getCurrentE3ID() const
Returns the id of the currently built e3 detector.
Definition: NLDetectorBuilder.cpp:325
SUMO_TAG_TIMEDEVENT
@ SUMO_TAG_TIMEDEVENT
The definition of a periodic event.
Definition: SUMOXMLDefinitions.h:161
SUMO_ATTR_ALLOW
@ SUMO_ATTR_ALLOW
Definition: SUMOXMLDefinitions.h:782
SUMO_TAG_CONNECTION
@ SUMO_TAG_CONNECTION
connectio between two lanes
Definition: SUMOXMLDefinitions.h:202
IOError
Definition: UtilExceptions.h:161
parseStopOffsets
std::map< SVCPermissions, double > parseStopOffsets(const SUMOSAXAttributes &attrs, bool &ok)
Extract stopOffsets from attributes of stopOffset element.
Definition: SUMOVehicleClass.cpp:392
NLJunctionControlBuilder::initJunctionLogic
void initJunctionLogic(const std::string &id)
Initialises a junction logic.
Definition: NLJunctionControlBuilder.cpp:333
SUMO_ATTR_VCLASS
@ SUMO_ATTR_VCLASS
Definition: SUMOXMLDefinitions.h:450
MSEdge::getLanes
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
Definition: MSEdge.h:167
Parameterised::setParameter
void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
Definition: Parameterised.cpp:46
SUMOXMLDefinitions::TrafficLightTypes
static StringBijection< TrafficLightType > TrafficLightTypes
traffic light types
Definition: SUMOXMLDefinitions.h:1392
SUMO_TAG_ROUTEPROBE
@ SUMO_TAG_ROUTEPROBE
a routeprobe detector
Definition: SUMOXMLDefinitions.h:115
MSTLLogicControl::TLSLogicVariants
Storage for all programs of a single tls.
Definition: MSTLLogicControl.h:85
NLHandler::beginEdgeParsing
void beginEdgeParsing(const SUMOSAXAttributes &attrs)
begins the processing of an edge
Definition: NLHandler.cpp:334
NLJunctionControlBuilder.h
NLHandler::endE3Detector
virtual void endE3Detector()
Builds of an e3 detector using collected values.
Definition: NLHandler.cpp:1425
SUMO_ATTR_JAM_DIST_THRESHOLD
@ SUMO_ATTR_JAM_DIST_THRESHOLD
Definition: SUMOXMLDefinitions.h:752
NLHandler::closeWAUT
void closeWAUT()
Definition: NLHandler.cpp:1435
Parameterised::clearParameter
void clearParameter()
Clears the parameter map.
Definition: Parameterised.cpp:100
SUMO_ATTR_MAXDURATION
@ SUMO_ATTR_MAXDURATION
maximum duration of a phase
Definition: SUMOXMLDefinitions.h:734
StringTokenizer::getVector
std::vector< std::string > getVector()
return vector of strings
Definition: StringTokenizer.cpp:191
NLTriggerBuilder::parseAndBuildChargingStation
void parseAndBuildChargingStation(MSNet &net, const SUMOSAXAttributes &attrs)
Parses his values and builds a charging station.
Definition: NLTriggerBuilder.cpp:146
SUMO_TAG_E3DETECTOR
@ SUMO_TAG_E3DETECTOR
an e3 detector
Definition: SUMOXMLDefinitions.h:73
NLTriggerBuilder::endParkingArea
virtual void endParkingArea()
End a parking area.
Definition: NLTriggerBuilder.cpp:479
config.h
NLHandler::initTrafficLightLogic
void initTrafficLightLogic(const SUMOSAXAttributes &attrs)
begins the reading of a traffic lights logic
Definition: NLHandler.cpp:673
NLEdgeControlBuilder::reportCurrentEdgeOrLane
std::string reportCurrentEdgeOrLane() const
Return info about currently processed edge or lane.
Definition: NLEdgeControlBuilder.cpp:104
ShapeContainer.h
NLDetectorBuilder::buildVTypeProbe
void buildVTypeProbe(const std::string &id, const std::string &vtype, SUMOTime frequency, const std::string &device)
Builds a vTypeProbe and adds it to the net.
Definition: NLDetectorBuilder.cpp:357
NLEdgeControlBuilder::closeEdge
virtual MSEdge * closeEdge()
Closes the building of an edge; The edge is completely described by now and may not be opened again.
Definition: NLEdgeControlBuilder.cpp:163
StringTokenizer.h
SUMO_ATTR_END
@ SUMO_ATTR_END
weights: time range end
Definition: SUMOXMLDefinitions.h:680
MSLane::geometryPositionAtOffset
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
Definition: MSLane.h:504
NLTriggerBuilder::parseAndBuildRerouter
void parseAndBuildRerouter(MSNet &net, const SUMOSAXAttributes &attrs, const std::string &base)
Parses his values and builds a rerouter.
Definition: NLTriggerBuilder.cpp:344
SUMOXMLDefinitions::getJunctionIDFromInternalEdge
static std::string getJunctionIDFromInternalEdge(const std::string internalEdge)
return the junction id when given an edge of type internal, crossing or WalkingArea
Definition: SUMOXMLDefinitions.cpp:954
SUMO_ATTR_PROGRAMID
@ SUMO_ATTR_PROGRAMID
Definition: SUMOXMLDefinitions.h:412
NLDetectorBuilder::addE3Exit
void addE3Exit(const std::string &lane, double pos, bool friendlyPos)
Builds an exit point of an e3 detector.
Definition: NLDetectorBuilder.cpp:311
SUMO_ATTR_CROSSING_EDGES
@ SUMO_ATTR_CROSSING_EDGES
the edges crossed by a pedestrian crossing
Definition: SUMOXMLDefinitions.h:674
MSNet::addRestriction
void addRestriction(const std::string &id, const SUMOVehicleClass svc, const double speed)
Adds a restriction for an edge type.
Definition: MSNet.cpp:324
MSLane.h
SUMO_ATTR_NAME
@ SUMO_ATTR_NAME
Definition: SUMOXMLDefinitions.h:380
SUMOSAXAttributes::getEdgeFunc
virtual SumoXMLEdgeFunc getEdgeFunc(bool &ok) const =0
Returns the value of the named attribute.
SUMOSAXAttributes::getStringSecure
virtual std::string getStringSecure(int id, const std::string &def) const =0
Returns the string-value of the named (by its enum-value) attribute.
MsgHandler::getErrorInstance
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
Definition: MsgHandler.cpp:81
SUMO_TAG_ROUNDABOUT
@ SUMO_TAG_ROUNDABOUT
roundabout defined in junction
Definition: SUMOXMLDefinitions.h:220
SUMO_TAG_ACCESS
@ SUMO_TAG_ACCESS
An access point for a train stop.
Definition: SUMOXMLDefinitions.h:103
SUMO_TAG_INDUCTION_LOOP
@ SUMO_TAG_INDUCTION_LOOP
alternative tag for e1 detector
Definition: SUMOXMLDefinitions.h:65
SUMO_ATTR_WAUT_ID
@ SUMO_ATTR_WAUT_ID
Definition: SUMOXMLDefinitions.h:757
NLHandler::myAmParsingTLLogicOrJunction
bool myAmParsingTLLogicOrJunction
internal information whether a tls-logic is currently read
Definition: NLHandler.h:309
NLTriggerBuilder::buildVaporizer
void buildVaporizer(const SUMOSAXAttributes &attrs)
Builds a vaporization.
Definition: NLTriggerBuilder.cpp:72
SUMO_TAG_CALIBRATOR
@ SUMO_TAG_CALIBRATOR
A calibrator placed over edge.
Definition: SUMOXMLDefinitions.h:91
MSEdge::addSuccessor
void addSuccessor(MSEdge *edge, const MSEdge *via=nullptr)
Adds an edge to the list of edges which may be reached from this edge and to the incoming of the othe...
Definition: MSEdge.cpp:944
SUMO_TAG_E1DETECTOR
@ SUMO_TAG_E1DETECTOR
an e1 detector
Definition: SUMOXMLDefinitions.h:63
SUMOSAXAttributes
Encapsulated SAX-Attributes.
Definition: SUMOSAXAttributes.h:56
SUMO_ATTR_SHAPE
@ SUMO_ATTR_SHAPE
edge: the shape in xml-definition
Definition: SUMOXMLDefinitions.h:690
Named::getID
const std::string & getID() const
Returns the id.
Definition: Named.h:76
SUMO_ATTR_X
@ SUMO_ATTR_X
Definition: SUMOXMLDefinitions.h:398
SUMO_TAG_E2DETECTOR
@ SUMO_TAG_E2DETECTOR
an e2 detector
Definition: SUMOXMLDefinitions.h:67
POSITION_EPS
#define POSITION_EPS
Definition: config.h:172
NLHandler::addWAUTSwitch
void addWAUTSwitch(const SUMOSAXAttributes &attrs)
Definition: NLHandler.cpp:593
WRITE_ERROR
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:283
SUMO_TAG_DET_EXIT
@ SUMO_TAG_DET_EXIT
an e3 exit point
Definition: SUMOXMLDefinitions.h:83
NLHandler::myHaveSeenAdditionalSpeedRestrictions
bool myHaveSeenAdditionalSpeedRestrictions
whether additional files contained type-specific speed limits
Definition: NLHandler.h:337
SUMO_ATTR_VERSION
@ SUMO_ATTR_VERSION
Definition: SUMOXMLDefinitions.h:876
NLHandler::myNetworkVersion
double myNetworkVersion
the loaded network version
Definition: NLHandler.h:343
SUMOXMLDefinitions.h
NLDetectorBuilder
Builds detectors for microsim.
Definition: NLDetectorBuilder.h:55
NLJunctionControlBuilder::getActiveKey
const std::string & getActiveKey() const
Returns the active key.
Definition: NLJunctionControlBuilder.cpp:473
NLDetectorBuilder::buildRouteProbe
void buildRouteProbe(const std::string &id, const std::string &edge, SUMOTime frequency, SUMOTime begin, const std::string &device, const std::string &vTypes)
Builds a routeProbe and adds it to the net.
Definition: NLDetectorBuilder.cpp:366
MSEdge::markAsRoundabout
void markAsRoundabout()
Definition: MSEdge.h:644
SUMO_TAG_INSTANT_INDUCTION_LOOP
@ SUMO_TAG_INSTANT_INDUCTION_LOOP
An instantenous induction loop.
Definition: SUMOXMLDefinitions.h:87
NLJunctionControlBuilder::addLogicItem
void addLogicItem(int request, const std::string &response, const std::string &foes, bool cont)
Adds a logic item.
Definition: NLJunctionControlBuilder.cpp:346
SUMO_ATTR_OFFSET
@ SUMO_ATTR_OFFSET
Definition: SUMOXMLDefinitions.h:413
NLHandler::parseLanes
void parseLanes(const std::string &junctionID, const std::string &def, std::vector< MSLane * > &into, bool &ok)
Definition: NLHandler.cpp:528
NLTriggerBuilder::parseAndBuildCalibrator
void parseAndBuildCalibrator(MSNet &net, const SUMOSAXAttributes &attrs, const std::string &base)
Parses his values and builds a mesoscopic or microscopic calibrator.
Definition: NLTriggerBuilder.cpp:283
SUMO_TAG_JUNCTION
@ SUMO_TAG_JUNCTION
begin/end of the description of a junction
Definition: SUMOXMLDefinitions.h:59
TLTYPE_ACTUATED
@ TLTYPE_ACTUATED
Definition: SUMOXMLDefinitions.h:1201
NLHandler::addRoundabout
void addRoundabout(const SUMOSAXAttributes &attrs)
Definition: NLHandler.cpp:1406
SUMO_TAG_VTYPEPROBE
@ SUMO_TAG_VTYPEPROBE
a vtypeprobe detector
Definition: SUMOXMLDefinitions.h:113
SUMO_ATTR_PROCEDURE
@ SUMO_ATTR_PROCEDURE
Definition: SUMOXMLDefinitions.h:759
SUMO_ATTR_TARGETLANE
@ SUMO_ATTR_TARGETLANE
Definition: SUMOXMLDefinitions.h:1019
NLHandler::addE3Exit
void addE3Exit(const SUMOSAXAttributes &attrs)
Adds an exit to the currently processed e3 detector.
Definition: NLHandler.cpp:1126