SUMO - Simulation of Urban MObility
NGEdge.cpp
Go to the documentation of this file.
00001 /****************************************************************************/
00009 // A netgen-representation of an edge
00010 /****************************************************************************/
00011 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00012 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
00013 /****************************************************************************/
00014 //
00015 //   This file is part of SUMO.
00016 //   SUMO is free software: you can redistribute it and/or modify
00017 //   it under the terms of the GNU General Public License as published by
00018 //   the Free Software Foundation, either version 3 of the License, or
00019 //   (at your option) any later version.
00020 //
00021 /****************************************************************************/
00022 
00023 
00024 // ===========================================================================
00025 // included modules
00026 // ===========================================================================
00027 #ifdef _MSC_VER
00028 #include <windows_config.h>
00029 #else
00030 #include <config.h>
00031 #endif
00032 
00033 #include <algorithm>
00034 #include <netbuild/NBNode.h>
00035 #include <netbuild/NBNodeCont.h>
00036 #include <netbuild/NBEdge.h>
00037 #include <netbuild/NBOwnTLDef.h>
00038 #include <netbuild/NBTypeCont.h>
00039 #include <netbuild/NBTrafficLightLogicCont.h>
00040 #include <netbuild/NBNetBuilder.h>
00041 #include <utils/common/UtilExceptions.h>
00042 #include <utils/common/ToString.h>
00043 #include <utils/geom/GeoConvHelper.h>
00044 #include <utils/options/OptionsCont.h>
00045 #include <utils/options/Option.h>
00046 #include "NGEdge.h"
00047 #include "NGNode.h"
00048 
00049 #ifdef CHECK_MEMORY_LEAKS
00050 #include <foreign/nvwa/debug_new.h>
00051 #endif // CHECK_MEMORY_LEAKS
00052 
00053 
00054 // ===========================================================================
00055 // method definitions
00056 // ===========================================================================
00057 // ---------------------------------------------------------------------------
00058 // NGEdge-definitions
00059 // ---------------------------------------------------------------------------
00060 NGEdge::NGEdge(const std::string& id, NGNode* startNode, NGNode* endNode)
00061     : myID(id), myStartNode(startNode), myEndNode(endNode) {
00062     myStartNode->addLink(this);
00063     myEndNode->addLink(this);
00064 }
00065 
00066 
00067 NGEdge::~NGEdge() {
00068     myStartNode->removeLink(this);
00069     myEndNode->removeLink(this);
00070 }
00071 
00072 
00073 NBEdge*
00074 NGEdge::buildNBEdge(NBNetBuilder& nb) const {
00075     return new NBEdge(
00076                myID,
00077                nb.getNodeCont().retrieve(myStartNode->getID()), // from
00078                nb.getNodeCont().retrieve(myEndNode->getID()), // to
00079                "", nb.getTypeCont().getSpeed(""), nb.getTypeCont().getNumLanes(""),
00080                nb.getTypeCont().getPriority(""), nb.getTypeCont().getWidth(""), -1
00081            );
00082 }
00083 
00084 
00085 /****************************************************************************/
00086 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines