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:
56 
57  // ===========================================================================
58  // class TLSAttributes
59  // ===========================================================================
60  class TLSAttributes : public FXGroupBox {
61 
62  public:
64  TLSAttributes(FXComposite* parent, GNETLSEditorFrame* TLSEditorParent);
65 
68 
70  void initTLSAttributes(GNEJunction* junction);
71 
73  void clearTLSAttributes();
74 
77 
79  SUMOTime getOffset() const;
80 
82  void setOffset(SUMOTime offset);
83 
85  int getNumberOfTLSDefinitions() const;
86 
88  int getNumberOfPrograms() const;
89 
90  private:
93 
95  std::vector<NBTrafficLightDefinition*> myTLSDefinitions;
96 
98  FXMatrix* myAttributeMatrix;
99 
101  FXLabel* myNameLabel;
102 
104  FXTextField* myNameTextField;
105 
107  FXLabel* myProgramLabel;
108 
110  FXComboBox* myProgramComboBox;
111 
113  FXLabel* myOffsetLabel;
114 
116  FXTextField* myOffsetTextField;
117  };
118 
119 
120  // ===========================================================================
121  // class TLSPhases
122  // ===========================================================================
123  /* class TLSPhases {
124 
125  };*/
126 
127 
128 
133  GNETLSEditorFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet);
134 
137 
140  void editJunction(GNEJunction* junction);
141 
146  long onCmdOK(FXObject*, FXSelector, void*);
147 
150  long onCmdCancel(FXObject*, FXSelector, void*);
151 
153  long onCmdToggle(FXObject*, FXSelector, void*);
154 
156  long onCmdGuess(FXObject*, FXSelector, void*);
157 
159  long onCmdDefCreate(FXObject*, FXSelector, void*);
160 
162  long onCmdDefDelete(FXObject*, FXSelector, void*);
163 
165  long onCmdDefOffset(FXObject*, FXSelector, void*);
166 
168  long onCmdDefSwitch(FXObject*, FXSelector, void*);
169 
171  long onCmdDefRename(FXObject*, FXSelector, void*);
172 
174  long onCmdDefSubRename(FXObject*, FXSelector, void*);
175 
177  long onCmdDefAddOff(FXObject*, FXSelector, void*);
178 
180  long onCmdPhaseSwitch(FXObject*, FXSelector, void*);
181 
183  long onCmdPhaseCreate(FXObject*, FXSelector, void*);
184 
186  long onCmdPhaseDelete(FXObject*, FXSelector, void*);
187 
189  long onCmdPhaseEdit(FXObject*, FXSelector, void*);
190 
192  long onCmdMakeRILSAConforming(FXObject*, FXSelector, void*);
193 
195  long onUpdDefSwitch(FXObject*, FXSelector, void*);
196 
198  long onUpdNeedsDef(FXObject*, FXSelector, void*);
199 
201  long onUpdNeedsDefAndPhase(FXObject*, FXSelector, void*);
202 
204  long onUpdDefCreate(FXObject*, FXSelector, void*);
205 
207  long onUpdModified(FXObject*, FXSelector, void*);
209 
211  void handleChange(GNEInternalLane* lane);
212 
214  void handleMultiChange(GNELane* lane, FXObject* obj, FXSelector sel, void* data);
215 
217  bool controlsEdge(GNEEdge& edge) const;
218 
219 protected:
222 
224  static SUMOTime getSUMOTime(const FXString& string);
225 
226 private:
228  FXFont* myTableFont;
229 
231  FXGroupBox* myGroupBoxJunction;
232 
235 
237  FXTextField* myTextFieldJunctionID;
238 
241 
244 
247 
249  FXGroupBox* myGroupBoxTLSDef;
250 
252  FXButton* myNewTLProgram;
253 
255  FXButton* myDeleteTLProgram;
256 
258  FXGroupBox* myGroupBoxPhases;
259 
261  FXScrollWindow* myTableScroll;
262 
264  FXTable* myPhaseTable;
265 
267  FXLabel* myCycleDuration;
268 
271 
274 
277 
280 
283 
286 
289 
291  typedef std::map<int, std::vector<GNEInternalLane*> > TLIndexMap;
292  TLIndexMap myInternalLanes;
293 
296 
299 
301  void updateDescription() const;
302 
304  void cleanup();
305 
308 
312  void initPhaseTable(int index = 0);
313 
315  const std::vector<NBTrafficLightLogic::PhaseDefinition>& getPhases();
316 
318  void updateCycleDuration();
319 
321  static std::string varDurString(SUMOTime dur);
322 };
323 
324 
325 #endif
326 
327 /****************************************************************************/
328 
TLIndexMap myInternalLanes
long onCmdGuess(FXObject *, FXSelector, void *)
Called when the user presses the button Guess.
bool controlsEdge(GNEEdge &edge) const
whether the given edge is controlled by the currently edited tlDef
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:54
void editJunction(GNEJunction *junction)
edits the traffic light for the given junction
FXButton * mySaveModificationsButtons
button for save modifications
int getNumberOfPrograms() const
get number of programs
GNETLSEditorFrame()
FOX needs this.
NBTrafficLightDefinition * getCurrentTLSDefinition() const
get current definition
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
int getNumberOfTLSDefinitions() const
get number of definitions
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 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.
void updateDescription() const
update descrition
FXGroupBox * myGroupBoxModifications
groupbox for buttons modifications
SUMOTime getOffset() const
get current offset in SUMOTIme
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.
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:58
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
FXLabel * myLabelJunctionStatus
label for junction status
TLSAttributes(FXComposite *parent, GNETLSEditorFrame *TLSEditorParent)
constructor
long onCmdOK(FXObject *, FXSelector, void *)
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: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.
FXTextField * myOffsetTextField
the control for modifying offset
NBLoadedSUMOTLDef * myEditedDef
the traffic light definition being edited
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