SUMO - Simulation of Urban MObility
NIVissimNodeDef_Edges.cpp
Go to the documentation of this file.
1 /****************************************************************************/
8 // -------------------
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
11 // Copyright (C) 2001-2014 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 /****************************************************************************/
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #ifdef _MSC_VER
27 #include <windows_config.h>
28 #else
29 #include <config.h>
30 #endif
31 
32 
33 
34 #include <string>
35 #include <map>
36 #include <algorithm>
37 #include <cassert>
38 #include <utils/geom/Boundary.h>
40 #include "NIVissimNodeDef.h"
41 #include "NIVissimEdge.h"
42 #include "NIVissimNodeDef_Edges.h"
43 #include "NIVissimDisturbance.h"
44 #include "NIVissimConnection.h"
45 
46 #ifdef CHECK_MEMORY_LEAKS
47 #include <foreign/nvwa/debug_new.h>
48 #endif // CHECK_MEMORY_LEAKS
49 
50 
51 // ===========================================================================
52 // method definitions
53 // ===========================================================================
55  const std::string& name, const NIVissimNodeParticipatingEdgeVector& edges)
56  : NIVissimNodeDef(id, name), myEdges(edges) {}
57 
58 
60  for (NIVissimNodeParticipatingEdgeVector::iterator i = myEdges.begin(); i != myEdges.end(); i++) {
61  delete(*i);
62  }
63  myEdges.clear();
64 }
65 
66 
67 bool
68 NIVissimNodeDef_Edges::dictionary(int id, const std::string& name,
70  NIVissimNodeDef_Edges* o = new NIVissimNodeDef_Edges(id, name, edges);
71  if (!NIVissimNodeDef::dictionary(id, o)) {
72  delete o;
73  return false;
74  }
75  return true;
76 }
77 
78 
79 void
81  std::vector<int> connections;
82  std::vector<int> edges;
83  Boundary boundary;
84  for (NIVissimNodeParticipatingEdgeVector::const_iterator i = myEdges.begin(); i != myEdges.end(); i++) {
88  NIVissimEdge* e =
90  if (c != 0) {
91  connections.push_back(edge->getID());
92  boundary.add(c->getFromGeomPosition());
93  boundary.add(c->getToGeomPosition());
94  c->setNodeCluster(myID);
95  }
96  if (e != 0) {
97  edges.push_back(edge->getID());
98  boundary.add(e->getGeomPosition(edge->getFromPos()));
99  boundary.add(e->getGeomPosition(edge->getToPos()));
100  }
101  }
103  new NIVissimConnectionCluster(connections, boundary, myID, edges);
104  for (std::vector<int>::iterator j = edges.begin(); j != edges.end(); j++) {
106  edge->myConnectionClusters.push_back(c);
107  }
108 }
109 
110 
111 
112 SUMOReal
114  for (NIVissimNodeParticipatingEdgeVector::const_iterator i = myEdges.begin(); i != myEdges.end(); i++) {
116  if (edge->getID() == edgeid) {
117  return (edge->getFromPos() + edge->getToPos()) / (SUMOReal) 2.0;
118  }
119  }
120  return -1;
121 }
122 
123 
124 
125 /****************************************************************************/
126 
virtual void searchAndSetConnections()
ConnectionClusters myConnectionClusters
List of connection clusters along this edge.
Definition: NIVissimEdge.h:275
virtual SUMOReal getEdgePosition(int edgeid) const
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:48
Position getToGeomPosition() const
static bool dictionary(int id, const std::string &name, const NIVissimNodeParticipatingEdgeVector &edges)
A temporary storage for edges imported from Vissim.
Definition: NIVissimEdge.h:61
void setNodeCluster(int nodeid)
static bool dictionary(int id, NIVissimNodeDef *o)
std::vector< NIVissimNodeParticipatingEdge * > NIVissimNodeParticipatingEdgeVector
void add(SUMOReal x, SUMOReal y)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:76
NIVissimNodeDef_Edges(int id, const std::string &name, const NIVissimNodeParticipatingEdgeVector &edges)
static bool dictionary(int id, const std::string &name, const NIVissimExtendedEdgePoint &from_def, const NIVissimExtendedEdgePoint &to_def, const PositionVector &geom, Direction direction, SUMOReal dxnothalt, SUMOReal dxeinordnen, SUMOReal zuschlag1, SUMOReal zuschlag2, SUMOReal seglength, const std::vector< int > &assignedVehicles, const NIVissimClosedLanesVector &clv)
static bool dictionary(int id, const std::string &name, const std::string &type, int noLanes, SUMOReal zuschlag1, SUMOReal zuschlag2, SUMOReal length, const PositionVector &geom, const NIVissimClosedLanesVector &clv)
Adds the described item to the dictionary Builds the edge first.
#define SUMOReal
Definition: config.h:215
NIVissimNodeParticipatingEdgeVector myEdges
Position getFromGeomPosition() const