Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/frames/network/GNEConnectorFrame.h
193700 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2001-2026 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 GNEConnectorFrame.h
15
/// @author Jakob Erdmann
16
/// @date May 2011
17
///
18
// The Widget for modifying lane-to-lane connections
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
#include <netbuild/NBEdge.h>
24
#include <netedit/frames/GNEFrame.h>
25
#include <netedit/frames/common/GNEGroupBoxModule.h>
26
27
// ===========================================================================
28
// class definitions
29
// ===========================================================================
30
31
class GNEConnectorFrame : public GNEFrame {
32
33
public:
34
35
// ===========================================================================
36
// class CurrentLane
37
// ===========================================================================
38
39
class CurrentLane : public GNEGroupBoxModule {
40
41
public:
42
/// @brief constructor
43
CurrentLane(GNEConnectorFrame* connectorFrameParent);
44
45
/// @brief destructor
46
~CurrentLane();
47
48
/// @brief set current junction label
49
void updateCurrentLaneLabel(const std::string& laneID);
50
51
private:
52
/// @brief Label for current Lane
53
FXLabel* myCurrentLaneLabel;
54
};
55
56
// ===========================================================================
57
// class ConnectionModifications
58
// ===========================================================================
59
60
class ConnectionModifications : public GNEGroupBoxModule {
61
/// @brief FOX-declaration
62
FXDECLARE(GNEConnectorFrame::ConnectionModifications)
63
64
public:
65
/// @brief constructor
66
ConnectionModifications(GNEConnectorFrame* connectorFrameParent);
67
68
/// @brief destructor
69
~ConnectionModifications();
70
71
/// @name FOX-callbacks
72
/// @{
73
74
/// @brief Called when the user presses the OK-Button saves any connection modifications
75
long onCmdSaveModifications(FXObject*, FXSelector, void*);
76
77
/// @brief Called when the user presses the Cancel-button discards any connection modifications
78
long onCmdCancelModifications(FXObject*, FXSelector, void*);
79
/// @}
80
81
protected:
82
FOX_CONSTRUCTOR(ConnectionModifications)
83
84
private:
85
/// @brief pointer to connectorFrame parent
86
GNEConnectorFrame* myConnectorFrameParent;
87
88
/// @brief "Cancel" button
89
FXButton* myCancelButton;
90
91
/// @brief "OK" button
92
FXButton* mySaveButton;
93
94
/// @brief protect routes checkbox
95
FXCheckButton* myProtectRoutesCheckBox;
96
};
97
98
// ===========================================================================
99
// class ConnectionOperations
100
// ===========================================================================
101
102
class ConnectionOperations : public GNEGroupBoxModule {
103
/// @brief FOX-declaration
104
FXDECLARE(GNEConnectorFrame::ConnectionOperations)
105
106
public:
107
/// @brief constructor
108
ConnectionOperations(GNEConnectorFrame* connectorFrameParent);
109
110
/// @brief destructor
111
~ConnectionOperations();
112
113
/// @name FOX-callbacks
114
/// @{
115
116
/// @brief Called when the user presses the select dead ends button
117
long onCmdSelectDeadEnds(FXObject*, FXSelector, void*);
118
119
/// @brief Called when the user presses the select dead starts button
120
long onCmdSelectDeadStarts(FXObject*, FXSelector, void*);
121
122
/// @brief Called when the user presses the select conflicts button
123
long onCmdSelectConflicts(FXObject*, FXSelector, void*);
124
125
/// @brief Called when the user presses the select pass button
126
long onCmdSelectPass(FXObject*, FXSelector, void*);
127
128
/// @brief Called when the user presses the clear selected connections button
129
long onCmdClearSelectedConnections(FXObject*, FXSelector, void*);
130
131
/// @brief Called when the user presses the reset selected connections button
132
long onCmdResetSelectedConnections(FXObject*, FXSelector, void*);
133
/// @}
134
135
protected:
136
FOX_CONSTRUCTOR(ConnectionOperations)
137
138
private:
139
/// @brief pointer to connectorFrame parent
140
GNEConnectorFrame* myConnectorFrameParent;
141
142
/// @brief "Select Dead Ends" button
143
FXButton* mySelectDeadEndsButton;
144
145
/// @brief "Select Dead Starts" button
146
FXButton* mySelectDeadStartsButton;
147
148
/// @brief "Select Conflicts" button
149
FXButton* mySelectConflictsButton;
150
151
/// @brief "Select Edges which may always pass"
152
FXButton* mySelectPassingButton;
153
154
/// @brief "Clear Selected"
155
FXButton* myClearSelectedButton;
156
157
/// @brief "Reset Selected"
158
FXButton* myResetSelectedButton;
159
};
160
161
// ===========================================================================
162
// class ConnectionSelection
163
// ===========================================================================
164
165
class ConnectionSelection : public GNEGroupBoxModule {
166
167
public:
168
/// @brief constructor
169
ConnectionSelection(GNEConnectorFrame* connectorFrameParent);
170
171
/// @brief destructor
172
~ConnectionSelection();
173
};
174
175
// ===========================================================================
176
// class Legend
177
// ===========================================================================
178
179
class Legend : public GNEGroupBoxModule {
180
181
public:
182
/// @brief constructor
183
Legend(GNEConnectorFrame* connectorFrameParent);
184
185
/// @brief destructor
186
~Legend();
187
188
private:
189
};
190
191
/**@brief Constructor
192
* @brief viewParent GNEViewParent in which this GNEFrame is placed
193
* @brief viewNet viewNet that uses this GNEFrame
194
*/
195
GNEConnectorFrame(GNEViewParent* viewParent, GNEViewNet* viewNet);
196
197
/// @brief Destructor
198
~GNEConnectorFrame();
199
200
/**@brief either sets the current lane or toggles the connection of the
201
* @param viewObjects collection of objects under cursor after click over view
202
*/
203
void handleLaneClick(const GNEViewNetHelper::ViewObjectsSelector& viewObjects);
204
205
/// @brief get pointer to ConnectionModifications module
206
ConnectionModifications* getConnectionModifications() const;
207
208
private:
209
/// @brief the status of a target lane
210
enum class LaneStatus {
211
UNCONNECTED,
212
CONNECTED,
213
CONNECTED_PASS,
214
CONFLICTED
215
};
216
217
/**@brief either sets the current lane or toggles the connection of the
218
* current lane to this lane (if they share a junction)
219
* @param[in] lane Either the lane to set as current lane, or the destination from current lane
220
* @param[in] mayDefinitelyPass Whether new connections shall have the pass attribute set
221
* @param[in] toggle Whether non-existing connections shall be created
222
*/
223
void buildConnection(GNELane* lane, const bool mayDefinitelyPass, const bool allowConflict, const bool toggle);
224
225
/// @brief init targets
226
void initTargets();
227
228
/// @brief clean up when deselecting current lane
229
void cleanup();
230
231
/// @brief remove connections
232
void removeConnections(GNELane* lane);
233
234
/// @brief return the status of toLane
235
LaneStatus getLaneStatus(const std::vector<NBEdge::Connection>& connections, const GNELane* targetLane) const;
236
237
/// @brief CurrentLane module
238
CurrentLane* myCurrentLane;
239
240
/// @brief ConnectionModifications module
241
GNEConnectorFrame::ConnectionModifications* myConnectionModifications = nullptr;
242
243
/// @brief ConnectionOperations module
244
GNEConnectorFrame::ConnectionOperations* myConnectionOperations = nullptr;
245
246
/// @brief ConnectionSelection module
247
GNEConnectorFrame::ConnectionSelection* myConnectionSelection = nullptr;
248
249
/// @brief Legend module
250
GNEConnectorFrame::Legend* myLegend = nullptr;
251
252
/// @brief the lane of which connections are to be modified
253
GNELane* myCurrentEditedLane;
254
255
/// @brief the set of lanes to which the current lane may be connected
256
std::set<GNELane*> myPotentialTargets;
257
258
/// @brief number of changes
259
int myNumChanges;
260
261
/// @brief the internal lanes belonging the current junction indexed by their tl-index
262
std::map<int, GNEInternalLane*> myInternalLanes;
263
264
/// @brief vector of connections deleted in the current editing step
265
std::vector<NBEdge::Connection> myDeletedConnections;
266
};
267
268