82 sourcePlusSinkColor(0),
83 sourceMinusSinkColor(0),
84 myCurrentTAZParent(CurrentTAZParent) {
93 sourceColor = source ? GNEAttributeCarrier::parse<int>(source->getAttribute(
GNE_ATTR_TAZCOLOR)) : 0;
94 sinkColor = sink ? GNEAttributeCarrier::parse<int>(sink->getAttribute(
GNE_ATTR_TAZCOLOR)) : 0;
95 double sourceWeight = source ? source->getWeight() : 0;
96 double sinkWeight = sink ? sink->getWeight() : 0;
98 double sourcePlusSinkWeight = sourceWeight + sinkWeight;
100 if ((myCurrentTAZParent->myMaxSourcePlusSinkWeight - myCurrentTAZParent->myMinSourcePlusSinkWeight) == 0) {
101 sourcePlusSinkColor = 0;
104 double percentage = (sourcePlusSinkWeight - myCurrentTAZParent->myMinSourcePlusSinkWeight) /
105 (myCurrentTAZParent->myMaxSourcePlusSinkWeight - myCurrentTAZParent->myMinSourcePlusSinkWeight);
107 if (percentage >= 1) {
108 sourcePlusSinkColor = 9;
109 }
else if (percentage < 0) {
110 sourcePlusSinkColor = 0;
112 sourcePlusSinkColor = (int)(percentage * 10);
116 double sourceMinusSinkWeight = sourceWeight - sinkWeight;
118 if ((myCurrentTAZParent->myMaxSourceMinusSinkWeight - myCurrentTAZParent->myMinSourceMinusSinkWeight) == 0) {
119 sourceMinusSinkColor = 0;
122 double percentage = (sourceMinusSinkWeight - myCurrentTAZParent->myMinSourceMinusSinkWeight) /
123 (myCurrentTAZParent->myMaxSourceMinusSinkWeight - myCurrentTAZParent->myMinSourceMinusSinkWeight);
125 if (percentage >= 1) {
126 sourceMinusSinkColor = 9;
127 }
else if (percentage < 0) {
128 sourceMinusSinkColor = 0;
130 sourceMinusSinkColor = (int)(percentage * 10);
142 sourcePlusSinkColor(0),
143 sourceMinusSinkColor(0),
144 myCurrentTAZParent(nullptr) {
167 myEditedTAZ = editedTAZ;
169 if (myEditedTAZ !=
nullptr) {
170 myCurrentTAZLabel->setText((
TL(
"Current TAZ: ") + myEditedTAZ->getID()).c_str());
176 myTAZFrameParent->myTAZAttributesEditor->hideAttributesEditor();
178 myTAZFrameParent->myDrawingShape->hideDrawingShape();
180 myTAZFrameParent->myTAZCommonStatistics->showTAZCommonStatisticsModule();
182 myTAZFrameParent->myTAZSaveChanges->showTAZSaveChangesModule();
184 myTAZFrameParent->myTAZChildDefaultParameters->extendTAZChildDefaultParameters();
186 myTAZFrameParent->myTAZEdgesGraphic->showTAZEdgesGraphicModule();
189 myTAZFrameParent->myTAZAttributesEditor->showAttributesEditor(myTAZFrameParent->getViewNet()->getNet()->getACTemplates()->getTemplateAC(
SUMO_TAG_TAZ),
true);
191 myTAZFrameParent->myDrawingShape->showDrawingShape();
193 myTAZFrameParent->myTAZCommonStatistics->hideTAZCommonStatisticsModule();
195 myTAZFrameParent->myTAZChildDefaultParameters->collapseTAZChildDefaultParameters();
197 myTAZFrameParent->myTAZEdgesGraphic->hideTAZEdgesGraphicModule();
199 myTAZFrameParent->myTAZSaveChanges->hideTAZSaveChangesModule();
201 myCurrentTAZLabel->setText(
TL(
"No TAZ selected"));
203 mySelectedEdges.clear();
205 myMaxSourcePlusSinkWeight = 0;
206 myMinSourcePlusSinkWeight = -1;
207 myMaxSourceMinusSinkWeight = 0;
208 myMinSourceMinusSinkWeight = -1;
232const std::vector<GNEEdge*>&
234 return mySelectedEdges;
238const std::vector<GNETAZFrame::CurrentTAZ::TAZEdgeColor>&
240 return myTAZEdgeColors;
247 myTAZEdgeColors.clear();
249 myMaxSourcePlusSinkWeight = 0;
250 myMinSourcePlusSinkWeight = -1;
251 myMaxSourceMinusSinkWeight = 0;
252 myMinSourceMinusSinkWeight = -1;
257 myTAZFrameParent->myTAZCommonStatistics->updateStatistics();
259 for (
const auto& TAZSourceSink : myEditedTAZ->getChildTAZSourceSinks()) {
260 addSourceSink(TAZSourceSink);
267 myTAZFrameParent->myTAZEdgesGraphic->updateEdgeColors();
276 bool createTAZEdge =
true;
279 createTAZEdge =
false;
291 myTAZEdgeColors.push_back(
TAZEdgeColor(
this, edge, sourceSink,
nullptr));
293 myTAZEdgeColors.push_back(
TAZEdgeColor(
this, edge,
nullptr, sourceSink));
297 myMaxSourcePlusSinkWeight = 0;
298 myMinSourcePlusSinkWeight = -1;
299 myMaxSourceMinusSinkWeight = 0;
300 myMinSourceMinusSinkWeight = -1;
307 if (sourcePlusSink > myMaxSourcePlusSinkWeight) {
308 myMaxSourcePlusSinkWeight = sourcePlusSink;
311 if ((myMinSourcePlusSinkWeight == -1) || (sourcePlusSink < myMinSourcePlusSinkWeight)) {
312 myMinSourcePlusSinkWeight = sourcePlusSink;
317 if (sourceMinusSink < 0) {
318 sourceMinusSink *= -1;
321 if (sourceMinusSink > myMaxSourceMinusSinkWeight) {
322 myMaxSourceMinusSinkWeight = sourceMinusSink;
325 if ((myMinSourceMinusSinkWeight == -1) || (sourceMinusSink < myMinSourceMinusSinkWeight)) {
326 myMinSourceMinusSinkWeight = sourceMinusSink;
338 myTAZFrameParent(TAZFrameParent) {
363 if (myTAZFrameParent->myCurrentTAZ->getTAZ()) {
365 std::ostringstream information;
367 <<
TL(
"- Number of edges: ") <<
toString(myTAZFrameParent->myCurrentTAZ->getTAZ()->getChildTAZSourceSinks().size() / 2) <<
"\n"
368 <<
TL(
"- Min source: ") << myTAZFrameParent->myCurrentTAZ->getTAZ()->getAttribute(
GNE_ATTR_MIN_SOURCE) <<
"\n"
369 <<
TL(
"- Max source: ") << myTAZFrameParent->myCurrentTAZ->getTAZ()->getAttribute(
GNE_ATTR_MAX_SOURCE) <<
"\n"
372 <<
TL(
"- Min sink: ") << myTAZFrameParent->myCurrentTAZ->getTAZ()->getAttribute(
GNE_ATTR_MIN_SINK) <<
"\n"
373 <<
TL(
"- Max sink: ") << myTAZFrameParent->myCurrentTAZ->getTAZ()->getAttribute(
GNE_ATTR_MAX_SINK) <<
"\n"
376 myStatisticsLabel->setText(information.str().c_str());
378 myStatisticsLabel->setText(
TL(
"No TAZ Selected"));
388 myTAZFrameParent(TAZFrameParent) {
410 onCmdCancelChanges(0, 0, 0);
418 if (!mySaveChangesButton->isEnabled()) {
420 mySaveChangesButton->enable();
421 myCancelChangesButton->enable();
423 myTAZFrameParent->myViewNet->getUndoList()->begin(
GUIIcon::TAZ,
TL(
"TAZ changes"));
431 return myTAZFrameParent->shown() && mySaveChangesButton->isEnabled();
438 if (mySaveChangesButton->isEnabled()) {
440 mySaveChangesButton->disable();
441 myCancelChangesButton->disable();
443 myTAZFrameParent->myViewNet->getUndoList()->end();
445 myTAZFrameParent->myCurrentTAZ->refreshTAZEdges();
447 myTAZFrameParent->myTAZChildDefaultParameters->updateSelectEdgesButton();
457 if (mySaveChangesButton->isEnabled()) {
459 mySaveChangesButton->disable();
460 myCancelChangesButton->disable();
462 myTAZFrameParent->myViewNet->getUndoList()->abortAllChangeGroups();
464 myTAZFrameParent->myCurrentTAZ->refreshTAZEdges();
466 myTAZFrameParent->myTAZChildDefaultParameters->updateSelectEdgesButton();
477 myTAZFrameParent(TAZFrameParent),
478 myDefaultTAZSourceWeight(1),
479 myDefaultTAZSinkWeight(1) {
501 std::ostringstream information;
503 << std::string(
"- ") <<
TL(
"Toggle Membership:") <<
"\n"
504 << std::string(
" ") <<
TL(
"Create new Sources/Sinks with given weights.");
517 if (myToggleMembership->getCheck() == FALSE) {
518 myTAZFrameParent->myTAZSelectionStatistics->showTAZSelectionStatisticsModule();
520 myTAZFrameParent->myTAZSelectionStatistics->hideTAZSelectionStatisticsModule();
523 updateSelectEdgesButton();
525 myToggleMembershipFrame->show();
526 myDefaultTAZSourceFrame->show();
527 myDefaultTAZSinkFrame->show();
528 myUseSelectedEdges->show();
529 myInformationLabel->show();
536 myTAZFrameParent->myTAZSelectionStatistics->hideTAZSelectionStatisticsModule();
538 myToggleMembershipFrame->hide();
539 myDefaultTAZSourceFrame->hide();
540 myDefaultTAZSinkFrame->hide();
541 myUseSelectedEdges->hide();
542 myInformationLabel->hide();
548 if (myToggleMembership->getCheck() == TRUE) {
550 if (myTAZFrameParent->myCurrentTAZ->getSelectedEdges().size() > 0) {
551 myUseSelectedEdges->setText(
TL(
"Use selected edges"));
552 myUseSelectedEdges->enable();
553 }
else if (myTAZFrameParent->myCurrentTAZ->getTAZEdges().size() > 0) {
554 myUseSelectedEdges->setText(
TL(
"Remove all edges"));
555 myUseSelectedEdges->enable();
557 myUseSelectedEdges->setText(
TL(
"Use selected edges"));
558 myUseSelectedEdges->disable();
560 }
else if (myTAZFrameParent->getCurrentTAZModule()->getTAZEdges().size() > 0) {
562 myUseSelectedEdges->enable();
564 if (myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected().size() == 0) {
566 bool allSelected =
true;
567 for (
const auto& TAZEdgeColor : myTAZFrameParent->getCurrentTAZModule()->getTAZEdges()) {
568 if (!TAZEdgeColor.edge->isAttributeCarrierSelected()) {
573 myUseSelectedEdges->setText(
TL(
"Remove all edges from selection"));
575 myUseSelectedEdges->setText(
TL(
"Add all edges to selection"));
577 }
else if (myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected().size() == 1) {
578 if (myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected().front().edge->isAttributeCarrierSelected()) {
579 myUseSelectedEdges->setText(
TL(
"Remove edge from selection"));
581 myUseSelectedEdges->setText(
TL(
"Add edge to selection"));
585 bool allSelected =
true;
586 for (
const auto& selectedEdge : myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected()) {
587 if (!selectedEdge.edge->isAttributeCarrierSelected()) {
592 myUseSelectedEdges->setText((
TL(
"Remove ") +
toString(myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected().size()) +
TL(
" edges from to selection")).c_str());
594 myUseSelectedEdges->setText((
TL(
"Add ") +
toString(myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected().size()) +
TL(
" edges to selection")).c_str());
599 myUseSelectedEdges->disable();
606 return myDefaultTAZSourceWeight;
612 return myDefaultTAZSinkWeight;
618 return (myToggleMembership->getCheck() == TRUE);
625 if (obj == myToggleMembership) {
627 myTAZFrameParent->myTAZSelectionStatistics->clearSelectedEdges();
629 if (myToggleMembership->getCheck() == TRUE) {
630 myToggleMembership->setText(
TL(
"toggle"));
632 myDefaultTAZSourceFrame->show();
633 myDefaultTAZSinkFrame->show();
635 std::ostringstream information;
637 << std::string(
"- ") <<
TL(
"Toggle Membership:") <<
"\n"
638 << std::string(
" ") <<
TL(
"Create new Sources/Sinks with given weights.");
639 myInformationLabel->setText(information.str().c_str());
641 myTAZFrameParent->myTAZSelectionStatistics->hideTAZSelectionStatisticsModule();
643 if (myTAZFrameParent->myCurrentTAZ->getSelectedEdges().size() > 0) {
644 myUseSelectedEdges->setText(
TL(
"Use selected edges"));
645 }
else if (myTAZFrameParent->myCurrentTAZ->getTAZEdges().size() > 0) {
646 myUseSelectedEdges->setText(
TL(
"Remove all edges"));
648 myUseSelectedEdges->setText(
TL(
"Use selected edges"));
649 myUseSelectedEdges->disable();
652 myToggleMembership->setText(
TL(
"keep"));
654 myDefaultTAZSourceFrame->hide();
655 myDefaultTAZSinkFrame->hide();
657 std::ostringstream information;
659 << std::string(
"- ") <<
TL(
"Keep Membership:") <<
TL(
" Select Sources/Sinks.") <<
"\n"
660 << std::string(
"- ") <<
TL(
"Press ESC to clear the current selection.");
661 myInformationLabel->setText(information.str().c_str());
663 myTAZFrameParent->myTAZSelectionStatistics->showTAZSelectionStatisticsModule();
666 updateSelectEdgesButton();
667 }
else if (obj == myTextFieldDefaultValueTAZSources) {
669 if (GNEAttributeCarrier::canParse<double>(myTextFieldDefaultValueTAZSources->getText().text())) {
670 myDefaultTAZSourceWeight = GNEAttributeCarrier::parse<double>(myTextFieldDefaultValueTAZSources->getText().text());
672 if (myDefaultTAZSourceWeight >= 0) {
678 myDefaultTAZSourceWeight = 1;
683 myDefaultTAZSourceWeight = 1;
685 }
else if (obj == myTextFieldDefaultValueTAZSinks) {
687 if (GNEAttributeCarrier::canParse<double>(myTextFieldDefaultValueTAZSinks->getText().text())) {
688 myDefaultTAZSinkWeight = GNEAttributeCarrier::parse<double>(myTextFieldDefaultValueTAZSinks->getText().text());
690 if (myDefaultTAZSinkWeight >= 0) {
696 myDefaultTAZSinkWeight = 1;
701 myDefaultTAZSinkWeight = 1;
711 if (myToggleMembership->getCheck() == TRUE) {
713 myTAZFrameParent->dropTAZMembers();
715 for (
const auto& selectedEdge : myTAZFrameParent->myCurrentTAZ->getSelectedEdges()) {
716 myTAZFrameParent->addOrRemoveTAZMember(selectedEdge);
719 updateSelectEdgesButton();
721 if (myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected().size() == 0) {
723 bool allSelected =
true;
724 for (
const auto& TAZEdgeColor : myTAZFrameParent->getCurrentTAZModule()->getTAZEdges()) {
725 if (!TAZEdgeColor.edge->isAttributeCarrierSelected()) {
732 for (
const auto& TAZEdgeColor : myTAZFrameParent->getCurrentTAZModule()->getTAZEdges()) {
734 TAZEdgeColor.edge->unselectAttributeCarrier();
738 for (
const auto& TAZEdgeColor : myTAZFrameParent->getCurrentTAZModule()->getTAZEdges()) {
740 TAZEdgeColor.edge->selectAttributeCarrier();
745 bool allSelected =
true;
746 for (
const auto& selectedEdge : myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected()) {
747 if (!selectedEdge.edge->isAttributeCarrierSelected()) {
754 for (
const auto& selectedEdge : myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected()) {
755 if (selectedEdge.edge->isAttributeCarrierSelected()) {
757 selectedEdge.edge->unselectAttributeCarrier();
762 for (
const auto& selectedEdge : myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected()) {
763 if (!selectedEdge.edge->isAttributeCarrierSelected()) {
765 selectedEdge.edge->selectAttributeCarrier();
772 myTAZFrameParent->myTAZChildDefaultParameters->updateSelectEdgesButton();
774 myTAZFrameParent->myViewNet->updateViewNet();
783 myTAZFrameParent->getViewNet()->getNet()->computeAndUpdate(neteditOptions,
false);
784 myTAZFrameParent->getViewNet()->update();
786 std::vector<GNETAZSourceSink*> sources;
787 std::vector<GNETAZSourceSink*> sinks;
788 std::set<GNEAdditional*> TAZs;
790 if (myTAZFrameParent->myCurrentTAZ->getTAZ() !=
nullptr) {
792 for (
const auto& TAZSourceSink : myTAZFrameParent->myCurrentTAZ->getTAZ()->getChildTAZSourceSinks()) {
795 if (!TAZSourceSink->getParentEdges().front()->hasSuccessors() &&
797 sources.push_back(TAZSourceSink);
798 TAZs.insert(myTAZFrameParent->myCurrentTAZ->getTAZ());
802 if (!TAZSourceSink->getParentEdges().front()->hasPredecessors() &&
804 sinks.push_back(TAZSourceSink);
805 TAZs.insert(myTAZFrameParent->myCurrentTAZ->getTAZ());
811 for (
const auto&
TAZ : myTAZFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getAdditionals().at(
SUMO_TAG_TAZ)) {
813 for (
const auto& TAZSourceSink :
TAZ.second->getChildTAZSourceSinks()) {
816 if (!TAZSourceSink->getParentEdges().front()->hasSuccessors() &&
818 sources.push_back(TAZSourceSink);
819 TAZs.insert(
TAZ.second);
823 if (!TAZSourceSink->getParentEdges().front()->hasPredecessors() &&
825 sinks.push_back(TAZSourceSink);
826 TAZs.insert(
TAZ.second);
833 if ((sources.size() + sinks.size()) > 0) {
835 const std::string text = (TAZs.size() == 1) ?
837 TL(
"Set weight 0 in ") +
toString(sources.size()) +
TL(
" sources and ") +
838 toString(sinks.size()) +
TL(
" sinks from TAZ '") + (*TAZs.begin())->getID() +
"'?" :
840 TL(
"Set weight 0 in ") +
toString(sources.size()) +
TL(
" sources and ") +
843 const auto questionDialog =
GNEQuestionBasicDialog(myTAZFrameParent->getViewNet()->getViewParent()->getGNEAppWindows(),
847 myTAZFrameParent->myViewNet->getUndoList()->begin(
GUIIcon::TAZ,
TL(
"set zero fringe probabilities"));
848 for (
const auto& source : sources) {
849 source->setAttribute(
SUMO_ATTR_WEIGHT,
"0", myTAZFrameParent->myViewNet->getUndoList());
851 for (
const auto& sink : sinks) {
852 sink->setAttribute(
SUMO_ATTR_WEIGHT,
"0", myTAZFrameParent->myViewNet->getUndoList());
854 myTAZFrameParent->myViewNet->getUndoList()->end();
859 TL(
"Set zero fringe probabilities"),
TL(
"No source/sinks to update."));
870 myTAZFrameParent(TAZFrameParent) {
900 clearSelectedEdges();
908 for (
const auto& selectedEdge : myEdgeAndTAZChildrenSelected) {
909 if (selectedEdge.edge == TAZEdgeColor.
edge) {
914 myEdgeAndTAZChildrenSelected.push_back(TAZEdgeColor);
918 myTAZFrameParent->myTAZEdgesGraphic->updateEdgeColors();
920 myTAZFrameParent->myTAZChildDefaultParameters->updateSelectEdgesButton();
929 for (
auto it = myEdgeAndTAZChildrenSelected.begin(); it != myEdgeAndTAZChildrenSelected.end(); it++) {
930 if (it->edge == edge) {
931 myEdgeAndTAZChildrenSelected.erase(it);
935 myTAZFrameParent->myTAZEdgesGraphic->updateEdgeColors();
937 myTAZFrameParent->myTAZChildDefaultParameters->updateSelectEdgesButton();
952 for (
const auto& selectedEdge : myEdgeAndTAZChildrenSelected) {
953 if (selectedEdge.edge == edge) {
965 myEdgeAndTAZChildrenSelected.clear();
969 myTAZFrameParent->myTAZEdgesGraphic->updateEdgeColors();
971 myTAZFrameParent->myTAZChildDefaultParameters->updateSelectEdgesButton();
975const std::vector<GNETAZFrame::CurrentTAZ::TAZEdgeColor>&
977 return myEdgeAndTAZChildrenSelected;
983 if (obj == myTextFieldTAZSourceWeight) {
985 if (GNEAttributeCarrier::canParse<double>(myTextFieldTAZSourceWeight->getText().text())) {
986 double newTAZSourceWeight = GNEAttributeCarrier::parse<double>(myTextFieldTAZSourceWeight->getText().text());
988 if (newTAZSourceWeight >= 0) {
992 myTAZFrameParent->myTAZSaveChanges->enableButtonsAndBeginUndoList();
994 for (
const auto& selectedEdge : myEdgeAndTAZChildrenSelected) {
995 selectedEdge.source->setAttribute(
SUMO_ATTR_WEIGHT, myTextFieldTAZSourceWeight->getText().text(), myTAZFrameParent->myViewNet->getUndoList());
998 myTAZFrameParent->getCurrentTAZModule()->refreshTAZEdges();
1007 }
else if (obj == myTextFieldTAZSinkWeight) {
1009 if (GNEAttributeCarrier::canParse<double>(myTextFieldTAZSinkWeight->getText().text())) {
1010 double newTAZSinkWeight = GNEAttributeCarrier::parse<double>(myTextFieldTAZSinkWeight->getText().text());
1012 if (newTAZSinkWeight >= 0) {
1016 myTAZFrameParent->myTAZSaveChanges->enableButtonsAndBeginUndoList();
1018 for (
const auto& selectedEdge : myEdgeAndTAZChildrenSelected) {
1019 selectedEdge.sink->setAttribute(
SUMO_ATTR_WEIGHT, myTextFieldTAZSinkWeight->getText().text(), myTAZFrameParent->myViewNet->getUndoList());
1022 myTAZFrameParent->getCurrentTAZModule()->refreshTAZEdges();
1038 if (myEdgeAndTAZChildrenSelected.size() == 0) {
1040 for (
const auto& TAZEdgeColor : myTAZFrameParent->getCurrentTAZModule()->getTAZEdges()) {
1042 if (!TAZEdgeColor.edge->isAttributeCarrierSelected()) {
1044 myTAZFrameParent->myTAZSaveChanges->enableButtonsAndBeginUndoList();
1046 TAZEdgeColor.edge->setAttribute(
GNE_ATTR_SELECTED,
"true", myTAZFrameParent->myViewNet->getUndoList());
1051 for (
const auto& selectedEdge : myEdgeAndTAZChildrenSelected) {
1053 if (!selectedEdge.edge->isAttributeCarrierSelected()) {
1055 myTAZFrameParent->myTAZSaveChanges->enableButtonsAndBeginUndoList();
1057 selectedEdge.edge->setAttribute(
GNE_ATTR_SELECTED,
"true", myTAZFrameParent->myViewNet->getUndoList());
1067 if (myEdgeAndTAZChildrenSelected.size() > 0) {
1069 myTAZSourceFrame->show();
1070 myTAZSinkFrame->show();
1072 std::set<std::string> weightSourceSet;
1073 std::set<std::string> weightSinkSet;
1076 double maxWeightSource = 0;
1077 double minWeightSource = -1;
1078 double averageWeightSource = 0;
1079 double maxWeightSink = 0;
1080 double minWeightSink = -1;
1081 double averageWeightSink = 0;
1083 for (
const auto& selectedEdge : myEdgeAndTAZChildrenSelected) {
1085 weight = selectedEdge.source->getWeight();
1087 weightSourceSet.insert(
toString(weight));
1089 if (maxWeightSource < weight) {
1090 maxWeightSource = weight;
1093 if (minWeightSource == -1 || (maxWeightSource < weight)) {
1094 minWeightSource = weight;
1097 averageWeightSource += weight;
1099 weight = selectedEdge.sink->getWeight();
1101 weightSinkSet.insert(
toString(weight));
1103 if (maxWeightSink < weight) {
1104 maxWeightSink = weight;
1107 if (minWeightSink == -1 || (maxWeightSink < weight)) {
1108 minWeightSink = weight;
1111 averageWeightSink += weight;
1114 averageWeightSource /= (double)myEdgeAndTAZChildrenSelected.size();
1115 averageWeightSink /= (double)myEdgeAndTAZChildrenSelected.size();
1117 std::ostringstream information;
1118 std::string edgeInformation;
1120 if (myEdgeAndTAZChildrenSelected.size() == 1) {
1121 edgeInformation =
TL(
"- Edge ID: ") + myEdgeAndTAZChildrenSelected.begin()->edge->getID();
1123 edgeInformation =
TL(
"- Number of edges: ") +
toString(myEdgeAndTAZChildrenSelected.size());
1127 << edgeInformation <<
"\n"
1128 <<
TL(
"- Min source: ") <<
toString(minWeightSource) <<
"\n"
1129 <<
TL(
"- Max source: ") <<
toString(maxWeightSource) <<
"\n"
1130 <<
TL(
"- Average source: ") <<
toString(averageWeightSource) <<
"\n"
1132 <<
TL(
"- Min sink: ") <<
toString(minWeightSink) <<
"\n"
1133 <<
TL(
"- Max sink: ") <<
toString(maxWeightSink) <<
"\n"
1134 <<
TL(
"- Average sink: ") <<
toString(averageWeightSink);
1136 myStatisticsLabel->setText(information.str().c_str());
1138 myTextFieldTAZSourceWeight->setText(
joinToString(weightSourceSet,
" ").c_str());
1140 myTextFieldTAZSinkWeight->setText(
joinToString(weightSinkSet,
" ").c_str());
1144 myTAZSourceFrame->hide();
1145 myTAZSinkFrame->hide();
1147 myStatisticsLabel->setText(
TL(
"No edges selected"));
1157 myTAZFrameParent(TAZFrameParent),
1158 myEdgeDefaultColor(
RGBColor::GREY),
1159 myEdgeSelectedColor(
RGBColor::MAGENTA) {
1196 for (
const auto& edge : myTAZFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
1197 for (
const auto& lane : edge.second->getChildLanes()) {
1198 lane->setSpecialColor(
nullptr);
1209 for (
const auto& edge : myTAZFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
1210 if (!edge.second->isAttributeCarrierSelected()) {
1212 for (
const auto lane : edge.second->getChildLanes()) {
1213 lane->setSpecialColor(&myEdgeDefaultColor);
1218 for (
const auto& TAZEdgeColor : myTAZFrameParent->myCurrentTAZ->getTAZEdges()) {
1219 if (!TAZEdgeColor.edge->isAttributeCarrierSelected()) {
1221 for (
const auto& lane : TAZEdgeColor.edge->getChildLanes()) {
1223 if (myColorBySourceWeight->getCheck() == TRUE) {
1224 lane->setSpecialColor(&scaledColors.at(TAZEdgeColor.sourceColor), TAZEdgeColor.source->getWeight());
1225 }
else if (myColorBySinkWeight->getCheck() == TRUE) {
1226 lane->setSpecialColor(&scaledColors.at(TAZEdgeColor.sinkColor), TAZEdgeColor.sink->getWeight());
1227 }
else if (myColorBySourcePlusSinkWeight->getCheck() == TRUE) {
1228 lane->setSpecialColor(&scaledColors.at(TAZEdgeColor.sourcePlusSinkColor), TAZEdgeColor.source->getWeight() + TAZEdgeColor.sink->getWeight());
1230 lane->setSpecialColor(&scaledColors.at(TAZEdgeColor.sourceMinusSinkColor), TAZEdgeColor.source->getWeight() - TAZEdgeColor.sink->getWeight());
1236 for (
const auto& selectedEdge : myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected()) {
1237 if (!selectedEdge.edge->isAttributeCarrierSelected()) {
1239 for (
const auto& lane : selectedEdge.edge->getChildLanes()) {
1240 lane->setSpecialColor(&myEdgeSelectedColor);
1245 myTAZFrameParent->myViewNet->updateViewNet();
1252 if (obj == myColorBySourceWeight) {
1253 myColorBySinkWeight->setCheck(FALSE);
1254 myColorBySourcePlusSinkWeight->setCheck(FALSE);
1255 myColorBySourceMinusSinkWeight->setCheck(FALSE);
1256 }
else if (obj == myColorBySinkWeight) {
1257 myColorBySourceWeight->setCheck(FALSE);
1258 myColorBySourcePlusSinkWeight->setCheck(FALSE);
1259 myColorBySourceMinusSinkWeight->setCheck(FALSE);
1260 }
else if (obj == myColorBySourcePlusSinkWeight) {
1261 myColorBySourceWeight->setCheck(FALSE);
1262 myColorBySinkWeight->setCheck(FALSE);
1263 myColorBySourceMinusSinkWeight->setCheck(FALSE);
1264 }
else if (obj == myColorBySourceMinusSinkWeight) {
1265 myColorBySourceWeight->setCheck(FALSE);
1266 myColorBySinkWeight->setCheck(FALSE);
1267 myColorBySourcePlusSinkWeight->setCheck(FALSE);
1337 std::map<SumoXMLAttr, std::string> valuesOfElement;
1398 for (
const auto& edge : edges) {
1407 for (
const auto& edge : edges) {
1412 if (TAZEdgeColor.edge == edge) {
1480 std::vector<std::string> edgeIDs;
1484 edgeIDs.push_back(edge->getID());
1511 if (TAZEdgeColor.edge == edge) {
1554 if (TAZEdgeColor.source) {
1557 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 GUIDesignTextColorRed
red color (for invalid text)
#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 GUIDesignTextColorBlack
black color (for correct text)
#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
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 module
TAZSaveChanges * getTAZSaveChangesModule() const
get TAZ Save Changes module
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 module
CurrentTAZ * getCurrentTAZModule() const
get Current TAZ module
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