80 mySelectorFrameParent(selectorFrameParent) {
94 const auto ACs = mySelectorFrameParent->getViewNet()->getNet()->getAttributeCarriers();
96 if (mySelectorFrameParent->getViewNet()->getEditModes().isCurrentSupermodeNetwork()) {
97 updateInformationLabel(
TL(
"Junctions"), ACs->getNumberOfSelectedJunctions());
98 updateInformationLabel(
TL(
"Edges"), ACs->getNumberOfSelectedEdges());
99 updateInformationLabel(
TL(
"Lanes"), ACs->getNumberOfSelectedLanes());
100 updateInformationLabel(
TL(
"Connections"), ACs->getNumberOfSelectedConnections());
101 updateInformationLabel(
TL(
"Crossings"), ACs->getNumberOfSelectedCrossings());
102 updateInformationLabel(
TL(
"WalkingAreas"), ACs->getNumberOfSelectedWalkingAreas());
103 updateInformationLabel(
TL(
"Additionals"), ACs->getNumberOfSelectedPureAdditionals());
104 updateInformationLabel(
TL(
"Wires"), ACs->getNumberOfSelectedWires());
105 updateInformationLabel(
TL(
"TAZs"), ACs->getNumberOfSelectedTAZs());
106 updateInformationLabel(
TL(
"TAZSources"), ACs->getNumberOfSelectedTAZSources());
107 updateInformationLabel(
TL(
"TAZSinks"), ACs->getNumberOfSelectedTAZSinks());
108 updateInformationLabel(
TL(
"Polygons"), ACs->getNumberOfSelectedPolygons());
109 updateInformationLabel(
TL(
"POIs"), ACs->getNumberOfSelectedPOIs());
110 updateInformationLabel(
TL(
"JuPedSim elements"),
111 ACs->getNumberOfSelectedJpsWalkableAreas() +
112 ACs->getNumberOfSelectedJpsObstacles());
113 }
else if (mySelectorFrameParent->getViewNet()->getEditModes().isCurrentSupermodeDemand()) {
114 updateInformationLabel(
TL(
"Routes"), ACs->getNumberOfSelectedRoutes());
115 updateInformationLabel(
TL(
"Vehicles"), ACs->getNumberOfSelectedVehicles());
116 updateInformationLabel(
TL(
"Persons"), ACs->getNumberOfSelectedPersons());
117 updateInformationLabel(
TL(
"Person trips"), ACs->getNumberOfSelectedPersonTrips());
118 updateInformationLabel(
TL(
"Walks"), ACs->getNumberOfSelectedWalks());
119 updateInformationLabel(
TL(
"Rides"), ACs->getNumberOfSelectedRides());
120 updateInformationLabel(
TL(
"Containers"), ACs->getNumberOfSelectedContainers());
121 updateInformationLabel(
TL(
"Transport"), ACs->getNumberOfSelectedTransport());
122 updateInformationLabel(
TL(
"Tranships"), ACs->getNumberOfSelectedTranships());
123 updateInformationLabel(
TL(
"Stops"), ACs->getNumberOfSelectedStops());
124 }
else if (mySelectorFrameParent->getViewNet()->getEditModes().isCurrentSupermodeData()) {
125 updateInformationLabel(
TL(
"EdgeDatas"), ACs->getNumberOfSelectedEdgeDatas());
126 updateInformationLabel(
TL(
"EdgeRelDatas"), ACs->getNumberOfSelectedEdgeRelDatas());
127 updateInformationLabel(
TL(
"EdgeTAZRel"), ACs->getNumberOfSelectedEdgeTAZRel());
131 if (numberLines == 0) {
133 }
else if (numberLines > 1) {
174 return myModificationModeType;
180 if (obj == myAddRadioButton) {
181 myModificationModeType = Operation::ADD;
182 myAddRadioButton->setCheck(
true);
183 myRemoveRadioButton->setCheck(
false);
184 myKeepRadioButton->setCheck(
false);
185 myReplaceRadioButton->setCheck(
false);
187 }
else if (obj == myRemoveRadioButton) {
188 myModificationModeType = Operation::SUB;
189 myAddRadioButton->setCheck(
false);
190 myRemoveRadioButton->setCheck(
true);
191 myKeepRadioButton->setCheck(
false);
192 myReplaceRadioButton->setCheck(
false);
194 }
else if (obj == myKeepRadioButton) {
195 myModificationModeType = Operation::RESTRICT;
196 myAddRadioButton->setCheck(
false);
197 myRemoveRadioButton->setCheck(
false);
198 myKeepRadioButton->setCheck(
true);
199 myReplaceRadioButton->setCheck(
false);
201 }
else if (obj == myReplaceRadioButton) {
202 myModificationModeType = Operation::REPLACE;
203 myAddRadioButton->setCheck(
false);
204 myRemoveRadioButton->setCheck(
false);
205 myKeepRadioButton->setCheck(
false);
206 myReplaceRadioButton->setCheck(
true);
219 mySelectorFrameParent(selectorFrameParent) {
237 mySelectorFrameParent->myViewNet->setSelectorFrameScale(mySelectionScaling->getValue());
238 mySelectorFrameParent->myViewNet->updateViewNet();
248 mySelectorFrameParent(selectorFrameParent) {
252 FXVerticalFrame* col1 =
new FXVerticalFrame(selectionButtons, LAYOUT_FILL_X, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
253 FXVerticalFrame* col2 =
new FXVerticalFrame(selectionButtons, LAYOUT_FILL_X, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
275 std::vector<GNEAttributeCarrier*> loadedACs;
276 std::ifstream strm(file.c_str());
282 std::map<const std::string, GNEAttributeCarrier*> GLFUllNameAC;
284 for (
const auto& GLObject : GLObjects) {
293 while (strm.good()) {
297 if (line.length() != 0) {
309 loadedACs.push_back(AC);
315 if (loadedACs.size() > 0) {
317 mySelectorFrameParent->handleIDs(loadedACs);
318 mySelectorFrameParent->myViewNet->getUndoList()->end();
320 mySelectorFrameParent->myViewNet->updateViewNet();
328 FXFileDialog opendialog(getCollapsableFrame(),
TL(
"Open List of Selected Items"));
330 opendialog.setSelectMode(SELECTFILE_EXISTING);
331 opendialog.setPatternList(
"Selection files (*.txt)\nAll files (*)");
335 if (opendialog.execute()) {
337 loadFromFile(opendialog.getFilename().text());
346 TL(
"Save List of selected Items"),
".txt",
354 const auto selectedACs = mySelectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->getSelectedAttributeCarriers(
false);
355 for (
const auto& selectedAC : selectedACs) {
364 WRITE_DEBUG(
"Opening FXMessageBox 'error storing selection'");
366 FXMessageBox::error(getCollapsableFrame(), MBOX_OK,
"Storing Selection failed",
"%s", e.what());
368 WRITE_DEBUG(
"Closed FXMessageBox 'error storing selection' with 'OK'");
377 GNEUndoList* undoList = mySelectorFrameParent->myViewNet->getUndoList();
379 std::pair<std::vector<std::pair<bool, GNEAttributeCarrier*> >, std::vector<std::pair<bool, GNEAttributeCarrier*> > > ACsToSelectUnselect;
380 if (mySelectorFrameParent->myViewNet->getEditModes().isCurrentSupermodeNetwork()) {
381 ACsToSelectUnselect = processMassiveNetworkElementSelection(
false);
382 }
else if (mySelectorFrameParent->myViewNet->getEditModes().isCurrentSupermodeDemand()) {
383 ACsToSelectUnselect = processMassiveDemandElementSelection();
384 }
else if (mySelectorFrameParent->myViewNet->getEditModes().isCurrentSupermodeData()) {
385 ACsToSelectUnselect = processMassiveDataElementSelection();
388 if (ACsToSelectUnselect.second.size() > 0) {
390 bool askedContinueIfLock =
false;
391 bool addLockedElements =
false;
392 bool unlockedElements =
false;
393 for (
const auto& AC : ACsToSelectUnselect.second) {
394 if (AC.first ==
false) {
396 unlockedElements =
true;
397 }
else if (!askedContinueIfLock) {
398 addLockedElements = askContinueIfLock();
400 askedContinueIfLock =
true;
403 if (unlockedElements || addLockedElements) {
405 for (
const auto& AC : ACsToSelectUnselect.second) {
406 if (addLockedElements || !AC.first) {
410 mySelectorFrameParent->myViewNet->getUndoList()->end();
419 mySelectorFrameParent->getViewNet()->hotkeyDel();
427 GNEUndoList* undoList = mySelectorFrameParent->myViewNet->getUndoList();
429 std::pair<std::vector<std::pair<bool, GNEAttributeCarrier*> >, std::vector<std::pair<bool, GNEAttributeCarrier*> > > ACsToSelectUnselect;
430 if (mySelectorFrameParent->myViewNet->getEditModes().isCurrentSupermodeNetwork()) {
431 ACsToSelectUnselect = processMassiveNetworkElementSelection(
true);
432 }
else if (mySelectorFrameParent->myViewNet->getEditModes().isCurrentSupermodeDemand()) {
433 ACsToSelectUnselect = processMassiveDemandElementSelection();
434 }
else if (mySelectorFrameParent->myViewNet->getEditModes().isCurrentSupermodeData()) {
435 ACsToSelectUnselect = processMassiveDataElementSelection();
438 if ((ACsToSelectUnselect.first.size() + ACsToSelectUnselect.second.size()) > 0) {
440 bool askedContinueIfLock =
false;
441 bool addLockedElements =
false;
442 bool unlockedElements =
false;
443 for (
const auto& AC : ACsToSelectUnselect.first) {
444 if (AC.first ==
false) {
446 unlockedElements =
true;
447 }
else if (!askedContinueIfLock) {
448 addLockedElements = askContinueIfLock();
450 askedContinueIfLock =
true;
453 for (
const auto& AC : ACsToSelectUnselect.second) {
454 if (AC.first ==
false) {
456 unlockedElements =
true;
457 }
else if (!askedContinueIfLock) {
458 addLockedElements = askContinueIfLock();
460 askedContinueIfLock =
true;
463 if (unlockedElements || addLockedElements) {
465 for (
const auto& AC : ACsToSelectUnselect.first) {
466 if (addLockedElements || !AC.first) {
470 for (
const auto& AC : ACsToSelectUnselect.second) {
471 if (addLockedElements || !AC.first) {
475 mySelectorFrameParent->myViewNet->getUndoList()->end();
487 onCmdInvert(0, 0, 0);
488 onCmdDelete(0, 0, 0);
490 mySelectorFrameParent->getViewNet()->getUndoList()->end();
495 std::pair<std::vector<std::pair<bool, GNEAttributeCarrier*> >, std::vector<std::pair<bool, GNEAttributeCarrier*> > >
498 const auto& ACs = mySelectorFrameParent->myViewNet->getNet()->getAttributeCarriers();
500 std::vector<GNEAttributeCarrier*> networkACs;
502 for (
const auto& junction : ACs->getJunctions()) {
503 networkACs.push_back(junction.second);
505 for (
const auto& incomingEdge : junction.second->getGNEIncomingEdges()) {
506 if (!filterLanes || mySelectorFrameParent->getViewNet()->getNetworkViewOptions().selectEdges()) {
507 networkACs.push_back(incomingEdge);
510 if (!filterLanes || !mySelectorFrameParent->getViewNet()->getNetworkViewOptions().selectEdges()) {
511 for (
const auto& lane : incomingEdge->getLanes()) {
512 networkACs.push_back(lane);
516 for (
const auto& connection : incomingEdge->getGNEConnections()) {
517 networkACs.push_back(connection);
521 for (
const auto& crossing : junction.second->getGNECrossings()) {
522 networkACs.push_back(crossing);
525 for (
const auto& walkingArea : junction.second->getGNEWalkingAreas()) {
526 networkACs.push_back(walkingArea);
530 for (
const auto& additionalTags : ACs->getAdditionals()) {
531 for (
const auto& additional : additionalTags.second) {
532 if (additional.second->getTagProperty().isSelectable()) {
533 networkACs.push_back(additional.second);
538 std::map<GUIGlObjectType, bool> checkedTypes;
540 std::pair<std::vector<std::pair<bool, GNEAttributeCarrier*> >, std::vector<std::pair<bool, GNEAttributeCarrier*> > > ACsToSelectUnselect;
542 for (
const auto& networkAC : networkACs) {
543 const auto networkACObjectType = networkAC->getGUIGlObject()->getType();
545 if (checkedTypes.find(networkACObjectType) == checkedTypes.end()) {
546 checkedTypes[networkACObjectType] = networkAC->getGUIGlObject()->isGLObjectLocked();
549 if (networkAC->isAttributeCarrierSelected()) {
550 ACsToSelectUnselect.second.push_back(std::make_pair(checkedTypes.at(networkACObjectType), networkAC));
552 ACsToSelectUnselect.first.push_back(std::make_pair(checkedTypes.at(networkACObjectType), networkAC));
555 return ACsToSelectUnselect;
559 std::pair<std::vector<std::pair<bool, GNEAttributeCarrier*> >, std::vector<std::pair<bool, GNEAttributeCarrier*> > >
562 std::map<GUIGlObjectType, bool> checkedTypes;
564 std::pair<std::vector<std::pair<bool, GNEAttributeCarrier*> >, std::vector<std::pair<bool, GNEAttributeCarrier*> > > ACsToSelectUnselect;
566 for (
const auto& demandElementTag : mySelectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->getDemandElements()) {
567 for (
const auto& demandElement : demandElementTag.second) {
568 if (demandElement.second->getTagProperty().isSelectable()) {
569 const auto networkACObjectType = demandElement.first->getType();
571 if (checkedTypes.find(networkACObjectType) == checkedTypes.end()) {
572 checkedTypes[networkACObjectType] = demandElement.first->isGLObjectLocked();
575 if (demandElement.second->isAttributeCarrierSelected()) {
576 ACsToSelectUnselect.second.push_back(std::make_pair(checkedTypes.at(networkACObjectType), demandElement.second));
578 ACsToSelectUnselect.first.push_back(std::make_pair(checkedTypes.at(networkACObjectType), demandElement.second));
583 return ACsToSelectUnselect;
587 std::pair<std::vector<std::pair<bool, GNEAttributeCarrier*> >, std::vector<std::pair<bool, GNEAttributeCarrier*> > >
590 std::map<GUIGlObjectType, bool> checkedTypes;
592 std::pair<std::vector<std::pair<bool, GNEAttributeCarrier*> >, std::vector<std::pair<bool, GNEAttributeCarrier*> > > ACsToSelectUnselect;
594 for (
const auto& genericDataTag : mySelectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->getGenericDatas()) {
595 for (
const auto& genericData : genericDataTag.second) {
596 if (genericData.second->getTagProperty().isSelectable()) {
597 const auto networkACObjectType = genericData.first->getType();
599 if (checkedTypes.find(networkACObjectType) == checkedTypes.end()) {
600 checkedTypes[networkACObjectType] = genericData.first->isGLObjectLocked();
603 if (genericData.second->isAttributeCarrierSelected()) {
604 ACsToSelectUnselect.second.push_back(std::make_pair(checkedTypes.at(networkACObjectType), genericData.second));
606 ACsToSelectUnselect.first.push_back(std::make_pair(checkedTypes.at(networkACObjectType), genericData.second));
611 return ACsToSelectUnselect;
617 WRITE_DEBUG(
"Opening FXMessageBox 'confirm selection operation'");
619 const FXuint answer = FXMessageBox::question(mySelectorFrameParent->getViewNet()->getApp(),
620 MBOX_YES_NO,
"Confirm selection operation",
"There are locked elements in the current selection.\nApply operation to locked elements?");
624 WRITE_DEBUG(
"Closed FXMessageBox 'confirm selection operation' with 'No'");
625 }
else if (answer == 4) {
626 WRITE_DEBUG(
"Closed FXMessageBox 'confirm selection operation' with 'ESC'");
631 WRITE_DEBUG(
"Closed FXMessageBox 'confirm selection operation' with 'Yes'");
642 mySelectorFrameParent(selectorFrameParent),
668 for (
const auto& item :
myItems) {
680 if (obj == myParentsComboBox) {
681 for (
const auto& item : myItems) {
682 if (item.second == myParentsComboBox->getText().text()) {
684 mySelectParentsButton->enable();
685 myUnselectParentsButton->enable();
687 myParentsComboBox->setTextColor(FXRGB(0, 0, 0));
689 myCurrentSelectedParent = item.first;
694 myCurrentSelectedParent = Selection::NOTHING;
696 mySelectParentsButton->disable();
697 myUnselectParentsButton->disable();
698 myParentsComboBox->setTextColor(FXRGB(255, 0, 0));
700 }
else if (obj == myChildrenComboBox) {
701 for (
const auto& item : myItems) {
702 if (item.second == myChildrenComboBox->getText().text()) {
704 mySelectChildrenButton->enable();
705 myUnselectChildrenButton->enable();
707 myChildrenComboBox->setTextColor(FXRGB(0, 0, 0));
709 myCurrentSelectedChild = item.first;
714 myCurrentSelectedChild = Selection::NOTHING;
716 mySelectChildrenButton->disable();
717 myUnselectChildrenButton->disable();
718 myChildrenComboBox->setTextColor(FXRGB(255, 0, 0));
728 const auto selectedACs = mySelectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedAttributeCarriers(
true);
730 if ((selectedACs.size() > 0) && (myCurrentSelectedParent != Selection::NOTHING)) {
732 std::vector<GNEHierarchicalElement*> HEToSelect;
733 for (
const auto& selectedAC : selectedACs) {
735 const auto HE = selectedAC->getHierarchicalElement();
737 if ((myCurrentSelectedParent == Selection::ALL) || (myCurrentSelectedParent == Selection::JUNCTION)) {
738 HEToSelect.insert(HEToSelect.end(), HE->getParentJunctions().begin(), HE->getParentJunctions().end());
741 if ((myCurrentSelectedParent == Selection::ALL) || (myCurrentSelectedParent == Selection::EDGE)) {
742 if (selectedAC->getTagProperty().getTag() ==
SUMO_TAG_LANE) {
744 HEToSelect.push_back(
dynamic_cast<GNELane*
>(selectedAC)->getParentEdge());
746 HEToSelect.insert(HEToSelect.end(), HE->getParentEdges().begin(), HE->getParentEdges().end());
750 if ((myCurrentSelectedParent == Selection::ALL) || (myCurrentSelectedParent == Selection::LANE)) {
751 HEToSelect.insert(HEToSelect.end(), HE->getParentLanes().begin(), HE->getParentLanes().end());
754 if ((myCurrentSelectedParent == Selection::ALL) || (myCurrentSelectedParent == Selection::ADDITIONAL)) {
755 HEToSelect.insert(HEToSelect.end(), HE->getParentAdditionals().begin(), HE->getParentAdditionals().end());
758 if ((myCurrentSelectedParent == Selection::ALL) || (myCurrentSelectedParent == Selection::WIRE)) {
759 HEToSelect.insert(HEToSelect.end(), HE->getParentAdditionals().begin(), HE->getParentAdditionals().end());
762 if ((myCurrentSelectedParent == Selection::ALL) || (myCurrentSelectedParent == Selection::DEMAND)) {
763 HEToSelect.insert(HEToSelect.end(), HE->getParentDemandElements().begin(), HE->getParentDemandElements().end());
766 if ((myCurrentSelectedParent == Selection::ALL) || (myCurrentSelectedParent == Selection::DATA)) {
767 HEToSelect.insert(HEToSelect.end(), HE->getParentGenericDatas().begin(), HE->getParentGenericDatas().end());
771 if (HEToSelect.size() > 0) {
772 if (HEToSelect.size() > 1) {
773 mySelectorFrameParent->getViewNet()->getUndoList()->begin(
GUIIcon::SELECT,
TL(
"select parents"));
775 for (
const auto& HE : HEToSelect) {
776 if (obj == mySelectParentsButton) {
777 HE->setAttribute(
GNE_ATTR_SELECTED,
"true", mySelectorFrameParent->getViewNet()->getUndoList());
779 HE->setAttribute(
GNE_ATTR_SELECTED,
"false", mySelectorFrameParent->getViewNet()->getUndoList());
782 if (HEToSelect.size() > 1) {
783 mySelectorFrameParent->getViewNet()->getUndoList()->end();
787 mySelectorFrameParent->mySelectionInformation->updateInformationLabel();
789 mySelectorFrameParent->getViewNet()->update();
798 const auto selectedACs = mySelectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedAttributeCarriers(
true);
800 if ((selectedACs.size() > 0) && (myCurrentSelectedChild != Selection::NOTHING)) {
802 std::vector<GNEHierarchicalElement*> HEToSelect;
803 for (
const auto& selectedAC : selectedACs) {
805 const auto HE = selectedAC->getHierarchicalElement();
807 if ((myCurrentSelectedChild == Selection::ALL) || (myCurrentSelectedChild == Selection::JUNCTION)) {
810 const auto junction =
dynamic_cast<GNEJunction*
>(selectedAC);
812 HEToSelect.insert(HEToSelect.end(), junction->getGNEIncomingEdges().begin(), junction->getGNEIncomingEdges().end());
813 HEToSelect.insert(HEToSelect.end(), junction->getGNEOutgoingEdges().begin(), junction->getGNEOutgoingEdges().end());
815 HEToSelect.insert(HEToSelect.end(), HE->getChildJunctions().begin(), HE->getChildJunctions().end());
819 if ((myCurrentSelectedChild == Selection::ALL) || (myCurrentSelectedChild == Selection::EDGE)) {
820 if (selectedAC->getTagProperty().getTag() ==
SUMO_TAG_EDGE) {
822 const auto edge =
dynamic_cast<GNEEdge*
>(selectedAC);
824 HEToSelect.insert(HEToSelect.end(), edge->getLanes().begin(), edge->getLanes().end());
826 HEToSelect.insert(HEToSelect.end(), HE->getChildEdges().begin(), HE->getChildEdges().end());
830 if ((myCurrentSelectedChild == Selection::ALL) || (myCurrentSelectedChild == Selection::CONNECTION)) {
831 if (selectedAC->getTagProperty().getTag() ==
SUMO_TAG_EDGE) {
833 const auto edge =
dynamic_cast<GNEEdge*
>(selectedAC);
835 HEToSelect.insert(HEToSelect.end(), edge->getGNEConnections().begin(), edge->getGNEConnections().end());
836 }
else if (selectedAC->getTagProperty().getTag() ==
SUMO_TAG_LANE) {
838 const auto lane =
dynamic_cast<GNELane*
>(selectedAC);
840 for (
const auto& connection : lane->getParentEdge()->getGNEConnections()) {
842 HEToSelect.push_back(connection);
847 const auto junction =
dynamic_cast<GNEJunction*
>(selectedAC);
851 HEToSelect.insert(HEToSelect.end(), connections.begin(), connections.end());
855 if ((myCurrentSelectedChild == Selection::ALL) || (myCurrentSelectedChild == Selection::CROSSING)) {
858 const auto junction =
dynamic_cast<GNEJunction*
>(selectedAC);
860 HEToSelect.insert(HEToSelect.end(), junction->getGNECrossings().begin(), junction->getGNECrossings().end());
864 if ((myCurrentSelectedChild == Selection::ALL) || (myCurrentSelectedChild == Selection::LANE)) {
865 HEToSelect.insert(HEToSelect.end(), HE->getChildLanes().begin(), HE->getChildLanes().end());
868 if ((myCurrentSelectedChild == Selection::ALL) || (myCurrentSelectedChild == Selection::ADDITIONAL)) {
870 for (
const auto& additionalChild : HE->getChildAdditionals()) {
871 if (!additionalChild->getTagProperty().isWireElement() && !additionalChild->getTagProperty().isSymbol()) {
872 HEToSelect.push_back(additionalChild);
877 if ((myCurrentSelectedChild == Selection::ALL) || (myCurrentSelectedChild == Selection::WIRE)) {
879 for (
const auto& wireChild : HE->getChildAdditionals()) {
880 if (wireChild->getTagProperty().isWireElement() && !wireChild->getTagProperty().isSymbol()) {
881 HEToSelect.push_back(wireChild);
886 if ((myCurrentSelectedChild == Selection::ALL) || (myCurrentSelectedChild == Selection::DEMAND)) {
887 HEToSelect.insert(HEToSelect.end(), HE->getChildDemandElements().begin(), HE->getChildDemandElements().end());
890 if ((myCurrentSelectedChild == Selection::ALL) || (myCurrentSelectedChild == Selection::DATA)) {
891 HEToSelect.insert(HEToSelect.end(), HE->getChildGenericDatas().begin(), HE->getChildGenericDatas().end());
895 if (HEToSelect.size() > 0) {
896 if (HEToSelect.size() > 1) {
897 mySelectorFrameParent->getViewNet()->getUndoList()->begin(
GUIIcon::SELECT,
TL(
"select children"));
899 for (
const auto& HE : HEToSelect) {
900 if (obj == mySelectChildrenButton) {
903 HE->setAttribute(
GNE_ATTR_SELECTED,
"false", mySelectorFrameParent->getViewNet()->getUndoList());
906 if (HEToSelect.size() > 1) {
907 mySelectorFrameParent->getViewNet()->getUndoList()->end();
911 mySelectorFrameParent->mySelectionInformation->updateInformationLabel();
913 mySelectorFrameParent->getViewNet()->update();
936 GNEFrame(viewParent, viewNet,
TL(
"Selection")) {
1010 if (AC ==
nullptr) {
1018 if ((AC->getTagProperty().isNetworkElement() || AC->getTagProperty().isAdditionalElement()) &&
1031 if (filteredGLObjects.size() > 1) {
1035 if (AC->isAttributeCarrierSelected()) {
1036 AC->unselectAttributeCarrier();
1038 AC->selectAttributeCarrier();
1052 std::set<std::pair<std::string, GNEAttributeCarrier*> > ACsToSelect, ACsToUnselect;
1058 for (
const auto& selectedAC : selectedACs) {
1059 ACsToUnselect.insert(std::make_pair(selectedAC->getID(), selectedAC));
1063 for (
const auto& AC : ACs) {
1065 switch (setOperation) {
1067 ACsToUnselect.insert(std::make_pair(AC->getID(), AC));
1070 if (ACsToUnselect.find(std::make_pair(AC->getID(), AC)) != ACsToUnselect.end()) {
1071 ACsToSelect.insert(std::make_pair(AC->getID(), AC));
1075 ACsToSelect.insert(std::make_pair(AC->getID(), AC));
1081 std::set<GNEEdge*> edgesToSelect;
1083 for (
const auto& AC : ACsToSelect) {
1084 if (AC.second->getTagProperty().getTag() ==
SUMO_TAG_EDGE) {
1089 for (
const auto& edgeToSelect : edgesToSelect) {
1091 ACsToSelect.insert(std::make_pair(edgeToSelect->getFromJunction()->getID(), edgeToSelect->getFromJunction()));
1092 for (
const auto& connectionToSelect : edgeToSelect->getFromJunction()->getGNEConnections()) {
1093 ACsToSelect.insert(std::make_pair(connectionToSelect->getID(), connectionToSelect));
1095 for (
const auto& fromCrossingToSelect : edgeToSelect->getFromJunction()->getGNECrossings()) {
1096 ACsToSelect.insert(std::make_pair(fromCrossingToSelect->getID(), fromCrossingToSelect));
1098 for (
const auto& fromWalkingAreaToSelect : edgeToSelect->getFromJunction()->getGNEWalkingAreas()) {
1099 ACsToSelect.insert(std::make_pair(fromWalkingAreaToSelect->getID(), fromWalkingAreaToSelect));
1102 ACsToSelect.insert(std::make_pair(edgeToSelect->getToJunction()->getID(), edgeToSelect->getToJunction()));
1103 for (
const auto& connectionToSelect : edgeToSelect->getToJunction()->getGNEConnections()) {
1104 ACsToSelect.insert(std::make_pair(connectionToSelect->getID(), connectionToSelect));
1106 for (
const auto& toCrossingToSelect : edgeToSelect->getToJunction()->getGNECrossings()) {
1107 ACsToSelect.insert(std::make_pair(toCrossingToSelect->getID(), toCrossingToSelect));
1109 for (
const auto& toWalkingAreaToSelect : edgeToSelect->getToJunction()->getGNEWalkingAreas()) {
1110 ACsToSelect.insert(std::make_pair(toWalkingAreaToSelect->getID(), toWalkingAreaToSelect));
1115 if ((ACsToSelect.size() + ACsToUnselect.size()) > 0) {
1118 for (
const auto& ACToUnselect : ACsToUnselect) {
1119 if (ACToUnselect.second->getTagProperty().isSelectable()) {
1123 for (
const auto& ACToSelect : ACsToSelect) {
1124 if (ACToSelect.second->getTagProperty().isSelectable()) {
1134 std::vector<GNEAttributeCarrier*>
1136 std::vector<GNEAttributeCarrier*> result;
1142 for (
const auto& AC : allACbyTag) {
1143 if (expr ==
"" && compOp ==
'@') {
1144 result.push_back(AC);
1145 }
else if (tagValue.hasAttribute(ACAttr) && tagValue.getAttributeProperties(ACAttr).isNumerical()) {
1147 std::istringstream buf(AC->getAttribute(ACAttr));
1152 result.push_back(AC);
1157 result.push_back(AC);
1162 result.push_back(AC);
1168 std::string acVal = AC->getAttributeForSelection(ACAttr);
1171 if (acVal.find(expr) != std::string::npos) {
1172 result.push_back(AC);
1176 if (acVal.find(expr) == std::string::npos) {
1177 result.push_back(AC);
1181 if (acVal == expr) {
1182 result.push_back(AC);
1186 if (acVal != expr) {
1187 result.push_back(AC);
1197 std::vector<GNEAttributeCarrier*>
1199 std::vector<GNEAttributeCarrier*> result;
1201 for (
const auto& genericData : genericDatas) {
1202 if (expr ==
"" && compOp ==
'@') {
1203 result.push_back(genericData);
1206 std::istringstream buf(genericData->getParameter(attr,
"0"));
1211 result.push_back(genericData);
1216 result.push_back(genericData);
1221 result.push_back(genericData);
1227 std::string acVal = genericData->getAttributeForSelection(
GNE_ATTR_PARENT);
1230 if (acVal.find(expr) != std::string::npos) {
1231 result.push_back(genericData);
1235 if (acVal.find(expr) == std::string::npos) {
1236 result.push_back(genericData);
1240 if (acVal == expr) {
1241 result.push_back(genericData);
1245 if (acVal != expr) {
1246 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_REDUCE
simplify network reduction
@ 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 GUIDesignComboBoxVisibleItemsMedium
combo box medium small
#define GUIDesignLabelThick(justify)
label extended over frame with thick and with text justify to left
#define GUIDesignRadioButton
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
FXString gCurrentFolder
The folder used as last.
#define WRITE_ERRORF(...)
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_VEHICLE
description of a vehicle
@ SUMO_TAG_JUNCTION
begin/end of the description of a junction
@ SUMO_TAG_LANE
begin/end of the description of a single lane
@ 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)
const std::string getID() const
get ID (all Attribute Carriers have one)
virtual GUIGlObject * getGUIGlObject()=0
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
bool isTemplate() const
check if this AC is template
A road/street connecting two junctions (netedit-version)
void hideElementSet()
hide element set
void showElementSet()
show element set
GNEViewNet * myViewNet
FOX need this.
FXVerticalFrame * myContentFrame
Vertical frame that holds all widgets of frame.
virtual void show()
show Frame
virtual void hide()
hide Frame
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
std::vector< GNEConnection * > getGNEConnections() const
Returns all GNEConnections vinculated with this junction.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
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
SelectionHierarchy(GNESelectorFrame *selectorFrameParent)
FOX-declaration.
MFXComboBoxIcon * myChildrenComboBox
comboBox for children
~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
MFXComboBoxIcon * myParentsComboBox
comboBox for parents
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 askContinueIfLock() const
ask if continue due locking
long onCmdDelete(FXObject *, FXSelector, void *)
Called when the user presses the delete-button.
long onCmdReduce(FXObject *, FXSelector, void *)
Called when the user presses the Reduce-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.
std::pair< std::vector< std::pair< bool, GNEAttributeCarrier * > >, std::vector< std::pair< bool, GNEAttributeCarrier * > > > processMassiveNetworkElementSelection(const bool filterLanes)
FOX need this.
std::pair< std::vector< std::pair< bool, GNEAttributeCarrier * > >, std::vector< std::pair< bool, GNEAttributeCarrier * > > > processMassiveDataElementSelection()
process massive dataelement selection
std::pair< std::vector< std::pair< bool, GNEAttributeCarrier * > >, std::vector< std::pair< bool, GNEAttributeCarrier * > > > processMassiveDemandElementSelection()
process massive demand element selection
void loadFromFile(const std::string &file) const
load from file
~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
ModificationMode * getModificationModeModul() const
get modification mode modul
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
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
GNESelectorFrame::SelectionOperation * getSelectionOperationModul() const
get selection operation modul
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,
GNESelectorFrame(GNEViewParent *viewParent, GNEViewNet *viewNet)
Constructor.
SelectionInformation * getSelectionInformation() const
get modul for selection information
bool selectAttributeCarrier(const GNEViewNetHelper::ViewObjectsSelector &viewObjects)
select attribute carrier (element)
bool isDataElement() const
return true if tag correspond to a data element
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...
bool isObjectLocked(GUIGlObjectType objectType, const bool selected) const
check if given GLObject is locked for inspect, select, delete and move
class used to group all variables related with objects under cursor after a click over view
GNEAttributeCarrier * getAttributeCarrierFront() const
get front attribute carrier or a pointer to nullptr
const std::vector< GUIGlObject * > & getGLObjects() const
get vector with GL objects
GNENet * getNet() const
get the net object
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
void openSelectDialogAtCursor(const std::vector< GUIGlObject * > &GLObjects)
open select dialog at cursor
bool autoSelectNodes()
whether to autoselect nodes or to lanes
GNEUndoList * getUndoList() const
get the undoList object
GNEViewNetHelper::LockManager & getLockManager()
get lock manager
A single child window which contains a view of the simulation area.
static FXButton * buildFXButton(FXComposite *p, const std::string &text, const std::string &tip, const std::string &help, FXIcon *ic, FXObject *tgt, FXSelector sel, FXuint opts=BUTTON_NORMAL, FXint x=0, FXint y=0, FXint w=0, FXint h=0, FXint pl=DEFAULT_PAD, FXint pr=DEFAULT_PAD, FXint pt=DEFAULT_PAD, FXint pb=DEFAULT_PAD)
build button
static FXRadioButton * buildFXRadioButton(FXComposite *p, const std::string &text, const std::string &tip, const std::string &help, FXObject *tgt, FXSelector sel, FXuint opts=RADIOBUTTON_NORMAL, FXint x=0, FXint y=0, FXint w=0, FXint h=0, FXint pl=DEFAULT_PAD, FXint pr=DEFAULT_PAD, FXint pt=DEFAULT_PAD, FXint pb=DEFAULT_PAD)
build radio button
static StringBijection< GUIGlObjectType > TypeNames
associates object types with strings
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
const std::vector< GUIGlObject * > & getAllGLObjects() const
Returns the set of all known objects.
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
FXint appendIconItem(const FXString &text, FXIcon *icon=nullptr, FXColor bgColor=FXRGB(255, 255, 255), void *ptr=nullptr)
append icon item in the last position
A list item which allows for custom coloring.
MFXGroupBoxModule (based on FXGroupBox)
FXVerticalFrame * getCollapsableFrame()
get collapsable frame (used by all elements that will be collapsed if button is toggled)
void setText(const std::string &text)
set text
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, bool usePrefix=true)
Returns the described OutputDevice.
const std::string & getString(const T key) const
static std::string replace(std::string str, const std::string &what, const std::string &by)
Replaces all occurrences of the second string by the third string within the first string.
static bool startsWith(const std::string &str, const std::string prefix)
Checks whether a given string starts with the prefix.
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
static std::vector< GUIGlObject * > filterElementsByLayer(const std::vector< GUIGlObject * > &GLObjects)
filter elements based on the layer