SUMO - Simulation of Urban MObility
GNETLSEditorFrame.h
Go to the documentation of this file.
1 /****************************************************************************/
7 // The Widget for modifying traffic lights
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
10 // Copyright (C) 2001-2017 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 GNETLSEditorFrame_h
21 #define GNETLSEditorFrame_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 // ===========================================================================
38 class NBLoadedSUMOTLDef;
39 class GNEEdge;
40 class GNELane;
41 class GNEInternalLane;
42 class GNEJunction;
43 
44 // ===========================================================================
45 // class definitions
46 // ===========================================================================
51 class GNETLSEditorFrame : public GNEFrame {
53  FXDECLARE(GNETLSEditorFrame)
54 
55 public:
60  GNETLSEditorFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet);
61 
64 
67  void editJunction(GNEJunction* junction);
68 
73  long onCmdOK(FXObject*, FXSelector, void*);
74 
77  long onCmdCancel(FXObject*, FXSelector, void*);
78 
80  long onCmdToggle(FXObject*, FXSelector, void*);
81 
83  long onCmdGuess(FXObject*, FXSelector, void*);
84 
86  long onCmdDefCreate(FXObject*, FXSelector, void*);
87 
89  long onCmdDefDelete(FXObject*, FXSelector, void*);
90 
92  long onCmdDefOffset(FXObject*, FXSelector, void*);
93 
95  long onCmdDefSwitch(FXObject*, FXSelector, void*);
96 
98  long onCmdDefRename(FXObject*, FXSelector, void*);
99 
101  long onCmdDefSubRename(FXObject*, FXSelector, void*);
102 
104  long onCmdDefAddOff(FXObject*, FXSelector, void*);
105 
107  long onCmdPhaseSwitch(FXObject*, FXSelector, void*);
108 
110  long onCmdPhaseCreate(FXObject*, FXSelector, void*);
111 
113  long onCmdPhaseDelete(FXObject*, FXSelector, void*);
114 
116  long onCmdPhaseEdit(FXObject*, FXSelector, void*);
117 
119  long onCmdMakeRILSAConforming(FXObject*, FXSelector, void*);
120 
122  long onUpdDefSwitch(FXObject*, FXSelector, void*);
123 
125  long onUpdNeedsDef(FXObject*, FXSelector, void*);
126 
128  long onUpdNeedsDefAndPhase(FXObject*, FXSelector, void*);
129 
131  long onUpdDefCreate(FXObject*, FXSelector, void*);
132 
134  long onUpdModified(FXObject*, FXSelector, void*);
136 
138  void handleChange(GNEInternalLane* lane);
139 
141  void handleMultiChange(GNELane* lane, FXObject* obj, FXSelector sel, void* data);
142 
144  bool controlsEdge(GNEEdge& edge) const;
145 
146 protected:
149 
150 private:
152  FXFont* myTableFont;
153 
155  FXGroupBox* myGroupBoxJunction;
156 
158  FXLabel* myDescription;
159 
161  FXGroupBox* myGroupBoxTLSDef;
162 
164  FXButton* myNewTLProgram;
165 
167  FXButton* myDeleteTLProgram;
168 
170  FXGroupBox* myGroupBoxAttributes;
171 
173  FXMatrix* myAttributeMatrix;
174 
176  FXLabel* myNameLabel;
177 
179  FXTextField* myNameTextField;
180 
182  FXLabel* myProgramLabel;
183 
185  FXComboBox* myProgramComboBox;
186 
188  FXLabel* myOffsetLabel;
189 
191  FXTextField* myOffset;
192 
194  FXGroupBox* myGroupBoxPhases;
195 
197  FXTable* myPhaseTable;
198 
200  FXLabel* myCycleDuration;
201 
204 
207 
210 
213 
216 
219 
222 
224  typedef std::map<int, std::vector<GNEInternalLane*> > TLIndexMap;
225  TLIndexMap myInternalLanes;
226 
228  std::vector<NBTrafficLightDefinition*> myDefinitions;
229 
232 
235 
237  void updateDescription() const;
238 
240  void cleanup();
241 
244 
246  void initDefinitions();
247 
251  void initPhaseTable(int index = 0);
252 
254  const std::vector<NBTrafficLightLogic::PhaseDefinition>& getPhases();
255 
257  void updateCycleDuration();
258 
260  static SUMOTime getSUMOTime(const FXString& string);
261 };
262 
263 
264 #endif
265 
266 /****************************************************************************/
267 
TLIndexMap myInternalLanes
long onCmdGuess(FXObject *, FXSelector, void *)
Called when the user presses the button Guess.
std::vector< NBTrafficLightDefinition * > myDefinitions
the list of Definitions for the current junction
FXLabel * myDescription
the label that shows the current editing state
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.
FXButton * myDiscardModificationsButtons
button for cancel modifications
A loaded (complete) traffic light logic.
long onCmdPhaseSwitch(FXObject *, FXSelector, void *)
Called when the user switchs a Phase.
FXLabel * myNameLabel
name label
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.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:54
void editJunction(GNEJunction *junction)
edits the traffic light for the given junction
FXLabel * myOffsetLabel
offset label
FXButton * mySaveModificationsButtons
button for save modifications
FXGroupBox * myGroupBoxAttributes
groupbox for TLS attributes
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
long onUpdNeedsDef(FXObject *, FXSelector, void *)
Called when occurs an update of needs definition.
FXFont * myTableFont
font for the phase table
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
FXTextField * myNameTextField
name text field
long onCmdCancel(FXObject *, FXSelector, void *)
Called when the user presses the Cancel-button.
bool controlsEdge(GNEEdge &edge) const
whether the given edge is controlled by the currently edited tlDef
FXLabel * myProgramLabel
program label
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
FXGroupBox * myGroupBoxJunction
groupbox for current junction
FXMatrix * myAttributeMatrix
matrix for attributes
FXTextField * myOffset
the control for modifying offset
static SUMOTime getSUMOTime(const FXString &string)
converts to SUMOTime
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:57
long onUpdDefSwitch(FXObject *, FXSelector, void *)
Called when occurs an update of switch definition.
void updateCycleDuration()
recomputes cycle duration and updates label
void initDefinitions()
initializes the definitions and corresponding listbox
long onCmdOK(FXObject *, FXSelector, void *)
FXButton * myDeleteSelectedPhaseButton
delete phase button
long onCmdDefSubRename(FXObject *, FXSelector, void *)
Called when the user sub-renames a TLS.
FXComboBox * myProgramComboBox
the comboBox for selecting the tl-definition to edit
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.
long long int SUMOTime
Definition: TraCIDefs.h:52
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.
NBLoadedSUMOTLDef * myEditedDef
the traffic light definition being edited
void updateDescription() const
update descrition
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