Path: blob/main/src/netimport/vissim/tempstructs/NIVissimEdgePosMap.cpp
169684 views
/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-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 NIVissimEdgePosMap.cpp14/// @author Daniel Krajzewicz15/// @date Sept 200216///17// -------------------18/****************************************************************************/19#include <config.h>202122#include <map>23#include "NIVissimEdgePosMap.h"242526NIVissimEdgePosMap::NIVissimEdgePosMap() {}272829NIVissimEdgePosMap::~NIVissimEdgePosMap() {}303132void33NIVissimEdgePosMap::add(int edgeid, double pos) {34add(edgeid, pos, pos);35}363738void39NIVissimEdgePosMap::add(int edgeid, double from, double to) {40if (from > to) {41double tmp = from;42from = to;43to = tmp;44}45ContType::iterator i = myCont.find(edgeid);46if (i == myCont.end()) {47myCont[edgeid] = Range(from, to);48} else {49double pfrom = (*i).second.first;50double pto = (*i).second.second;51if (pfrom < from) {52from = pfrom;53}54if (pto > to) {55to = pto;56}57myCont[edgeid] = Range(from, to);58}59}606162void63NIVissimEdgePosMap::join(NIVissimEdgePosMap& with) {64for (ContType::iterator i = with.myCont.begin(); i != with.myCont.end(); i++) {65add((*i).first, (*i).second.first, (*i).second.second);66}67}686970/****************************************************************************/717273