Path: blob/main/src/netimport/vissim/tempstructs/NIVissimTL.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 NIVissimTL.h14/// @author Daniel Krajzewicz15/// @author Michael Behrisch16/// @date Sept 200217///18// -------------------19/****************************************************************************/20#pragma once21#include <config.h>222324#include <map>25#include <string>26#include <vector>27#include <utils/geom/PositionVector.h>28#include <utils/geom/AbstractPoly.h>29#include <utils/common/SUMOTime.h>303132// ===========================================================================33// class declarations34// ===========================================================================35class NBTrafficLightLogicCont;36class NBLoadedTLDef;37class NBEdgeCont;383940// ===========================================================================41// class definitions42// ===========================================================================43/**44* @class NIVissimTL45*/46class NIVissimTL {47public:48NIVissimTL(int id, const std::string& type, const std::string& name,49SUMOTime absdur, SUMOTime offset);50~NIVissimTL();51// void computeBounding();52std::string getType() const;53int getID() const;5455public:56static bool dictionary(int id, const std::string& type,57const std::string& name, SUMOTime absdur, SUMOTime offset);58static bool dictionary(int id, NIVissimTL* o);59static NIVissimTL* dictionary(int id);60// static std::vector<int> getWithin(const AbstractPoly &poly, double offset);61static void clearDict();62static bool dict_SetSignals(NBTrafficLightLogicCont& tlc,63NBEdgeCont& ec);6465public:66class NIVissimTLSignal;67class NIVissimTLSignalGroup;68typedef std::map<int, NIVissimTLSignal*> SSignalDictType;69typedef std::map<int, NIVissimTLSignalGroup*> SGroupDictType;70typedef std::map<int, SSignalDictType> SignalDictType;71typedef std::map<int, SGroupDictType> GroupDictType;7273/**74*75*/76class NIVissimTLSignal {77public:78NIVissimTLSignal(int id, const std::string& name,79const std::vector<int>& groupids, int edgeid, int laneno,80double position, const std::vector<int>& assignedVehicleTypes);81~NIVissimTLSignal();82bool isWithin(const PositionVector& poly) const;83Position getPosition() const;84bool addTo(NBEdgeCont& ec, NBLoadedTLDef* node) const;8586public:87static bool dictionary(int lsaid, int id, NIVissimTLSignal* o);88static NIVissimTLSignal* dictionary(int lsaid, int id);89static void clearDict();90static SSignalDictType getSignalsFor(int tlid);9192protected:93int myID;94std::string myName;95std::vector<int> myGroupIDs;96int myEdgeID;97int myLane;98double myPosition;99std::vector<int> myVehicleTypes;100static SignalDictType myDict;101};102103class NIVissimTLSignalGroup {104public:105NIVissimTLSignalGroup(int id, const std::string& name,106bool isGreenBegin, const std::vector<SUMOTime>& times,107SUMOTime tredyellow, SUMOTime tyellow);108~NIVissimTLSignalGroup();109bool addTo(NBLoadedTLDef* node) const;110public:111static bool dictionary(int lsaid, int id, NIVissimTLSignalGroup* o);112static NIVissimTLSignalGroup* dictionary(int lsaid, int id);113static void clearDict();114static SGroupDictType getGroupsFor(int tlid);115116private:117int myID;118std::string myName;119std::vector<SUMOTime> myTimes;120bool myFirstIsRed;121SUMOTime myTRedYellow, myTYellow;122static GroupDictType myDict;123};124125protected:126int myID;127std::string myName;128SUMOTime myAbsDuration;129SUMOTime myOffset;130NIVissimTLSignalGroup* myCurrentGroup;131std::string myType;132private:133typedef std::map<int, NIVissimTL*> DictType;134static DictType myDict;135};136137138