Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
NIVissimNodeDef.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2002-2024 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
19// -------------------
20/****************************************************************************/
21#include <config.h>
22
23
24#include <iostream> // !!! debug
25#include <cassert>
26#include "NIVissimNodeDef.h"
27#include "NIVissimConnection.h"
28#include "NIVissimDisturbance.h"
29#include "NIVissimTL.h"
30
31
32// ===========================================================================
33// static member variables
34// ===========================================================================
37
38
39// ===========================================================================
40// method definitions
41// ===========================================================================
42NIVissimNodeDef::NIVissimNodeDef(int id, const std::string& name)
43 : myID(id), myName(name) {}
44
45
47
48
49bool
51 DictType::iterator i = myDict.find(id);
52 if (i == myDict.end()) {
53 myDict[id] = o;
54 myMaxID = myMaxID > id
55 ? myMaxID
56 : id;
57// o->computeBounding();
58 return true;
59 }
60 return false;
61}
62
63
66 DictType::iterator i = myDict.find(id);
67 if (i == myDict.end()) {
68 return nullptr;
69 }
70 return (*i).second;
71}
72
73/*
74void
75NIVissimNodeDef::buildNodeClusters()
76{
77 for(DictType::iterator i=myDict.begin(); i!=myDict.end(); i++) {
78 int cluster = (*i).second->buildNodeCluster();
79 }
80}
81*/
82
83
84/*
85
86std::vector<int>
87NIVissimNodeDef::getWithin(const AbstractPoly &p, double off)
88{
89 std::vector<int> ret;
90 for(DictType::iterator i=myDict.begin(); i!=myDict.end(); i++) {
91 NIVissimNodeDef *d = (*i).second;
92 if(d->partialWithin(p, off)) {
93 ret.push_back((*i).first);
94 }
95 }
96 return ret;
97}
98
99bool
100NIVissimNodeDef::partialWithin(const AbstractPoly &p, double off) const
101{
102 assert(myBoundary!=0&&myBoundary->xmax()>=myBoundary->xmin());
103 return myBoundary->partialWithin(p, off);
104}
105
106
107void
108NIVissimNodeDef::dict_assignConnectionsToNodes() {
109 for (DictType::iterator i = myDict.begin(); i != myDict.end(); i++) {
110 (*i).second->searchAndSetConnections();
111 }
112}
113*/
114
115
116void
118 for (DictType::iterator i = myDict.begin(); i != myDict.end(); i++) {
119 delete (*i).second;
120 }
121 myDict.clear();
122}
123
124
125int
129
130
131/****************************************************************************/
static void clearDict()
static DictType myDict
virtual ~NIVissimNodeDef()
NIVissimNodeDef(int id, const std::string &name)
static bool dictionary(int id, NIVissimNodeDef *o)
static int getMaxID()
std::map< int, NIVissimNodeDef * > DictType