SUMO - Simulation of Urban MObility
GNEConnectorFrame.h
Go to the documentation of this file.
1 /****************************************************************************/
7 // The Widget for modifying lane-to-lane connections
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
10 // Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors
11 /****************************************************************************/
12 //
13 // This file is part of SUMO.
14 // SUMO is free software: you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation, either version 3 of the License, or
17 // (at your option) any later version.
18 //
19 /****************************************************************************/
20 #ifndef GNEConnectorFrame_h
21 #define GNEConnectorFrame_h
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #ifdef _MSC_VER
27 #include <windows_config.h>
28 #else
29 #include <config.h>
30 #endif
31 
32 #include "GNEFrame.h"
33 
34 // ===========================================================================
35 // class declarations
36 // ===========================================================================
37 class GNELane;
38 class GNEInternalLane;
39 
40 // ===========================================================================
41 // class definitions
42 // ===========================================================================
47 class GNEConnectorFrame : public GNEFrame {
49  FXDECLARE(GNEConnectorFrame)
50 
51 public:
56  GNEConnectorFrame(FXComposite* parent, GNEViewNet* viewNet);
57 
60 
62  void show();
63 
65  void hide();
66 
73  void handleLaneClick(GNELane* lane, bool mayDefinitelyPass, bool allowConflict, bool toggle);
74 
78  long onCmdOK(FXObject*, FXSelector, void*);
79 
81  long onCmdCancel(FXObject*, FXSelector, void*);
82 
84  long onCmdSelectDeadEnds(FXObject*, FXSelector, void*);
85  long onCmdSelectDeadStarts(FXObject*, FXSelector, void*);
86  long onCmdSelectConflicts(FXObject*, FXSelector, void*);
87  long onCmdSelectPass(FXObject*, FXSelector, void*);
88  long onCmdClearSelectedConnections(FXObject*, FXSelector, void*);
89  long onCmdResetSelectedConnections(FXObject*, FXSelector, void*);
91 
92 protected:
95 
96 private:
97 
99  enum LaneStatus {
104  };
105 
107  FXLabel* myDescription;
108 
111 
113  std::set<GNELane*> myPotentialTargets;
114 
117 
119  std::map<int, GNEInternalLane*> myInternalLanes;
120 
123 
126 
129 
132 
135 
136 private:
138  void updateDescription() const;
139 
141  void initTargets();
142 
144  void cleanup();
145 
147  void removeConnections(GNELane* lane);
148 
150  LaneStatus getLaneStatus(const std::vector<NBEdge::Connection>& connections, GNELane* targetLane);
151 
152  /* @brief return the link number (tlLinkNo) of an existing connection
153  * @param[in] connections All connections of the current edge from the given lane
154  * @param[in] targetLane The target lane of the connection
155  */
156  int getTLLLinkNumber(const std::vector<NBEdge::Connection>& connections, GNELane* targetLane);
157 
159  void buildIinternalLanes(NBNode* node);
160 };
161 
162 
163 #endif
164 
165 /****************************************************************************/
166 
static RGBColor targetColor
color for the to-lane of a connection
void show()
show Frame
long onCmdSelectDeadStarts(FXObject *, FXSelector, void *)
long onCmdSelectPass(FXObject *, FXSelector, void *)
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
std::set< GNELane * > myPotentialTargets
the set of lanes to which the current lane may be connected
long onCmdClearSelectedConnections(FXObject *, FXSelector, void *)
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:54
LaneStatus getLaneStatus(const std::vector< NBEdge::Connection > &connections, GNELane *targetLane)
return the status of toLane
static RGBColor potentialTargetColor
color for potential to-lane targets (currently unconnected)
void handleLaneClick(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...
long onCmdSelectConflicts(FXObject *, FXSelector, void *)
int myNumChanges
number of changes
void initTargets()
init targets
GNEConnectorFrame()
FOX needs this.
void removeConnections(GNELane *lane)
remove connections
static RGBColor sourceColor
color for the from-lane of a connection
static RGBColor targetPassColor
color for the to-lane of a connection with pass attribute
long onCmdOK(FXObject *, FXSelector, void *)
void updateDescription() const
update description
void hide()
hide Frame
static RGBColor conflictColor
color for a to-lane that cannot be used because another connection conflicts
std::map< int, GNEInternalLane * > myInternalLanes
the internal lanes belonging the the current junction indexed by their tl-index
void buildIinternalLanes(NBNode *node)
builds internal lanes for the given node
long onCmdCancel(FXObject *, FXSelector, void *)
Called when the user presses the Cancel-button discards any connection modifications.
FXLabel * myDescription
the label that shows the current editing state
LaneStatus
the status of a target lane
Represents a single node (junction) during network building.
Definition: NBNode.h:74
long onCmdSelectDeadEnds(FXObject *, FXSelector, void *)
Called when the user presses the Corresponding-button.
GNELane * myCurrentLane
the lane of which connections are to be modified
~GNEConnectorFrame()
Destructor.
void cleanup()
clean up when deselecting current lane
int getTLLLinkNumber(const std::vector< NBEdge::Connection > &connections, GNELane *targetLane)
long onCmdResetSelectedConnections(FXObject *, FXSelector, void *)