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