Eclipse SUMO - Simulation of Urban MObility
GNETAZFrame.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-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
18 // The Widget for add TAZ elements
19 /****************************************************************************/
20 #pragma once
21 
23 
24 
25 // ===========================================================================
26 // class definitions
27 // ===========================================================================
28 class GNETAZ;
29 class GNETAZSourceSink;
30 
31 
32 // ===========================================================================
33 // class definitions
34 // ===========================================================================
39 class GNETAZFrame : public GNEFrame {
40 
41 public:
42  // ===========================================================================
43  // class TAZCurrent
44  // ===========================================================================
45 
46  class TAZCurrent : protected FXGroupBox {
47 
48  public:
50  struct TAZEdge {
52  TAZEdge(TAZCurrent* TAZCurrentParent, GNEEdge* _edge, GNETAZSourceSink* _TAZSource, GNETAZSourceSink* _TAZSink);
53 
55  ~TAZEdge();
56 
58  void updateColors();
59 
62 
65 
68 
71 
73  int sinkColor;
74 
77 
80 
81  private:
84  };
85 
87  TAZCurrent(GNETAZFrame* TAZFrameParent);
88 
90  ~TAZCurrent();
91 
93  void setTAZ(GNETAZ* editedTAZ);
94 
96  GNETAZ* getTAZ() const;
97 
99  bool isTAZEdge(GNEEdge* edge) const;
100 
102  const std::vector<GNEEdge*>& getNetEdges() const;
103 
105  const std::vector<GNEEdge*>& getSelectedEdges() const;
106 
108  const std::vector<TAZCurrent::TAZEdge>& getTAZEdges() const;
109 
111  void refreshTAZEdges();
112 
113  protected:
115  void addTAZChild(GNETAZSourceSink* additional);
116 
117  private:
120 
123 
125  std::vector<GNEEdge*> myNetEdges;
126 
128  std::vector<GNEEdge*> mySelectedEdges;
129 
131  std::vector<TAZEdge> myTAZEdges;
132 
135 
138 
141 
144 
147  };
148 
149  // ===========================================================================
150  // class TAZCommonStatistics
151  // ===========================================================================
152 
153  class TAZCommonStatistics : protected FXGroupBox {
154 
155  public:
157  TAZCommonStatistics(GNETAZFrame* TAZFrameParent);
158 
161 
164 
167 
168  protected:
170  void updateStatistics();
171 
172  private:
175 
178  };
179 
180  // ===========================================================================
181  // class TAZSaveChanges
182  // ===========================================================================
183 
184  class TAZSaveChanges : protected FXGroupBox {
186  FXDECLARE(GNETAZFrame::TAZSaveChanges)
187 
188  public:
190  TAZSaveChanges(GNETAZFrame* TAZFrameParent);
191 
193  ~TAZSaveChanges();
194 
197 
200 
203 
205  bool isChangesPending() const;
206 
210  long onCmdSaveChanges(FXObject*, FXSelector, void*);
211 
213  long onCmdCancelChanges(FXObject*, FXSelector, void*);
215 
216  protected:
217  FOX_CONSTRUCTOR(TAZSaveChanges)
218 
219  private:
222 
225 
228  };
229 
230  // ===========================================================================
231  // class TAZChildDefaultParameters
232  // ===========================================================================
233 
234  class TAZChildDefaultParameters : protected FXGroupBox {
237 
238  public:
240  TAZChildDefaultParameters(GNETAZFrame* TAZFrameParent);
241 
244 
247 
250 
253 
255  double getDefaultTAZSourceWeight() const;
256 
258  double getDefaultTAZSinkWeight() const;
259 
261  bool getToggleMembership() const;
262 
266  long onCmdSetDefaultValues(FXObject* obj, FXSelector, void*);
267 
269  long onCmdUseSelectedEdges(FXObject* obj, FXSelector, void*);
271 
272  protected:
273  FOX_CONSTRUCTOR(TAZChildDefaultParameters)
274 
275  private:
278 
280  FXCheckButton* myToggleMembership;
281 
283  FXHorizontalFrame* myDefaultTAZSourceFrame;
284 
287 
289  FXHorizontalFrame* myDefaultTAZSinkFrame;
290 
293 
296 
299 
302 
305  };
306 
307  // ===========================================================================
308  // class TAZSelectionStatistics
309  // ===========================================================================
310 
311  class TAZSelectionStatistics : protected FXGroupBox {
314 
315  public:
317  TAZSelectionStatistics(GNETAZFrame* TAZFrameParent);
318 
321 
324 
327 
329  bool selectEdge(const TAZCurrent::TAZEdge& edge);
330 
332  bool unselectEdge(GNEEdge* edge);
333 
335  bool isEdgeSelected(GNEEdge* edge);
336 
338  void clearSelectedEdges();
339 
341  const std::vector<TAZCurrent::TAZEdge>& getEdgeAndTAZChildrenSelected() const;
342 
346  long onCmdSetNewValues(FXObject* obj, FXSelector, void*);
347 
349  long onCmdSelectEdges(FXObject* obj, FXSelector, void*);
351 
352  protected:
353  FOX_CONSTRUCTOR(TAZSelectionStatistics)
354 
355 
356  void updateStatistics();
357 
358  private:
361 
363  FXHorizontalFrame* myTAZSourceFrame;
364 
367 
369  FXHorizontalFrame* myTAZSinkFrame;
370 
373 
376 
378  std::vector<TAZCurrent::TAZEdge> myEdgeAndTAZChildrenSelected;
379  };
380 
381  // ===========================================================================
382  // class TAZParameters
383  // ===========================================================================
384 
385  class TAZParameters : protected FXGroupBox {
387  FXDECLARE(GNETAZFrame::TAZParameters)
388 
389  public:
391  TAZParameters(GNETAZFrame* TAZFrameParent);
392 
394  ~TAZParameters();
395 
397  void showTAZParametersModul();
398 
400  void hideTAZParametersModul();
401 
403  bool isCurrentParametersValid() const;
404 
406  bool isAddEdgesWithinEnabled() const;
407 
409  std::map<SumoXMLAttr, std::string> getAttributesAndValues() const;
410 
414  long onCmdSetColorAttribute(FXObject*, FXSelector, void*);
415 
417  long onCmdSetAttribute(FXObject*, FXSelector, void*);
418 
420  long onCmdHelp(FXObject*, FXSelector, void*);
422 
423  protected:
424  FOX_CONSTRUCTOR(TAZParameters)
425 
426  private:
429 
431  FXButton* myColorEditor;
432 
434  FXTextField* myTextFieldColor;
435 
438 
441  };
442 
443  // ===========================================================================
444  // class TAZEdgesGraphic
445  // ===========================================================================
446 
447  class TAZEdgesGraphic : protected FXGroupBox {
450 
451  public:
453  TAZEdgesGraphic(GNETAZFrame* TAZFrameParent);
454 
457 
460 
463 
465  void updateEdgeColors();
466 
470  long onCmdChoosenBy(FXObject* obj, FXSelector, void*);
472 
473  protected:
474  FOX_CONSTRUCTOR(TAZEdgesGraphic)
475 
476  private:
479 
481  FXRadioButton* myColorBySourceWeight;
482 
484  FXRadioButton* myColorBySinkWeight;
485 
488 
491 
494 
497  };
498 
503  GNETAZFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet);
504 
506  ~GNETAZFrame();
507 
509  void hide();
510 
516  bool processClick(const Position& clickedPosition, const GNEViewNetHelper::ObjectsUnderCursor& objectsUnderCursor);
517 
519  void processEdgeSelection(const std::vector<GNEEdge*>& edges);
520 
523 
526 
529 
532 
533 protected:
538  bool shapeDrawed();
539 
541  bool addOrRemoveTAZMember(GNEEdge* edge);
542 
544  void dropTAZMembers();
545 
546 private:
549 
552 
555 
558 
561 
564 
567 
570 
573 };
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:49
bool getToggleMembership() const
check if toggle membership is enabled
FXButton * myUseSelectedEdges
button for use selected edges
Definition: GNETAZFrame.h:295
TAZChildDefaultParameters(GNETAZFrame *TAZFrameParent)
FOX-declaration.
FXCheckButton * myToggleMembership
CheckButton to enable or disable Toggle edge Membership.
Definition: GNETAZFrame.h:280
void hideTAZChildDefaultParametersModul()
hide TAZ child default parameters Modul
FXTextField * myTextFieldDefaultValueTAZSources
textField to set a default value for TAZ Sources
Definition: GNETAZFrame.h:286
long onCmdUseSelectedEdges(FXObject *obj, FXSelector, void *)
Called when the user press use selected edges.
void updateSelectEdgesButton()
update "select edges button"
double getDefaultTAZSourceWeight() const
get default TAZSource weight
FXLabel * myInformationLabel
information label
Definition: GNETAZFrame.h:298
FXHorizontalFrame * myDefaultTAZSinkFrame
Horizontal Frame for default TAZ Sink Weight.
Definition: GNETAZFrame.h:289
FXHorizontalFrame * myDefaultTAZSourceFrame
Horizontal Frame for default TAZ Source Weight.
Definition: GNETAZFrame.h:283
GNETAZFrame * myTAZFrameParent
pointer to TAZFrame parent
Definition: GNETAZFrame.h:277
double myDefaultTAZSourceWeight
default TAZSource weight
Definition: GNETAZFrame.h:301
FXTextField * myTextFieldDefaultValueTAZSinks
textField to set a default value for TAZ Sinks
Definition: GNETAZFrame.h:292
long onCmdSetDefaultValues(FXObject *obj, FXSelector, void *)
double getDefaultTAZSinkWeight() const
default TAZSink weight
double myDefaultTAZSinkWeight
default TAZSink weight
Definition: GNETAZFrame.h:304
void showTAZChildDefaultParametersModul()
show TAZ child default parameters Modul
TAZCommonStatistics(GNETAZFrame *TAZFrameParent)
constructor
FXLabel * myStatisticsLabel
Statistics labels.
Definition: GNETAZFrame.h:177
void hideTAZCommonStatisticsModul()
hide TAZ Common Statistics Modul
void showTAZCommonStatisticsModul()
show TAZ Common Statistics Modul
void updateStatistics()
update Statistics label
GNETAZFrame * myTAZFrameParent
pointer to TAZFrame parent
Definition: GNETAZFrame.h:174
void refreshTAZEdges()
refresh TAZEdges
void addTAZChild(GNETAZSourceSink *additional)
add TAZChild
void setTAZ(GNETAZ *editedTAZ)
set current TAZ
const std::vector< TAZCurrent::TAZEdge > & getTAZEdges() const
get TAZEdges
FXLabel * myTAZCurrentLabel
Label for current TAZ.
Definition: GNETAZFrame.h:134
const std::vector< GNEEdge * > & getNetEdges() const
get current net edges
double myMaxSourcePlusSinkWeight
maximum source plus sink value of current TAZ Edges
Definition: GNETAZFrame.h:137
bool isTAZEdge(GNEEdge *edge) const
check if given edge belongs to current TAZ
GNETAZ * getTAZ() const
get current TAZ
double myMinSourceMinusSinkWeight
minimum source minus sink value of current TAZ Edges
Definition: GNETAZFrame.h:146
std::vector< TAZEdge > myTAZEdges
vector with TAZ's edges
Definition: GNETAZFrame.h:131
GNETAZFrame * myTAZFrameParent
pointer to TAZ Frame
Definition: GNETAZFrame.h:119
std::vector< GNEEdge * > myNetEdges
vector with pointers to edges (it's used to avoid slowdowns during Source/Sinks manipulations)
Definition: GNETAZFrame.h:125
const std::vector< GNEEdge * > & getSelectedEdges() const
get current selected edges
double myMinSourcePlusSinkWeight
minimum source plus sink value of current TAZ Edges
Definition: GNETAZFrame.h:140
double myMaxSourceMinusSinkWeight
maximum source minus sink value of current TAZ Edges
Definition: GNETAZFrame.h:143
TAZCurrent(GNETAZFrame *TAZFrameParent)
constructor
GNETAZ * myEditedTAZ
current edited TAZ
Definition: GNETAZFrame.h:122
std::vector< GNEEdge * > mySelectedEdges
vector with pointers to selected edges
Definition: GNETAZFrame.h:128
FXRadioButton * myColorBySourcePlusSinkWeight
add radio button "color source + sink"
Definition: GNETAZFrame.h:487
RGBColor myEdgeSelectedColor
RGBColor color for selected egdes.
Definition: GNETAZFrame.h:496
FXRadioButton * myColorBySinkWeight
add radio button "color by sink"
Definition: GNETAZFrame.h:484
void updateEdgeColors()
update edge colors;
void showTAZEdgesGraphicModul()
show TAZ Edges Graphic Modul
FXRadioButton * myColorBySourceWeight
add radio button "color by source"
Definition: GNETAZFrame.h:481
FXRadioButton * myColorBySourceMinusSinkWeight
add radio button "color source - Sink"
Definition: GNETAZFrame.h:490
RGBColor myEdgeDefaultColor
default RGBColor for all edges
Definition: GNETAZFrame.h:493
void hideTAZEdgesGraphicModul()
hide TAZ Edges Graphic Modul
GNETAZFrame * myTAZFrameParent
pointer to TAZFrame parent
Definition: GNETAZFrame.h:478
long onCmdChoosenBy(FXObject *obj, FXSelector, void *)
TAZEdgesGraphic(GNETAZFrame *TAZFrameParent)
FOX-declaration.
std::map< SumoXMLAttr, std::string > getAttributesAndValues() const
get a map with attributes and their values
bool isAddEdgesWithinEnabled() const
check if edges within has to be used after TAZ Creation
void hideTAZParametersModul()
hide TAZ parameters
TAZParameters(GNETAZFrame *TAZFrameParent)
FOX-declaration.
FXButton * myHelpTAZAttribute
button for help
Definition: GNETAZFrame.h:440
FXCheckButton * myAddEdgesWithinCheckButton
CheckButton to enable or disable use edges within TAZ after creation.
Definition: GNETAZFrame.h:437
long onCmdSetAttribute(FXObject *, FXSelector, void *)
Called when user set a value.
long onCmdHelp(FXObject *, FXSelector, void *)
Called when help button is pressed.
long onCmdSetColorAttribute(FXObject *, FXSelector, void *)
GNETAZFrame * myTAZFrameParent
pointer to GNETAZFrame parent
Definition: GNETAZFrame.h:428
FXButton * myColorEditor
Button for open color editor.
Definition: GNETAZFrame.h:431
void showTAZParametersModul()
show TAZ parameters and set the default value of parameters
FXTextField * myTextFieldColor
textField to modify the default value of color parameter
Definition: GNETAZFrame.h:434
bool isCurrentParametersValid() const
check if current parameters are valid
bool isChangesPending() const
return true if there is changes to save
FXButton * mySaveChangesButton
@field FXButton for save changes in TAZEdges
Definition: GNETAZFrame.h:224
void hideTAZSaveChangesModul()
hide TAZ Save Changes Modul
GNETAZFrame * myTAZFrameParent
pointer to TAZFrame parent
Definition: GNETAZFrame.h:221
FXButton * myCancelChangesButton
@field FXButton for cancel changes in TAZEdges
Definition: GNETAZFrame.h:227
void showTAZSaveChangesModul()
show TAZ Save Changes Modul
long onCmdCancelChanges(FXObject *, FXSelector, void *)
Called when the user press the button cancel changes.
TAZSaveChanges(GNETAZFrame *TAZFrameParent)
FOX-declaration.
long onCmdSaveChanges(FXObject *, FXSelector, void *)
void enableButtonsAndBeginUndoList()
enable buttons save and cancel changes (And begin Undo List)
long onCmdSelectEdges(FXObject *obj, FXSelector, void *)
Called when the user press select edges.
TAZSelectionStatistics(GNETAZFrame *TAZFrameParent)
FOX-declaration.
FXHorizontalFrame * myTAZSourceFrame
Horizontal Frame for default TAZ Source Weight.
Definition: GNETAZFrame.h:363
const std::vector< TAZCurrent::TAZEdge > & getEdgeAndTAZChildrenSelected() const
get map with edge and TAZChildren
GNETAZFrame * myTAZFrameParent
pointer to TAZFrame parent
Definition: GNETAZFrame.h:360
bool isEdgeSelected(GNEEdge *edge)
check if an edge is selected
FXHorizontalFrame * myTAZSinkFrame
Horizontal Frame for default TAZ Sink Weight.
Definition: GNETAZFrame.h:369
std::vector< TAZCurrent::TAZEdge > myEdgeAndTAZChildrenSelected
vector with the current selected edges and their associated children
Definition: GNETAZFrame.h:378
long onCmdSetNewValues(FXObject *obj, FXSelector, void *)
bool selectEdge(const TAZCurrent::TAZEdge &edge)
add an edge and their TAZ Children in the list of selected items
void clearSelectedEdges()
clear current TAZ children
void showTAZSelectionStatisticsModul()
show TAZ Selection Statistics Modul
FXTextField * myTextFieldTAZSourceWeight
textField for TAZ Source weight
Definition: GNETAZFrame.h:366
void updateStatistics()
update TAZSelectionStatistics
void hideTAZSelectionStatisticsModul()
hide TAZ Selection Statistics Modul
FXTextField * myTextFieldTAZSinkWeight
textField for TAZ Sink weight
Definition: GNETAZFrame.h:372
bool unselectEdge(GNEEdge *edge)
un select an edge (and their TAZ Children)
FXLabel * myStatisticsLabel
Statistics labels.
Definition: GNETAZFrame.h:375
TAZSelectionStatistics * myTAZSelectionStatistics
TAZ Edges selection parameters.
Definition: GNETAZFrame.h:569
TAZEdgesGraphic * myTAZEdgesGraphic
TAZ Edges Graphic.
Definition: GNETAZFrame.h:572
TAZParameters * myTAZParameters
TAZ parameters.
Definition: GNETAZFrame.h:554
bool addOrRemoveTAZMember(GNEEdge *edge)
add or remove a TAZSource and a TAZSink, or remove it if edge is in the list of TAZ Children
void dropTAZMembers()
drop all TAZSources and TAZ Sinks of current TAZ
bool processClick(const Position &clickedPosition, const GNEViewNetHelper::ObjectsUnderCursor &objectsUnderCursor)
process click over Viewnet
TAZSelectionStatistics * getTAZSelectionStatisticsModul() const
get TAZ Selection Statistics modul
TAZCommonStatistics * myTAZCommonStatistics
TAZ Edges common parameters.
Definition: GNETAZFrame.h:551
TAZCurrent * myTAZCurrent
current TAZ
Definition: GNETAZFrame.h:548
bool shapeDrawed()
build a shaped element using the drawed shape return true if was sucesfully created
GNEFrameModuls::DrawingShape * myDrawingShape
Drawing shape.
Definition: GNETAZFrame.h:560
~GNETAZFrame()
Destructor.
TAZSaveChanges * myTAZSaveChanges
save TAZ Edges
Definition: GNETAZFrame.h:563
GNEFrameAttributesModuls::NeteditAttributes * myNeteditAttributes
Netedit parameter.
Definition: GNETAZFrame.h:557
GNEFrameModuls::DrawingShape * getDrawingShapeModul() const
get drawing mode modul
TAZCurrent * getTAZCurrentModul() const
get Current TAZ modul
GNETAZFrame(FXHorizontalFrame *horizontalFrameParent, GNEViewNet *viewNet)
Constructor.
void hide()
hide TAZ frame
void processEdgeSelection(const std::vector< GNEEdge * > &edges)
process selection of edges in view net
TAZSaveChanges * getTAZSaveChangesModul() const
get TAZ Save Changes modul
TAZChildDefaultParameters * myTAZChildDefaultParameters
TAZ child defaults parameters.
Definition: GNETAZFrame.h:566
Definition: GNETAZ.h:33
class used to group all variables related with objects under cursor after a click over view
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:36
struct for edges and the source/sink colors
Definition: GNETAZFrame.h:50
TAZCurrent * myTAZCurrentParent
pointer to TAZCurrentParent
Definition: GNETAZFrame.h:83
int sourceColor
color by source [0-9]
Definition: GNETAZFrame.h:70
int sourceMinusSinkColor
color by source - sink [0-9]
Definition: GNETAZFrame.h:79
int sinkColor
color by sink [0-9]
Definition: GNETAZFrame.h:73
int sourcePlusSinkColor
color by source + sink [0-9]
Definition: GNETAZFrame.h:76
TAZEdge(TAZCurrent *TAZCurrentParent, GNEEdge *_edge, GNETAZSourceSink *_TAZSource, GNETAZSourceSink *_TAZSink)
constructor
Definition: GNETAZFrame.cpp:80
void updateColors()
update colors
Definition: GNETAZFrame.cpp:96
GNETAZSourceSink * TAZSink
@brif sink TAZ
Definition: GNETAZFrame.h:67
~TAZEdge()
destructor (needed because RGBColors has to be deleted)
Definition: GNETAZFrame.cpp:92
GNETAZSourceSink * TAZSource
source TAZ
Definition: GNETAZFrame.h:64