Eclipse SUMO - Simulation of Urban MObility
NBTypeCont.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-2022 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 /****************************************************************************/
21 // A storage for the available types of an edge
22 /****************************************************************************/
23 #include <config.h>
24 
25 #include <string>
26 #include <map>
27 #include <iostream>
29 #include <utils/common/ToString.h>
31 
32 #include "NBTypeCont.h"
33 
34 
35 // ===========================================================================
36 // method definitions
37 // ===========================================================================
38 
39 // ---------------------------------------------------------------------------
40 // NBTypeCont::EdgeTypeDefinition - methods
41 // ---------------------------------------------------------------------------
42 
44  speed(NBEdge::UNSPECIFIED_SPEED),
45  permissions(SVC_UNSPECIFIED),
46  width(NBEdge::UNSPECIFIED_WIDTH) {
47 }
48 
49 
51  speed(edgeTypeDefinition->speed),
52  permissions(edgeTypeDefinition->permissions),
53  width(edgeTypeDefinition->width) {
54 }
55 
56 
57 NBTypeCont::LaneTypeDefinition::LaneTypeDefinition(const double _speed, const double _width, SVCPermissions _permissions, const std::set<SumoXMLAttr>& _attrs) :
58  speed(_speed),
59  permissions(_permissions),
60  width(_width),
61  attrs(_attrs) {
62 }
63 
64 
66  speed(laneTypeDefinition->speed),
67  permissions(laneTypeDefinition->permissions),
68  width(laneTypeDefinition->width),
69  restrictions(laneTypeDefinition->restrictions),
70  attrs(laneTypeDefinition->attrs) {
71 }
72 
73 // ---------------------------------------------------------------------------
74 // NBTypeCont::EdgeTypeDefinition - methods
75 // ---------------------------------------------------------------------------
76 
78  speed((double) 13.89), priority(-1),
79  permissions(SVC_UNSPECIFIED),
80  spreadType(LaneSpreadFunction::RIGHT),
81  oneWay(true), discard(false),
82  width(NBEdge::UNSPECIFIED_WIDTH),
83  widthResolution(0),
84  maxWidth(0),
85  minWidth(0),
86  sidewalkWidth(NBEdge::UNSPECIFIED_WIDTH),
87  bikeLaneWidth(NBEdge::UNSPECIFIED_WIDTH) {
88  // set laneTypes
89  laneTypeDefinitions.resize(1);
90 }
91 
92 
94  speed(edgeType->speed),
95  priority(edgeType->priority),
96  permissions(edgeType->permissions),
97  spreadType(edgeType->spreadType),
98  oneWay(edgeType->oneWay),
99  discard(edgeType->discard),
100  width(edgeType->width),
101  widthResolution(edgeType->widthResolution),
102  maxWidth(edgeType->maxWidth),
103  minWidth(edgeType->minWidth),
104  sidewalkWidth(edgeType->sidewalkWidth),
105  bikeLaneWidth(edgeType->bikeLaneWidth),
106  restrictions(edgeType->restrictions),
107  attrs(edgeType->attrs),
108  laneTypeDefinitions(edgeType->laneTypeDefinitions) {
109 }
110 
111 
112 NBTypeCont::EdgeTypeDefinition::EdgeTypeDefinition(int numLanes, double _speed, int _priority,
113  double _width, SVCPermissions _permissions, LaneSpreadFunction _spreadType, bool _oneWay, double _sideWalkWidth,
114  double _bikeLaneWidth, double _widthResolution, double _maxWidth, double _minWidth) :
115  speed(_speed), priority(_priority),
116  permissions(_permissions),
117  spreadType(_spreadType),
118  oneWay(_oneWay),
119  discard(false),
120  width(_width),
121  widthResolution(_widthResolution),
122  maxWidth(_maxWidth),
123  minWidth(_minWidth),
124  sidewalkWidth(_sideWalkWidth),
125  bikeLaneWidth(_bikeLaneWidth) {
126  // set laneTypes
127  laneTypeDefinitions.resize(numLanes);
128 }
129 
130 
131 bool
133  for (const LaneTypeDefinition& laneType : laneTypeDefinitions) {
134  if (laneType.attrs.count(SUMO_ATTR_SPEED) > 0 && laneType.speed != NBEdge::UNSPECIFIED_SPEED && laneType.speed != speed) {
135  return true;
136  }
137  if ((laneType.attrs.count(SUMO_ATTR_DISALLOW) > 0 || laneType.attrs.count(SUMO_ATTR_ALLOW) > 0)
138  && laneType.permissions != permissions) {
139  return true;
140  }
141  if (laneType.attrs.count(SUMO_ATTR_WIDTH) > 0 && laneType.width != width && laneType.width != NBEdge::UNSPECIFIED_WIDTH) {
142  return true;
143  }
144  if (laneType.restrictions.size() > 0) {
145  return true;
146  }
147  }
148  return false;
149 }
150 
151 // ---------------------------------------------------------------------------
152 // NBTypeCont - methods
153 // ---------------------------------------------------------------------------
154 
157 
158 
160  clearTypes();
161  delete myDefaultType;
162 }
163 
164 
165 void
167  // remove edge types
168  for (const auto& edgeType : myEdgeTypes) {
169  delete edgeType.second;
170  }
171  // clear edge types
172  myEdgeTypes.clear();
173 }
174 
175 
176 void
178  double defaultLaneWidth,
179  double defaultSpeed,
180  int defaultPriority,
181  SVCPermissions defaultPermissions,
182  LaneSpreadFunction defaultSpreadType) {
184  myDefaultType->laneTypeDefinitions.resize(defaultNumLanes);
185  myDefaultType->width = defaultLaneWidth;
186  myDefaultType->speed = defaultSpeed;
187  myDefaultType->priority = defaultPriority;
188  myDefaultType->permissions = defaultPermissions;
189  myDefaultType->spreadType = defaultSpreadType;
190 }
191 
192 
193 void
194 NBTypeCont::insertEdgeType(const std::string& id, int numLanes, double maxSpeed, int prio,
195  SVCPermissions permissions, LaneSpreadFunction spreadType, double width,
196  bool oneWayIsDefault, double sidewalkWidth, double bikeLaneWidth,
197  double widthResolution, double maxWidth, double minWidth) {
198  // Create edge type definition
199  EdgeTypeDefinition* newType = new EdgeTypeDefinition(numLanes, maxSpeed, prio, width, permissions, spreadType, oneWayIsDefault, sidewalkWidth, bikeLaneWidth, widthResolution, maxWidth, minWidth);
200  // check if edgeType already exist in types
201  TypesCont::iterator old = myEdgeTypes.find(id);
202  // if exists, then update restrictions and attributes
203  if (old != myEdgeTypes.end()) {
204  newType->restrictions.insert(old->second->restrictions.begin(), old->second->restrictions.end());
205  newType->attrs.insert(old->second->attrs.begin(), old->second->attrs.end());
206  delete old->second;
207  }
208  // insert it in types
209  myEdgeTypes[id] = newType;
210 }
211 
212 
213 void
214 NBTypeCont::insertEdgeType(const std::string& id, const EdgeTypeDefinition* edgeType) {
215  // Create edge type definition
216  EdgeTypeDefinition* newType = new EdgeTypeDefinition(edgeType);
217  // check if edgeType already exist in types
218  TypesCont::iterator old = myEdgeTypes.find(id);
219  // if exists, then update restrictions and attributes
220  if (old != myEdgeTypes.end()) {
221  newType->restrictions.insert(old->second->restrictions.begin(), old->second->restrictions.end());
222  newType->attrs.insert(old->second->attrs.begin(), old->second->attrs.end());
223  delete old->second;
224  }
225  // insert it in types
226  myEdgeTypes[id] = newType;
227 }
228 
229 
230 void
231 NBTypeCont::insertLaneType(const std::string& edgeTypeID, int index, double maxSpeed, SVCPermissions permissions,
232  double width, const std::set<SumoXMLAttr>& attrs) {
233  EdgeTypeDefinition* et = myEdgeTypes.at(edgeTypeID);
234  while ((int)et->laneTypeDefinitions.size() <= index) {
235  et->laneTypeDefinitions.push_back(et);
236  }
237  // add LaneTypeDefinition with the given attributes
238  et->laneTypeDefinitions[index] = LaneTypeDefinition(maxSpeed, width, permissions, attrs);
239 }
240 
241 
242 int
244  return (int)myEdgeTypes.size();
245 }
246 
247 
248 void
249 NBTypeCont::removeEdgeType(const std::string& id) {
250  // check if edgeType already exist in types
251  const auto it = myEdgeTypes.find(id);
252  // if exists, then remove it
253  if (it != myEdgeTypes.end()) {
254  // remove it from map
255  delete it->second;
256  myEdgeTypes.erase(it);
257  }
258 }
259 
260 
261 void
262 NBTypeCont::updateEdgeTypeID(const std::string& oldId, const std::string& newId) {
263  // check if edgeType already exist in types
264  const auto oldIt = myEdgeTypes.find(oldId);
265  const auto newIt = myEdgeTypes.find(newId);
266  // if exists, then remove it
267  if ((oldIt != myEdgeTypes.end()) && (newIt == myEdgeTypes.end())) {
268  // obtain pointer
269  auto edgeType = oldIt->second;
270  // remove it from map
271  myEdgeTypes.erase(oldIt);
272  // add it again
273  myEdgeTypes[newId] = edgeType;
274  }
275 }
276 
277 
278 NBTypeCont::TypesCont::const_iterator
280  return myEdgeTypes.cbegin();
281 }
282 
283 
284 NBTypeCont::TypesCont::const_iterator
286  return myEdgeTypes.cend();
287 }
288 
289 
290 bool
291 NBTypeCont::knows(const std::string& type) const {
292  return myEdgeTypes.find(type) != myEdgeTypes.end();
293 }
294 
295 
296 bool
297 NBTypeCont::markEdgeTypeAsToDiscard(const std::string& id) {
298  TypesCont::iterator i = myEdgeTypes.find(id);
299  if (i == myEdgeTypes.end()) {
300  return false;
301  }
302  i->second->discard = true;
303  return true;
304 }
305 
306 
307 bool
308 NBTypeCont::markEdgeTypeAsSet(const std::string& id, const SumoXMLAttr attr) {
309  TypesCont::iterator i = myEdgeTypes.find(id);
310  if (i == myEdgeTypes.end()) {
311  return false;
312  }
313  i->second->attrs.insert(attr);
314  return true;
315 }
316 
317 
318 bool
319 NBTypeCont::addEdgeTypeRestriction(const std::string& id, const SUMOVehicleClass svc, const double speed) {
320  TypesCont::iterator i = myEdgeTypes.find(id);
321  if (i == myEdgeTypes.end()) {
322  return false;
323  }
324  i->second->restrictions[svc] = speed;
325  return true;
326 }
327 
328 
329 bool
330 NBTypeCont::copyEdgeTypeRestrictionsAndAttrs(const std::string& fromId, const std::string& toId) {
331  TypesCont::iterator from = myEdgeTypes.find(fromId);
332  TypesCont::iterator to = myEdgeTypes.find(toId);
333  if (from == myEdgeTypes.end() || to == myEdgeTypes.end()) {
334  return false;
335  }
336  to->second->restrictions.insert(from->second->restrictions.begin(), from->second->restrictions.end());
337  to->second->attrs.insert(from->second->attrs.begin(), from->second->attrs.end());
338  return true;
339 }
340 
341 
342 bool
343 NBTypeCont::markLaneTypeAsSet(const std::string& id, int index, const SumoXMLAttr attr) {
344  TypesCont::iterator i = myEdgeTypes.find(id);
345  if (i == myEdgeTypes.end()) {
346  return false;
347  }
348  i->second->laneTypeDefinitions[index].attrs.insert(attr);
349  return true;
350 }
351 
352 
353 bool
354 NBTypeCont::addLaneTypeRestriction(const std::string& id, const SUMOVehicleClass svc, const double speed) {
355  TypesCont::iterator i = myEdgeTypes.find(id);
356  if (i == myEdgeTypes.end()) {
357  return false;
358  }
359  i->second->laneTypeDefinitions.back().restrictions[svc] = speed;
360  return true;
361 }
362 
363 
364 void
366  // iterate over edge types
367  for (const auto& edgeType : myEdgeTypes) {
368  // open edge type tag
369  into.openTag(SUMO_TAG_TYPE);
370  // write ID
371  into.writeAttr(SUMO_ATTR_ID, edgeType.first);
372  // write priority
373  if (edgeType.second->attrs.count(SUMO_ATTR_PRIORITY) > 0) {
374  into.writeAttr(SUMO_ATTR_PRIORITY, edgeType.second->priority);
375  }
376  // write numLanes
377  if (edgeType.second->attrs.count(SUMO_ATTR_NUMLANES) > 0 || edgeType.second->laneTypeDefinitions.size() > 1) {
378  into.writeAttr(SUMO_ATTR_NUMLANES, edgeType.second->laneTypeDefinitions.size());
379  }
380  // write speed
381  if (edgeType.second->attrs.count(SUMO_ATTR_SPEED) > 0) {
382  into.writeAttr(SUMO_ATTR_SPEED, edgeType.second->speed);
383  }
384  // write permissions
385  if ((edgeType.second->attrs.count(SUMO_ATTR_DISALLOW) > 0) || (edgeType.second->attrs.count(SUMO_ATTR_ALLOW) > 0)) {
386  writePermissions(into, edgeType.second->permissions);
387  }
388  // write spreadType (unless default)
389  if ((edgeType.second->attrs.count(SUMO_ATTR_SPREADTYPE) > 0) && edgeType.second->spreadType != LaneSpreadFunction::RIGHT) {
390  into.writeAttr(SUMO_ATTR_SPREADTYPE, SUMOXMLDefinitions::LaneSpreadFunctions.getString(edgeType.second->spreadType));
391  }
392  // write oneWay
393  if (edgeType.second->attrs.count(SUMO_ATTR_ONEWAY) > 0) {
394  into.writeAttr(SUMO_ATTR_ONEWAY, edgeType.second->oneWay);
395  }
396  // write discard
397  if (edgeType.second->attrs.count(SUMO_ATTR_DISCARD) > 0) {
398  into.writeAttr(SUMO_ATTR_DISCARD, edgeType.second->discard);
399  }
400  // write width
401  if (edgeType.second->attrs.count(SUMO_ATTR_WIDTH) > 0) {
402  into.writeAttr(SUMO_ATTR_WIDTH, edgeType.second->width);
403  }
404  // write sidewalkwidth
405  if (edgeType.second->attrs.count(SUMO_ATTR_SIDEWALKWIDTH) > 0) {
406  into.writeAttr(SUMO_ATTR_SIDEWALKWIDTH, edgeType.second->sidewalkWidth);
407  }
408  // write bikelanewidth
409  if (edgeType.second->attrs.count(SUMO_ATTR_BIKELANEWIDTH) > 0) {
410  into.writeAttr(SUMO_ATTR_BIKELANEWIDTH, edgeType.second->bikeLaneWidth);
411  }
412  // write restrictions
413  for (const auto& restriction : edgeType.second->restrictions) {
414  // open restriction tag
416  // write vclass
417  into.writeAttr(SUMO_ATTR_VCLASS, getVehicleClassNames(restriction.first));
418  // write speed
419  into.writeAttr(SUMO_ATTR_SPEED, restriction.second);
420  // close restriction tag
421  into.closeTag();
422  }
423  // iterate over lanes
424  if (edgeType.second->needsLaneType()) {
425  int index = 0;
426  for (const auto& laneType : edgeType.second->laneTypeDefinitions) {
427  // open lane type taG
429  into.writeAttr(SUMO_ATTR_INDEX, index++);
430  // write speed
431  if (laneType.attrs.count(SUMO_ATTR_SPEED) > 0 && laneType.speed != NBEdge::UNSPECIFIED_SPEED
432  && laneType.speed != edgeType.second->speed) {
433  into.writeAttr(SUMO_ATTR_SPEED, laneType.speed);
434  }
435  // write permissions
436  if (laneType.attrs.count(SUMO_ATTR_DISALLOW) > 0 || laneType.attrs.count(SUMO_ATTR_ALLOW) > 0) {
437  writePermissions(into, laneType.permissions);
438  }
439  // write width
440  if (laneType.attrs.count(SUMO_ATTR_WIDTH) > 0 && laneType.width != edgeType.second->width
441  && laneType.width != NBEdge::UNSPECIFIED_WIDTH) {
442  into.writeAttr(SUMO_ATTR_WIDTH, laneType.width);
443  }
444  // write restrictions
445  for (const auto& restriction : laneType.restrictions) {
446  // open restriction tag
448  // write vclass
449  into.writeAttr(SUMO_ATTR_VCLASS, getVehicleClassNames(restriction.first));
450  // write speed
451  into.writeAttr(SUMO_ATTR_SPEED, restriction.second);
452  // close restriction tag
453  into.closeTag();
454  }
455  // close lane type tag
456  into.closeTag();
457  }
458  }
459  // close edge type tag
460  into.closeTag();
461  }
462  //write endlype
463  if (!myEdgeTypes.empty()) {
464  into.lf();
465  }
466 }
467 
468 
469 int
470 NBTypeCont::getEdgeTypeNumLanes(const std::string& type) const {
471  return (int)getEdgeType(type)->laneTypeDefinitions.size();
472 }
473 
474 
475 double
476 NBTypeCont::getEdgeTypeSpeed(const std::string& type) const {
477  return getEdgeType(type)->speed;
478 }
479 
480 
481 int
482 NBTypeCont::getEdgeTypePriority(const std::string& type) const {
483  return getEdgeType(type)->priority;
484 }
485 
486 
487 bool
488 NBTypeCont::getEdgeTypeIsOneWay(const std::string& type) const {
489  return getEdgeType(type)->oneWay;
490 }
491 
492 
493 bool
494 NBTypeCont::getEdgeTypeShallBeDiscarded(const std::string& type) const {
495  return getEdgeType(type)->discard;
496 }
497 
498 double
499 NBTypeCont::getEdgeTypeWidthResolution(const std::string& type) const {
500  return getEdgeType(type)->widthResolution;
501 }
502 
503 double
504 NBTypeCont::getEdgeTypeMaxWidth(const std::string& type) const {
505  return getEdgeType(type)->maxWidth;
506 }
507 
508 double
509 NBTypeCont::getEdgeTypeMinWidth(const std::string& type) const {
510  return getEdgeType(type)->minWidth;
511 }
512 
513 bool
514 NBTypeCont::wasSetEdgeTypeAttribute(const std::string& type, const SumoXMLAttr attr) const {
515  return getEdgeType(type)->attrs.count(attr) > 0;
516 }
517 
518 
520 NBTypeCont::getEdgeTypePermissions(const std::string& type) const {
521  return getEdgeType(type)->permissions;
522 }
523 
524 
526 NBTypeCont::getEdgeTypeSpreadType(const std::string& type) const {
527  return getEdgeType(type)->spreadType;
528 }
529 
530 
531 double
532 NBTypeCont::getEdgeTypeWidth(const std::string& type) const {
533  return getEdgeType(type)->width;
534 }
535 
536 
537 double
538 NBTypeCont::getEdgeTypeSidewalkWidth(const std::string& type) const {
539  return getEdgeType(type)->sidewalkWidth;
540 }
541 
542 
543 double
544 NBTypeCont::getEdgeTypeBikeLaneWidth(const std::string& type) const {
545  return getEdgeType(type)->bikeLaneWidth;
546 }
547 
548 
550 NBTypeCont::getEdgeType(const std::string& name) const {
551  // try to find name in edge types
552  TypesCont::const_iterator i = myEdgeTypes.find(name);
553  // check if return edge types, or default edge types
554  if (i == myEdgeTypes.end()) {
555  return myDefaultType;
556  } else {
557  return i->second;
558  }
559 }
560 
561 /****************************************************************************/
const SVCPermissions SVC_UNSPECIFIED
permissions not specified
const std::string & getVehicleClassNames(SVCPermissions permissions, bool expand)
Returns the ids of the given classes, divided using a ' '.
void writePermissions(OutputDevice &into, SVCPermissions permissions)
writes allowed disallowed attributes if needed;
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
@ RIGHT
At the rightmost side of the lane.
@ SUMO_TAG_RESTRICTION
begin/end of the description of an edge restriction
@ SUMO_TAG_LANETYPE
lane type
@ SUMO_TAG_TYPE
type (edge)
LaneSpreadFunction
Numbers representing special SUMO-XML-attribute values Information how the edge's lateral offset shal...
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_DISALLOW
@ SUMO_ATTR_ALLOW
@ SUMO_ATTR_SPEED
@ SUMO_ATTR_ONEWAY
@ SUMO_ATTR_PRIORITY
@ SUMO_ATTR_NUMLANES
@ SUMO_ATTR_INDEX
@ SUMO_ATTR_SPREADTYPE
The information about how to spread the lanes from the given position.
@ SUMO_ATTR_BIKELANEWIDTH
@ SUMO_ATTR_VCLASS
@ SUMO_ATTR_SIDEWALKWIDTH
@ SUMO_ATTR_ID
@ SUMO_ATTR_DISCARD
@ SUMO_ATTR_WIDTH
The representation of a single edge during network building.
Definition: NBEdge.h:91
static const double UNSPECIFIED_SPEED
unspecified lane speed
Definition: NBEdge.h:355
static const double UNSPECIFIED_WIDTH
unspecified lane width
Definition: NBEdge.h:349
double getEdgeTypeMaxWidth(const std::string &edgeType) const
Returns the maximum edge/lane widths of the given edgeType.
Definition: NBTypeCont.cpp:504
bool markEdgeTypeAsSet(const std::string &id, const SumoXMLAttr attr)
Marks an attribute of a edgeType as set.
Definition: NBTypeCont.cpp:308
void removeEdgeType(const std::string &id)
Remove a edgeType from the list.
Definition: NBTypeCont.cpp:249
NBTypeCont()
Constructor.
Definition: NBTypeCont.cpp:155
void setEdgeTypeDefaults(int defaultNumLanes, double defaultLaneWidth, double defaultSpeed, int defaultPriority, SVCPermissions defaultPermissions, LaneSpreadFunction defaultSpreadType)
Sets the default values.
Definition: NBTypeCont.cpp:177
bool addLaneTypeRestriction(const std::string &id, const SUMOVehicleClass svc, const double speed)
Adds a restriction to last laneType.
Definition: NBTypeCont.cpp:354
~NBTypeCont()
Destructor.
Definition: NBTypeCont.cpp:159
void writeEdgeTypes(OutputDevice &into) const
writes all EdgeTypes (and their lanes) as XML
Definition: NBTypeCont.cpp:365
bool wasSetEdgeTypeAttribute(const std::string &edgeType, const SumoXMLAttr attr) const
Returns whether an attribute of a edgeType was set.
Definition: NBTypeCont.cpp:514
int size() const
Returns the number of known edgeTypes.
Definition: NBTypeCont.cpp:243
bool markEdgeTypeAsToDiscard(const std::string &id)
Marks a edgeType as to be discarded.
Definition: NBTypeCont.cpp:297
double getEdgeTypeMinWidth(const std::string &edgeType) const
Returns the minimum edge/lane widths of the given edgeType.
Definition: NBTypeCont.cpp:509
bool getEdgeTypeShallBeDiscarded(const std::string &edgeType) const
Returns the information whether edges of this edgeType shall be discarded.
Definition: NBTypeCont.cpp:494
void insertEdgeType(const std::string &id, int numLanes, double maxSpeed, int prio, SVCPermissions permissions, LaneSpreadFunction spreadType, double width, bool oneWayIsDefault, double sidewalkWidth, double bikeLaneWidth, double widthResolution, double maxWidth, double minWidth)
Adds a edgeType into the list.
Definition: NBTypeCont.cpp:194
bool copyEdgeTypeRestrictionsAndAttrs(const std::string &fromId, const std::string &toId)
Copy restrictions to a edgeType.
Definition: NBTypeCont.cpp:330
double getEdgeTypeSpeed(const std::string &edgeType) const
Returns the maximal velocity for the given edgeType [m/s].
Definition: NBTypeCont.cpp:476
int getEdgeTypePriority(const std::string &edgeType) const
Returns the priority for the given edgeType.
Definition: NBTypeCont.cpp:482
TypesCont::const_iterator begin() const
return begin iterator
Definition: NBTypeCont.cpp:279
int getEdgeTypeNumLanes(const std::string &edgeType) const
Returns the number of lanes for the given edgeType.
Definition: NBTypeCont.cpp:470
double getEdgeTypeWidth(const std::string &edgeType) const
Returns the lane width for the given edgeType [m].
Definition: NBTypeCont.cpp:532
SVCPermissions getEdgeTypePermissions(const std::string &edgeType) const
Returns allowed vehicle classes for the given edgeType.
Definition: NBTypeCont.cpp:520
double getEdgeTypeWidthResolution(const std::string &edgeType) const
Returns the resolution for interpreting edge/lane widths of the given edgeType.
Definition: NBTypeCont.cpp:499
bool knows(const std::string &edgeType) const
Returns whether the named edgeType is in the container.
Definition: NBTypeCont.cpp:291
bool addEdgeTypeRestriction(const std::string &id, const SUMOVehicleClass svc, const double speed)
Adds a restriction to a edgeType.
Definition: NBTypeCont.cpp:319
TypesCont::const_iterator end() const
return end iterator
Definition: NBTypeCont.cpp:285
double getEdgeTypeSidewalkWidth(const std::string &edgeType) const
Returns the lane width for a sidewalk to be added [m].
Definition: NBTypeCont.cpp:538
LaneSpreadFunction getEdgeTypeSpreadType(const std::string &edgeType) const
Returns spreadType for the given edgeType.
Definition: NBTypeCont.cpp:526
double getEdgeTypeBikeLaneWidth(const std::string &edgeType) const
Returns the lane width for a bike lane to be added [m].
Definition: NBTypeCont.cpp:544
void clearTypes()
clear types
Definition: NBTypeCont.cpp:166
const EdgeTypeDefinition * getEdgeType(const std::string &name) const
Retrieve the name or the default edgeType.
Definition: NBTypeCont.cpp:550
bool getEdgeTypeIsOneWay(const std::string &edgeType) const
Returns whether edges are one-way per default for the given edgeType.
Definition: NBTypeCont.cpp:488
void updateEdgeTypeID(const std::string &oldId, const std::string &newId)
change edge type ID
Definition: NBTypeCont.cpp:262
TypesCont myEdgeTypes
The container of edgeTypes.
Definition: NBTypeCont.h:425
bool markLaneTypeAsSet(const std::string &id, int index, const SumoXMLAttr attr)
Marks an attribute of last laneType as set.
Definition: NBTypeCont.cpp:343
EdgeTypeDefinition * myDefaultType
The default edgeType.
Definition: NBTypeCont.h:422
void insertLaneType(const std::string &edgeTypeID, int index, double maxSpeed, SVCPermissions permissions, double width, const std::set< SumoXMLAttr > &attrs)
Adds a laneType into the list.
Definition: NBTypeCont.cpp:231
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
void lf()
writes a line feed if applicable
Definition: OutputDevice.h:236
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:248
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
static StringBijection< LaneSpreadFunction > LaneSpreadFunctions
lane spread functions
edgeType definition
Definition: NBTypeCont.h:90
int priority
The priority of an edge.
Definition: NBTypeCont.h:111
double width
The width of lanes of edges of this edgeType [m].
Definition: NBTypeCont.h:126
double minWidth
The minimum width for lanes of this edgeType [m].
Definition: NBTypeCont.h:135
double speed
The maximal velocity on an edge in m/s.
Definition: NBTypeCont.h:108
LaneSpreadFunction spreadType
lane spread type
Definition: NBTypeCont.h:117
SVCPermissions permissions
List of vehicle edgeTypes that are allowed on this edge.
Definition: NBTypeCont.h:114
double maxWidth
The maximum width for lanes of this edgeType [m].
Definition: NBTypeCont.h:132
double widthResolution
The resolution for interpreting custom (noisy) lane widths of this edgeType [m].
Definition: NBTypeCont.h:129
bool oneWay
Whether one-way traffic is mostly common for this edgeType (mostly unused)
Definition: NBTypeCont.h:120
std::set< SumoXMLAttr > attrs
The attributes which have been set.
Definition: NBTypeCont.h:149
std::map< SUMOVehicleClass, double > restrictions
The vehicle class specific speed restrictions.
Definition: NBTypeCont.h:146
bool needsLaneType() const
whether any lane attributes deviate from the edge attributes
Definition: NBTypeCont.cpp:132
std::vector< LaneTypeDefinition > laneTypeDefinitions
vector with LaneTypeDefinitions
Definition: NBTypeCont.h:152
bool discard
Whether edges of this edgeType shall be discarded.
Definition: NBTypeCont.h:123
laneType definition
Definition: NBTypeCont.h:59
LaneTypeDefinition()
default Constructor
Definition: NBTypeCont.cpp:43