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 
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 
GNEConnectorFrame::myConnectionLegend
ConnectionLegend * myConnectionLegend
ConnectionLegend modul.
Definition: GNEConnectorFrame.h:305
GNEConnectorFrame::getConnectionModifications
ConnectionModifications * getConnectionModifications() const
get pointer to ConnectionModifications modul
Definition: GNEConnectorFrame.cpp:422
GNEConnectorFrame::ConnectionLegend::myTargetColor
RGBColor myTargetColor
color for the to-lane of a connection
Definition: GNEConnectorFrame.h:234
GNEConnectorFrame::ConnectionOperations::mySelectConflictsButton
FXButton * mySelectConflictsButton
"Select Conflicts" button
Definition: GNEConnectorFrame.h:153
GNEConnectorFrame::CurrentLane::myCurrentLaneLabel
FXLabel * myCurrentLaneLabel
Label for current Lane.
Definition: GNEConnectorFrame.h:55
GNEConnectorFrame::ConnectionOperations::onCmdResetSelectedConnections
long onCmdResetSelectedConnections(FXObject *, FXSelector, void *)
Called when the user presses the reset selected connections button.
Definition: GNEConnectorFrame.cpp:296
GNEConnectorFrame::~GNEConnectorFrame
~GNEConnectorFrame()
Destructor.
Definition: GNEConnectorFrame.cpp:411
GNEConnectorFrame::ConnectionModifications::onCmdSaveModifications
long onCmdSaveModifications(FXObject *, FXSelector, void *)
Called when the user presses the OK-Button saves any connection modifications.
Definition: GNEConnectorFrame.cpp:129
GNEConnectorFrame::ConnectionOperations
Definition: GNEConnectorFrame.h:105
GNEConnectorFrame::ConnectionLegend::myPossibleTargetLabel
FXLabel * myPossibleTargetLabel
possible target label
Definition: GNEConnectorFrame.h:222
GNEConnectorFrame::removeConnections
void removeConnections(GNELane *lane)
remove connections
Definition: GNEConnectorFrame.cpp:428
GNEConnectorFrame::ConnectionOperations::onCmdClearSelectedConnections
long onCmdClearSelectedConnections(FXObject *, FXSelector, void *)
Called when the user presses the clear selected connections button.
Definition: GNEConnectorFrame.cpp:269
GNEConnectorFrame::myConnectionSelection
ConnectionSelection * myConnectionSelection
ConnectionSelection modul.
Definition: GNEConnectorFrame.h:302
GNEConnectorFrame::ConnectionOperations::~ConnectionOperations
~ConnectionOperations()
destructor
Definition: GNEConnectorFrame.cpp:182
GNEConnectorFrame::CurrentLane
Definition: GNEConnectorFrame.h:41
GNEConnectorFrame::ConnectionSelection
Definition: GNEConnectorFrame.h:169
GNEConnectorFrame::ConnectionOperations::ConnectionOperations
ConnectionOperations()
FOX needs this.
Definition: GNEConnectorFrame.h:140
GNEConnectorFrame::ConnectionSelection::ConnectionSelection
ConnectionSelection(GNEConnectorFrame *connectorFrameParent)
constructor
Definition: GNEConnectorFrame.cpp:311
GNEConnectorFrame::ConnectionModifications::ConnectionModifications
ConnectionModifications()
FOX needs this.
Definition: GNEConnectorFrame.h:85
GNEConnectorFrame::ConnectionSelection::~ConnectionSelection
~ConnectionSelection()
destructor
Definition: GNEConnectorFrame.cpp:319
GNEConnectorFrame::ConnectionLegend::getPotentialTargetColor
const RGBColor & getPotentialTargetColor() const
get color for potential to-lane targets (currently unconnected)
Definition: GNEConnectorFrame.cpp:371
GNEFrame
Definition: GNEFrame.h:35
GNEConnectorFrame::ConnectionLegend::~ConnectionLegend
~ConnectionLegend()
destructor
Definition: GNEConnectorFrame.cpp:355
GNEViewNet
Definition: GNEViewNet.h:43
GNEConnectorFrame::ConnectionOperations::onCmdSelectPass
long onCmdSelectPass(FXObject *, FXSelector, void *)
Called when the user presses the select pass button.
Definition: GNEConnectorFrame.cpp:253
GNEConnectorFrame::ConnectionLegend::getTargetColor
const RGBColor & getTargetColor() const
get color for the to-lane of a connection
Definition: GNEConnectorFrame.cpp:365
GNEConnectorFrame::ConnectionOperations::myConnectorFrameParent
GNEConnectorFrame * myConnectorFrameParent
pointer to connectorFrame parent
Definition: GNEConnectorFrame.h:144
GNEConnectorFrame::getLaneStatus
LaneStatus getLaneStatus(const std::vector< NBEdge::Connection > &connections, GNELane *targetLane)
return the status of toLane
Definition: GNEConnectorFrame.cpp:560
GNEConnectorFrame::ConnectionModifications::myProtectRoutesCheckBox
FXCheckButton * myProtectRoutesCheckBox
protect routes checkbox
Definition: GNEConnectorFrame.h:98
GNEConnectorFrame::ConnectionLegend::ConnectionLegend
ConnectionLegend(GNEConnectorFrame *connectorFrameParent)
constructor
Definition: GNEConnectorFrame.cpp:325
GNEConnectorFrame
Definition: GNEConnectorFrame.h:33
GNEConnectorFrame::myCurrentLane
CurrentLane * myCurrentLane
CurrentLane modul.
Definition: GNEConnectorFrame.h:293
GNEConnectorFrame::ConnectionLegend
Definition: GNEConnectorFrame.h:190
GNEConnectorFrame::myConnectionModifications
ConnectionModifications * myConnectionModifications
ConnectionModifications modul.
Definition: GNEConnectorFrame.h:296
GNEConnectorFrame::myConnectionOperations
ConnectionOperations * myConnectionOperations
ConnectionOperations modul.
Definition: GNEConnectorFrame.h:299
RGBColor
Definition: RGBColor.h:40
GNEConnectorFrame::ConnectionLegend::getSourceColor
const RGBColor & getSourceColor() const
get color for the from-lane of a connection
Definition: GNEConnectorFrame.cpp:359
GNEConnectorFrame::CurrentLane::~CurrentLane
~CurrentLane()
destructor
Definition: GNEConnectorFrame.cpp:79
GNEConnectorFrame::ConnectionOperations::myResetSelectedButton
FXButton * myResetSelectedButton
"Reset Selected"
Definition: GNEConnectorFrame.h:162
GNEConnectorFrame::ConnectionOperations::onCmdSelectDeadStarts
long onCmdSelectDeadStarts(FXObject *, FXSelector, void *)
Called when the user presses the select dead starts button.
Definition: GNEConnectorFrame.cpp:203
GNEConnectorFrame::initTargets
void initTargets()
init targets
Definition: GNEConnectorFrame.cpp:512
GNEViewNetHelper::ObjectsUnderCursor
class used to group all variables related with objects under cursor after a click over view
Definition: GNEViewNetHelper.h:149
GNEConnectorFrame::handleLaneClick
void handleLaneClick(const GNEViewNetHelper::ObjectsUnderCursor &objectsUnderCursor)
either sets the current lane or toggles the connection of the
Definition: GNEConnectorFrame.cpp:415
GNEConnectorFrame::ConnectionModifications::mySaveButton
FXButton * mySaveButton
"OK" button
Definition: GNEConnectorFrame.h:95
GNEConnectorFrame::myNumChanges
int myNumChanges
number of changes
Definition: GNEConnectorFrame.h:314
GNEConnectorFrame::ConnectionLegend::myTargetPassLabel
FXLabel * myTargetPassLabel
target pass label
Definition: GNEConnectorFrame.h:225
GNEConnectorFrame::ConnectionLegend::myTargetPassColor
RGBColor myTargetPassColor
color for the to-lane of a connection with pass attribute
Definition: GNEConnectorFrame.h:240
GNEConnectorFrame::ConnectionModifications::myConnectorFrameParent
GNEConnectorFrame * myConnectorFrameParent
pointer to connectorFrame parent
Definition: GNEConnectorFrame.h:89
GNEConnectorFrame::ConnectionModifications::myCancelButton
FXButton * myCancelButton
"Cancel" button
Definition: GNEConnectorFrame.h:92
GNEConnectorFrame::ConnectionOperations::onCmdSelectConflicts
long onCmdSelectConflicts(FXObject *, FXSelector, void *)
Called when the user presses the select conflicts button.
Definition: GNEConnectorFrame.cpp:229
GNEConnectorFrame::myPotentialTargets
std::set< GNELane * > myPotentialTargets
the set of lanes to which the current lane may be connected
Definition: GNEConnectorFrame.h:311
GNEConnectorFrame::LaneStatus
LaneStatus
the status of a target lane
Definition: GNEConnectorFrame.h:265
GNEConnectorFrame::ConnectionSelection::myHoldControlLabel
FXLabel * myHoldControlLabel
hold control label
Definition: GNEConnectorFrame.h:183
GNEConnectorFrame::cleanup
void cleanup()
clean up when deselecting current lane
Definition: GNEConnectorFrame.cpp:544
GNEConnectorFrame::CurrentLane::updateCurrentLaneLabel
void updateCurrentLaneLabel(const std::string &laneID)
set current junction label
Definition: GNEConnectorFrame.cpp:83
GNEConnectorFrame::myInternalLanes
std::map< int, GNEInternalLane * > myInternalLanes
the internal lanes belonging the the current junction indexed by their tl-index
Definition: GNEConnectorFrame.h:317
GNEConnectorFrame::CurrentLane::CurrentLane
CurrentLane(GNEConnectorFrame *connectorFrameParent)
constructor
Definition: GNEConnectorFrame.cpp:72
GNEConnectorFrame::ConnectionLegend::getTargetPassColor
const RGBColor & getTargetPassColor() const
get color for the to-lane of a connection with pass attribute
Definition: GNEConnectorFrame.cpp:377
GNEConnectorFrame::ConnectionLegend::myPotentialTargetColor
RGBColor myPotentialTargetColor
color for potential to-lane targets (currently unconnected)
Definition: GNEConnectorFrame.h:237
GNEConnectorFrame::ConnectionModifications::onCmdCancelModifications
long onCmdCancelModifications(FXObject *, FXSelector, void *)
Called when the user presses the Cancel-button discards any connection modifications.
Definition: GNEConnectorFrame.cpp:115
GNEConnectorFrame::GNEConnectorFrame
GNEConnectorFrame(FXHorizontalFrame *horizontalFrameParent, GNEViewNet *viewNet)
Constructor.
Definition: GNEConnectorFrame.cpp:391
GNEConnectorFrame::ConnectionLegend::myTargetLabel
FXLabel * myTargetLabel
target label
Definition: GNEConnectorFrame.h:219
GNEConnectorFrame::ConnectionSelection::myHoldShiftLabel
FXLabel * myHoldShiftLabel
Selection Hint.
Definition: GNEConnectorFrame.h:180
GNEConnectorFrame::myDeletedConnections
std::vector< NBEdge::Connection > myDeletedConnections
vector of connections deleted in the current editing step
Definition: GNEConnectorFrame.h:320
GNEConnectorFrame::ConnectionOperations::mySelectDeadStartsButton
FXButton * mySelectDeadStartsButton
"Select Dead Starts" button
Definition: GNEConnectorFrame.h:150
GNEConnectorFrame::buildConnection
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...
Definition: GNEConnectorFrame.cpp:442
GNEConnectorFrame::UNCONNECTED
Definition: GNEConnectorFrame.h:266
GNEConnectorFrame::ConnectionOperations::myClearSelectedButton
FXButton * myClearSelectedButton
"Clear Selected"
Definition: GNEConnectorFrame.h:159
GNEConnectorFrame::myCurrentEditedLane
GNELane * myCurrentEditedLane
the lane of which connections are to be modified
Definition: GNEConnectorFrame.h:308
GNEConnectorFrame::ConnectionOperations::mySelectPassingButton
FXButton * mySelectPassingButton
"Select Edges which may always pass"
Definition: GNEConnectorFrame.h:156
GNEConnectorFrame::ConnectionModifications::~ConnectionModifications
~ConnectionModifications()
destructor
Definition: GNEConnectorFrame.cpp:111
GNEConnectorFrame::ConnectionModifications
Definition: GNEConnectorFrame.h:62
GNEConnectorFrame::ConnectionLegend::getConflictColor
const RGBColor & getConflictColor() const
get color for a to-lane that cannot be used because another connection conflicts
Definition: GNEConnectorFrame.cpp:383
GNEConnectorFrame::ConnectionLegend::myConflictColor
RGBColor myConflictColor
color for a to-lane that cannot be used because another connection conflicts
Definition: GNEConnectorFrame.h:243
GNEConnectorFrame::ConnectionLegend::mySourceColor
RGBColor mySourceColor
color for the from-lane of a connection
Definition: GNEConnectorFrame.h:231
GNEConnectorFrame::CONNECTED
Definition: GNEConnectorFrame.h:267
GNEFrame.h
GNEConnectorFrame::ConnectionOperations::onCmdSelectDeadEnds
long onCmdSelectDeadEnds(FXObject *, FXSelector, void *)
Called when the user presses the select dead ends button.
Definition: GNEConnectorFrame.cpp:186
GNEConnectorFrame::CONNECTED_PASS
Definition: GNEConnectorFrame.h:268
GNEConnectorFrame::ConnectionLegend::mySourceLabel
FXLabel * mySourceLabel
source label
Definition: GNEConnectorFrame.h:216
GNEConnectorFrame::ConnectionLegend::myConflictLabel
FXLabel * myConflictLabel
conflict label
Definition: GNEConnectorFrame.h:228
GNELane
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
NBEdge.h
GNEConnectorFrame::ConnectionOperations::mySelectDeadEndsButton
FXButton * mySelectDeadEndsButton
"Select Dead Ends" button
Definition: GNEConnectorFrame.h:147
GNEConnectorFrame::CONFLICTED
Definition: GNEConnectorFrame.h:269