SUMO - Simulation of Urban MObility
GNETAZFrame.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2018 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 
18 // ===========================================================================
19 // included modules
20 // ===========================================================================
21 #include <config.h>
22 
27 #include <netedit/GNENet.h>
35 #include <netedit/GNEUndoList.h>
36 
37 #include "GNETAZFrame.h"
38 
39 
40 // ===========================================================================
41 // FOX callback mapping
42 // ===========================================================================
43 
44 FXDEFMAP(GNETAZFrame::TAZParameters) TAZParametersMap[] = {
47  FXMAPFUNC(SEL_COMMAND, MID_HELP, GNETAZFrame::TAZParameters::onCmdHelp),
48 };
49 
50 FXDEFMAP(GNETAZFrame::TAZSaveChanges) TAZSaveChangesMap[] = {
53 };
54 
55 FXDEFMAP(GNETAZFrame::TAZChildDefaultParameters) TAZChildDefaultParametersMap[] = {
58 };
59 
60 FXDEFMAP(GNETAZFrame::TAZSelectionStatistics) TAZSelectionStatisticsMap[] = {
62 };
63 
64 FXDEFMAP(GNETAZFrame::TAZEdgesGraphic) TAZEdgesGraphicMap[] = {
66 };
67 
68 // Object implementation
69 FXIMPLEMENT(GNETAZFrame::TAZParameters, FXGroupBox, TAZParametersMap, ARRAYNUMBER(TAZParametersMap))
70 FXIMPLEMENT(GNETAZFrame::TAZSaveChanges, FXGroupBox, TAZSaveChangesMap, ARRAYNUMBER(TAZSaveChangesMap))
71 FXIMPLEMENT(GNETAZFrame::TAZChildDefaultParameters, FXGroupBox, TAZChildDefaultParametersMap, ARRAYNUMBER(TAZChildDefaultParametersMap))
72 FXIMPLEMENT(GNETAZFrame::TAZSelectionStatistics, FXGroupBox, TAZSelectionStatisticsMap, ARRAYNUMBER(TAZSelectionStatisticsMap))
73 FXIMPLEMENT(GNETAZFrame::TAZEdgesGraphic, FXGroupBox, TAZEdgesGraphicMap, ARRAYNUMBER(TAZEdgesGraphicMap))
74 
75 
76 // ===========================================================================
77 // method definitions
78 // ===========================================================================
79 
80 // ---------------------------------------------------------------------------
81 // GNETAZFrame::TAZCurrent - methods
82 // ---------------------------------------------------------------------------
83 
84 GNETAZFrame::TAZCurrent::TAZEdge::TAZEdge(TAZCurrent* TAZCurrentParent, GNEEdge* _edge, GNEAdditional *_TAZSource, GNEAdditional *_TAZSink) :
85  edge(_edge),
86  TAZSource(_TAZSource),
87  TAZSink(_TAZSink),
88  sourceColor(0),
89  sinkColor(0),
90  sourcePlusSinkColor(0),
91  sourceMinusSinkColor(0),
92  myTAZCurrentParent(TAZCurrentParent)
93 { }
94 
95 
97 
98 
99 void
101  sourceColor = GNEAttributeCarrier::parse<int>(TAZSource->getAttribute(GNE_ATTR_TAZCOLOR));
102  sinkColor = GNEAttributeCarrier::parse<int>(TAZSink->getAttribute(GNE_ATTR_TAZCOLOR));
103  // Obtain Source+Sink needs more steps. First obtain Source+Sink Weight
104  double sourcePlusSinkWeight = GNEAttributeCarrier::parse<double>(TAZSource->getAttribute(SUMO_ATTR_WEIGHT)) +
105  GNEAttributeCarrier::parse<double>(TAZSink->getAttribute(SUMO_ATTR_WEIGHT));
106  // avoid division between zero
109  } else {
110  // calculate percentage relative to the max and min Source+Sink weight
111  double percentage = (sourcePlusSinkWeight - myTAZCurrentParent->myMinSourcePlusSinkWeight) /
113  // convert percentage to a value between [0-9] (because we have only 10 colors)
114  if (percentage >= 1) {
116  } else if (percentage < 0) {
118  } else {
119  sourcePlusSinkColor = (int)(percentage*10);
120  }
121  }
122  // Obtain Source+Sink needs more steps. First obtain Source-Sink Weight
123  double sourceMinusSinkWeight = GNEAttributeCarrier::parse<double>(TAZSource->getAttribute(SUMO_ATTR_WEIGHT)) -
124  GNEAttributeCarrier::parse<double>(TAZSink->getAttribute(SUMO_ATTR_WEIGHT));
125  // avoid division between zero
128  } else {
129  // calculate percentage relative to the max and min Source-Sink weight
130  double percentage = (sourceMinusSinkWeight - myTAZCurrentParent->myMinSourceMinusSinkWeight) /
132  // convert percentage to a value between [0-9] (because we have only 10 colors)
133  if (percentage >= 1) {
135  } else if (percentage < 0) {
137  } else {
138  sourceMinusSinkColor = (int)(percentage*10);
139  }
140  }
141 }
142 
143 
145  FXGroupBox(TAZFrameParent->myContentFrame, "TAZ", GUIDesignGroupBoxFrame),
146  myTAZFrameParent(TAZFrameParent),
147  myEditedTAZ(nullptr),
152  // create TAZ label
153  myTAZCurrentLabel = new FXLabel(this, "No TAZ selected", 0, GUIDesignLabelLeft);
154 }
155 
156 
158 
159 
160 void
162  // set new current TAZ
163  myEditedTAZ = editedTAZ;
164  // update label and moduls
165  if (myEditedTAZ != nullptr) {
166  myTAZCurrentLabel->setText(("Current TAZ: " + myEditedTAZ->getID()).c_str());
167  // obtain a copy of all edges of the net (to avoid slowdown during manipulations)
169  // obtain a copy of all SELECTED edges of the net (to avoid slowdown during manipulations)
171  // resfresh TAZ Edges
172  refreshTAZEdges();
173  // hide TAZ parameters
175  // hide Netedit parameters
177  // hide drawing shape
179  // show edge common parameters
181  // show save TAZ Edges
183  // show edge common parameters
185  // show Edges graphics
187  } else {
188  // show TAZ parameters
190  // show Netedit parameters
192  // show drawing shape
194  // hide edge common parameters
196  // hide edge common parameters
198  // hide Edges graphics
200  // hide save TAZ Edges
202  // restore label
203  myTAZCurrentLabel->setText("No TAZ selected");
204  // clear net edges (always the last step due hideTAZEdgesGraphicModul() function)
205  myNetEdges.clear();
206  // clear selected edges
207  mySelectedEdges.clear();
208  // reset all weight values
213  }
214 }
215 
216 
217 GNETAZ*
219  return myEditedTAZ;
220 }
221 
222 
223 bool
225  // simply iterate over edges and check edge parameter
226  for (const auto &i : myTAZEdges) {
227  if (i.edge == edge) {
228  return true;
229  }
230  }
231  // not found, then return false
232  return false;
233 }
234 
235 
236 const std::vector<GNEEdge*>&
238  return myNetEdges;
239 }
240 
241 
242 const std::vector<GNEEdge*>&
244  return mySelectedEdges;
245 }
246 
247 
248 const std::vector<GNETAZFrame::TAZCurrent::TAZEdge> &
250  return myTAZEdges;
251 }
252 
253 
254 void
256  // clear all curren TAZEdges
257  myTAZEdges.clear();
258  // clear weight values
263  // only refresh if we're editing an TAZ
264  if (myEditedTAZ) {
265  // iterate over additional childs and create TAZEdges
266  for (const auto &i : myEditedTAZ->getAdditionalChilds()) {
267  addTAZChild(i);
268  }
269  // update colors after add all edges
270  for (auto &i : myTAZEdges) {
271  i.updateColors();
272  }
273  // update edge colors
275  }
276 }
277 
278 
279 void
281  // first make sure that additional is an TAZ Source or Sink
282  if ((additional->getTagProperty().getTag() == SUMO_TAG_TAZSOURCE) || (additional->getTagProperty().getTag() == SUMO_TAG_TAZSINK)) {
284  // first check if TAZEdge has to be created
285  bool createTAZEdge = true;
286  for (auto &i : myTAZEdges) {
287  if (i.edge == edge) {
288  createTAZEdge = false;
289  // update TAZ Source or Sink
290  if (additional->getTagProperty().getTag() == SUMO_TAG_TAZSOURCE) {
291  i.TAZSource = additional;
292  } else {
293  i.TAZSink = additional;
294  }
295  }
296  }
297  // check if additional has to be created
298  if (createTAZEdge) {
299  if (additional->getTagProperty().getTag() == SUMO_TAG_TAZSOURCE) {
300  myTAZEdges.push_back(TAZEdge(this, edge, additional, nullptr));
301  } else {
302  myTAZEdges.push_back(TAZEdge(this, edge, nullptr, additional));
303  }
304  }
305  // recalculate weights
310  for (auto &i : myTAZEdges) {
311  // make sure that both TAZ Source and Sink exist
312  if (i.TAZSource && i.TAZSink) {
313  // obtain source plus sink
314  double sourcePlusSink = GNEAttributeCarrier::parse<double>(i.TAZSource->getAttribute(SUMO_ATTR_WEIGHT)) +
315  GNEAttributeCarrier::parse<double>(i.TAZSink->getAttribute(SUMO_ATTR_WEIGHT));
316  // check myMaxSourcePlusSinkWeight
317  if (sourcePlusSink > myMaxSourcePlusSinkWeight) {
318  myMaxSourcePlusSinkWeight = sourcePlusSink;
319  }
320  // check myMinSourcePlusSinkWeight
321  if ((myMinSourcePlusSinkWeight == -1) || (sourcePlusSink < myMinSourcePlusSinkWeight)) {
322  myMinSourcePlusSinkWeight = sourcePlusSink;
323  }
324  // obtain source minus sink
325  double sourceMinusSink = GNEAttributeCarrier::parse<double>(i.TAZSource->getAttribute(SUMO_ATTR_WEIGHT)) -
326  GNEAttributeCarrier::parse<double>(i.TAZSink->getAttribute(SUMO_ATTR_WEIGHT));
327  // use valor absolute
328  if (sourceMinusSink < 0) {
329  sourceMinusSink *= -1;
330  }
331  // check myMaxSourcePlusSinkWeight
332  if (sourceMinusSink > myMaxSourceMinusSinkWeight) {
333  myMaxSourceMinusSinkWeight = sourceMinusSink;
334  }
335  // check myMinSourcePlusSinkWeight
336  if ((myMinSourceMinusSinkWeight == -1) || (sourceMinusSink < myMinSourceMinusSinkWeight)) {
337  myMinSourceMinusSinkWeight = sourceMinusSink;
338  }
339  }
340  }
341  } else {
342  throw ProcessError("Invalid TAZ Child");
343  }
344 }
345 
346 // ---------------------------------------------------------------------------
347 // GNETAZFrame::TAZCommonStatistics - methods
348 // ---------------------------------------------------------------------------
349 
351  FXGroupBox(TAZFrameParent->myContentFrame, "TAZ Statistics", GUIDesignGroupBoxFrame),
352  myTAZFrameParent(TAZFrameParent) {
353  // create label for statistics
354  myStatisticsLabel = new FXLabel(this, "Statistics", 0, GUIDesignLabelFrameInformation);
355 }
356 
357 
359 
360 
361 void
363  // always update statistics after show
365  show();
366 }
367 
368 
369 void
371  hide();
372 }
373 
374 
375 void
378  // declare ostringstream for statistics
379  std::ostringstream information;
380  information
381  << "- Number of Edges: " << toString(myTAZFrameParent->myTAZCurrent->getTAZ()->getAdditionalChilds().size()/2) << "\n"
382  << "- Min source: " << myTAZFrameParent->myTAZCurrent->getTAZ()->getAttribute(GNE_ATTR_MIN_SOURCE) << "\n"
383  << "- Max source: " << myTAZFrameParent->myTAZCurrent->getTAZ()->getAttribute(GNE_ATTR_MAX_SOURCE) << "\n"
384  << "- Average source: " << myTAZFrameParent->myTAZCurrent->getTAZ()->getAttribute(GNE_ATTR_AVERAGE_SOURCE) << "\n"
385  << "\n"
386  << "- Min sink: " << myTAZFrameParent->myTAZCurrent->getTAZ()->getAttribute(GNE_ATTR_MIN_SINK) << "\n"
387  << "- Max sink: " << myTAZFrameParent->myTAZCurrent->getTAZ()->getAttribute(GNE_ATTR_MAX_SINK) << "\n"
389  // set new label
390  myStatisticsLabel->setText(information.str().c_str());
391  } else {
392  myStatisticsLabel->setText("No TAZ Selected");
393  }
394 }
395 
396 // ---------------------------------------------------------------------------
397 // GNETAZFrame::TAZSaveChanges - methods
398 // ---------------------------------------------------------------------------
399 
401  FXGroupBox(TAZFrameParent->myContentFrame, "Modifications", GUIDesignGroupBoxFrame),
402  myTAZFrameParent(TAZFrameParent) {
403  // Create groupbox for save changes
404  mySaveChangesButton = new FXButton(this, "Save changes", GUIIconSubSys::getIcon(ICON_SAVE), this, MID_OK, GUIDesignButton);
405  mySaveChangesButton->disable();
406  // Create groupbox cancel changes
407  myCancelChangesButton = new FXButton(this, "Cancel changes", GUIIconSubSys::getIcon(ICON_CANCEL), this, MID_CANCEL, GUIDesignButton);
408  myCancelChangesButton->disable();
409 }
410 
411 
413 
414 
415 void
417  show();
418 }
419 
420 
421 void
423  // cancel changes before hidding modul
424  onCmdCancelChanges(0,0,0);
425  hide();
426 }
427 
428 
429 void
431  // check that save changes is disabled
432  if (!mySaveChangesButton->isEnabled()) {
433  // enable mySaveChangesButton and myCancelChangesButton
434  mySaveChangesButton->enable();
435  myCancelChangesButton->enable();
436  // start undo list set
437  myTAZFrameParent->myViewNet->getUndoList()->p_begin("TAZ attributes");
438  }
439 }
440 
441 
442 bool
444  // simply check if save Changes Button is enabled
445  return mySaveChangesButton->isEnabled();
446 }
447 
448 
449 long
450 GNETAZFrame::TAZSaveChanges::onCmdSaveChanges(FXObject*, FXSelector, void*) {
451  // check that save changes is enabled
452  if (mySaveChangesButton->isEnabled()) {
453  // disable mySaveChangesButton and myCancelChangesButtonand
454  mySaveChangesButton->disable();
455  myCancelChangesButton->disable();
456  // finish undo list set
458  }
459  return 1;
460 }
461 
462 
463 long
464 GNETAZFrame::TAZSaveChanges::onCmdCancelChanges(FXObject*, FXSelector, void*) {
465  // check that save changes is enabled
466  if (mySaveChangesButton->isEnabled()) {
467  // disable buttons
468  mySaveChangesButton->disable();
469  myCancelChangesButton->disable();
470  // abort undo list
472  // always refresh TAZ Edges after removing TAZSources/Sinks
474  // update use edges button
476  }
477  return 1;
478 }
479 
480 // ---------------------------------------------------------------------------
481 // GNETAZFrame::TAZChildDefaultParameters - methods
482 // ---------------------------------------------------------------------------
483 
485  FXGroupBox(TAZFrameParent->myContentFrame, "TAZ Sources/Sinks", GUIDesignGroupBoxFrame),
486  myTAZFrameParent(TAZFrameParent),
487  myDefaultTAZSourceWeight(1),
488  myDefaultTAZSinkWeight(1) {
489  // create checkbox for toogle membership
490  FXHorizontalFrame* toogleMembershipFrame = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
491  new FXLabel(toogleMembershipFrame, "Membership", 0, GUIDesignLabelAttribute);
492  myToggleMembership = new FXCheckButton(toogleMembershipFrame, "Toggle", this, MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButtonAttribute);
493  // by default enabled
494  myToggleMembership->setCheck(TRUE);
495  // create default TAZ Source weight
496  myDefaultTAZSourceFrame = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
497  new FXLabel(myDefaultTAZSourceFrame, "New source", 0, GUIDesignLabelAttribute);
499  myTextFieldDefaultValueTAZSources->setText("1");
500  // create default TAZ Sink weight
501  myDefaultTAZSinkFrame = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
502  new FXLabel(myDefaultTAZSinkFrame, "New sink", 0, GUIDesignLabelAttribute);
504  myTextFieldDefaultValueTAZSinks->setText("1");
505  // Create button for use selected edges
506  myUseSelectedEdges = new FXButton(this, "Use selected edges", nullptr, this, MID_GNE_SELECT, GUIDesignButton);
507  // Create information label
508  std::ostringstream information;
509  information
510  << "- Toogle Membership:\n"
511  << " Create new Sources/Sinks\n"
512  << " with given weights.";
513  myInformationLabel = new FXLabel(this, information.str().c_str(), 0, GUIDesignLabelFrameInformation);
514 }
515 
516 
518 
519 
520 void
522  // check if TAZ selection Statistics Modul has to be shown
523  if (myToggleMembership->getCheck() == FALSE) {
525  } else {
527  }
528  // update selected button
530  // show modul
531  show();
532 }
533 
534 
535 void
537  // hide TAZ Selection Statistics Modul
539  // hide modul
540  hide();
541 }
542 
543 
544 void
546  if (myToggleMembership->getCheck() == TRUE) {
547  // check if use selected edges has to be enabled
548  if (myTAZFrameParent->myTAZCurrent->getSelectedEdges().size() > 0) {
549  myUseSelectedEdges->setText("Use selected edges");
550  myUseSelectedEdges->enable();
551  } else if(myTAZFrameParent->myTAZCurrent->getTAZEdges().size() > 0){
552  myUseSelectedEdges->setText("Remove all edges");
553  myUseSelectedEdges->enable();
554  } else {
555  myUseSelectedEdges->setText("Use selected edges");
556  myUseSelectedEdges->disable();
557  }
558  } else if (myTAZFrameParent->getTAZCurrentModul()->getTAZEdges().size() > 0) {
559  // enable myUseSelectedEdges button
560  myUseSelectedEdges->enable();
561  // update mySelectEdgesOfSelection label
563  // check if all edges of TAZChilds are selected
564  bool allSelected = true;
565  for (const auto & i : myTAZFrameParent->getTAZCurrentModul()->getTAZEdges()) {
566  if (!i.edge->isAttributeCarrierSelected()) {
567  allSelected = false;
568  }
569  }
570  if(allSelected) {
571  myUseSelectedEdges->setText("Remove all edges from selection");
572  } else {
573  myUseSelectedEdges->setText("Add all edges to selection");
574  }
576  if (myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildsSelected().front().edge->isAttributeCarrierSelected()) {
577  myUseSelectedEdges->setText("Remove edge from selection");
578  } else {
579  myUseSelectedEdges->setText("Add edge to selection");
580  }
581  } else {
582  // check if all edges of TAZChilds selected are selected
583  bool allSelected = true;
585  if (!i.edge->isAttributeCarrierSelected()) {
586  allSelected = false;
587  }
588  }
589  if (allSelected) {
590  myUseSelectedEdges->setText(("Remove " + toString(myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildsSelected().size()) + " from to selection").c_str());
591  } else {
592  myUseSelectedEdges->setText(("Add " + toString(myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildsSelected().size()) + " edges to selection").c_str());
593  }
594  }
595  } else {
596  // TAZ doesn't have childs, then disable button
597  myUseSelectedEdges->disable();
598  }
599 }
600 
601 
602 double
605 }
606 
607 
608 double
610  return myDefaultTAZSinkWeight;
611 }
612 
613 
614 bool
616  return (myToggleMembership->getCheck() == TRUE);
617 }
618 
619 
620 long
622  // find edited object
623  if (obj == myToggleMembership) {
624  // first clear selected edges
626  // set text of myToggleMembership
627  if (myToggleMembership->getCheck() == TRUE) {
628  myToggleMembership->setText("toogle");
629  // show TAZSource/Sink Frames
630  myDefaultTAZSourceFrame->show();
631  myDefaultTAZSinkFrame->show();
632  // update information label
633  std::ostringstream information;
634  information
635  << "- Toogle Membership:\n"
636  << " Create new Sources/Sinks\n"
637  << " with given weights.";
638  myInformationLabel->setText(information.str().c_str());
639  // hide TAZSelectionStatistics
641  // check if use selected edges has to be enabled
642  if (myTAZFrameParent->myTAZCurrent->getSelectedEdges().size() > 0) {
643  myUseSelectedEdges->setText("Use selected edges");
644  } else if(myTAZFrameParent->myTAZCurrent->getTAZEdges().size() > 0){
645  myUseSelectedEdges->setText("Remove all edges");
646  } else {
647  myUseSelectedEdges->setText("Use selected edges");
648  myUseSelectedEdges->disable();
649  }
650  } else {
651  myToggleMembership->setText("keep");
652  // hide TAZSource/Sink Frames
653  myDefaultTAZSourceFrame->hide();
654  myDefaultTAZSinkFrame->hide();
655  // update information label
656  std::ostringstream information;
657  information
658  << "- Keep Membership:\n"
659  << " Select Sources/Sinks.\n"
660  << "- Press ESC to clear\n"
661  << " current selection.";
662  myInformationLabel->setText(information.str().c_str());
663  // show TAZSelectionStatistics
665  }
666  // update button
668  } else if (obj == myTextFieldDefaultValueTAZSources) {
669  // check if given value is valid
670  if (GNEAttributeCarrier::canParse<double>(myTextFieldDefaultValueTAZSources->getText().text())) {
671  myDefaultTAZSourceWeight = GNEAttributeCarrier::parse<double>(myTextFieldDefaultValueTAZSources->getText().text());
672  // check if myDefaultTAZSourceWeight is greather than 0
673  if (myDefaultTAZSourceWeight >= 0) {
674  // set valid color
675  myTextFieldDefaultValueTAZSources->setTextColor(FXRGB(0, 0, 0));
676  } else {
677  // set invalid color
678  myTextFieldDefaultValueTAZSources->setTextColor(FXRGB(255, 0, 0));
680  }
681  } else {
682  // set invalid color
683  myTextFieldDefaultValueTAZSources->setTextColor(FXRGB(255, 0, 0));
685  }
686  } else if (obj == myTextFieldDefaultValueTAZSinks) {
687  // check if given value is valid
688  if (GNEAttributeCarrier::canParse<double>(myTextFieldDefaultValueTAZSinks->getText().text())) {
689  myDefaultTAZSinkWeight = GNEAttributeCarrier::parse<double>(myTextFieldDefaultValueTAZSinks->getText().text());
690  // check if myDefaultTAZSinkWeight is greather than 0
691  if (myDefaultTAZSinkWeight >= 0) {
692  // set valid color
693  myTextFieldDefaultValueTAZSinks->setTextColor(FXRGB(0, 0, 0));
694  } else {
695  // set invalid color
696  myTextFieldDefaultValueTAZSinks->setTextColor(FXRGB(255, 0, 0));
698  }
699  } else {
700  // set invalid color
701  myTextFieldDefaultValueTAZSinks->setTextColor(FXRGB(255, 0, 0));
703  }
704  }
705  return 1;
706 }
707 
708 
709 long
711  // select edge or create new TAZ Source/Child, depending of myToggleMembership
712  if(myToggleMembership->getCheck() == TRUE) {
713  // first drop all edges
715  // iterate over selected edges and add it as TAZMember
716  for (const auto &i : myTAZFrameParent->myTAZCurrent->getSelectedEdges()) {
718  }
719  // update selected button
721  } else {
723  // first check if all TAZEdges are selected
724  bool allSelected = true;
725  for (const auto & i : myTAZFrameParent->getTAZCurrentModul()->getTAZEdges()) {
726  if (!i.edge->isAttributeCarrierSelected()) {
727  allSelected = false;
728  }
729  }
730  // select or unselect all depending of allSelected
731  if(allSelected) {
732  // remove form selection all TAZEdges
733  for (const auto & i : myTAZFrameParent->getTAZCurrentModul()->getTAZEdges()) {
734  // enable save button
736  // change attribute selected
737  i.edge->setAttribute(GNE_ATTR_SELECTED, "false", myTAZFrameParent->myViewNet->getUndoList());
738  }
739  } else {
740  // add to selection all TAZEdges
741  for (const auto & i : myTAZFrameParent->getTAZCurrentModul()->getTAZEdges()) {
742  // enable save button
744  // change attribute selected
745  i.edge->setAttribute(GNE_ATTR_SELECTED, "true", myTAZFrameParent->myViewNet->getUndoList());
746  }
747  }
748  } else {
749  // first check if all TAZEdges are selected
750  bool allSelected = true;
752  if (!i.edge->isAttributeCarrierSelected()) {
753  allSelected = false;
754  }
755  }
756  // select or unselect all depending of allSelected
757  if(allSelected) {
758  // only remove from selection selected TAZEdges
760  if (i.edge->isAttributeCarrierSelected()) {
761  // enable save button
763  // change attribute selected
764  i.edge->setAttribute(GNE_ATTR_SELECTED, "false", myTAZFrameParent->myViewNet->getUndoList());
765  }
766  }
767  } else {
768  // only add to selection selected TAZEdges
770  if (!i.edge->isAttributeCarrierSelected()) {
771  // enable save button
773  // change attribute selected
774  i.edge->setAttribute(GNE_ATTR_SELECTED, "true", myTAZFrameParent->myViewNet->getUndoList());
775  }
776  }
777  }
778  }
779  }
780  // update selection button
782  // update view net
783  myTAZFrameParent->myViewNet->update();
784  return 1;
785 }
786 
787 // ---------------------------------------------------------------------------
788 // GNETAZFrame::TAZSelectionStatistics - methods
789 // ---------------------------------------------------------------------------
790 
792  FXGroupBox(TAZFrameParent->myContentFrame, "Selection Statistics", GUIDesignGroupBoxFrame),
793  myTAZFrameParent(TAZFrameParent) {
794  // create default TAZ Source weight
795  myTAZSourceFrame = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
796  new FXLabel(myTAZSourceFrame, "Source", 0, GUIDesignLabelAttribute);
798  myTAZSourceFrame->hide();
799  // create default TAZ Sink weight
800  myTAZSinkFrame = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
801  new FXLabel(myTAZSinkFrame, "Sink", 0, GUIDesignLabelAttribute);
803  myTAZSinkFrame->hide();
804  // create label for statistics
805  myStatisticsLabel = new FXLabel(this, "Statistics", 0, GUIDesignLabelFrameInformation);
806 }
807 
808 
810 
811 
812 void
814  // update Statistics before show
816  show();
817 }
818 
819 
820 void
822  // clear childs before hide
824  hide();
825 }
826 
827 
828 bool
830  // find TAZEdge using edge as criterium wasn't previously selected
831  for (const auto &i : myEdgeAndTAZChildsSelected) {
832  if (i.edge == TAZEdge.edge) {
833  throw ProcessError("TAZEdge already selected");
834  }
835  }
836  // add edge and their TAZ Childs into myTAZChildSelected
837  myEdgeAndTAZChildsSelected.push_back(TAZEdge);
838  // always update statistics after insertion
840  // update edge colors
842  // update selection button
844  return true;
845 }
846 
847 
848 bool
850  if (edge) {
851  // find TAZEdge using edge as criterium
852  for (auto i = myEdgeAndTAZChildsSelected.begin(); i != myEdgeAndTAZChildsSelected.end(); i++) {
853  if (i->edge == edge) {
855  // always update statistics after insertion
857  // update edge colors
859  // update selection button
861  return true;
862  }
863  }
864  // throw exception if edge wasn't found
865  throw ProcessError("edge wasn't found");
866  } else {
867  throw ProcessError("Invalid edge");
868  }
869 }
870 
871 
872 bool
874  // find TAZEdge using edge as criterium
875  for (const auto &i : myEdgeAndTAZChildsSelected) {
876  if (i.edge == edge) {
877  return true;
878  }
879  }
880  // edge wasn't found, then return false
881  return false;
882 }
883 
884 
885 void
887  // clear all selected edges (and the TAZ Childs)
889  // always update statistics after clear edges
891  // update edge colors
893  // update selection button
895 }
896 
897 
898 const std::vector<GNETAZFrame::TAZCurrent::TAZEdge>&
901 }
902 
903 
904 long
906  if (obj == myTextFieldTAZSourceWeight) {
907  // check if given value is valid
908  if (GNEAttributeCarrier::canParse<double>(myTextFieldTAZSourceWeight->getText().text())) {
909  double newTAZSourceWeight = GNEAttributeCarrier::parse<double>(myTextFieldTAZSourceWeight->getText().text());
910  // check if myDefaultTAZSourceWeight is greather than 0
911  if (newTAZSourceWeight >= 0) {
912  // set valid color in TextField
913  myTextFieldTAZSourceWeight->setTextColor(FXRGB(0, 0, 0));
914  // enable save button
916  // update weight of all TAZSources
917  for (const auto &i : myEdgeAndTAZChildsSelected) {
918  i.TAZSource->setAttribute(SUMO_ATTR_WEIGHT, myTextFieldTAZSourceWeight->getText().text(), myTAZFrameParent->myViewNet->getUndoList());
919  }
920  // refresh TAZ Edges
922  } else {
923  // set invalid color
924  myTextFieldTAZSourceWeight->setTextColor(FXRGB(255, 0, 0));
925  }
926  } else {
927  // set invalid color
928  myTextFieldTAZSourceWeight->setTextColor(FXRGB(255, 0, 0));
929  }
930  } else if (obj == myTextFieldTAZSinkWeight) {
931  // check if given value is valid
932  if (GNEAttributeCarrier::canParse<double>(myTextFieldTAZSinkWeight->getText().text())) {
933  double newTAZSinkWeight = GNEAttributeCarrier::parse<double>(myTextFieldTAZSinkWeight->getText().text());
934  // check if myDefaultTAZSinkWeight is greather than 0
935  if (newTAZSinkWeight >= 0) {
936  // set valid color in TextField
937  myTextFieldTAZSinkWeight->setTextColor(FXRGB(0, 0, 0));
938  // enable save button
940  // update weight of all TAZSources
941  for (const auto &i : myEdgeAndTAZChildsSelected) {
942  i.TAZSink->setAttribute(SUMO_ATTR_WEIGHT, myTextFieldTAZSinkWeight->getText().text(), myTAZFrameParent->myViewNet->getUndoList());
943  }
944  // refresh TAZ Edges
946  } else {
947  // set invalid color
948  myTextFieldTAZSinkWeight->setTextColor(FXRGB(255, 0, 0));
949  }
950  } else {
951  // set invalid color
952  myTextFieldTAZSinkWeight->setTextColor(FXRGB(255, 0, 0));
953  }
954  }
955  return 1;
956 }
957 
958 
959 long
961  if(myEdgeAndTAZChildsSelected.size() == 0) {
962  // add to selection all TAZEdges
963  for (const auto & i : myTAZFrameParent->getTAZCurrentModul()->getTAZEdges()) {
964  // avoid empty undolists
965  if(!i.edge->isAttributeCarrierSelected()) {
966  // enable save button
968  // change attribute selected
969  i.edge->setAttribute(GNE_ATTR_SELECTED, "true", myTAZFrameParent->myViewNet->getUndoList());
970  }
971  }
972  } else {
973  // only add to selection selected TAZEdges
974  for (const auto &i : myEdgeAndTAZChildsSelected) {
975  // avoid empty undolists
976  if (!i.edge->isAttributeCarrierSelected()) {
977  // enable save button
979  // change attribute selected
980  i.edge->setAttribute(GNE_ATTR_SELECTED, "true", myTAZFrameParent->myViewNet->getUndoList());
981  }
982  }
983  }
984  // update view net
985  myTAZFrameParent->myViewNet->update();
986  return 1;
987 }
988 
989 
990 void
992  if (myEdgeAndTAZChildsSelected.size() > 0) {
993  // show TAZSources/Sinks frames
994  myTAZSourceFrame->show();
995  myTAZSinkFrame->show();
996  // declare string sets for TextFields (to avoid duplicated values)
997  std::set<std::string> weightSourceSet;
998  std::set<std::string> weightSinkSet;
999  // declare stadistic variables
1000  double weight = 0;
1001  double maxWeightSource = 0;
1002  double minWeightSource = -1;
1003  double averageWeightSource = 0;
1004  double maxWeightSink = 0;
1005  double minWeightSink = -1;
1006  double averageWeightSink = 0;
1007  // iterate over additional childs
1008  for (const auto &i : myEdgeAndTAZChildsSelected) {
1009  //start with sources
1010  weight = GNEAttributeCarrier::parse<double>(i.TAZSource->getAttribute(SUMO_ATTR_WEIGHT));
1011  // insert source weight in weightSinkTextField
1012  weightSourceSet.insert(toString(weight));
1013  // check max Weight
1014  if (maxWeightSource < weight) {
1015  maxWeightSource = weight;
1016  }
1017  // check min Weight
1018  if (minWeightSource == -1 || (maxWeightSource < weight)) {
1019  minWeightSource = weight;
1020  }
1021  // update Average
1022  averageWeightSource += weight;
1023  // continue with sinks
1024  weight = GNEAttributeCarrier::parse<double>(i.TAZSink->getAttribute(SUMO_ATTR_WEIGHT));
1025  // save sink weight in weightSinkTextField
1026  weightSinkSet.insert(toString(weight));
1027  // check max Weight
1028  if (maxWeightSink < weight) {
1029  maxWeightSink = weight;
1030  }
1031  // check min Weight
1032  if (minWeightSink == -1 || (maxWeightSink < weight)) {
1033  minWeightSink = weight;
1034  }
1035  // update Average
1036  averageWeightSink += weight;
1037  }
1038  // calculate average
1039  averageWeightSource /= myEdgeAndTAZChildsSelected.size();
1040  averageWeightSink /= myEdgeAndTAZChildsSelected.size();
1041  // declare ostringstream for statistics
1042  std::ostringstream information;
1043  std::string edgeInformation;
1044  // first fill edgeInformation
1045  if (myEdgeAndTAZChildsSelected.size() == 1) {
1046  edgeInformation = "- Edge ID: " + myEdgeAndTAZChildsSelected.begin()->edge->getID();
1047  } else {
1048  edgeInformation = "- Number of edges: " + toString(myEdgeAndTAZChildsSelected.size());
1049  }
1050  // fill rest of information
1051  information
1052  << edgeInformation << "\n"
1053  << "- Min source: " << toString(minWeightSource) << "\n"
1054  << "- Max source: " << toString(maxWeightSource) << "\n"
1055  << "- Average source: " << toString(averageWeightSource) << "\n"
1056  << "\n"
1057  << "- Min sink: " << toString(minWeightSink) << "\n"
1058  << "- Max sink: " << toString(maxWeightSink) << "\n"
1059  << "- Average sink: " << toString(averageWeightSink);
1060  // set new label
1061  myStatisticsLabel->setText(information.str().c_str());
1062  // set TextFields (Text and color)
1063  myTextFieldTAZSourceWeight->setText(joinToString(weightSourceSet, " ").c_str());
1064  myTextFieldTAZSourceWeight->setTextColor(FXRGB(0, 0, 0));
1065  myTextFieldTAZSinkWeight->setText(joinToString(weightSinkSet, " ").c_str());
1066  myTextFieldTAZSinkWeight->setTextColor(FXRGB(0, 0, 0));
1067  } else {
1068  // hide TAZSources/Sinks frames
1069  myTAZSourceFrame->hide();
1070  myTAZSinkFrame->hide();
1071  // hide myStatisticsLabel
1072  myStatisticsLabel->setText("No edges selected");
1073  }
1074 }
1075 
1076 // ---------------------------------------------------------------------------
1077 // GNETAZFrame::TAZParameters- methods
1078 // ---------------------------------------------------------------------------
1079 
1081  FXGroupBox(TAZFrameParent->myContentFrame, "TAZ parameters", GUIDesignGroupBoxFrame),
1082  myTAZFrameParent(TAZFrameParent) {
1083  // create Button and string textField for color and set blue as default color
1084  FXHorizontalFrame* colorParameter = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
1085  myColorEditor = new FXButton(colorParameter, toString(SUMO_ATTR_COLOR).c_str(), 0, this, MID_GNE_SET_ATTRIBUTE_DIALOG, GUIDesignButtonAttribute);
1086  myTextFieldColor = new FXTextField(colorParameter, GUIDesignTextFieldNCol, this, MID_GNE_SET_ATTRIBUTE, GUIDesignTextField);
1087  myTextFieldColor->setText("blue");
1088  // create Label and CheckButton for use innen edges with true as default value
1089  FXHorizontalFrame* useInnenEdges = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
1090  new FXLabel(useInnenEdges, "Edges within", 0, GUIDesignLabelAttribute);
1091  myAddEdgesWithinCheckButton = new FXCheckButton(useInnenEdges, "use", this, MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButtonAttribute);
1092  myAddEdgesWithinCheckButton->setCheck(true);
1093  // Create help button
1094  myHelpTAZAttribute = new FXButton(this, "Help", 0, this, MID_HELP, GUIDesignButtonRectangular);
1095 }
1096 
1097 
1099 
1100 
1101 void
1103  FXGroupBox::show();
1104 }
1105 
1106 
1107 void
1109  FXGroupBox::hide();
1110 }
1111 
1112 
1113 bool
1115  return GNEAttributeCarrier::canParse<RGBColor>(myTextFieldColor->getText().text());
1116 }
1117 
1118 
1119 bool
1121  return (myAddEdgesWithinCheckButton->getCheck() == TRUE);
1122 }
1123 
1124 
1125 std::map<SumoXMLAttr, std::string>
1127  std::map<SumoXMLAttr, std::string> parametersAndValues;
1128  // get color (currently the only editable attribute)
1129  parametersAndValues[SUMO_ATTR_COLOR] = myTextFieldColor->getText().text();
1130  return parametersAndValues;
1131 }
1132 
1133 
1134 long
1136  // create FXColorDialog
1137  FXColorDialog colordialog(this, tr("Color Dialog"));
1138  colordialog.setTarget(this);
1139  // If previous attribute wasn't correct, set black as default color
1140  if (GNEAttributeCarrier::canParse<RGBColor>(myTextFieldColor->getText().text())) {
1141  colordialog.setRGBA(MFXUtils::getFXColor(RGBColor::parseColor(myTextFieldColor->getText().text())));
1142  } else {
1143  colordialog.setRGBA(MFXUtils::getFXColor(RGBColor::parseColor("blue")));
1144  }
1145  // execute dialog to get a new color
1146  if (colordialog.execute()) {
1147  myTextFieldColor->setText(toString(MFXUtils::getRGBColor(colordialog.getRGBA())).c_str());
1148  onCmdSetAttribute(0, 0, 0);
1149  }
1150  return 0;
1151 }
1152 
1153 
1154 long
1155 GNETAZFrame::TAZParameters::onCmdSetAttribute(FXObject*, FXSelector, void*) {
1156  // only COLOR text field has to be checked
1157  bool currentParametersValid = GNEAttributeCarrier::canParse<RGBColor>(myTextFieldColor->getText().text());
1158  // change color of textfield dependig of myCurrentParametersValid
1159  if (currentParametersValid) {
1160  myTextFieldColor->setTextColor(FXRGB(0, 0, 0));
1161  myTextFieldColor->killFocus();
1162  } else {
1163  myTextFieldColor->setTextColor(FXRGB(255, 0, 0));
1164  currentParametersValid = false;
1165  }
1166  // change useInnenEdgesCheckButton text
1167  if (myAddEdgesWithinCheckButton->getCheck() == TRUE) {
1168  myAddEdgesWithinCheckButton->setText("use");
1169  } else {
1170  myAddEdgesWithinCheckButton->setText("not use");
1171  }
1172  return 0;
1173 }
1174 
1175 
1176 long
1177 GNETAZFrame::TAZParameters::onCmdHelp(FXObject*, FXSelector, void*) {
1179  return 1;
1180 }
1181 
1182 // ---------------------------------------------------------------------------
1183 // GNETAZFrame::TAZEdgesGraphic - methods
1184 // ---------------------------------------------------------------------------
1185 
1187  FXGroupBox(TAZFrameParent->myContentFrame, "Edges", GUIDesignGroupBoxFrame),
1188  myTAZFrameParent(TAZFrameParent),
1189  myEdgeDefaultColor(RGBColor::GREY),
1190  myEdgeSelectedColor(RGBColor::MAGENTA) {
1191  // create label for non taz edge color information
1192  FXLabel *NonTAZEdgeLabel = new FXLabel(this,"Non TAZ Edge", nullptr, GUIDesignLabelCenter);
1193  NonTAZEdgeLabel->setBackColor(MFXUtils::getFXColor(myEdgeDefaultColor));
1194  NonTAZEdgeLabel->setTextColor(MFXUtils::getFXColor(RGBColor::WHITE));
1195  // create label for selected TAZEdge color information
1196  FXLabel *selectedTAZEdgeLabel = new FXLabel(this,"Selected TAZ Edge", nullptr, GUIDesignLabelCenter);
1197  selectedTAZEdgeLabel->setBackColor(MFXUtils::getFXColor(myEdgeSelectedColor));
1198  // create label for color information
1199  new FXLabel(this,"Scala: Min -> Max", nullptr, GUIDesignLabelCenterThick);
1200  // fill scale colors
1201  myScaleColors.push_back(RGBColor(232, 35, 0 ));
1202  myScaleColors.push_back(RGBColor(255, 165, 0 ));
1203  myScaleColors.push_back(RGBColor(255, 255, 0 ));
1204  myScaleColors.push_back(RGBColor(28, 215, 0 ));
1205  myScaleColors.push_back(RGBColor(0, 181, 100));
1206  myScaleColors.push_back(RGBColor(0, 255, 191));
1207  myScaleColors.push_back(RGBColor(178, 255, 255));
1208  myScaleColors.push_back(RGBColor(0, 112, 184));
1209  myScaleColors.push_back(RGBColor(56, 41, 131));
1210  myScaleColors.push_back(RGBColor(127, 0, 255));
1211  // create frame for color scale
1212  FXHorizontalFrame *horizontalFrameColors = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
1213  for (const auto &i : myScaleColors) {
1214  FXLabel *colorLabel = new FXLabel(horizontalFrameColors,"", nullptr, GUIDesignLabelLeft);
1215  colorLabel->setBackColor(MFXUtils::getFXColor(i));
1216  }
1217  // create Radio button for show edges by source weight
1218  myColorBySourceWeight = new FXRadioButton(this, "Color by Source", this, MID_CHOOSEN_OPERATION, GUIDesignRadioButton);
1219  // create Radio button for show edges by sink weight
1220  myColorBySinkWeight = new FXRadioButton(this, "Color by Sink", this, MID_CHOOSEN_OPERATION, GUIDesignRadioButton);
1221  // create Radio button for show edges by source + sink weight
1222  myColorBySourcePlusSinkWeight = new FXRadioButton(this, "Color by Source + Sink", this, MID_CHOOSEN_OPERATION, GUIDesignRadioButton);
1223  // create Radio button for show edges by source - sink weight
1224  myColorBySourceMinusSinkWeight = new FXRadioButton(this, "Color by Source - Sink", this, MID_CHOOSEN_OPERATION, GUIDesignRadioButton);
1225  // show by source as default
1226  myColorBySourceWeight->setCheck(true);
1227 }
1228 
1229 
1231 
1232 
1233 void
1235  // update edge colors
1236  updateEdgeColors();
1237  show();
1238 }
1239 
1240 
1241 void
1243  // iterate over all edges and restore color
1244  for (const auto &i : myTAZFrameParent->myTAZCurrent->getNetEdges()) {
1245  for (const auto j : i->getLanes() ) {
1246  j->setSpecialColor(nullptr);
1247  }
1248  }
1249  hide();
1250 }
1251 
1252 
1253 void
1255  // start painting all edges in gray
1256  for (const auto &i : myTAZFrameParent->myTAZCurrent->getNetEdges()) {
1257  // set candidate color (in this case, gray)
1258  for (const auto j : i->getLanes() ) {
1259  j->setSpecialColor(&myEdgeDefaultColor);
1260  }
1261  }
1262  // now paint Source/sinks colors
1263  for (const auto &i : myTAZFrameParent->myTAZCurrent->getTAZEdges()) {
1264  // set candidate color (in this case,
1265  for (const auto j : i.edge->getLanes() ) {
1266  // check what will be painted (source, sink or both)
1267  if (myColorBySourceWeight->getCheck() == TRUE) {
1268  j->setSpecialColor(&myScaleColors.at(i.sourceColor));
1269  } else if (myColorBySinkWeight->getCheck() == TRUE) {
1270  j->setSpecialColor(&myScaleColors.at(i.sinkColor));
1271  } else if (myColorBySourcePlusSinkWeight->getCheck() == TRUE) {
1272  j->setSpecialColor(&myScaleColors.at(i.sourcePlusSinkColor));
1273  } else {
1274  j->setSpecialColor(&myScaleColors.at(i.sourceMinusSinkColor));
1275  }
1276  }
1277  }
1278  // as last step paint candidate colors
1280  // set candidate selected color
1281  for (const auto &j : i.edge->getLanes() ) {
1282  j->setSpecialColor(&myEdgeSelectedColor);
1283  }
1284  }
1285  // always update view after setting new colors
1286  myTAZFrameParent->myViewNet->update();
1287 }
1288 
1289 
1290 long
1291 GNETAZFrame::TAZEdgesGraphic::onCmdChoosenBy(FXObject* obj, FXSelector, void*) {
1292  // check what radio was pressed and disable the others
1293  if (obj == myColorBySourceWeight) {
1294  myColorBySinkWeight->setCheck(FALSE);
1295  myColorBySourcePlusSinkWeight->setCheck(FALSE);
1296  myColorBySourceMinusSinkWeight->setCheck(FALSE);
1297  } else if (obj == myColorBySinkWeight) {
1298  myColorBySourceWeight->setCheck(FALSE);
1299  myColorBySourcePlusSinkWeight->setCheck(FALSE);
1300  myColorBySourceMinusSinkWeight->setCheck(FALSE);
1301  } else if (obj == myColorBySourcePlusSinkWeight) {
1302  myColorBySourceWeight->setCheck(FALSE);
1303  myColorBySinkWeight->setCheck(FALSE);
1304  myColorBySourceMinusSinkWeight->setCheck(FALSE);
1305  } else if (obj == myColorBySourceMinusSinkWeight) {
1306  myColorBySourceWeight->setCheck(FALSE);
1307  myColorBySinkWeight->setCheck(FALSE);
1308  myColorBySourcePlusSinkWeight->setCheck(FALSE);
1309  }
1310  // update edge colors
1311  updateEdgeColors();
1312  return 1;
1313 }
1314 
1315 // ---------------------------------------------------------------------------
1316 // GNETAZFrame - methods
1317 // ---------------------------------------------------------------------------
1318 
1319 GNETAZFrame::GNETAZFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet) :
1320  GNEFrame(horizontalFrameParent, viewNet, "TAZs") {
1321 
1322  // create current TAZ modul
1323  myTAZCurrent = new TAZCurrent(this);
1324 
1325  // Create TAZ Parameters modul
1326  myTAZParameters = new TAZParameters(this);
1327 
1330 
1331  // Create drawing controls modul
1332  myDrawingShape = new DrawingShape(this);
1333 
1334  // Create TAZ Edges Common Statistics modul
1336 
1337  // Create save TAZ Edges modul
1338  myTAZSaveChanges = new TAZSaveChanges(this);
1339 
1340  // Create TAZ Edges Common Parameters modul
1342 
1343  // Create TAZ Edges Selection Statistics modul
1345 
1346  // Create TAZ Edges Common Parameters modul
1347  myTAZEdgesGraphic = new TAZEdgesGraphic(this);
1348 
1349  // by default there isn't a TAZ
1350  myTAZCurrent->setTAZ(nullptr);
1351 }
1352 
1353 
1355 }
1356 
1357 
1358 void
1360  // hide frame
1361  GNEFrame::hide();
1362 }
1363 
1364 
1365 bool
1366 GNETAZFrame::processClick(const Position& clickedPosition, const GNEViewNet::ObjectsUnderCursor &objectsUnderCursor) {
1367  // Declare map to keep values
1368  std::map<SumoXMLAttr, std::string> valuesOfElement;
1369  if (myDrawingShape->isDrawing()) {
1370  // add or delete a new point depending of flag "delete last created point"
1373  } else {
1374  myDrawingShape->addNewPoint(clickedPosition);
1375  }
1376  return true;
1377  } else if ((myTAZCurrent->getTAZ() == nullptr) || (objectsUnderCursor.getTAZFront() && myTAZCurrent->getTAZ() && !myTAZSaveChanges->isChangesPending())) {
1378  // if user click over an TAZ and there isn't changes pending, then select a new TAZ
1379  if (objectsUnderCursor.getTAZFront()) {
1380  // avoid reset of Frame if user doesn't click over an TAZ
1381  myTAZCurrent->setTAZ(objectsUnderCursor.getTAZFront());
1382  return true;
1383  } else {
1384  return false;
1385  }
1386  } else if (objectsUnderCursor.getEdgeFront()) {
1387  // if toogle Edge is enabled, select edge. In other case create two new TAZSource/Sinks
1389  // create new TAZSource/Sinks or delete it
1390  return addOrRemoveTAZMember(objectsUnderCursor.getEdgeFront());
1391  } else {
1392  // first check if clicked edge was previously selected
1393  if (myTAZSelectionStatistics->isEdgeSelected(objectsUnderCursor.getEdgeFront())) {
1394  // clear selected edges
1396  } else {
1397  // iterate over TAZEdges saved in TAZCurrent (it contains the Edge and Source/sinks)
1398  for (const auto &i : myTAZCurrent->getTAZEdges()) {
1399  if (i.edge == objectsUnderCursor.getEdgeFront()) {
1400  // clear current selection (to avoid having two or more edges selected at the same time using mouse clicks)
1402  // now select edge
1404  // edge selected, then return true
1405  return true;
1406  }
1407  }
1408  }
1409  // edge wasn't selected, then return false
1410  return false;
1411  }
1412  } else {
1413  // nothing to do
1414  return false;
1415  }
1416 }
1417 
1418 
1419 void
1420 GNETAZFrame::processEdgeSelection(const std::vector<GNEEdge*>& edges) {
1421  // first check that a TAZ is selected
1422  if (myTAZCurrent->getTAZ()) {
1423  // if "toogle Membership" is enabled, create new TAZSources/sinks. In other case simply select edges
1425  // iterate over edges
1426  for (auto i : edges) {
1427  // first check if edge owns a TAZEge
1428  if (myTAZCurrent->isTAZEdge(i) == false) {
1429  // create new TAZ Sources/Sinks
1431  }
1432  }
1433  } else {
1434  // iterate over edges
1435  for (auto i : edges) {
1436  // first check that selected edge isn't already selected
1438  // iterate over TAZEdges saved in TAZCurrent (it contains the Edge and Source/sinks)
1439  for (const auto &j : myTAZCurrent->getTAZEdges()) {
1440  if (j.edge == i) {
1442  }
1443  }
1444  }
1445  }
1446  }
1447  }
1448 }
1449 
1450 
1453  return myDrawingShape;
1454 }
1455 
1456 
1459  return myTAZCurrent;
1460 }
1461 
1462 
1465  return myTAZSelectionStatistics;
1466 }
1467 
1468 
1471  return myTAZSaveChanges;
1472 }
1473 
1474 
1475 bool
1477  // show warning dialogbox and stop check if input parameters are valid
1479  return false;
1480  } else if (myDrawingShape->getTemporalShape().size() == 0) {
1481  WRITE_WARNING("TAZ shape cannot be empty");
1482  return false;
1483  } else {
1484  // Declare map to keep TAZ Parameters values
1485  std::map<SumoXMLAttr, std::string> valuesOfElement = myTAZParameters->getAttributesAndValues();
1486 
1487  // obtain Netedit attributes
1488  myNeteditAttributes->getNeteditAttributesAndValues(valuesOfElement, nullptr);
1489 
1490  // generate new ID
1492 
1493  // obtain shape and close it
1495  shape.closePolygon();
1496  valuesOfElement[SUMO_ATTR_SHAPE] = toString(shape);
1497 
1498  // check if TAZ has to be created with edges
1500  std::vector<std::string> edgeIDs;
1501  auto ACsInBoundary = myViewNet->getAttributeCarriersInBoundary(shape.getBoxBoundary(), true);
1502  for (auto i : ACsInBoundary) {
1503  if (i.second->getTagProperty().getTag() == SUMO_TAG_EDGE) {
1504  edgeIDs.push_back(i.first);
1505  }
1506  }
1507  valuesOfElement[SUMO_ATTR_EDGES] = toString(edgeIDs);
1508  } else {
1509  // TAZ is created without edges
1510  valuesOfElement[SUMO_ATTR_EDGES] = "";
1511  }
1512  // return true if TAZ was successfully created
1513  return GNEAdditionalHandler::buildAdditional(myViewNet, true, SUMO_TAG_TAZ, valuesOfElement) != nullptr;
1514  }
1515 }
1516 
1517 
1518 bool
1520  // first check if edge exist;
1521  if (edge) {
1522  // first check if already exist (in this case, remove it)
1523  for (const auto &i : myTAZCurrent->getTAZEdges()) {
1524  if (i.edge == edge) {
1525  // enable save changes button
1527  // remove Source and Sinks using GNEChange_Additional
1528  myViewNet->getUndoList()->add(new GNEChange_Additional(i.TAZSource, false), true);
1529  myViewNet->getUndoList()->add(new GNEChange_Additional(i.TAZSink, false), true);
1530  // always refresh TAZ Edges after removing TAZSources/Sinks
1532  // update select edges button
1534  return true;
1535  }
1536  }
1537  // if wasn't found, then add it
1539  // create TAZ Sink using GNEChange_Additional and value of TAZChild default parameters
1541  myViewNet->getUndoList()->add(new GNEChange_Additional(TAZSource, true), true);
1542  // create TAZ Sink using GNEChange_Additional and value of TAZChild default parameters
1544  myViewNet->getUndoList()->add(new GNEChange_Additional(TAZSink, true), true);
1545  // always refresh TAZ Edges after adding TAZSources/Sinks
1547  // update selected button
1549  return true;
1550  } else {
1551  throw ProcessError("Edge cannot be null");
1552  }
1553 }
1554 
1555 
1556 void
1558  // iterate over all TAZEdges
1559  for (const auto &i : myTAZCurrent->getTAZEdges()) {
1560  // enable save changes button
1562  // remove Source and Sinks using GNEChange_Additional
1563  myViewNet->getUndoList()->add(new GNEChange_Additional(i.TAZSource, false), true);
1564  myViewNet->getUndoList()->add(new GNEChange_Additional(i.TAZSink, false), true);
1565  }
1566  // always refresh TAZ Edges after removing TAZSources/Sinks
1568 }
1569 
1570 /****************************************************************************/
double myMaxSourceMinusSinkWeight
maximum source minus sink value of current TAZ Edges
Definition: GNETAZFrame.h:138
TAZSelectionStatistics * getTAZSelectionStatisticsModul() const
get TAZ Selection Statistics modul
average sink (used only by TAZs)
TAZParameters * myTAZParameters
TAZ parameters.
Definition: GNETAZFrame.h:557
static const TagProperties & getTagProperties(SumoXMLTag tag)
get Tag Properties
void hideNeteditAttributesModul()
hide Netedit attributes modul
Definition: GNEFrame.cpp:1435
std::set< std::pair< std::string, GNEAttributeCarrier * > > getAttributeCarriersInBoundary(const Boundary &boundary, bool forceSelectEdges=false)
get AttributeCarriers in Boundary
Definition: GNEViewNet.cpp:585
GNEAdditional * TAZSource
source TAZ
Definition: GNETAZFrame.h:59
static RGBColor parseColor(std::string coldef)
Parses a color information.
Definition: RGBColor.cpp:177
#define GUIDesignCheckButtonAttribute
checkButton without thick extended over the frame used for attributes
Definition: GUIDesigns.h:115
GNETAZ * getTAZ() const
get current TAZ
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
Definition: GNENet.cpp:900
#define GUIDesignButtonAttribute
button extended over over column with thick and raise frame
Definition: GUIDesigns.h:57
a source within a district (connection road)
TAZChildDefaultParameters * myTAZChildDefaultParameters
TAZ child defaults parameters.
Definition: GNETAZFrame.h:569
void hide()
hide TAZ frame
FXTextField * myTextFieldTAZSinkWeight
textField for TAZ Sink weight
Definition: GNETAZFrame.h:370
struct for edges and the source/sink colors
Definition: GNETAZFrame.h:45
TAZEdgesGraphic()
FOX needs this.
Definition: GNETAZFrame.h:474
FXHorizontalFrame * myTAZSinkFrame
Horizontal Frame for default TAZ Sink Weight.
Definition: GNETAZFrame.h:367
void showTAZParametersModul()
show TAZ parameters and set the default value of parameters
bool unselectEdge(GNEEdge *edge)
un select an edge (and their TAZ Childs)
void hideTAZSelectionStatisticsModul()
hide TAZ Selection Statistics Modul
static const RGBColor WHITE
Definition: RGBColor.h:191
FXButton * myCancelChangesButton
FXButton for cancel changes in TAZEdges
Definition: GNETAZFrame.h:223
FXLabel * myStatisticsLabel
Statistics labels.
Definition: GNETAZFrame.h:172
a traffic assignment zone
FXRadioButton * myColorBySourceMinusSinkWeight
add radio button "color source - Sink"
Definition: GNETAZFrame.h:490
FXHorizontalFrame * myTAZSourceFrame
Horizontal Frame for default TAZ Source Weight.
Definition: GNETAZFrame.h:361
TAZEdgesGraphic * myTAZEdgesGraphic
TAZ Edges Graphic.
Definition: GNETAZFrame.h:575
void updateStatistics()
update Statistics label
static RGBColor getRGBColor(FXColor col)
converts FXColor to RGBColor
Definition: MFXUtils.cpp:108
GNETAZ * getTAZFront() const
get front TAZ (or a pointer to nullptr if there isn&#39;t)
Definition: GNEViewNet.cpp:397
void hideTAZCommonStatisticsModul()
hide TAZ Common Statistics Modul
bool getToggleMembership() const
check if toggle membership is enabled
void removeLastPoint()
remove last added point
Definition: GNEFrame.cpp:1291
TAZSelectionStatistics()
FOX needs this.
Definition: GNETAZFrame.h:351
void hideTAZSaveChangesModul()
hide TAZ Save Changes Modul
void hideDrawingShape()
hide Drawing mode
Definition: GNEFrame.cpp:1230
Color of TAZSources/TAZChilds.
long onCmdUseSelectedEdges(FXObject *obj, FXSelector, void *)
Called when the user press use selected edges.
std::vector< RGBColor > myScaleColors
vector wit the scale colors
Definition: GNETAZFrame.h:493
TAZCurrent * getTAZCurrentModul() const
get Current TAZ modul
~GNETAZFrame()
Destructor.
void p_begin(const std::string &description)
Begin undo command sub-group. This begins a new group of commands that are treated as a single comman...
Definition: GNEUndoList.cpp:73
void clearSelectedEdges()
clear current TAZ childs
void showTAZChildDefaultParametersModul()
show TAZ child default parameters Modul
void processEdgeSelection(const std::vector< GNEEdge *> &edges)
process selection of edges in view net
max source (used only by TAZs)
int sourceColor
color by source [0-9]
Definition: GNETAZFrame.h:65
min sink (used only by TAZs)
FXButton * myUseSelectedEdges
button for use selected edges
Definition: GNETAZFrame.h:292
void hideTAZParametersModul()
hide TAZ parameters
FXCheckButton * myToggleMembership
CheckButton to enable or disable Toggle edge Membership.
Definition: GNETAZFrame.h:277
FXTextField * myTextFieldColor
textField to modify the default value of color parameter
Definition: GNETAZFrame.h:433
long onCmdSetAttribute(FXObject *, FXSelector, void *)
Called when user set a value.
double myDefaultTAZSinkWeight
default TAZSink weight
Definition: GNETAZFrame.h:301
bool isChangesPending() const
return true if there is changes to save
virtual std::string getAttribute(SumoXMLAttr key) const =0
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:241
long onCmdSetDefaultValues(FXObject *obj, FXSelector, void *)
void showNeteditAttributesModul(const GNEAttributeCarrier::TagProperties &tagValue)
show Netedit attributes modul
Definition: GNEFrame.cpp:1384
void enableButtonsAndBeginUndoList()
enable buttons save and cancel changes (And begin Undo List)
GNEViewNet * myViewNet
View Net for changes.
Definition: GNEFrame.h:612
TAZChildDefaultParameters()
FOX needs this.
Definition: GNETAZFrame.h:270
GNETAZFrame * myTAZFrameParent
pointer to GNETAZFrame parent
Definition: GNETAZFrame.h:427
GNEEdge * getEdgeFront() const
get front edge (or a pointer to nullptr if there isn&#39;t)
Definition: GNEViewNet.cpp:357
void addTAZChild(GNEAdditional *additional)
add TAZChild
long onCmdSetNewValues(FXObject *obj, FXSelector, void *)
const std::vector< GNEEdge * > & getSelectedEdges() const
get current selected edges
FXLabel * myStatisticsLabel
Statistics labels.
Definition: GNETAZFrame.h:373
int sourceMinusSinkColor
color by source - sink [0-9]
Definition: GNETAZFrame.h:74
void showTAZSelectionStatisticsModul()
show TAZ Selection Statistics Modul
GNEUndoList * getUndoList() const
get the undoList object
bool addOrRemoveTAZMember(GNEEdge *edge)
add or remove a TAZSource and a TAZSink, or remove it if edge is in the list of TAZ Childs ...
double myMinSourceMinusSinkWeight
minimum source minus sink value of current TAZ Edges
Definition: GNETAZFrame.h:141
set type of selection
Definition: GUIAppEnum.h:344
min source (used only by TAZs)
std::vector< TAZEdge > myTAZEdges
vector with TAZ&#39;s edges
Definition: GNETAZFrame.h:126
#define GUIDesignTextField
Definition: GUIDesigns.h:34
the edges of a route
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:49
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
double myMinSourcePlusSinkWeight
minimum source plus sink value of current TAZ Edges
Definition: GNETAZFrame.h:135
FXVerticalFrame * myContentFrame
Vertical frame that holds all widgets of frame.
Definition: GNEFrame.h:615
max sink (used only by TAZs)
DrawingShape * getDrawingShapeModul() const
get drawing mode modul
double myMaxSourcePlusSinkWeight
maximum source plus sink value of current TAZ Edges
Definition: GNETAZFrame.h:132
RGBColor myEdgeDefaultColor
default RGBColor for all edges
Definition: GNETAZFrame.h:496
help button
Definition: GUIAppEnum.h:400
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
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise, the sub-group will be added as a new command into parent group. A matching begin() must have been called previously.
Definition: GNEUndoList.cpp:80
GNETAZFrame * myTAZFrameParent
pointer to TAZFrame parent
Definition: GNETAZFrame.h:274
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames ...
Definition: GUIDesigns.h:261
A list of positions.
FXButton * myColorEditor
Button for open color editor.
Definition: GNETAZFrame.h:430
void showTAZEdgesGraphicModul()
show TAZ Edges Graphic Modul
GNETAZFrame * myTAZFrameParent
pointer to TAZ Frame
Definition: GNETAZFrame.h:114
int sourcePlusSinkColor
color by source + sink [0-9]
Definition: GNETAZFrame.h:71
void showDrawingShape()
show Drawing mode
Definition: GNEFrame.cpp:1222
TAZSelectionStatistics * myTAZSelectionStatistics
TAZ Edges selection parameters.
Definition: GNETAZFrame.h:572
std::string getAttribute(SumoXMLAttr key) const
Definition: GNETAZ.cpp:326
TAZCurrent * myTAZCurrentParent
pointer to TAZCurrentParent
Definition: GNETAZFrame.h:78
TAZSaveChanges()
FOX needs this.
Definition: GNETAZFrame.h:213
long onCmdSaveChanges(FXObject *, FXSelector, void *)
FXRadioButton * myColorBySourceWeight
add radio button "color by source"
Definition: GNETAZFrame.h:481
const std::vector< GNEEdge * > & getNetEdges() const
get current net edges
bool isCurrentParametersValid() const
check if current parameters are valid
long onCmdSetColorAttribute(FXObject *, FXSelector, void *)
FXDEFMAP(GNETAZFrame::TAZParameters) TAZParametersMap[]
GNETAZFrame * myTAZFrameParent
pointer to TAZFrame parent
Definition: GNETAZFrame.h:169
attribute edited trought dialog
Definition: GUIAppEnum.h:547
Definition: GNETAZ.h:35
long onCmdChoosenBy(FXObject *obj, FXSelector, void *)
void hideTAZChildDefaultParametersModul()
hide TAZ child default parameters Modul
GNEEdge * edge
TAZ edge.
Definition: GNETAZFrame.h:56
edge: the shape in xml-definition
const PositionVector & getTemporalShape() const
get Temporal shape
Definition: GNEFrame.cpp:1297
FXHorizontalFrame * myDefaultTAZSourceFrame
Horizontal Frame for default TAZ Source Weight.
Definition: GNETAZFrame.h:280
bool processClick(const Position &clickedPosition, const GNEViewNet::ObjectsUnderCursor &objectsUnderCursor)
process click over Viewnet
const std::string getID() const
function to support debugging
NeteditAttributes * myNeteditAttributes
Netedit parameter.
Definition: GNETAZFrame.h:560
void refreshTAZEdges()
refresh TAZEdges
FXCheckButton * myAddEdgesWithinCheckButton
CheckButton to enable or disable use edges within TAZ after creation.
Definition: GNETAZFrame.h:436
GNETAZFrame * myTAZFrameParent
pointer to TAZFrame parent
Definition: GNETAZFrame.h:478
FXTextField * myTextFieldDefaultValueTAZSources
textField to set a default value for TAZ Sources
Definition: GNETAZFrame.h:283
#define GUIDesignLabelCenter
label extended over frame without thick and with text justify to center and height of 23 ...
Definition: GUIDesigns.h:151
void hideTAZEdgesGraphicModul()
hide TAZ Edges Graphic Modul
TAZSaveChanges * myTAZSaveChanges
save TAZ Edges
Definition: GNETAZFrame.h:566
bool getNeteditAttributesAndValues(std::map< SumoXMLAttr, std::string > &valuesMap, GNELane *lane) const
fill valuesMap with netedit attributes
Definition: GNEFrame.cpp:1441
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
Definition: GUIDesigns.h:184
void updateEdgeColors()
update edge colors;
GNEAdditional * TAZSink
sink TAZ
Definition: GNETAZFrame.h:62
void p_abort()
reverts and discards ALL active command groups
Definition: GNEUndoList.cpp:94
#define GUIDesignButtonRectangular
little button rectangular (46x23) used in frames (For example, in "help" buttons) ...
Definition: GUIDesigns.h:60
bool isTAZEdge(GNEEdge *edge) const
check if given edge belongs to current TAZ
void addNewPoint(const Position &P)
add new point to temporal shape
Definition: GNEFrame.cpp:1281
int sinkColor
color by sink [0-9]
Definition: GNETAZFrame.h:68
void updateStatistics()
update TAZSelectionStatistics
FXButton * myHelpTAZAttribute
button for help
Definition: GNETAZFrame.h:439
begin/end of the description of an edge
GNETAZFrame * myTAZFrameParent
pointer to TAZFrame parent
Definition: GNETAZFrame.h:217
select items
Definition: GUIAppEnum.h:549
long onCmdHelp(FXObject *, FXSelector, void *)
Called when help button is pressed.
std::vector< TAZCurrent::TAZEdge > myEdgeAndTAZChildsSelected
vector with the current selected edges and their associated childs
Definition: GNETAZFrame.h:376
bool selectEdge(const TAZCurrent::TAZEdge &edge)
add an edge and their TAZ Childs in the list of selected items
bool isDrawing() const
return true if currently a shape is drawed
Definition: GNEFrame.cpp:1303
const std::vector< TAZCurrent::TAZEdge > & getTAZEdges() const
get TAZEdges
#define GUIDesignLabelCenterThick
label extended over frame with thick and with text justify to center and height of 23 ...
Definition: GUIDesigns.h:163
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:50
FXHorizontalFrame * myDefaultTAZSinkFrame
Horizontal Frame for default TAZ Sink Weight.
Definition: GNETAZFrame.h:286
std::map< SumoXMLAttr, std::string > getAttributesAndValues() const
get a map with attributes and their values
~TAZEdge()
destructor (needed because RGBColors has to be deleted)
Definition: GNETAZFrame.cpp:96
#define GUIDesignTextFieldNCol
Num of column of text field.
Definition: GUIDesigns.h:46
void setTAZ(GNETAZ *editedTAZ)
set current TAZ
double myDefaultTAZSourceWeight
default TAZSource weight
Definition: GNETAZFrame.h:298
GNETAZFrame(FXHorizontalFrame *horizontalFrameParent, GNEViewNet *viewNet)
Constructor.
double getDefaultTAZSourceWeight() const
get default TAZSource weight
RGBColor myEdgeSelectedColor
RGBColor color for selected egdes.
Definition: GNETAZFrame.h:499
#define GUIDesignButton
Definition: GUIDesigns.h:54
void showTAZCommonStatisticsModul()
show TAZ Common Statistics Modul
std::string generateAdditionalID(SumoXMLTag type) const
generate additional id
Definition: GNENet.cpp:1902
virtual void show()
show Frame
Definition: GNEFrame.cpp:1695
a sink within a district (connection road)
FXLabel * myInformationLabel
information label
Definition: GNETAZFrame.h:295
std::vector< GNEEdge * > retrieveEdges(bool onlySelected=false)
return all edges
Definition: GNENet.cpp:1031
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:48
#define GUIDesignGroupBoxFrame
Group box design extended over frame.
Definition: GUIDesigns.h:227
static GNEAdditional * buildAdditional(GNEViewNet *viewNet, bool allowUndoRedo, SumoXMLTag tag, std::map< SumoXMLAttr, std::string > values)
Build additionals.
bool isAddEdgesWithinEnabled() const
check if edges within has to be used after TAZ Creation
TAZCurrent * myTAZCurrent
current TAZ
Definition: GNETAZFrame.h:551
FXTextField * myTextFieldTAZSourceWeight
textField for TAZ Source weight
Definition: GNETAZFrame.h:364
element is selected
const std::vector< TAZCurrent::TAZEdge > & getEdgeAndTAZChildsSelected() const
get map with edge and TAZChilds
TAZCommonStatistics(GNETAZFrame *TAZFrameParent)
constructor
TAZSaveChanges * getTAZSaveChangesModul() const
get TAZ Save Changes modul
FXRadioButton * myColorBySourcePlusSinkWeight
add radio button "color source + sink"
Definition: GNETAZFrame.h:487
TAZCurrent(GNETAZFrame *TAZFrameParent)
constructor
Ok-button pressed.
Definition: GUIAppEnum.h:56
virtual void hide()
hide Frame
Definition: GNEFrame.cpp:1704
TAZParameters()
FOX needs this.
Definition: GNETAZFrame.h:423
Cancel-button pressed.
Definition: GUIAppEnum.h:58
GNETAZ * myEditedTAZ
current edited TAZ
Definition: GNETAZFrame.h:117
GNENet * getNet() const
get the net object
#define GUIDesignTextFieldReal
text field extended over Frame with thick frame and limited to Doubles/doubles
Definition: GUIDesigns.h:40
static FXColor getFXColor(const RGBColor &col)
converts FXColor to RGBColor
Definition: MFXUtils.cpp:114
FXButton * mySaveChangesButton
FXButton for save changes in TAZEdges
Definition: GNETAZFrame.h:220
void updateColors()
update colors
attribute edited
Definition: GUIAppEnum.h:537
average source (used only by TAZs)
FXRadioButton * myColorBySinkWeight
add radio button "color by sink"
Definition: GNETAZFrame.h:484
const TagProperties & getTagProperty() const
get Tag Property assigned to this object
void openHelpAttributesDialog(const GNEAttributeCarrier::TagProperties &tagProperties) const
Open help attributes dialog.
Definition: GNEFrame.cpp:1757
void updateSelectEdgesButton()
update "select edges button"
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
long onCmdSelectEdges(FXObject *obj, FXSelector, void *)
Called when the user press select edges.
void showTAZSaveChangesModul()
show TAZ Save Changes Modul
std::vector< GNEEdge * > mySelectedEdges
vector with pointers to selected edges
Definition: GNETAZFrame.h:123
DrawingShape * myDrawingShape
Drawing shape.
Definition: GNETAZFrame.h:563
bool getDeleteLastCreatedPoint()
get flag delete last created point
Definition: GNEFrame.cpp:1315
#define GUIDesignLabelLeft
Definition: GUIDesigns.h:145
double getDefaultTAZSinkWeight() const
default TAZSink weight
#define GUIDesignLabelAttribute
label extended over the matrix column with thick frame and height of 23
Definition: GUIDesigns.h:166
#define GUIDesignRadioButton
Definition: GUIDesigns.h:135
FXLabel * myTAZCurrentLabel
Label for current TAZ.
Definition: GNETAZFrame.h:129
const std::vector< GNEAdditional * > & getAdditionalChilds() const
return vector of additionals that have as Parent this edge (For example, Calibrators) ...
long onCmdCancelChanges(FXObject *, FXSelector, void *)
Called when the user press the button cancel changes.
void closePolygon()
ensures that the last position equals the first
GNETAZFrame * myTAZFrameParent
pointer to TAZFrame parent
Definition: GNETAZFrame.h:358
TAZCommonStatistics * myTAZCommonStatistics
TAZ Edges common parameters.
Definition: GNETAZFrame.h:554
A color information.
bool buildShape()
build a shaped element using the drawed shape return true if was sucesfully created ...
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
Definition: ToString.h:237
FXTextField * myTextFieldDefaultValueTAZSinks
textField to set a default value for TAZ Sinks
Definition: GNETAZFrame.h:289
std::vector< GNEEdge * > myNetEdges
vector with pointers to edges (it&#39;s used to avoid slowdowns during Source/Sinks manipulations) ...
Definition: GNETAZFrame.h:120
bool isEdgeSelected(GNEEdge *edge)
check if an edge is selected