Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/frames/network/GNEProhibitionFrame.h
169689 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 GNEProhibitionFrame.h
15
/// @author Mirko Barthauer (Technische Universitaet Braunschweig)
16
/// @date May 2018
17
///
18
// The Widget for remove network-elements
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
#include <netedit/frames/GNEFrame.h>
23
24
// ===========================================================================
25
// class declarations
26
// ===========================================================================
27
class GNEConnection;
28
class GNEAttributeCarrier;
29
30
// ===========================================================================
31
// class definitions
32
// ===========================================================================
33
/**
34
* @class GNEProhibitionFrame
35
* The Widget for editing connection foes
36
*/
37
class GNEProhibitionFrame : public GNEFrame {
38
39
public:
40
41
/// @brief the prohibition status of a connection
42
enum ConnStatus {
43
UNDEFINED,
44
PROHIBITED,
45
PROHIBITING
46
};
47
48
// ===========================================================================
49
// class RelativeToConnection
50
// ===========================================================================
51
52
class RelativeToConnection : public MFXGroupBoxModule {
53
54
public:
55
/// @brief constructor
56
RelativeToConnection(GNEProhibitionFrame* prohibitionFrameParent);
57
58
/// @brief destructor
59
~RelativeToConnection();
60
61
/// @brief update description
62
void updateDescription() const;
63
64
private:
65
/// @brief pointer to prohibition frame parent
66
GNEProhibitionFrame* myProhibitionFrameParent;
67
68
/// @brief the label that shows the currently selected connection
69
FXLabel* myConnDescriptionLabel;
70
};
71
72
// ===========================================================================
73
// class Legend
74
// ===========================================================================
75
76
class Legend : public MFXGroupBoxModule {
77
78
public:
79
/// @brief constructor
80
Legend(GNEProhibitionFrame* prohibitionFrameParent);
81
82
/// @brief destructor
83
~Legend();
84
85
/// @brief get color for non-conflicting pairs of connections
86
const RGBColor& getUndefinedColor() const;
87
88
/// @brief get color for waiting connections
89
const RGBColor& getProhibitedColor() const;
90
91
/// @brief get color for connections with precedence
92
const RGBColor& getProhibitingColor() const;
93
94
/// @brief get color for unregulated conflicts
95
const RGBColor& getUnregulatedConflictColor() const;
96
97
/// @brief get color for mutual conflicts
98
const RGBColor& getMutualConflictColor() const;
99
100
private:
101
/// @brief color for non-conflicting pairs of connections
102
RGBColor myUndefinedColor;
103
104
/// @brief color for waiting connections
105
RGBColor myProhibitedColor;
106
107
/// @brief color for connections with precedence
108
RGBColor myProhibitingColor;
109
110
/// @brief color for unregulated conflicts
111
RGBColor myUnregulatedConflictColor;
112
113
/// @brief color for mutual conflicts
114
RGBColor myMutualConflictColor;
115
};
116
117
// ===========================================================================
118
// class Selection (in the future will be "Modification")
119
// ===========================================================================
120
121
class Selection : public MFXGroupBoxModule {
122
/// @brief FOX-declaration
123
FXDECLARE(GNEProhibitionFrame::Selection)
124
125
public:
126
/// @brief constructor
127
Selection(GNEProhibitionFrame* prohibitionFrameParent);
128
129
/// @brief destructor
130
~Selection();
131
132
/// @name FOX-callbacks
133
/// @{
134
135
/// @brief Called when the user presses the OK-Button saves any prohibition modifications
136
long onCmdOK(FXObject*, FXSelector, void*);
137
138
/// @brief Called when the user presses the Cancel-button discards any prohibition modifications
139
long onCmdCancel(FXObject*, FXSelector, void*);
140
141
/// @brief Called when the user presses the OK-Button saves any prohibition modifications
142
long onCmdRequireConnection(FXObject*, FXSelector, void*);
143
144
/// @}
145
146
protected:
147
/// @brief FOX needs this
148
FOX_CONSTRUCTOR(Selection)
149
150
private:
151
/// @brief pointer to prohibition frame parent
152
GNEProhibitionFrame* myProhibitionFrameParent = nullptr;
153
154
/// @brief "Save" button
155
MFXButtonTooltip* mySaveButton = nullptr;
156
157
/// @brief "Cancel" button
158
MFXButtonTooltip* myCancelButton = nullptr;
159
};
160
161
/**@brief Constructor
162
* @brief viewParent GNEViewParent in which this GNEFrame is placed
163
* @brief viewNet viewNet that uses this GNEFrame
164
*/
165
GNEProhibitionFrame(GNEViewParent* viewParent, GNEViewNet* viewNet);
166
167
/// @brief Destructor
168
~GNEProhibitionFrame();
169
170
/**@brief handle prohibitions and set the relative coloring
171
* @param viewObjects collection of objects under cursor after click over view
172
*/
173
void handleProhibitionClick(const GNEViewNetHelper::ViewObjectsSelector& viewObjects);
174
175
/// @brief show prohibition frame
176
void show();
177
178
/// @brief hide prohibition frame
179
void hide();
180
181
/// @brief get selection module
182
GNEProhibitionFrame::Selection* getSelectionModul() const;
183
184
protected:
185
/// @brief FOX needs this
186
FOX_CONSTRUCTOR(GNEProhibitionFrame)
187
188
/// @brief build prohibition
189
void buildProhibition(GNEConnection* conn, bool mayDefinitelyPass, bool allowConflict, bool toggle);
190
191
private:
192
/// @brief Relative To Connection
193
RelativeToConnection* myRelativeToConnection;
194
195
/// @brief prohibition legend
196
GNEProhibitionFrame::Legend* myLegend = nullptr;
197
198
/// @brief Selection
199
GNEProhibitionFrame::Selection* mySelectionModul = nullptr;
200
201
/// @brief the connection which prohibits
202
GNEConnection* myCurrentConn = nullptr;
203
204
/// @brief the set of connections which
205
std::set<GNEConnection*> myConcernedConns;
206
};
207
208