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