44 speed(
NBEdge::UNSPECIFIED_SPEED),
46 width(
NBEdge::UNSPECIFIED_WIDTH) {
51 speed(edgeTypeDefinition->speed),
52 permissions(edgeTypeDefinition->permissions),
53 width(edgeTypeDefinition->width) {
59 permissions(_permissions),
66 speed(laneTypeDefinition->speed),
67 permissions(laneTypeDefinition->permissions),
68 width(laneTypeDefinition->width),
69 restrictions(laneTypeDefinition->restrictions),
70 attrs(laneTypeDefinition->attrs) {
78 speed((double) 13.89), priority(-1),
81 oneWay(true), discard(false),
82 width(
NBEdge::UNSPECIFIED_WIDTH),
86 sidewalkWidth(
NBEdge::UNSPECIFIED_WIDTH),
87 bikeLaneWidth(
NBEdge::UNSPECIFIED_WIDTH) {
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) {
114 double _bikeLaneWidth,
double _widthResolution,
double _maxWidth,
double _minWidth) :
115 speed(_speed), priority(_priority),
116 permissions(_permissions),
117 spreadType(_spreadType),
121 widthResolution(_widthResolution),
124 sidewalkWidth(_sideWalkWidth),
125 bikeLaneWidth(_bikeLaneWidth) {
138 && laneType.permissions != permissions) {
144 if (laneType.restrictions.size() > 0) {
169 delete edgeType.second;
178 double defaultLaneWidth,
196 bool oneWayIsDefault,
double sidewalkWidth,
double bikeLaneWidth,
197 double widthResolution,
double maxWidth,
double minWidth) {
199 EdgeTypeDefinition* newType =
new EdgeTypeDefinition(numLanes, maxSpeed, prio, width, permissions, spreadType, oneWayIsDefault, sidewalkWidth, bikeLaneWidth, widthResolution, maxWidth, minWidth);
204 newType->
restrictions.insert(old->second->restrictions.begin(), old->second->restrictions.end());
205 newType->
attrs.insert(old->second->attrs.begin(), old->second->attrs.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());
232 double width,
const std::set<SumoXMLAttr>& attrs) {
269 auto edgeType = oldIt->second;
278 NBTypeCont::TypesCont::const_iterator
284 NBTypeCont::TypesCont::const_iterator
302 i->second->discard =
true;
313 i->second->attrs.insert(attr);
324 i->second->restrictions[svc] = speed;
331 TypesCont::iterator from =
myEdgeTypes.find(fromId);
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());
348 i->second->laneTypeDefinitions[index].attrs.insert(attr);
359 i->second->laneTypeDefinitions.back().restrictions[svc] = speed;
377 if (edgeType.second->attrs.count(
SUMO_ATTR_NUMLANES) > 0 || edgeType.second->laneTypeDefinitions.size() > 1) {
413 for (
const auto& restriction : edgeType.second->restrictions) {
424 if (edgeType.second->needsLaneType()) {
426 for (
const auto& laneType : edgeType.second->laneTypeDefinitions) {
432 && laneType.speed != edgeType.second->speed) {
440 if (laneType.attrs.count(
SUMO_ATTR_WIDTH) > 0 && laneType.width != edgeType.second->width
445 for (
const auto& restriction : laneType.restrictions) {
552 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;
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_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_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.
void setEdgeTypeDefaults(int defaultNumLanes, double defaultLaneWidth, double defaultSpeed, int defaultPriority, SVCPermissions defaultPermissions, LaneSpreadFunction defaultSpreadType)
Sets the default values.
bool addLaneTypeRestriction(const std::string &id, const SUMOVehicleClass svc, const double speed)
Adds a restriction to last laneType.
void writeEdgeTypes(OutputDevice &into) const
writes all EdgeTypes (and their lanes) as XML
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 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.
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.
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