Eclipse SUMO - Simulation of Urban MObility
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
GNETAZFrame.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2025 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
22#include <netedit/GNENet.h>
24#include <netedit/GNEUndoList.h>
33
34#include "GNETAZFrame.h"
35
36// ===========================================================================
37// FOX callback mapping
38// ===========================================================================
39
44
50
54
58
59// Object implementation
60FXIMPLEMENT(GNETAZFrame::TAZSaveChanges, MFXGroupBoxModule, TAZSaveChangesMap, ARRAYNUMBER(TAZSaveChangesMap))
61FXIMPLEMENT(GNETAZFrame::TAZChildDefaultParameters, MFXGroupBoxModule, TAZChildDefaultParametersMap, ARRAYNUMBER(TAZChildDefaultParametersMap))
62FXIMPLEMENT(GNETAZFrame::TAZSelectionStatistics, MFXGroupBoxModule, TAZSelectionStatisticsMap, ARRAYNUMBER(TAZSelectionStatisticsMap))
63FXIMPLEMENT(GNETAZFrame::TAZEdgesGraphic, MFXGroupBoxModule, TAZEdgesGraphicMap, ARRAYNUMBER(TAZEdgesGraphicMap))
64
65
66// ===========================================================================
67// method definitions
68// ===========================================================================
69
70// ---------------------------------------------------------------------------
71// GNETAZFrame::CurrentTAZ - methods
72// ---------------------------------------------------------------------------
73
75 edge(_edge),
76 source(_source),
77 sink(_sink),
78 sourceColor(0),
79 sinkColor(0),
80 sourcePlusSinkColor(0),
81 sourceMinusSinkColor(0),
82 myCurrentTAZParent(CurrentTAZParent) {
83}
84
85
87
88
89void
91 sourceColor = source ? GNEAttributeCarrier::parse<int>(source->getAttribute(GNE_ATTR_TAZCOLOR)) : 0;
92 sinkColor = sink ? GNEAttributeCarrier::parse<int>(sink->getAttribute(GNE_ATTR_TAZCOLOR)) : 0;
93 double sourceWeight = source ? source->getWeight() : 0;
94 double sinkWeight = sink ? sink->getWeight() : 0;
95 // Obtain Source+Sink needs more steps. First obtain Source+Sink Weight
96 double sourcePlusSinkWeight = sourceWeight + sinkWeight;
97 // avoid division between zero
98 if ((myCurrentTAZParent->myMaxSourcePlusSinkWeight - myCurrentTAZParent->myMinSourcePlusSinkWeight) == 0) {
99 sourcePlusSinkColor = 0;
100 } else {
101 // calculate percentage relative to the max and min Source+Sink weight
102 double percentage = (sourcePlusSinkWeight - myCurrentTAZParent->myMinSourcePlusSinkWeight) /
103 (myCurrentTAZParent->myMaxSourcePlusSinkWeight - myCurrentTAZParent->myMinSourcePlusSinkWeight);
104 // convert percentage to a value between [0-9] (because we have only 10 colors)
105 if (percentage >= 1) {
106 sourcePlusSinkColor = 9;
107 } else if (percentage < 0) {
108 sourcePlusSinkColor = 0;
109 } else {
110 sourcePlusSinkColor = (int)(percentage * 10);
111 }
112 }
113 // Obtain Source+Sink needs more steps. First obtain Source-Sink Weight
114 double sourceMinusSinkWeight = sourceWeight - sinkWeight;
115 // avoid division between zero
116 if ((myCurrentTAZParent->myMaxSourceMinusSinkWeight - myCurrentTAZParent->myMinSourceMinusSinkWeight) == 0) {
117 sourceMinusSinkColor = 0;
118 } else {
119 // calculate percentage relative to the max and min Source-Sink weight
120 double percentage = (sourceMinusSinkWeight - myCurrentTAZParent->myMinSourceMinusSinkWeight) /
121 (myCurrentTAZParent->myMaxSourceMinusSinkWeight - myCurrentTAZParent->myMinSourceMinusSinkWeight);
122 // convert percentage to a value between [0-9] (because we have only 10 colors)
123 if (percentage >= 1) {
124 sourceMinusSinkColor = 9;
125 } else if (percentage < 0) {
126 sourceMinusSinkColor = 0;
127 } else {
128 sourceMinusSinkColor = (int)(percentage * 10);
129 }
130 }
131}
132
133
135 edge(nullptr),
136 source(nullptr),
137 sink(nullptr),
138 sourceColor(0),
139 sinkColor(0),
140 sourcePlusSinkColor(0),
141 sourceMinusSinkColor(0),
142 myCurrentTAZParent(nullptr) {
143}
144
145
147 MFXGroupBoxModule(TAZFrameParent, TL("TAZ")),
148 myTAZFrameParent(TAZFrameParent),
149 myEditedTAZ(nullptr),
154 // create TAZ label
155 myCurrentTAZLabel = new FXLabel(getCollapsableFrame(), TL("No TAZ selected"), 0, GUIDesignLabel(JUSTIFY_LEFT));
156}
157
158
160
161
162void
164 // set new current TAZ
165 myEditedTAZ = editedTAZ;
166 // update label and moduls
167 if (myEditedTAZ != nullptr) {
168 myCurrentTAZLabel->setText((TL("Current TAZ: ") + myEditedTAZ->getID()).c_str());
169 // obtain a copy of all SELECTED edges of the net (to avoid slowdown during manipulations)
170 mySelectedEdges = myTAZFrameParent->myViewNet->getNet()->getAttributeCarriers()->getSelectedEdges();
171 // refresh TAZ Edges
172 refreshTAZEdges();
173 // hide TAZ parameters
174 myTAZFrameParent->myTAZAttributesEditor->hideAttributesEditor();
175 // hide drawing shape
176 myTAZFrameParent->myDrawingShape->hideDrawingShape();
177 // show edge common parameters
178 myTAZFrameParent->myTAZCommonStatistics->showTAZCommonStatisticsModule();
179 // show save TAZ Edges
180 myTAZFrameParent->myTAZSaveChanges->showTAZSaveChangesModule();
181 // show edge common parameters
182 myTAZFrameParent->myTAZChildDefaultParameters->extendTAZChildDefaultParameters();
183 // show Edges graphics
184 myTAZFrameParent->myTAZEdgesGraphic->showTAZEdgesGraphicModule();
185 } else {
186 // show TAZ parameters
187 myTAZFrameParent->myTAZAttributesEditor->showAttributesEditor(myTAZFrameParent->getViewNet()->getNet()->getACTemplates()->getTemplateAC(SUMO_TAG_TAZ), true);
188 // show drawing shape
189 myTAZFrameParent->myDrawingShape->showDrawingShape();
190 // hide edge common parameters
191 myTAZFrameParent->myTAZCommonStatistics->hideTAZCommonStatisticsModule();
192 // hide edge common parameters
193 myTAZFrameParent->myTAZChildDefaultParameters->collapseTAZChildDefaultParameters();
194 // hide Edges graphics
195 myTAZFrameParent->myTAZEdgesGraphic->hideTAZEdgesGraphicModule();
196 // hide save TAZ Edges
197 myTAZFrameParent->myTAZSaveChanges->hideTAZSaveChangesModule();
198 // restore label
199 myCurrentTAZLabel->setText(TL("No TAZ selected"));
200 // clear selected edges
201 mySelectedEdges.clear();
202 // reset all weight values
203 myMaxSourcePlusSinkWeight = 0;
204 myMinSourcePlusSinkWeight = -1;
205 myMaxSourceMinusSinkWeight = 0;
206 myMinSourceMinusSinkWeight = -1;
207 }
208}
209
210
211GNETAZ*
213 return myEditedTAZ;
214}
215
216
217bool
219 // simply iterate over edges and check edge parameter
220 for (const auto& TAZEdgeColor : myTAZEdgeColors) {
221 if (TAZEdgeColor.edge == edge) {
222 return true;
223 }
224 }
225 // not found, then return false
226 return false;
227}
228
229
230const std::vector<GNEEdge*>&
232 return mySelectedEdges;
233}
234
235
236const std::vector<GNETAZFrame::CurrentTAZ::TAZEdgeColor>&
238 return myTAZEdgeColors;
239}
240
241
242void
244 // clear all curren TAZEdges
245 myTAZEdgeColors.clear();
246 // clear weight values
247 myMaxSourcePlusSinkWeight = 0;
248 myMinSourcePlusSinkWeight = -1;
249 myMaxSourceMinusSinkWeight = 0;
250 myMinSourceMinusSinkWeight = -1;
251 // only refresh if we're editing an TAZ
252 if (myEditedTAZ) {
253 // first update TAZ Statistics
254 myEditedTAZ->updateTAZStatistic();
255 myTAZFrameParent->myTAZCommonStatistics->updateStatistics();
256 // iterate over child TAZElements and create TAZEdges
257 for (const auto& TAZSourceSink : myEditedTAZ->getChildTAZSourceSinks()) {
258 addSourceSink(TAZSourceSink);
259 }
260 // update colors after add all edges
261 for (auto& TAZEdgeColor : myTAZEdgeColors) {
263 }
264 // update edge colors
265 myTAZFrameParent->myTAZEdgesGraphic->updateEdgeColors();
266 }
267}
268
269
270void
272 GNEEdge* edge = myTAZFrameParent->myViewNet->getNet()->getAttributeCarriers()->retrieveEdge(sourceSink->getAttribute(SUMO_ATTR_EDGE));
273 // first check if TAZEdgeColor has to be created
274 bool createTAZEdge = true;
275 for (auto& TAZEdgeColor : myTAZEdgeColors) {
276 if (TAZEdgeColor.edge == edge) {
277 createTAZEdge = false;
278 // update TAZ Source or Sink
279 if (sourceSink->getTagProperty()->getTag() == SUMO_TAG_TAZSOURCE) {
280 TAZEdgeColor.source = sourceSink;
281 } else {
282 TAZEdgeColor.sink = sourceSink;
283 }
284 }
285 }
286 // check if TAZElements has to be created
287 if (createTAZEdge) {
288 if (sourceSink->getTagProperty()->getTag() == SUMO_TAG_TAZSOURCE) {
289 myTAZEdgeColors.push_back(TAZEdgeColor(this, edge, sourceSink, nullptr));
290 } else {
291 myTAZEdgeColors.push_back(TAZEdgeColor(this, edge, nullptr, sourceSink));
292 }
293 }
294 // recalculate weights
295 myMaxSourcePlusSinkWeight = 0;
296 myMinSourcePlusSinkWeight = -1;
297 myMaxSourceMinusSinkWeight = 0;
298 myMinSourceMinusSinkWeight = -1;
299 for (const auto& TAZEdgeColor : myTAZEdgeColors) {
300 // make sure that both TAZ Source and Sink exist
302 // obtain source plus sink
303 double sourcePlusSink = TAZEdgeColor.source->getWeight() + TAZEdgeColor.sink->getWeight();
304 // check myMaxSourcePlusSinkWeight
305 if (sourcePlusSink > myMaxSourcePlusSinkWeight) {
306 myMaxSourcePlusSinkWeight = sourcePlusSink;
307 }
308 // check myMinSourcePlusSinkWeight
309 if ((myMinSourcePlusSinkWeight == -1) || (sourcePlusSink < myMinSourcePlusSinkWeight)) {
310 myMinSourcePlusSinkWeight = sourcePlusSink;
311 }
312 // obtain source minus sink
313 double sourceMinusSink = TAZEdgeColor.source->getWeight() - TAZEdgeColor.sink->getWeight();
314 // use valor absolute
315 if (sourceMinusSink < 0) {
316 sourceMinusSink *= -1;
317 }
318 // check myMaxSourcePlusSinkWeight
319 if (sourceMinusSink > myMaxSourceMinusSinkWeight) {
320 myMaxSourceMinusSinkWeight = sourceMinusSink;
321 }
322 // check myMinSourcePlusSinkWeight
323 if ((myMinSourceMinusSinkWeight == -1) || (sourceMinusSink < myMinSourceMinusSinkWeight)) {
324 myMinSourceMinusSinkWeight = sourceMinusSink;
325 }
326 }
327 }
328}
329
330// ---------------------------------------------------------------------------
331// GNETAZFrame::TAZCommonStatistics - methods
332// ---------------------------------------------------------------------------
333
335 MFXGroupBoxModule(TAZFrameParent, TL("TAZ Statistics")),
336 myTAZFrameParent(TAZFrameParent) {
337 // create label for statistics
339}
340
341
343
344
345void
347 // always update statistics after show
348 updateStatistics();
349 show();
350}
351
352
353void
357
358
359void
361 if (myTAZFrameParent->myCurrentTAZ->getTAZ()) {
362 // declare ostringstream for statistics
363 std::ostringstream information;
364 information
365 << TL("- Number of edges: ") << toString(myTAZFrameParent->myCurrentTAZ->getTAZ()->getChildTAZSourceSinks().size() / 2) << "\n"
366 << TL("- Min source: ") << myTAZFrameParent->myCurrentTAZ->getTAZ()->getAttribute(GNE_ATTR_MIN_SOURCE) << "\n"
367 << TL("- Max source: ") << myTAZFrameParent->myCurrentTAZ->getTAZ()->getAttribute(GNE_ATTR_MAX_SOURCE) << "\n"
368 << TL("- Average source: ") << myTAZFrameParent->myCurrentTAZ->getTAZ()->getAttribute(GNE_ATTR_AVERAGE_SOURCE) << "\n"
369 << "\n"
370 << TL("- Min sink: ") << myTAZFrameParent->myCurrentTAZ->getTAZ()->getAttribute(GNE_ATTR_MIN_SINK) << "\n"
371 << TL("- Max sink: ") << myTAZFrameParent->myCurrentTAZ->getTAZ()->getAttribute(GNE_ATTR_MAX_SINK) << "\n"
372 << TL("- Average sink: ") << myTAZFrameParent->myCurrentTAZ->getTAZ()->getAttribute(GNE_ATTR_AVERAGE_SINK);
373 // set new label
374 myStatisticsLabel->setText(information.str().c_str());
375 } else {
376 myStatisticsLabel->setText(TL("No TAZ Selected"));
377 }
378}
379
380// ---------------------------------------------------------------------------
381// GNETAZFrame::TAZSaveChanges - methods
382// ---------------------------------------------------------------------------
383
385 MFXGroupBoxModule(TAZFrameParent, TL("Modifications")),
386 myTAZFrameParent(TAZFrameParent) {
387 // Create groupbox for save changes
389 mySaveChangesButton->disable();
390 // Create groupbox cancel changes
392 myCancelChangesButton->disable();
393}
394
395
397
398
399void
403
404
405void
407 // cancel changes before hiding module
408 onCmdCancelChanges(0, 0, 0);
409 hide();
410}
411
412
413void
415 // check that save changes is disabled
416 if (!mySaveChangesButton->isEnabled()) {
417 // enable mySaveChangesButton and myCancelChangesButton
418 mySaveChangesButton->enable();
419 myCancelChangesButton->enable();
420 // start undo list set
421 myTAZFrameParent->myViewNet->getUndoList()->begin(GUIIcon::TAZ, TL("TAZ changes"));
422 }
423}
424
425
426bool
428 // simply check if save Changes Button is enabled
429 return myTAZFrameParent->shown() && mySaveChangesButton->isEnabled();
430}
431
432
433long
435 // check that save changes is enabled
436 if (mySaveChangesButton->isEnabled()) {
437 // disable mySaveChangesButton and myCancelChangesButton
438 mySaveChangesButton->disable();
439 myCancelChangesButton->disable();
440 // finish undo list set
441 myTAZFrameParent->myViewNet->getUndoList()->end();
442 // always refresh TAZ Edges after removing TAZSources/Sinks
443 myTAZFrameParent->myCurrentTAZ->refreshTAZEdges();
444 // update use edges button
445 myTAZFrameParent->myTAZChildDefaultParameters->updateSelectEdgesButton();
446
447 }
448 return 1;
449}
450
451
452long
454 // check that save changes is enabled
455 if (mySaveChangesButton->isEnabled()) {
456 // disable buttons
457 mySaveChangesButton->disable();
458 myCancelChangesButton->disable();
459 // abort undo list
460 myTAZFrameParent->myViewNet->getUndoList()->abortAllChangeGroups();
461 // always refresh TAZ Edges after removing TAZSources/Sinks
462 myTAZFrameParent->myCurrentTAZ->refreshTAZEdges();
463 // update use edges button
464 myTAZFrameParent->myTAZChildDefaultParameters->updateSelectEdgesButton();
465 }
466 return 1;
467}
468
469// ---------------------------------------------------------------------------
470// GNETAZFrame::TAZChildDefaultParameters - methods
471// ---------------------------------------------------------------------------
472
474 MFXGroupBoxModule(TAZFrameParent, TL("TAZ Sources/Sinks")),
475 myTAZFrameParent(TAZFrameParent),
476 myDefaultTAZSourceWeight(1),
477 myDefaultTAZSinkWeight(1) {
478 // create checkbox for toggle membership
480 new FXLabel(myToggleMembershipFrame, TL("Membership"), 0, GUIDesignLabelThickedFixed(100));
482 // by default enabled
483 myToggleMembership->setCheck(TRUE);
484 // create default TAZ Source weight
486 new FXLabel(myDefaultTAZSourceFrame, TL("New source"), 0, GUIDesignLabelThickedFixed(100));
489 // create default TAZ Sink weight
491 new FXLabel(myDefaultTAZSinkFrame, TL("New sink"), 0, GUIDesignLabelThickedFixed(100));
494 // Create button for use selected edges
495 myUseSelectedEdges = GUIDesigns::buildFXButton(getCollapsableFrame(), TL("Use selected edges"), "", "", nullptr, this, MID_GNE_SELECT, GUIDesignButton);
496 // Create button for zero fringe probabilities
498 // Create information label
499 std::ostringstream information;
500 information
501 << std::string("- ") << TL("Toggle Membership:") << "\n"
502 << std::string(" ") << TL("Create new Sources/Sinks with given weights.");
504 // always show
505 show();
506}
507
508
510
511
512void
514 // check if TAZ selection Statistics Module has to be shown
515 if (myToggleMembership->getCheck() == FALSE) {
516 myTAZFrameParent->myTAZSelectionStatistics->showTAZSelectionStatisticsModule();
517 } else {
518 myTAZFrameParent->myTAZSelectionStatistics->hideTAZSelectionStatisticsModule();
519 }
520 // update selected button
521 updateSelectEdgesButton();
522 // show items edges button
523 myToggleMembershipFrame->show();
524 myDefaultTAZSourceFrame->show();
525 myDefaultTAZSinkFrame->show();
526 myUseSelectedEdges->show();
527 myInformationLabel->show();
528}
529
530
531void
533 // hide TAZ Selection Statistics Module
534 myTAZFrameParent->myTAZSelectionStatistics->hideTAZSelectionStatisticsModule();
535 // hide items
536 myToggleMembershipFrame->hide();
537 myDefaultTAZSourceFrame->hide();
538 myDefaultTAZSinkFrame->hide();
539 myUseSelectedEdges->hide();
540 myInformationLabel->hide();
541}
542
543
544void
546 if (myToggleMembership->getCheck() == TRUE) {
547 // check if use selected edges has to be enabled
548 if (myTAZFrameParent->myCurrentTAZ->getSelectedEdges().size() > 0) {
549 myUseSelectedEdges->setText(TL("Use selected edges"));
550 myUseSelectedEdges->enable();
551 } else if (myTAZFrameParent->myCurrentTAZ->getTAZEdges().size() > 0) {
552 myUseSelectedEdges->setText(TL("Remove all edges"));
553 myUseSelectedEdges->enable();
554 } else {
555 myUseSelectedEdges->setText(TL("Use selected edges"));
556 myUseSelectedEdges->disable();
557 }
558 } else if (myTAZFrameParent->getCurrentTAZModule()->getTAZEdges().size() > 0) {
559 // enable myUseSelectedEdges button
560 myUseSelectedEdges->enable();
561 // update mySelectEdgesOfSelection label
562 if (myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected().size() == 0) {
563 // check if all edges of TAZChildren are selected
564 bool allSelected = true;
565 for (const auto& TAZEdgeColor : myTAZFrameParent->getCurrentTAZModule()->getTAZEdges()) {
566 if (!TAZEdgeColor.edge->isAttributeCarrierSelected()) {
567 allSelected = false;
568 }
569 }
570 if (allSelected) {
571 myUseSelectedEdges->setText(TL("Remove all edges from selection"));
572 } else {
573 myUseSelectedEdges->setText(TL("Add all edges to selection"));
574 }
575 } else if (myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected().size() == 1) {
576 if (myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected().front().edge->isAttributeCarrierSelected()) {
577 myUseSelectedEdges->setText(TL("Remove edge from selection"));
578 } else {
579 myUseSelectedEdges->setText(TL("Add edge to selection"));
580 }
581 } else {
582 // check if all edges of TAZChildren selected are selected
583 bool allSelected = true;
584 for (const auto& selectedEdge : myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected()) {
585 if (!selectedEdge.edge->isAttributeCarrierSelected()) {
586 allSelected = false;
587 }
588 }
589 if (allSelected) {
590 myUseSelectedEdges->setText((TL("Remove ") + toString(myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected().size()) + TL(" edges from to selection")).c_str());
591 } else {
592 myUseSelectedEdges->setText((TL("Add ") + toString(myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected().size()) + TL(" edges to selection")).c_str());
593 }
594 }
595 } else {
596 // TAZ doesn't have children, then disable button
597 myUseSelectedEdges->disable();
598 }
599}
600
601
602double
604 return myDefaultTAZSourceWeight;
605}
606
607
608double
610 return myDefaultTAZSinkWeight;
611}
612
613
614bool
616 return (myToggleMembership->getCheck() == TRUE);
617}
618
619
620long
622 // find edited object
623 if (obj == myToggleMembership) {
624 // first clear selected edges
625 myTAZFrameParent->myTAZSelectionStatistics->clearSelectedEdges();
626 // set text of myToggleMembership
627 if (myToggleMembership->getCheck() == TRUE) {
628 myToggleMembership->setText(TL("toggle"));
629 // show source/Sink Frames
630 myDefaultTAZSourceFrame->show();
631 myDefaultTAZSinkFrame->show();
632 // update information label
633 std::ostringstream information;
634 information
635 << std::string("- ") << TL("Toggle Membership:") << "\n"
636 << std::string(" ") << TL("Create new Sources/Sinks with given weights.");
637 myInformationLabel->setText(information.str().c_str());
638 // hide TAZSelectionStatistics
639 myTAZFrameParent->myTAZSelectionStatistics->hideTAZSelectionStatisticsModule();
640 // check if use selected edges has to be enabled
641 if (myTAZFrameParent->myCurrentTAZ->getSelectedEdges().size() > 0) {
642 myUseSelectedEdges->setText(TL("Use selected edges"));
643 } else if (myTAZFrameParent->myCurrentTAZ->getTAZEdges().size() > 0) {
644 myUseSelectedEdges->setText(TL("Remove all edges"));
645 } else {
646 myUseSelectedEdges->setText(TL("Use selected edges"));
647 myUseSelectedEdges->disable();
648 }
649 } else {
650 myToggleMembership->setText(TL("keep"));
651 // hide source/Sink Frames
652 myDefaultTAZSourceFrame->hide();
653 myDefaultTAZSinkFrame->hide();
654 // update information label
655 std::ostringstream information;
656 information
657 << std::string("- ") << TL("Keep Membership:") << TL(" Select Sources/Sinks.") << "\n"
658 << std::string("- ") << TL("Press ESC to clear the current selection.");
659 myInformationLabel->setText(information.str().c_str());
660 // show TAZSelectionStatistics
661 myTAZFrameParent->myTAZSelectionStatistics->showTAZSelectionStatisticsModule();
662 }
663 // update button
664 updateSelectEdgesButton();
665 } else if (obj == myTextFieldDefaultValueTAZSources) {
666 // check if given value is valid
667 if (GNEAttributeCarrier::canParse<double>(myTextFieldDefaultValueTAZSources->getText().text())) {
668 myDefaultTAZSourceWeight = GNEAttributeCarrier::parse<double>(myTextFieldDefaultValueTAZSources->getText().text());
669 // check if myDefaultTAZSourceWeight is greater than 0
670 if (myDefaultTAZSourceWeight >= 0) {
671 // set valid color
672 myTextFieldDefaultValueTAZSources->setTextColor(FXRGB(0, 0, 0));
673 } else {
674 // set invalid color
675 myTextFieldDefaultValueTAZSources->setTextColor(FXRGB(255, 0, 0));
676 myDefaultTAZSourceWeight = 1;
677 }
678 } else {
679 // set invalid color
680 myTextFieldDefaultValueTAZSources->setTextColor(FXRGB(255, 0, 0));
681 myDefaultTAZSourceWeight = 1;
682 }
683 } else if (obj == myTextFieldDefaultValueTAZSinks) {
684 // check if given value is valid
685 if (GNEAttributeCarrier::canParse<double>(myTextFieldDefaultValueTAZSinks->getText().text())) {
686 myDefaultTAZSinkWeight = GNEAttributeCarrier::parse<double>(myTextFieldDefaultValueTAZSinks->getText().text());
687 // check if myDefaultTAZSinkWeight is greater than 0
688 if (myDefaultTAZSinkWeight >= 0) {
689 // set valid color
690 myTextFieldDefaultValueTAZSinks->setTextColor(FXRGB(0, 0, 0));
691 } else {
692 // set invalid color
693 myTextFieldDefaultValueTAZSinks->setTextColor(FXRGB(255, 0, 0));
694 myDefaultTAZSinkWeight = 1;
695 }
696 } else {
697 // set invalid color
698 myTextFieldDefaultValueTAZSinks->setTextColor(FXRGB(255, 0, 0));
699 myDefaultTAZSinkWeight = 1;
700 }
701 }
702 return 1;
703}
704
705
706long
708 // select edge or create new TAZ Source/Child, depending of myToggleMembership
709 if (myToggleMembership->getCheck() == TRUE) {
710 // first drop all edges
711 myTAZFrameParent->dropTAZMembers();
712 // iterate over selected edges and add it as TAZMember
713 for (const auto& selectedEdge : myTAZFrameParent->myCurrentTAZ->getSelectedEdges()) {
714 myTAZFrameParent->addOrRemoveTAZMember(selectedEdge);
715 }
716 // update selected button
717 updateSelectEdgesButton();
718 } else {
719 if (myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected().size() == 0) {
720 // first check if all TAZEdges are selected
721 bool allSelected = true;
722 for (const auto& TAZEdgeColor : myTAZFrameParent->getCurrentTAZModule()->getTAZEdges()) {
723 if (!TAZEdgeColor.edge->isAttributeCarrierSelected()) {
724 allSelected = false;
725 }
726 }
727 // select or unselect all depending of allSelected
728 if (allSelected) {
729 // remove form selection all TAZEdges
730 for (const auto& TAZEdgeColor : myTAZFrameParent->getCurrentTAZModule()->getTAZEdges()) {
731 // change attribute selected (without undo-redo)
732 TAZEdgeColor.edge->unselectAttributeCarrier();
733 }
734 } else {
735 // add to selection all TAZEdges
736 for (const auto& TAZEdgeColor : myTAZFrameParent->getCurrentTAZModule()->getTAZEdges()) {
737 // change attribute selected (without undo-redo)
738 TAZEdgeColor.edge->selectAttributeCarrier();
739 }
740 }
741 } else {
742 // first check if all TAZEdges are selected
743 bool allSelected = true;
744 for (const auto& selectedEdge : myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected()) {
745 if (!selectedEdge.edge->isAttributeCarrierSelected()) {
746 allSelected = false;
747 }
748 }
749 // select or unselect all depending of allSelected
750 if (allSelected) {
751 // only remove from selection selected TAZEdges
752 for (const auto& selectedEdge : myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected()) {
753 if (selectedEdge.edge->isAttributeCarrierSelected()) {
754 // change attribute selected (without undo-redo)
755 selectedEdge.edge->unselectAttributeCarrier();
756 }
757 }
758 } else {
759 // only add to selection selected TAZEdges
760 for (const auto& selectedEdge : myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected()) {
761 if (!selectedEdge.edge->isAttributeCarrierSelected()) {
762 // change attribute selected (without undo-redo)
763 selectedEdge.edge->selectAttributeCarrier();
764 }
765 }
766 }
767 }
768 }
769 // update selection button
770 myTAZFrameParent->myTAZChildDefaultParameters->updateSelectEdgesButton();
771 // update view net
772 myTAZFrameParent->myViewNet->updateViewNet();
773 return 1;
774}
775
776
777long
779 // compute and update
780 auto& neteditOptions = OptionsCont::getOptions();
781 myTAZFrameParent->getViewNet()->getNet()->computeAndUpdate(neteditOptions, false);
782 myTAZFrameParent->getViewNet()->update();
783 // find all edges with TAZSource/sinks and without successors/predecessors
784 std::vector<GNETAZSourceSink*> sources;
785 std::vector<GNETAZSourceSink*> sinks;
786 std::set<GNEAdditional*> TAZs;
787 // check if we're editing a single TAZ or all TAZs
788 if (myTAZFrameParent->myCurrentTAZ->getTAZ() != nullptr) {
789 // iterate over source/sinks
790 for (const auto& TAZSourceSink : myTAZFrameParent->myCurrentTAZ->getTAZ()->getChildTAZSourceSinks()) {
791 if (TAZSourceSink->getTagProperty()->getTag() == SUMO_TAG_TAZSOURCE) {
792 // set sink probability to 0 for all edges that have no predecessor
793 if (!TAZSourceSink->getParentEdges().front()->hasSuccessors() &&
794 (TAZSourceSink->getAttributeDouble(SUMO_ATTR_WEIGHT) != 0)) {
795 sources.push_back(TAZSourceSink);
796 TAZs.insert(myTAZFrameParent->myCurrentTAZ->getTAZ());
797 }
798 } else {
799 // set source probability to 0 for all edges that have no successor
800 if (!TAZSourceSink->getParentEdges().front()->hasPredecessors() &&
801 (TAZSourceSink->getAttributeDouble(SUMO_ATTR_WEIGHT) != 0)) {
802 sinks.push_back(TAZSourceSink);
803 TAZs.insert(myTAZFrameParent->myCurrentTAZ->getTAZ());
804 }
805 }
806 }
807 } else {
808 // iterate over all TAZs
809 for (const auto& TAZ : myTAZFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getAdditionals().at(SUMO_TAG_TAZ)) {
810 // iterate over source/sinks
811 for (const auto& TAZSourceSink : TAZ.second->getChildTAZSourceSinks()) {
812 if (TAZSourceSink->getTagProperty()->getTag() == SUMO_TAG_TAZSOURCE) {
813 // set sink probability to 0 for all edges that have no predecessor
814 if (!TAZSourceSink->getParentEdges().front()->hasSuccessors() &&
815 (TAZSourceSink->getAttributeDouble(SUMO_ATTR_WEIGHT) != 0)) {
816 sources.push_back(TAZSourceSink);
817 TAZs.insert(TAZ.second);
818 }
819 } else {
820 // set source probability to 0 for all edges that have no successor
821 if (!TAZSourceSink->getParentEdges().front()->hasPredecessors() &&
822 (TAZSourceSink->getAttributeDouble(SUMO_ATTR_WEIGHT) != 0)) {
823 sinks.push_back(TAZSourceSink);
824 TAZs.insert(TAZ.second);
825 }
826 }
827 }
828 }
829 }
830 // check if there is sources/sinks
831 if ((sources.size() + sinks.size()) > 0) {
832 // build the text
833 const std::string text = (TAZs.size() == 1) ?
834 // single TAZ
835 TL("Set weight 0 in ") + toString(sources.size()) + TL(" sources and ") +
836 toString(sinks.size()) + TL(" sinks from TAZ '") + (*TAZs.begin())->getID() + "'?" :
837 // multiple TAZs
838 TL("Set weight 0 in ") + toString(sources.size()) + TL(" sources and ") +
839 toString(sinks.size()) + TL(" sinks from ") + toString(TAZs.size()) + TL(" TAZs?");
840 // ask if continue
841 const FXuint answer = FXMessageBox::question(this, MBOX_YES_NO, TL("Set zero fringe probabilities"), "%s", text.c_str());
842 if (answer == 1) { // 1:yes, 2:no, 4:esc
843 myTAZFrameParent->myViewNet->getUndoList()->begin(GUIIcon::TAZ, TL("set zero fringe probabilities"));
844 for (const auto& source : sources) {
845 source->setAttribute(SUMO_ATTR_WEIGHT, "0", myTAZFrameParent->myViewNet->getUndoList());
846 }
847 for (const auto& sink : sinks) {
848 sink->setAttribute(SUMO_ATTR_WEIGHT, "0", myTAZFrameParent->myViewNet->getUndoList());
849 }
850 myTAZFrameParent->myViewNet->getUndoList()->end();
851 }
852 } else {
853 // show information box
854 FXMessageBox::information(this, MBOX_OK, TL("Set zero fringe probabilities"), TL("No source/sinks to update."));
855 }
856 return 1;
857}
858
859// ---------------------------------------------------------------------------
860// GNETAZFrame::TAZSelectionStatistics - methods
861// ---------------------------------------------------------------------------
862
864 MFXGroupBoxModule(TAZFrameParent, TL("Selection Statistics")),
865 myTAZFrameParent(TAZFrameParent) {
866 // create default TAZ Source weight
868 new FXLabel(myTAZSourceFrame, TL("Source"), 0, GUIDesignLabelThickedFixed(100));
870 myTAZSourceFrame->hide();
871 // create default TAZ Sink weight
873 new FXLabel(myTAZSinkFrame, TL("Sink"), 0, GUIDesignLabelThickedFixed(100));
875 myTAZSinkFrame->hide();
876 // create label for statistics
878}
879
880
882
883
884void
886 // update Statistics before show
887 updateStatistics();
888 show();
889}
890
891
892void
894 // clear children before hide
895 clearSelectedEdges();
896 hide();
897}
898
899
900bool
902 // find TAZEdgeColor using edge as criterium wasn't previously selected
903 for (const auto& selectedEdge : myEdgeAndTAZChildrenSelected) {
904 if (selectedEdge.edge == TAZEdgeColor.edge) {
905 throw ProcessError(TL("TAZEdgeColor already selected"));
906 }
907 }
908 // add edge and their TAZ Children into myTAZChildSelected
909 myEdgeAndTAZChildrenSelected.push_back(TAZEdgeColor);
910 // always update statistics after insertion
911 updateStatistics();
912 // update edge colors
913 myTAZFrameParent->myTAZEdgesGraphic->updateEdgeColors();
914 // update selection button
915 myTAZFrameParent->myTAZChildDefaultParameters->updateSelectEdgesButton();
916 return true;
917}
918
919
920bool
922 if (edge) {
923 // find TAZEdgeColor using edge as criterium
924 for (auto it = myEdgeAndTAZChildrenSelected.begin(); it != myEdgeAndTAZChildrenSelected.end(); it++) {
925 if (it->edge == edge) {
926 myEdgeAndTAZChildrenSelected.erase(it);
927 // always update statistics after insertion
928 updateStatistics();
929 // update edge colors
930 myTAZFrameParent->myTAZEdgesGraphic->updateEdgeColors();
931 // update selection button
932 myTAZFrameParent->myTAZChildDefaultParameters->updateSelectEdgesButton();
933 return true;
934 }
935 }
936 // throw exception if edge wasn't found
937 throw ProcessError(TL("edge wasn't found"));
938 } else {
939 throw ProcessError(TL("Invalid edge"));
940 }
941}
942
943
944bool
946 // find TAZEdgeColor using edge as criterium
947 for (const auto& selectedEdge : myEdgeAndTAZChildrenSelected) {
948 if (selectedEdge.edge == edge) {
949 return true;
950 }
951 }
952 // edge wasn't found, then return false
953 return false;
954}
955
956
957void
959 // clear all selected edges (and the TAZ Children)
960 myEdgeAndTAZChildrenSelected.clear();
961 // always update statistics after clear edges
962 updateStatistics();
963 // update edge colors
964 myTAZFrameParent->myTAZEdgesGraphic->updateEdgeColors();
965 // update selection button
966 myTAZFrameParent->myTAZChildDefaultParameters->updateSelectEdgesButton();
967}
968
969
970const std::vector<GNETAZFrame::CurrentTAZ::TAZEdgeColor>&
972 return myEdgeAndTAZChildrenSelected;
973}
974
975
976long
978 if (obj == myTextFieldTAZSourceWeight) {
979 // check if given value is valid
980 if (GNEAttributeCarrier::canParse<double>(myTextFieldTAZSourceWeight->getText().text())) {
981 double newTAZSourceWeight = GNEAttributeCarrier::parse<double>(myTextFieldTAZSourceWeight->getText().text());
982 // check if myDefaultTAZSourceWeight is greater than 0
983 if (newTAZSourceWeight >= 0) {
984 // set valid color in TextField
985 myTextFieldTAZSourceWeight->setTextColor(FXRGB(0, 0, 0));
986 // enable save button
987 myTAZFrameParent->myTAZSaveChanges->enableButtonsAndBeginUndoList();
988 // update weight of all TAZSources
989 for (const auto& selectedEdge : myEdgeAndTAZChildrenSelected) {
990 selectedEdge.source->setAttribute(SUMO_ATTR_WEIGHT, myTextFieldTAZSourceWeight->getText().text(), myTAZFrameParent->myViewNet->getUndoList());
991 }
992 // refresh TAZ Edges
993 myTAZFrameParent->getCurrentTAZModule()->refreshTAZEdges();
994 } else {
995 // set invalid color
996 myTextFieldTAZSourceWeight->setTextColor(FXRGB(255, 0, 0));
997 }
998 } else {
999 // set invalid color
1000 myTextFieldTAZSourceWeight->setTextColor(FXRGB(255, 0, 0));
1001 }
1002 } else if (obj == myTextFieldTAZSinkWeight) {
1003 // check if given value is valid
1004 if (GNEAttributeCarrier::canParse<double>(myTextFieldTAZSinkWeight->getText().text())) {
1005 double newTAZSinkWeight = GNEAttributeCarrier::parse<double>(myTextFieldTAZSinkWeight->getText().text());
1006 // check if myDefaultTAZSinkWeight is greater than 0
1007 if (newTAZSinkWeight >= 0) {
1008 // set valid color in TextField
1009 myTextFieldTAZSinkWeight->setTextColor(FXRGB(0, 0, 0));
1010 // enable save button
1011 myTAZFrameParent->myTAZSaveChanges->enableButtonsAndBeginUndoList();
1012 // update weight of all TAZSources
1013 for (const auto& selectedEdge : myEdgeAndTAZChildrenSelected) {
1014 selectedEdge.sink->setAttribute(SUMO_ATTR_WEIGHT, myTextFieldTAZSinkWeight->getText().text(), myTAZFrameParent->myViewNet->getUndoList());
1015 }
1016 // refresh TAZ Edges
1017 myTAZFrameParent->getCurrentTAZModule()->refreshTAZEdges();
1018 } else {
1019 // set invalid color
1020 myTextFieldTAZSinkWeight->setTextColor(FXRGB(255, 0, 0));
1021 }
1022 } else {
1023 // set invalid color
1024 myTextFieldTAZSinkWeight->setTextColor(FXRGB(255, 0, 0));
1025 }
1026 }
1027 return 1;
1028}
1029
1030
1031long
1033 if (myEdgeAndTAZChildrenSelected.size() == 0) {
1034 // add to selection all TAZEdges
1035 for (const auto& TAZEdgeColor : myTAZFrameParent->getCurrentTAZModule()->getTAZEdges()) {
1036 // avoid empty undolists
1037 if (!TAZEdgeColor.edge->isAttributeCarrierSelected()) {
1038 // enable save button
1039 myTAZFrameParent->myTAZSaveChanges->enableButtonsAndBeginUndoList();
1040 // change attribute selected
1041 TAZEdgeColor.edge->setAttribute(GNE_ATTR_SELECTED, "true", myTAZFrameParent->myViewNet->getUndoList());
1042 }
1043 }
1044 } else {
1045 // only add to selection selected TAZEdges
1046 for (const auto& selectedEdge : myEdgeAndTAZChildrenSelected) {
1047 // avoid empty undolists
1048 if (!selectedEdge.edge->isAttributeCarrierSelected()) {
1049 // enable save button
1050 myTAZFrameParent->myTAZSaveChanges->enableButtonsAndBeginUndoList();
1051 // change attribute selected
1052 selectedEdge.edge->setAttribute(GNE_ATTR_SELECTED, "true", myTAZFrameParent->myViewNet->getUndoList());
1053 }
1054 }
1055 }
1056 return 1;
1057}
1058
1059
1060void
1062 if (myEdgeAndTAZChildrenSelected.size() > 0) {
1063 // show TAZSources/Sinks frames
1064 myTAZSourceFrame->show();
1065 myTAZSinkFrame->show();
1066 // declare string sets for TextFields (to avoid duplicated values)
1067 std::set<std::string> weightSourceSet;
1068 std::set<std::string> weightSinkSet;
1069 // declare statistic variables
1070 double weight = 0;
1071 double maxWeightSource = 0;
1072 double minWeightSource = -1;
1073 double averageWeightSource = 0;
1074 double maxWeightSink = 0;
1075 double minWeightSink = -1;
1076 double averageWeightSink = 0;
1077 // iterate over child TAZElements
1078 for (const auto& selectedEdge : myEdgeAndTAZChildrenSelected) {
1079 //start with sources
1080 weight = selectedEdge.source->getWeight();
1081 // insert source weight in weightSinkTextField
1082 weightSourceSet.insert(toString(weight));
1083 // check max Weight
1084 if (maxWeightSource < weight) {
1085 maxWeightSource = weight;
1086 }
1087 // check min Weight
1088 if (minWeightSource == -1 || (maxWeightSource < weight)) {
1089 minWeightSource = weight;
1090 }
1091 // update Average
1092 averageWeightSource += weight;
1093 // continue with sinks
1094 weight = selectedEdge.sink->getWeight();
1095 // save sink weight in weightSinkTextField
1096 weightSinkSet.insert(toString(weight));
1097 // check max Weight
1098 if (maxWeightSink < weight) {
1099 maxWeightSink = weight;
1100 }
1101 // check min Weight
1102 if (minWeightSink == -1 || (maxWeightSink < weight)) {
1103 minWeightSink = weight;
1104 }
1105 // update Average
1106 averageWeightSink += weight;
1107 }
1108 // calculate average
1109 averageWeightSource /= (double)myEdgeAndTAZChildrenSelected.size();
1110 averageWeightSink /= (double)myEdgeAndTAZChildrenSelected.size();
1111 // declare ostringstream for statistics
1112 std::ostringstream information;
1113 std::string edgeInformation;
1114 // first fill edgeInformation
1115 if (myEdgeAndTAZChildrenSelected.size() == 1) {
1116 edgeInformation = TL("- Edge ID: ") + myEdgeAndTAZChildrenSelected.begin()->edge->getID();
1117 } else {
1118 edgeInformation = TL("- Number of edges: ") + toString(myEdgeAndTAZChildrenSelected.size());
1119 }
1120 // fill rest of information
1121 information
1122 << edgeInformation << "\n"
1123 << TL("- Min source: ") << toString(minWeightSource) << "\n"
1124 << TL("- Max source: ") << toString(maxWeightSource) << "\n"
1125 << TL("- Average source: ") << toString(averageWeightSource) << "\n"
1126 << "\n"
1127 << TL("- Min sink: ") << toString(minWeightSink) << "\n"
1128 << TL("- Max sink: ") << toString(maxWeightSink) << "\n"
1129 << TL("- Average sink: ") << toString(averageWeightSink);
1130 // set new label
1131 myStatisticsLabel->setText(information.str().c_str());
1132 // set TextFields (Text and color)
1133 myTextFieldTAZSourceWeight->setText(joinToString(weightSourceSet, " ").c_str());
1134 myTextFieldTAZSourceWeight->setTextColor(FXRGB(0, 0, 0));
1135 myTextFieldTAZSinkWeight->setText(joinToString(weightSinkSet, " ").c_str());
1136 myTextFieldTAZSinkWeight->setTextColor(FXRGB(0, 0, 0));
1137 } else {
1138 // hide TAZSources/Sinks frames
1139 myTAZSourceFrame->hide();
1140 myTAZSinkFrame->hide();
1141 // hide myStatisticsLabel
1142 myStatisticsLabel->setText(TL("No edges selected"));
1143 }
1144}
1145
1146// ---------------------------------------------------------------------------
1147// GNETAZFrame::TAZEdgesGraphic - methods
1148// ---------------------------------------------------------------------------
1149
1151 MFXGroupBoxModule(TAZFrameParent, TL("Edges")),
1152 myTAZFrameParent(TAZFrameParent),
1153 myEdgeDefaultColor(RGBColor::GREY),
1154 myEdgeSelectedColor(RGBColor::MAGENTA) {
1155 // create label for non taz edge color information
1156 FXLabel* NonTAZEdgeLabel = new FXLabel(getCollapsableFrame(), TL("Non TAZ Edge"), nullptr, GUIDesignLabel(JUSTIFY_NORMAL));
1157 NonTAZEdgeLabel->setBackColor(MFXUtils::getFXColor(myEdgeDefaultColor));
1158 NonTAZEdgeLabel->setTextColor(MFXUtils::getFXColor(RGBColor::WHITE));
1159 // create label for selected TAZEdgeColor color information
1160 FXLabel* selectedTAZEdgeLabel = new FXLabel(getCollapsableFrame(), TL("Selected TAZ Edge"), nullptr, GUIDesignLabel(JUSTIFY_NORMAL));
1161 selectedTAZEdgeLabel->setBackColor(MFXUtils::getFXColor(myEdgeSelectedColor));
1162 // build rainbow
1164 // create Radio button for show edges by source weight
1165 myColorBySourceWeight = new FXRadioButton(getCollapsableFrame(), TL("Color by Source"), this, MID_CHOOSEN_OPERATION, GUIDesignRadioButton);
1166 // create Radio button for show edges by sink weight
1167 myColorBySinkWeight = new FXRadioButton(getCollapsableFrame(), TL("Color by Sink"), this, MID_CHOOSEN_OPERATION, GUIDesignRadioButton);
1168 // create Radio button for show edges by source + sink weight
1169 myColorBySourcePlusSinkWeight = new FXRadioButton(getCollapsableFrame(), TL("Color by Source + Sink"), this, MID_CHOOSEN_OPERATION, GUIDesignRadioButton);
1170 // create Radio button for show edges by source - sink weight
1171 myColorBySourceMinusSinkWeight = new FXRadioButton(getCollapsableFrame(), TL("Color by Source - Sink"), this, MID_CHOOSEN_OPERATION, GUIDesignRadioButton);
1172 // show by source as default
1173 myColorBySourceWeight->setCheck(true);
1174}
1175
1176
1178
1179
1180void
1182 // update edge colors
1183 updateEdgeColors();
1184 show();
1185}
1186
1187
1188void
1190 // iterate over all edges and restore color
1191 for (const auto& edge : myTAZFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
1192 for (const auto& lane : edge.second->getChildLanes()) {
1193 lane->setSpecialColor(nullptr);
1194 }
1195 }
1196 hide();
1197}
1198
1199
1200void
1202 const std::vector<RGBColor>& scaledColors = GNEViewNetHelper::getRainbowScaledColors();
1203 // start painting all edges in gray
1204 for (const auto& edge : myTAZFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
1205 if (!edge.second->isAttributeCarrierSelected()) {
1206 // set candidate color (in this case, gray)
1207 for (const auto lane : edge.second->getChildLanes()) {
1208 lane->setSpecialColor(&myEdgeDefaultColor);
1209 }
1210 }
1211 }
1212 // now paint Source/sinks colors
1213 for (const auto& TAZEdgeColor : myTAZFrameParent->myCurrentTAZ->getTAZEdges()) {
1214 if (!TAZEdgeColor.edge->isAttributeCarrierSelected()) {
1215 // set candidate color (in this case,
1216 for (const auto& lane : TAZEdgeColor.edge->getChildLanes()) {
1217 // check what will be painted (source, sink or both)
1218 if (myColorBySourceWeight->getCheck() == TRUE) {
1219 lane->setSpecialColor(&scaledColors.at(TAZEdgeColor.sourceColor), TAZEdgeColor.source->getWeight());
1220 } else if (myColorBySinkWeight->getCheck() == TRUE) {
1221 lane->setSpecialColor(&scaledColors.at(TAZEdgeColor.sinkColor), TAZEdgeColor.sink->getWeight());
1222 } else if (myColorBySourcePlusSinkWeight->getCheck() == TRUE) {
1223 lane->setSpecialColor(&scaledColors.at(TAZEdgeColor.sourcePlusSinkColor), TAZEdgeColor.source->getWeight() + TAZEdgeColor.sink->getWeight());
1224 } else {
1225 lane->setSpecialColor(&scaledColors.at(TAZEdgeColor.sourceMinusSinkColor), TAZEdgeColor.source->getWeight() - TAZEdgeColor.sink->getWeight());
1226 }
1227 }
1228 }
1229 }
1230 // as last step paint candidate colors
1231 for (const auto& selectedEdge : myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected()) {
1232 if (!selectedEdge.edge->isAttributeCarrierSelected()) {
1233 // set candidate selected color
1234 for (const auto& lane : selectedEdge.edge->getChildLanes()) {
1235 lane->setSpecialColor(&myEdgeSelectedColor);
1236 }
1237 }
1238 }
1239 // always update view after setting new colors
1240 myTAZFrameParent->myViewNet->updateViewNet();
1241}
1242
1243
1244long
1245GNETAZFrame::TAZEdgesGraphic::onCmdChoosenBy(FXObject* obj, FXSelector, void*) {
1246 // check what radio was pressed and disable the others
1247 if (obj == myColorBySourceWeight) {
1248 myColorBySinkWeight->setCheck(FALSE);
1249 myColorBySourcePlusSinkWeight->setCheck(FALSE);
1250 myColorBySourceMinusSinkWeight->setCheck(FALSE);
1251 } else if (obj == myColorBySinkWeight) {
1252 myColorBySourceWeight->setCheck(FALSE);
1253 myColorBySourcePlusSinkWeight->setCheck(FALSE);
1254 myColorBySourceMinusSinkWeight->setCheck(FALSE);
1255 } else if (obj == myColorBySourcePlusSinkWeight) {
1256 myColorBySourceWeight->setCheck(FALSE);
1257 myColorBySinkWeight->setCheck(FALSE);
1258 myColorBySourceMinusSinkWeight->setCheck(FALSE);
1259 } else if (obj == myColorBySourceMinusSinkWeight) {
1260 myColorBySourceWeight->setCheck(FALSE);
1261 myColorBySinkWeight->setCheck(FALSE);
1262 myColorBySourcePlusSinkWeight->setCheck(FALSE);
1263 }
1264 // update edge colors
1265 updateEdgeColors();
1266 return 1;
1267}
1268
1269// ---------------------------------------------------------------------------
1270// GNETAZFrame - methods
1271// ---------------------------------------------------------------------------
1272
1274 GNEFrame(viewParent, viewNet, TL("TAZs")) {
1275
1276 // create current TAZ module
1277 myCurrentTAZ = new CurrentTAZ(this);
1278
1279 // Create TAZ Parameters module
1281
1282 // Create drawing controls module
1283 myDrawingShape = new GNEDrawingShape(this);
1284
1285 // Create TAZ Edges Common Statistics module
1287
1288 // Create save TAZ Edges module
1289 myTAZSaveChanges = new TAZSaveChanges(this);
1290
1291 // Create TAZ Edges Common Parameters module
1293
1294 // Create TAZ Edges Selection Statistics module
1296
1297 // Create TAZ Edges Common Parameters module
1299
1300 // by default there isn't a TAZ
1301 myCurrentTAZ->setTAZ(nullptr);
1302}
1303
1304
1306 // check if we have to delete base TAZ object
1307 if (myBaseTAZ) {
1308 delete myBaseTAZ;
1309 }
1310}
1311
1312
1313void
1315 // edit template
1316 myCurrentTAZ->setTAZ(nullptr);
1317 // show frame
1319}
1320
1321
1322void
1324 // hide frame
1326}
1327
1328
1329bool
1331 // Declare map to keep values
1332 std::map<SumoXMLAttr, std::string> valuesOfElement;
1333 if (myDrawingShape->isDrawing()) {
1334 // add or delete a new point depending of flag "delete last created point"
1337 } else {
1338 myDrawingShape->addNewPoint(clickedPosition);
1339 }
1340 return true;
1341 } else if ((myCurrentTAZ->getTAZ() == nullptr) || (viewObjects.getTAZFront() && myCurrentTAZ->getTAZ() && !myTAZSaveChanges->isChangesPending())) {
1342 // if user click over an TAZ and there isn't changes pending, then select a new TAZ
1343 if (viewObjects.getTAZFront()) {
1344 // avoid reset of Frame if user doesn't click over an TAZ
1345 myCurrentTAZ->setTAZ(viewObjects.getTAZFront());
1346 // update TAZStatistics
1349 return true;
1350 } else {
1351 return false;
1352 }
1353 } else if (viewObjects.getEdgeFront()) {
1354 // if toggle Edge is enabled, select edge. In other case create two new source/Sinks
1356 // create new source/Sinks or delete it
1357 return addOrRemoveTAZMember(viewObjects.getEdgeFront());
1358 } else {
1359 // first check if clicked edge was previously selected
1361 // clear selected edges
1363 } else {
1364 // iterate over TAZEdges saved in CurrentTAZ (it contains the Edge and Source/sinks)
1365 for (const auto& TAZEdgeColor : myCurrentTAZ->getTAZEdges()) {
1366 if (TAZEdgeColor.edge == viewObjects.getEdgeFront()) {
1367 // clear current selection (to avoid having two or more edges selected at the same time using mouse clicks)
1369 // now select edge
1370 myTAZSelectionStatistics->selectEdge(TAZEdgeColor);
1371 // edge selected, then return true
1372 return true;
1373 }
1374 }
1375 }
1376 // edge wasn't selected, then return false
1377 return false;
1378 }
1379 } else {
1380 // nothing to do
1381 return false;
1382 }
1383}
1384
1385
1386void
1387GNETAZFrame::processEdgeSelection(const std::vector<GNEEdge*>& edges) {
1388 // first check that a TAZ is selected
1389 if (myCurrentTAZ->getTAZ()) {
1390 // if "toggle Membership" is enabled, create new TAZSources/sinks. In other case simply select edges
1392 // iterate over edges
1393 for (const auto& edge : edges) {
1394 // first check if edge owns a TAZEge
1395 if (!myCurrentTAZ->isTAZEdge(edge)) {
1396 // create new TAZ Sources/Sinks
1398 }
1399 }
1400 } else {
1401 // iterate over edges
1402 for (const auto& edge : edges) {
1403 // first check that selected edge isn't already selected
1405 // iterate over TAZEdges saved in CurrentTAZ (it contains the Edge and Source/sinks)
1406 for (const auto& TAZEdgeColor : myCurrentTAZ->getTAZEdges()) {
1407 if (TAZEdgeColor.edge == edge) {
1408 myTAZSelectionStatistics->selectEdge(TAZEdgeColor);
1409 }
1410 }
1411 }
1412 }
1413 }
1414 }
1415}
1416
1417
1422
1423
1428
1429
1434
1435
1440
1441
1442bool
1444 // show warning dialogbox and stop check if input parameters are valid
1446 return false;
1447 } else if (myDrawingShape->getTemporalShape().size() < 3) {
1448 WRITE_WARNING(TL("TAZ shape needs at least three points"));
1449 return false;
1450 } else {
1451 // reset base TAZ element
1452 if (myBaseTAZ) {
1453 delete myBaseTAZ;
1454 }
1455 // create an new base additional
1458 // get attributes and values
1460 // generate new ID
1462 // obtain shape and close it
1464 shape.closePolygon();
1466 // set center if is invalid
1469 }
1470 // check if TAZ has to be created with edges
1472 // get all elements within shape
1474 // declare edge IDs
1475 std::vector<std::string> edgeIDs;
1476 edgeIDs.reserve(myViewNet->getViewObjectsSelector().getEdges().size());
1477 // get only edges with geometry around triangle
1478 for (const auto& edge : myViewNet->getViewObjectsSelector().getEdges()) {
1479 edgeIDs.push_back(edge->getID());
1480 }
1482 } else {
1483 // TAZ is created without edges
1484 myBaseTAZ->addStringListAttribute(SUMO_ATTR_EDGES, std::vector<std::string>());
1485 }
1486 // declare additional handler
1490 // build TAZ
1491 additionalHandler.parseSumoBaseObject(myBaseTAZ);
1492 // Write info
1493 WRITE_MESSAGE(TLF("Created % sources and sinks", (2 * myBaseTAZ->getStringListAttribute(SUMO_ATTR_EDGES).size())));
1494 // TAZ created, then return true
1495 return true;
1496 }
1497}
1498
1499
1500bool
1502 // first check if edge exist;
1503 if (edge) {
1504 // first check if already exist (in this case, remove it)
1505 for (const auto& TAZEdgeColor : myCurrentTAZ->getTAZEdges()) {
1506 if (TAZEdgeColor.edge == edge) {
1507 // enable save changes button
1509 // remove Source and Sinks using GNEChange_TAZElement
1510 if (myViewNet->getNet()->getAttributeCarriers()->retrieveAdditional(TAZEdgeColor.source->getGUIGlObject(), false)) {
1511 myViewNet->getUndoList()->add(new GNEChange_TAZSourceSink(TAZEdgeColor.source, false), true);
1512 }
1513 if (myViewNet->getNet()->getAttributeCarriers()->retrieveAdditional(TAZEdgeColor.sink->getGUIGlObject(), false)) {
1514 myViewNet->getUndoList()->add(new GNEChange_TAZSourceSink(TAZEdgeColor.sink, false), true);
1515 }
1516 // always refresh TAZ Edges after removing TAZSources/Sinks
1518 // update select edges button
1520 return true;
1521 }
1522 }
1523 // if wasn't found, then add it
1525 // create TAZ Sink using GNEChange_TAZElement and value of TAZChild default parameters
1527 myViewNet->getUndoList()->add(new GNEChange_TAZSourceSink(source, true), true);
1528 // create TAZ Sink using GNEChange_TAZElement and value of TAZChild default parameters
1530 myViewNet->getUndoList()->add(new GNEChange_TAZSourceSink(sink, true), true);
1531 // always refresh TAZ Edges after adding TAZSources/Sinks
1533 // update selected button
1535 return true;
1536 } else {
1537 throw ProcessError("Edge cannot be null");
1538 }
1539}
1540
1541
1542void
1544 // iterate over all TAZEdges
1545 for (const auto& TAZEdgeColor : myCurrentTAZ->getTAZEdges()) {
1546 // enable save changes button
1548 // remove Source and Sinks using GNEChange_TAZElement
1549 if (TAZEdgeColor.source) {
1550 myViewNet->getUndoList()->add(new GNEChange_TAZSourceSink(TAZEdgeColor.source, false), true);
1551 }
1552 if (TAZEdgeColor.sink) {
1553 myViewNet->getUndoList()->add(new GNEChange_TAZSourceSink(TAZEdgeColor.sink, false), true);
1554 }
1555 }
1556 // always refresh TAZ Edges after removing TAZSources/Sinks
1558}
1559
1560/****************************************************************************/
FXDEFMAP(GNETAZFrame::TAZSaveChanges) TAZSaveChangesMap[]
@ MID_GNE_SET_ATTRIBUTE
attribute edited
Definition GUIAppEnum.h:939
@ MID_CANCEL
Cancel-button pressed.
Definition GUIAppEnum.h:308
@ MID_CHOOSEN_OPERATION
set type of selection
Definition GUIAppEnum.h:597
@ MID_OK
Ok-button pressed.
Definition GUIAppEnum.h:306
@ MID_GNE_SELECT
select element
Definition GUIAppEnum.h:957
@ MID_GNE_SET_ZEROFRINGEPROB
set zero fringe probabilities (used in TAZ Frame)
#define GUIDesignButton
Definition GUIDesigns.h:82
#define GUIDesignTextField
Definition GUIDesigns.h:59
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
Definition GUIDesigns.h:399
#define GUIDesignLabel(justify)
Definition GUIDesigns.h:243
#define GUIDesignTextFieldNCol
Num of column of text field.
Definition GUIDesigns.h:74
#define GUIDesignCheckButton
checkButton placed in left position
Definition GUIDesigns.h:192
#define GUIDesignRadioButton
Definition GUIDesigns.h:229
#define GUIDesignLabelThickedFixed(width)
label thicked, icon before text, text centered and custom width
Definition GUIDesigns.h:252
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
Definition GUIDesigns.h:279
@ SAVE
save icons
#define WRITE_MESSAGE(msg)
Definition MsgHandler.h:289
#define WRITE_WARNING(msg)
Definition MsgHandler.h:287
#define TL(string)
Definition MsgHandler.h:305
#define TLF(string,...)
Definition MsgHandler.h:307
@ SUMO_TAG_TAZ
a traffic assignment zone
@ SUMO_TAG_TAZSINK
a sink within a district (connection road)
@ SUMO_TAG_TAZSOURCE
a source within a district (connection road)
@ GNE_ATTR_MAX_SOURCE
max source (used only by TAZs)
@ SUMO_ATTR_EDGE
@ GNE_ATTR_TAZCOLOR
Color of TAZSources/TAZSinks.
@ GNE_ATTR_MAX_SINK
max sink (used only by TAZs)
@ GNE_ATTR_AVERAGE_SINK
average sink (used only by TAZs)
@ GNE_ATTR_SELECTED
element is selected
@ GNE_ATTR_MIN_SINK
min sink (used only by TAZs)
@ SUMO_ATTR_EDGES
the edges of a route
@ GNE_ATTR_ADDITIONAL_FILE
additional save file
@ SUMO_ATTR_SHAPE
edge: the shape in xml-definition
@ SUMO_ATTR_WEIGHT
@ SUMO_ATTR_CENTER
@ GNE_ATTR_AVERAGE_SOURCE
average source (used only by TAZs)
@ SUMO_ATTR_ID
@ GNE_ATTR_EDGES_WITHIN
virtual attribute used for use edges within during TAZ creation
@ GNE_ATTR_MIN_SOURCE
min source (used only by TAZs)
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
Definition ToString.h:283
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:46
void parseSumoBaseObject(CommonXMLStructure::SumoBaseObject *obj)
parse SumoBaseObject (it's called recursivelly)
bool hasStringAttribute(const SumoXMLAttr attr) const
has function
void setTag(const SumoXMLTag tag)
set SumoBaseObject tag
const Position & getPositionAttribute(const SumoXMLAttr attr) const
get Position attribute
void addPositionVectorAttribute(const SumoXMLAttr attr, const PositionVector &value)
add PositionVector attribute into current SumoBaseObject node
void addStringListAttribute(const SumoXMLAttr attr, const std::vector< std::string > &value)
add string list attribute into current SumoBaseObject node
void addPositionAttribute(const SumoXMLAttr attr, const Position &value)
add Position attribute into current SumoBaseObject node
bool getBoolAttribute(const SumoXMLAttr attr) const
get bool attribute
void addStringAttribute(const SumoXMLAttr attr, const std::string &value)
add string attribute into current SumoBaseObject node
const std::vector< std::string > & getStringListAttribute(const SumoXMLAttr attr) const
get string list attribute
const std::string & getStringAttribute(const SumoXMLAttr attr) const
get string attribute
const GNETagProperties * getTagProperty() const
get tagProperty associated with this Attribute Carrier
GNENet * getNet() const
get pointer to net
SumoXMLAttr fillSumoBaseObject(CommonXMLStructure::SumoBaseObject *baseObject) const
fill sumo Base object
bool checkAttributes(const bool showWarning)
check if current edited attributes are valid
bool isDrawing() const
return true if currently a shape is drawed
void addNewPoint(const Position &P)
add new point to temporal shape
bool getDeleteLastCreatedPoint()
get flag delete last created point
void removeLastPoint()
remove last added point
const PositionVector & getTemporalShape() const
get Temporal shape
A road/street connecting two junctions (netedit-version)
Definition GNEEdge.h:53
static FXLabel * buildRainbow(FXComposite *parent)
build rainbow in frame modul
Definition GNEFrame.cpp:320
GNEViewNet * myViewNet
FOX need this.
Definition GNEFrame.h:121
virtual void show()
show Frame
Definition GNEFrame.cpp:119
virtual void hide()
hide Frame
Definition GNEFrame.cpp:128
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
std::string generateAdditionalID(SumoXMLTag type) const
generate additional id
GNEEdge * retrieveEdge(const std::string &id, bool hardFail=true) const
get edge by id
std::vector< GNEEdge * > getSelectedEdges() const
return all edges
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition GNENet.cpp:146
struct for edges and the source/sink colors
Definition GNETAZFrame.h:49
GNETAZSourceSink * sink
@brif sink TAZ
Definition GNETAZFrame.h:68
GNETAZSourceSink * source
source TAZ
Definition GNETAZFrame.h:65
~TAZEdgeColor()
destructor (needed because RGBColors has to be deleted)
void refreshTAZEdges()
refresh TAZEdges
double myMinSourceMinusSinkWeight
minimum source minus sink value of current TAZ Edges
bool isTAZEdge(GNEEdge *edge) const
check if given edge belongs to current TAZ
void addSourceSink(GNETAZSourceSink *additional)
add source sink
GNETAZFrame * myTAZFrameParent
pointer to TAZ Frame
GNETAZ * myEditedTAZ
current edited TAZ
const std::vector< CurrentTAZ::TAZEdgeColor > & getTAZEdges() const
get TAZEdges
void setTAZ(GNETAZ *editedTAZ)
set current TAZ
const std::vector< GNEEdge * > & getSelectedEdges() const
get current selected edges
double myMaxSourceMinusSinkWeight
maximum source minus sink value of current TAZ Edges
FXLabel * myCurrentTAZLabel
Label for current TAZ.
CurrentTAZ(GNETAZFrame *TAZFrameParent)
constructor
double myMaxSourcePlusSinkWeight
maximum source plus sink value of current TAZ Edges
double myMinSourcePlusSinkWeight
minimum source plus sink value of current TAZ Edges
GNETAZ * getTAZ() const
get current TAZ
bool getToggleMembership() const
check if toggle membership is enabled
FXButton * myUseSelectedEdges
button for use selected edges
TAZChildDefaultParameters(GNETAZFrame *TAZFrameParent)
FOX-declaration.
FXCheckButton * myToggleMembership
CheckButton to enable or disable Toggle edge Membership.
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
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
FXHorizontalFrame * myDefaultTAZSinkFrame
Horizontal Frame for default TAZ Sink Weight.
FXHorizontalFrame * myDefaultTAZSourceFrame
Horizontal Frame for default TAZ Source Weight.
FXHorizontalFrame * myToggleMembershipFrame
Horizontal Frame toggle membership.
long onCmdSetZeroFringeProbabilities(FXObject *obj, FXSelector, void *)
Called when the user press "zero fringe probabilities" button.
FXTextField * myTextFieldDefaultValueTAZSinks
textField to set a default value for TAZ Sinks
long onCmdSetDefaultValues(FXObject *obj, FXSelector, void *)
double getDefaultTAZSinkWeight() const
default sink weight
FXButton * myZeroFringeProbabilities
button for setting zero fringe probabilities
void showTAZCommonStatisticsModule()
show TAZ Common Statistics Module
TAZCommonStatistics(GNETAZFrame *TAZFrameParent)
constructor
FXLabel * myStatisticsLabel
Statistics labels.
void hideTAZCommonStatisticsModule()
hide TAZ Common Statistics Module
void updateStatistics()
update Statistics label
FXRadioButton * myColorBySourcePlusSinkWeight
add radio button "color source + sink"
RGBColor myEdgeSelectedColor
RGBColor color for selected egdes.
FXRadioButton * myColorBySinkWeight
add radio button "color by sink"
void showTAZEdgesGraphicModule()
show TAZ Edges Graphic Module
void updateEdgeColors()
update edge colors;
FXRadioButton * myColorBySourceWeight
add radio button "color by source"
FXRadioButton * myColorBySourceMinusSinkWeight
add radio button "color source - Sink"
RGBColor myEdgeDefaultColor
default RGBColor for all edges
long onCmdChoosenBy(FXObject *obj, FXSelector, void *)
void hideTAZEdgesGraphicModule()
hide TAZ Edges Graphic Module
TAZEdgesGraphic(GNETAZFrame *TAZFrameParent)
FOX-declaration.
bool isChangesPending() const
return true if there is changes to save
FXButton * mySaveChangesButton
@field FXButton for save changes in TAZEdges
void showTAZSaveChangesModule()
show TAZ Save Changes Module
FXButton * myCancelChangesButton
@field FXButton for cancel changes in TAZEdges
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.
void hideTAZSelectionStatisticsModule()
hide TAZ Selection Statistics Module
bool isEdgeSelected(GNEEdge *edge)
check if an edge is selected
FXHorizontalFrame * myTAZSinkFrame
Horizontal Frame for default TAZ Sink Weight.
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
void updateStatistics()
update TAZSelectionStatistics
FXTextField * myTextFieldTAZSinkWeight
textField for TAZ Sink weight
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.
TAZSelectionStatistics * myTAZSelectionStatistics
TAZ Edges selection parameters.
TAZSelectionStatistics * getTAZSelectionStatisticsModule() const
get TAZ Selection Statistics modul
TAZSaveChanges * getTAZSaveChangesModule() const
get TAZ Save Changes modul
GNEAttributesEditor * myTAZAttributesEditor
TAZ parameters.
CurrentTAZ * myCurrentTAZ
current TAZ
TAZEdgesGraphic * myTAZEdgesGraphic
TAZ Edges Graphic.
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.
GNEDrawingShape * myDrawingShape
Drawing shape.
bool shapeDrawed()
build a shaped element using the drawed shape return true if was successfully created
void show()
show TAZ Frame
~GNETAZFrame()
Destructor.
TAZSaveChanges * myTAZSaveChanges
save TAZ Edges
CommonXMLStructure::SumoBaseObject * myBaseTAZ
SumoBaseObject used for creating TAZ.
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.
GNETAZFrame(GNEViewParent *viewParent, GNEViewNet *viewNet)
Constructor.
void updateTAZStatistic()
update TAZ Statistic
Definition GNETAZ.cpp:592
double getWeight() const
get weight
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
void add(GNEChange *command, bool doit=false, bool merge=true)
Add new command, executing it if desired. The new command will be merged with the previous command if...
class used to group all variables related with objects under cursor after a click over view
GNEEdge * getEdgeFront() const
get front edge or a pointer to nullptr
GNETAZ * getTAZFront() const
get front TAZ or a pointer to nullptr
const std::vector< GNEEdge * > & getEdges() const
get vector with edges
GNENet * getNet() const
get the net object
GNEViewParent * getViewParent() const
get the net object
GNEUndoList * getUndoList() const
get the undoList object
const GNEViewNetHelper::ViewObjectsSelector & getViewObjectsSelector() const
get objects under cursor
void updateObjectsInShape(const PositionVector &shape)
get objects in the given shape (using triangulation)
A single child window which contains a view of the simulation area.
GNEApplicationWindow * getGNEAppWindows() const
get GNE Application Windows
static FXButton * buildFXButton(FXComposite *p, const std::string &text, const std::string &tip, const std::string &help, FXIcon *ic, FXObject *tgt, FXSelector sel, FXuint opts=BUTTON_NORMAL, FXint x=0, FXint y=0, FXint w=0, FXint h=0, FXint pl=DEFAULT_PAD, FXint pr=DEFAULT_PAD, FXint pt=DEFAULT_PAD, FXint pb=DEFAULT_PAD)
build button
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
A list item which allows for custom coloring.
MFXGroupBoxModule (based on FXGroupBox)
FXVerticalFrame * getCollapsableFrame()
get collapsable frame (used by all elements that will be collapsed if button is toggled)
static FXColor getFXColor(const RGBColor &col)
converts FXColor to RGBColor
Definition MFXUtils.cpp:145
static OptionsCont & getOptions()
Retrieves the options.
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
static const Position INVALID
used to indicate that a position is valid
Definition Position.h:319
A list of positions.
void closePolygon()
ensures that the last position equals the first
Position getCentroid() const
Returns the centroid (closes the polygon if unclosed)
static const RGBColor WHITE
Definition RGBColor.h:195
static const std::vector< RGBColor > & getRainbowScaledColors()
get scaled rainbow colors