44 speed(
NBEdge::UNSPECIFIED_SPEED),
46 width(
NBEdge::UNSPECIFIED_WIDTH) {
52 permissions(_permissions),
61 speed((double) 13.89), priority(-1),
63 oneWay(true), discard(false),
64 width(
NBEdge::UNSPECIFIED_WIDTH),
68 sidewalkWidth(
NBEdge::UNSPECIFIED_WIDTH),
69 bikeLaneWidth(
NBEdge::UNSPECIFIED_WIDTH) {
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){
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),
98 widthResolution(_widthResolution),
101 sidewalkWidth(_sideWalkWidth),
102 bikeLaneWidth(_bikeLaneWidth) {
115 && laneType.permissions != permissions) {
121 if (laneType.restrictions.size() > 0) {
139 delete edgeType.second;
150 delete edgeType.second;
159 double defaultLaneWidth,
175 double sidewalkWidth,
double bikeLaneWidth,
176 double widthResolution,
180 EdgeTypeDefinition *newType =
new EdgeTypeDefinition(numLanes, maxSpeed, prio, width, permissions, oneWayIsDefault, sidewalkWidth, bikeLaneWidth, widthResolution, maxWidth, minWidth);
185 newType->
restrictions.insert(old->second->restrictions.begin(), old->second->restrictions.end());
186 newType->
attrs.insert(old->second->attrs.begin(), old->second->attrs.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());
211 double width,
const std::set<SumoXMLAttr> &attrs) {
248 auto edgeType = oldIt->second;
257 NBTypeCont::TypesCont::const_iterator
263 NBTypeCont::TypesCont::const_iterator
281 i->second->discard =
true;
292 i->second->attrs.insert(attr);
303 i->second->restrictions[svc] = speed;
310 TypesCont::iterator from =
myEdgeTypes.find(fromId);
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());
327 i->second->laneTypeDefinitions[index].attrs.insert(attr);
338 i->second->laneTypeDefinitions.back().restrictions[svc] = speed;
356 if (edgeType.second->attrs.count(
SUMO_ATTR_NUMLANES) > 0 || edgeType.second->laneTypeDefinitions.size() > 1) {
388 for (
const auto &restriction : edgeType.second->restrictions) {
399 if (edgeType.second->needsLaneType()) {
401 for (
const auto &laneType : edgeType.second->laneTypeDefinitions) {
407 && laneType.speed != edgeType.second->speed) {
415 if (laneType.attrs.count(
SUMO_ATTR_WIDTH) > 0 && laneType.width != edgeType.second->width
420 for (
const auto &restriction : laneType.restrictions) {
521 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
@ 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_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
void setEdgeTypeDefaults(int defaultNumLanes, double defaultLaneWidth, double defaultSpeed, int defaultPriority, SVCPermissions defaultPermissions)
Sets the default values.
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.
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.
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.
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.
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].
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.
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.
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()
Constructor.