SUMO - Simulation of Urban MObility
GNETLSEditorFrame.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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
17 // The Widget for modifying traffic lights
18 /****************************************************************************/
19 #ifndef GNETLSEditorFrame_h
20 #define GNETLSEditorFrame_h
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #ifdef _MSC_VER
26 #include <windows_config.h>
27 #else
28 #include <config.h>
29 #endif
30 
31 #include "GNEFrame.h"
32 
33 // ===========================================================================
34 // class declarations
35 // ===========================================================================
37 class NBLoadedSUMOTLDef;
38 class GNEEdge;
39 class GNELane;
40 class GNEInternalLane;
41 class GNEJunction;
42 
43 // ===========================================================================
44 // class definitions
45 // ===========================================================================
50 class GNETLSEditorFrame : public GNEFrame {
52  FXDECLARE(GNETLSEditorFrame)
53 
54 public:
55 
56  // ===========================================================================
57  // class TLSAttributes
58  // ===========================================================================
59  class TLSAttributes : public FXGroupBox {
60 
61  public:
63  TLSAttributes(FXComposite* parent, GNETLSEditorFrame* TLSEditorParent);
64 
67 
69  void initTLSAttributes(GNEJunction* junction);
70 
72  void clearTLSAttributes();
73 
76 
78  SUMOTime getOffset() const;
79 
81  void setOffset(SUMOTime offset);
82 
84  int getNumberOfTLSDefinitions() const;
85 
87  int getNumberOfPrograms() const;
88 
89  private:
92 
94  std::vector<NBTrafficLightDefinition*> myTLSDefinitions;
95 
97  FXMatrix* myAttributeMatrix;
98 
100  FXLabel* myNameLabel;
101 
103  FXTextField* myNameTextField;
104 
106  FXLabel* myProgramLabel;
107 
109  FXComboBox* myProgramComboBox;
110 
112  FXLabel* myOffsetLabel;
113 
115  FXTextField* myOffsetTextField;
116  };
117 
118 
119  // ===========================================================================
120  // class TLSPhases
121  // ===========================================================================
122  /* class TLSPhases {
123 
124  };*/
125 
126 
127 
132  GNETLSEditorFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet);
133 
136 
139  void editJunction(GNEJunction* junction);
140 
145  long onCmdOK(FXObject*, FXSelector, void*);
146 
149  long onCmdCancel(FXObject*, FXSelector, void*);
150 
152  long onCmdToggle(FXObject*, FXSelector, void*);
153 
155  long onCmdGuess(FXObject*, FXSelector, void*);
156 
158  long onCmdDefCreate(FXObject*, FXSelector, void*);
159 
161  long onCmdDefDelete(FXObject*, FXSelector, void*);
162 
164  long onCmdDefOffset(FXObject*, FXSelector, void*);
165 
167  long onCmdDefSwitch(FXObject*, FXSelector, void*);
168 
170  long onCmdDefRename(FXObject*, FXSelector, void*);
171 
173  long onCmdDefSubRename(FXObject*, FXSelector, void*);
174 
176  long onCmdDefAddOff(FXObject*, FXSelector, void*);
177 
179  long onCmdPhaseSwitch(FXObject*, FXSelector, void*);
180 
182  long onCmdPhaseCreate(FXObject*, FXSelector, void*);
183 
185  long onCmdPhaseDelete(FXObject*, FXSelector, void*);
186 
188  long onCmdCleanup(FXObject*, FXSelector, void*);
189 
191  long onCmdPhaseEdit(FXObject*, FXSelector, void*);
192 
194  long onCmdMakeRILSAConforming(FXObject*, FXSelector, void*);
195 
197  long onUpdDefSwitch(FXObject*, FXSelector, void*);
198 
200  long onUpdNeedsDef(FXObject*, FXSelector, void*);
201 
203  long onUpdNeedsDefAndPhase(FXObject*, FXSelector, void*);
204 
206  long onUpdDefCreate(FXObject*, FXSelector, void*);
207 
209  long onUpdModified(FXObject*, FXSelector, void*);
211 
213  void handleChange(GNEInternalLane* lane);
214 
216  void handleMultiChange(GNELane* lane, FXObject* obj, FXSelector sel, void* data);
217 
219  bool controlsEdge(GNEEdge& edge) const;
220 
221 protected:
224 
226  static SUMOTime getSUMOTime(const FXString& string);
227 
228 private:
230  FXFont* myTableFont;
231 
233  FXGroupBox* myGroupBoxJunction;
234 
237 
239  FXTextField* myTextFieldJunctionID;
240 
243 
246 
249 
251  FXGroupBox* myGroupBoxTLSDef;
252 
254  FXButton* myNewTLProgram;
255 
257  FXButton* myDeleteTLProgram;
258 
260  FXGroupBox* myGroupBoxPhases;
261 
263  FXScrollWindow* myTableScroll;
264 
266  FXTable* myPhaseTable;
267 
269  FXLabel* myCycleDuration;
270 
273 
276 
279 
282 
285 
288 
291 
293  typedef std::map<int, std::vector<GNEInternalLane*> > TLIndexMap;
294  TLIndexMap myInternalLanes;
295 
298 
301 
303  void updateDescription() const;
304 
306  void cleanup();
307 
310 
314  void initPhaseTable(int index = 0);
315 
317  const std::vector<NBTrafficLightLogic::PhaseDefinition>& getPhases();
318 
320  void updateCycleDuration();
321 
323  static std::string varDurString(SUMOTime dur);
324 };
325 
326 
327 #endif
328 
329 /****************************************************************************/
330 
TLIndexMap myInternalLanes
long onCmdGuess(FXObject *, FXSelector, void *)
Called when the user presses the button Guess.
FXTable * myPhaseTable
table for selecting and rearranging phases and for changing duration
long onUpdNeedsDefAndPhase(FXObject *, FXSelector, void *)
Called when occurs an update of needs definition an dphase.
long onCmdPhaseDelete(FXObject *, FXSelector, void *)
Called when the user deletes a Phase.
FXButton * myInsertDuplicateButton
insert new phase button
int myPhaseIndex
index of the phase being shown
long onCmdDefCreate(FXObject *, FXSelector, void *)
Called when the user creates a TLS.
FXButton * myNewTLProgram
button for create new Traffic light program
long onCmdMakeRILSAConforming(FXObject *, FXSelector, void *)
Called when the user makes RILSA.
FXLabel * myOffsetLabel
offset label
FXButton * myDiscardModificationsButtons
button for cancel modifications
A loaded (complete) traffic light logic.
TLSAttributes * myTLSAttributes
TLS attributes.
long onCmdPhaseSwitch(FXObject *, FXSelector, void *)
Called when the user switchs a Phase.
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
The base class for traffic light logic definitions.
FXScrollWindow * myTableScroll
window for oversized phase tables
FXComboBox * myProgramComboBox
the comboBox for selecting the tl-definition to edit
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:53
void editJunction(GNEJunction *junction)
edits the traffic light for the given junction
FXButton * mySaveModificationsButtons
button for save modifications
GNETLSEditorFrame()
FOX needs this.
void handleMultiChange(GNELane *lane, FXObject *obj, FXSelector sel, void *data)
update phase definition for the current traffic light and phase
std::map< int, std::vector< GNEInternalLane * > > TLIndexMap
the internal lanes belonging the the current junction indexed by their tl-index
FXLabel * myProgramLabel
program label
long onUpdNeedsDef(FXObject *, FXSelector, void *)
Called when occurs an update of needs definition.
FXFont * myTableFont
font for the phase table
long onCmdCleanup(FXObject *, FXSelector, void *)
Called when the user cleans up states.
long onCmdDefDelete(FXObject *, FXSelector, void *)
Called when the user deletes a TLS.
long onCmdDefOffset(FXObject *, FXSelector, void *)
Called when the user changes the offset of a TLS.
long onCmdDefSwitch(FXObject *, FXSelector, void *)
Called when the user switchs a TLS.
long onCmdDefAddOff(FXObject *, FXSelector, void *)
Called when the user adds a OFF.
FXGroupBox * myGroupBoxModifications
groupbox for buttons modifications
void clearTLSAttributes()
clear TLS attributes
GNETLSEditorFrame * myTLSEditorParent
pointer to TLSEditorParent
FXTextField * myNameTextField
name text field
void initTLSAttributes(GNEJunction *junction)
initializes the definitions and corresponding listbox
long onCmdCancel(FXObject *, FXSelector, void *)
Called when the user presses the Cancel-button.
NBTrafficLightDefinition * getCurrentTLSDefinition() const
get current definition
bool controlsEdge(GNEEdge &edge) const
whether the given edge is controlled by the currently edited tlDef
long onUpdDefCreate(FXObject *, FXSelector, void *)
Called when occurs an update of create definition.
void buildIinternalLanes(NBTrafficLightDefinition *tlDef)
builds internal lanes for the given tlDef
bool myHaveModifications
whether the current tls was modified
long onCmdPhaseEdit(FXObject *, FXSelector, void *)
Called when the user edits a Phase.
FXGroupBox * myGroupBoxTLSDef
groupbox for TLS Definition buttons
~GNETLSEditorFrame()
Destructor.
void handleChange(GNEInternalLane *lane)
update phase definition for the current traffic light and phase
FXGroupBox * myGroupBoxPhases
groupbox for phases
FXLabel * myLabelJunctionID
label for junction ID
FXGroupBox * myGroupBoxJunction
groupbox for current junction
static SUMOTime getSUMOTime(const FXString &string)
converts to SUMOTime
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:56
int getNumberOfTLSDefinitions() const
get number of definitions
long onUpdDefSwitch(FXObject *, FXSelector, void *)
Called when occurs an update of switch definition.
void updateCycleDuration()
recomputes cycle duration and updates label
static std::string varDurString(SUMOTime dur)
convert duration (potentially undefined) to string
FXMatrix * myAttributeMatrix
matrix for attributes
int getNumberOfPrograms() const
get number of programs
FXLabel * myLabelJunctionStatus
label for junction status
TLSAttributes(FXComposite *parent, GNETLSEditorFrame *TLSEditorParent)
constructor
long onCmdOK(FXObject *, FXSelector, void *)
SUMOTime getOffset() const
get current offset in SUMOTIme
FXButton * myDeleteSelectedPhaseButton
delete phase button
long onCmdDefSubRename(FXObject *, FXSelector, void *)
Called when the user sub-renames a TLS.
void setOffset(SUMOTime offset)
set new offset
GNEJunction * myCurrentJunction
the junction of the tls is being modified
const std::vector< NBTrafficLightLogic::PhaseDefinition > & getPhases()
the phase of the current traffic light
long onCmdPhaseCreate(FXObject *, FXSelector, void *)
Called when the user creates a Phase.
FXTextField * myTextFieldJunctionStatus
text field for junction status
long long int SUMOTime
Definition: TraCIDefs.h:51
FXButton * myDeleteTLProgram
button for delete traffic light program
long onCmdDefRename(FXObject *, FXSelector, void *)
Called when the user renames a TLS.
long onUpdModified(FXObject *, FXSelector, void *)
Called when occurs an update of modified.
FXTextField * myOffsetTextField
the control for modifying offset
NBLoadedSUMOTLDef * myEditedDef
the traffic light definition being edited
void updateDescription() const
update descrition
FXTextField * myTextFieldJunctionID
text field for junction ID
std::vector< NBTrafficLightDefinition * > myTLSDefinitions
the list of Definitions for the current junction
void cleanup()
cleans up previous lanes
FXLabel * myCycleDuration
label with the cycle duration
long onCmdToggle(FXObject *, FXSelector, void *)
Called when the user presses the button Toogle.
void initPhaseTable(int index=0)
initialies the phase table