Path: blob/main/src/netimport/vissim/tempstructs/NIVissimNodeDef.cpp
169684 views
/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2002-2025 German Aerospace Center (DLR) and others.3// This program and the accompanying materials are made available under the4// terms of the Eclipse Public License 2.0 which is available at5// https://www.eclipse.org/legal/epl-2.0/6// This Source Code may also be made available under the following Secondary7// Licenses when the conditions for such availability set forth in the Eclipse8// Public License 2.0 are satisfied: GNU General Public License, version 29// or later which is available at10// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later12/****************************************************************************/13/// @file NIVissimNodeDef.cpp14/// @author Daniel Krajzewicz15/// @author Michael Behrisch16/// @date Sept 200217///18// -------------------19/****************************************************************************/20#include <config.h>212223#include <iostream> // !!! debug24#include <cassert>25#include "NIVissimNodeDef.h"26#include "NIVissimConnection.h"27#include "NIVissimDisturbance.h"28#include "NIVissimTL.h"293031// ===========================================================================32// static member variables33// ===========================================================================34NIVissimNodeDef::DictType NIVissimNodeDef::myDict;35int NIVissimNodeDef::myMaxID = 0;363738// ===========================================================================39// method definitions40// ===========================================================================41NIVissimNodeDef::NIVissimNodeDef(int id, const std::string& name)42: myID(id), myName(name) {}434445NIVissimNodeDef::~NIVissimNodeDef() {}464748bool49NIVissimNodeDef::dictionary(int id, NIVissimNodeDef* o) {50DictType::iterator i = myDict.find(id);51if (i == myDict.end()) {52myDict[id] = o;53myMaxID = myMaxID > id54? myMaxID55: id;56// o->computeBounding();57return true;58}59return false;60}616263NIVissimNodeDef*64NIVissimNodeDef::dictionary(int id) {65DictType::iterator i = myDict.find(id);66if (i == myDict.end()) {67return nullptr;68}69return (*i).second;70}7172/*73void74NIVissimNodeDef::buildNodeClusters()75{76for(DictType::iterator i=myDict.begin(); i!=myDict.end(); i++) {77int cluster = (*i).second->buildNodeCluster();78}79}80*/818283/*8485std::vector<int>86NIVissimNodeDef::getWithin(const AbstractPoly &p, double off)87{88std::vector<int> ret;89for(DictType::iterator i=myDict.begin(); i!=myDict.end(); i++) {90NIVissimNodeDef *d = (*i).second;91if(d->partialWithin(p, off)) {92ret.push_back((*i).first);93}94}95return ret;96}9798bool99NIVissimNodeDef::partialWithin(const AbstractPoly &p, double off) const100{101assert(myBoundary!=0&&myBoundary->xmax()>=myBoundary->xmin());102return myBoundary->partialWithin(p, off);103}104105106void107NIVissimNodeDef::dict_assignConnectionsToNodes() {108for (DictType::iterator i = myDict.begin(); i != myDict.end(); i++) {109(*i).second->searchAndSetConnections();110}111}112*/113114115void116NIVissimNodeDef::clearDict() {117for (DictType::iterator i = myDict.begin(); i != myDict.end(); i++) {118delete (*i).second;119}120myDict.clear();121}122123124int125NIVissimNodeDef::getMaxID() {126return myMaxID;127}128129130/****************************************************************************/131132133