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.dev/sumo
3 // Copyright (C) 2001-2024 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 #include <config.h>
22 
25 
26 
27 // ===========================================================================
28 // class definitions
29 // ===========================================================================
30 class GNETAZ;
31 class GNETAZSourceSink;
32 
33 
34 // ===========================================================================
35 // class definitions
36 // ===========================================================================
41 class GNETAZFrame : public GNEFrame {
42 
43 public:
44  // ===========================================================================
45  // class CurrentTAZ
46  // ===========================================================================
47 
48  class CurrentTAZ : public MFXGroupBoxModule {
49 
50  public:
52  class TAZEdgeColor {
53 
54  public:
56  TAZEdgeColor(CurrentTAZ* CurrentTAZParent, GNEEdge* _edge, GNETAZSourceSink* _source, GNETAZSourceSink* _sink);
57 
59  ~TAZEdgeColor();
60 
62  void updateColors();
63 
66 
69 
72 
75 
77  int sinkColor;
78 
81 
84 
85  private:
88 
90  TAZEdgeColor();
91  };
92 
94  CurrentTAZ(GNETAZFrame* TAZFrameParent);
95 
97  ~CurrentTAZ();
98 
100  void setTAZ(GNETAZ* editedTAZ);
101 
103  GNETAZ* getTAZ() const;
104 
106  bool isTAZEdge(GNEEdge* edge) const;
107 
109  const std::vector<GNEEdge*>& getSelectedEdges() const;
110 
112  const std::vector<CurrentTAZ::TAZEdgeColor>& getTAZEdges() const;
113 
115  void refreshTAZEdges();
116 
117  protected:
119  void addTAZChild(GNETAZSourceSink* additional);
120 
121  private:
124 
127 
129  std::vector<GNEEdge*> mySelectedEdges;
130 
132  std::vector<TAZEdgeColor> myTAZEdgeColors;
133 
136 
139 
142 
145 
148  };
149 
150  // ===========================================================================
151  // class TAZCommonStatistics
152  // ===========================================================================
153 
155 
156  public:
158  TAZCommonStatistics(GNETAZFrame* TAZFrameParent);
159 
162 
165 
168 
170  void updateStatistics();
171 
172  private:
175 
178  };
179 
180  // ===========================================================================
181  // class TAZSaveChanges
182  // ===========================================================================
183 
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 
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*);
270 
272  long onCmdSetZeroFringeProbabilities(FXObject* obj, FXSelector, void*);
274 
275  protected:
277  FOX_CONSTRUCTOR(TAZChildDefaultParameters)
278 
279  private:
282 
284  FXCheckButton* myToggleMembership;
285 
287  FXHorizontalFrame* myToggleMembershipFrame;
288 
290  FXHorizontalFrame* myDefaultTAZSourceFrame;
291 
294 
296  FXHorizontalFrame* myDefaultTAZSinkFrame;
297 
300 
303 
306 
309 
312 
315  };
316 
317  // ===========================================================================
318  // class TAZSelectionStatistics
319  // ===========================================================================
320 
324 
325  public:
327  TAZSelectionStatistics(GNETAZFrame* TAZFrameParent);
328 
331 
334 
337 
339  bool selectEdge(const CurrentTAZ::TAZEdgeColor& edge);
340 
342  bool unselectEdge(GNEEdge* edge);
343 
345  bool isEdgeSelected(GNEEdge* edge);
346 
348  void clearSelectedEdges();
349 
351  const std::vector<CurrentTAZ::TAZEdgeColor>& getEdgeAndTAZChildrenSelected() const;
352 
356  long onCmdSetNewValues(FXObject* obj, FXSelector, void*);
357 
359  long onCmdSelectEdges(FXObject* obj, FXSelector, void*);
361 
362  protected:
363  FOX_CONSTRUCTOR(TAZSelectionStatistics)
364 
365 
366  void updateStatistics();
367 
368  private:
371 
373  FXHorizontalFrame* myTAZSourceFrame;
374 
377 
379  FXHorizontalFrame* myTAZSinkFrame;
380 
383 
386 
388  std::vector<CurrentTAZ::TAZEdgeColor> myEdgeAndTAZChildrenSelected;
389  };
390 
391  // ===========================================================================
392  // class TAZParameters
393  // ===========================================================================
394 
397  FXDECLARE(GNETAZFrame::TAZParameters)
398 
399  public:
401  TAZParameters(GNETAZFrame* TAZFrameParent);
402 
404  ~TAZParameters();
405 
408 
411 
413  bool isCurrentParametersValid() const;
414 
416  bool isAddEdgesWithinEnabled() const;
417 
419  void getAttributesAndValues() const;
420 
424  long onCmdSetColorAttribute(FXObject*, FXSelector, void*);
425 
427  long onCmdSetAttribute(FXObject*, FXSelector, void*);
428 
430  long onCmdHelp(FXObject*, FXSelector, void*);
432 
433  protected:
434  FOX_CONSTRUCTOR(TAZParameters)
435 
436  private:
439 
442 
444  FXButton* myColorEditor;
445 
447  FXTextField* myTextFieldCenter;
448 
450  FXCheckButton* myCheckButtonFill;
451 
453  FXTextField* myTextFieldColor;
454 
456  FXTextField* myTextFieldName;
457 
460 
463  };
464 
465  // ===========================================================================
466  // class TAZEdgesGraphic
467  // ===========================================================================
468 
472 
473  public:
475  TAZEdgesGraphic(GNETAZFrame* TAZFrameParent);
476 
479 
482 
485 
487  void updateEdgeColors();
488 
492  long onCmdChoosenBy(FXObject* obj, FXSelector, void*);
494 
495  protected:
496  FOX_CONSTRUCTOR(TAZEdgesGraphic)
497 
498  private:
501 
503  FXRadioButton* myColorBySourceWeight;
504 
506  FXRadioButton* myColorBySinkWeight;
507 
510 
513 
516 
519  };
520 
525  GNETAZFrame(GNEViewParent* viewParent, GNEViewNet* viewNet);
526 
528  ~GNETAZFrame();
529 
531  void hide();
532 
538  bool processClick(const Position& clickedPosition, const GNEViewNetHelper::ViewObjectsSelector& viewObjects);
539 
541  void processEdgeSelection(const std::vector<GNEEdge*>& edges);
542 
545 
548 
551 
554 
555 protected:
558 
563  bool shapeDrawed();
564 
566  bool addOrRemoveTAZMember(GNEEdge* edge);
567 
569  void dropTAZMembers();
570 
571 private:
574 
577 
580 
583 
586 
589 
592 
595 };
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:53
struct for edges and the source/sink colors
Definition: GNETAZFrame.h:52
int sourcePlusSinkColor
color by source + sink [0-9]
Definition: GNETAZFrame.h:80
GNETAZSourceSink * sink
@brif sink TAZ
Definition: GNETAZFrame.h:71
GNETAZSourceSink * source
source TAZ
Definition: GNETAZFrame.h:68
~TAZEdgeColor()
destructor (needed because RGBColors has to be deleted)
Definition: GNETAZFrame.cpp:94
int sourceMinusSinkColor
color by source - sink [0-9]
Definition: GNETAZFrame.h:83
CurrentTAZ * myCurrentTAZParent
pointer to CurrentTAZParent
Definition: GNETAZFrame.h:87
int sourceColor
color by source [0-9]
Definition: GNETAZFrame.h:74
int sinkColor
color by sink [0-9]
Definition: GNETAZFrame.h:77
void refreshTAZEdges()
refresh TAZEdges
double myMinSourceMinusSinkWeight
minimum source minus sink value of current TAZ Edges
Definition: GNETAZFrame.h:147
std::vector< GNEEdge * > mySelectedEdges
vector with pointers to selected edges
Definition: GNETAZFrame.h:129
bool isTAZEdge(GNEEdge *edge) const
check if given edge belongs to current TAZ
GNETAZFrame * myTAZFrameParent
pointer to TAZ Frame
Definition: GNETAZFrame.h:123
GNETAZ * myEditedTAZ
current edited TAZ
Definition: GNETAZFrame.h:126
const std::vector< CurrentTAZ::TAZEdgeColor > & getTAZEdges() const
get TAZEdges
void setTAZ(GNETAZ *editedTAZ)
set current TAZ
void addTAZChild(GNETAZSourceSink *additional)
add TAZChild
const std::vector< GNEEdge * > & getSelectedEdges() const
get current selected edges
std::vector< TAZEdgeColor > myTAZEdgeColors
vector with TAZ's edges
Definition: GNETAZFrame.h:132
double myMaxSourceMinusSinkWeight
maximum source minus sink value of current TAZ Edges
Definition: GNETAZFrame.h:144
FXLabel * myCurrentTAZLabel
Label for current TAZ.
Definition: GNETAZFrame.h:135
CurrentTAZ(GNETAZFrame *TAZFrameParent)
constructor
double myMaxSourcePlusSinkWeight
maximum source plus sink value of current TAZ Edges
Definition: GNETAZFrame.h:138
double myMinSourcePlusSinkWeight
minimum source plus sink value of current TAZ Edges
Definition: GNETAZFrame.h:141
GNETAZ * getTAZ() const
get current TAZ
bool getToggleMembership() const
check if toggle membership is enabled
FXButton * myUseSelectedEdges
button for use selected edges
Definition: GNETAZFrame.h:302
TAZChildDefaultParameters(GNETAZFrame *TAZFrameParent)
FOX-declaration.
FXCheckButton * myToggleMembership
CheckButton to enable or disable Toggle edge Membership.
Definition: GNETAZFrame.h:284
void collapseTAZChildDefaultParameters()
collapse TAZ child default parameters Module (if we have selected a TAZ)
FXTextField * myTextFieldDefaultValueTAZSources
textField to set a default value for TAZ Sources
Definition: GNETAZFrame.h:293
long onCmdUseSelectedEdges(FXObject *obj, FXSelector, void *)
Called when the user press "use selected edges" button.
void updateSelectEdgesButton()
update "select edges button"
double getDefaultTAZSourceWeight() const
get default source weight
void extendTAZChildDefaultParameters()
extend TAZ child default parameters Module (if we have selected a TAZ)
FXLabel * myInformationLabel
information label
Definition: GNETAZFrame.h:308
FXHorizontalFrame * myDefaultTAZSinkFrame
Horizontal Frame for default TAZ Sink Weight.
Definition: GNETAZFrame.h:296
FXHorizontalFrame * myDefaultTAZSourceFrame
Horizontal Frame for default TAZ Source Weight.
Definition: GNETAZFrame.h:290
FXHorizontalFrame * myToggleMembershipFrame
Horizontal Frame toggle membership.
Definition: GNETAZFrame.h:287
GNETAZFrame * myTAZFrameParent
FOX need this.
Definition: GNETAZFrame.h:281
long onCmdSetZeroFringeProbabilities(FXObject *obj, FXSelector, void *)
Called when the user press "zero fringe probabilities" button.
double myDefaultTAZSourceWeight
default source weight
Definition: GNETAZFrame.h:311
FXTextField * myTextFieldDefaultValueTAZSinks
textField to set a default value for TAZ Sinks
Definition: GNETAZFrame.h:299
long onCmdSetDefaultValues(FXObject *obj, FXSelector, void *)
double getDefaultTAZSinkWeight() const
default sink weight
double myDefaultTAZSinkWeight
default sink weight
Definition: GNETAZFrame.h:314
FXButton * myZeroFringeProbabilities
button for setting zero fringe probabilities
Definition: GNETAZFrame.h:305
void showTAZCommonStatisticsModule()
show TAZ Common Statistics Module
TAZCommonStatistics(GNETAZFrame *TAZFrameParent)
constructor
FXLabel * myStatisticsLabel
Statistics labels.
Definition: GNETAZFrame.h:177
void hideTAZCommonStatisticsModule()
hide TAZ Common Statistics Module
void updateStatistics()
update Statistics label
GNETAZFrame * myTAZFrameParent
pointer to TAZFrame parent
Definition: GNETAZFrame.h:174
FXRadioButton * myColorBySourcePlusSinkWeight
add radio button "color source + sink"
Definition: GNETAZFrame.h:509
RGBColor myEdgeSelectedColor
RGBColor color for selected egdes.
Definition: GNETAZFrame.h:518
FXRadioButton * myColorBySinkWeight
add radio button "color by sink"
Definition: GNETAZFrame.h:506
void showTAZEdgesGraphicModule()
show TAZ Edges Graphic Module
void updateEdgeColors()
update edge colors;
FXRadioButton * myColorBySourceWeight
add radio button "color by source"
Definition: GNETAZFrame.h:503
FXRadioButton * myColorBySourceMinusSinkWeight
add radio button "color source - Sink"
Definition: GNETAZFrame.h:512
RGBColor myEdgeDefaultColor
default RGBColor for all edges
Definition: GNETAZFrame.h:515
GNETAZFrame * myTAZFrameParent
pointer to TAZFrame parent
Definition: GNETAZFrame.h:500
long onCmdChoosenBy(FXObject *obj, FXSelector, void *)
void hideTAZEdgesGraphicModule()
hide TAZ Edges Graphic Module
TAZEdgesGraphic(GNETAZFrame *TAZFrameParent)
FOX-declaration.
FXTextField * myTextFieldName
textField to modify the default value of name parameter
Definition: GNETAZFrame.h:456
void 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 showTAZParametersModule()
show TAZ parameters and set the default value of parameters
TAZParameters(GNETAZFrame *TAZFrameParent)
FOX-declaration.
FXButton * myHelpTAZAttribute
button for help
Definition: GNETAZFrame.h:462
FXCheckButton * myAddEdgesWithinCheckButton
CheckButton to enable or disable use edges within TAZ after creation.
Definition: GNETAZFrame.h:459
long onCmdSetAttribute(FXObject *, FXSelector, void *)
Called when user set a value.
long onCmdHelp(FXObject *, FXSelector, void *)
Called when help button is pressed.
void hideTAZParametersModule()
hide TAZ parameters
long onCmdSetColorAttribute(FXObject *, FXSelector, void *)
GNETAZFrame * myTAZFrameParent
pointer to GNETAZFrame parent
Definition: GNETAZFrame.h:438
FXButton * myColorEditor
Button for open color editor.
Definition: GNETAZFrame.h:444
FXTextField * myTextFieldCenter
text field center
Definition: GNETAZFrame.h:447
FXTextField * myTextFieldColor
textField to modify the default value of color parameter
Definition: GNETAZFrame.h:453
FXCheckButton * myCheckButtonFill
CheckButton to enable or disable fill.
Definition: GNETAZFrame.h:450
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 showTAZSaveChangesModule()
show TAZ Save Changes Module
GNETAZFrame * myTAZFrameParent
pointer to TAZFrame parent
Definition: GNETAZFrame.h:221
FXButton * myCancelChangesButton
@field FXButton for cancel changes in TAZEdges
Definition: GNETAZFrame.h:227
long onCmdCancelChanges(FXObject *, FXSelector, void *)
Called when the user press the button cancel changes.
TAZSaveChanges(GNETAZFrame *TAZFrameParent)
FOX-declaration.
void hideTAZSaveChangesModule()
hide TAZ Save Changes Module
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:373
std::vector< CurrentTAZ::TAZEdgeColor > myEdgeAndTAZChildrenSelected
vector with the current selected edges and their associated children
Definition: GNETAZFrame.h:388
void hideTAZSelectionStatisticsModule()
hide TAZ Selection Statistics Module
GNETAZFrame * myTAZFrameParent
pointer to TAZFrame parent
Definition: GNETAZFrame.h:370
bool isEdgeSelected(GNEEdge *edge)
check if an edge is selected
FXHorizontalFrame * myTAZSinkFrame
Horizontal Frame for default TAZ Sink Weight.
Definition: GNETAZFrame.h:379
const std::vector< CurrentTAZ::TAZEdgeColor > & getEdgeAndTAZChildrenSelected() const
get map with edge and TAZChildren
void showTAZSelectionStatisticsModule()
show TAZ Selection Statistics Module
long onCmdSetNewValues(FXObject *obj, FXSelector, void *)
void clearSelectedEdges()
clear current TAZ children
FXTextField * myTextFieldTAZSourceWeight
textField for TAZ Source weight
Definition: GNETAZFrame.h:376
void updateStatistics()
update TAZSelectionStatistics
FXTextField * myTextFieldTAZSinkWeight
textField for TAZ Sink weight
Definition: GNETAZFrame.h:382
bool selectEdge(const CurrentTAZ::TAZEdgeColor &edge)
add an edge and their TAZ Children in the list of selected items
bool unselectEdge(GNEEdge *edge)
un select an edge (and their TAZ Children)
FXLabel * myStatisticsLabel
Statistics labels.
Definition: GNETAZFrame.h:385
TAZSelectionStatistics * myTAZSelectionStatistics
TAZ Edges selection parameters.
Definition: GNETAZFrame.h:591
TAZSelectionStatistics * getTAZSelectionStatisticsModule() const
get TAZ Selection Statistics modul
TAZSaveChanges * getTAZSaveChangesModule() const
get TAZ Save Changes modul
CurrentTAZ * myCurrentTAZ
current TAZ
Definition: GNETAZFrame.h:573
TAZEdgesGraphic * myTAZEdgesGraphic
TAZ Edges Graphic.
Definition: GNETAZFrame.h:594
TAZParameters * myTAZParameters
TAZ parameters.
Definition: GNETAZFrame.h:579
bool addOrRemoveTAZMember(GNEEdge *edge)
add or remove a source and a sink, or remove it if edge is in the list of TAZ Children
void dropTAZMembers()
drop all TAZSources and TAZ Sinks of current TAZ
GNEDrawingShape * getDrawingShapeModule() const
get drawing mode modul
CurrentTAZ * getCurrentTAZModule() const
get Current TAZ modul
TAZCommonStatistics * myTAZCommonStatistics
TAZ Edges common parameters.
Definition: GNETAZFrame.h:576
GNEDrawingShape * myDrawingShape
Drawing shape.
Definition: GNETAZFrame.h:582
bool shapeDrawed()
build a shaped element using the drawed shape return true if was successfully created
~GNETAZFrame()
Destructor.
TAZSaveChanges * myTAZSaveChanges
save TAZ Edges
Definition: GNETAZFrame.h:585
CommonXMLStructure::SumoBaseObject * myBaseTAZ
SumoBaseObject used for creating TAZ.
Definition: GNETAZFrame.h:557
void hide()
hide TAZ frame
void processEdgeSelection(const std::vector< GNEEdge * > &edges)
process selection of edges in view net
bool processClick(const Position &clickedPosition, const GNEViewNetHelper::ViewObjectsSelector &viewObjects)
process click over Viewnet
TAZChildDefaultParameters * myTAZChildDefaultParameters
TAZ child defaults parameters.
Definition: GNETAZFrame.h:588
GNETAZFrame(GNEViewParent *viewParent, GNEViewNet *viewNet)
Constructor.
Definition: GNETAZ.h:34
class used to group all variables related with objects under cursor after a click over view
A single child window which contains a view of the simulation area.
Definition: GNEViewParent.h:88
MFXGroupBoxModule (based on FXGroupBox)
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37