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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // The Widget for add TAZ elements
16 /****************************************************************************/
17 #ifndef GNETAZFrame_h
18 #define GNETAZFrame_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include "GNEFrame.h"
25 
26 // ===========================================================================
27 // class definitions
28 // ===========================================================================
29 
30 class GNETAZSourceSink;
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 
163  void showTAZCommonStatisticsModul();
164 
166  void hideTAZCommonStatisticsModul();
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 
196  void showTAZSaveChangesModul();
197 
199  void hideTAZSaveChangesModul();
200 
202  void enableButtonsAndBeginUndoList();
203 
205  bool isChangesPending() const;
206 
210  long onCmdSaveChanges(FXObject*, FXSelector, void*);
211 
213  long onCmdCancelChanges(FXObject*, FXSelector, void*);
215 
216  protected:
219 
220  private:
223 
226 
229  };
230 
231  // ===========================================================================
232  // class TAZChildDefaultParameters
233  // ===========================================================================
234 
235  class TAZChildDefaultParameters : protected FXGroupBox {
238 
239  public:
241  TAZChildDefaultParameters(GNETAZFrame* TAZFrameParent);
242 
245 
247  void showTAZChildDefaultParametersModul();
248 
250  void hideTAZChildDefaultParametersModul();
251 
253  void updateSelectEdgesButton();
254 
256  double getDefaultTAZSourceWeight() const;
257 
259  double getDefaultTAZSinkWeight() const;
260 
262  bool getToggleMembership() const;
263 
267  long onCmdSetDefaultValues(FXObject* obj, FXSelector, void*);
268 
270  long onCmdUseSelectedEdges(FXObject* obj, FXSelector, void*);
272 
273  protected:
276 
277  private:
280 
282  FXCheckButton* myToggleMembership;
283 
285  FXHorizontalFrame* myDefaultTAZSourceFrame;
286 
289 
291  FXHorizontalFrame* myDefaultTAZSinkFrame;
292 
295 
298 
301 
304 
307  };
308 
309  // ===========================================================================
310  // class TAZSelectionStatistics
311  // ===========================================================================
312 
313  class TAZSelectionStatistics : protected FXGroupBox {
316 
317  public:
319  TAZSelectionStatistics(GNETAZFrame* TAZFrameParent);
320 
323 
325  void showTAZSelectionStatisticsModul();
326 
328  void hideTAZSelectionStatisticsModul();
329 
331  bool selectEdge(const TAZCurrent::TAZEdge& edge);
332 
334  bool unselectEdge(GNEEdge* edge);
335 
337  bool isEdgeSelected(GNEEdge* edge);
338 
340  void clearSelectedEdges();
341 
343  const std::vector<TAZCurrent::TAZEdge>& getEdgeAndTAZChildrenSelected() const;
344 
348  long onCmdSetNewValues(FXObject* obj, FXSelector, void*);
349 
351  long onCmdSelectEdges(FXObject* obj, FXSelector, void*);
353 
354  protected:
357 
359  void updateStatistics();
360 
361  private:
364 
366  FXHorizontalFrame* myTAZSourceFrame;
367 
370 
372  FXHorizontalFrame* myTAZSinkFrame;
373 
376 
379 
381  std::vector<TAZCurrent::TAZEdge> myEdgeAndTAZChildrenSelected;
382  };
383 
384  // ===========================================================================
385  // class TAZParameters
386  // ===========================================================================
387 
388  class TAZParameters : protected FXGroupBox {
390  FXDECLARE(GNETAZFrame::TAZParameters)
391 
392  public:
394  TAZParameters(GNETAZFrame* TAZFrameParent);
395 
397  ~TAZParameters();
398 
400  void showTAZParametersModul();
401 
403  void hideTAZParametersModul();
404 
406  bool isCurrentParametersValid() const;
407 
409  bool isAddEdgesWithinEnabled() const;
410 
412  std::map<SumoXMLAttr, std::string> getAttributesAndValues() const;
413 
417  long onCmdSetColorAttribute(FXObject*, FXSelector, void*);
418 
420  long onCmdSetAttribute(FXObject*, FXSelector, void*);
421 
423  long onCmdHelp(FXObject*, FXSelector, void*);
425 
426  protected:
429 
430  private:
433 
435  FXButton* myColorEditor;
436 
438  FXTextField* myTextFieldColor;
439 
442 
445  };
446 
447  // ===========================================================================
448  // class TAZEdgesGraphic
449  // ===========================================================================
450 
451  class TAZEdgesGraphic : protected FXGroupBox {
454 
455  public:
457  TAZEdgesGraphic(GNETAZFrame* TAZFrameParent);
458 
460  ~TAZEdgesGraphic();
461 
463  void showTAZEdgesGraphicModul();
464 
466  void hideTAZEdgesGraphicModul();
467 
469  void updateEdgeColors();
470 
474  long onCmdChoosenBy(FXObject* obj, FXSelector, void*);
476 
477  protected:
480 
481  private:
484 
486  FXRadioButton* myColorBySourceWeight;
487 
489  FXRadioButton* myColorBySinkWeight;
490 
493 
496 
498  std::vector<RGBColor> myScaleColors;
499 
502 
505  };
506 
511  GNETAZFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet);
512 
514  ~GNETAZFrame();
515 
517  void hide();
518 
524  bool processClick(const Position& clickedPosition, const GNEViewNetHelper::ObjectsUnderCursor& objectsUnderCursor);
525 
527  void processEdgeSelection(const std::vector<GNEEdge*>& edges);
528 
531 
534 
537 
540 
541 protected:
546  bool shapeDrawed();
547 
550 
552  void dropTAZMembers();
553 
554 private:
557 
560 
563 
566 
569 
572 
575 
578 
581 };
582 
583 
584 #endif
585 
586 /****************************************************************************/
double myMaxSourceMinusSinkWeight
maximum source minus sink value of current TAZ Edges
Definition: GNETAZFrame.h:143
TAZSelectionStatistics * getTAZSelectionStatisticsModul() const
get TAZ Selection Statistics modul
TAZParameters * myTAZParameters
TAZ parameters.
Definition: GNETAZFrame.h:562
GNETAZ * getTAZ() const
get current TAZ
TAZChildDefaultParameters * myTAZChildDefaultParameters
TAZ child defaults parameters.
Definition: GNETAZFrame.h:574
void hide()
hide TAZ frame
FXTextField * myTextFieldTAZSinkWeight
textField for TAZ Sink weight
Definition: GNETAZFrame.h:375
struct for edges and the source/sink colors
Definition: GNETAZFrame.h:50
TAZEdgesGraphic()
FOX needs this.
Definition: GNETAZFrame.h:479
FXHorizontalFrame * myTAZSinkFrame
Horizontal Frame for default TAZ Sink Weight.
Definition: GNETAZFrame.h:372
FXButton * myCancelChangesButton
FXButton for cancel changes in TAZEdges
Definition: GNETAZFrame.h:228
FXLabel * myStatisticsLabel
Statistics labels.
Definition: GNETAZFrame.h:177
FXRadioButton * myColorBySourceMinusSinkWeight
add radio button "color source - Sink"
Definition: GNETAZFrame.h:495
FXHorizontalFrame * myTAZSourceFrame
Horizontal Frame for default TAZ Source Weight.
Definition: GNETAZFrame.h:366
TAZEdgesGraphic * myTAZEdgesGraphic
TAZ Edges Graphic.
Definition: GNETAZFrame.h:580
GNEFrameModuls::DrawingShape * getDrawingShapeModul() const
get drawing mode modul
GNETAZSourceSink * TAZSink
sink TAZ
Definition: GNETAZFrame.h:67
TAZSelectionStatistics()
FOX needs this.
Definition: GNETAZFrame.h:356
std::vector< RGBColor > myScaleColors
vector wit the scale colors
Definition: GNETAZFrame.h:498
TAZCurrent * getTAZCurrentModul() const
get Current TAZ modul
~GNETAZFrame()
Destructor.
void processEdgeSelection(const std::vector< GNEEdge *> &edges)
process selection of edges in view net
int sourceColor
color by source [0-9]
Definition: GNETAZFrame.h:70
void addTAZChild(GNETAZSourceSink *additional)
add TAZChild
FXButton * myUseSelectedEdges
button for use selected edges
Definition: GNETAZFrame.h:297
FXCheckButton * myToggleMembership
CheckButton to enable or disable Toggle edge Membership.
Definition: GNETAZFrame.h:282
bool shapeDrawed()
build a shaped element using the drawed shape return true if was sucesfully created ...
FXTextField * myTextFieldColor
textField to modify the default value of color parameter
Definition: GNETAZFrame.h:438
double myDefaultTAZSinkWeight
default TAZSink weight
Definition: GNETAZFrame.h:306
TAZChildDefaultParameters()
FOX needs this.
Definition: GNETAZFrame.h:275
GNETAZFrame * myTAZFrameParent
pointer to GNETAZFrame parent
Definition: GNETAZFrame.h:432
const std::vector< GNEEdge * > & getSelectedEdges() const
get current selected edges
FXLabel * myStatisticsLabel
Statistics labels.
Definition: GNETAZFrame.h:378
int sourceMinusSinkColor
color by source - sink [0-9]
Definition: GNETAZFrame.h:79
bool addOrRemoveTAZMember(GNEEdge *edge)
add or remove a TAZSource and a TAZSink, or remove it if edge is in the list of TAZ Children ...
double myMinSourceMinusSinkWeight
minimum source minus sink value of current TAZ Edges
Definition: GNETAZFrame.h:146
std::vector< TAZEdge > myTAZEdges
vector with TAZ&#39;s edges
Definition: GNETAZFrame.h:131
double myMinSourcePlusSinkWeight
minimum source plus sink value of current TAZ Edges
Definition: GNETAZFrame.h:140
double myMaxSourcePlusSinkWeight
maximum source plus sink value of current TAZ Edges
Definition: GNETAZFrame.h:137
RGBColor myEdgeDefaultColor
default RGBColor for all edges
Definition: GNETAZFrame.h:501
void dropTAZMembers()
drop all TAZSources and TAZ Sinks of current TAZ
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
GNETAZFrame * myTAZFrameParent
pointer to TAZFrame parent
Definition: GNETAZFrame.h:279
FXButton * myColorEditor
Button for open color editor.
Definition: GNETAZFrame.h:435
GNETAZFrame * myTAZFrameParent
pointer to TAZ Frame
Definition: GNETAZFrame.h:119
int sourcePlusSinkColor
color by source + sink [0-9]
Definition: GNETAZFrame.h:76
TAZSelectionStatistics * myTAZSelectionStatistics
TAZ Edges selection parameters.
Definition: GNETAZFrame.h:577
TAZCurrent * myTAZCurrentParent
pointer to TAZCurrentParent
Definition: GNETAZFrame.h:83
TAZSaveChanges()
FOX needs this.
Definition: GNETAZFrame.h:218
FXRadioButton * myColorBySourceWeight
add radio button "color by source"
Definition: GNETAZFrame.h:486
const std::vector< GNEEdge * > & getNetEdges() const
get current net edges
class used to group all variables related with objects under cursor after a click over view ...
GNETAZFrame * myTAZFrameParent
pointer to TAZFrame parent
Definition: GNETAZFrame.h:174
Definition: GNETAZ.h:35
GNEEdge * edge
TAZ edge.
Definition: GNETAZFrame.h:61
FXHorizontalFrame * myDefaultTAZSourceFrame
Horizontal Frame for default TAZ Source Weight.
Definition: GNETAZFrame.h:285
void refreshTAZEdges()
refresh TAZEdges
FXCheckButton * myAddEdgesWithinCheckButton
CheckButton to enable or disable use edges within TAZ after creation.
Definition: GNETAZFrame.h:441
GNETAZFrame * myTAZFrameParent
pointer to TAZFrame parent
Definition: GNETAZFrame.h:483
FXTextField * myTextFieldDefaultValueTAZSources
textField to set a default value for TAZ Sources
Definition: GNETAZFrame.h:288
TAZSaveChanges * myTAZSaveChanges
save TAZ Edges
Definition: GNETAZFrame.h:571
TAZEdge(TAZCurrent *TAZCurrentParent, GNEEdge *_edge, GNETAZSourceSink *_TAZSource, GNETAZSourceSink *_TAZSink)
constructor
Definition: GNETAZFrame.cpp:83
bool isTAZEdge(GNEEdge *edge) const
check if given edge belongs to current TAZ
int sinkColor
color by sink [0-9]
Definition: GNETAZFrame.h:73
FXButton * myHelpTAZAttribute
button for help
Definition: GNETAZFrame.h:444
GNETAZFrame * myTAZFrameParent
pointer to TAZFrame parent
Definition: GNETAZFrame.h:222
GNEFrameModuls::DrawingShape * myDrawingShape
Drawing shape.
Definition: GNETAZFrame.h:568
const std::vector< TAZCurrent::TAZEdge > & getTAZEdges() const
get TAZEdges
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:50
FXHorizontalFrame * myDefaultTAZSinkFrame
Horizontal Frame for default TAZ Sink Weight.
Definition: GNETAZFrame.h:291
~TAZEdge()
destructor (needed because RGBColors has to be deleted)
Definition: GNETAZFrame.cpp:95
void setTAZ(GNETAZ *editedTAZ)
set current TAZ
double myDefaultTAZSourceWeight
default TAZSource weight
Definition: GNETAZFrame.h:303
GNETAZFrame(FXHorizontalFrame *horizontalFrameParent, GNEViewNet *viewNet)
Constructor.
RGBColor myEdgeSelectedColor
RGBColor color for selected egdes.
Definition: GNETAZFrame.h:504
FXLabel * myInformationLabel
information label
Definition: GNETAZFrame.h:300
std::vector< TAZCurrent::TAZEdge > myEdgeAndTAZChildrenSelected
vector with the current selected edges and their associated children
Definition: GNETAZFrame.h:381
GNETAZSourceSink * TAZSource
source TAZ
Definition: GNETAZFrame.h:64
TAZCurrent * myTAZCurrent
current TAZ
Definition: GNETAZFrame.h:556
FXTextField * myTextFieldTAZSourceWeight
textField for TAZ Source weight
Definition: GNETAZFrame.h:369
TAZSaveChanges * getTAZSaveChangesModul() const
get TAZ Save Changes modul
FXRadioButton * myColorBySourcePlusSinkWeight
add radio button "color source + sink"
Definition: GNETAZFrame.h:492
TAZCurrent(GNETAZFrame *TAZFrameParent)
constructor
TAZParameters()
FOX needs this.
Definition: GNETAZFrame.h:428
GNETAZ * myEditedTAZ
current edited TAZ
Definition: GNETAZFrame.h:122
FXButton * mySaveChangesButton
FXButton for save changes in TAZEdges
Definition: GNETAZFrame.h:225
void updateColors()
update colors
Definition: GNETAZFrame.cpp:99
FXRadioButton * myColorBySinkWeight
add radio button "color by sink"
Definition: GNETAZFrame.h:489
std::vector< GNEEdge * > mySelectedEdges
vector with pointers to selected edges
Definition: GNETAZFrame.h:128
FXLabel * myTAZCurrentLabel
Label for current TAZ.
Definition: GNETAZFrame.h:134
GNETAZFrame * myTAZFrameParent
pointer to TAZFrame parent
Definition: GNETAZFrame.h:363
TAZCommonStatistics * myTAZCommonStatistics
TAZ Edges common parameters.
Definition: GNETAZFrame.h:559
GNEFrameAttributesModuls::NeteditAttributes * myNeteditAttributes
Netedit parameter.
Definition: GNETAZFrame.h:565
FXTextField * myTextFieldDefaultValueTAZSinks
textField to set a default value for TAZ Sinks
Definition: GNETAZFrame.h:294
std::vector< GNEEdge * > myNetEdges
vector with pointers to edges (it&#39;s used to avoid slowdowns during Source/Sinks manipulations) ...
Definition: GNETAZFrame.h:125
bool processClick(const Position &clickedPosition, const GNEViewNetHelper::ObjectsUnderCursor &objectsUnderCursor)
process click over Viewnet