86 sourcePlusSinkColor(0),
87 sourceMinusSinkColor(0),
88 myCurrentTAZParent(CurrentTAZParent) {
97 sourceColor = GNEAttributeCarrier::parse<int>(source->getAttribute(
GNE_ATTR_TAZCOLOR));
98 sinkColor = GNEAttributeCarrier::parse<int>(sink->getAttribute(
GNE_ATTR_TAZCOLOR));
100 double sourcePlusSinkWeight = source->getDepartWeight() + sink->getDepartWeight();
102 if ((myCurrentTAZParent->myMaxSourcePlusSinkWeight - myCurrentTAZParent->myMinSourcePlusSinkWeight) == 0) {
103 sourcePlusSinkColor = 0;
106 double percentage = (sourcePlusSinkWeight - myCurrentTAZParent->myMinSourcePlusSinkWeight) /
107 (myCurrentTAZParent->myMaxSourcePlusSinkWeight - myCurrentTAZParent->myMinSourcePlusSinkWeight);
109 if (percentage >= 1) {
110 sourcePlusSinkColor = 9;
111 }
else if (percentage < 0) {
112 sourcePlusSinkColor = 0;
114 sourcePlusSinkColor = (int)(percentage * 10);
118 double sourceMinusSinkWeight = source->getDepartWeight() - sink->getDepartWeight();
120 if ((myCurrentTAZParent->myMaxSourceMinusSinkWeight - myCurrentTAZParent->myMinSourceMinusSinkWeight) == 0) {
121 sourceMinusSinkColor = 0;
124 double percentage = (sourceMinusSinkWeight - myCurrentTAZParent->myMinSourceMinusSinkWeight) /
125 (myCurrentTAZParent->myMaxSourceMinusSinkWeight - myCurrentTAZParent->myMinSourceMinusSinkWeight);
127 if (percentage >= 1) {
128 sourceMinusSinkColor = 9;
129 }
else if (percentage < 0) {
130 sourceMinusSinkColor = 0;
132 sourceMinusSinkColor = (int)(percentage * 10);
144 sourcePlusSinkColor(0),
145 sourceMinusSinkColor(0),
146 myCurrentTAZParent(nullptr) {
169 myEditedTAZ = editedTAZ;
171 if (myEditedTAZ !=
nullptr) {
172 myCurrentTAZLabel->setText((
"Current TAZ: " + myEditedTAZ->getID()).c_str());
178 myTAZFrameParent->myTAZParameters->hideTAZParametersModule();
180 myTAZFrameParent->myNeteditAttributes->hideNeteditAttributesModule();
182 myTAZFrameParent->myDrawingShape->hideDrawingShape();
184 myTAZFrameParent->myTAZCommonStatistics->showTAZCommonStatisticsModule();
186 myTAZFrameParent->myTAZSaveChanges->showTAZSaveChangesModule();
188 myTAZFrameParent->myTAZChildDefaultParameters->showTAZChildDefaultParametersModule();
190 myTAZFrameParent->myTAZEdgesGraphic->showTAZEdgesGraphicModule();
193 myTAZFrameParent->myTAZParameters->showTAZParametersModule();
197 myTAZFrameParent->myDrawingShape->showDrawingShape();
199 myTAZFrameParent->myTAZCommonStatistics->hideTAZCommonStatisticsModule();
201 myTAZFrameParent->myTAZChildDefaultParameters->hideTAZChildDefaultParametersModule();
203 myTAZFrameParent->myTAZEdgesGraphic->hideTAZEdgesGraphicModule();
205 myTAZFrameParent->myTAZSaveChanges->hideTAZSaveChangesModule();
207 myCurrentTAZLabel->setText(
"No TAZ selected");
209 mySelectedEdges.clear();
211 myMaxSourcePlusSinkWeight = 0;
212 myMinSourcePlusSinkWeight = -1;
213 myMaxSourceMinusSinkWeight = 0;
214 myMinSourceMinusSinkWeight = -1;
238 const std::vector<GNEEdge*>&
240 return mySelectedEdges;
244 const std::vector<GNETAZFrame::CurrentTAZ::TAZEdgeColor>&
246 return myTAZEdgeColors;
253 myTAZEdgeColors.clear();
255 myMaxSourcePlusSinkWeight = 0;
256 myMinSourcePlusSinkWeight = -1;
257 myMaxSourceMinusSinkWeight = 0;
258 myMinSourceMinusSinkWeight = -1;
262 myEditedTAZ->updateTAZStadistic();
263 myTAZFrameParent->myTAZCommonStatistics->updateStatistics();
265 for (
const auto& TAZElement : myEditedTAZ->getChildTAZElements()) {
273 myTAZFrameParent->myTAZEdgesGraphic->updateEdgeColors();
284 bool createTAZEdge =
true;
287 createTAZEdge =
false;
299 myTAZEdgeColors.push_back(
TAZEdgeColor(
this, edge, sourceSink,
nullptr));
301 myTAZEdgeColors.push_back(
TAZEdgeColor(
this, edge,
nullptr, sourceSink));
305 myMaxSourcePlusSinkWeight = 0;
306 myMinSourcePlusSinkWeight = -1;
307 myMaxSourceMinusSinkWeight = 0;
308 myMinSourceMinusSinkWeight = -1;
315 if (sourcePlusSink > myMaxSourcePlusSinkWeight) {
316 myMaxSourcePlusSinkWeight = sourcePlusSink;
319 if ((myMinSourcePlusSinkWeight == -1) || (sourcePlusSink < myMinSourcePlusSinkWeight)) {
320 myMinSourcePlusSinkWeight = sourcePlusSink;
325 if (sourceMinusSink < 0) {
326 sourceMinusSink *= -1;
329 if (sourceMinusSink > myMaxSourceMinusSinkWeight) {
330 myMaxSourceMinusSinkWeight = sourceMinusSink;
333 if ((myMinSourceMinusSinkWeight == -1) || (sourceMinusSink < myMinSourceMinusSinkWeight)) {
334 myMinSourceMinusSinkWeight = sourceMinusSink;
349 myTAZFrameParent(TAZFrameParent) {
374 if (myTAZFrameParent->myCurrentTAZ->getTAZ()) {
376 std::ostringstream information;
378 <<
"- Number of edges: " <<
toString(myTAZFrameParent->myCurrentTAZ->getTAZ()->getChildTAZElements().size() / 2) <<
"\n"
379 <<
"- Min source: " << myTAZFrameParent->myCurrentTAZ->getTAZ()->getAttribute(
GNE_ATTR_MIN_SOURCE) <<
"\n"
380 <<
"- Max source: " << myTAZFrameParent->myCurrentTAZ->getTAZ()->getAttribute(
GNE_ATTR_MAX_SOURCE) <<
"\n"
381 <<
"- Average source: " << myTAZFrameParent->myCurrentTAZ->getTAZ()->getAttribute(
GNE_ATTR_AVERAGE_SOURCE) <<
"\n"
383 <<
"- Min sink: " << myTAZFrameParent->myCurrentTAZ->getTAZ()->getAttribute(
GNE_ATTR_MIN_SINK) <<
"\n"
384 <<
"- Max sink: " << myTAZFrameParent->myCurrentTAZ->getTAZ()->getAttribute(
GNE_ATTR_MAX_SINK) <<
"\n"
385 <<
"- Average sink: " << myTAZFrameParent->myCurrentTAZ->getTAZ()->getAttribute(
GNE_ATTR_AVERAGE_SINK);
387 myStatisticsLabel->setText(information.str().c_str());
389 myStatisticsLabel->setText(
"No TAZ Selected");
399 myTAZFrameParent(TAZFrameParent) {
421 onCmdCancelChanges(0, 0, 0);
429 if (!mySaveChangesButton->isEnabled()) {
431 mySaveChangesButton->enable();
432 myCancelChangesButton->enable();
434 myTAZFrameParent->myViewNet->getUndoList()->begin(
GUIIcon::TAZ,
"TAZ changes");
442 return mySaveChangesButton->isEnabled();
449 if (mySaveChangesButton->isEnabled()) {
451 mySaveChangesButton->disable();
452 myCancelChangesButton->disable();
454 myTAZFrameParent->myViewNet->getUndoList()->end();
456 myTAZFrameParent->myCurrentTAZ->refreshTAZEdges();
458 myTAZFrameParent->myTAZChildDefaultParameters->updateSelectEdgesButton();
468 if (mySaveChangesButton->isEnabled()) {
470 mySaveChangesButton->disable();
471 myCancelChangesButton->disable();
473 myTAZFrameParent->myViewNet->getUndoList()->abortAllChangeGroups();
475 myTAZFrameParent->myCurrentTAZ->refreshTAZEdges();
477 myTAZFrameParent->myTAZChildDefaultParameters->updateSelectEdgesButton();
488 myTAZFrameParent(TAZFrameParent),
489 myDefaultTAZSourceWeight(1),
490 myDefaultTAZSinkWeight(1) {
510 std::ostringstream information;
512 <<
"- Toggle Membership:\n"
513 <<
" Create new Sources/Sinks\n"
514 <<
" with given weights.";
525 if (myToggleMembership->getCheck() == FALSE) {
526 myTAZFrameParent->myTAZSelectionStatistics->showTAZSelectionStatisticsModule();
528 myTAZFrameParent->myTAZSelectionStatistics->hideTAZSelectionStatisticsModule();
531 updateSelectEdgesButton();
540 myTAZFrameParent->myTAZSelectionStatistics->hideTAZSelectionStatisticsModule();
548 if (myToggleMembership->getCheck() == TRUE) {
550 if (myTAZFrameParent->myCurrentTAZ->getSelectedEdges().size() > 0) {
551 myUseSelectedEdges->setText(
"Use selected edges");
552 myUseSelectedEdges->enable();
553 }
else if (myTAZFrameParent->myCurrentTAZ->getTAZEdges().size() > 0) {
554 myUseSelectedEdges->setText(
"Remove all edges");
555 myUseSelectedEdges->enable();
557 myUseSelectedEdges->setText(
"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(
"Remove all edges from selection");
575 myUseSelectedEdges->setText(
"Add all edges to selection");
577 }
else if (myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected().size() == 1) {
578 if (myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected().front().edge->isAttributeCarrierSelected()) {
579 myUseSelectedEdges->setText(
"Remove edge from selection");
581 myUseSelectedEdges->setText(
"Add edge to selection");
585 bool allSelected =
true;
586 for (
const auto& selectedEdge : myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected()) {
587 if (!selectedEdge.edge->isAttributeCarrierSelected()) {
592 myUseSelectedEdges->setText((
"Remove " +
toString(myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected().size()) +
" from to selection").c_str());
594 myUseSelectedEdges->setText((
"Add " +
toString(myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected().size()) +
" 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(
"toggle");
632 myDefaultTAZSourceFrame->show();
633 myDefaultTAZSinkFrame->show();
635 std::ostringstream information;
637 <<
"- Toggle Membership:\n"
638 <<
" Create new Sources/Sinks\n"
639 <<
" with given weights.";
640 myInformationLabel->setText(information.str().c_str());
642 myTAZFrameParent->myTAZSelectionStatistics->hideTAZSelectionStatisticsModule();
644 if (myTAZFrameParent->myCurrentTAZ->getSelectedEdges().size() > 0) {
645 myUseSelectedEdges->setText(
"Use selected edges");
646 }
else if (myTAZFrameParent->myCurrentTAZ->getTAZEdges().size() > 0) {
647 myUseSelectedEdges->setText(
"Remove all edges");
649 myUseSelectedEdges->setText(
"Use selected edges");
650 myUseSelectedEdges->disable();
653 myToggleMembership->setText(
"keep");
655 myDefaultTAZSourceFrame->hide();
656 myDefaultTAZSinkFrame->hide();
658 std::ostringstream information;
660 <<
"- Keep Membership:\n"
661 <<
" Select Sources/Sinks.\n"
662 <<
"- Press ESC to clear\n"
663 <<
" current selection.";
664 myInformationLabel->setText(information.str().c_str());
666 myTAZFrameParent->myTAZSelectionStatistics->showTAZSelectionStatisticsModule();
669 updateSelectEdgesButton();
670 }
else if (obj == myTextFieldDefaultValueTAZSources) {
672 if (GNEAttributeCarrier::canParse<double>(myTextFieldDefaultValueTAZSources->getText().text())) {
673 myDefaultTAZSourceWeight = GNEAttributeCarrier::parse<double>(myTextFieldDefaultValueTAZSources->getText().text());
675 if (myDefaultTAZSourceWeight >= 0) {
677 myTextFieldDefaultValueTAZSources->setTextColor(FXRGB(0, 0, 0));
680 myTextFieldDefaultValueTAZSources->setTextColor(FXRGB(255, 0, 0));
681 myDefaultTAZSourceWeight = 1;
685 myTextFieldDefaultValueTAZSources->setTextColor(FXRGB(255, 0, 0));
686 myDefaultTAZSourceWeight = 1;
688 }
else if (obj == myTextFieldDefaultValueTAZSinks) {
690 if (GNEAttributeCarrier::canParse<double>(myTextFieldDefaultValueTAZSinks->getText().text())) {
691 myDefaultTAZSinkWeight = GNEAttributeCarrier::parse<double>(myTextFieldDefaultValueTAZSinks->getText().text());
693 if (myDefaultTAZSinkWeight >= 0) {
695 myTextFieldDefaultValueTAZSinks->setTextColor(FXRGB(0, 0, 0));
698 myTextFieldDefaultValueTAZSinks->setTextColor(FXRGB(255, 0, 0));
699 myDefaultTAZSinkWeight = 1;
703 myTextFieldDefaultValueTAZSinks->setTextColor(FXRGB(255, 0, 0));
704 myDefaultTAZSinkWeight = 1;
714 if (myToggleMembership->getCheck() == TRUE) {
716 myTAZFrameParent->dropTAZMembers();
718 for (
const auto& selectedEdge : myTAZFrameParent->myCurrentTAZ->getSelectedEdges()) {
719 myTAZFrameParent->addOrRemoveTAZMember(selectedEdge);
722 updateSelectEdgesButton();
724 if (myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected().size() == 0) {
726 bool allSelected =
true;
727 for (
const auto& TAZEdgeColor : myTAZFrameParent->getCurrentTAZModule()->getTAZEdges()) {
728 if (!TAZEdgeColor.edge->isAttributeCarrierSelected()) {
735 for (
const auto& TAZEdgeColor : myTAZFrameParent->getCurrentTAZModule()->getTAZEdges()) {
737 TAZEdgeColor.edge->unselectAttributeCarrier();
741 for (
const auto& TAZEdgeColor : myTAZFrameParent->getCurrentTAZModule()->getTAZEdges()) {
743 TAZEdgeColor.edge->selectAttributeCarrier();
748 bool allSelected =
true;
749 for (
const auto& selectedEdge : myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected()) {
750 if (!selectedEdge.edge->isAttributeCarrierSelected()) {
757 for (
const auto& selectedEdge : myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected()) {
758 if (selectedEdge.edge->isAttributeCarrierSelected()) {
760 selectedEdge.edge->unselectAttributeCarrier();
765 for (
const auto& selectedEdge : myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected()) {
766 if (!selectedEdge.edge->isAttributeCarrierSelected()) {
768 selectedEdge.edge->selectAttributeCarrier();
775 myTAZFrameParent->myTAZChildDefaultParameters->updateSelectEdgesButton();
777 myTAZFrameParent->myViewNet->updateViewNet();
787 myTAZFrameParent(TAZFrameParent) {
817 clearSelectedEdges();
825 for (
const auto& selectedEdge : myEdgeAndTAZChildrenSelected) {
826 if (selectedEdge.edge == TAZEdgeColor.
edge) {
831 myEdgeAndTAZChildrenSelected.push_back(TAZEdgeColor);
835 myTAZFrameParent->myTAZEdgesGraphic->updateEdgeColors();
837 myTAZFrameParent->myTAZChildDefaultParameters->updateSelectEdgesButton();
846 for (
auto it = myEdgeAndTAZChildrenSelected.begin(); it != myEdgeAndTAZChildrenSelected.end(); it++) {
847 if (it->edge == edge) {
848 myEdgeAndTAZChildrenSelected.erase(it);
852 myTAZFrameParent->myTAZEdgesGraphic->updateEdgeColors();
854 myTAZFrameParent->myTAZChildDefaultParameters->updateSelectEdgesButton();
869 for (
const auto& selectedEdge : myEdgeAndTAZChildrenSelected) {
870 if (selectedEdge.edge == edge) {
882 myEdgeAndTAZChildrenSelected.clear();
886 myTAZFrameParent->myTAZEdgesGraphic->updateEdgeColors();
888 myTAZFrameParent->myTAZChildDefaultParameters->updateSelectEdgesButton();
892 const std::vector<GNETAZFrame::CurrentTAZ::TAZEdgeColor>&
894 return myEdgeAndTAZChildrenSelected;
900 if (obj == myTextFieldTAZSourceWeight) {
902 if (GNEAttributeCarrier::canParse<double>(myTextFieldTAZSourceWeight->getText().text())) {
903 double newTAZSourceWeight = GNEAttributeCarrier::parse<double>(myTextFieldTAZSourceWeight->getText().text());
905 if (newTAZSourceWeight >= 0) {
907 myTextFieldTAZSourceWeight->setTextColor(FXRGB(0, 0, 0));
909 myTAZFrameParent->myTAZSaveChanges->enableButtonsAndBeginUndoList();
911 for (
const auto& selectedEdge : myEdgeAndTAZChildrenSelected) {
912 selectedEdge.source->setAttribute(
SUMO_ATTR_WEIGHT, myTextFieldTAZSourceWeight->getText().text(), myTAZFrameParent->myViewNet->getUndoList());
915 myTAZFrameParent->getCurrentTAZModule()->refreshTAZEdges();
918 myTextFieldTAZSourceWeight->setTextColor(FXRGB(255, 0, 0));
922 myTextFieldTAZSourceWeight->setTextColor(FXRGB(255, 0, 0));
924 }
else if (obj == myTextFieldTAZSinkWeight) {
926 if (GNEAttributeCarrier::canParse<double>(myTextFieldTAZSinkWeight->getText().text())) {
927 double newTAZSinkWeight = GNEAttributeCarrier::parse<double>(myTextFieldTAZSinkWeight->getText().text());
929 if (newTAZSinkWeight >= 0) {
931 myTextFieldTAZSinkWeight->setTextColor(FXRGB(0, 0, 0));
933 myTAZFrameParent->myTAZSaveChanges->enableButtonsAndBeginUndoList();
935 for (
const auto& selectedEdge : myEdgeAndTAZChildrenSelected) {
936 selectedEdge.sink->setAttribute(
SUMO_ATTR_WEIGHT, myTextFieldTAZSinkWeight->getText().text(), myTAZFrameParent->myViewNet->getUndoList());
939 myTAZFrameParent->getCurrentTAZModule()->refreshTAZEdges();
942 myTextFieldTAZSinkWeight->setTextColor(FXRGB(255, 0, 0));
946 myTextFieldTAZSinkWeight->setTextColor(FXRGB(255, 0, 0));
955 if (myEdgeAndTAZChildrenSelected.size() == 0) {
957 for (
const auto& TAZEdgeColor : myTAZFrameParent->getCurrentTAZModule()->getTAZEdges()) {
959 if (!TAZEdgeColor.edge->isAttributeCarrierSelected()) {
961 myTAZFrameParent->myTAZSaveChanges->enableButtonsAndBeginUndoList();
963 TAZEdgeColor.edge->setAttribute(
GNE_ATTR_SELECTED,
"true", myTAZFrameParent->myViewNet->getUndoList());
968 for (
const auto& selectedEdge : myEdgeAndTAZChildrenSelected) {
970 if (!selectedEdge.edge->isAttributeCarrierSelected()) {
972 myTAZFrameParent->myTAZSaveChanges->enableButtonsAndBeginUndoList();
974 selectedEdge.edge->setAttribute(
GNE_ATTR_SELECTED,
"true", myTAZFrameParent->myViewNet->getUndoList());
984 if (myEdgeAndTAZChildrenSelected.size() > 0) {
986 myTAZSourceFrame->show();
987 myTAZSinkFrame->show();
989 std::set<std::string> weightSourceSet;
990 std::set<std::string> weightSinkSet;
993 double maxWeightSource = 0;
994 double minWeightSource = -1;
995 double averageWeightSource = 0;
996 double maxWeightSink = 0;
997 double minWeightSink = -1;
998 double averageWeightSink = 0;
1000 for (
const auto& selectedEdge : myEdgeAndTAZChildrenSelected) {
1002 weight = selectedEdge.source->getDepartWeight();
1004 weightSourceSet.insert(
toString(weight));
1006 if (maxWeightSource < weight) {
1007 maxWeightSource = weight;
1010 if (minWeightSource == -1 || (maxWeightSource < weight)) {
1011 minWeightSource = weight;
1014 averageWeightSource += weight;
1016 weight = selectedEdge.sink->getDepartWeight();
1018 weightSinkSet.insert(
toString(weight));
1020 if (maxWeightSink < weight) {
1021 maxWeightSink = weight;
1024 if (minWeightSink == -1 || (maxWeightSink < weight)) {
1025 minWeightSink = weight;
1028 averageWeightSink += weight;
1031 averageWeightSource /= myEdgeAndTAZChildrenSelected.size();
1032 averageWeightSink /= myEdgeAndTAZChildrenSelected.size();
1034 std::ostringstream information;
1035 std::string edgeInformation;
1037 if (myEdgeAndTAZChildrenSelected.size() == 1) {
1038 edgeInformation =
"- Edge ID: " + myEdgeAndTAZChildrenSelected.begin()->edge->getID();
1040 edgeInformation =
"- Number of edges: " +
toString(myEdgeAndTAZChildrenSelected.size());
1044 << edgeInformation <<
"\n"
1045 <<
"- Min source: " <<
toString(minWeightSource) <<
"\n"
1046 <<
"- Max source: " <<
toString(maxWeightSource) <<
"\n"
1047 <<
"- Average source: " <<
toString(averageWeightSource) <<
"\n"
1049 <<
"- Min sink: " <<
toString(minWeightSink) <<
"\n"
1050 <<
"- Max sink: " <<
toString(maxWeightSink) <<
"\n"
1051 <<
"- Average sink: " <<
toString(averageWeightSink);
1053 myStatisticsLabel->setText(information.str().c_str());
1055 myTextFieldTAZSourceWeight->setText(
joinToString(weightSourceSet,
" ").c_str());
1056 myTextFieldTAZSourceWeight->setTextColor(FXRGB(0, 0, 0));
1057 myTextFieldTAZSinkWeight->setText(
joinToString(weightSinkSet,
" ").c_str());
1058 myTextFieldTAZSinkWeight->setTextColor(FXRGB(0, 0, 0));
1061 myTAZSourceFrame->hide();
1062 myTAZSinkFrame->hide();
1064 myStatisticsLabel->setText(
"No edges selected");
1074 myTAZFrameParent(TAZFrameParent),
1075 myTAZTemplate(nullptr) {
1107 delete myTAZTemplate;
1113 FXGroupBoxModule::show();
1119 FXGroupBoxModule::hide();
1125 const bool validColor = GNEAttributeCarrier::canParse<RGBColor>(myTextFieldColor->getText().text());
1126 const bool validCenter = myTextFieldCenter->getText().empty() || GNEAttributeCarrier::canParse<Position>(myTextFieldCenter->getText().text());
1128 return (validColor && validCenter && validName);
1134 return (myAddEdgesWithinCheckButton->getCheck() == TRUE);
1141 if (myTAZFrameParent->myBaseTAZ) {
1143 delete myTAZFrameParent->myBaseTAZ;
1150 myTAZFrameParent->myBaseTAZ->addPositionAttribute(
SUMO_ATTR_CENTER, myTextFieldCenter->getText().empty() ?
Position::INVALID : GNEAttributeCarrier::parse<Position>(myTextFieldCenter->getText().text()));
1151 myTAZFrameParent->myBaseTAZ->addBoolAttribute(
SUMO_ATTR_FILL, (myCheckButtonFill->getCheck() == TRUE));
1152 myTAZFrameParent->myBaseTAZ->addColorAttribute(
SUMO_ATTR_COLOR, GNEAttributeCarrier::parse<RGBColor>(myTextFieldColor->getText().text()));
1153 myTAZFrameParent->myBaseTAZ->addStringAttribute(
SUMO_ATTR_NAME, myTextFieldName->getText().text());
1160 FXColorDialog colordialog(getCollapsableFrame(), tr(
"Color Dialog"));
1161 colordialog.setTarget(
this);
1163 if (GNEAttributeCarrier::canParse<RGBColor>(myTextFieldColor->getText().text())) {
1164 colordialog.setRGBA(
MFXUtils::getFXColor(GNEAttributeCarrier::parse<RGBColor>(myTextFieldColor->getText().text())));
1169 if (colordialog.execute()) {
1171 onCmdSetAttribute(0, 0, 0);
1179 if (obj == myTextFieldColor) {
1181 if (GNEAttributeCarrier::canParse<RGBColor>(myTextFieldColor->getText().text())) {
1182 myTextFieldColor->setTextColor(FXRGB(0, 0, 0));
1183 myTextFieldColor->killFocus();
1185 myTextFieldColor->setTextColor(FXRGB(255, 0, 0));
1187 }
else if (obj == myTextFieldCenter) {
1189 if (myTextFieldCenter->getText().empty() || GNEAttributeCarrier::canParse<RGBColor>(myTextFieldCenter->getText().text())) {
1190 myTextFieldCenter->setTextColor(FXRGB(0, 0, 0));
1191 myTextFieldCenter->killFocus();
1193 myTextFieldCenter->setTextColor(FXRGB(255, 0, 0));
1195 }
else if (obj == myTextFieldName) {
1198 myTextFieldName->setTextColor(FXRGB(0, 0, 0));
1199 myTextFieldName->killFocus();
1201 myTextFieldName->setTextColor(FXRGB(255, 0, 0));
1203 }
else if (obj == myAddEdgesWithinCheckButton) {
1205 if (myAddEdgesWithinCheckButton->getCheck() == TRUE) {
1206 myAddEdgesWithinCheckButton->setText(
"use");
1208 myAddEdgesWithinCheckButton->setText(
"not use");
1210 }
else if (obj == myCheckButtonFill) {
1212 if (myCheckButtonFill->getCheck() == TRUE) {
1213 myCheckButtonFill->setText(
"true");
1215 myCheckButtonFill->setText(
"false");
1224 myTAZFrameParent->openHelpAttributesDialog(myTAZTemplate);
1234 myTAZFrameParent(TAZFrameParent),
1235 myEdgeDefaultColor(
RGBColor::GREY),
1236 myEdgeSelectedColor(
RGBColor::MAGENTA) {
1273 for (
const auto& edge : myTAZFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
1274 for (
const auto& lane : edge.second->getLanes()) {
1275 lane->setSpecialColor(
nullptr);
1286 for (
const auto& edge : myTAZFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
1287 if (!edge.second->isAttributeCarrierSelected()) {
1289 for (
const auto lane : edge.second->getLanes()) {
1290 lane->setSpecialColor(&myEdgeDefaultColor);
1295 for (
const auto& TAZEdgeColor : myTAZFrameParent->myCurrentTAZ->getTAZEdges()) {
1296 if (!TAZEdgeColor.edge->isAttributeCarrierSelected()) {
1298 for (
const auto& lane : TAZEdgeColor.edge->getLanes()) {
1300 if (myColorBySourceWeight->getCheck() == TRUE) {
1301 lane->setSpecialColor(&scaledColors.at(TAZEdgeColor.sourceColor), TAZEdgeColor.source->getDepartWeight());
1302 }
else if (myColorBySinkWeight->getCheck() == TRUE) {
1303 lane->setSpecialColor(&scaledColors.at(TAZEdgeColor.sinkColor), TAZEdgeColor.sink->getDepartWeight());
1304 }
else if (myColorBySourcePlusSinkWeight->getCheck() == TRUE) {
1305 lane->setSpecialColor(&scaledColors.at(TAZEdgeColor.sourcePlusSinkColor), TAZEdgeColor.source->getDepartWeight() + TAZEdgeColor.sink->getDepartWeight());
1307 lane->setSpecialColor(&scaledColors.at(TAZEdgeColor.sourceMinusSinkColor), TAZEdgeColor.source->getDepartWeight() - TAZEdgeColor.sink->getDepartWeight());
1313 for (
const auto& selectedEdge : myTAZFrameParent->myTAZSelectionStatistics->getEdgeAndTAZChildrenSelected()) {
1314 if (!selectedEdge.edge->isAttributeCarrierSelected()) {
1316 for (
const auto& lane : selectedEdge.edge->getLanes()) {
1317 lane->setSpecialColor(&myEdgeSelectedColor);
1322 myTAZFrameParent->myViewNet->updateViewNet();
1329 if (obj == myColorBySourceWeight) {
1330 myColorBySinkWeight->setCheck(FALSE);
1331 myColorBySourcePlusSinkWeight->setCheck(FALSE);
1332 myColorBySourceMinusSinkWeight->setCheck(FALSE);
1333 }
else if (obj == myColorBySinkWeight) {
1334 myColorBySourceWeight->setCheck(FALSE);
1335 myColorBySourcePlusSinkWeight->setCheck(FALSE);
1336 myColorBySourceMinusSinkWeight->setCheck(FALSE);
1337 }
else if (obj == myColorBySourcePlusSinkWeight) {
1338 myColorBySourceWeight->setCheck(FALSE);
1339 myColorBySinkWeight->setCheck(FALSE);
1340 myColorBySourceMinusSinkWeight->setCheck(FALSE);
1341 }
else if (obj == myColorBySourceMinusSinkWeight) {
1342 myColorBySourceWeight->setCheck(FALSE);
1343 myColorBySinkWeight->setCheck(FALSE);
1344 myColorBySourcePlusSinkWeight->setCheck(FALSE);
1356 GNEFrame(horizontalFrameParent, viewNet,
"TAZs"),
1409 std::map<SumoXMLAttr, std::string> valuesOfElement;
1443 if (TAZEdgeColor.edge == objectsUnderCursor.
getEdgeFront()) {
1470 for (
const auto& edge : edges) {
1479 for (
const auto& edge : edges) {
1484 if (TAZEdgeColor.edge == edge) {
1544 std::vector<std::string> edgeIDs;
1547 for (
const auto& AC : ACsInBoundary) {
1548 if ((AC.second->getTagProperty().getTag() ==
SUMO_TAG_EDGE) &&
1550 edgeIDs.push_back(AC.first);
1574 if (TAZEdgeColor.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 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
@ SUMO_ATTR_FILL
Fill the polygon.
@ 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)
void parseSumoBaseObject(CommonXMLStructure::SumoBaseObject *obj)
parse SumoBaseObject (it's called recursivelly)
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
void addStringAttribute(const SumoXMLAttr attr, const std::string &value)
FXGroupBoxModule (based on FXGroupBox)
FXVerticalFrame * getCollapsableFrame()
get collapsable frame (used by all elements that will be collapsed if button is toogled)
Builds additional objects for GNENet (busStops, chargingStations, detectors, etc.....
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
GNENet * getNet() const
get pointer to net
A road/street connecting two junctions (netedit-version)
bool getNeteditAttributesAndValues(CommonXMLStructure::SumoBaseObject *baseObject, const GNELane *lane) const
fill valuesMap with netedit attributes
GNEViewNet * getViewNet() const
get view net
GNEViewNet * myViewNet
View Net.
FXVerticalFrame * myContentFrame
Vertical frame that holds all widgets of frame.
virtual void show()
show Frame
virtual void hide()
hide Frame
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
bool isNetworkElementAroundShape(GNEAttributeCarrier *AC, const PositionVector &shape) const
check if shape of given AC (network element) is around the given shape
std::string generateTAZElementID(SumoXMLTag TAZElementTag) const
generate TAZElement ID
GNEEdge * retrieveEdge(const std::string &id, bool hardFail=true) const
get edge by id
std::vector< GNEEdge * > getSelectedEdges() const
return all edges
bool TAZElementExist(const GNETAZElement *TAZElement) const
return true if given TAZElement exist
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
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
void addTAZChild(GNETAZSourceSink *additional)
add TAZChild
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.
void showTAZChildDefaultParametersModule()
show TAZ child default parameters Module
FXCheckButton * myToggleMembership
CheckButton to enable or disable Toggle edge Membership.
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 source weight
void hideTAZChildDefaultParametersModule()
hide TAZ child default parameters Module
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 sink weight
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.
FXTextField * myTextFieldName
textField to modify the default value of name parameter
void 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 showTAZParametersModule()
show TAZ parameters and set the default value of 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.
void hideTAZParametersModule()
hide TAZ parameters
long onCmdSetColorAttribute(FXObject *, FXSelector, void *)
GNETAZ * myTAZTemplate
TAZ.
FXButton * myColorEditor
Button for open color editor.
FXTextField * myTextFieldCenter
text field center
FXTextField * myTextFieldColor
textField to modify the default value of color parameter
FXCheckButton * myCheckButtonFill
CheckButton to enable or disable fill.
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 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
GNEFrameAttributeModules::NeteditAttributes * myNeteditAttributes
Netedit parameter.
TAZSaveChanges * getTAZSaveChangesModule() const
get TAZ Save Changes modul
CurrentTAZ * myCurrentTAZ
current TAZ
TAZEdgesGraphic * myTAZEdgesGraphic
TAZ Edges Graphic.
TAZParameters * myTAZParameters
TAZ parameters.
bool addOrRemoveTAZMember(GNEEdge *edge)
add or remove a source and a sink, or remove it if edge is in the list of TAZ Children
GNEFrameModules::DrawingShape * getDrawingShapeModule() const
get drawing mode modul
void dropTAZMembers()
drop all TAZSources and TAZ Sinks of current TAZ
bool processClick(const Position &clickedPosition, const GNEViewNetHelper::ObjectsUnderCursor &objectsUnderCursor)
process click over Viewnet
CurrentTAZ * getCurrentTAZModule() const
get Current TAZ modul
TAZCommonStatistics * myTAZCommonStatistics
TAZ Edges common parameters.
GNEFrameModules::DrawingShape * myDrawingShape
Drawing shape.
bool shapeDrawed()
build a shaped element using the drawed shape return true if was sucesfully created
~GNETAZFrame()
Destructor.
TAZSaveChanges * myTAZSaveChanges
save TAZ Edges
CommonXMLStructure::SumoBaseObject * myBaseTAZ
SumoBaseObject used for creating TAZ.
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
TAZChildDefaultParameters * myTAZChildDefaultParameters
TAZ child defaults parameters.
void updateTAZStadistic()
update TAZ Stadistic
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
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
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.
static const Position INVALID
used to indicate that a position is valid
void closePolygon()
ensures that the last position equals the first
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
Position getCentroid() const
Returns the centroid (closes the polygon if unclosed)
static const RGBColor WHITE
static const RGBColor BLUE
static bool isValidAttribute(const std::string &value)
whether the given string is a valid attribute for a certain key (for example, a name)
static const std::vector< RGBColor > & getRainbowScaledColors()
get scaled rainbow colors