Eclipse SUMO - Simulation of Urban MObility
GNEConnectorFrame.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2022 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 /****************************************************************************/
18 // The Widget for modifying lane-to-lane connections
19 /****************************************************************************/
20 #pragma once
21 #include <config.h>
22 
23 #include <config.h>
24 #include <netbuild/NBEdge.h>
26 
27 
28 // ===========================================================================
29 // class definitions
30 // ===========================================================================
35 class GNEConnectorFrame : public GNEFrame {
36 
37 public:
38 
39  // ===========================================================================
40  // class CurrentLane
41  // ===========================================================================
42 
43  class CurrentLane : public FXGroupBoxModule {
44 
45  public:
47  CurrentLane(GNEConnectorFrame* connectorFrameParent);
48 
50  ~CurrentLane();
51 
53  void updateCurrentLaneLabel(const std::string& laneID);
54 
55  private:
58  };
59 
60  // ===========================================================================
61  // class ConnectionModifications
62  // ===========================================================================
63 
67 
68  public:
70  ConnectionModifications(GNEConnectorFrame* connectorFrameParent);
71 
74 
77 
79  long onCmdSaveModifications(FXObject*, FXSelector, void*);
80 
82  long onCmdCancelModifications(FXObject*, FXSelector, void*);
84 
85  protected:
86  FOX_CONSTRUCTOR(ConnectionModifications)
87 
88  private:
91 
93  FXButton* myCancelButton;
94 
96  FXButton* mySaveButton;
97 
99  FXCheckButton* myProtectRoutesCheckBox;
100  };
101 
102  // ===========================================================================
103  // class ConnectionOperations
104  // ===========================================================================
105 
109 
110  public:
112  ConnectionOperations(GNEConnectorFrame* connectorFrameParent);
113 
116 
119 
121  long onCmdSelectDeadEnds(FXObject*, FXSelector, void*);
122 
124  long onCmdSelectDeadStarts(FXObject*, FXSelector, void*);
125 
127  long onCmdSelectConflicts(FXObject*, FXSelector, void*);
128 
130  long onCmdSelectPass(FXObject*, FXSelector, void*);
131 
133  long onCmdClearSelectedConnections(FXObject*, FXSelector, void*);
134 
136  long onCmdResetSelectedConnections(FXObject*, FXSelector, void*);
138 
139  protected:
140  FOX_CONSTRUCTOR(ConnectionOperations)
141 
142  private:
145 
148 
151 
154 
157 
160 
163  };
164 
165  // ===========================================================================
166  // class ConnectionSelection
167  // ===========================================================================
168 
170 
171  public:
173  ConnectionSelection(GNEConnectorFrame* connectorFrameParent);
174 
177 
178  private:
181 
184  };
185 
186  // ===========================================================================
187  // class Legend
188  // ===========================================================================
189 
190  class Legend : public FXGroupBoxModule {
191 
192  public:
194  Legend(GNEConnectorFrame* connectorFrameParent);
195 
197  ~Legend();
198 
199  private:
200  };
201 
206  GNEConnectorFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet);
207 
210 
214  void handleLaneClick(const GNEViewNetHelper::ObjectsUnderCursor& objectsUnderCursor);
215 
218 
219 private:
221  enum class LaneStatus {
222  UNCONNECTED,
223  CONNECTED,
225  CONFLICTED
226  };
227 
234  void buildConnection(GNELane* lane, const bool mayDefinitelyPass, const bool allowConflict, const bool toggle);
235 
237  void initTargets();
238 
240  void cleanup();
241 
243  void removeConnections(GNELane* lane);
244 
246  LaneStatus getLaneStatus(const std::vector<NBEdge::Connection>& connections, const GNELane* targetLane) const;
247 
250 
253 
256 
259 
262 
265 
267  std::set<GNELane*> myPotentialTargets;
268 
271 
273  std::map<int, GNEInternalLane*> myInternalLanes;
274 
276  std::vector<NBEdge::Connection> myDeletedConnections;
277 };
FXGroupBoxModule (based on FXGroupBox)
long onCmdSaveModifications(FXObject *, FXSelector, void *)
Called when the user presses the OK-Button saves any connection modifications.
ConnectionModifications(GNEConnectorFrame *connectorFrameParent)
FOX-declaration.
long onCmdCancelModifications(FXObject *, FXSelector, void *)
Called when the user presses the Cancel-button discards any connection modifications.
FXCheckButton * myProtectRoutesCheckBox
protect routes checkbox
GNEConnectorFrame * myConnectorFrameParent
pointer to connectorFrame parent
FXButton * mySelectDeadStartsButton
"Select Dead Starts" button
GNEConnectorFrame * myConnectorFrameParent
pointer to connectorFrame parent
FXButton * mySelectConflictsButton
"Select Conflicts" button
long onCmdSelectDeadEnds(FXObject *, FXSelector, void *)
Called when the user presses the select dead ends button.
long onCmdResetSelectedConnections(FXObject *, FXSelector, void *)
Called when the user presses the reset selected connections button.
long onCmdSelectDeadStarts(FXObject *, FXSelector, void *)
Called when the user presses the select dead starts button.
long onCmdSelectPass(FXObject *, FXSelector, void *)
Called when the user presses the select pass button.
FXButton * mySelectDeadEndsButton
"Select Dead Ends" button
long onCmdClearSelectedConnections(FXObject *, FXSelector, void *)
Called when the user presses the clear selected connections button.
FXButton * myClearSelectedButton
"Clear Selected"
long onCmdSelectConflicts(FXObject *, FXSelector, void *)
Called when the user presses the select conflicts button.
ConnectionOperations(GNEConnectorFrame *connectorFrameParent)
FOX-declaration.
FXButton * myResetSelectedButton
"Reset Selected"
FXButton * mySelectPassingButton
"Select Edges which may always pass"
FXLabel * myHoldShiftLabel
Selection Hint.
ConnectionSelection(GNEConnectorFrame *connectorFrameParent)
constructor
FXLabel * myHoldControlLabel
hold control label
FXLabel * myCurrentLaneLabel
Label for current Lane.
void updateCurrentLaneLabel(const std::string &laneID)
set current junction label
CurrentLane(GNEConnectorFrame *connectorFrameParent)
constructor
Legend(GNEConnectorFrame *connectorFrameParent)
constructor
int myNumChanges
number of changes
std::vector< NBEdge::Connection > myDeletedConnections
vector of connections deleted in the current editing step
void cleanup()
clean up when deselecting current lane
void initTargets()
init targets
ConnectionModifications * getConnectionModifications() const
get pointer to ConnectionModifications modul
GNEConnectorFrame::ConnectionOperations * myConnectionOperations
ConnectionOperations modul.
GNEConnectorFrame::Legend * myLegend
Legend modul.
void buildConnection(GNELane *lane, const bool mayDefinitelyPass, const bool allowConflict, const bool toggle)
either sets the current lane or toggles the connection of the current lane to this lane (if they shar...
void handleLaneClick(const GNEViewNetHelper::ObjectsUnderCursor &objectsUnderCursor)
either sets the current lane or toggles the connection of the
~GNEConnectorFrame()
Destructor.
void removeConnections(GNELane *lane)
remove connections
std::map< int, GNEInternalLane * > myInternalLanes
the internal lanes belonging the the current junction indexed by their tl-index
std::set< GNELane * > myPotentialTargets
the set of lanes to which the current lane may be connected
LaneStatus getLaneStatus(const std::vector< NBEdge::Connection > &connections, const GNELane *targetLane) const
return the status of toLane
GNEConnectorFrame(FXHorizontalFrame *horizontalFrameParent, GNEViewNet *viewNet)
Constructor.
GNEConnectorFrame::ConnectionModifications * myConnectionModifications
ConnectionModifications modul.
GNELane * myCurrentEditedLane
the lane of which connections are to be modified
LaneStatus
the status of a target lane
GNEConnectorFrame::ConnectionSelection * myConnectionSelection
ConnectionSelection modul.
CurrentLane * myCurrentLane
CurrentLane modul.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
class used to group all variables related with objects under cursor after a click over view