SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NGEdge.cpp
Go to the documentation of this file.
1 /****************************************************************************/
10 // A netgen-representation of an edge
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
13 // Copyright (C) 2003-2014 DLR (http://www.dlr.de/) and contributors
14 /****************************************************************************/
15 //
16 // This file is part of SUMO.
17 // SUMO is free software: you can redistribute it and/or modify
18 // it under the terms of the GNU General Public License as published by
19 // the Free Software Foundation, either version 3 of the License, or
20 // (at your option) any later version.
21 //
22 /****************************************************************************/
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #include <algorithm>
35 #include <netbuild/NBNode.h>
36 #include <netbuild/NBNodeCont.h>
37 #include <netbuild/NBEdge.h>
38 #include <netbuild/NBOwnTLDef.h>
39 #include <netbuild/NBTypeCont.h>
41 #include <netbuild/NBNetBuilder.h>
43 #include <utils/common/ToString.h>
46 #include <utils/options/Option.h>
47 #include "NGEdge.h"
48 #include "NGNode.h"
49 
50 #ifdef CHECK_MEMORY_LEAKS
51 #include <foreign/nvwa/debug_new.h>
52 #endif // CHECK_MEMORY_LEAKS
53 
54 
55 // ===========================================================================
56 // method definitions
57 // ===========================================================================
58 // ---------------------------------------------------------------------------
59 // NGEdge-definitions
60 // ---------------------------------------------------------------------------
61 NGEdge::NGEdge(const std::string& id, NGNode* startNode, NGNode* endNode)
62  : Named(id), myStartNode(startNode), myEndNode(endNode) {
63  myStartNode->addLink(this);
64  myEndNode->addLink(this);
65 }
66 
67 
69  myStartNode->removeLink(this);
70  myEndNode->removeLink(this);
71 }
72 
73 
74 NBEdge*
76  return new NBEdge(
77  myID,
78  nb.getNodeCont().retrieve(myStartNode->getID()), // from
79  nb.getNodeCont().retrieve(myEndNode->getID()), // to
80  "", nb.getTypeCont().getSpeed(""), nb.getTypeCont().getNumLanes(""),
82  );
83 }
84 
85 
86 /****************************************************************************/
87