SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NIVissimNodeDef.cpp
Go to the documentation of this file.
1 /****************************************************************************/
7 // -------------------
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
10 // Copyright (C) 2001-2014 DLR (http://www.dlr.de/) and contributors
11 /****************************************************************************/
12 //
13 // This file is part of SUMO.
14 // SUMO is free software: you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation, either version 3 of the License, or
17 // (at your option) any later version.
18 //
19 /****************************************************************************/
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #ifdef _MSC_VER
26 #include <windows_config.h>
27 #else
28 #include <config.h>
29 #endif
30 
31 
32 #include <iostream> // !!! debug
33 #include <cassert>
34 #include "NIVissimNodeDef.h"
35 #include "NIVissimConnection.h"
36 #include "NIVissimDisturbance.h"
37 #include "NIVissimTL.h"
38 
39 #ifdef CHECK_MEMORY_LEAKS
40 #include <foreign/nvwa/debug_new.h>
41 #endif // CHECK_MEMORY_LEAKS
42 
43 
44 // ===========================================================================
45 // static member variables
46 // ===========================================================================
49 
50 
51 // ===========================================================================
52 // method definitions
53 // ===========================================================================
54 NIVissimNodeDef::NIVissimNodeDef(int id, const std::string& name)
55  : myID(id), myName(name) {}
56 
57 
59 
60 
61 bool
63  DictType::iterator i = myDict.find(id);
64  if (i == myDict.end()) {
65  myDict[id] = o;
66  myMaxID = myMaxID > id
67  ? myMaxID
68  : id;
69 // o->computeBounding();
70  return true;
71  }
72  return false;
73 }
74 
75 
78  DictType::iterator i = myDict.find(id);
79  if (i == myDict.end()) {
80  return 0;
81  }
82  return (*i).second;
83 }
84 
85 /*
86 void
87 NIVissimNodeDef::buildNodeClusters()
88 {
89  for(DictType::iterator i=myDict.begin(); i!=myDict.end(); i++) {
90  int cluster = (*i).second->buildNodeCluster();
91  }
92 }
93 */
94 
95 
96 /*
97 
98 std::vector<int>
99 NIVissimNodeDef::getWithin(const AbstractPoly &p, SUMOReal off)
100 {
101  std::vector<int> ret;
102  for(DictType::iterator i=myDict.begin(); i!=myDict.end(); i++) {
103  NIVissimNodeDef *d = (*i).second;
104  if(d->partialWithin(p, off)) {
105  ret.push_back((*i).first);
106  }
107  }
108  return ret;
109 }
110 
111 bool
112 NIVissimNodeDef::partialWithin(const AbstractPoly &p, SUMOReal off) const
113 {
114  assert(myBoundary!=0&&myBoundary->xmax()>=myBoundary->xmin());
115  return myBoundary->partialWithin(p, off);
116 }
117 */
118 
119 void
121  for (DictType::iterator i = myDict.begin(); i != myDict.end(); i++) {
122  (*i).second->searchAndSetConnections();
123  }
124 }
125 
126 
127 size_t
129  return myDict.size();
130 }
131 
132 
133 
134 void
136  for (DictType::iterator i = myDict.begin(); i != myDict.end(); i++) {
137  delete(*i).second;
138  }
139  myDict.clear();
140 }
141 
142 
143 int
145  return myMaxID;
146 }
147 
148 
149 
150 /****************************************************************************/
151 
static void clearDict()
virtual ~NIVissimNodeDef()
static int myMaxID
static int getMaxID()
static size_t dictSize()
static bool dictionary(int id, NIVissimNodeDef *o)
std::map< int, NIVissimNodeDef * > DictType
static DictType myDict
static void dict_assignConnectionsToNodes()
NIVissimNodeDef(int id, const std::string &name)