82 TAZSource(_TAZSource),
86 sourcePlusSinkColor(0),
87 sourceMinusSinkColor(0),
88 myTAZCurrentParent(TAZCurrentParent)
97 sourceColor = GNEAttributeCarrier::parse<int>(TAZSource->getAttribute(
GNE_ATTR_TAZCOLOR));
98 sinkColor = GNEAttributeCarrier::parse<int>(TAZSink->getAttribute(
GNE_ATTR_TAZCOLOR));
100 double sourcePlusSinkWeight = TAZSource->getDepartWeight() + TAZSink->getDepartWeight();
102 if ((myTAZCurrentParent->myMaxSourcePlusSinkWeight - myTAZCurrentParent->myMinSourcePlusSinkWeight) == 0) {
103 sourcePlusSinkColor = 0;
106 double percentage = (sourcePlusSinkWeight - myTAZCurrentParent->myMinSourcePlusSinkWeight) /
107 (myTAZCurrentParent->myMaxSourcePlusSinkWeight - myTAZCurrentParent->myMinSourcePlusSinkWeight);
109 if (percentage >= 1) {
110 sourcePlusSinkColor = 9;
111 }
else if (percentage < 0) {
112 sourcePlusSinkColor = 0;
114 sourcePlusSinkColor = (int)(percentage * 10);
118 double sourceMinusSinkWeight = TAZSource->getDepartWeight() - TAZSink->getDepartWeight();
120 if ((myTAZCurrentParent->myMaxSourceMinusSinkWeight - myTAZCurrentParent->myMinSourceMinusSinkWeight) == 0) {
121 sourceMinusSinkColor = 0;
124 double percentage = (sourceMinusSinkWeight - myTAZCurrentParent->myMinSourceMinusSinkWeight) /
125 (myTAZCurrentParent->myMaxSourceMinusSinkWeight - myTAZCurrentParent->myMinSourceMinusSinkWeight);
127 if (percentage >= 1) {
128 sourceMinusSinkColor = 9;
129 }
else if (percentage < 0) {
130 sourceMinusSinkColor = 0;
132 sourceMinusSinkColor = (int)(percentage * 10);
157 myEditedTAZ = editedTAZ;
159 if (myEditedTAZ !=
nullptr) {
160 myTAZCurrentLabel->setText((
"Current TAZ: " + myEditedTAZ->getID()).c_str());
164 mySelectedEdges = myTAZFrameParent->myViewNet->getNet()->retrieveEdges(
true);
168 myTAZFrameParent->myTAZParameters->hideTAZParametersModul();
170 myTAZFrameParent->myNeteditAttributes->hideNeteditAttributesModul();
172 myTAZFrameParent->myDrawingShape->hideDrawingShape();
174 myTAZFrameParent->myTAZCommonStatistics->showTAZCommonStatisticsModul();
176 myTAZFrameParent->myTAZSaveChanges->showTAZSaveChangesModul();
178 myTAZFrameParent->myTAZChildDefaultParameters->showTAZChildDefaultParametersModul();
180 myTAZFrameParent->myTAZEdgesGraphic->showTAZEdgesGraphicModul();
183 myTAZFrameParent->myTAZParameters->showTAZParametersModul();
187 myTAZFrameParent->myDrawingShape->showDrawingShape();
189 myTAZFrameParent->myTAZCommonStatistics->hideTAZCommonStatisticsModul();
191 myTAZFrameParent->myTAZChildDefaultParameters->hideTAZChildDefaultParametersModul();
193 myTAZFrameParent->myTAZEdgesGraphic->hideTAZEdgesGraphicModul();
195 myTAZFrameParent->myTAZSaveChanges->hideTAZSaveChangesModul();
197 myTAZCurrentLabel->setText(
"No TAZ selected");
201 mySelectedEdges.clear();
203 myMaxSourcePlusSinkWeight = 0;
204 myMinSourcePlusSinkWeight = -1;
205 myMaxSourceMinusSinkWeight = 0;
206 myMinSourceMinusSinkWeight = -1;
220 for (
const auto& i : myTAZEdges) {
221 if (i.edge == edge) {
230 const std::vector<GNEEdge*>&
236 const std::vector<GNEEdge*>&
238 return mySelectedEdges;
242 const std::vector<GNETAZFrame::TAZCurrent::TAZEdge>&
253 myMaxSourcePlusSinkWeight = 0;
254 myMinSourcePlusSinkWeight = -1;
255 myMaxSourceMinusSinkWeight = 0;
256 myMinSourceMinusSinkWeight = -1;
260 for (
const auto& TAZElement : myEditedTAZ->getChildTAZElements()) {
264 for (
auto& i : myTAZEdges) {
268 myTAZFrameParent->myTAZEdgesGraphic->updateEdgeColors();
279 bool createTAZEdge =
true;
280 for (
auto& i : myTAZEdges) {
281 if (i.edge == edge) {
282 createTAZEdge =
false;
285 i.TAZSource = sourceSink;
287 i.TAZSink = sourceSink;
294 myTAZEdges.push_back(
TAZEdge(
this, edge, sourceSink,
nullptr));
296 myTAZEdges.push_back(
TAZEdge(
this, edge,
nullptr, sourceSink));
300 myMaxSourcePlusSinkWeight = 0;
301 myMinSourcePlusSinkWeight = -1;
302 myMaxSourceMinusSinkWeight = 0;
303 myMinSourceMinusSinkWeight = -1;
304 for (
const auto& i : myTAZEdges) {
306 if (i.TAZSource && i.TAZSink) {
308 double sourcePlusSink = i.TAZSource->
getDepartWeight() + i.TAZSink->getDepartWeight();
310 if (sourcePlusSink > myMaxSourcePlusSinkWeight) {
311 myMaxSourcePlusSinkWeight = sourcePlusSink;
314 if ((myMinSourcePlusSinkWeight == -1) || (sourcePlusSink < myMinSourcePlusSinkWeight)) {
315 myMinSourcePlusSinkWeight = sourcePlusSink;
318 double sourceMinusSink = i.TAZSource->getDepartWeight() - i.TAZSink->getDepartWeight();
320 if (sourceMinusSink < 0) {
321 sourceMinusSink *= -1;
324 if (sourceMinusSink > myMaxSourceMinusSinkWeight) {
325 myMaxSourceMinusSinkWeight = sourceMinusSink;
328 if ((myMinSourceMinusSinkWeight == -1) || (sourceMinusSink < myMinSourceMinusSinkWeight)) {
329 myMinSourceMinusSinkWeight = sourceMinusSink;
344 myTAZFrameParent(TAZFrameParent) {
369 if (myTAZFrameParent->myTAZCurrent->getTAZ()) {
371 std::ostringstream information;
373 <<
"- Number of Edges: " <<
toString(myTAZFrameParent->myTAZCurrent->getTAZ()->getChildAdditionals().size() / 2) <<
"\n"
374 <<
"- Min source: " << myTAZFrameParent->myTAZCurrent->getTAZ()->getAttribute(
GNE_ATTR_MIN_SOURCE) <<
"\n"
375 <<
"- Max source: " << myTAZFrameParent->myTAZCurrent->getTAZ()->getAttribute(
GNE_ATTR_MAX_SOURCE) <<
"\n"
376 <<
"- Average source: " << myTAZFrameParent->myTAZCurrent->getTAZ()->getAttribute(
GNE_ATTR_AVERAGE_SOURCE) <<
"\n"
378 <<
"- Min sink: " << myTAZFrameParent->myTAZCurrent->getTAZ()->getAttribute(
GNE_ATTR_MIN_SINK) <<
"\n"
379 <<
"- Max sink: " << myTAZFrameParent->myTAZCurrent->getTAZ()->getAttribute(
GNE_ATTR_MAX_SINK) <<
"\n"
380 <<
"- Average sink: " << myTAZFrameParent->myTAZCurrent->getTAZ()->getAttribute(
GNE_ATTR_AVERAGE_SINK);
382 myStatisticsLabel->setText(information.str().c_str());
384 myStatisticsLabel->setText(
"No TAZ Selected");
394 myTAZFrameParent(TAZFrameParent) {
416 onCmdCancelChanges(0, 0, 0);
424 if (!mySaveChangesButton->isEnabled()) {
426 mySaveChangesButton->enable();
427 myCancelChangesButton->enable();
429 myTAZFrameParent->myViewNet->getUndoList()->p_begin(
"TAZ attributes");
437 return mySaveChangesButton->isEnabled();
444 if (mySaveChangesButton->isEnabled()) {
446 mySaveChangesButton->disable();
447 myCancelChangesButton->disable();
449 myTAZFrameParent->myViewNet->getUndoList()->p_end();
458 if (mySaveChangesButton->isEnabled()) {
460 mySaveChangesButton->disable();
461 myCancelChangesButton->disable();
463 myTAZFrameParent->myViewNet->getUndoList()->p_abort();
465 myTAZFrameParent->myTAZCurrent->refreshTAZEdges();
467 myTAZFrameParent->myTAZChildDefaultParameters->updateSelectEdgesButton();
478 myTAZFrameParent(TAZFrameParent),
479 myDefaultTAZSourceWeight(1),
480 myDefaultTAZSinkWeight(1) {
500 std::ostringstream information;
502 <<
"- Toogle Membership:\n"
503 <<
" Create new Sources/Sinks\n"
504 <<
" with given weights.";
515 if (myToggleMembership->getCheck() == FALSE) {
516 myTAZFrameParent->myTAZSelectionStatistics->showTAZSelectionStatisticsModul();
518 myTAZFrameParent->myTAZSelectionStatistics->hideTAZSelectionStatisticsModul();
521 updateSelectEdgesButton();
530 myTAZFrameParent->myTAZSelectionStatistics->hideTAZSelectionStatisticsModul();
538 if (myToggleMembership->getCheck() == TRUE) {
540 if (myTAZFrameParent->myTAZCurrent->getSelectedEdges().size() > 0) {
541 myUseSelectedEdges->setText(
"Use selected edges");
542 myUseSelectedEdges->enable();
543 }
else if (myTAZFrameParent->myTAZCurrent->getTAZEdges().size() > 0) {
544 myUseSelectedEdges->setText(
"Remove all edges");
545 myUseSelectedEdges->enable();
547 myUseSelectedEdges->setText(
"Use selected edges");
548 myUseSelectedEdges->disable();
550 }
else if (myTAZFrameParent->getTAZCurrentModul()->getTAZEdges().size() > 0) {
552 myUseSelectedEdges->enable();
554 if (myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected().size() == 0) {
556 bool allSelected =
true;
557 for (
const auto& i : myTAZFrameParent->getTAZCurrentModul()->getTAZEdges()) {
558 if (!i.edge->isAttributeCarrierSelected()) {
563 myUseSelectedEdges->setText(
"Remove all edges from selection");
565 myUseSelectedEdges->setText(
"Add all edges to selection");
567 }
else if (myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected().size() == 1) {
568 if (myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected().front().edge->isAttributeCarrierSelected()) {
569 myUseSelectedEdges->setText(
"Remove edge from selection");
571 myUseSelectedEdges->setText(
"Add edge to selection");
575 bool allSelected =
true;
576 for (
const auto& i : myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected()) {
577 if (!i.edge->isAttributeCarrierSelected()) {
582 myUseSelectedEdges->setText((
"Remove " +
toString(myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected().size()) +
" from to selection").c_str());
584 myUseSelectedEdges->setText((
"Add " +
toString(myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected().size()) +
" edges to selection").c_str());
589 myUseSelectedEdges->disable();
596 return myDefaultTAZSourceWeight;
602 return myDefaultTAZSinkWeight;
608 return (myToggleMembership->getCheck() == TRUE);
615 if (obj == myToggleMembership) {
617 myTAZFrameParent->myTAZSelectionStatistics->clearSelectedEdges();
619 if (myToggleMembership->getCheck() == TRUE) {
620 myToggleMembership->setText(
"toogle");
622 myDefaultTAZSourceFrame->show();
623 myDefaultTAZSinkFrame->show();
625 std::ostringstream information;
627 <<
"- Toogle Membership:\n"
628 <<
" Create new Sources/Sinks\n"
629 <<
" with given weights.";
630 myInformationLabel->setText(information.str().c_str());
632 myTAZFrameParent->myTAZSelectionStatistics->hideTAZSelectionStatisticsModul();
634 if (myTAZFrameParent->myTAZCurrent->getSelectedEdges().size() > 0) {
635 myUseSelectedEdges->setText(
"Use selected edges");
636 }
else if (myTAZFrameParent->myTAZCurrent->getTAZEdges().size() > 0) {
637 myUseSelectedEdges->setText(
"Remove all edges");
639 myUseSelectedEdges->setText(
"Use selected edges");
640 myUseSelectedEdges->disable();
643 myToggleMembership->setText(
"keep");
645 myDefaultTAZSourceFrame->hide();
646 myDefaultTAZSinkFrame->hide();
648 std::ostringstream information;
650 <<
"- Keep Membership:\n"
651 <<
" Select Sources/Sinks.\n"
652 <<
"- Press ESC to clear\n"
653 <<
" current selection.";
654 myInformationLabel->setText(information.str().c_str());
656 myTAZFrameParent->myTAZSelectionStatistics->showTAZSelectionStatisticsModul();
659 updateSelectEdgesButton();
660 }
else if (obj == myTextFieldDefaultValueTAZSources) {
662 if (GNEAttributeCarrier::canParse<double>(myTextFieldDefaultValueTAZSources->getText().text())) {
663 myDefaultTAZSourceWeight = GNEAttributeCarrier::parse<double>(myTextFieldDefaultValueTAZSources->getText().text());
665 if (myDefaultTAZSourceWeight >= 0) {
667 myTextFieldDefaultValueTAZSources->setTextColor(FXRGB(0, 0, 0));
670 myTextFieldDefaultValueTAZSources->setTextColor(FXRGB(255, 0, 0));
671 myDefaultTAZSourceWeight = 1;
675 myTextFieldDefaultValueTAZSources->setTextColor(FXRGB(255, 0, 0));
676 myDefaultTAZSourceWeight = 1;
678 }
else if (obj == myTextFieldDefaultValueTAZSinks) {
680 if (GNEAttributeCarrier::canParse<double>(myTextFieldDefaultValueTAZSinks->getText().text())) {
681 myDefaultTAZSinkWeight = GNEAttributeCarrier::parse<double>(myTextFieldDefaultValueTAZSinks->getText().text());
683 if (myDefaultTAZSinkWeight >= 0) {
685 myTextFieldDefaultValueTAZSinks->setTextColor(FXRGB(0, 0, 0));
688 myTextFieldDefaultValueTAZSinks->setTextColor(FXRGB(255, 0, 0));
689 myDefaultTAZSinkWeight = 1;
693 myTextFieldDefaultValueTAZSinks->setTextColor(FXRGB(255, 0, 0));
694 myDefaultTAZSinkWeight = 1;
704 if (myToggleMembership->getCheck() == TRUE) {
706 myTAZFrameParent->dropTAZMembers();
708 for (
const auto& i : myTAZFrameParent->myTAZCurrent->getSelectedEdges()) {
709 myTAZFrameParent->addOrRemoveTAZMember(i);
712 updateSelectEdgesButton();
714 if (myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected().size() == 0) {
716 bool allSelected =
true;
717 for (
const auto& i : myTAZFrameParent->getTAZCurrentModul()->getTAZEdges()) {
718 if (!i.edge->isAttributeCarrierSelected()) {
725 for (
const auto& i : myTAZFrameParent->getTAZCurrentModul()->getTAZEdges()) {
727 myTAZFrameParent->myTAZSaveChanges->enableButtonsAndBeginUndoList();
729 i.edge->setAttribute(
GNE_ATTR_SELECTED,
"false", myTAZFrameParent->myViewNet->getUndoList());
733 for (
const auto& i : myTAZFrameParent->getTAZCurrentModul()->getTAZEdges()) {
735 myTAZFrameParent->myTAZSaveChanges->enableButtonsAndBeginUndoList();
737 i.edge->setAttribute(
GNE_ATTR_SELECTED,
"true", myTAZFrameParent->myViewNet->getUndoList());
742 bool allSelected =
true;
743 for (
const auto& i : myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected()) {
744 if (!i.edge->isAttributeCarrierSelected()) {
751 for (
const auto& i : myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected()) {
752 if (i.edge->isAttributeCarrierSelected()) {
754 myTAZFrameParent->myTAZSaveChanges->enableButtonsAndBeginUndoList();
756 i.edge->setAttribute(
GNE_ATTR_SELECTED,
"false", myTAZFrameParent->myViewNet->getUndoList());
761 for (
const auto& i : myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected()) {
762 if (!i.edge->isAttributeCarrierSelected()) {
764 myTAZFrameParent->myTAZSaveChanges->enableButtonsAndBeginUndoList();
766 i.edge->setAttribute(
GNE_ATTR_SELECTED,
"true", myTAZFrameParent->myViewNet->getUndoList());
773 myTAZFrameParent->myTAZChildDefaultParameters->updateSelectEdgesButton();
775 myTAZFrameParent->myViewNet->updateViewNet();
785 myTAZFrameParent(TAZFrameParent) {
815 clearSelectedEdges();
823 for (
const auto& i : myEdgeAndTAZChildrenSelected) {
824 if (i.edge == TAZEdge.
edge) {
829 myEdgeAndTAZChildrenSelected.push_back(TAZEdge);
833 myTAZFrameParent->myTAZEdgesGraphic->updateEdgeColors();
835 myTAZFrameParent->myTAZChildDefaultParameters->updateSelectEdgesButton();
844 for (
auto i = myEdgeAndTAZChildrenSelected.begin(); i != myEdgeAndTAZChildrenSelected.end(); i++) {
845 if (i->edge == edge) {
846 myEdgeAndTAZChildrenSelected.erase(i);
850 myTAZFrameParent->myTAZEdgesGraphic->updateEdgeColors();
852 myTAZFrameParent->myTAZChildDefaultParameters->updateSelectEdgesButton();
867 for (
const auto& i : myEdgeAndTAZChildrenSelected) {
868 if (i.edge == edge) {
880 myEdgeAndTAZChildrenSelected.clear();
884 myTAZFrameParent->myTAZEdgesGraphic->updateEdgeColors();
886 myTAZFrameParent->myTAZChildDefaultParameters->updateSelectEdgesButton();
890 const std::vector<GNETAZFrame::TAZCurrent::TAZEdge>&
892 return myEdgeAndTAZChildrenSelected;
898 if (obj == myTextFieldTAZSourceWeight) {
900 if (GNEAttributeCarrier::canParse<double>(myTextFieldTAZSourceWeight->getText().text())) {
901 double newTAZSourceWeight = GNEAttributeCarrier::parse<double>(myTextFieldTAZSourceWeight->getText().text());
903 if (newTAZSourceWeight >= 0) {
905 myTextFieldTAZSourceWeight->setTextColor(FXRGB(0, 0, 0));
907 myTAZFrameParent->myTAZSaveChanges->enableButtonsAndBeginUndoList();
909 for (
const auto& i : myEdgeAndTAZChildrenSelected) {
910 i.TAZSource->setAttribute(
SUMO_ATTR_WEIGHT, myTextFieldTAZSourceWeight->getText().text(), myTAZFrameParent->myViewNet->getUndoList());
913 myTAZFrameParent->getTAZCurrentModul()->refreshTAZEdges();
916 myTextFieldTAZSourceWeight->setTextColor(FXRGB(255, 0, 0));
920 myTextFieldTAZSourceWeight->setTextColor(FXRGB(255, 0, 0));
922 }
else if (obj == myTextFieldTAZSinkWeight) {
924 if (GNEAttributeCarrier::canParse<double>(myTextFieldTAZSinkWeight->getText().text())) {
925 double newTAZSinkWeight = GNEAttributeCarrier::parse<double>(myTextFieldTAZSinkWeight->getText().text());
927 if (newTAZSinkWeight >= 0) {
929 myTextFieldTAZSinkWeight->setTextColor(FXRGB(0, 0, 0));
931 myTAZFrameParent->myTAZSaveChanges->enableButtonsAndBeginUndoList();
933 for (
const auto& i : myEdgeAndTAZChildrenSelected) {
934 i.TAZSink->setAttribute(
SUMO_ATTR_WEIGHT, myTextFieldTAZSinkWeight->getText().text(), myTAZFrameParent->myViewNet->getUndoList());
937 myTAZFrameParent->getTAZCurrentModul()->refreshTAZEdges();
940 myTextFieldTAZSinkWeight->setTextColor(FXRGB(255, 0, 0));
944 myTextFieldTAZSinkWeight->setTextColor(FXRGB(255, 0, 0));
953 if (myEdgeAndTAZChildrenSelected.size() == 0) {
955 for (
const auto& i : myTAZFrameParent->getTAZCurrentModul()->getTAZEdges()) {
957 if (!i.edge->isAttributeCarrierSelected()) {
959 myTAZFrameParent->myTAZSaveChanges->enableButtonsAndBeginUndoList();
961 i.edge->setAttribute(
GNE_ATTR_SELECTED,
"true", myTAZFrameParent->myViewNet->getUndoList());
966 for (
const auto& i : myEdgeAndTAZChildrenSelected) {
968 if (!i.edge->isAttributeCarrierSelected()) {
970 myTAZFrameParent->myTAZSaveChanges->enableButtonsAndBeginUndoList();
972 i.edge->setAttribute(
GNE_ATTR_SELECTED,
"true", myTAZFrameParent->myViewNet->getUndoList());
982 if (myEdgeAndTAZChildrenSelected.size() > 0) {
984 myTAZSourceFrame->show();
985 myTAZSinkFrame->show();
987 std::set<std::string> weightSourceSet;
988 std::set<std::string> weightSinkSet;
991 double maxWeightSource = 0;
992 double minWeightSource = -1;
993 double averageWeightSource = 0;
994 double maxWeightSink = 0;
995 double minWeightSink = -1;
996 double averageWeightSink = 0;
998 for (
const auto& i : myEdgeAndTAZChildrenSelected) {
1000 weight = i.TAZSource->getDepartWeight();
1002 weightSourceSet.insert(
toString(weight));
1004 if (maxWeightSource < weight) {
1005 maxWeightSource = weight;
1008 if (minWeightSource == -1 || (maxWeightSource < weight)) {
1009 minWeightSource = weight;
1012 averageWeightSource += weight;
1014 weight = i.TAZSink->getDepartWeight();
1016 weightSinkSet.insert(
toString(weight));
1018 if (maxWeightSink < weight) {
1019 maxWeightSink = weight;
1022 if (minWeightSink == -1 || (maxWeightSink < weight)) {
1023 minWeightSink = weight;
1026 averageWeightSink += weight;
1029 averageWeightSource /= myEdgeAndTAZChildrenSelected.size();
1030 averageWeightSink /= myEdgeAndTAZChildrenSelected.size();
1032 std::ostringstream information;
1033 std::string edgeInformation;
1035 if (myEdgeAndTAZChildrenSelected.size() == 1) {
1036 edgeInformation =
"- Edge ID: " + myEdgeAndTAZChildrenSelected.begin()->edge->getID();
1038 edgeInformation =
"- Number of edges: " +
toString(myEdgeAndTAZChildrenSelected.size());
1042 << edgeInformation <<
"\n"
1043 <<
"- Min source: " <<
toString(minWeightSource) <<
"\n"
1044 <<
"- Max source: " <<
toString(maxWeightSource) <<
"\n"
1045 <<
"- Average source: " <<
toString(averageWeightSource) <<
"\n"
1047 <<
"- Min sink: " <<
toString(minWeightSink) <<
"\n"
1048 <<
"- Max sink: " <<
toString(maxWeightSink) <<
"\n"
1049 <<
"- Average sink: " <<
toString(averageWeightSink);
1051 myStatisticsLabel->setText(information.str().c_str());
1053 myTextFieldTAZSourceWeight->setText(
joinToString(weightSourceSet,
" ").c_str());
1054 myTextFieldTAZSourceWeight->setTextColor(FXRGB(0, 0, 0));
1055 myTextFieldTAZSinkWeight->setText(
joinToString(weightSinkSet,
" ").c_str());
1056 myTextFieldTAZSinkWeight->setTextColor(FXRGB(0, 0, 0));
1059 myTAZSourceFrame->hide();
1060 myTAZSinkFrame->hide();
1062 myStatisticsLabel->setText(
"No edges selected");
1072 myTAZFrameParent(TAZFrameParent) {
1105 return GNEAttributeCarrier::canParse<RGBColor>(myTextFieldColor->getText().text());
1111 return (myAddEdgesWithinCheckButton->getCheck() == TRUE);
1115 std::map<SumoXMLAttr, std::string>
1117 std::map<SumoXMLAttr, std::string> parametersAndValues;
1119 parametersAndValues[
SUMO_ATTR_COLOR] = myTextFieldColor->getText().text();
1120 return parametersAndValues;
1127 FXColorDialog colordialog(
this, tr(
"Color Dialog"));
1128 colordialog.setTarget(
this);
1130 if (GNEAttributeCarrier::canParse<RGBColor>(myTextFieldColor->getText().text())) {
1136 if (colordialog.execute()) {
1138 onCmdSetAttribute(0, 0, 0);
1147 bool currentParametersValid = GNEAttributeCarrier::canParse<RGBColor>(myTextFieldColor->getText().text());
1149 if (currentParametersValid) {
1150 myTextFieldColor->setTextColor(FXRGB(0, 0, 0));
1151 myTextFieldColor->killFocus();
1153 myTextFieldColor->setTextColor(FXRGB(255, 0, 0));
1154 currentParametersValid =
false;
1157 if (myAddEdgesWithinCheckButton->getCheck() == TRUE) {
1158 myAddEdgesWithinCheckButton->setText(
"use");
1160 myAddEdgesWithinCheckButton->setText(
"not use");
1178 myTAZFrameParent(TAZFrameParent),
1179 myEdgeDefaultColor(
RGBColor::GREY),
1180 myEdgeSelectedColor(
RGBColor::MAGENTA) {
1186 FXLabel* selectedTAZEdgeLabel =
new FXLabel(
this,
"Selected TAZ Edge",
nullptr,
GUIDesignLabelCenter);
1217 for (
const auto& i : myTAZFrameParent->myTAZCurrent->getNetEdges()) {
1218 for (
const auto j : i->getLanes()) {
1219 j->setSpecialColor(
nullptr);
1230 for (
const auto& i : myTAZFrameParent->myTAZCurrent->getNetEdges()) {
1232 for (
const auto j : i->getLanes()) {
1233 j->setSpecialColor(&myEdgeDefaultColor);
1237 for (
const auto& i : myTAZFrameParent->myTAZCurrent->getTAZEdges()) {
1239 for (
const auto j : i.edge->getLanes()) {
1241 if (myColorBySourceWeight->getCheck() == TRUE) {
1242 j->setSpecialColor(&scaledColors.at(i.sourceColor), i.TAZSource->getDepartWeight());
1243 }
else if (myColorBySinkWeight->getCheck() == TRUE) {
1244 j->setSpecialColor(&scaledColors.at(i.sinkColor), i.TAZSink->getDepartWeight());
1245 }
else if (myColorBySourcePlusSinkWeight->getCheck() == TRUE) {
1246 j->setSpecialColor(&scaledColors.at(i.sourcePlusSinkColor), i.TAZSource->getDepartWeight() + i.TAZSink->getDepartWeight());
1248 j->setSpecialColor(&scaledColors.at(i.sourceMinusSinkColor), i.TAZSource->getDepartWeight() - i.TAZSink->getDepartWeight());
1253 for (
const auto& i : myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected()) {
1255 for (
const auto& j : i.edge->getLanes()) {
1256 j->setSpecialColor(&myEdgeSelectedColor);
1260 myTAZFrameParent->myViewNet->updateViewNet();
1267 if (obj == myColorBySourceWeight) {
1268 myColorBySinkWeight->setCheck(FALSE);
1269 myColorBySourcePlusSinkWeight->setCheck(FALSE);
1270 myColorBySourceMinusSinkWeight->setCheck(FALSE);
1271 }
else if (obj == myColorBySinkWeight) {
1272 myColorBySourceWeight->setCheck(FALSE);
1273 myColorBySourcePlusSinkWeight->setCheck(FALSE);
1274 myColorBySourceMinusSinkWeight->setCheck(FALSE);
1275 }
else if (obj == myColorBySourcePlusSinkWeight) {
1276 myColorBySourceWeight->setCheck(FALSE);
1277 myColorBySinkWeight->setCheck(FALSE);
1278 myColorBySourceMinusSinkWeight->setCheck(FALSE);
1279 }
else if (obj == myColorBySourceMinusSinkWeight) {
1280 myColorBySourceWeight->setCheck(FALSE);
1281 myColorBySinkWeight->setCheck(FALSE);
1282 myColorBySourcePlusSinkWeight->setCheck(FALSE);
1294 GNEFrame(horizontalFrameParent, viewNet,
"TAZs") {
1342 std::map<SumoXMLAttr, std::string> valuesOfElement;
1400 for (
auto i : edges) {
1409 for (
auto i : edges) {
1474 std::vector<std::string> edgeIDs;
1476 for (
auto i : ACsInBoundary) {
1478 edgeIDs.push_back(i.first);
1500 if (i.edge == edge) {
FXDEFMAP(GNETAZFrame::TAZParameters) TAZParametersMap[]
@ MID_GNE_SET_ATTRIBUTE
attribute edited
@ MID_CANCEL
Cancel-button pressed.
@ MID_GNE_SET_ATTRIBUTE_DIALOG
attribute edited trought dialog
@ MID_CHOOSEN_OPERATION
set type of selection
@ MID_OK
Ok-button pressed.
@ MID_GNE_SELECT
select element
#define GUIDesignLabelLeft
#define GUIDesignLabelCenter
label extended over frame without thick and with text justify to center
#define GUIDesignButtonAttribute
button extended over over column with thick and raise frame
#define GUIDesignTextField
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
#define GUIDesignLabelAttribute
label extended over the matrix column with thick frame
#define GUIDesignButtonRectangular
little button rectangula used in frames (For example, in "help" buttons)
#define GUIDesignTextFieldNCol
Num of column of text field.
#define GUIDesignGroupBoxFrame
Group box design extended over frame.
#define GUIDesignCheckButton
checkButton placed in left position
#define GUIDesignRadioButton
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
#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)
@ SUMO_TAG_EDGE
begin/end of the description of an edge
@ 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
@ SUMO_ATTR_SHAPE
edge: the shape in xml-definition
@ GNE_ATTR_AVERAGE_SOURCE
average source (used only by TAZs)
@ SUMO_ATTR_COLOR
A color information.
@ 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)
static bool buildAdditional(GNENet *net, bool allowUndoRedo, SumoXMLTag tag, const SUMOSAXAttributes &attrs, LastInsertedElement *insertedAdditionals)
Build additionals.
static const GNETagProperties & getTagProperties(SumoXMLTag tag)
get Tag Properties
const GNETagProperties & getTagProperty() const
get Tag Property assigned to this object
GNENet * getNet() const
get pointer to net
A road/street connecting two junctions (netedit-version)
bool getNeteditAttributesAndValues(std::map< SumoXMLAttr, std::string > &valuesMap, const GNELane *lane) const
fill valuesMap with netedit attributes
GNEViewNet * myViewNet
View Net.
FXVerticalFrame * myContentFrame
Vertical frame that holds all widgets of frame.
virtual void show()
show Frame
virtual void hide()
hide Frame
const std::vector< std::string > & getPredefinedTagsMML() const
get predefinedTagsMML
bool getDeleteLastCreatedPoint()
get flag delete last created point
const PositionVector & getTemporalShape() const
get Temporal shape
void addNewPoint(const Position &P)
add new point to temporal shape
void removeLastPoint()
remove last added point
bool isDrawing() const
return true if currently a shape is drawed
static FXLabel * buildRainbow(FXComposite *parent)
build rainbow in frame modul
std::string generateTAZElementID(SumoXMLTag TAZElementTag) const
generate TAZElement ID
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true) const
get edge by id
std::vector< GNEEdge * > retrieveEdges(bool onlySelected=false)
return all edges
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 hideTAZChildDefaultParametersModul()
hide TAZ child default parameters Modul
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.
void updateSelectEdgesButton()
update "select edges button"
double getDefaultTAZSourceWeight() const
get default TAZSource weight
FXLabel * myInformationLabel
information label
FXHorizontalFrame * myDefaultTAZSinkFrame
Horizontal Frame for default TAZ Sink Weight.
FXHorizontalFrame * myDefaultTAZSourceFrame
Horizontal Frame for default TAZ Source Weight.
~TAZChildDefaultParameters()
destructor
FXTextField * myTextFieldDefaultValueTAZSinks
textField to set a default value for TAZ Sinks
long onCmdSetDefaultValues(FXObject *obj, FXSelector, void *)
double getDefaultTAZSinkWeight() const
default TAZSink weight
void showTAZChildDefaultParametersModul()
show TAZ child default parameters Modul
TAZCommonStatistics(GNETAZFrame *TAZFrameParent)
constructor
~TAZCommonStatistics()
destructor
FXLabel * myStatisticsLabel
Statistics labels.
void hideTAZCommonStatisticsModul()
hide TAZ Common Statistics Modul
void showTAZCommonStatisticsModul()
show TAZ Common Statistics Modul
void updateStatistics()
update Statistics label
void refreshTAZEdges()
refresh TAZEdges
void addTAZChild(GNETAZSourceSink *additional)
add TAZChild
void setTAZ(GNETAZ *editedTAZ)
set current TAZ
const std::vector< TAZCurrent::TAZEdge > & getTAZEdges() const
get TAZEdges
FXLabel * myTAZCurrentLabel
Label for current TAZ.
const std::vector< GNEEdge * > & getNetEdges() const
get current net edges
double myMaxSourcePlusSinkWeight
maximum source plus sink value of current TAZ Edges
bool isTAZEdge(GNEEdge *edge) const
check if given edge belongs to current TAZ
GNETAZ * getTAZ() const
get current TAZ
double myMinSourceMinusSinkWeight
minimum source minus sink value of current TAZ Edges
GNETAZFrame * myTAZFrameParent
pointer to TAZ Frame
const std::vector< GNEEdge * > & getSelectedEdges() const
get current selected edges
double myMinSourcePlusSinkWeight
minimum source plus sink value of current TAZ Edges
double myMaxSourceMinusSinkWeight
maximum source minus sink value of current TAZ Edges
TAZCurrent(GNETAZFrame *TAZFrameParent)
constructor
GNETAZ * myEditedTAZ
current edited TAZ
FXRadioButton * myColorBySourcePlusSinkWeight
add radio button "color source + sink"
RGBColor myEdgeSelectedColor
RGBColor color for selected egdes.
FXRadioButton * myColorBySinkWeight
add radio button "color by sink"
void updateEdgeColors()
update edge colors;
void showTAZEdgesGraphicModul()
show TAZ Edges Graphic Modul
FXRadioButton * myColorBySourceWeight
add radio button "color by source"
FXRadioButton * myColorBySourceMinusSinkWeight
add radio button "color source - Sink"
RGBColor myEdgeDefaultColor
default RGBColor for all edges
void hideTAZEdgesGraphicModul()
hide TAZ Edges Graphic Modul
~TAZEdgesGraphic()
destructor
long onCmdChoosenBy(FXObject *obj, FXSelector, void *)
TAZEdgesGraphic(GNETAZFrame *TAZFrameParent)
FOX-declaration.
std::map< SumoXMLAttr, std::string > getAttributesAndValues() const
get a map with attributes and their values
bool isAddEdgesWithinEnabled() const
check if edges within has to be used after TAZ Creation
void hideTAZParametersModul()
hide TAZ parameters
TAZParameters(GNETAZFrame *TAZFrameParent)
FOX-declaration.
~TAZParameters()
destructor
FXButton * myHelpTAZAttribute
button for help
FXCheckButton * myAddEdgesWithinCheckButton
CheckButton to enable or disable use edges within TAZ after creation.
long onCmdSetAttribute(FXObject *, FXSelector, void *)
Called when user set a value.
long onCmdHelp(FXObject *, FXSelector, void *)
Called when help button is pressed.
long onCmdSetColorAttribute(FXObject *, FXSelector, void *)
FXButton * myColorEditor
Button for open color editor.
void showTAZParametersModul()
show TAZ parameters and set the default value of parameters
FXTextField * myTextFieldColor
textField to modify the default value of color parameter
bool isCurrentParametersValid() const
check if current parameters are valid
bool isChangesPending() const
return true if there is changes to save
FXButton * mySaveChangesButton
@field FXButton for save changes in TAZEdges
void hideTAZSaveChangesModul()
hide TAZ Save Changes Modul
FXButton * myCancelChangesButton
@field FXButton for cancel changes in TAZEdges
void showTAZSaveChangesModul()
show TAZ Save Changes Modul
long onCmdCancelChanges(FXObject *, FXSelector, void *)
Called when the user press the button cancel changes.
TAZSaveChanges(GNETAZFrame *TAZFrameParent)
FOX-declaration.
~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
const std::vector< TAZCurrent::TAZEdge > & getEdgeAndTAZChildrenSelected() const
get map with edge and TAZChildren
bool isEdgeSelected(GNEEdge *edge)
check if an edge is selected
FXHorizontalFrame * myTAZSinkFrame
Horizontal Frame for default TAZ Sink Weight.
long onCmdSetNewValues(FXObject *obj, FXSelector, void *)
bool selectEdge(const TAZCurrent::TAZEdge &edge)
add an edge and their TAZ Children in the list of selected items
void clearSelectedEdges()
clear current TAZ children
void showTAZSelectionStatisticsModul()
show TAZ Selection Statistics Modul
FXTextField * myTextFieldTAZSourceWeight
textField for TAZ Source weight
void updateStatistics()
update TAZSelectionStatistics
void hideTAZSelectionStatisticsModul()
hide TAZ Selection Statistics Modul
FXTextField * myTextFieldTAZSinkWeight
textField for TAZ Sink weight
bool unselectEdge(GNEEdge *edge)
un select an edge (and their TAZ Children)
FXLabel * myStatisticsLabel
Statistics labels.
TAZSelectionStatistics * myTAZSelectionStatistics
TAZ Edges selection parameters.
TAZEdgesGraphic * myTAZEdgesGraphic
TAZ Edges Graphic.
TAZParameters * myTAZParameters
TAZ parameters.
bool addOrRemoveTAZMember(GNEEdge *edge)
add or remove a TAZSource and a TAZSink, or remove it if edge is in the list of TAZ Children
void dropTAZMembers()
drop all TAZSources and TAZ Sinks of current TAZ
bool processClick(const Position &clickedPosition, const GNEViewNetHelper::ObjectsUnderCursor &objectsUnderCursor)
process click over Viewnet
TAZSelectionStatistics * getTAZSelectionStatisticsModul() const
get TAZ Selection Statistics modul
TAZCommonStatistics * myTAZCommonStatistics
TAZ Edges common parameters.
TAZCurrent * myTAZCurrent
current TAZ
bool shapeDrawed()
build a shaped element using the drawed shape return true if was sucesfully created
GNEFrameModuls::DrawingShape * myDrawingShape
Drawing shape.
~GNETAZFrame()
Destructor.
TAZSaveChanges * myTAZSaveChanges
save TAZ Edges
GNEFrameAttributesModuls::NeteditAttributes * myNeteditAttributes
Netedit parameter.
GNEFrameModuls::DrawingShape * getDrawingShapeModul() const
get drawing mode modul
TAZCurrent * getTAZCurrentModul() const
get Current TAZ modul
GNETAZFrame(FXHorizontalFrame *horizontalFrameParent, GNEViewNet *viewNet)
Constructor.
void hide()
hide TAZ frame
void processEdgeSelection(const std::vector< GNEEdge * > &edges)
process selection of edges in view net
TAZSaveChanges * getTAZSaveChangesModul() const
get TAZ Save Changes modul
TAZChildDefaultParameters * myTAZChildDefaultParameters
TAZ child defaults parameters.
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
double getDepartWeight() const
get depart weight
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
class used to group all variables related with objects under cursor after a click over view
GNETAZElement * getTAZElementFront() const
get front TAZElement or a pointer to nullptr
GNEEdge * getEdgeFront() const
get front edge or a pointer to nullptr
GNENet * getNet() const
get the net object
GNEUndoList * getUndoList() const
get the undoList object
std::set< std::pair< std::string, GNEAttributeCarrier * > > getAttributeCarriersInBoundary(const Boundary &boundary, bool forceSelectEdges=false)
get AttributeCarriers in Boundary
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
static FXColor getFXColor(const RGBColor &col)
converts FXColor to RGBColor
static RGBColor getRGBColor(FXColor col)
converts FXColor to RGBColor
A point in 2D or 3D with translation and scaling methods.
void closePolygon()
ensures that the last position equals the first
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
static const RGBColor WHITE
static RGBColor parseColor(std::string coldef)
Parses a color information.
Encapsulated Xerces-SAX-attributes.
struct for edges and the source/sink colors
void updateColors()
update colors
~TAZEdge()
destructor (needed because RGBColors has to be deleted)
static const std::vector< RGBColor > & getRainbowScaledColors()
get scaled rainbow colors