Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netimport/vissim/tempstructs/NIVissimTL.h
169684 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2001-2025 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
/****************************************************************************/
14
/// @file NIVissimTL.h
15
/// @author Daniel Krajzewicz
16
/// @author Michael Behrisch
17
/// @date Sept 2002
18
///
19
// -------------------
20
/****************************************************************************/
21
#pragma once
22
#include <config.h>
23
24
25
#include <map>
26
#include <string>
27
#include <vector>
28
#include <utils/geom/PositionVector.h>
29
#include <utils/geom/AbstractPoly.h>
30
#include <utils/common/SUMOTime.h>
31
32
33
// ===========================================================================
34
// class declarations
35
// ===========================================================================
36
class NBTrafficLightLogicCont;
37
class NBLoadedTLDef;
38
class NBEdgeCont;
39
40
41
// ===========================================================================
42
// class definitions
43
// ===========================================================================
44
/**
45
* @class NIVissimTL
46
*/
47
class NIVissimTL {
48
public:
49
NIVissimTL(int id, const std::string& type, const std::string& name,
50
SUMOTime absdur, SUMOTime offset);
51
~NIVissimTL();
52
// void computeBounding();
53
std::string getType() const;
54
int getID() const;
55
56
public:
57
static bool dictionary(int id, const std::string& type,
58
const std::string& name, SUMOTime absdur, SUMOTime offset);
59
static bool dictionary(int id, NIVissimTL* o);
60
static NIVissimTL* dictionary(int id);
61
// static std::vector<int> getWithin(const AbstractPoly &poly, double offset);
62
static void clearDict();
63
static bool dict_SetSignals(NBTrafficLightLogicCont& tlc,
64
NBEdgeCont& ec);
65
66
public:
67
class NIVissimTLSignal;
68
class NIVissimTLSignalGroup;
69
typedef std::map<int, NIVissimTLSignal*> SSignalDictType;
70
typedef std::map<int, NIVissimTLSignalGroup*> SGroupDictType;
71
typedef std::map<int, SSignalDictType> SignalDictType;
72
typedef std::map<int, SGroupDictType> GroupDictType;
73
74
/**
75
*
76
*/
77
class NIVissimTLSignal {
78
public:
79
NIVissimTLSignal(int id, const std::string& name,
80
const std::vector<int>& groupids, int edgeid, int laneno,
81
double position, const std::vector<int>& assignedVehicleTypes);
82
~NIVissimTLSignal();
83
bool isWithin(const PositionVector& poly) const;
84
Position getPosition() const;
85
bool addTo(NBEdgeCont& ec, NBLoadedTLDef* node) const;
86
87
public:
88
static bool dictionary(int lsaid, int id, NIVissimTLSignal* o);
89
static NIVissimTLSignal* dictionary(int lsaid, int id);
90
static void clearDict();
91
static SSignalDictType getSignalsFor(int tlid);
92
93
protected:
94
int myID;
95
std::string myName;
96
std::vector<int> myGroupIDs;
97
int myEdgeID;
98
int myLane;
99
double myPosition;
100
std::vector<int> myVehicleTypes;
101
static SignalDictType myDict;
102
};
103
104
class NIVissimTLSignalGroup {
105
public:
106
NIVissimTLSignalGroup(int id, const std::string& name,
107
bool isGreenBegin, const std::vector<SUMOTime>& times,
108
SUMOTime tredyellow, SUMOTime tyellow);
109
~NIVissimTLSignalGroup();
110
bool addTo(NBLoadedTLDef* node) const;
111
public:
112
static bool dictionary(int lsaid, int id, NIVissimTLSignalGroup* o);
113
static NIVissimTLSignalGroup* dictionary(int lsaid, int id);
114
static void clearDict();
115
static SGroupDictType getGroupsFor(int tlid);
116
117
private:
118
int myID;
119
std::string myName;
120
std::vector<SUMOTime> myTimes;
121
bool myFirstIsRed;
122
SUMOTime myTRedYellow, myTYellow;
123
static GroupDictType myDict;
124
};
125
126
protected:
127
int myID;
128
std::string myName;
129
SUMOTime myAbsDuration;
130
SUMOTime myOffset;
131
NIVissimTLSignalGroup* myCurrentGroup;
132
std::string myType;
133
private:
134
typedef std::map<int, NIVissimTL*> DictType;
135
static DictType myDict;
136
};
137
138