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