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-2020 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 
22 #include <config.h>
23 #include <netbuild/NBEdge.h>
25 
26 
27 // ===========================================================================
28 // class definitions
29 // ===========================================================================
34 class GNEConnectorFrame : public GNEFrame {
35 
36 public:
37 
38  // ===========================================================================
39  // class CurrentLane
40  // ===========================================================================
41 
42  class CurrentLane : protected FXGroupBox {
43 
44  public:
46  CurrentLane(GNEConnectorFrame* connectorFrameParent);
47 
49  ~CurrentLane();
50 
52  void updateCurrentLaneLabel(const std::string& laneID);
53 
54  private:
57  };
58 
59  // ===========================================================================
60  // class ConnectionModifications
61  // ===========================================================================
62 
63  class ConnectionModifications : protected FXGroupBox {
66 
67  public:
69  ConnectionModifications(GNEConnectorFrame* connectorFrameParent);
70 
73 
76 
78  long onCmdSaveModifications(FXObject*, FXSelector, void*);
79 
81  long onCmdCancelModifications(FXObject*, FXSelector, void*);
83 
84  protected:
85  FOX_CONSTRUCTOR(ConnectionModifications)
86 
87  private:
90 
92  FXButton* myCancelButton;
93 
95  FXButton* mySaveButton;
96 
98  FXCheckButton* myProtectRoutesCheckBox;
99  };
100 
101  // ===========================================================================
102  // class ConnectionOperations
103  // ===========================================================================
104 
105  class ConnectionOperations : protected FXGroupBox {
108 
109  public:
111  ConnectionOperations(GNEConnectorFrame* connectorFrameParent);
112 
115 
118 
120  long onCmdSelectDeadEnds(FXObject*, FXSelector, void*);
121 
123  long onCmdSelectDeadStarts(FXObject*, FXSelector, void*);
124 
126  long onCmdSelectConflicts(FXObject*, FXSelector, void*);
127 
129  long onCmdSelectPass(FXObject*, FXSelector, void*);
130 
132  long onCmdClearSelectedConnections(FXObject*, FXSelector, void*);
133 
135  long onCmdResetSelectedConnections(FXObject*, FXSelector, void*);
137 
138  protected:
139  FOX_CONSTRUCTOR(ConnectionOperations)
140 
141  private:
144 
147 
150 
153 
156 
159 
162  };
163 
164  // ===========================================================================
165  // class ConnectionSelection
166  // ===========================================================================
167 
168  class ConnectionSelection : protected FXGroupBox {
169 
170  public:
172  ConnectionSelection(GNEConnectorFrame* connectorFrameParent);
173 
176 
177  private:
180 
183  };
184 
185  // ===========================================================================
186  // class ConnectionLegend
187  // ===========================================================================
188 
189  class ConnectionLegend : protected FXGroupBox {
190 
191  public:
193  ConnectionLegend(GNEConnectorFrame* connectorFrameParent);
194 
197 
198  private:
199  };
200 
205  GNEConnectorFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet);
206 
209 
213  void handleLaneClick(const GNEViewNetHelper::ObjectsUnderCursor& objectsUnderCursor);
214 
217 
218 private:
220  enum class LaneStatus {
221  UNCONNECTED,
222  CONNECTED,
224  CONFLICTED
225  };
226 
233  void buildConnection(GNELane* lane, const bool mayDefinitelyPass, const bool allowConflict, const bool toggle);
234 
236  void initTargets();
237 
239  void cleanup();
240 
242  void removeConnections(GNELane* lane);
243 
245  LaneStatus getLaneStatus(const std::vector<NBEdge::Connection>& connections, const GNELane* targetLane) const;
246 
249 
252 
255 
258 
261 
264 
266  std::set<GNELane*> myPotentialTargets;
267 
270 
272  std::map<int, GNEInternalLane*> myInternalLanes;
273 
275  std::vector<NBEdge::Connection> myDeletedConnections;
276 };
ConnectionLegend(GNEConnectorFrame *connectorFrameParent)
constructor
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
int myNumChanges
number of changes
ConnectionModifications * myConnectionModifications
ConnectionModifications modul.
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
ConnectionSelection * myConnectionSelection
ConnectionSelection 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
ConnectionOperations * myConnectionOperations
ConnectionOperations modul.
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.
GNELane * myCurrentEditedLane
the lane of which connections are to be modified
ConnectionLegend * myConnectionLegend
ConnectionLegend modul.
LaneStatus
the status of a target lane
CurrentLane * myCurrentLane
CurrentLane modul.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:45
class used to group all variables related with objects under cursor after a click over view