78 FXGroupBoxModule(selectorFrameParent->myContentFrame, "Selection information"),
79 mySelectorFrameParent(selectorFrameParent) {
93 const auto ACs = mySelectorFrameParent->getViewNet()->getNet()->getAttributeCarriers();
95 if (mySelectorFrameParent->getViewNet()->getEditModes().isCurrentSupermodeNetwork()) {
96 updateInformationLabel(
"Junctions", ACs->getNumberOfSelectedJunctions());
97 updateInformationLabel(
"Edges", ACs->getNumberOfSelectedEdges());
98 updateInformationLabel(
"Lanes", ACs->getNumberOfSelectedLanes());
99 updateInformationLabel(
"Connections", ACs->getNumberOfSelectedConnections());
100 updateInformationLabel(
"Crossings", ACs->getNumberOfSelectedCrossings());
101 updateInformationLabel(
"Additionals", ACs->getNumberOfSelectedAdditionals());
102 updateInformationLabel(
"TAZs", ACs->getNumberOfSelectedTAZs());
103 updateInformationLabel(
"Polygon", ACs->getNumberOfSelectedPolygons());
104 updateInformationLabel(
"POIs", ACs->getNumberOfSelectedPOIs());
105 }
else if (mySelectorFrameParent->getViewNet()->getEditModes().isCurrentSupermodeDemand()) {
106 updateInformationLabel(
"Routes", ACs->getNumberOfSelectedRoutes());
107 updateInformationLabel(
"Vehicles", ACs->getNumberOfSelectedVehicles());
108 updateInformationLabel(
"Persons", ACs->getNumberOfSelectedPersons());
109 updateInformationLabel(
"Person trips", ACs->getNumberOfSelectedPersonTrips());
110 updateInformationLabel(
"Walks", ACs->getNumberOfSelectedWalks());
111 updateInformationLabel(
"Rides", ACs->getNumberOfSelectedRides());
112 updateInformationLabel(
"Containers", ACs->getNumberOfSelectedContainers());
113 updateInformationLabel(
"Transport", ACs->getNumberOfSelectedTransport());
114 updateInformationLabel(
"Tranships", ACs->getNumberOfSelectedTranships());
115 updateInformationLabel(
"Stops", ACs->getNumberOfSelectedStops());
116 }
else if (mySelectorFrameParent->getViewNet()->getEditModes().isCurrentSupermodeData()) {
117 updateInformationLabel(
"EdgeDatas", ACs->getNumberOfSelectedEdgeDatas());
118 updateInformationLabel(
"EdgeRelDatas", ACs->getNumberOfSelectedEdgeRelDatas());
119 updateInformationLabel(
"EdgeTAZRel", ACs->getNumberOfSelectedEdgeTAZRel());
123 if (numberLines == 0) {
125 }
else if (numberLines > 1) {
166 return myModificationModeType;
172 if (obj == myAddRadioButton) {
173 myModificationModeType = Operation::ADD;
174 myAddRadioButton->setCheck(
true);
175 myRemoveRadioButton->setCheck(
false);
176 myKeepRadioButton->setCheck(
false);
177 myReplaceRadioButton->setCheck(
false);
179 }
else if (obj == myRemoveRadioButton) {
180 myModificationModeType = Operation::SUB;
181 myAddRadioButton->setCheck(
false);
182 myRemoveRadioButton->setCheck(
true);
183 myKeepRadioButton->setCheck(
false);
184 myReplaceRadioButton->setCheck(
false);
186 }
else if (obj == myKeepRadioButton) {
187 myModificationModeType = Operation::RESTRICT;
188 myAddRadioButton->setCheck(
false);
189 myRemoveRadioButton->setCheck(
false);
190 myKeepRadioButton->setCheck(
true);
191 myReplaceRadioButton->setCheck(
false);
193 }
else if (obj == myReplaceRadioButton) {
194 myModificationModeType = Operation::REPLACE;
195 myAddRadioButton->setCheck(
false);
196 myRemoveRadioButton->setCheck(
false);
197 myKeepRadioButton->setCheck(
false);
198 myReplaceRadioButton->setCheck(
true);
211 mySelectorFrameParent(selectorFrameParent) {
229 mySelectorFrameParent->myViewNet->setSelectorFrameScale(mySelectionScaling->getValue());
230 mySelectorFrameParent->myViewNet->updateViewNet();
240 mySelectorFrameParent(selectorFrameParent) {
244 FXVerticalFrame* col1 =
new FXVerticalFrame(selectionButtons, LAYOUT_FILL_X, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
245 FXVerticalFrame* col2 =
new FXVerticalFrame(selectionButtons, LAYOUT_FILL_X, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
266 FXFileDialog opendialog(getCollapsableFrame(),
"Open List of Selected Items");
268 opendialog.setSelectMode(SELECTFILE_EXISTING);
269 opendialog.setPatternList(
"Selection files (*.txt)\nAll files (*)");
273 if (opendialog.execute()) {
274 std::vector<GNEAttributeCarrier*> loadedACs;
276 std::string file = opendialog.getFilename().text();
277 std::ostringstream msg;
278 std::ifstream strm(file.c_str());
284 while (strm.good()) {
288 if (line.length() != 0) {
292 if ((
object !=
nullptr) && !mySelectorFrameParent->getViewNet()->getLockManager().isObjectLocked(object->
getType(),
false)) {
300 loadedACs.push_back(AC);
306 if (loadedACs.size() > 0) {
307 mySelectorFrameParent->myViewNet->getUndoList()->begin(
GUIIcon::MODESELECT,
"load selection");
308 mySelectorFrameParent->handleIDs(loadedACs);
309 mySelectorFrameParent->myViewNet->getUndoList()->end();
312 mySelectorFrameParent->myViewNet->updateViewNet();
320 "Save List of selected Items",
".txt",
328 const auto selectedACs = mySelectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->getSelectedAttributeCarriers(
false);
329 for (
const auto& selectedAC : selectedACs) {
338 WRITE_DEBUG(
"Opening FXMessageBox 'error storing selection'");
340 FXMessageBox::error(getCollapsableFrame(), MBOX_OK,
"Storing Selection failed",
"%s", e.what());
342 WRITE_DEBUG(
"Closed FXMessageBox 'error storing selection' with 'OK'");
350 bool ignoreLocking =
false;
352 if ((mySelectorFrameParent->myViewNet->getEditModes().isCurrentSupermodeNetwork() && processNetworkElementSelection(
true,
false, ignoreLocking)) ||
353 (mySelectorFrameParent->myViewNet->getEditModes().isCurrentSupermodeDemand() && processDemandElementSelection(
true,
false, ignoreLocking)) ||
354 (mySelectorFrameParent->myViewNet->getEditModes().isCurrentSupermodeData() && processDataElementSelection(
true,
false, ignoreLocking))) {
356 mySelectorFrameParent->myViewNet->getUndoList()->begin(
GUIIcon::MODESELECT,
"invert selection");
358 if (mySelectorFrameParent->myViewNet->getEditModes().isCurrentSupermodeNetwork()) {
359 processNetworkElementSelection(
false,
true, ignoreLocking);
360 }
else if (mySelectorFrameParent->myViewNet->getEditModes().isCurrentSupermodeDemand()) {
361 processDemandElementSelection(
false,
true, ignoreLocking);
362 }
else if (mySelectorFrameParent->myViewNet->getEditModes().isCurrentSupermodeData()) {
363 processDataElementSelection(
false,
true, ignoreLocking);
366 mySelectorFrameParent->myViewNet->getUndoList()->end();
374 mySelectorFrameParent->getViewNet()->hotkeyDel();
381 bool ignoreLocking =
false;
383 if ((mySelectorFrameParent->myViewNet->getEditModes().isCurrentSupermodeNetwork() && processNetworkElementSelection(
true,
false, ignoreLocking)) ||
384 (mySelectorFrameParent->myViewNet->getEditModes().isCurrentSupermodeDemand() && processDemandElementSelection(
true,
false, ignoreLocking)) ||
385 (mySelectorFrameParent->myViewNet->getEditModes().isCurrentSupermodeData() && processDataElementSelection(
true,
false, ignoreLocking))) {
387 mySelectorFrameParent->myViewNet->getUndoList()->begin(
GUIIcon::MODESELECT,
"invert selection");
389 if (mySelectorFrameParent->myViewNet->getEditModes().isCurrentSupermodeNetwork()) {
391 processNetworkElementSelection(
false,
false, ignoreLocking);
392 }
else if (mySelectorFrameParent->myViewNet->getEditModes().isCurrentSupermodeDemand()) {
394 processDemandElementSelection(
false,
false, ignoreLocking);
395 }
else if (mySelectorFrameParent->myViewNet->getEditModes().isCurrentSupermodeData()) {
397 processDataElementSelection(
false,
false, ignoreLocking);
400 mySelectorFrameParent->myViewNet->getUndoList()->end();
409 const auto& locks = mySelectorFrameParent->getViewNet()->getLockManager();
411 const auto& ACs = mySelectorFrameParent->myViewNet->getNet()->getAttributeCarriers();
413 GNEUndoList* undoList = mySelectorFrameParent->myViewNet->getUndoList();
415 for (
const auto& junction : ACs->getJunctions()) {
417 if (ignoreLocking || !locks.isObjectLocked(
GLO_JUNCTION,
false)) {
420 }
else if (onlyUnselect || junction.second->isAttributeCarrierSelected()) {
425 }
else if (onlyCount) {
426 ignoreLocking = askContinueIfLock();
430 for (
const auto& incomingEdge : junction.second->getGNEIncomingEdges()) {
434 if (ignoreLocking || !locks.isObjectLocked(
GLO_EDGE,
false)) {
440 }
else if (onlyCount) {
441 ignoreLocking = askContinueIfLock();
445 if (ignoreLocking || !locks.isObjectLocked(
GLO_LANE,
false)) {
446 for (
const auto& lane : incomingEdge->getLanes()) {
453 }
else if (onlyCount) {
454 ignoreLocking = askContinueIfLock();
457 }
else if (mySelectorFrameParent->myViewNet->getNetworkViewOptions().selectEdges()) {
459 if (ignoreLocking || !locks.isObjectLocked(
GLO_EDGE,
false)) {
462 }
else if (onlyUnselect || incomingEdge->isAttributeCarrierSelected()) {
467 }
else if (onlyCount) {
468 ignoreLocking = askContinueIfLock();
473 if (ignoreLocking || !locks.isObjectLocked(
GLO_LANE,
false)) {
474 for (
const auto& lane : incomingEdge->getLanes()) {
477 }
else if (onlyUnselect || lane->isAttributeCarrierSelected()) {
483 }
else if (onlyCount) {
484 ignoreLocking = askContinueIfLock();
489 if (ignoreLocking || !locks.isObjectLocked(
GLO_CONNECTION,
false)) {
490 for (
const auto& connection : incomingEdge->getGNEConnections()) {
493 }
else if (onlyUnselect || connection->isAttributeCarrierSelected()) {
499 }
else if (onlyCount) {
500 ignoreLocking = askContinueIfLock();
505 if (ignoreLocking || !locks.isObjectLocked(
GLO_CROSSING,
false)) {
506 for (
const auto& crossing : junction.second->getGNECrossings()) {
509 }
else if (onlyUnselect || crossing->isAttributeCarrierSelected()) {
515 }
else if (onlyCount) {
516 ignoreLocking = askContinueIfLock();
522 for (
const auto& additionalTag : ACs->getAdditionals()) {
525 for (
const auto& additional : additionalTag.second) {
528 }
else if (onlyUnselect || additional->isAttributeCarrierSelected()) {
536 }
else if (onlyCount) {
537 ignoreLocking = askContinueIfLock();
541 if (ignoreLocking || !locks.isObjectLocked(
GLO_POLYGON,
false)) {
542 for (
const auto& polygon : ACs->getShapes().at(
SUMO_TAG_POLY)) {
545 }
else if (onlyUnselect || polygon->isAttributeCarrierSelected()) {
551 }
else if (onlyCount) {
552 ignoreLocking = askContinueIfLock();
556 if (ignoreLocking || !locks.isObjectLocked(
GLO_TAZ,
false)) {
560 }
else if (onlyUnselect ||
TAZ->isAttributeCarrierSelected()) {
566 }
else if (onlyCount) {
567 ignoreLocking = askContinueIfLock();
571 if (ignoreLocking || !locks.isObjectLocked(
GLO_POI,
false)) {
572 for (
const auto& shapeTag : ACs->getShapes()) {
574 for (
const auto&
POI : shapeTag.second) {
577 }
else if (onlyUnselect ||
POI->isAttributeCarrierSelected()) {
583 }
else if (onlyCount) {
584 ignoreLocking = askContinueIfLock();
596 const auto& locks = mySelectorFrameParent->getViewNet()->getLockManager();
598 GNEUndoList* undoList = mySelectorFrameParent->myViewNet->getUndoList();
600 const auto& demandElements = mySelectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->getDemandElements();
602 if (ignoreLocking || !locks.isObjectLocked(
GLO_ROUTE,
false)) {
606 }
else if (onlyUnselect || route->isAttributeCarrierSelected()) {
616 }
else if (onlyUnselect || vehicle->getChildDemandElements().front()->isAttributeCarrierSelected()) {
617 vehicle->getChildDemandElements().front()->setAttribute(
GNE_ATTR_SELECTED,
"false", undoList);
619 vehicle->getChildDemandElements().front()->setAttribute(
GNE_ATTR_SELECTED,
"true", undoList);
625 }
else if (onlyUnselect || routeFlow->getChildDemandElements().front()->isAttributeCarrierSelected()) {
626 routeFlow->getChildDemandElements().front()->setAttribute(
GNE_ATTR_SELECTED,
"false", undoList);
628 routeFlow->getChildDemandElements().front()->setAttribute(
GNE_ATTR_SELECTED,
"true", undoList);
631 }
else if (onlyCount) {
632 ignoreLocking = askContinueIfLock();
636 if (ignoreLocking || !locks.isObjectLocked(
GLO_VEHICLE,
false)) {
640 }
else if (onlyUnselect || vehicle->isAttributeCarrierSelected()) {
649 }
else if (onlyUnselect || vehicle->isAttributeCarrierSelected()) {
658 }
else if (onlyUnselect || trip->isAttributeCarrierSelected()) {
667 }
else if (onlyUnselect || flow->isAttributeCarrierSelected()) {
676 }
else if (onlyUnselect || routeFlow->isAttributeCarrierSelected()) {
685 }
else if (onlyUnselect || routeFlow->isAttributeCarrierSelected()) {
691 }
else if (onlyCount) {
692 ignoreLocking = askContinueIfLock();
696 if (ignoreLocking || !locks.isObjectLocked(
GLO_PERSON,
false)) {
700 }
else if (onlyUnselect || person->isAttributeCarrierSelected()) {
709 }
else if (onlyUnselect || personFlow->isAttributeCarrierSelected()) {
715 }
else if (onlyCount) {
716 ignoreLocking = askContinueIfLock();
720 if (ignoreLocking || !locks.isObjectLocked(
GLO_PERSONTRIP,
false)) {
722 for (
const auto& personPlan : person->getChildDemandElements()) {
725 }
else if (personPlan->getTagProperty().isPersonTrip()) {
726 if (onlyUnselect || personPlan->isAttributeCarrierSelected()) {
735 for (
const auto& personPlan : personFlow->getChildDemandElements()) {
738 }
else if (personPlan->getTagProperty().isPersonTrip()) {
739 if (onlyUnselect || personPlan->isAttributeCarrierSelected()) {
747 }
else if (onlyCount) {
748 ignoreLocking = askContinueIfLock();
752 if (ignoreLocking || !locks.isObjectLocked(
GLO_PERSONTRIP,
false)) {
754 for (
const auto& personPlan : person->getChildDemandElements()) {
755 if (personPlan->getTagProperty().isRide()) {
758 }
else if (onlyUnselect || personPlan->isAttributeCarrierSelected()) {
767 for (
const auto& personPlan : personFlow->getChildDemandElements()) {
768 if (personPlan->getTagProperty().isRide()) {
771 }
else if (onlyUnselect || personPlan->isAttributeCarrierSelected()) {
779 }
else if (onlyCount) {
780 ignoreLocking = askContinueIfLock();
784 if (ignoreLocking || !locks.isObjectLocked(
GLO_PERSONTRIP,
false)) {
786 for (
const auto& personPlan : person->getChildDemandElements()) {
787 if (personPlan->getTagProperty().isWalk()) {
790 }
else if (onlyUnselect || personPlan->isAttributeCarrierSelected()) {
799 for (
const auto& personPlan : personFlow->getChildDemandElements()) {
800 if (personPlan->getTagProperty().isWalk()) {
803 }
else if (onlyUnselect || personPlan->isAttributeCarrierSelected()) {
811 }
else if (onlyCount) {
812 ignoreLocking = askContinueIfLock();
816 if (ignoreLocking || !locks.isObjectLocked(
GLO_CONTAINER,
false)) {
820 }
else if (onlyUnselect || container->isAttributeCarrierSelected()) {
829 }
else if (onlyUnselect || containerFlow->isAttributeCarrierSelected()) {
835 }
else if (onlyCount) {
836 ignoreLocking = askContinueIfLock();
840 if (ignoreLocking || !locks.isObjectLocked(
GLO_TRANSPORT,
false)) {
842 for (
const auto& containerPlan : container->getChildDemandElements()) {
843 if (containerPlan->getTagProperty().isTransportPlan()) {
846 }
else if (onlyUnselect || containerPlan->isAttributeCarrierSelected()) {
855 for (
const auto& containerPlan : containerFlow->getChildDemandElements()) {
856 if (containerPlan->getTagProperty().isTransportPlan()) {
859 }
else if (onlyUnselect || containerPlan->isAttributeCarrierSelected()) {
867 }
else if (onlyCount) {
868 ignoreLocking = askContinueIfLock();
872 if (ignoreLocking || !locks.isObjectLocked(
GLO_TRANSHIP,
false)) {
874 for (
const auto& containerPlan : container->getChildDemandElements()) {
875 if (containerPlan->getTagProperty().isTranshipPlan()) {
878 }
else if (onlyUnselect || containerPlan->isAttributeCarrierSelected()) {
887 for (
const auto& containerPlan : containerFlow->getChildDemandElements()) {
888 if (containerPlan->getTagProperty().isTranshipPlan()) {
891 }
else if (onlyUnselect || containerPlan->isAttributeCarrierSelected()) {
899 }
else if (onlyCount) {
900 ignoreLocking = askContinueIfLock();
904 if (ignoreLocking || !locks.isObjectLocked(
GLO_STOP,
false)) {
905 for (
const auto& demandElementTag : demandElements) {
906 for (
const auto& demandElement : demandElementTag.second) {
908 if (!demandElement->getTagProperty().isVehicleType()) {
910 for (
const auto& stop : demandElement->getChildDemandElements()) {
911 if (stop->getTagProperty().isStop() || stop->getTagProperty().isStopPerson() || stop->getTagProperty().isStopContainer()) {
914 }
else if (onlyUnselect || stop->isAttributeCarrierSelected()) {
921 for (
const auto& stopEmbeddedRoute : stop->getChildDemandElements()) {
922 if (stopEmbeddedRoute->getTagProperty().isStop() ||
923 stopEmbeddedRoute->getTagProperty().isStopPerson() ||
924 stopEmbeddedRoute->getTagProperty().isStopContainer()) {
927 }
else if (onlyUnselect || stopEmbeddedRoute->isAttributeCarrierSelected()) {
939 }
else if (onlyCount) {
940 ignoreLocking = askContinueIfLock();
950 const auto& locks = mySelectorFrameParent->getViewNet()->getLockManager();
952 for (
const auto& genericDataTag : mySelectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->getGenericDatas()) {
953 for (
const auto& genericData : genericDataTag.second) {
954 if (onlyCount && locks.isObjectLocked(genericData->getType(),
false)) {
955 ignoreLocking = askContinueIfLock();
957 }
else if ((ignoreLocking || (!locks.isObjectLocked(
GLO_EDGEDATA,
false) && genericData->getType() ==
GLO_EDGEDATA)) ||
962 }
else if (onlyUnselect || genericData->isAttributeCarrierSelected()) {
963 genericData->setAttribute(
GNE_ATTR_SELECTED,
"false", mySelectorFrameParent->myViewNet->getUndoList());
965 genericData->setAttribute(
GNE_ATTR_SELECTED,
"true", mySelectorFrameParent->myViewNet->getUndoList());
976 WRITE_DEBUG(
"Opening FXMessageBox 'confirm selection operation'");
978 const FXuint answer = FXMessageBox::question(mySelectorFrameParent->getViewNet()->getApp(),
979 MBOX_YES_NO,
"Confirm selection operation",
"There are locked elements in currentselection.\nApply operation to locked elements?");
983 WRITE_DEBUG(
"Closed FXMessageBox 'confirm selection operation' with 'No'");
984 }
else if (answer == 4) {
985 WRITE_DEBUG(
"Closed FXMessageBox 'confirm selection operation' with 'ESC'");
990 WRITE_DEBUG(
"Closed FXMessageBox 'confirm selection operation' with 'Yes'");
1001 mySelectorFrameParent(selectorFrameParent),
1002 myCurrentSelectedParent(
Selection::ALL),
1003 myCurrentSelectedChild(
Selection::ALL) {
1025 for (
const auto& item :
myItems) {
1039 if (obj == myParentsComboBox) {
1040 for (
const auto& item : myItems) {
1041 if (item.second == myParentsComboBox->getText().text()) {
1043 mySelectParentsButton->enable();
1044 myUnselectParentsButton->enable();
1046 myParentsComboBox->setTextColor(FXRGB(0, 0, 0));
1048 myCurrentSelectedParent = item.first;
1053 myCurrentSelectedParent = Selection::NOTHING;
1055 mySelectParentsButton->disable();
1056 myUnselectParentsButton->disable();
1057 myParentsComboBox->setTextColor(FXRGB(255, 0, 0));
1059 }
else if (obj == myChildrenComboBox) {
1060 for (
const auto& item : myItems) {
1061 if (item.second == myChildrenComboBox->getText().text()) {
1063 mySelectChildrenButton->enable();
1064 myUnselectChildrenButton->enable();
1066 myChildrenComboBox->setTextColor(FXRGB(0, 0, 0));
1068 myCurrentSelectedChild = item.first;
1073 myCurrentSelectedChild = Selection::NOTHING;
1075 mySelectChildrenButton->disable();
1076 myUnselectChildrenButton->disable();
1077 myChildrenComboBox->setTextColor(FXRGB(255, 0, 0));
1087 const auto selectedACs = mySelectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedAttributeCarriers(
true);
1089 if ((selectedACs.size() > 0) && (myCurrentSelectedParent != Selection::NOTHING)) {
1091 std::vector<GNEHierarchicalElement*> HEToSelect;
1092 for (
const auto& selectedAC : selectedACs) {
1094 const auto HE = selectedAC->getHierarchicalElement();
1096 if ((myCurrentSelectedParent == Selection::ALL) || (myCurrentSelectedParent == Selection::JUNCTION)) {
1097 HEToSelect.insert(HEToSelect.end(), HE->getParentJunctions().begin(), HE->getParentJunctions().end());
1100 if ((myCurrentSelectedParent == Selection::ALL) || (myCurrentSelectedParent == Selection::EDGE)) {
1101 if (selectedAC->getTagProperty().getTag() ==
SUMO_TAG_LANE) {
1103 HEToSelect.push_back(
dynamic_cast<GNELane*
>(selectedAC)->getParentEdge());
1105 HEToSelect.insert(HEToSelect.end(), HE->getParentEdges().begin(), HE->getParentEdges().end());
1109 if ((myCurrentSelectedParent == Selection::ALL) || (myCurrentSelectedParent == Selection::LANE)) {
1110 HEToSelect.insert(HEToSelect.end(), HE->getParentLanes().begin(), HE->getParentLanes().end());
1113 if ((myCurrentSelectedParent == Selection::ALL) || (myCurrentSelectedParent == Selection::ADDITIONAL)) {
1114 HEToSelect.insert(HEToSelect.end(), HE->getParentAdditionals().begin(), HE->getParentAdditionals().end());
1117 if ((myCurrentSelectedParent == Selection::ALL) || (myCurrentSelectedParent == Selection::SHAPE)) {
1118 HEToSelect.insert(HEToSelect.end(), HE->getParentShapes().begin(), HE->getParentShapes().end());
1121 if ((myCurrentSelectedParent == Selection::ALL) || (myCurrentSelectedParent == Selection::DEMAND)) {
1122 HEToSelect.insert(HEToSelect.end(), HE->getParentDemandElements().begin(), HE->getParentDemandElements().end());
1125 if ((myCurrentSelectedParent == Selection::ALL) || (myCurrentSelectedParent == Selection::DATA)) {
1126 HEToSelect.insert(HEToSelect.end(), HE->getParentGenericDatas().begin(), HE->getParentGenericDatas().end());
1130 if (HEToSelect.size() > 0) {
1131 for (
const auto& HE : HEToSelect) {
1132 if (obj == mySelectParentsButton) {
1133 HE->setAttribute(
GNE_ATTR_SELECTED,
"true", mySelectorFrameParent->getViewNet()->getUndoList());
1135 HE->setAttribute(
GNE_ATTR_SELECTED,
"false", mySelectorFrameParent->getViewNet()->getUndoList());
1140 mySelectorFrameParent->mySelectionInformation->updateInformationLabel();
1142 mySelectorFrameParent->getViewNet()->update();
1151 const auto selectedACs = mySelectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedAttributeCarriers(
true);
1153 if ((selectedACs.size() > 0) && (myCurrentSelectedChild != Selection::NOTHING)) {
1155 std::vector<GNEHierarchicalElement*> HEToSelect;
1156 for (
const auto& selectedAC : selectedACs) {
1158 const auto HE = selectedAC->getHierarchicalElement();
1160 if ((myCurrentSelectedChild == Selection::ALL) || (myCurrentSelectedChild == Selection::JUNCTION)) {
1163 const auto junction =
dynamic_cast<GNEJunction*
>(selectedAC);
1165 HEToSelect.insert(HEToSelect.end(), junction->getGNEIncomingEdges().begin(), junction->getGNEIncomingEdges().end());
1166 HEToSelect.insert(HEToSelect.end(), junction->getGNEOutgoingEdges().begin(), junction->getGNEOutgoingEdges().end());
1168 HEToSelect.insert(HEToSelect.end(), HE->getChildJunctions().begin(), HE->getChildJunctions().end());
1172 if ((myCurrentSelectedChild == Selection::ALL) || (myCurrentSelectedChild == Selection::EDGE)) {
1173 if (selectedAC->getTagProperty().getTag() ==
SUMO_TAG_EDGE) {
1175 const auto edge =
dynamic_cast<GNEEdge*
>(selectedAC);
1177 HEToSelect.insert(HEToSelect.end(), edge->getLanes().begin(), edge->getLanes().end());
1179 HEToSelect.insert(HEToSelect.end(), HE->getChildEdges().begin(), HE->getChildEdges().end());
1183 if ((myCurrentSelectedChild == Selection::ALL) || (myCurrentSelectedChild == Selection::LANE)) {
1184 HEToSelect.insert(HEToSelect.end(), HE->getChildLanes().begin(), HE->getChildLanes().end());
1187 if ((myCurrentSelectedChild == Selection::ALL) || (myCurrentSelectedChild == Selection::ADDITIONAL)) {
1189 for (
const auto& additionalChild : HE->getChildAdditionals()) {
1190 if (!additionalChild->getTagProperty().isSymbol()) {
1191 HEToSelect.push_back(additionalChild);
1196 if ((myCurrentSelectedChild == Selection::ALL) || (myCurrentSelectedChild == Selection::SHAPE)) {
1197 HEToSelect.insert(HEToSelect.end(), HE->getChildShapes().begin(), HE->getChildShapes().end());
1200 if ((myCurrentSelectedChild == Selection::ALL) || (myCurrentSelectedChild == Selection::DEMAND)) {
1201 HEToSelect.insert(HEToSelect.end(), HE->getChildDemandElements().begin(), HE->getChildDemandElements().end());
1204 if ((myCurrentSelectedChild == Selection::ALL) || (myCurrentSelectedChild == Selection::DATA)) {
1205 HEToSelect.insert(HEToSelect.end(), HE->getChildGenericDatas().begin(), HE->getChildGenericDatas().end());
1209 if (HEToSelect.size() > 0) {
1210 for (
const auto& HE : HEToSelect) {
1211 if (obj == mySelectChildrenButton) {
1214 HE->setAttribute(
GNE_ATTR_SELECTED,
"false", mySelectorFrameParent->getViewNet()->getUndoList());
1219 mySelectorFrameParent->mySelectionInformation->updateInformationLabel();
1221 mySelectorFrameParent->getViewNet()->update();
1244 GNEFrame(horizontalFrameParent, viewNet,
"Selection") {
1318 std::set<std::pair<std::string, GNEAttributeCarrier*> > ACsToSelect, ACsToUnselect;
1324 for (
const auto& selectedAC : selectedACs) {
1325 ACsToUnselect.insert(std::make_pair(selectedAC->getID(), selectedAC));
1329 for (
const auto& AC : ACs) {
1331 switch (setOperation) {
1333 ACsToUnselect.insert(std::make_pair(AC->getID(), AC));
1336 if (ACsToUnselect.find(std::make_pair(AC->getID(), AC)) != ACsToUnselect.end()) {
1337 ACsToSelect.insert(std::make_pair(AC->getID(), AC));
1341 ACsToSelect.insert(std::make_pair(AC->getID(), AC));
1347 std::set<GNEEdge*> edgesToSelect;
1349 for (
const auto& AC : ACsToSelect) {
1350 if (AC.second->getTagProperty().getTag() ==
SUMO_TAG_EDGE) {
1355 for (
const auto& edgeToSelect : edgesToSelect) {
1357 ACsToSelect.insert(std::make_pair(edgeToSelect->getFromJunction()->getID(), edgeToSelect->getFromJunction()));
1358 for (
const auto& connectionToSelect : edgeToSelect->getFromJunction()->getGNEConnections()) {
1359 ACsToSelect.insert(std::make_pair(connectionToSelect->getID(), connectionToSelect));
1361 for (
const auto& crossingToSelect : edgeToSelect->getFromJunction()->getGNECrossings()) {
1362 ACsToSelect.insert(std::make_pair(crossingToSelect->getID(), crossingToSelect));
1365 ACsToSelect.insert(std::make_pair(edgeToSelect->getToJunction()->getID(), edgeToSelect->getToJunction()));
1366 for (
const auto& connectionToSelect : edgeToSelect->getToJunction()->getGNEConnections()) {
1367 ACsToSelect.insert(std::make_pair(connectionToSelect->getID(), connectionToSelect));
1369 for (
const auto& crossingToSelect : edgeToSelect->getToJunction()->getGNECrossings()) {
1370 ACsToSelect.insert(std::make_pair(crossingToSelect->getID(), crossingToSelect));
1375 if ((ACsToSelect.size() + ACsToUnselect.size()) > 0) {
1378 for (
const auto& ACToUnselect : ACsToUnselect) {
1379 if (ACToUnselect.second->getTagProperty().isSelectable()) {
1383 for (
const auto& ACToSelect : ACsToSelect) {
1384 if (ACToSelect.second->getTagProperty().isSelectable()) {
1394 std::vector<GNEAttributeCarrier*>
1396 std::vector<GNEAttributeCarrier*> result;
1402 for (
const auto& AC : allACbyTag) {
1403 if (expr ==
"" && compOp ==
'@') {
1404 result.push_back(AC);
1405 }
else if (tagValue.hasAttribute(ACAttr) && tagValue.getAttributeProperties(ACAttr).isNumerical()) {
1407 std::istringstream buf(AC->getAttribute(ACAttr));
1412 result.push_back(AC);
1417 result.push_back(AC);
1422 result.push_back(AC);
1428 std::string acVal = AC->getAttributeForSelection(ACAttr);
1431 if (acVal.find(expr) != std::string::npos) {
1432 result.push_back(AC);
1436 if (acVal.find(expr) == std::string::npos) {
1437 result.push_back(AC);
1441 if (acVal == expr) {
1442 result.push_back(AC);
1446 if (acVal != expr) {
1447 result.push_back(AC);
1457 std::vector<GNEAttributeCarrier*>
1459 std::vector<GNEAttributeCarrier*> result;
1461 for (
const auto& genericData : genericDatas) {
1462 if (expr ==
"" && compOp ==
'@') {
1463 result.push_back(genericData);
1466 std::istringstream buf(genericData->getParameter(attr,
"0"));
1471 result.push_back(genericData);
1476 result.push_back(genericData);
1481 result.push_back(genericData);
1487 std::string acVal = genericData->getAttributeForSelection(
GNE_ATTR_PARENT);
1490 if (acVal.find(expr) != std::string::npos) {
1491 result.push_back(genericData);
1495 if (acVal.find(expr) == std::string::npos) {
1496 result.push_back(genericData);
1500 if (acVal == expr) {
1501 result.push_back(genericData);
1505 if (acVal != expr) {
1506 result.push_back(genericData);
FXDEFMAP(GNESelectorFrame::ModificationMode) ModificationModeMap[]
@ NETWORK
Network mode (Edges, junctions, etc..)
@ DATA
Data mode (edgeData, LaneData etc..)
@ DEMAND
Demand mode (Routes, Vehicles etc..)
@ MID_GNE_SELECTORFRAME_SELECTSCALE
changes the visual scaling of selected items
@ MID_GNE_SELECTORFRAME_CHILDREN
select/unselect children
@ MID_CHOOSEN_SAVE
Save set.
@ MID_CHOOSEN_INVERT
Deselect selected items.
@ MID_CHOOSEN_DELETE
delete set
@ MID_CHOOSEN_OPERATION
set type of selection
@ MID_CHOOSEN_LOAD
Load set.
@ MID_CHOOSEN_CLEAR
Clear set.
@ MID_GNE_SELECT
select element
@ MID_GNE_SELECTORFRAME_PARENTS
select/unselect parents
#define GUIDesignSpinDial
#define GUIDesignComboBox
#define GUIDesignComboBoxNCol
number of column of every combo box
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
#define GUIDesignLabelThickCenter
label with thick, text justify to left and extended with (used in selector frame)
#define GUIDesignRadioButton
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
@ GLO_EDGERELDATA
edge relation data
@ GLO_TAZRELDATA
TAZ relation data.
@ GLO_TRANSHIP
a container tranship
@ GLO_TAZ
Traffic Assignment Zones (TAZs)
@ GLO_CONTAINER
a container
@ GLO_CONNECTION
a connection
@ GLO_ADDITIONALELEMENT
reserved GLO type to pack all additionals elements
@ GLO_PERSONTRIP
a person trip
@ GLO_TRANSPORT
a container transport
FXString gCurrentFolder
The folder used as last.
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_TAZ
a traffic assignment zone
@ SUMO_TAG_VEHICLE
description of a vehicle
@ GNE_TAG_FLOW_ROUTE
a flow definition using a route instead of a from-to edges route (used in NETEDIT)
@ GNE_TAG_FLOW_WITHROUTE
description of a vehicle with an embedded route (used in NETEDIT)
@ SUMO_TAG_FLOW
a flow definitio nusing a from-to edges instead of a route (used by router)
@ SUMO_TAG_JUNCTION
begin/end of the description of a junction
@ SUMO_TAG_ROUTE
begin/end of the description of a route
@ SUMO_TAG_MEANDATA_EDGE
an edge based mean data detector
@ SUMO_TAG_POLY
begin/end of the description of a polygon
@ SUMO_TAG_LANE
begin/end of the description of a single lane
@ GNE_TAG_VEHICLE_WITHROUTE
description of a vehicle with an embedded route (used in NETEDIT)
@ SUMO_TAG_TRIP
a single trip definition (used by router)
@ SUMO_TAG_EDGE
begin/end of the description of an edge
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ GNE_ATTR_PARENT
parent of an additional element
@ GNE_ATTR_SELECTED
element is selected
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
FXGroupBoxModule (based on FXGroupBox)
void setText(const std::string &text)
set text
FXVerticalFrame * getCollapsableFrame()
get collapsable frame (used by all elements that will be collapsed if button is toogled)
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)
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
void hideElementSet()
hide element set
void showElementSet()
show element set
GNEViewNet * myViewNet
View Net.
FXVerticalFrame * myContentFrame
Vertical frame that holds all widgets of frame.
virtual void show()
show Frame
virtual void hide()
hide Frame
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
GNEAttributeCarrier * retrieveAttributeCarrier(const GUIGlID id, bool hardFail=true) const
get a single attribute carrier based on a GLID
std::vector< GNEAttributeCarrier * > retrieveAttributeCarriers(SumoXMLTag tag=SUMO_TAG_NOTHING)
get the attribute carriers based on Type
GNEEdge * retrieveEdge(const std::string &id, bool hardFail=true) const
get edge by id
std::vector< GNEAttributeCarrier * > getSelectedAttributeCarriers(const bool ignoreCurrentSupermode)
get all selected attribute carriers (or only relative to current supermode
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
FXRadioButton * myReplaceRadioButton
replace radio button
Operation
FOX-declaration.
ModificationMode(GNESelectorFrame *selectorFrameParent)
constructor
long onCmdSelectModificationMode(FXObject *, FXSelector, void *)
FXRadioButton * myAddRadioButton
FOX need this.
~ModificationMode()
destructor
Operation getModificationMode() const
get current modification mode
FXRadioButton * myRemoveRadioButton
remove radio button
FXRadioButton * myKeepRadioButton
keep button
FXComboBox * myParentsComboBox
comboBox for parents
SelectionHierarchy(GNESelectorFrame *selectorFrameParent)
FOX-declaration.
~SelectionHierarchy()
destructor
FXButton * myUnselectParentsButton
unselect parents button
FXButton * mySelectParentsButton
select parents button
FXButton * myUnselectChildrenButton
unselect parents button
long onCmdParents(FXObject *obj, FXSelector, void *)
called when user press select/unselect parents button
long onCmdChildren(FXObject *obj, FXSelector, void *)
called when user press select/unselect children button
long onCmdSelectItem(FXObject *obj, FXSelector, void *)
called when user select an item in comboBox
FXComboBox * myChildrenComboBox
comboBox for children
const std::vector< std::pair< Selection, std::string > > myItems
FXButton * mySelectChildrenButton
select children button
SelectionOperation(GNESelectorFrame *selectorFrameParent)
FOX-declaration.
long onCmdSave(FXObject *, FXSelector, void *)
Called when the user presses the Save-button.
bool processDataElementSelection(const bool onlyCount, const bool onlyUnselect, bool &ignoreLocking)
process data element selection
bool askContinueIfLock() const
ask if continue due locking
long onCmdDelete(FXObject *, FXSelector, void *)
Called when the user presses the delete-button.
~SelectionOperation()
destructor
long onCmdInvert(FXObject *, FXSelector, void *)
Called when the user presses the Invert-button.
long onCmdClear(FXObject *, FXSelector, void *)
Called when the user presses the Clear-button.
long onCmdLoad(FXObject *, FXSelector, void *)
Called when the user presses the Load-button.
bool processDemandElementSelection(const bool onlyCount, const bool onlyUnselect, bool &ignoreLocking)
process demand element selection
bool processNetworkElementSelection(const bool onlyCount, const bool onlyUnselect, bool &ignoreLocking)
FOX need this.
~VisualScaling()
destructor
long onCmdScaleSelection(FXObject *, FXSelector, void *)
Called when the user changes visual scaling.
VisualScaling(GNESelectorFrame *selectorFrameParent)
FOX-declaration.
FXRealSpinner * mySelectionScaling
Spinner for selection scaling.
FXVerticalFrame * getContentFrame() const
get vertical frame that holds all widgets of frame
std::vector< GNEAttributeCarrier * > getMatches(const SumoXMLTag ACTag, const SumoXMLAttr ACAttr, const char compOp, const double val, const std::string &expr)
return ACs of the given type with matching attrs
void updateFrameAfterUndoRedo()
function called after undo/redo in the current frame
std::vector< GNEAttributeCarrier * > getGenericMatches(const std::vector< GNEGenericData * > &genericDatas, const std::string &attr, const char compOp, const double val, const std::string &expr)
return GenericDatas of the given type with matching attrs
ModificationMode * getModificationModeModule() const
get modification mode modul
GNESelectorFrame(FXHorizontalFrame *horizontalFrameParent, GNEViewNet *viewNet)
Constructor.
GNESelectorFrame::SelectionOperation * mySelectionOperation
modul for selection operations
~GNESelectorFrame()
Destructor.
GNESelectorFrame::SelectionInformation * mySelectionInformation
modul for selection information
GNESelectorFrame::VisualScaling * myVisualScaling
modul for visual scaling
GNEElementSet * myDemandElementSet
moduls for select demand element set
GNESelectorFrame::Information * myInformation
information modul
GNESelectorFrame::SelectionHierarchy * mySelectionHierarchy
modul for selection hierarchy
GNEElementSet * myNetworkElementSet
moduls for select network element set
GNEElementSet * myDataElementSet
moduls for select data element set
GNESelectorFrame::ModificationMode * myModificationMode
modul for change modification mode
void clearCurrentSelection() const
clear current selection with possibility of undo/redo
void handleIDs(const std::vector< GNEAttributeCarrier * > &ACs, const ModificationMode::Operation setop=ModificationMode::Operation::DEFAULT)
apply list of ids to the current selection according to Operation,
SelectionInformation * getSelectionInformation() const
getmodul for selection information
bool isSelectable() const
return true if tag correspond to a selectable element
bool isDemandElement() const
return true if tag correspond to a demand element
void end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
void begin(GUIIcon icon, const std::string &description)
Begin undo command sub-group with current supermode. This begins a new group of commands that are tre...
GNENet * getNet() const
get the net object
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
bool autoSelectNodes()
whether to autoselect nodes or to lanes
GNEUndoList * getUndoList() const
get the undoList object
static StringBijection< GUIGlObjectType > TypeNames
associates object types with strings
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
GUIGlID getGlID() const
Returns the numerical id of the object.
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
GUIGlObject * getObjectBlocking(GUIGlID id)
Returns the object from the container locking it.
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
static FXString getFilename2Write(FXWindow *parent, const FXString &header, const FXString &extension, FXIcon *icon, FXString ¤tFolder)
Returns the file name to write.
Static storage of an output device and its base (abstract) implementation.
void close()
Closes the device and removes it from the dictionary.
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
C++ TraCI client API implementation.
const std::string & getString(const T key) const
bool isCurrentSupermodeDemand() const
@check if current supermode is Demand
bool isCurrentSupermodeData() const
@check if current supermode is Data
bool isCurrentSupermodeNetwork() const
@check if current supermode is Network