44 speed(
NBEdge::UNSPECIFIED_SPEED),
45 friction(
NBEdge::UNSPECIFIED_FRICTION),
47 width(
NBEdge::UNSPECIFIED_WIDTH) {
52 speed(edgeTypeDefinition->speed),
53 friction(edgeTypeDefinition->friction),
54 permissions(edgeTypeDefinition->permissions),
55 width(edgeTypeDefinition->width) {
62 permissions(_permissions),
69 speed(laneTypeDefinition->speed),
70 friction(laneTypeDefinition->friction),
71 permissions(laneTypeDefinition->permissions),
72 width(laneTypeDefinition->width),
73 restrictions(laneTypeDefinition->restrictions),
74 attrs(laneTypeDefinition->attrs) {
82 speed(13.89), friction(
NBEdge::UNSPECIFIED_FRICTION), priority(-1),
85 oneWay(true), discard(false),
86 width(
NBEdge::UNSPECIFIED_WIDTH),
90 sidewalkWidth(
NBEdge::UNSPECIFIED_WIDTH),
91 bikeLaneWidth(
NBEdge::UNSPECIFIED_WIDTH) {
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) {
119 double _bikeLaneWidth,
double _widthResolution,
double _maxWidth,
double _minWidth) :
120 speed(_speed), friction(_friction), priority(_priority),
121 permissions(_permissions),
122 spreadType(_spreadType),
126 widthResolution(_widthResolution),
129 sidewalkWidth(_sideWalkWidth),
130 bikeLaneWidth(_bikeLaneWidth) {
146 && laneType.permissions != permissions) {
152 if (laneType.restrictions.size() > 0) {
177 delete edgeType.second;
186 double defaultLaneWidth,
188 double defaultFriction,
206 bool oneWayIsDefault,
double sidewalkWidth,
double bikeLaneWidth,
207 double widthResolution,
double maxWidth,
double minWidth) {
210 width, permissions, spreadType, oneWayIsDefault, sidewalkWidth,
211 bikeLaneWidth, widthResolution, maxWidth, minWidth);
216 newType->
restrictions.insert(old->second->restrictions.begin(), old->second->restrictions.end());
217 newType->
attrs.insert(old->second->attrs.begin(), old->second->attrs.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());
244 double width,
const std::set<SumoXMLAttr>& attrs) {
281 auto edgeType = oldIt->second;
290 NBTypeCont::TypesCont::const_iterator
296 NBTypeCont::TypesCont::const_iterator
314 i->second->discard =
true;
325 i->second->attrs.insert(attr);
336 i->second->restrictions[svc] = speed;
343 TypesCont::iterator from =
myEdgeTypes.find(fromId);
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());
360 i->second->laneTypeDefinitions[index].attrs.insert(attr);
371 i->second->laneTypeDefinitions.back().restrictions[svc] = speed;
380 if (typeIDs.size() > 0 && typeIDs.count(edgeType.first) == 0) {
392 if (edgeType.second->attrs.count(
SUMO_ATTR_NUMLANES) > 0 || edgeType.second->laneTypeDefinitions.size() > 1) {
435 for (
const auto& restriction : edgeType.second->restrictions) {
446 if (edgeType.second->needsLaneType()) {
448 for (
const auto& laneType : edgeType.second->laneTypeDefinitions) {
454 && laneType.speed != edgeType.second->speed) {
459 && laneType.friction != edgeType.second->friction) {
467 if (laneType.attrs.count(
SUMO_ATTR_WIDTH) > 0 && laneType.width != edgeType.second->width
472 for (
const auto& restriction : laneType.restrictions) {
584 TypesCont::const_iterator i =
myEdgeTypes.find(name);
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;
long long int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ 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_SPREADTYPE
The information about how to spread the lanes from the given position.
@ SUMO_ATTR_BIKELANEWIDTH
@ SUMO_ATTR_SIDEWALKWIDTH
The representation of a single edge during network building.
static const double UNSPECIFIED_FRICTION
unspecified lane friction
static const double UNSPECIFIED_SPEED
unspecified lane speed
static const double UNSPECIFIED_WIDTH
unspecified lane width
double getEdgeTypeMaxWidth(const std::string &edgeType) const
Returns the maximum edge/lane widths of the given edgeType.
bool markEdgeTypeAsSet(const std::string &id, const SumoXMLAttr attr)
Marks an attribute of a edgeType as set.
void removeEdgeType(const std::string &id)
Remove a edgeType from the list.
bool addLaneTypeRestriction(const std::string &id, const SUMOVehicleClass svc, const double speed)
Adds a restriction to last laneType.
bool wasSetEdgeTypeAttribute(const std::string &edgeType, const SumoXMLAttr attr) const
Returns whether an attribute of a edgeType was set.
int size() const
Returns the number of known edgeTypes.
bool markEdgeTypeAsToDiscard(const std::string &id)
Marks a edgeType as to be discarded.
double getEdgeTypeFriction(const std::string &edgeType) const
Returns the default friction for the given edgeType [-].
void writeEdgeTypes(OutputDevice &into, const std::set< std::string > &typeIDs=std::set< std::string >()) const
writes all EdgeTypes (and their lanes) as XML
double getEdgeTypeMinWidth(const std::string &edgeType) const
Returns the minimum edge/lane widths of the given edgeType.
bool getEdgeTypeShallBeDiscarded(const std::string &edgeType) const
Returns the information whether edges of this edgeType shall be discarded.
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.
bool copyEdgeTypeRestrictionsAndAttrs(const std::string &fromId, const std::string &toId)
Copy restrictions to a edgeType.
double getEdgeTypeSpeed(const std::string &edgeType) const
Returns the maximal velocity for the given edgeType [m/s].
int getEdgeTypePriority(const std::string &edgeType) const
Returns the priority for the given edgeType.
TypesCont::const_iterator begin() const
return begin iterator
int getEdgeTypeNumLanes(const std::string &edgeType) const
Returns the number of lanes for the given edgeType.
double getEdgeTypeWidth(const std::string &edgeType) const
Returns the lane width for the given edgeType [m].
SVCPermissions getEdgeTypePermissions(const std::string &edgeType) const
Returns allowed vehicle classes for the given edgeType.
double getEdgeTypeWidthResolution(const std::string &edgeType) const
Returns the resolution for interpreting edge/lane widths of the given edgeType.
bool knows(const std::string &edgeType) const
Returns whether the named edgeType is in the container.
bool addEdgeTypeRestriction(const std::string &id, const SUMOVehicleClass svc, const double speed)
Adds a restriction to a edgeType.
TypesCont::const_iterator end() const
return end iterator
double getEdgeTypeSidewalkWidth(const std::string &edgeType) const
Returns the lane width for a sidewalk to be added [m].
LaneSpreadFunction getEdgeTypeSpreadType(const std::string &edgeType) const
Returns spreadType for the given edgeType.
double getEdgeTypeBikeLaneWidth(const std::string &edgeType) const
Returns the lane width for a bike lane to be added [m].
void clearTypes()
clear types
const EdgeTypeDefinition * getEdgeType(const std::string &name) const
Retrieve the name or the default edgeType.
bool getEdgeTypeIsOneWay(const std::string &edgeType) const
Returns whether edges are one-way per default for the given edgeType.
void updateEdgeTypeID(const std::string &oldId, const std::string &newId)
change edge type ID
TypesCont myEdgeTypes
The container of edgeTypes.
void setEdgeTypeDefaults(int defaultNumLanes, double defaultLaneWidth, double defaultSpeed, double defaultFriction, int defaultPriority, SVCPermissions defaultPermissions, LaneSpreadFunction defaultSpreadType)
Sets the default values.
bool markLaneTypeAsSet(const std::string &id, int index, const SumoXMLAttr attr)
Marks an attribute of last laneType as set.
EdgeTypeDefinition * myDefaultType
The default edgeType.
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.
Static storage of an output device and its base (abstract) implementation.
void lf()
writes a line feed if applicable
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
static StringBijection< LaneSpreadFunction > LaneSpreadFunctions
lane spread functions
int priority
The priority of an edge.
EdgeTypeDefinition()
Constructor.
double width
The width of lanes of edges of this edgeType [m].
double minWidth
The minimum width for lanes of this edgeType [m].
double speed
The maximal velocity on an edge in m/s.
LaneSpreadFunction spreadType
lane spread type
SVCPermissions permissions
List of vehicle edgeTypes that are allowed on this edge.
double maxWidth
The maximum width for lanes of this edgeType [m].
double widthResolution
The resolution for interpreting custom (noisy) lane widths of this edgeType [m].
bool oneWay
Whether one-way traffic is mostly common for this edgeType (mostly unused)
std::set< SumoXMLAttr > attrs
The attributes which have been set.
double friction
The default friction on an edge.
std::map< SUMOVehicleClass, double > restrictions
The vehicle class specific speed restrictions.
bool needsLaneType() const
whether any lane attributes deviate from the edge attributes
std::vector< LaneTypeDefinition > laneTypeDefinitions
vector with LaneTypeDefinitions
bool discard
Whether edges of this edgeType shall be discarded.
LaneTypeDefinition()
default Constructor