SUMO - Simulation of Urban MObility

NGEdge.cpp

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