Path: blob/main/src/netimport/vissim/tempstructs/NIVissimDistrictConnection.h
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 NIVissimDistrictConnection.h14/// @author Daniel Krajzewicz15/// @author Michael Behrisch16/// @date End of 200217///18// An edge imported from Vissim together for a container for19/****************************************************************************/20#pragma once21#include <config.h>2223#include <map>24#include <string>25#include <utils/geom/Position.h>262728class NBDistrictCont;29class NBEdgeCont;303132// ===========================================================================33// class definitions34// ===========================================================================35class NIVissimDistrictConnection {36public:37/// Contructor38NIVissimDistrictConnection(int id, const std::string& name,39const std::vector<int>& districts, const std::vector<double>& percentages,40int edgeid, double position,41const std::vector<std::pair<int, int> >& assignedVehicles);4243// Destructor44~NIVissimDistrictConnection();4546/** @brief Returns the position47The position yields from the edge geometry and the place the connection is plaed at */48Position geomPosition() const;4950/// Returns the id of the connection51int getID() const {52return myID;53}5455/// Returns the position of the connection at the edge56double getPosition() const {57return myPosition;58}5960double getMeanSpeed() const;6162public:63/// Inserts the connection into the dictionary after building it64static bool dictionary(int id, const std::string& name,65const std::vector<int>& districts, const std::vector<double>& percentages,66int edgeid, double position,67const std::vector<std::pair<int, int> >& assignedVehicles);6869/// Inserts the build connection to the dictionary70static bool dictionary(int id, NIVissimDistrictConnection* o);7172/// Returns the named dictionary73static NIVissimDistrictConnection* dictionary(int id);7475/// Builds the nodes that belong to a district76static void dict_BuildDistrictNodes(NBDistrictCont& dc,77NBNodeCont& nc);7879/// Builds the districts80static void dict_BuildDistricts(NBDistrictCont& dc,81NBEdgeCont& ec, NBNodeCont& nc);8283/** @brief Returns the connection to a district placed at the given node84Yep, there onyl should be one, there is no need to build a single edge as connection between two parking places */85static NIVissimDistrictConnection* dict_findForEdge(int edgeid);8687/// Clears the dictionary88static void clearDict();8990static void dict_BuildDistrictConnections();9192static void dict_CheckEdgeEnds();939495private:96void checkEdgeEnd();97double getRealSpeed(int distNo) const;9899private:100/// The id of the connections101int myID;102103/// The name of the connections104std::string myName;105106/// The connected districts107std::vector<int> myDistricts;108109/// Definition of a map of how many vehicles should leave to a certain district110typedef std::map<int, double> DistrictPercentages;111112/// A map how many vehicles (key, amount) should leave to a district (key)113DistrictPercentages myPercentages;114115/// The id of the connected edge116int myEdgeID;117118/// The position on the edge119double myPosition;120121/// The vehicles using this connection122std::vector<std::pair<int, int> > myAssignedVehicles;123124private:125/// Definition of a dictionary of district connections126typedef std::map<int, NIVissimDistrictConnection*> DictType;127128/// District connection dictionary129static DictType myDict;130131/// Map from ditricts to connections132static std::map<int, std::vector<int> > myDistrictsConnections;133134};135136137