SUMO - Simulation of Urban MObility
GNEConnector.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-2015 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 GNEConnector_h
21 #define GNEConnector_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include <fx.h>
35 #include <netbuild/NBEdge.h>
36 
37 // ===========================================================================
38 // class declarations
39 // ===========================================================================
40 class GNEViewNet;
41 class GNELane;
42 class GNEInternalLane;
43 class GNEUndoList;
44 
45 
46 // ===========================================================================
47 // class definitions
48 // ===========================================================================
53 class GNEConnector : public FXScrollWindow {
54  // FOX-declarations
55  FXDECLARE(GNEConnector)
56 
57 public:
61  GNEConnector(FXComposite* parent, GNEViewNet* updateTarget, GNEUndoList* undoList);
62 
63 
65  ~GNEConnector();
66 
67 
68  FXFont* getHeaderFont() {
69  return myHeaderFont;
70  }
71 
78  void handleLaneClick(GNELane* lane, bool mayDefinitelyPass, bool allowConflict, bool toggle);
79 
82 
85  long onCmdOK(FXObject*, FXSelector, void*);
86 
90  long onCmdCancel(FXObject*, FXSelector, void*);
91 
93  long onCmdSelectDeadEnds(FXObject*, FXSelector, void*);
94  long onCmdSelectDeadStarts(FXObject*, FXSelector, void*);
95  long onCmdSelectConflicts(FXObject*, FXSelector, void*);
96  long onCmdSelectPass(FXObject*, FXSelector, void*);
97  long onCmdClearSelectedConnections(FXObject*, FXSelector, void*);
98  long onCmdResetSelectedConnections(FXObject*, FXSelector, void*);
100 
101 protected:
104 
105 private:
106 
108  enum LaneStatus {
113  };
114 
116  FXVerticalFrame* myContentFrame;
117 
119  FXFont* myHeaderFont;
120 
122  FXLabel* myDescription;
123 
126 
128  std::set<GNELane*> myPotentialTargets;
129 
131 
132  unsigned int myNumChanges;
133 
134  /* @brief the window to inform when connections are modified */
136 
138  std::map<int, GNEInternalLane*> myInternalLanes;
139 
140  static const int WIDTH;
141 
152 
153 private:
154  void updateDescription() const;
155 
156  void initTargets();
157 
158  // @brief clean up when deselecting current lane
159  void cleanup();
160 
161  // @brief remove connections
162  void removeConnections(GNELane* lane);
163 
164  // @brief return the status of toLane
165  LaneStatus getLaneStatus(const std::vector<NBEdge::Connection>& connections, GNELane* targetLane);
166 
167  /* @brief return the link number (tlLinkNo) of an existing connection
168  * @param[in] connections All connections of the current edge from the given lane
169  * @param[in] targetLane The target lane of the connection
170  */
171  unsigned int getTLLLinkNumber(const std::vector<NBEdge::Connection>& connections, GNELane* targetLane);
172 
173  /* @brief builds internal lanes for the given node */
174  void buildIinternalLanes(NBNode* node);
175 
176 };
177 
178 
179 #endif
180 
181 /****************************************************************************/
182 
unsigned int getTLLLinkNumber(const std::vector< NBEdge::Connection > &connections, GNELane *targetLane)
void initTargets()
std::map< int, GNEInternalLane * > myInternalLanes
the internal lanes belonging the the current junction indexed by their tl-index
Definition: GNEConnector.h:138
long onCmdSelectDeadEnds(FXObject *, FXSelector, void *)
Called when the user presses the Corresponding-button.
static RGBColor targetPassColor
color for the to-lane of a connection with pass attribute
Definition: GNEConnector.h:149
LaneStatus getLaneStatus(const std::vector< NBEdge::Connection > &connections, GNELane *targetLane)
FXVerticalFrame * myContentFrame
the panel to hold all member widgets
Definition: GNEConnector.h:116
long onCmdSelectDeadStarts(FXObject *, FXSelector, void *)
FXLabel * myDescription
the label that shows the current editing state
Definition: GNEConnector.h:122
GNELane * myCurrentLane
the lane of which connections are to be modified
Definition: GNEConnector.h:125
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 onCmdOK(FXObject *, FXSelector, void *)
Called when the user presses the OK-Button saves any connection modifications.
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:56
~GNEConnector()
Destructor.
static RGBColor conflictColor
color for a to-lane that cannot be used because another connection conflicts
Definition: GNEConnector.h:147
void removeConnections(GNELane *lane)
static RGBColor sourceColor
color for the from-lane of a connection
Definition: GNEConnector.h:143
long onCmdClearSelectedConnections(FXObject *, FXSelector, void *)
FXFont * getHeaderFont()
Definition: GNEConnector.h:68
long onCmdCancel(FXObject *, FXSelector, void *)
Called when the user presses the Cancel-button discards any connection modifications.
LaneStatus
the status of a target lane
Definition: GNEConnector.h:108
GNEViewNet * myUpdateTarget
Definition: GNEConnector.h:135
static const int WIDTH
Definition: GNEConnector.h:140
GNEUndoList * myUndoList
Definition: GNEConnector.h:130
long onCmdSelectPass(FXObject *, FXSelector, void *)
void updateDescription() const
long onCmdResetSelectedConnections(FXObject *, FXSelector, void *)
GNEConnector()
FOX needs this.
Definition: GNEConnector.h:103
std::set< GNELane * > myPotentialTargets
the set of lanes to which the current lane may be connected
Definition: GNEConnector.h:128
unsigned int myNumChanges
Definition: GNEConnector.h:132
long onCmdSelectConflicts(FXObject *, FXSelector, void *)
FXFont * myHeaderFont
Font for the widget.
Definition: GNEConnector.h:119
Represents a single node (junction) during network building.
Definition: NBNode.h:74
void buildIinternalLanes(NBNode *node)
static RGBColor targetColor
color for the to-lane of a connection
Definition: GNEConnector.h:145
static RGBColor potentialTargetColor
color for potential to-lane targets (currently unconnected)
Definition: GNEConnector.h:151