80 sourcePlusSinkColor(0),
81 sourceMinusSinkColor(0),
82 myCurrentTAZParent(CurrentTAZParent) {
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;
96 double sourcePlusSinkWeight = sourceWeight + sinkWeight;
98 if ((myCurrentTAZParent->myMaxSourcePlusSinkWeight - myCurrentTAZParent->myMinSourcePlusSinkWeight) == 0) {
99 sourcePlusSinkColor = 0;
102 double percentage = (sourcePlusSinkWeight - myCurrentTAZParent->myMinSourcePlusSinkWeight) /
103 (myCurrentTAZParent->myMaxSourcePlusSinkWeight - myCurrentTAZParent->myMinSourcePlusSinkWeight);
105 if (percentage >= 1) {
106 sourcePlusSinkColor = 9;
107 }
else if (percentage < 0) {
108 sourcePlusSinkColor = 0;
110 sourcePlusSinkColor = (int)(percentage * 10);
114 double sourceMinusSinkWeight = sourceWeight - sinkWeight;
116 if ((myCurrentTAZParent->myMaxSourceMinusSinkWeight - myCurrentTAZParent->myMinSourceMinusSinkWeight) == 0) {
117 sourceMinusSinkColor = 0;
120 double percentage = (sourceMinusSinkWeight - myCurrentTAZParent->myMinSourceMinusSinkWeight) /
121 (myCurrentTAZParent->myMaxSourceMinusSinkWeight - myCurrentTAZParent->myMinSourceMinusSinkWeight);
123 if (percentage >= 1) {
124 sourceMinusSinkColor = 9;
125 }
else if (percentage < 0) {
126 sourceMinusSinkColor = 0;
128 sourceMinusSinkColor = (int)(percentage * 10);
140 sourcePlusSinkColor(0),
141 sourceMinusSinkColor(0),
142 myCurrentTAZParent(nullptr) {
165 myEditedTAZ = editedTAZ;
167 if (myEditedTAZ !=
nullptr) {
168 myCurrentTAZLabel->setText((
TL(
"Current TAZ: ") + myEditedTAZ->getID()).c_str());
174 myTAZFrameParent->myTAZAttributesEditor->hideAttributesEditor();
176 myTAZFrameParent->myDrawingShape->hideDrawingShape();
178 myTAZFrameParent->myTAZCommonStatistics->showTAZCommonStatisticsModule();
180 myTAZFrameParent->myTAZSaveChanges->showTAZSaveChangesModule();
182 myTAZFrameParent->myTAZChildDefaultParameters->extendTAZChildDefaultParameters();
184 myTAZFrameParent->myTAZEdgesGraphic->showTAZEdgesGraphicModule();
187 myTAZFrameParent->myTAZAttributesEditor->showAttributesEditor(myTAZFrameParent->getViewNet()->getNet()->getACTemplates()->getTemplateAC(
SUMO_TAG_TAZ),
true);
189 myTAZFrameParent->myDrawingShape->showDrawingShape();
191 myTAZFrameParent->myTAZCommonStatistics->hideTAZCommonStatisticsModule();
193 myTAZFrameParent->myTAZChildDefaultParameters->collapseTAZChildDefaultParameters();
195 myTAZFrameParent->myTAZEdgesGraphic->hideTAZEdgesGraphicModule();
197 myTAZFrameParent->myTAZSaveChanges->hideTAZSaveChangesModule();
199 myCurrentTAZLabel->setText(
TL(
"No TAZ selected"));
201 mySelectedEdges.clear();
203 myMaxSourcePlusSinkWeight = 0;
204 myMinSourcePlusSinkWeight = -1;
205 myMaxSourceMinusSinkWeight = 0;
206 myMinSourceMinusSinkWeight = -1;
230const std::vector<GNEEdge*>&
232 return mySelectedEdges;
236const std::vector<GNETAZFrame::CurrentTAZ::TAZEdgeColor>&
238 return myTAZEdgeColors;
245 myTAZEdgeColors.clear();
247 myMaxSourcePlusSinkWeight = 0;
248 myMinSourcePlusSinkWeight = -1;
249 myMaxSourceMinusSinkWeight = 0;
250 myMinSourceMinusSinkWeight = -1;
255 myTAZFrameParent->myTAZCommonStatistics->updateStatistics();
257 for (
const auto& TAZSourceSink : myEditedTAZ->getChildTAZSourceSinks()) {
258 addSourceSink(TAZSourceSink);
265 myTAZFrameParent->myTAZEdgesGraphic->updateEdgeColors();
274 bool createTAZEdge =
true;
277 createTAZEdge =
false;
289 myTAZEdgeColors.push_back(
TAZEdgeColor(
this, edge, sourceSink,
nullptr));
291 myTAZEdgeColors.push_back(
TAZEdgeColor(
this, edge,
nullptr, sourceSink));
295 myMaxSourcePlusSinkWeight = 0;
296 myMinSourcePlusSinkWeight = -1;
297 myMaxSourceMinusSinkWeight = 0;
298 myMinSourceMinusSinkWeight = -1;
305 if (sourcePlusSink > myMaxSourcePlusSinkWeight) {
306 myMaxSourcePlusSinkWeight = sourcePlusSink;
309 if ((myMinSourcePlusSinkWeight == -1) || (sourcePlusSink < myMinSourcePlusSinkWeight)) {
310 myMinSourcePlusSinkWeight = sourcePlusSink;
315 if (sourceMinusSink < 0) {
316 sourceMinusSink *= -1;
319 if (sourceMinusSink > myMaxSourceMinusSinkWeight) {
320 myMaxSourceMinusSinkWeight = sourceMinusSink;
323 if ((myMinSourceMinusSinkWeight == -1) || (sourceMinusSink < myMinSourceMinusSinkWeight)) {
324 myMinSourceMinusSinkWeight = sourceMinusSink;
336 myTAZFrameParent(TAZFrameParent) {
361 if (myTAZFrameParent->myCurrentTAZ->getTAZ()) {
363 std::ostringstream 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"
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"
374 myStatisticsLabel->setText(information.str().c_str());
376 myStatisticsLabel->setText(
TL(
"No TAZ Selected"));
386 myTAZFrameParent(TAZFrameParent) {
408 onCmdCancelChanges(0, 0, 0);
416 if (!mySaveChangesButton->isEnabled()) {
418 mySaveChangesButton->enable();
419 myCancelChangesButton->enable();
421 myTAZFrameParent->myViewNet->getUndoList()->begin(
GUIIcon::TAZ,
TL(
"TAZ changes"));
429 return myTAZFrameParent->shown() && mySaveChangesButton->isEnabled();
436 if (mySaveChangesButton->isEnabled()) {
438 mySaveChangesButton->disable();
439 myCancelChangesButton->disable();
441 myTAZFrameParent->myViewNet->getUndoList()->end();
443 myTAZFrameParent->myCurrentTAZ->refreshTAZEdges();
445 myTAZFrameParent->myTAZChildDefaultParameters->updateSelectEdgesButton();
455 if (mySaveChangesButton->isEnabled()) {
457 mySaveChangesButton->disable();
458 myCancelChangesButton->disable();
460 myTAZFrameParent->myViewNet->getUndoList()->abortAllChangeGroups();
462 myTAZFrameParent->myCurrentTAZ->refreshTAZEdges();
464 myTAZFrameParent->myTAZChildDefaultParameters->updateSelectEdgesButton();
475 myTAZFrameParent(TAZFrameParent),
476 myDefaultTAZSourceWeight(1),
477 myDefaultTAZSinkWeight(1) {
499 std::ostringstream information;
501 << std::string(
"- ") <<
TL(
"Toggle Membership:") <<
"\n"
502 << std::string(
" ") <<
TL(
"Create new Sources/Sinks with given weights.");
515 if (myToggleMembership->getCheck() == FALSE) {
516 myTAZFrameParent->myTAZSelectionStatistics->showTAZSelectionStatisticsModule();
518 myTAZFrameParent->myTAZSelectionStatistics->hideTAZSelectionStatisticsModule();
521 updateSelectEdgesButton();
523 myToggleMembershipFrame->show();
524 myDefaultTAZSourceFrame->show();
525 myDefaultTAZSinkFrame->show();
526 myUseSelectedEdges->show();
527 myInformationLabel->show();
534 myTAZFrameParent->myTAZSelectionStatistics->hideTAZSelectionStatisticsModule();
536 myToggleMembershipFrame->hide();
537 myDefaultTAZSourceFrame->hide();
538 myDefaultTAZSinkFrame->hide();
539 myUseSelectedEdges->hide();
540 myInformationLabel->hide();
546 if (myToggleMembership->getCheck() == TRUE) {
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();
555 myUseSelectedEdges->setText(
TL(
"Use selected edges"));
556 myUseSelectedEdges->disable();
558 }
else if (myTAZFrameParent->getCurrentTAZModule()->getTAZEdges().size() > 0) {
560 myUseSelectedEdges->enable();
562 if (myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected().size() == 0) {
564 bool allSelected =
true;
565 for (
const auto& TAZEdgeColor : myTAZFrameParent->getCurrentTAZModule()->getTAZEdges()) {
566 if (!TAZEdgeColor.edge->isAttributeCarrierSelected()) {
571 myUseSelectedEdges->setText(
TL(
"Remove all edges from selection"));
573 myUseSelectedEdges->setText(
TL(
"Add all edges to selection"));
575 }
else if (myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected().size() == 1) {
576 if (myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected().front().edge->isAttributeCarrierSelected()) {
577 myUseSelectedEdges->setText(
TL(
"Remove edge from selection"));
579 myUseSelectedEdges->setText(
TL(
"Add edge to selection"));
583 bool allSelected =
true;
584 for (
const auto& selectedEdge : myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected()) {
585 if (!selectedEdge.edge->isAttributeCarrierSelected()) {
590 myUseSelectedEdges->setText((
TL(
"Remove ") +
toString(myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected().size()) +
TL(
" edges from to selection")).c_str());
592 myUseSelectedEdges->setText((
TL(
"Add ") +
toString(myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected().size()) +
TL(
" edges to selection")).c_str());
597 myUseSelectedEdges->disable();
604 return myDefaultTAZSourceWeight;
610 return myDefaultTAZSinkWeight;
616 return (myToggleMembership->getCheck() == TRUE);
623 if (obj == myToggleMembership) {
625 myTAZFrameParent->myTAZSelectionStatistics->clearSelectedEdges();
627 if (myToggleMembership->getCheck() == TRUE) {
628 myToggleMembership->setText(
TL(
"toggle"));
630 myDefaultTAZSourceFrame->show();
631 myDefaultTAZSinkFrame->show();
633 std::ostringstream 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());
639 myTAZFrameParent->myTAZSelectionStatistics->hideTAZSelectionStatisticsModule();
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"));
646 myUseSelectedEdges->setText(
TL(
"Use selected edges"));
647 myUseSelectedEdges->disable();
650 myToggleMembership->setText(
TL(
"keep"));
652 myDefaultTAZSourceFrame->hide();
653 myDefaultTAZSinkFrame->hide();
655 std::ostringstream 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());
661 myTAZFrameParent->myTAZSelectionStatistics->showTAZSelectionStatisticsModule();
664 updateSelectEdgesButton();
665 }
else if (obj == myTextFieldDefaultValueTAZSources) {
667 if (GNEAttributeCarrier::canParse<double>(myTextFieldDefaultValueTAZSources->getText().text())) {
668 myDefaultTAZSourceWeight = GNEAttributeCarrier::parse<double>(myTextFieldDefaultValueTAZSources->getText().text());
670 if (myDefaultTAZSourceWeight >= 0) {
672 myTextFieldDefaultValueTAZSources->setTextColor(FXRGB(0, 0, 0));
675 myTextFieldDefaultValueTAZSources->setTextColor(FXRGB(255, 0, 0));
676 myDefaultTAZSourceWeight = 1;
680 myTextFieldDefaultValueTAZSources->setTextColor(FXRGB(255, 0, 0));
681 myDefaultTAZSourceWeight = 1;
683 }
else if (obj == myTextFieldDefaultValueTAZSinks) {
685 if (GNEAttributeCarrier::canParse<double>(myTextFieldDefaultValueTAZSinks->getText().text())) {
686 myDefaultTAZSinkWeight = GNEAttributeCarrier::parse<double>(myTextFieldDefaultValueTAZSinks->getText().text());
688 if (myDefaultTAZSinkWeight >= 0) {
690 myTextFieldDefaultValueTAZSinks->setTextColor(FXRGB(0, 0, 0));
693 myTextFieldDefaultValueTAZSinks->setTextColor(FXRGB(255, 0, 0));
694 myDefaultTAZSinkWeight = 1;
698 myTextFieldDefaultValueTAZSinks->setTextColor(FXRGB(255, 0, 0));
699 myDefaultTAZSinkWeight = 1;
709 if (myToggleMembership->getCheck() == TRUE) {
711 myTAZFrameParent->dropTAZMembers();
713 for (
const auto& selectedEdge : myTAZFrameParent->myCurrentTAZ->getSelectedEdges()) {
714 myTAZFrameParent->addOrRemoveTAZMember(selectedEdge);
717 updateSelectEdgesButton();
719 if (myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected().size() == 0) {
721 bool allSelected =
true;
722 for (
const auto& TAZEdgeColor : myTAZFrameParent->getCurrentTAZModule()->getTAZEdges()) {
723 if (!TAZEdgeColor.edge->isAttributeCarrierSelected()) {
730 for (
const auto& TAZEdgeColor : myTAZFrameParent->getCurrentTAZModule()->getTAZEdges()) {
732 TAZEdgeColor.edge->unselectAttributeCarrier();
736 for (
const auto& TAZEdgeColor : myTAZFrameParent->getCurrentTAZModule()->getTAZEdges()) {
738 TAZEdgeColor.edge->selectAttributeCarrier();
743 bool allSelected =
true;
744 for (
const auto& selectedEdge : myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected()) {
745 if (!selectedEdge.edge->isAttributeCarrierSelected()) {
752 for (
const auto& selectedEdge : myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected()) {
753 if (selectedEdge.edge->isAttributeCarrierSelected()) {
755 selectedEdge.edge->unselectAttributeCarrier();
760 for (
const auto& selectedEdge : myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected()) {
761 if (!selectedEdge.edge->isAttributeCarrierSelected()) {
763 selectedEdge.edge->selectAttributeCarrier();
770 myTAZFrameParent->myTAZChildDefaultParameters->updateSelectEdgesButton();
772 myTAZFrameParent->myViewNet->updateViewNet();
781 myTAZFrameParent->getViewNet()->getNet()->computeAndUpdate(neteditOptions,
false);
782 myTAZFrameParent->getViewNet()->update();
784 std::vector<GNETAZSourceSink*> sources;
785 std::vector<GNETAZSourceSink*> sinks;
786 std::set<GNEAdditional*> TAZs;
788 if (myTAZFrameParent->myCurrentTAZ->getTAZ() !=
nullptr) {
790 for (
const auto& TAZSourceSink : myTAZFrameParent->myCurrentTAZ->getTAZ()->getChildTAZSourceSinks()) {
793 if (!TAZSourceSink->getParentEdges().front()->hasSuccessors() &&
795 sources.push_back(TAZSourceSink);
796 TAZs.insert(myTAZFrameParent->myCurrentTAZ->getTAZ());
800 if (!TAZSourceSink->getParentEdges().front()->hasPredecessors() &&
802 sinks.push_back(TAZSourceSink);
803 TAZs.insert(myTAZFrameParent->myCurrentTAZ->getTAZ());
809 for (
const auto&
TAZ : myTAZFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getAdditionals().at(
SUMO_TAG_TAZ)) {
811 for (
const auto& TAZSourceSink :
TAZ.second->getChildTAZSourceSinks()) {
814 if (!TAZSourceSink->getParentEdges().front()->hasSuccessors() &&
816 sources.push_back(TAZSourceSink);
817 TAZs.insert(
TAZ.second);
821 if (!TAZSourceSink->getParentEdges().front()->hasPredecessors() &&
823 sinks.push_back(TAZSourceSink);
824 TAZs.insert(
TAZ.second);
831 if ((sources.size() + sinks.size()) > 0) {
833 const std::string text = (TAZs.size() == 1) ?
835 TL(
"Set weight 0 in ") +
toString(sources.size()) +
TL(
" sources and ") +
836 toString(sinks.size()) +
TL(
" sinks from TAZ '") + (*TAZs.begin())->getID() +
"'?" :
838 TL(
"Set weight 0 in ") +
toString(sources.size()) +
TL(
" sources and ") +
841 const FXuint answer = FXMessageBox::question(
this, MBOX_YES_NO,
TL(
"Set zero fringe probabilities"),
"%s", text.c_str());
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());
847 for (
const auto& sink : sinks) {
848 sink->setAttribute(
SUMO_ATTR_WEIGHT,
"0", myTAZFrameParent->myViewNet->getUndoList());
850 myTAZFrameParent->myViewNet->getUndoList()->end();
854 FXMessageBox::information(
this, MBOX_OK,
TL(
"Set zero fringe probabilities"),
TL(
"No source/sinks to update."));
865 myTAZFrameParent(TAZFrameParent) {
895 clearSelectedEdges();
903 for (
const auto& selectedEdge : myEdgeAndTAZChildrenSelected) {
904 if (selectedEdge.edge == TAZEdgeColor.
edge) {
909 myEdgeAndTAZChildrenSelected.push_back(TAZEdgeColor);
913 myTAZFrameParent->myTAZEdgesGraphic->updateEdgeColors();
915 myTAZFrameParent->myTAZChildDefaultParameters->updateSelectEdgesButton();
924 for (
auto it = myEdgeAndTAZChildrenSelected.begin(); it != myEdgeAndTAZChildrenSelected.end(); it++) {
925 if (it->edge == edge) {
926 myEdgeAndTAZChildrenSelected.erase(it);
930 myTAZFrameParent->myTAZEdgesGraphic->updateEdgeColors();
932 myTAZFrameParent->myTAZChildDefaultParameters->updateSelectEdgesButton();
947 for (
const auto& selectedEdge : myEdgeAndTAZChildrenSelected) {
948 if (selectedEdge.edge == edge) {
960 myEdgeAndTAZChildrenSelected.clear();
964 myTAZFrameParent->myTAZEdgesGraphic->updateEdgeColors();
966 myTAZFrameParent->myTAZChildDefaultParameters->updateSelectEdgesButton();
970const std::vector<GNETAZFrame::CurrentTAZ::TAZEdgeColor>&
972 return myEdgeAndTAZChildrenSelected;
978 if (obj == myTextFieldTAZSourceWeight) {
980 if (GNEAttributeCarrier::canParse<double>(myTextFieldTAZSourceWeight->getText().text())) {
981 double newTAZSourceWeight = GNEAttributeCarrier::parse<double>(myTextFieldTAZSourceWeight->getText().text());
983 if (newTAZSourceWeight >= 0) {
985 myTextFieldTAZSourceWeight->setTextColor(FXRGB(0, 0, 0));
987 myTAZFrameParent->myTAZSaveChanges->enableButtonsAndBeginUndoList();
989 for (
const auto& selectedEdge : myEdgeAndTAZChildrenSelected) {
990 selectedEdge.source->setAttribute(
SUMO_ATTR_WEIGHT, myTextFieldTAZSourceWeight->getText().text(), myTAZFrameParent->myViewNet->getUndoList());
993 myTAZFrameParent->getCurrentTAZModule()->refreshTAZEdges();
996 myTextFieldTAZSourceWeight->setTextColor(FXRGB(255, 0, 0));
1000 myTextFieldTAZSourceWeight->setTextColor(FXRGB(255, 0, 0));
1002 }
else if (obj == myTextFieldTAZSinkWeight) {
1004 if (GNEAttributeCarrier::canParse<double>(myTextFieldTAZSinkWeight->getText().text())) {
1005 double newTAZSinkWeight = GNEAttributeCarrier::parse<double>(myTextFieldTAZSinkWeight->getText().text());
1007 if (newTAZSinkWeight >= 0) {
1009 myTextFieldTAZSinkWeight->setTextColor(FXRGB(0, 0, 0));
1011 myTAZFrameParent->myTAZSaveChanges->enableButtonsAndBeginUndoList();
1013 for (
const auto& selectedEdge : myEdgeAndTAZChildrenSelected) {
1014 selectedEdge.sink->setAttribute(
SUMO_ATTR_WEIGHT, myTextFieldTAZSinkWeight->getText().text(), myTAZFrameParent->myViewNet->getUndoList());
1017 myTAZFrameParent->getCurrentTAZModule()->refreshTAZEdges();
1020 myTextFieldTAZSinkWeight->setTextColor(FXRGB(255, 0, 0));
1024 myTextFieldTAZSinkWeight->setTextColor(FXRGB(255, 0, 0));
1033 if (myEdgeAndTAZChildrenSelected.size() == 0) {
1035 for (
const auto& TAZEdgeColor : myTAZFrameParent->getCurrentTAZModule()->getTAZEdges()) {
1037 if (!TAZEdgeColor.edge->isAttributeCarrierSelected()) {
1039 myTAZFrameParent->myTAZSaveChanges->enableButtonsAndBeginUndoList();
1041 TAZEdgeColor.edge->setAttribute(
GNE_ATTR_SELECTED,
"true", myTAZFrameParent->myViewNet->getUndoList());
1046 for (
const auto& selectedEdge : myEdgeAndTAZChildrenSelected) {
1048 if (!selectedEdge.edge->isAttributeCarrierSelected()) {
1050 myTAZFrameParent->myTAZSaveChanges->enableButtonsAndBeginUndoList();
1052 selectedEdge.edge->setAttribute(
GNE_ATTR_SELECTED,
"true", myTAZFrameParent->myViewNet->getUndoList());
1062 if (myEdgeAndTAZChildrenSelected.size() > 0) {
1064 myTAZSourceFrame->show();
1065 myTAZSinkFrame->show();
1067 std::set<std::string> weightSourceSet;
1068 std::set<std::string> weightSinkSet;
1071 double maxWeightSource = 0;
1072 double minWeightSource = -1;
1073 double averageWeightSource = 0;
1074 double maxWeightSink = 0;
1075 double minWeightSink = -1;
1076 double averageWeightSink = 0;
1078 for (
const auto& selectedEdge : myEdgeAndTAZChildrenSelected) {
1080 weight = selectedEdge.source->getWeight();
1082 weightSourceSet.insert(
toString(weight));
1084 if (maxWeightSource < weight) {
1085 maxWeightSource = weight;
1088 if (minWeightSource == -1 || (maxWeightSource < weight)) {
1089 minWeightSource = weight;
1092 averageWeightSource += weight;
1094 weight = selectedEdge.sink->getWeight();
1096 weightSinkSet.insert(
toString(weight));
1098 if (maxWeightSink < weight) {
1099 maxWeightSink = weight;
1102 if (minWeightSink == -1 || (maxWeightSink < weight)) {
1103 minWeightSink = weight;
1106 averageWeightSink += weight;
1109 averageWeightSource /= (double)myEdgeAndTAZChildrenSelected.size();
1110 averageWeightSink /= (double)myEdgeAndTAZChildrenSelected.size();
1112 std::ostringstream information;
1113 std::string edgeInformation;
1115 if (myEdgeAndTAZChildrenSelected.size() == 1) {
1116 edgeInformation =
TL(
"- Edge ID: ") + myEdgeAndTAZChildrenSelected.begin()->edge->getID();
1118 edgeInformation =
TL(
"- Number of edges: ") +
toString(myEdgeAndTAZChildrenSelected.size());
1122 << edgeInformation <<
"\n"
1123 <<
TL(
"- Min source: ") <<
toString(minWeightSource) <<
"\n"
1124 <<
TL(
"- Max source: ") <<
toString(maxWeightSource) <<
"\n"
1125 <<
TL(
"- Average source: ") <<
toString(averageWeightSource) <<
"\n"
1127 <<
TL(
"- Min sink: ") <<
toString(minWeightSink) <<
"\n"
1128 <<
TL(
"- Max sink: ") <<
toString(maxWeightSink) <<
"\n"
1129 <<
TL(
"- Average sink: ") <<
toString(averageWeightSink);
1131 myStatisticsLabel->setText(information.str().c_str());
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));
1139 myTAZSourceFrame->hide();
1140 myTAZSinkFrame->hide();
1142 myStatisticsLabel->setText(
TL(
"No edges selected"));
1152 myTAZFrameParent(TAZFrameParent),
1153 myEdgeDefaultColor(
RGBColor::GREY),
1154 myEdgeSelectedColor(
RGBColor::MAGENTA) {
1191 for (
const auto& edge : myTAZFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
1192 for (
const auto& lane : edge.second->getChildLanes()) {
1193 lane->setSpecialColor(
nullptr);
1204 for (
const auto& edge : myTAZFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
1205 if (!edge.second->isAttributeCarrierSelected()) {
1207 for (
const auto lane : edge.second->getChildLanes()) {
1208 lane->setSpecialColor(&myEdgeDefaultColor);
1213 for (
const auto& TAZEdgeColor : myTAZFrameParent->myCurrentTAZ->getTAZEdges()) {
1214 if (!TAZEdgeColor.edge->isAttributeCarrierSelected()) {
1216 for (
const auto& lane : TAZEdgeColor.edge->getChildLanes()) {
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());
1225 lane->setSpecialColor(&scaledColors.at(TAZEdgeColor.sourceMinusSinkColor), TAZEdgeColor.source->getWeight() - TAZEdgeColor.sink->getWeight());
1231 for (
const auto& selectedEdge : myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected()) {
1232 if (!selectedEdge.edge->isAttributeCarrierSelected()) {
1234 for (
const auto& lane : selectedEdge.edge->getChildLanes()) {
1235 lane->setSpecialColor(&myEdgeSelectedColor);
1240 myTAZFrameParent->myViewNet->updateViewNet();
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);
1332 std::map<SumoXMLAttr, std::string> valuesOfElement;
1393 for (
const auto& edge : edges) {
1402 for (
const auto& edge : edges) {
1407 if (TAZEdgeColor.edge == edge) {
1475 std::vector<std::string> edgeIDs;
1479 edgeIDs.push_back(edge->getID());
1506 if (TAZEdgeColor.edge == edge) {
1549 if (TAZEdgeColor.source) {
1552 if (TAZEdgeColor.sink) {
FXDEFMAP(GNETAZFrame::TAZSaveChanges) TAZSaveChangesMap[]
@ MID_GNE_SET_ATTRIBUTE
attribute edited
@ MID_CANCEL
Cancel-button pressed.
@ MID_CHOOSEN_OPERATION
set type of selection
@ MID_OK
Ok-button pressed.
@ MID_GNE_SELECT
select element
@ MID_GNE_SET_ZEROFRINGEPROB
set zero fringe probabilities (used in TAZ Frame)
#define GUIDesignTextField
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
#define GUIDesignLabel(justify)
#define GUIDesignTextFieldNCol
Num of column of text field.
#define GUIDesignCheckButton
checkButton placed in left position
#define GUIDesignRadioButton
#define GUIDesignLabelThickedFixed(width)
label thicked, icon before text, text centered and custom width
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
#define WRITE_MESSAGE(msg)
#define WRITE_WARNING(msg)
@ 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)
@ 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
@ GNE_ATTR_AVERAGE_SOURCE
average source (used only by TAZs)
@ 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)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
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
bool isUndoRedoAllowed() const
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)
static FXLabel * buildRainbow(FXComposite *parent)
build rainbow in frame modul
GNEViewNet * myViewNet
FOX need this.
virtual void show()
show Frame
virtual void hide()
hide Frame
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
struct for edges and the source/sink colors
GNETAZSourceSink * sink
@brif sink TAZ
void updateColors()
update colors
GNETAZSourceSink * source
source TAZ
TAZEdgeColor()
default color
~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.
~TAZChildDefaultParameters()
destructor
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
~TAZCommonStatistics()
destructor
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
~TAZEdgesGraphic()
destructor
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
~TAZSaveChanges()
destructor
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.
~TAZSelectionStatistics()
destructor
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
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
static OptionsCont & getOptions()
Retrieves the options.
A point in 2D or 3D with translation and scaling methods.
static const Position INVALID
used to indicate that a position is valid
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
static const std::vector< RGBColor > & getRainbowScaledColors()
get scaled rainbow colors