Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netimport/vissim/tempstructs/NIVissimConflictArea.h
169684 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2002-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 NIVissimConflictArea.h
15
/// @author Lukas Grohmann
16
/// @date Aug 2015
17
///
18
// -------------------
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
24
#include <map>
25
#include <string>
26
#include <utils/common/StringUtils.h>
27
#include "NIVissimConnection.h"
28
#include <netbuild/NBEdgeCont.h>
29
#include <netbuild/NBEdge.h>
30
#include <netbuild/NBNode.h>
31
32
33
// ===========================================================================
34
// class declarations
35
// ===========================================================================
36
37
38
39
// ===========================================================================
40
// class definitions
41
// ===========================================================================
42
/**
43
* @class NIVissimConflictArea
44
* @brief A temporary storage for conflict areas imported from Vissim
45
*/
46
class NIVissimConflictArea {
47
public:
48
/// Constructor
49
NIVissimConflictArea(int id, const std::string& link1,
50
const std::string& link2,
51
const std::string& status);
52
53
54
/// Destructor
55
~NIVissimConflictArea();
56
57
public:
58
/** @brief Adds the described item to the dictionary
59
Builds the conflict area first */
60
static bool dictionary(int id, const std::string& link1,
61
const std::string& link2, const std::string& status);
62
63
/// Adds the conflict area to the dictionary
64
static bool dictionary(int id, NIVissimConflictArea* ca);
65
66
/// Returns the named dictionary
67
static NIVissimConflictArea* dictionary(int id);
68
69
/// Returns the conflict area from the dictionary, which defines
70
/// the priority rule of the two given links
71
static NIVissimConflictArea* dict_findByLinks(const std::string& link1,
72
const std::string& link2);
73
74
/// Clears the dictionary
75
static void clearDict();
76
77
/// Returns the dictionary including all conflict areas
78
static std::map<int, NIVissimConflictArea*> getConflictAreas() {
79
return myDict;
80
}
81
82
/// Returns the ID of the conflic area
83
int getID() {
84
return myConflictID;
85
}
86
87
/// Returns the first link of the conflic area
88
std::string getFirstLink() {
89
return myFirstLink;
90
}
91
92
/// Returns the second link of the conflic area
93
std::string getSecondLink() {
94
return mySecondLink;
95
}
96
97
/// Returns the priority regulation of the conflic area
98
std::string getStatus() {
99
return myStatus;
100
}
101
102
/// Sets the priority regulation according to the VISSIM conflict area data
103
static void setPriorityRegulation(NBEdgeCont& ec);
104
105
106
107
private:
108
/// The id of the conflict area
109
int myConflictID;
110
111
/// The first link of the conflict area
112
std::string myFirstLink;
113
114
/// The second link of the conflict area
115
std::string mySecondLink;
116
117
/// The priority regulation of the conflict area
118
std::string myStatus;
119
120
private:
121
/// @brief Definition of the dictionary type
122
typedef std::map<int, NIVissimConflictArea*> DictType;
123
124
/// @brief The dictionary
125
static DictType myDict;
126
};
127
128