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();
327 FXFileDialog opendialog(getCollapsableFrame(),
TL(
"Open List of Selected Items"));
329 opendialog.setSelectMode(SELECTFILE_EXISTING);
330 opendialog.setPatternList(
"Selection files (*.txt)\nAll files (*)");
334 if (opendialog.execute()) {
336 loadFromFile(opendialog.getFilename().text());
345 TL(
"Save List of selected Items"),
".txt",
353 const auto selectedACs = mySelectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->getSelectedAttributeCarriers(
false);
354 for (
const auto& selectedAC : selectedACs) {
363 WRITE_DEBUG(
"Opening FXMessageBox 'error storing selection'");
365 FXMessageBox::error(getCollapsableFrame(), MBOX_OK,
"Storing Selection failed",
"%s", e.what());
367 WRITE_DEBUG(
"Closed FXMessageBox 'error storing selection' with 'OK'");
376 GNEUndoList* undoList = mySelectorFrameParent->myViewNet->getUndoList();
378 std::pair<std::vector<std::pair<bool, GNEAttributeCarrier*> >, std::vector<std::pair<bool, GNEAttributeCarrier*> > > ACsToSelectUnselect;
379 if (mySelectorFrameParent->myViewNet->getEditModes().isCurrentSupermodeNetwork()) {
380 ACsToSelectUnselect = processMassiveNetworkElementSelection(
false);
381 }
else if (mySelectorFrameParent->myViewNet->getEditModes().isCurrentSupermodeDemand()) {
382 ACsToSelectUnselect = processMassiveDemandElementSelection();
383 }
else if (mySelectorFrameParent->myViewNet->getEditModes().isCurrentSupermodeData()) {
384 ACsToSelectUnselect = processMassiveDataElementSelection();
387 if (ACsToSelectUnselect.second.size() > 0) {
389 bool askedContinueIfLock =
false;
390 bool addLockedElements =
false;
391 bool unlockedElements =
false;
392 for (
const auto& AC : ACsToSelectUnselect.second) {
393 if (AC.first ==
false) {
395 unlockedElements =
true;
396 }
else if (!askedContinueIfLock) {
397 addLockedElements = askContinueIfLock();
399 askedContinueIfLock =
true;
402 if (unlockedElements || addLockedElements) {
404 for (
const auto& AC : ACsToSelectUnselect.second) {
405 if (addLockedElements || !AC.first) {
409 mySelectorFrameParent->myViewNet->getUndoList()->end();
418 mySelectorFrameParent->getViewNet()->hotkeyDel();
426 GNEUndoList* undoList = mySelectorFrameParent->myViewNet->getUndoList();
428 std::pair<std::vector<std::pair<bool, GNEAttributeCarrier*> >, std::vector<std::pair<bool, GNEAttributeCarrier*> > > ACsToSelectUnselect;
429 if (mySelectorFrameParent->myViewNet->getEditModes().isCurrentSupermodeNetwork()) {
430 ACsToSelectUnselect = processMassiveNetworkElementSelection(
true);
431 }
else if (mySelectorFrameParent->myViewNet->getEditModes().isCurrentSupermodeDemand()) {
432 ACsToSelectUnselect = processMassiveDemandElementSelection();
433 }
else if (mySelectorFrameParent->myViewNet->getEditModes().isCurrentSupermodeData()) {
434 ACsToSelectUnselect = processMassiveDataElementSelection();
437 if ((ACsToSelectUnselect.first.size() + ACsToSelectUnselect.second.size()) > 0) {
439 bool askedContinueIfLock =
false;
440 bool addLockedElements =
false;
441 bool unlockedElements =
false;
442 for (
const auto& AC : ACsToSelectUnselect.first) {
443 if (AC.first ==
false) {
445 unlockedElements =
true;
446 }
else if (!askedContinueIfLock) {
447 addLockedElements = askContinueIfLock();
449 askedContinueIfLock =
true;
452 for (
const auto& AC : ACsToSelectUnselect.second) {
453 if (AC.first ==
false) {
455 unlockedElements =
true;
456 }
else if (!askedContinueIfLock) {
457 addLockedElements = askContinueIfLock();
459 askedContinueIfLock =
true;
462 if (unlockedElements || addLockedElements) {
464 for (
const auto& AC : ACsToSelectUnselect.first) {
465 if (addLockedElements || !AC.first) {
469 for (
const auto& AC : ACsToSelectUnselect.second) {
470 if (addLockedElements || !AC.first) {
474 mySelectorFrameParent->myViewNet->getUndoList()->end();
486 onCmdInvert(0, 0, 0);
487 onCmdDelete(0, 0, 0);
489 mySelectorFrameParent->getViewNet()->getUndoList()->end();
494std::pair<std::vector<std::pair<bool, GNEAttributeCarrier*> >, std::vector<std::pair<bool, GNEAttributeCarrier*> > >
497 const auto& ACs = mySelectorFrameParent->myViewNet->getNet()->getAttributeCarriers();
499 std::vector<GNEAttributeCarrier*> networkACs;
501 for (
const auto& junction : ACs->getJunctions()) {
502 networkACs.push_back(junction.second);
504 for (
const auto& incomingEdge : junction.second->getGNEIncomingEdges()) {
505 if (!filterLanes || mySelectorFrameParent->getViewNet()->getNetworkViewOptions().selectEdges()) {
506 networkACs.push_back(incomingEdge);
509 if (!filterLanes || !mySelectorFrameParent->getViewNet()->getNetworkViewOptions().selectEdges()) {
510 for (
const auto& lane : incomingEdge->getLanes()) {
511 networkACs.push_back(lane);
515 for (
const auto& connection : incomingEdge->getGNEConnections()) {
516 networkACs.push_back(connection);
520 for (
const auto& crossing : junction.second->getGNECrossings()) {
521 networkACs.push_back(crossing);
524 for (
const auto& walkingArea : junction.second->getGNEWalkingAreas()) {
525 networkACs.push_back(walkingArea);
529 for (
const auto& additionalTags : ACs->getAdditionals()) {
530 for (
const auto& additional : additionalTags.second) {
531 if (additional.second->getTagProperty().isSelectable()) {
532 networkACs.push_back(additional.second);
537 std::map<GUIGlObjectType, bool> checkedTypes;
539 std::pair<std::vector<std::pair<bool, GNEAttributeCarrier*> >, std::vector<std::pair<bool, GNEAttributeCarrier*> > > ACsToSelectUnselect;
541 for (
const auto& networkAC : networkACs) {
542 const auto networkACObjectType = networkAC->getGUIGlObject()->getType();
544 if (checkedTypes.find(networkACObjectType) == checkedTypes.end()) {
545 checkedTypes[networkACObjectType] = networkAC->getGUIGlObject()->isGLObjectLocked();
548 if (networkAC->isAttributeCarrierSelected()) {
549 ACsToSelectUnselect.second.push_back(std::make_pair(checkedTypes.at(networkACObjectType), networkAC));
551 ACsToSelectUnselect.first.push_back(std::make_pair(checkedTypes.at(networkACObjectType), networkAC));
554 return ACsToSelectUnselect;
558std::pair<std::vector<std::pair<bool, GNEAttributeCarrier*> >, std::vector<std::pair<bool, GNEAttributeCarrier*> > >
561 std::map<GUIGlObjectType, bool> checkedTypes;
563 std::pair<std::vector<std::pair<bool, GNEAttributeCarrier*> >, std::vector<std::pair<bool, GNEAttributeCarrier*> > > ACsToSelectUnselect;
565 for (
const auto& demandElementTag : mySelectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->getDemandElements()) {
566 for (
const auto& demandElement : demandElementTag.second) {
567 if (demandElement.second->getTagProperty().isSelectable()) {
568 const auto networkACObjectType = demandElement.first->getType();
570 if (checkedTypes.find(networkACObjectType) == checkedTypes.end()) {
571 checkedTypes[networkACObjectType] = demandElement.first->isGLObjectLocked();
574 if (demandElement.second->isAttributeCarrierSelected()) {
575 ACsToSelectUnselect.second.push_back(std::make_pair(checkedTypes.at(networkACObjectType), demandElement.second));
577 ACsToSelectUnselect.first.push_back(std::make_pair(checkedTypes.at(networkACObjectType), demandElement.second));
582 return ACsToSelectUnselect;
586std::pair<std::vector<std::pair<bool, GNEAttributeCarrier*> >, std::vector<std::pair<bool, GNEAttributeCarrier*> > >
589 std::map<GUIGlObjectType, bool> checkedTypes;
591 std::pair<std::vector<std::pair<bool, GNEAttributeCarrier*> >, std::vector<std::pair<bool, GNEAttributeCarrier*> > > ACsToSelectUnselect;
593 for (
const auto& genericDataTag : mySelectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->getGenericDatas()) {
594 for (
const auto& genericData : genericDataTag.second) {
595 if (genericData.second->getTagProperty().isSelectable()) {
596 const auto networkACObjectType = genericData.first->getType();
598 if (checkedTypes.find(networkACObjectType) == checkedTypes.end()) {
599 checkedTypes[networkACObjectType] = genericData.first->isGLObjectLocked();
602 if (genericData.second->isAttributeCarrierSelected()) {
603 ACsToSelectUnselect.second.push_back(std::make_pair(checkedTypes.at(networkACObjectType), genericData.second));
605 ACsToSelectUnselect.first.push_back(std::make_pair(checkedTypes.at(networkACObjectType), genericData.second));
610 return ACsToSelectUnselect;
616 WRITE_DEBUG(
"Opening FXMessageBox 'confirm selection operation'");
618 const FXuint answer = FXMessageBox::question(mySelectorFrameParent->getViewNet()->getApp(),
619 MBOX_YES_NO,
"Confirm selection operation",
"There are locked elements in the current selection.\nApply operation to locked elements?");
623 WRITE_DEBUG(
"Closed FXMessageBox 'confirm selection operation' with 'No'");
624 }
else if (answer == 4) {
625 WRITE_DEBUG(
"Closed FXMessageBox 'confirm selection operation' with 'ESC'");
630 WRITE_DEBUG(
"Closed FXMessageBox 'confirm selection operation' with 'Yes'");
641 mySelectorFrameParent(selectorFrameParent),
667 for (
const auto& item :
myItems) {
679 if (obj == myParentsComboBox) {
680 for (
const auto& item : myItems) {
681 if (item.second == myParentsComboBox->getText().text()) {
683 mySelectParentsButton->enable();
684 myUnselectParentsButton->enable();
686 myParentsComboBox->setTextColor(FXRGB(0, 0, 0));
688 myCurrentSelectedParent = item.first;
693 myCurrentSelectedParent = Selection::NOTHING;
695 mySelectParentsButton->disable();
696 myUnselectParentsButton->disable();
697 myParentsComboBox->setTextColor(FXRGB(255, 0, 0));
699 }
else if (obj == myChildrenComboBox) {
700 for (
const auto& item : myItems) {
701 if (item.second == myChildrenComboBox->getText().text()) {
703 mySelectChildrenButton->enable();
704 myUnselectChildrenButton->enable();
706 myChildrenComboBox->setTextColor(FXRGB(0, 0, 0));
708 myCurrentSelectedChild = item.first;
713 myCurrentSelectedChild = Selection::NOTHING;
715 mySelectChildrenButton->disable();
716 myUnselectChildrenButton->disable();
717 myChildrenComboBox->setTextColor(FXRGB(255, 0, 0));
727 const auto selectedACs = mySelectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedAttributeCarriers(
true);
729 if ((selectedACs.size() > 0) && (myCurrentSelectedParent != Selection::NOTHING)) {
731 std::vector<GNEHierarchicalElement*> HEToSelect;
732 for (
const auto& selectedAC : selectedACs) {
734 const auto HE = selectedAC->getHierarchicalElement();
736 if ((myCurrentSelectedParent == Selection::ALL) || (myCurrentSelectedParent == Selection::JUNCTION)) {
737 HEToSelect.insert(HEToSelect.end(), HE->getParentJunctions().begin(), HE->getParentJunctions().end());
740 if ((myCurrentSelectedParent == Selection::ALL) || (myCurrentSelectedParent == Selection::EDGE)) {
741 if (selectedAC->getTagProperty().getTag() ==
SUMO_TAG_LANE) {
745 HEToSelect.insert(HEToSelect.end(), HE->getParentEdges().begin(), HE->getParentEdges().end());
749 if ((myCurrentSelectedParent == Selection::ALL) || (myCurrentSelectedParent == Selection::LANE)) {
750 HEToSelect.insert(HEToSelect.end(), HE->getParentLanes().begin(), HE->getParentLanes().end());
753 if ((myCurrentSelectedParent == Selection::ALL) || (myCurrentSelectedParent == Selection::ADDITIONAL)) {
754 HEToSelect.insert(HEToSelect.end(), HE->getParentAdditionals().begin(), HE->getParentAdditionals().end());
757 if ((myCurrentSelectedParent == Selection::ALL) || (myCurrentSelectedParent == Selection::WIRE)) {
758 HEToSelect.insert(HEToSelect.end(), HE->getParentAdditionals().begin(), HE->getParentAdditionals().end());
761 if ((myCurrentSelectedParent == Selection::ALL) || (myCurrentSelectedParent == Selection::DEMAND)) {
762 HEToSelect.insert(HEToSelect.end(), HE->getParentDemandElements().begin(), HE->getParentDemandElements().end());
765 if ((myCurrentSelectedParent == Selection::ALL) || (myCurrentSelectedParent == Selection::DATA)) {
766 HEToSelect.insert(HEToSelect.end(), HE->getParentGenericDatas().begin(), HE->getParentGenericDatas().end());
770 if (HEToSelect.size() > 0) {
771 if (HEToSelect.size() > 1) {
772 mySelectorFrameParent->getViewNet()->getUndoList()->begin(
GUIIcon::SELECT,
TL(
"select parents"));
774 for (
const auto& HE : HEToSelect) {
775 if (obj == mySelectParentsButton) {
776 HE->setAttribute(
GNE_ATTR_SELECTED,
"true", mySelectorFrameParent->getViewNet()->getUndoList());
778 HE->setAttribute(
GNE_ATTR_SELECTED,
"false", mySelectorFrameParent->getViewNet()->getUndoList());
781 if (HEToSelect.size() > 1) {
782 mySelectorFrameParent->getViewNet()->getUndoList()->end();
786 mySelectorFrameParent->mySelectionInformation->updateInformationLabel();
788 mySelectorFrameParent->getViewNet()->update();
797 const auto selectedACs = mySelectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedAttributeCarriers(
true);
799 if ((selectedACs.size() > 0) && (myCurrentSelectedChild != Selection::NOTHING)) {
801 std::vector<GNEHierarchicalElement*> HEToSelect;
802 for (
const auto& selectedAC : selectedACs) {
804 const auto HE = selectedAC->getHierarchicalElement();
806 if ((myCurrentSelectedChild == Selection::ALL) || (myCurrentSelectedChild == Selection::JUNCTION)) {
809 const auto junction =
dynamic_cast<GNEJunction*
>(selectedAC);
811 HEToSelect.insert(HEToSelect.end(), junction->getGNEIncomingEdges().begin(), junction->getGNEIncomingEdges().end());
812 HEToSelect.insert(HEToSelect.end(), junction->getGNEOutgoingEdges().begin(), junction->getGNEOutgoingEdges().end());
814 HEToSelect.insert(HEToSelect.end(), HE->getChildJunctions().begin(), HE->getChildJunctions().end());
818 if ((myCurrentSelectedChild == Selection::ALL) || (myCurrentSelectedChild == Selection::EDGE)) {
819 if (selectedAC->getTagProperty().getTag() ==
SUMO_TAG_EDGE) {
821 const auto edge =
dynamic_cast<GNEEdge*
>(selectedAC);
823 HEToSelect.insert(HEToSelect.end(), edge->getLanes().begin(), edge->getLanes().end());
825 HEToSelect.insert(HEToSelect.end(), HE->getChildEdges().begin(), HE->getChildEdges().end());
829 if ((myCurrentSelectedChild == Selection::ALL) || (myCurrentSelectedChild == Selection::CONNECTION)) {
830 if (selectedAC->getTagProperty().getTag() ==
SUMO_TAG_EDGE) {
832 const auto edge =
dynamic_cast<GNEEdge*
>(selectedAC);
834 HEToSelect.insert(HEToSelect.end(), edge->getGNEConnections().begin(), edge->getGNEConnections().end());
835 }
else if (selectedAC->getTagProperty().getTag() ==
SUMO_TAG_LANE) {
837 const auto lane =
dynamic_cast<GNELane*
>(selectedAC);
839 for (
const auto& connection : lane->getParentEdge()->getGNEConnections()) {
841 HEToSelect.push_back(connection);
846 const auto junction =
dynamic_cast<GNEJunction*
>(selectedAC);
850 HEToSelect.insert(HEToSelect.end(), connections.begin(), connections.end());
854 if ((myCurrentSelectedChild == Selection::ALL) || (myCurrentSelectedChild == Selection::CROSSING)) {
857 const auto junction =
dynamic_cast<GNEJunction*
>(selectedAC);
859 HEToSelect.insert(HEToSelect.end(), junction->getGNECrossings().begin(), junction->getGNECrossings().end());
863 if ((myCurrentSelectedChild == Selection::ALL) || (myCurrentSelectedChild == Selection::LANE)) {
864 HEToSelect.insert(HEToSelect.end(), HE->getChildLanes().begin(), HE->getChildLanes().end());
867 if ((myCurrentSelectedChild == Selection::ALL) || (myCurrentSelectedChild == Selection::ADDITIONAL)) {
869 for (
const auto& additionalChild : HE->getChildAdditionals()) {
870 if (!additionalChild->getTagProperty().isWireElement() && !additionalChild->getTagProperty().isSymbol()) {
871 HEToSelect.push_back(additionalChild);
876 if ((myCurrentSelectedChild == Selection::ALL) || (myCurrentSelectedChild == Selection::WIRE)) {
878 for (
const auto& wireChild : HE->getChildAdditionals()) {
879 if (wireChild->getTagProperty().isWireElement() && !wireChild->getTagProperty().isSymbol()) {
880 HEToSelect.push_back(wireChild);
885 if ((myCurrentSelectedChild == Selection::ALL) || (myCurrentSelectedChild == Selection::DEMAND)) {
886 HEToSelect.insert(HEToSelect.end(), HE->getChildDemandElements().begin(), HE->getChildDemandElements().end());
889 if ((myCurrentSelectedChild == Selection::ALL) || (myCurrentSelectedChild == Selection::DATA)) {
890 HEToSelect.insert(HEToSelect.end(), HE->getChildGenericDatas().begin(), HE->getChildGenericDatas().end());
894 if (HEToSelect.size() > 0) {
895 if (HEToSelect.size() > 1) {
896 mySelectorFrameParent->getViewNet()->getUndoList()->begin(
GUIIcon::SELECT,
TL(
"select children"));
898 for (
const auto& HE : HEToSelect) {
899 if (obj == mySelectChildrenButton) {
902 HE->setAttribute(
GNE_ATTR_SELECTED,
"false", mySelectorFrameParent->getViewNet()->getUndoList());
905 if (HEToSelect.size() > 1) {
906 mySelectorFrameParent->getViewNet()->getUndoList()->end();
910 mySelectorFrameParent->mySelectionInformation->updateInformationLabel();
912 mySelectorFrameParent->getViewNet()->update();
935 GNEFrame(viewParent, viewNet,
TL(
"Selection")) {
1009 if (AC ==
nullptr) {
1017 if ((AC->getTagProperty().isNetworkElement() || AC->getTagProperty().isAdditionalElement()) &&
1030 if (filteredGLObjects.size() > 1) {
1034 if (AC->isAttributeCarrierSelected()) {
1035 AC->unselectAttributeCarrier();
1037 AC->selectAttributeCarrier();
1051 std::set<std::pair<std::string, GNEAttributeCarrier*> > ACsToSelect, ACsToUnselect;
1057 for (
const auto& selectedAC : selectedACs) {
1058 ACsToUnselect.insert(std::make_pair(selectedAC->getID(), selectedAC));
1062 for (
const auto& AC : ACs) {
1064 switch (setOperation) {
1066 ACsToUnselect.insert(std::make_pair(AC->getID(), AC));
1069 if (ACsToUnselect.find(std::make_pair(AC->getID(), AC)) != ACsToUnselect.end()) {
1070 ACsToSelect.insert(std::make_pair(AC->getID(), AC));
1074 ACsToSelect.insert(std::make_pair(AC->getID(), AC));
1080 std::set<GNEEdge*> edgesToSelect;
1082 for (
const auto& AC : ACsToSelect) {
1083 if (AC.second->getTagProperty().getTag() ==
SUMO_TAG_EDGE) {
1088 for (
const auto& edgeToSelect : edgesToSelect) {
1090 ACsToSelect.insert(std::make_pair(edgeToSelect->getFromJunction()->getID(), edgeToSelect->getFromJunction()));
1091 for (
const auto& connectionToSelect : edgeToSelect->getFromJunction()->getGNEConnections()) {
1092 ACsToSelect.insert(std::make_pair(connectionToSelect->getID(), connectionToSelect));
1094 for (
const auto& fromCrossingToSelect : edgeToSelect->getFromJunction()->getGNECrossings()) {
1095 ACsToSelect.insert(std::make_pair(fromCrossingToSelect->getID(), fromCrossingToSelect));
1097 for (
const auto& fromWalkingAreaToSelect : edgeToSelect->getFromJunction()->getGNEWalkingAreas()) {
1098 ACsToSelect.insert(std::make_pair(fromWalkingAreaToSelect->getID(), fromWalkingAreaToSelect));
1101 ACsToSelect.insert(std::make_pair(edgeToSelect->getToJunction()->getID(), edgeToSelect->getToJunction()));
1102 for (
const auto& connectionToSelect : edgeToSelect->getToJunction()->getGNEConnections()) {
1103 ACsToSelect.insert(std::make_pair(connectionToSelect->getID(), connectionToSelect));
1105 for (
const auto& toCrossingToSelect : edgeToSelect->getToJunction()->getGNECrossings()) {
1106 ACsToSelect.insert(std::make_pair(toCrossingToSelect->getID(), toCrossingToSelect));
1108 for (
const auto& toWalkingAreaToSelect : edgeToSelect->getToJunction()->getGNEWalkingAreas()) {
1109 ACsToSelect.insert(std::make_pair(toWalkingAreaToSelect->getID(), toWalkingAreaToSelect));
1114 if ((ACsToSelect.size() + ACsToUnselect.size()) > 0) {
1117 for (
const auto& ACToUnselect : ACsToUnselect) {
1118 if (ACToUnselect.second->getTagProperty().isSelectable()) {
1122 for (
const auto& ACToSelect : ACsToSelect) {
1123 if (ACToSelect.second->getTagProperty().isSelectable()) {
1133std::vector<GNEAttributeCarrier*>
1135 std::vector<GNEAttributeCarrier*> result;
1141 for (
const auto& AC : allACbyTag) {
1142 if (expr ==
"" && compOp ==
'@') {
1143 result.push_back(AC);
1144 }
else if (tagValue.hasAttribute(ACAttr) && tagValue.getAttributeProperties(ACAttr).isNumerical()) {
1146 std::istringstream buf(AC->getAttribute(ACAttr));
1151 result.push_back(AC);
1156 result.push_back(AC);
1161 result.push_back(AC);
1167 std::string acVal = AC->getAttributeForSelection(ACAttr);
1170 if (acVal.find(expr) != std::string::npos) {
1171 result.push_back(AC);
1175 if (acVal.find(expr) == std::string::npos) {
1176 result.push_back(AC);
1180 if (acVal == expr) {
1181 result.push_back(AC);
1185 if (acVal != expr) {
1186 result.push_back(AC);
1196std::vector<GNEAttributeCarrier*>
1198 std::vector<GNEAttributeCarrier*> result;
1200 for (
const auto& genericData : genericDatas) {
1201 if (expr ==
"" && compOp ==
'@') {
1202 result.push_back(genericData);
1205 std::istringstream buf(genericData->getParameter(attr,
"0"));
1210 result.push_back(genericData);
1215 result.push_back(genericData);
1220 result.push_back(genericData);
1226 std::string acVal = genericData->getAttributeForSelection(
GNE_ATTR_PARENT);
1229 if (acVal.find(expr) != std::string::npos) {
1230 result.push_back(genericData);
1234 if (acVal.find(expr) == std::string::npos) {
1235 result.push_back(genericData);
1239 if (acVal == expr) {
1240 result.push_back(genericData);
1244 if (acVal != expr) {
1245 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)
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
bool isTemplate() const
check if this AC is template
virtual GUIGlObject * getGUIGlObject()=0
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.
GNEEdge * getParentEdge() const
get parent edge
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