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 /****************************************************************************/
14 // The Widget for modifying lane-to-lane connections
15 /****************************************************************************/
16 #ifndef GNEConnectorFrame_h
17 #define GNEConnectorFrame_h
18 
19 // ===========================================================================
20 // included modules
21 // ===========================================================================
22 #include <config.h>
23 #include <netbuild/NBEdge.h>
24 #include "GNEFrame.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:
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:
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 
199  const RGBColor& getSourceColor() const;
200 
202  const RGBColor& getTargetColor() const;
203 
205  const RGBColor& getPotentialTargetColor() const;
206 
208  const RGBColor& getTargetPassColor() const;
209 
211  const RGBColor& getConflictColor() const;
212 
213  private:
215  FXLabel* mySourceLabel;
216 
218  FXLabel* myTargetLabel;
219 
222 
225 
227  FXLabel* myConflictLabel;
228 
231 
234 
237 
240 
243  };
244 
249  GNEConnectorFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet);
250 
253 
257  void handleLaneClick(const GNEViewNetHelper::ObjectsUnderCursor& objectsUnderCursor);
258 
261 
262 private:
264  enum LaneStatus {
268  CONFLICTED
269  };
270 
277  void buildConnection(GNELane* lane, bool mayDefinitelyPass, bool allowConflict, bool toggle);
278 
280  void initTargets();
281 
283  void cleanup();
284 
286  void removeConnections(GNELane* lane);
287 
289  LaneStatus getLaneStatus(const std::vector<NBEdge::Connection>& connections, GNELane* targetLane);
290 
293 
296 
299 
302 
305 
308 
310  std::set<GNELane*> myPotentialTargets;
311 
314 
316  std::map<int, GNEInternalLane*> myInternalLanes;
317 
319  std::vector<NBEdge::Connection> myDeletedConnections;
320 };
321 
322 
323 #endif
324 
325 /****************************************************************************/
326 
GNEConnectorFrame::myConnectionLegend
ConnectionLegend * myConnectionLegend
ConnectionLegend modul.
Definition: GNEConnectorFrame.h:304
GNEConnectorFrame::getConnectionModifications
ConnectionModifications * getConnectionModifications() const
get pointer to ConnectionModifications modul
Definition: GNEConnectorFrame.cpp:425
GNEConnectorFrame::ConnectionLegend::myTargetColor
RGBColor myTargetColor
color for the to-lane of a connection
Definition: GNEConnectorFrame.h:233
GNEConnectorFrame::ConnectionOperations::mySelectConflictsButton
FXButton * mySelectConflictsButton
"Select Conflicts" button
Definition: GNEConnectorFrame.h:152
GNEConnectorFrame::CurrentLane::myCurrentLaneLabel
FXLabel * myCurrentLaneLabel
Label for current Lane.
Definition: GNEConnectorFrame.h:56
GNEConnectorFrame::ConnectionOperations::onCmdResetSelectedConnections
long onCmdResetSelectedConnections(FXObject *, FXSelector, void *)
Called when the user presses the reset selected connections button.
Definition: GNEConnectorFrame.cpp:299
GNEConnectorFrame::~GNEConnectorFrame
~GNEConnectorFrame()
Destructor.
Definition: GNEConnectorFrame.cpp:414
GNEConnectorFrame::ConnectionModifications::onCmdSaveModifications
long onCmdSaveModifications(FXObject *, FXSelector, void *)
Called when the user presses the OK-Button saves any connection modifications.
Definition: GNEConnectorFrame.cpp:128
GNEConnectorFrame::ConnectionOperations
Definition: GNEConnectorFrame.h:105
GNEConnectorFrame::ConnectionLegend::myPossibleTargetLabel
FXLabel * myPossibleTargetLabel
possible target label
Definition: GNEConnectorFrame.h:221
GNEConnectorFrame::removeConnections
void removeConnections(GNELane *lane)
remove connections
Definition: GNEConnectorFrame.cpp:431
GNEConnectorFrame::ConnectionOperations::onCmdClearSelectedConnections
long onCmdClearSelectedConnections(FXObject *, FXSelector, void *)
Called when the user presses the clear selected connections button.
Definition: GNEConnectorFrame.cpp:272
GNEConnectorFrame::myConnectionSelection
ConnectionSelection * myConnectionSelection
ConnectionSelection modul.
Definition: GNEConnectorFrame.h:301
GNEConnectorFrame::ConnectionOperations::~ConnectionOperations
~ConnectionOperations()
destructor
Definition: GNEConnectorFrame.cpp:181
GNEConnectorFrame::CurrentLane
Definition: GNEConnectorFrame.h:42
GNEConnectorFrame::ConnectionSelection
Definition: GNEConnectorFrame.h:168
GNEConnectorFrame::ConnectionSelection::ConnectionSelection
ConnectionSelection(GNEConnectorFrame *connectorFrameParent)
constructor
Definition: GNEConnectorFrame.cpp:314
GNEConnectorFrame::ConnectionSelection::~ConnectionSelection
~ConnectionSelection()
destructor
Definition: GNEConnectorFrame.cpp:322
GNEConnectorFrame::ConnectionLegend::getPotentialTargetColor
const RGBColor & getPotentialTargetColor() const
get color for potential to-lane targets (currently unconnected)
Definition: GNEConnectorFrame.cpp:374
GNEFrame
Definition: GNEFrame.h:34
GNEConnectorFrame::ConnectionLegend::~ConnectionLegend
~ConnectionLegend()
destructor
Definition: GNEConnectorFrame.cpp:358
GNEViewNet
Definition: GNEViewNet.h:42
GNEConnectorFrame::ConnectionOperations::onCmdSelectPass
long onCmdSelectPass(FXObject *, FXSelector, void *)
Called when the user presses the select pass button.
Definition: GNEConnectorFrame.cpp:256
GNEConnectorFrame::ConnectionLegend::getTargetColor
const RGBColor & getTargetColor() const
get color for the to-lane of a connection
Definition: GNEConnectorFrame.cpp:368
GNEConnectorFrame::ConnectionOperations::myConnectorFrameParent
GNEConnectorFrame * myConnectorFrameParent
pointer to connectorFrame parent
Definition: GNEConnectorFrame.h:143
GNEConnectorFrame::getLaneStatus
LaneStatus getLaneStatus(const std::vector< NBEdge::Connection > &connections, GNELane *targetLane)
return the status of toLane
Definition: GNEConnectorFrame.cpp:563
GNEConnectorFrame::ConnectionModifications::myProtectRoutesCheckBox
FXCheckButton * myProtectRoutesCheckBox
protect routes checkbox
Definition: GNEConnectorFrame.h:98
GNEConnectorFrame::ConnectionLegend::ConnectionLegend
ConnectionLegend(GNEConnectorFrame *connectorFrameParent)
constructor
Definition: GNEConnectorFrame.cpp:328
GNEConnectorFrame
Definition: GNEConnectorFrame.h:34
GNEConnectorFrame::myCurrentLane
CurrentLane * myCurrentLane
CurrentLane modul.
Definition: GNEConnectorFrame.h:292
GNEConnectorFrame::ConnectionLegend
Definition: GNEConnectorFrame.h:189
GNEConnectorFrame::myConnectionModifications
ConnectionModifications * myConnectionModifications
ConnectionModifications modul.
Definition: GNEConnectorFrame.h:295
GNEConnectorFrame::ConnectionModifications::ConnectionModifications
ConnectionModifications(GNEConnectorFrame *connectorFrameParent)
FOX-declaration.
Definition: GNEConnectorFrame.cpp:94
GNEConnectorFrame::myConnectionOperations
ConnectionOperations * myConnectionOperations
ConnectionOperations modul.
Definition: GNEConnectorFrame.h:298
RGBColor
Definition: RGBColor.h:39
GNEConnectorFrame::ConnectionLegend::getSourceColor
const RGBColor & getSourceColor() const
get color for the from-lane of a connection
Definition: GNEConnectorFrame.cpp:362
GNEConnectorFrame::CurrentLane::~CurrentLane
~CurrentLane()
destructor
Definition: GNEConnectorFrame.cpp:78
GNEConnectorFrame::ConnectionOperations::myResetSelectedButton
FXButton * myResetSelectedButton
"Reset Selected"
Definition: GNEConnectorFrame.h:161
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:515
GNEViewNetHelper::ObjectsUnderCursor
class used to group all variables related with objects under cursor after a click over view
Definition: GNEViewNetHelper.h:148
GNEConnectorFrame::handleLaneClick
void handleLaneClick(const GNEViewNetHelper::ObjectsUnderCursor &objectsUnderCursor)
either sets the current lane or toggles the connection of the
Definition: GNEConnectorFrame.cpp:418
GNEConnectorFrame::ConnectionModifications::mySaveButton
FXButton * mySaveButton
"OK" button
Definition: GNEConnectorFrame.h:95
GNEConnectorFrame::myNumChanges
int myNumChanges
number of changes
Definition: GNEConnectorFrame.h:313
GNEConnectorFrame::ConnectionLegend::myTargetPassLabel
FXLabel * myTargetPassLabel
target pass label
Definition: GNEConnectorFrame.h:224
GNEConnectorFrame::ConnectionLegend::myTargetPassColor
RGBColor myTargetPassColor
color for the to-lane of a connection with pass attribute
Definition: GNEConnectorFrame.h:239
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:232
GNEConnectorFrame::myPotentialTargets
std::set< GNELane * > myPotentialTargets
the set of lanes to which the current lane may be connected
Definition: GNEConnectorFrame.h:310
GNEConnectorFrame::LaneStatus
LaneStatus
the status of a target lane
Definition: GNEConnectorFrame.h:264
FOX_CONSTRUCTOR
#define FOX_CONSTRUCTOR(classname)
Definition: config.h:13
GNEConnectorFrame::ConnectionSelection::myHoldControlLabel
FXLabel * myHoldControlLabel
hold control label
Definition: GNEConnectorFrame.h:182
GNEConnectorFrame::cleanup
void cleanup()
clean up when deselecting current lane
Definition: GNEConnectorFrame.cpp:547
GNEConnectorFrame::CurrentLane::updateCurrentLaneLabel
void updateCurrentLaneLabel(const std::string &laneID)
set current junction label
Definition: GNEConnectorFrame.cpp:82
GNEConnectorFrame::myInternalLanes
std::map< int, GNEInternalLane * > myInternalLanes
the internal lanes belonging the the current junction indexed by their tl-index
Definition: GNEConnectorFrame.h:316
GNEConnectorFrame::CurrentLane::CurrentLane
CurrentLane(GNEConnectorFrame *connectorFrameParent)
constructor
Definition: GNEConnectorFrame.cpp:71
GNEConnectorFrame::ConnectionLegend::getTargetPassColor
const RGBColor & getTargetPassColor() const
get color for the to-lane of a connection with pass attribute
Definition: GNEConnectorFrame.cpp:380
GNEConnectorFrame::ConnectionLegend::myPotentialTargetColor
RGBColor myPotentialTargetColor
color for potential to-lane targets (currently unconnected)
Definition: GNEConnectorFrame.h:236
GNEConnectorFrame::ConnectionModifications::onCmdCancelModifications
long onCmdCancelModifications(FXObject *, FXSelector, void *)
Called when the user presses the Cancel-button discards any connection modifications.
Definition: GNEConnectorFrame.cpp:114
GNEConnectorFrame::GNEConnectorFrame
GNEConnectorFrame(FXHorizontalFrame *horizontalFrameParent, GNEViewNet *viewNet)
Constructor.
Definition: GNEConnectorFrame.cpp:394
GNEConnectorFrame::ConnectionLegend::myTargetLabel
FXLabel * myTargetLabel
target label
Definition: GNEConnectorFrame.h:218
GNEConnectorFrame::ConnectionSelection::myHoldShiftLabel
FXLabel * myHoldShiftLabel
Selection Hint.
Definition: GNEConnectorFrame.h:179
GNEConnectorFrame::myDeletedConnections
std::vector< NBEdge::Connection > myDeletedConnections
vector of connections deleted in the current editing step
Definition: GNEConnectorFrame.h:319
GNEConnectorFrame::ConnectionOperations::mySelectDeadStartsButton
FXButton * mySelectDeadStartsButton
"Select Dead Starts" button
Definition: GNEConnectorFrame.h:149
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:445
GNEConnectorFrame::ConnectionOperations::ConnectionOperations
ConnectionOperations(GNEConnectorFrame *connectorFrameParent)
FOX-declaration.
Definition: GNEConnectorFrame.cpp:156
GNEConnectorFrame::UNCONNECTED
@ UNCONNECTED
Definition: GNEConnectorFrame.h:265
GNEConnectorFrame::ConnectionOperations::myClearSelectedButton
FXButton * myClearSelectedButton
"Clear Selected"
Definition: GNEConnectorFrame.h:158
GNEConnectorFrame::myCurrentEditedLane
GNELane * myCurrentEditedLane
the lane of which connections are to be modified
Definition: GNEConnectorFrame.h:307
GNEConnectorFrame::ConnectionOperations::mySelectPassingButton
FXButton * mySelectPassingButton
"Select Edges which may always pass"
Definition: GNEConnectorFrame.h:155
GNEConnectorFrame::ConnectionModifications::~ConnectionModifications
~ConnectionModifications()
destructor
Definition: GNEConnectorFrame.cpp:110
config.h
GNEConnectorFrame::ConnectionModifications
Definition: GNEConnectorFrame.h:63
GNEConnectorFrame::ConnectionLegend::getConflictColor
const RGBColor & getConflictColor() const
get color for a to-lane that cannot be used because another connection conflicts
Definition: GNEConnectorFrame.cpp:386
GNEConnectorFrame::ConnectionLegend::myConflictColor
RGBColor myConflictColor
color for a to-lane that cannot be used because another connection conflicts
Definition: GNEConnectorFrame.h:242
GNEConnectorFrame::ConnectionLegend::mySourceColor
RGBColor mySourceColor
color for the from-lane of a connection
Definition: GNEConnectorFrame.h:230
GNEConnectorFrame::CONNECTED
@ CONNECTED
Definition: GNEConnectorFrame.h:266
GNEFrame.h
GNEConnectorFrame::ConnectionOperations::onCmdSelectDeadEnds
long onCmdSelectDeadEnds(FXObject *, FXSelector, void *)
Called when the user presses the select dead ends button.
Definition: GNEConnectorFrame.cpp:185
GNEConnectorFrame::CONNECTED_PASS
@ CONNECTED_PASS
Definition: GNEConnectorFrame.h:267
GNEConnectorFrame::ConnectionLegend::mySourceLabel
FXLabel * mySourceLabel
source label
Definition: GNEConnectorFrame.h:215
GNEConnectorFrame::ConnectionLegend::myConflictLabel
FXLabel * myConflictLabel
conflict label
Definition: GNEConnectorFrame.h:227
GNELane
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:45
NBEdge.h
GNEConnectorFrame::ConnectionOperations::mySelectDeadEndsButton
FXButton * mySelectDeadEndsButton
"Select Dead Ends" button
Definition: GNEConnectorFrame.h:146
GNEConnectorFrame::CONFLICTED
@ CONFLICTED
Definition: GNEConnectorFrame.h:268