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-2022 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 
24 
25 
26 // ===========================================================================
27 // class definitions
28 // ===========================================================================
29 class GNETAZ;
30 class GNETAZSourceSink;
31 
32 
33 // ===========================================================================
34 // class definitions
35 // ===========================================================================
40 class GNETAZFrame : public GNEFrame {
41 
42 public:
43  // ===========================================================================
44  // class CurrentTAZ
45  // ===========================================================================
46 
47  class CurrentTAZ : public FXGroupBoxModule {
48 
49  public:
51  class TAZEdgeColor {
52 
53  public:
55  TAZEdgeColor(CurrentTAZ* CurrentTAZParent, GNEEdge* _edge, GNETAZSourceSink* _source, GNETAZSourceSink* _sink);
56 
58  ~TAZEdgeColor();
59 
61  void updateColors();
62 
65 
68 
71 
74 
76  int sinkColor;
77 
80 
83 
84  private:
87 
89  TAZEdgeColor();
90  };
91 
93  CurrentTAZ(GNETAZFrame* TAZFrameParent);
94 
96  ~CurrentTAZ();
97 
99  void setTAZ(GNETAZ* editedTAZ);
100 
102  GNETAZ* getTAZ() const;
103 
105  bool isTAZEdge(GNEEdge* edge) const;
106 
108  const std::vector<GNEEdge*>& getSelectedEdges() const;
109 
111  const std::vector<CurrentTAZ::TAZEdgeColor>& getTAZEdges() const;
112 
114  void refreshTAZEdges();
115 
116  protected:
118  void addTAZChild(GNETAZSourceSink* additional);
119 
120  private:
123 
126 
128  std::vector<GNEEdge*> mySelectedEdges;
129 
131  std::vector<TAZEdgeColor> myTAZEdgeColors;
132 
135 
138 
141 
144 
147  };
148 
149  // ===========================================================================
150  // class TAZCommonStatistics
151  // ===========================================================================
152 
154 
155  public:
157  TAZCommonStatistics(GNETAZFrame* TAZFrameParent);
158 
161 
164 
167 
169  void updateStatistics();
170 
171  private:
174 
177  };
178 
179  // ===========================================================================
180  // class TAZSaveChanges
181  // ===========================================================================
182 
185  FXDECLARE(GNETAZFrame::TAZSaveChanges)
186 
187  public:
189  TAZSaveChanges(GNETAZFrame* TAZFrameParent);
190 
192  ~TAZSaveChanges();
193 
196 
199 
202 
204  bool isChangesPending() const;
205 
209  long onCmdSaveChanges(FXObject*, FXSelector, void*);
210 
212  long onCmdCancelChanges(FXObject*, FXSelector, void*);
214 
215  protected:
216  FOX_CONSTRUCTOR(TAZSaveChanges)
217 
218  private:
221 
224 
227  };
228 
229  // ===========================================================================
230  // class TAZChildDefaultParameters
231  // ===========================================================================
232 
236 
237  public:
239  TAZChildDefaultParameters(GNETAZFrame* TAZFrameParent);
240 
243 
246 
249 
252 
254  double getDefaultTAZSourceWeight() const;
255 
257  double getDefaultTAZSinkWeight() const;
258 
260  bool getToggleMembership() const;
261 
265  long onCmdSetDefaultValues(FXObject* obj, FXSelector, void*);
266 
268  long onCmdUseSelectedEdges(FXObject* obj, FXSelector, void*);
270 
271  protected:
272  FOX_CONSTRUCTOR(TAZChildDefaultParameters)
273 
274  private:
277 
279  FXCheckButton* myToggleMembership;
280 
282  FXHorizontalFrame* myDefaultTAZSourceFrame;
283 
286 
288  FXHorizontalFrame* myDefaultTAZSinkFrame;
289 
292 
295 
298 
301 
304  };
305 
306  // ===========================================================================
307  // class TAZSelectionStatistics
308  // ===========================================================================
309 
313 
314  public:
316  TAZSelectionStatistics(GNETAZFrame* TAZFrameParent);
317 
320 
323 
326 
328  bool selectEdge(const CurrentTAZ::TAZEdgeColor& edge);
329 
331  bool unselectEdge(GNEEdge* edge);
332 
334  bool isEdgeSelected(GNEEdge* edge);
335 
337  void clearSelectedEdges();
338 
340  const std::vector<CurrentTAZ::TAZEdgeColor>& getEdgeAndTAZChildrenSelected() const;
341 
345  long onCmdSetNewValues(FXObject* obj, FXSelector, void*);
346 
348  long onCmdSelectEdges(FXObject* obj, FXSelector, void*);
350 
351  protected:
352  FOX_CONSTRUCTOR(TAZSelectionStatistics)
353 
354 
355  void updateStatistics();
356 
357  private:
360 
362  FXHorizontalFrame* myTAZSourceFrame;
363 
366 
368  FXHorizontalFrame* myTAZSinkFrame;
369 
372 
375 
377  std::vector<CurrentTAZ::TAZEdgeColor> myEdgeAndTAZChildrenSelected;
378  };
379 
380  // ===========================================================================
381  // class TAZParameters
382  // ===========================================================================
383 
386  FXDECLARE(GNETAZFrame::TAZParameters)
387 
388  public:
390  TAZParameters(GNETAZFrame* TAZFrameParent);
391 
393  ~TAZParameters();
394 
397 
400 
402  bool isCurrentParametersValid() const;
403 
405  bool isAddEdgesWithinEnabled() const;
406 
408  void getAttributesAndValues() const;
409 
413  long onCmdSetColorAttribute(FXObject*, FXSelector, void*);
414 
416  long onCmdSetAttribute(FXObject*, FXSelector, void*);
417 
419  long onCmdHelp(FXObject*, FXSelector, void*);
421 
422  protected:
423  FOX_CONSTRUCTOR(TAZParameters)
424 
425  private:
428 
431 
433  FXButton* myColorEditor;
434 
436  FXTextField* myTextFieldCenter;
437 
439  FXCheckButton* myCheckButtonFill;
440 
442  FXTextField* myTextFieldColor;
443 
445  FXTextField* myTextFieldName;
446 
449 
452  };
453 
454  // ===========================================================================
455  // class TAZEdgesGraphic
456  // ===========================================================================
457 
461 
462  public:
464  TAZEdgesGraphic(GNETAZFrame* TAZFrameParent);
465 
468 
471 
474 
476  void updateEdgeColors();
477 
481  long onCmdChoosenBy(FXObject* obj, FXSelector, void*);
483 
484  protected:
485  FOX_CONSTRUCTOR(TAZEdgesGraphic)
486 
487  private:
490 
492  FXRadioButton* myColorBySourceWeight;
493 
495  FXRadioButton* myColorBySinkWeight;
496 
499 
502 
505 
508  };
509 
514  GNETAZFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet);
515 
517  ~GNETAZFrame();
518 
520  void hide();
521 
527  bool processClick(const Position& clickedPosition, const GNEViewNetHelper::ObjectsUnderCursor& objectsUnderCursor);
528 
530  void processEdgeSelection(const std::vector<GNEEdge*>& edges);
531 
534 
537 
540 
543 
544 protected:
547 
552  bool shapeDrawed();
553 
555  bool addOrRemoveTAZMember(GNEEdge* edge);
556 
558  void dropTAZMembers();
559 
560 private:
563 
566 
569 
572 
575 
578 
581 
584 
587 };
FXGroupBoxModule (based on FXGroupBox)
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:53
struct for edges and the source/sink colors
Definition: GNETAZFrame.h:51
int sourcePlusSinkColor
color by source + sink [0-9]
Definition: GNETAZFrame.h:79
GNETAZSourceSink * sink
@brif sink TAZ
Definition: GNETAZFrame.h:70
GNETAZSourceSink * source
source TAZ
Definition: GNETAZFrame.h:67
~TAZEdgeColor()
destructor (needed because RGBColors has to be deleted)
Definition: GNETAZFrame.cpp:92
int sourceMinusSinkColor
color by source - sink [0-9]
Definition: GNETAZFrame.h:82
CurrentTAZ * myCurrentTAZParent
pointer to CurrentTAZParent
Definition: GNETAZFrame.h:86
int sourceColor
color by source [0-9]
Definition: GNETAZFrame.h:73
int sinkColor
color by sink [0-9]
Definition: GNETAZFrame.h:76
void refreshTAZEdges()
refresh TAZEdges
double myMinSourceMinusSinkWeight
minimum source minus sink value of current TAZ Edges
Definition: GNETAZFrame.h:146
std::vector< GNEEdge * > mySelectedEdges
vector with pointers to selected edges
Definition: GNETAZFrame.h:128
bool isTAZEdge(GNEEdge *edge) const
check if given edge belongs to current TAZ
GNETAZFrame * myTAZFrameParent
pointer to TAZ Frame
Definition: GNETAZFrame.h:122
GNETAZ * myEditedTAZ
current edited TAZ
Definition: GNETAZFrame.h:125
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:131
double myMaxSourceMinusSinkWeight
maximum source minus sink value of current TAZ Edges
Definition: GNETAZFrame.h:143
FXLabel * myCurrentTAZLabel
Label for current TAZ.
Definition: GNETAZFrame.h:134
CurrentTAZ(GNETAZFrame *TAZFrameParent)
constructor
double myMaxSourcePlusSinkWeight
maximum source plus sink value of current TAZ Edges
Definition: GNETAZFrame.h:137
double myMinSourcePlusSinkWeight
minimum source plus sink value of current TAZ Edges
Definition: GNETAZFrame.h:140
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:294
TAZChildDefaultParameters(GNETAZFrame *TAZFrameParent)
FOX-declaration.
void showTAZChildDefaultParametersModule()
show TAZ child default parameters Module
FXCheckButton * myToggleMembership
CheckButton to enable or disable Toggle edge Membership.
Definition: GNETAZFrame.h:279
FXTextField * myTextFieldDefaultValueTAZSources
textField to set a default value for TAZ Sources
Definition: GNETAZFrame.h:285
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 source weight
void hideTAZChildDefaultParametersModule()
hide TAZ child default parameters Module
FXLabel * myInformationLabel
information label
Definition: GNETAZFrame.h:297
FXHorizontalFrame * myDefaultTAZSinkFrame
Horizontal Frame for default TAZ Sink Weight.
Definition: GNETAZFrame.h:288
FXHorizontalFrame * myDefaultTAZSourceFrame
Horizontal Frame for default TAZ Source Weight.
Definition: GNETAZFrame.h:282
GNETAZFrame * myTAZFrameParent
pointer to TAZFrame parent
Definition: GNETAZFrame.h:276
double myDefaultTAZSourceWeight
default source weight
Definition: GNETAZFrame.h:300
FXTextField * myTextFieldDefaultValueTAZSinks
textField to set a default value for TAZ Sinks
Definition: GNETAZFrame.h:291
long onCmdSetDefaultValues(FXObject *obj, FXSelector, void *)
double getDefaultTAZSinkWeight() const
default sink weight
double myDefaultTAZSinkWeight
default sink weight
Definition: GNETAZFrame.h:303
void showTAZCommonStatisticsModule()
show TAZ Common Statistics Module
TAZCommonStatistics(GNETAZFrame *TAZFrameParent)
constructor
FXLabel * myStatisticsLabel
Statistics labels.
Definition: GNETAZFrame.h:176
void hideTAZCommonStatisticsModule()
hide TAZ Common Statistics Module
void updateStatistics()
update Statistics label
GNETAZFrame * myTAZFrameParent
pointer to TAZFrame parent
Definition: GNETAZFrame.h:173
FXRadioButton * myColorBySourcePlusSinkWeight
add radio button "color source + sink"
Definition: GNETAZFrame.h:498
RGBColor myEdgeSelectedColor
RGBColor color for selected egdes.
Definition: GNETAZFrame.h:507
FXRadioButton * myColorBySinkWeight
add radio button "color by sink"
Definition: GNETAZFrame.h:495
void showTAZEdgesGraphicModule()
show TAZ Edges Graphic Module
void updateEdgeColors()
update edge colors;
FXRadioButton * myColorBySourceWeight
add radio button "color by source"
Definition: GNETAZFrame.h:492
FXRadioButton * myColorBySourceMinusSinkWeight
add radio button "color source - Sink"
Definition: GNETAZFrame.h:501
RGBColor myEdgeDefaultColor
default RGBColor for all edges
Definition: GNETAZFrame.h:504
GNETAZFrame * myTAZFrameParent
pointer to TAZFrame parent
Definition: GNETAZFrame.h:489
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:445
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:451
FXCheckButton * myAddEdgesWithinCheckButton
CheckButton to enable or disable use edges within TAZ after creation.
Definition: GNETAZFrame.h:448
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:427
FXButton * myColorEditor
Button for open color editor.
Definition: GNETAZFrame.h:433
FXTextField * myTextFieldCenter
text field center
Definition: GNETAZFrame.h:436
FXTextField * myTextFieldColor
textField to modify the default value of color parameter
Definition: GNETAZFrame.h:442
FXCheckButton * myCheckButtonFill
CheckButton to enable or disable fill.
Definition: GNETAZFrame.h:439
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:223
void showTAZSaveChangesModule()
show TAZ Save Changes Module
GNETAZFrame * myTAZFrameParent
pointer to TAZFrame parent
Definition: GNETAZFrame.h:220
FXButton * myCancelChangesButton
@field FXButton for cancel changes in TAZEdges
Definition: GNETAZFrame.h:226
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:362
std::vector< CurrentTAZ::TAZEdgeColor > myEdgeAndTAZChildrenSelected
vector with the current selected edges and their associated children
Definition: GNETAZFrame.h:377
void hideTAZSelectionStatisticsModule()
hide TAZ Selection Statistics Module
GNETAZFrame * myTAZFrameParent
pointer to TAZFrame parent
Definition: GNETAZFrame.h:359
bool isEdgeSelected(GNEEdge *edge)
check if an edge is selected
FXHorizontalFrame * myTAZSinkFrame
Horizontal Frame for default TAZ Sink Weight.
Definition: GNETAZFrame.h:368
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:365
void updateStatistics()
update TAZSelectionStatistics
FXTextField * myTextFieldTAZSinkWeight
textField for TAZ Sink weight
Definition: GNETAZFrame.h:371
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:374
TAZSelectionStatistics * myTAZSelectionStatistics
TAZ Edges selection parameters.
Definition: GNETAZFrame.h:583
TAZSelectionStatistics * getTAZSelectionStatisticsModule() const
get TAZ Selection Statistics modul
GNEFrameAttributeModules::NeteditAttributes * myNeteditAttributes
Netedit parameter.
Definition: GNETAZFrame.h:571
TAZSaveChanges * getTAZSaveChangesModule() const
get TAZ Save Changes modul
CurrentTAZ * myCurrentTAZ
current TAZ
Definition: GNETAZFrame.h:562
TAZEdgesGraphic * myTAZEdgesGraphic
TAZ Edges Graphic.
Definition: GNETAZFrame.h:586
TAZParameters * myTAZParameters
TAZ parameters.
Definition: GNETAZFrame.h:568
bool addOrRemoveTAZMember(GNEEdge *edge)
add or remove a source and a sink, or remove it if edge is in the list of TAZ Children
GNEFrameModules::DrawingShape * getDrawingShapeModule() const
get drawing mode modul
void dropTAZMembers()
drop all TAZSources and TAZ Sinks of current TAZ
bool processClick(const Position &clickedPosition, const GNEViewNetHelper::ObjectsUnderCursor &objectsUnderCursor)
process click over Viewnet
CurrentTAZ * getCurrentTAZModule() const
get Current TAZ modul
TAZCommonStatistics * myTAZCommonStatistics
TAZ Edges common parameters.
Definition: GNETAZFrame.h:565
GNEFrameModules::DrawingShape * myDrawingShape
Drawing shape.
Definition: GNETAZFrame.h:574
bool shapeDrawed()
build a shaped element using the drawed shape return true if was sucesfully created
~GNETAZFrame()
Destructor.
TAZSaveChanges * myTAZSaveChanges
save TAZ Edges
Definition: GNETAZFrame.h:577
CommonXMLStructure::SumoBaseObject * myBaseTAZ
SumoBaseObject used for creating TAZ.
Definition: GNETAZFrame.h:546
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
TAZChildDefaultParameters * myTAZChildDefaultParameters
TAZ child defaults parameters.
Definition: GNETAZFrame.h:580
Definition: GNETAZ.h:34
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:37