LCOV - code coverage report
Current view: top level - src/netbuild - NBTypeCont.cpp (source / functions) Coverage Total Hit
Test: lcov.info Lines: 77.1 % 245 189
Test Date: 2026-07-26 16:30:20 Functions: 85.1 % 47 40

            Line data    Source code
       1              : /****************************************************************************/
       2              : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
       3              : // Copyright (C) 2001-2026 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              : /****************************************************************************/
      14              : /// @file    NBTypeCont.cpp
      15              : /// @author  Daniel Krajzewicz
      16              : /// @author  Jakob Erdmann
      17              : /// @author  Michael Behrisch
      18              : /// @author  Walter Bamberger
      19              : /// @date    Tue, 20 Nov 2001
      20              : ///
      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>
      28              : #include <utils/common/MsgHandler.h>
      29              : #include <utils/common/ToString.h>
      30              : #include <utils/iodevices/OutputDevice.h>
      31              : 
      32              : #include "NBTypeCont.h"
      33              : 
      34              : 
      35              : // ===========================================================================
      36              : // method definitions
      37              : // ===========================================================================
      38              : 
      39              : // ---------------------------------------------------------------------------
      40              : // NBTypeCont::EdgeTypeDefinition - methods
      41              : // ---------------------------------------------------------------------------
      42              : 
      43        64405 : NBTypeCont::LaneTypeDefinition::LaneTypeDefinition() :
      44        64405 :     speed(NBEdge::UNSPECIFIED_SPEED),
      45        64405 :     friction(NBEdge::UNSPECIFIED_FRICTION),
      46        64405 :     permissions(SVC_UNSPECIFIED),
      47        64405 :     width(NBEdge::UNSPECIFIED_WIDTH) {
      48        64405 : }
      49              : 
      50              : 
      51            0 : NBTypeCont::LaneTypeDefinition::LaneTypeDefinition(const EdgeTypeDefinition* edgeTypeDefinition) :
      52            0 :     speed(edgeTypeDefinition->speed),
      53            0 :     friction(edgeTypeDefinition->friction),
      54            0 :     permissions(edgeTypeDefinition->permissions),
      55            0 :     width(edgeTypeDefinition->width) {
      56            0 : }
      57              : 
      58              : 
      59           59 : NBTypeCont::LaneTypeDefinition::LaneTypeDefinition(const double _speed, const double _friction, const double _width, SVCPermissions _permissions, const std::set<SumoXMLAttr>& _attrs) :
      60           59 :     speed(_speed),
      61           59 :     friction(_friction),
      62           59 :     permissions(_permissions),
      63           59 :     width(_width),
      64              :     attrs(_attrs) {
      65           59 : }
      66              : 
      67              : 
      68            0 : NBTypeCont::LaneTypeDefinition::LaneTypeDefinition(const LaneTypeDefinition* laneTypeDefinition) :
      69            0 :     speed(laneTypeDefinition->speed),
      70            0 :     friction(laneTypeDefinition->friction),
      71            0 :     permissions(laneTypeDefinition->permissions),
      72            0 :     width(laneTypeDefinition->width),
      73              :     restrictions(laneTypeDefinition->restrictions),
      74              :     attrs(laneTypeDefinition->attrs) {
      75            0 : }
      76              : 
      77              : // ---------------------------------------------------------------------------
      78              : // NBTypeCont::EdgeTypeDefinition - methods
      79              : // ---------------------------------------------------------------------------
      80              : 
      81         2541 : NBTypeCont::EdgeTypeDefinition::EdgeTypeDefinition() :
      82         2541 :     speed(13.89), friction(NBEdge::UNSPECIFIED_FRICTION), priority(-1),
      83         2541 :     permissions(SVC_UNSPECIFIED),
      84         2541 :     spreadType(LaneSpreadFunction::RIGHT),
      85         2541 :     oneWay(true), discard(false),
      86         2541 :     width(NBEdge::UNSPECIFIED_WIDTH),
      87         2541 :     widthResolution(0),
      88         2541 :     maxWidth(0),
      89         2541 :     minWidth(0),
      90         2541 :     sidewalkWidth(NBEdge::UNSPECIFIED_WIDTH),
      91         2541 :     bikeLaneWidth(NBEdge::UNSPECIFIED_WIDTH) {
      92              :     // set laneTypes
      93         2541 :     laneTypeDefinitions.resize(1);
      94         2541 : }
      95              : 
      96              : 
      97            0 : NBTypeCont::EdgeTypeDefinition::EdgeTypeDefinition(const EdgeTypeDefinition* edgeType) :
      98            0 :     speed(edgeType->speed),
      99            0 :     friction(edgeType->friction),
     100            0 :     priority(edgeType->priority),
     101            0 :     permissions(edgeType->permissions),
     102            0 :     spreadType(edgeType->spreadType),
     103            0 :     oneWay(edgeType->oneWay),
     104            0 :     discard(edgeType->discard),
     105            0 :     width(edgeType->width),
     106            0 :     widthResolution(edgeType->widthResolution),
     107            0 :     maxWidth(edgeType->maxWidth),
     108            0 :     minWidth(edgeType->minWidth),
     109            0 :     sidewalkWidth(edgeType->sidewalkWidth),
     110            0 :     bikeLaneWidth(edgeType->bikeLaneWidth),
     111              :     restrictions(edgeType->restrictions),
     112              :     attrs(edgeType->attrs),
     113            0 :     laneTypeDefinitions(edgeType->laneTypeDefinitions) {
     114            0 : }
     115              : 
     116              : 
     117        19228 : NBTypeCont::EdgeTypeDefinition::EdgeTypeDefinition(int numLanes, double _speed, double _friction, int _priority,
     118              :         double _width, SVCPermissions _permissions, LaneSpreadFunction _spreadType, bool _oneWay, double _sideWalkWidth,
     119        19228 :         double _bikeLaneWidth, double _widthResolution, double _maxWidth, double _minWidth) :
     120        19228 :     speed(_speed), friction(_friction), priority(_priority), //TODO
     121        19228 :     permissions(_permissions),
     122        19228 :     spreadType(_spreadType),
     123        19228 :     oneWay(_oneWay),
     124        19228 :     discard(false),
     125        19228 :     width(_width),
     126        19228 :     widthResolution(_widthResolution),
     127        19228 :     maxWidth(_maxWidth),
     128        19228 :     minWidth(_minWidth),
     129        19228 :     sidewalkWidth(_sideWalkWidth),
     130        19228 :     bikeLaneWidth(_bikeLaneWidth) {
     131              :     // set laneTypes
     132        19228 :     laneTypeDefinitions.resize(numLanes);
     133        19228 : }
     134              : 
     135              : 
     136              : bool
     137         2451 : NBTypeCont::EdgeTypeDefinition::needsLaneType() const {
     138         5943 :     for (const LaneTypeDefinition& laneType : laneTypeDefinitions) {
     139          112 :         if (laneType.attrs.count(SUMO_ATTR_SPEED) > 0 && laneType.speed != NBEdge::UNSPECIFIED_SPEED && laneType.speed != speed) {
     140              :             return true;
     141              :         }
     142            0 :         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            0 :                 && laneType.permissions != permissions) {
     147              :             return true;
     148              :         }
     149           15 :         if (laneType.attrs.count(SUMO_ATTR_WIDTH) > 0 && laneType.width != width && laneType.width != NBEdge::UNSPECIFIED_WIDTH) {
     150              :             return true;
     151              :         }
     152         3492 :         if (laneType.restrictions.size() > 0) {
     153              :             return true;
     154              :         }
     155              :     }
     156              :     return false;
     157              : }
     158              : 
     159              : // ---------------------------------------------------------------------------
     160              : // NBTypeCont - methods
     161              : // ---------------------------------------------------------------------------
     162              : 
     163         2541 : NBTypeCont::NBTypeCont() :
     164         2541 :     myDefaultType(new EdgeTypeDefinition()) {}
     165              : 
     166              : 
     167         2541 : NBTypeCont::~NBTypeCont() {
     168         2541 :     clearTypes();
     169         2541 :     delete myDefaultType;
     170         2541 : }
     171              : 
     172              : 
     173              : void
     174         2541 : NBTypeCont::clearTypes() {
     175              :     // remove edge types
     176        21298 :     for (const auto& edgeType : myEdgeTypes) {
     177        18757 :         delete edgeType.second;
     178              :     }
     179              :     // clear edge types
     180              :     myEdgeTypes.clear();
     181         2541 : }
     182              : 
     183              : 
     184              : void
     185         2541 : NBTypeCont::setEdgeTypeDefaults(int defaultNumLanes,
     186              :                                 double defaultLaneWidth,
     187              :                                 double defaultSpeed,
     188              :                                 double defaultFriction,
     189              :                                 int defaultPriority,
     190              :                                 SVCPermissions defaultPermissions,
     191              :                                 LaneSpreadFunction defaultSpreadType) {
     192         2541 :     myDefaultType->laneTypeDefinitions.clear();
     193         2541 :     myDefaultType->laneTypeDefinitions.resize(defaultNumLanes);
     194         2541 :     myDefaultType->width = defaultLaneWidth;
     195         2541 :     myDefaultType->speed = defaultSpeed;
     196         2541 :     myDefaultType->friction = defaultFriction;
     197         2541 :     myDefaultType->priority = defaultPriority;
     198         2541 :     myDefaultType->permissions = defaultPermissions;
     199         2541 :     myDefaultType->spreadType = defaultSpreadType;
     200         2541 : }
     201              : 
     202              : 
     203              : void
     204        19228 : NBTypeCont::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        19228 :             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        19228 :     if (old != myEdgeTypes.end()) {
     216          471 :         newType->restrictions.insert(old->second->restrictions.begin(), old->second->restrictions.end());
     217          471 :         newType->attrs.insert(old->second->attrs.begin(), old->second->attrs.end());
     218          471 :         delete old->second;
     219              :     }
     220              :     // insert it in types
     221        19228 :     myEdgeTypes[id] = newType;
     222        19228 : }
     223              : 
     224              : 
     225              : void
     226            0 : NBTypeCont::insertEdgeType(const std::string& id, const EdgeTypeDefinition* edgeType) {
     227              :     // Create edge type definition
     228            0 :     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            0 :     if (old != myEdgeTypes.end()) {
     233            0 :         newType->restrictions.insert(old->second->restrictions.begin(), old->second->restrictions.end());
     234            0 :         newType->attrs.insert(old->second->attrs.begin(), old->second->attrs.end());
     235            0 :         delete old->second;
     236              :     }
     237              :     // insert it in types
     238            0 :     myEdgeTypes[id] = newType;
     239            0 : }
     240              : 
     241              : 
     242              : void
     243           59 : NBTypeCont::insertLaneType(const std::string& edgeTypeID, int index, double maxSpeed, SVCPermissions permissions,
     244              :                            double width, const std::set<SumoXMLAttr>& attrs) {
     245           59 :     EdgeTypeDefinition* et = myEdgeTypes.at(edgeTypeID);
     246           59 :     while ((int)et->laneTypeDefinitions.size() <= index) {
     247            0 :         et->laneTypeDefinitions.push_back(et);
     248              :     }
     249              :     // add LaneTypeDefinition with the given attributes
     250           59 :     et->laneTypeDefinitions[index] = LaneTypeDefinition(maxSpeed, NBEdge::UNSPECIFIED_FRICTION, width, permissions, attrs);
     251           59 : }
     252              : 
     253              : 
     254              : int
     255         3205 : NBTypeCont::size() const {
     256         3205 :     return (int)myEdgeTypes.size();
     257              : }
     258              : 
     259              : 
     260              : void
     261            0 : NBTypeCont::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            0 :     if (it != myEdgeTypes.end()) {
     266              :         // remove it from map
     267            0 :         delete it->second;
     268              :         myEdgeTypes.erase(it);
     269              :     }
     270            0 : }
     271              : 
     272              : 
     273              : void
     274          247 : NBTypeCont::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          247 :     if ((oldIt != myEdgeTypes.end()) && (newIt == myEdgeTypes.end())) {
     280              :         // obtain pointer
     281          247 :         auto edgeType = oldIt->second;
     282              :         // remove it from map
     283              :         myEdgeTypes.erase(oldIt);
     284              :         // add it again
     285          247 :         myEdgeTypes[newId] = edgeType;
     286              :     }
     287          247 : }
     288              : 
     289              : 
     290              : NBTypeCont::TypesCont::const_iterator
     291           33 : NBTypeCont::begin() const {
     292           33 :     return myEdgeTypes.cbegin();
     293              : }
     294              : 
     295              : 
     296              : NBTypeCont::TypesCont::const_iterator
     297          256 : NBTypeCont::end() const {
     298          256 :     return myEdgeTypes.cend();
     299              : }
     300              : 
     301              : 
     302              : bool
     303       317609 : NBTypeCont::knows(const std::string& type) const {
     304       317609 :     return myEdgeTypes.find(type) != myEdgeTypes.end();
     305              : }
     306              : 
     307              : 
     308              : bool
     309          867 : NBTypeCont::markEdgeTypeAsToDiscard(const std::string& id) {
     310              :     TypesCont::iterator i = myEdgeTypes.find(id);
     311          867 :     if (i == myEdgeTypes.end()) {
     312              :         return false;
     313              :     }
     314          867 :     i->second->discard = true;
     315          867 :     return true;
     316              : }
     317              : 
     318              : 
     319              : bool
     320        94063 : NBTypeCont::markEdgeTypeAsSet(const std::string& id, const SumoXMLAttr attr) {
     321              :     TypesCont::iterator i = myEdgeTypes.find(id);
     322        94063 :     if (i == myEdgeTypes.end()) {
     323              :         return false;
     324              :     }
     325        94063 :     i->second->attrs.insert(attr);
     326        94063 :     return true;
     327              : }
     328              : 
     329              : 
     330              : bool
     331            2 : NBTypeCont::addEdgeTypeRestriction(const std::string& id, const SUMOVehicleClass svc, const double speed) {
     332              :     TypesCont::iterator i = myEdgeTypes.find(id);
     333            2 :     if (i == myEdgeTypes.end()) {
     334              :         return false;
     335              :     }
     336            2 :     i->second->restrictions[svc] = speed;
     337            2 :     return true;
     338              : }
     339              : 
     340              : 
     341              : bool
     342           84 : NBTypeCont::copyEdgeTypeRestrictionsAndAttrs(const std::string& fromId, const std::string& toId) {
     343              :     TypesCont::iterator from = myEdgeTypes.find(fromId);
     344              :     TypesCont::iterator to = myEdgeTypes.find(toId);
     345           84 :     if (from == myEdgeTypes.end() || to == myEdgeTypes.end()) {
     346              :         return false;
     347              :     }
     348           84 :     to->second->restrictions.insert(from->second->restrictions.begin(), from->second->restrictions.end());
     349           84 :     to->second->attrs.insert(from->second->attrs.begin(), from->second->attrs.end());
     350           84 :     return true;
     351              : }
     352              : 
     353              : 
     354              : bool
     355          100 : NBTypeCont::markLaneTypeAsSet(const std::string& id, int index, const SumoXMLAttr attr) {
     356              :     TypesCont::iterator i = myEdgeTypes.find(id);
     357          100 :     if (i == myEdgeTypes.end()) {
     358              :         return false;
     359              :     }
     360          100 :     i->second->laneTypeDefinitions[index].attrs.insert(attr);
     361          100 :     return true;
     362              : }
     363              : 
     364              : 
     365              : bool
     366            0 : NBTypeCont::addLaneTypeRestriction(const std::string& id, const SUMOVehicleClass svc, const double speed) {
     367              :     TypesCont::iterator i = myEdgeTypes.find(id);
     368            0 :     if (i == myEdgeTypes.end()) {
     369              :         return false;
     370              :     }
     371            0 :     i->second->laneTypeDefinitions.back().restrictions[svc] = speed;
     372            0 :     return true;
     373              : }
     374              : 
     375              : 
     376              : void
     377         2163 : NBTypeCont::writeEdgeTypes(OutputDevice& into,  const std::set<std::string>& typeIDs) const {
     378              :     // iterate over edge types
     379        20835 :     for (const auto& edgeType : myEdgeTypes) {
     380        18672 :         if (typeIDs.size() > 0 && typeIDs.count(edgeType.first) == 0) {
     381        16653 :             continue;
     382              :         }
     383        16152 :         auto write = [&](SumoXMLAttr attr, const auto & val) {
     384        16152 :             into.writeOptionalAttr(attr, val, edgeType.second->attrs.count(attr) == 0);
     385        18171 :         };
     386              : 
     387         2019 :         into.openTag(SUMO_TAG_TYPE);
     388         2019 :         into.writeAttr(SUMO_ATTR_ID, edgeType.first);
     389         2019 :         write(SUMO_ATTR_PRIORITY, edgeType.second->priority);
     390         2019 :         into.writeOptionalAttr(SUMO_ATTR_NUMLANES, edgeType.second->laneTypeDefinitions.size(),
     391         2220 :                                edgeType.second->attrs.count(SUMO_ATTR_NUMLANES) == 0 && edgeType.second->laneTypeDefinitions.size() <= 1);
     392         2019 :         write(SUMO_ATTR_SPEED, edgeType.second->speed);
     393         2019 :         write(SUMO_ATTR_FRICTION, edgeType.second->friction);
     394              :         // write permissions
     395         2019 :         if ((edgeType.second->attrs.count(SUMO_ATTR_DISALLOW) > 0) || (edgeType.second->attrs.count(SUMO_ATTR_ALLOW) > 0)) {
     396         1953 :             writePermissions(into, edgeType.second->permissions);
     397              :         }
     398              :         // write spreadType (unless default)
     399         2062 :         if ((edgeType.second->attrs.count(SUMO_ATTR_SPREADTYPE) > 0) && edgeType.second->spreadType != LaneSpreadFunction::RIGHT) {
     400            7 :             into.writeAttr(SUMO_ATTR_SPREADTYPE, SUMOXMLDefinitions::LaneSpreadFunctions.getString(edgeType.second->spreadType));
     401              :         }
     402         2019 :         write(SUMO_ATTR_ONEWAY, edgeType.second->oneWay);
     403         2019 :         write(SUMO_ATTR_DISCARD, edgeType.second->discard);
     404         2019 :         write(SUMO_ATTR_WIDTH, edgeType.second->width);
     405         2019 :         write(SUMO_ATTR_SIDEWALKWIDTH, edgeType.second->sidewalkWidth);
     406         2019 :         write(SUMO_ATTR_BIKELANEWIDTH, edgeType.second->bikeLaneWidth);
     407         2021 :         for (const auto& restriction : edgeType.second->restrictions) {
     408              :             // open restriction tag
     409            2 :             into.openTag(SUMO_TAG_RESTRICTION);
     410              :             // write vclass
     411            2 :             into.writeAttr(SUMO_ATTR_VCLASS, getVehicleClassNames(restriction.first));
     412              :             // write speed
     413            2 :             into.writeAttr(SUMO_ATTR_SPEED, restriction.second);
     414              :             // close restriction tag
     415            4 :             into.closeTag();
     416              :         }
     417              :         // iterate over lanes
     418         2019 :         if (edgeType.second->needsLaneType()) {
     419              :             int index = 0;
     420           68 :             for (const auto& laneType : edgeType.second->laneTypeDefinitions) {
     421              :                 // open lane type taG
     422           45 :                 into.openTag(SUMO_TAG_LANETYPE);
     423           45 :                 into.writeAttr(SUMO_ATTR_INDEX, index++);
     424              :                 // write speed
     425           34 :                 if (laneType.attrs.count(SUMO_ATTR_SPEED) > 0 && laneType.speed != NBEdge::UNSPECIFIED_SPEED
     426           34 :                         && laneType.speed != edgeType.second->speed) {
     427           34 :                     into.writeAttr(SUMO_ATTR_SPEED, laneType.speed);
     428              :                 }
     429              :                 // write friction
     430            0 :                 if (laneType.attrs.count(SUMO_ATTR_FRICTION) > 0 && laneType.friction != NBEdge::UNSPECIFIED_FRICTION
     431            0 :                         && laneType.friction != edgeType.second->friction) {
     432            0 :                     into.writeAttr(SUMO_ATTR_FRICTION, laneType.friction);
     433              :                 }
     434              :                 // write permissions
     435              :                 if (laneType.attrs.count(SUMO_ATTR_DISALLOW) > 0 || laneType.attrs.count(SUMO_ATTR_ALLOW) > 0) {
     436           11 :                     writePermissions(into, laneType.permissions);
     437              :                 }
     438              :                 // write width
     439           29 :                 if (laneType.attrs.count(SUMO_ATTR_WIDTH) > 0 && laneType.width != edgeType.second->width
     440           29 :                         && laneType.width != NBEdge::UNSPECIFIED_WIDTH) {
     441           29 :                     into.writeAttr(SUMO_ATTR_WIDTH, laneType.width);
     442              :                 }
     443              :                 // write restrictions
     444           45 :                 for (const auto& restriction : laneType.restrictions) {
     445              :                     // open restriction tag
     446            0 :                     into.openTag(SUMO_TAG_RESTRICTION);
     447              :                     // write vclass
     448            0 :                     into.writeAttr(SUMO_ATTR_VCLASS, getVehicleClassNames(restriction.first));
     449              :                     // write speed
     450            0 :                     into.writeAttr(SUMO_ATTR_SPEED, restriction.second);
     451              :                     // close restriction tag
     452            0 :                     into.closeTag();
     453              :                 }
     454              :                 // close lane type tag
     455           90 :                 into.closeTag();
     456              :             }
     457              :         }
     458              :         // close edge type tag
     459         4038 :         into.closeTag();
     460              :     }
     461              :     //write endlype
     462         2163 :     if (!myEdgeTypes.empty()) {
     463          704 :         into.lf();
     464              :     }
     465         2163 : }
     466              : 
     467              : 
     468              : int
     469       126768 : NBTypeCont::getEdgeTypeNumLanes(const std::string& type) const {
     470       126768 :     return (int)getEdgeType(type)->laneTypeDefinitions.size();
     471              : }
     472              : 
     473              : 
     474              : double
     475        90059 : NBTypeCont::getEdgeTypeSpeed(const std::string& type) const {
     476        90059 :     return getEdgeType(type)->speed;
     477              : }
     478              : 
     479              : double
     480        16921 : NBTypeCont::getEdgeTypeFriction(const std::string& type) const {
     481        16921 :     return getEdgeType(type)->friction;
     482              : }
     483              : 
     484              : 
     485              : int
     486        99838 : NBTypeCont::getEdgeTypePriority(const std::string& type) const {
     487        99838 :     return getEdgeType(type)->priority;
     488              : }
     489              : 
     490              : 
     491              : bool
     492        56221 : NBTypeCont::getEdgeTypeIsOneWay(const std::string& type) const {
     493        56221 :     return getEdgeType(type)->oneWay;
     494              : }
     495              : 
     496              : 
     497              : bool
     498       153164 : NBTypeCont::getEdgeTypeShallBeDiscarded(const std::string& type) const {
     499       153164 :     return getEdgeType(type)->discard;
     500              : }
     501              : 
     502              : double
     503        18787 : NBTypeCont::getEdgeTypeWidthResolution(const std::string& type) const {
     504        18787 :     return getEdgeType(type)->widthResolution;
     505              : }
     506              : 
     507              : double
     508        18787 : NBTypeCont::getEdgeTypeMaxWidth(const std::string& type) const {
     509        18787 :     return getEdgeType(type)->maxWidth;
     510              : }
     511              : 
     512              : double
     513        18267 : NBTypeCont::getEdgeTypeMinWidth(const std::string& type) const {
     514        18267 :     return getEdgeType(type)->minWidth;
     515              : }
     516              : 
     517              : bool
     518            0 : NBTypeCont::wasSetEdgeTypeAttribute(const std::string& type, const SumoXMLAttr attr) const {
     519            0 :     return getEdgeType(type)->attrs.count(attr) > 0;
     520              : }
     521              : 
     522              : 
     523              : SVCPermissions
     524       117170 : NBTypeCont::getEdgeTypePermissions(const std::string& type) const {
     525       117170 :     return getEdgeType(type)->permissions;
     526              : }
     527              : 
     528              : 
     529              : LaneSpreadFunction
     530        69987 : NBTypeCont::getEdgeTypeSpreadType(const std::string& type) const {
     531        69987 :     return getEdgeType(type)->spreadType;
     532              : }
     533              : 
     534              : 
     535              : double
     536       135552 : NBTypeCont::getEdgeTypeWidth(const std::string& type) const {
     537       135552 :     return getEdgeType(type)->width;
     538              : }
     539              : 
     540              : 
     541              : double
     542        73255 : NBTypeCont::getEdgeTypeSidewalkWidth(const std::string& type) const {
     543        73255 :     return getEdgeType(type)->sidewalkWidth;
     544              : }
     545              : 
     546              : 
     547              : double
     548        73094 : NBTypeCont::getEdgeTypeBikeLaneWidth(const std::string& type) const {
     549        73094 :     return getEdgeType(type)->bikeLaneWidth;
     550              : }
     551              : 
     552              : 
     553              : const NBTypeCont::EdgeTypeDefinition*
     554      1068302 : NBTypeCont::getEdgeType(const std::string& name) const {
     555              :     // try to find name in edge types
     556              :     TypesCont::const_iterator i = myEdgeTypes.find(name);
     557              :     // check if return edge types, or default edge types
     558      1068302 :     if (i == myEdgeTypes.end()) {
     559       437222 :         return myDefaultType;
     560              :     } else {
     561       631080 :         return i->second;
     562              :     }
     563              : }
     564              : 
     565              : /****************************************************************************/
        

Generated by: LCOV version 2.0-1