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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // The Widget for modifying lane-to-lane connections
16 /****************************************************************************/
17 #ifndef GNEConnectorFrame_h
18 #define GNEConnectorFrame_h
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 #include "GNEFrame.h"
24 #include <netbuild/NBEdge.h>
25 
26 // ===========================================================================
27 // class definitions
28 // ===========================================================================
33 class GNEConnectorFrame : public GNEFrame {
34 
35 public:
36 
37  // ===========================================================================
38  // class CurrentLane
39  // ===========================================================================
40 
41  class CurrentLane : protected FXGroupBox {
42 
43  public:
45  CurrentLane(GNEConnectorFrame* connectorFrameParent);
46 
48  ~CurrentLane();
49 
51  void updateCurrentLaneLabel(const std::string& laneID);
52 
53  private:
56  };
57 
58  // ===========================================================================
59  // class ConnectionModifications
60  // ===========================================================================
61 
62  class ConnectionModifications : protected FXGroupBox {
65 
66  public:
68  ConnectionModifications(GNEConnectorFrame* connectorFrameParent);
69 
72 
75 
77  long onCmdSaveModifications(FXObject*, FXSelector, void*);
78 
80  long onCmdCancelModifications(FXObject*, FXSelector, void*);
82 
83  protected:
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:
141 
142  private:
145 
148 
151 
154 
157 
160 
163  };
164 
165  // ===========================================================================
166  // class ConnectionSelection
167  // ===========================================================================
168 
169  class ConnectionSelection : protected FXGroupBox {
170 
171  public:
173  ConnectionSelection(GNEConnectorFrame* connectorFrameParent);
174 
177 
178  private:
181 
184  };
185 
186  // ===========================================================================
187  // class ConnectionLegend
188  // ===========================================================================
189 
190  class ConnectionLegend : protected FXGroupBox {
191 
192  public:
194  ConnectionLegend(GNEConnectorFrame* connectorFrameParent);
195 
197  ~ConnectionLegend();
198 
200  const RGBColor& getSourceColor() const;
201 
203  const RGBColor& getTargetColor() const;
204 
206  const RGBColor& getPotentialTargetColor() const;
207 
209  const RGBColor& getTargetPassColor() const;
210 
212  const RGBColor& getConflictColor() const;
213 
214  private:
216  FXLabel* mySourceLabel;
217 
219  FXLabel* myTargetLabel;
220 
223 
226 
228  FXLabel* myConflictLabel;
229 
232 
235 
238 
241 
244  };
245 
250  GNEConnectorFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet);
251 
254 
258  void handleLaneClick(const GNEViewNetHelper::ObjectsUnderCursor& objectsUnderCursor);
259 
262 
263 private:
265  enum LaneStatus {
270  };
271 
278  void buildConnection(GNELane* lane, bool mayDefinitelyPass, bool allowConflict, bool toggle);
279 
281  void initTargets();
282 
284  void cleanup();
285 
287  void removeConnections(GNELane* lane);
288 
290  LaneStatus getLaneStatus(const std::vector<NBEdge::Connection>& connections, GNELane* targetLane);
291 
294 
297 
300 
303 
306 
309 
311  std::set<GNELane*> myPotentialTargets;
312 
315 
317  std::map<int, GNEInternalLane*> myInternalLanes;
318 
320  std::vector<NBEdge::Connection> myDeletedConnections;
321 };
322 
323 
324 #endif
325 
326 /****************************************************************************/
327 
ConnectionModifications * getConnectionModifications() const
get pointer to ConnectionModifications modul
FXLabel * myTargetPassLabel
target pass label
GNEConnectorFrame * myConnectorFrameParent
pointer to connectorFrame parent
FXButton * mySelectDeadStartsButton
"Select Dead Starts" button
FXButton * myClearSelectedButton
"Clear Selected"
RGBColor myConflictColor
color for a to-lane that cannot be used because another connection conflicts
ConnectionLegend * myConnectionLegend
ConnectionLegend modul.
std::set< GNELane * > myPotentialTargets
the set of lanes to which the current lane may be connected
FXButton * mySelectPassingButton
"Select Edges which may always pass"
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
FXLabel * myHoldControlLabel
hold control label
FXCheckButton * myProtectRoutesCheckBox
protect routes checkbox
RGBColor myTargetPassColor
color for the to-lane of a connection with pass attribute
FXButton * myResetSelectedButton
"Reset Selected"
RGBColor myPotentialTargetColor
color for potential to-lane targets (currently unconnected)
FXLabel * myCurrentLaneLabel
Label for current Lane.
GNEConnectorFrame * myConnectorFrameParent
pointer to connectorFrame parent
LaneStatus getLaneStatus(const std::vector< NBEdge::Connection > &connections, GNELane *targetLane)
return the status of toLane
FXLabel * myConflictLabel
conflict label
RGBColor myTargetColor
color for the to-lane of a connection
int myNumChanges
number of changes
void initTargets()
init targets
RGBColor mySourceColor
color for the from-lane of a connection
FXLabel * myPossibleTargetLabel
possible target label
void removeConnections(GNELane *lane)
remove connections
class used to group all variables related with objects under cursor after a click over view ...
FXButton * mySelectConflictsButton
"Select Conflicts" button
ConnectionModifications * myConnectionModifications
ConnectionModifications modul.
FXLabel * myHoldShiftLabel
Selection Hint.
std::vector< NBEdge::Connection > myDeletedConnections
vector of connections deleted in the current editing step
ConnectionSelection * myConnectionSelection
ConnectionSelection modul.
void handleLaneClick(const GNEViewNetHelper::ObjectsUnderCursor &objectsUnderCursor)
either sets the current lane or toggles the connection of the
void buildConnection(GNELane *lane, bool mayDefinitelyPass, bool allowConflict, bool toggle)
either sets the current lane or toggles the connection of the current lane to this lane (if they shar...
CurrentLane(GNEConnectorFrame *connectorFrameParent)
constructor
std::map< int, GNEInternalLane * > myInternalLanes
the internal lanes belonging the the current junction indexed by their tl-index
FXButton * mySelectDeadEndsButton
"Select Dead Ends" button
LaneStatus
the status of a target lane
ConnectionOperations * myConnectionOperations
ConnectionOperations modul.
~GNEConnectorFrame()
Destructor.
void updateCurrentLaneLabel(const std::string &laneID)
set current junction label
GNEConnectorFrame(FXHorizontalFrame *horizontalFrameParent, GNEViewNet *viewNet)
Constructor.
void cleanup()
clean up when deselecting current lane
GNELane * myCurrentEditedLane
the lane of which connections are to be modified
CurrentLane * myCurrentLane
CurrentLane modul.