72 FXIMPLEMENT(
GNEInspectorFrame, FXVerticalFrame, GNEInspectorFrameMap, ARRAYNUMBER(GNEInspectorFrameMap))
84 GNEFrame(horizontalFrameParent, viewNet, "Inspector"),
85 myPreviousElementInspect(
nullptr),
86 myPreviousElementDelete(
nullptr) {
90 myHeaderLeftFrame->hide();
213 std::vector<GNEAttributeCarrier*> itemsToInspect;
220 for (
const auto& i : selectedACs) {
223 itemsToInspect.push_back(i);
227 itemsToInspect.push_back(AC);
248 if (ACs.size() > 0) {
250 std::string headerString;
251 if (ACs.front()->getTagProperty().isNetElement()) {
252 headerString =
"Net: ";
253 }
else if (ACs.front()->getTagProperty().isAdditional()) {
254 headerString =
"Additional: ";
255 }
else if (ACs.front()->getTagProperty().isShape()) {
256 headerString =
"Shape: ";
258 if (ACs.size() > 1) {
259 headerString +=
toString(ACs.size()) +
" ";
261 headerString += ACs.front()->getTagStr();
262 if (ACs.size() > 1) {
278 if (ACs.size() == 1) {
288 if (ACs.size() == 1) {
411 myInspectorFrameParent(inspectorFrameParent),
437 mySavedClickedPosition = clickedPosition;
441 myCurrentIndexButton->setText((
"1 / " +
toString(myOverlappedACs.size())).c_str());
443 myOverlappedElementList->clearItems();
448 myOverlappedElementList->getItem(0)->setSelected(TRUE);
450 myOverlappedElementList->hide();
471 return (mySavedClickedPosition.distanceSquaredTo2D(clickedPosition) < 0.25);
480 if (checkSavedPosition(clickedPosition)) {
482 onCmdNextElement(0, 0, 0);
498 if (checkSavedPosition(clickedPosition)) {
500 onCmdPreviousElement(0, 0, 0);
514 myOverlappedElementList->getItem((
int)myItemIndex)->setSelected(FALSE);
516 if (myItemIndex > 0) {
519 myItemIndex = (myOverlappedACs.size() - 1);
522 myOverlappedElementList->getItem((
int)myItemIndex)->setSelected(TRUE);
524 inspectOverlappedAttributeCarrier();
532 myOverlappedElementList->getItem((
int)myItemIndex)->setSelected(FALSE);
534 myItemIndex = (myItemIndex + 1) % myOverlappedACs.size();
536 myOverlappedElementList->getItem((
int)myItemIndex)->setSelected(TRUE);
538 inspectOverlappedAttributeCarrier();
546 if (myOverlappedElementList->shown()) {
547 myOverlappedElementList->hide();
549 myOverlappedElementList->show();
551 myOverlappedElementList->recalc();
559 for (
int i = 0; i < myOverlappedElementList->getNumItems(); i++) {
560 if (myOverlappedElementList->getItem(i)->isSelected()) {
563 inspectOverlappedAttributeCarrier();
573 FXDialogBox* helpDialog =
new FXDialogBox(
this,
"GEO attributes Help",
GUIDesignDialogBox);
574 std::ostringstream help;
576 <<
" - Click in the same position\n"
577 <<
" for inspect next element\n"
578 <<
" - Shift + Click in the same\n"
579 <<
" position for inspect\n"
580 <<
" previous element";
584 helpDialog->create();
596 myInspectorFrameParent->inspectSingleElement(&dynamic_cast<GNELane*>(AC)->getParentEdge());
598 myInspectorFrameParent->inspectSingleElement(AC);
603 myCurrentIndexButton->setText((
toString(myItemIndex + 1) +
" / " +
toString(myOverlappedACs.size())).c_str());
605 myInspectorFrameParent->getViewNet()->update();
614 myInspectorFrameParent(inspectorFrameParent) {
646 if (myInspectorFrameParent->myAttributesEditor->getEditedACs().size() > 0) {
648 myTextFieldAdditionalParent->enable();
649 myCheckBoxBlockMovement->enable();
650 myCheckBoxBlockShape->enable();
651 myCheckBoxCloseShape->enable();
653 const auto& tagValue = myInspectorFrameParent->myAttributesEditor->getEditedACs().front()->getTagProperty();
655 if (tagValue.canBlockMovement()) {
660 for (
const auto& i : myInspectorFrameParent->myAttributesEditor->getEditedACs()) {
664 myHorizontalFrameBlockMovement->show();
667 myCheckBoxBlockMovement->setCheck(
true);
668 myCheckBoxBlockMovement->setText(
"true");
670 myCheckBoxBlockMovement->setCheck(
false);
671 myCheckBoxBlockMovement->setText(
"false");
675 if (tagValue.canBlockShape()) {
680 for (
const auto& i : myInspectorFrameParent->myAttributesEditor->getEditedACs()) {
684 myHorizontalFrameBlockShape->show();
687 myCheckBoxBlockShape->setCheck(
true);
688 myCheckBoxBlockShape->setText(
"true");
690 myCheckBoxBlockShape->setCheck(
false);
691 myCheckBoxBlockShape->setText(
"false");
695 if (tagValue.canCloseShape()) {
700 for (
const auto& i : myInspectorFrameParent->myAttributesEditor->getEditedACs()) {
704 myHorizontalFrameCloseShape->show();
707 myCheckBoxCloseShape->setCheck(
true);
708 myCheckBoxCloseShape->setText(
"true");
710 myCheckBoxCloseShape->setCheck(
false);
711 myCheckBoxCloseShape->setText(
"false");
715 if (tagValue.hasParent() && tagValue.canBeReparent()) {
719 std::set<std::string> parents;
720 for (
const auto& i : myInspectorFrameParent->myAttributesEditor->getEditedACs()) {
724 myHorizontalFrameAdditionalParent->show();
726 myLabelAdditionalParent->setText((
toString(myInspectorFrameParent->myAttributesEditor->getEditedACs().front()->getTagProperty().getParentTag()) +
" parent").c_str());
727 myTextFieldAdditionalParent->setText(
toString(parents).c_str());
730 if (((myInspectorFrameParent->getViewNet()->getEditModes().currentSupermode ==
GNE_SUPERMODE_NETWORK) && myInspectorFrameParent->myAttributesEditor->getEditedACs().front()->getTagProperty().isDemandElement()) ||
731 ((myInspectorFrameParent->getViewNet()->getEditModes().currentSupermode ==
GNE_SUPERMODE_DEMAND) && !myInspectorFrameParent->myAttributesEditor->getEditedACs().front()->getTagProperty().isDemandElement())) {
732 myTextFieldAdditionalParent->disable();
733 myCheckBoxBlockMovement->disable();
734 myCheckBoxBlockShape->disable();
735 myCheckBoxCloseShape->disable();
744 myHorizontalFrameAdditionalParent->hide();
745 myHorizontalFrameBlockMovement->hide();
746 myHorizontalFrameBlockShape->hide();
747 myHorizontalFrameCloseShape->hide();
755 if (myInspectorFrameParent->myAttributesEditor->getEditedACs().size() > 0) {
757 if (myHorizontalFrameBlockMovement->shown()) {
760 for (
const auto& i : myInspectorFrameParent->myAttributesEditor->getEditedACs()) {
765 myCheckBoxBlockMovement->setCheck(
true);
766 myCheckBoxBlockMovement->setText(
"true");
768 myCheckBoxBlockMovement->setCheck(
false);
769 myCheckBoxBlockMovement->setText(
"false");
773 if (myHorizontalFrameBlockShape->shown()) {
776 for (
const auto& i : myInspectorFrameParent->myAttributesEditor->getEditedACs()) {
781 myCheckBoxBlockShape->setCheck(
true);
782 myCheckBoxBlockShape->setText(
"true");
784 myCheckBoxBlockShape->setCheck(
false);
785 myCheckBoxBlockShape->setText(
"false");
789 if (myHorizontalFrameCloseShape->shown()) {
792 for (
const auto& i : myInspectorFrameParent->myAttributesEditor->getEditedACs()) {
797 myCheckBoxCloseShape->setCheck(
true);
798 myCheckBoxCloseShape->setText(
"true");
800 myCheckBoxCloseShape->setCheck(
false);
801 myCheckBoxCloseShape->setText(
"false");
805 if (myHorizontalFrameAdditionalParent->shown() && ((myTextFieldAdditionalParent->getTextColor() == FXRGB(0, 0, 0)) || forceRefresh)) {
807 myLabelAdditionalParent->setText((
toString(myInspectorFrameParent->myAttributesEditor->getEditedACs().front()->getTagProperty().getParentTag()) +
" parent").c_str());
808 myTextFieldAdditionalParent->setText(myInspectorFrameParent->myAttributesEditor->getEditedACs().front()->getAttribute(
GNE_ATTR_PARENT).c_str());
817 if (myInspectorFrameParent->myAttributesEditor->getEditedACs().size() > 0) {
819 if (myInspectorFrameParent->myAttributesEditor->getEditedACs().size() > 1) {
820 myInspectorFrameParent->getViewNet()->getUndoList()->p_begin(
"Change multiple attributes");
822 if (obj == myCheckBoxBlockMovement) {
824 for (
const auto& i : myInspectorFrameParent->myAttributesEditor->getEditedACs()) {
825 if (myCheckBoxBlockMovement->getCheck() == 1) {
827 myCheckBoxBlockMovement->setText(
"true");
830 myCheckBoxBlockMovement->setText(
"false");
833 }
else if (obj == myCheckBoxBlockShape) {
835 for (
const auto& i : myInspectorFrameParent->myAttributesEditor->getEditedACs()) {
836 if (myCheckBoxBlockShape->getCheck() == 1) {
837 i->setAttribute(
GNE_ATTR_BLOCK_SHAPE,
"true", myInspectorFrameParent->getViewNet()->getUndoList());
838 myCheckBoxBlockShape->setText(
"true");
840 i->setAttribute(
GNE_ATTR_BLOCK_SHAPE,
"false", myInspectorFrameParent->getViewNet()->getUndoList());
841 myCheckBoxBlockShape->setText(
"false");
844 }
else if (obj == myCheckBoxCloseShape) {
846 for (
const auto& i : myInspectorFrameParent->myAttributesEditor->getEditedACs()) {
847 if (myCheckBoxCloseShape->getCheck() == 1) {
848 i->setAttribute(
GNE_ATTR_CLOSE_SHAPE,
"true", myInspectorFrameParent->getViewNet()->getUndoList());
849 myCheckBoxCloseShape->setText(
"true");
851 i->setAttribute(
GNE_ATTR_CLOSE_SHAPE,
"false", myInspectorFrameParent->getViewNet()->getUndoList());
852 myCheckBoxCloseShape->setText(
"false");
855 }
else if (obj == myTextFieldAdditionalParent) {
856 if (myInspectorFrameParent->myAttributesEditor->getEditedACs().front()->isValid(
GNE_ATTR_PARENT, myTextFieldAdditionalParent->getText().text())) {
858 for (
const auto& i : myInspectorFrameParent->myAttributesEditor->getEditedACs()) {
859 i->setAttribute(
GNE_ATTR_PARENT, myTextFieldAdditionalParent->getText().text(), myInspectorFrameParent->getViewNet()->getUndoList());
861 myTextFieldAdditionalParent->setTextColor(FXRGB(0, 0, 0));
863 myTextFieldAdditionalParent->setTextColor(FXRGB(255, 0, 0));
864 myTextFieldAdditionalParent->killFocus();
868 if (myInspectorFrameParent->myAttributesEditor->getEditedACs().size() > 1) {
869 myInspectorFrameParent->getViewNet()->getUndoList()->p_end();
872 myInspectorFrameParent->myAttributesEditor->refreshAttributeEditor(
true,
true);
873 myInspectorFrameParent->myGEOAttributesEditor->refreshGEOAttributesEditor(
true);
890 myInspectorFrameParent(inspectorFrameParent) {
913 if (myInspectorFrameParent->myAttributesEditor->getEditedACs().size() > 0) {
915 myGEOAttributeTextField->enable();
916 myUseGEOCheckButton->enable();
918 const auto& tagProperty = myInspectorFrameParent->myAttributesEditor->getEditedACs().front()->getTagProperty();
920 if (tagProperty.hasGEOPosition() || tagProperty.hasGEOShape()) {
925 for (
const auto& i : myInspectorFrameParent->myAttributesEditor->getEditedACs()) {
926 value &= GNEAttributeCarrier::parse<bool>(i->getAttribute(
SUMO_ATTR_GEO));
929 myUseGEOFrame->show();
932 myUseGEOCheckButton->enable();
934 myUseGEOCheckButton->setCheck(
true);
935 myUseGEOCheckButton->setText(
"true");
937 myUseGEOCheckButton->setCheck(
false);
938 myUseGEOCheckButton->setText(
"false");
941 myUseGEOCheckButton->disable();
944 if (tagProperty.hasGEOPosition() && myInspectorFrameParent->myAttributesEditor->getEditedACs().size() == 1) {
945 myGEOAttributeFrame->show();
947 myGEOAttributeTextField->setTextColor(FXRGB(0, 0, 0));
950 myGEOAttributeTextField->enable();
951 myGEOAttributeTextField->setText(myInspectorFrameParent->myAttributesEditor->getEditedACs().front()->getAttribute(
SUMO_ATTR_GEOPOSITION).c_str());
953 myGEOAttributeTextField->disable();
954 myGEOAttributeTextField->setText(
"No geo-conversion defined");
956 }
else if (tagProperty.hasGEOShape() && myInspectorFrameParent->myAttributesEditor->getEditedACs().size() == 1) {
957 myGEOAttributeFrame->show();
959 myGEOAttributeTextField->setTextColor(FXRGB(0, 0, 0));
962 myGEOAttributeTextField->enable();
963 myGEOAttributeTextField->setText(myInspectorFrameParent->myAttributesEditor->getEditedACs().front()->getAttribute(
SUMO_ATTR_GEOSHAPE).c_str());
965 myGEOAttributeTextField->disable();
966 myGEOAttributeTextField->setText(
"No geo-conversion defined");
971 if (((myInspectorFrameParent->getViewNet()->getEditModes().currentSupermode ==
GNE_SUPERMODE_NETWORK) && myInspectorFrameParent->myAttributesEditor->getEditedACs().front()->getTagProperty().isDemandElement()) ||
972 ((myInspectorFrameParent->getViewNet()->getEditModes().currentSupermode ==
GNE_SUPERMODE_DEMAND) && !myInspectorFrameParent->myAttributesEditor->getEditedACs().front()->getTagProperty().isDemandElement())) {
973 myGEOAttributeTextField->disable();
974 myUseGEOCheckButton->disable();
983 myGEOAttributeFrame->hide();
984 myUseGEOFrame->hide();
993 const auto& tagProperty = myInspectorFrameParent->myAttributesEditor->getEditedACs().front()->getTagProperty();
995 if ((
GeoConvHelper::getFinal().getProjString() !=
"!") && myGEOAttributeFrame->shown() && ((myGEOAttributeTextField->getTextColor() == FXRGB(0, 0, 0)) || forceRefresh)) {
996 if (tagProperty.hasGEOPosition()) {
997 myGEOAttributeTextField->setText(myInspectorFrameParent->myAttributesEditor->getEditedACs().front()->getAttribute(
SUMO_ATTR_GEOPOSITION).c_str());
998 }
else if (tagProperty.hasGEOShape()) {
999 myGEOAttributeTextField->setText(myInspectorFrameParent->myAttributesEditor->getEditedACs().front()->getAttribute(
SUMO_ATTR_GEOSHAPE).c_str());
1001 myGEOAttributeTextField->setTextColor(FXRGB(0, 0, 0));
1009 if ((
GeoConvHelper::getFinal().getProjString() !=
"!") && (myInspectorFrameParent->myAttributesEditor->getEditedACs().size() > 0)) {
1010 if (obj == myGEOAttributeTextField) {
1012 const auto& tagProperty = myInspectorFrameParent->myAttributesEditor->getEditedACs().front()->getTagProperty();
1014 if (tagProperty.hasGEOPosition()) {
1015 if (myInspectorFrameParent->myAttributesEditor->getEditedACs().front()->isValid(
SUMO_ATTR_GEOPOSITION, myGEOAttributeTextField->getText().text())) {
1016 myInspectorFrameParent->myAttributesEditor->getEditedACs().front()->setAttribute(
SUMO_ATTR_GEOPOSITION, myGEOAttributeTextField->getText().text(), myInspectorFrameParent->getViewNet()->getUndoList());
1017 myGEOAttributeTextField->setTextColor(FXRGB(0, 0, 0));
1019 myGEOAttributeTextField->setTextColor(FXRGB(255, 0, 0));
1020 myGEOAttributeTextField->killFocus();
1022 }
else if (tagProperty.hasGEOShape()) {
1023 if (myInspectorFrameParent->myAttributesEditor->getEditedACs().front()->isValid(
SUMO_ATTR_GEOSHAPE, myGEOAttributeTextField->getText().text())) {
1024 myInspectorFrameParent->myAttributesEditor->getEditedACs().front()->setAttribute(
SUMO_ATTR_GEOSHAPE, myGEOAttributeTextField->getText().text(), myInspectorFrameParent->getViewNet()->getUndoList());
1025 myGEOAttributeTextField->setTextColor(FXRGB(0, 0, 0));
1027 myGEOAttributeTextField->setTextColor(FXRGB(255, 0, 0));
1028 myGEOAttributeTextField->killFocus();
1031 throw ProcessError(
"myGEOAttributeTextField must be hidden becaurse there isn't GEO Attribute to edit");
1033 }
else if (obj == myUseGEOCheckButton) {
1035 for (
const auto& i : myInspectorFrameParent->myAttributesEditor->getEditedACs()) {
1036 if (myUseGEOCheckButton->getCheck() == 1) {
1037 i->setAttribute(
SUMO_ATTR_GEO,
"true", myInspectorFrameParent->getViewNet()->getUndoList());
1038 myUseGEOCheckButton->setText(
"true");
1040 i->setAttribute(
SUMO_ATTR_GEO,
"false", myInspectorFrameParent->getViewNet()->getUndoList());
1041 myUseGEOCheckButton->setText(
"false");
1046 myInspectorFrameParent->myAttributesEditor->refreshAttributeEditor(
true,
true);
1047 myInspectorFrameParent->myNeteditAttributesEditor->refreshNeteditAttributesEditor(
true);
1055 FXDialogBox* helpDialog =
new FXDialogBox(
this,
"GEO attributes Help",
GUIDesignDialogBox);
1056 std::ostringstream help;
1058 <<
" SUMO uses the World Geodetic System 84 (WGS84/UTM).\n"
1059 <<
" For a GEO-referenced network, geo coordinates are represented as pairs of Longitude and Latitude\n"
1060 <<
" in decimal degrees without extra symbols. (N,W..)\n"
1061 <<
" - Longitude: East-west position of a point on the Earth's surface.\n"
1062 <<
" - Latitude: North-south position of a point on the Earth's surface.\n"
1063 <<
" - CheckBox 'geo' enables or disables saving position in GEO coordinates\n";
1067 helpDialog->create();
1078 myInspectorFrameParent(inspectorFrameParent),
1079 myEdgeTemplate(nullptr) {
1092 if (myEdgeTemplate) {
1094 myEdgeTemplate->decRef(
"GNEInspectorFrame::~GNEInspectorFrame");
1095 if (myEdgeTemplate->unreferenced()) {
1096 delete myEdgeTemplate;
1105 if ((myInspectorFrameParent->getViewNet()->getEditModes().currentSupermode ==
GNE_SUPERMODE_NETWORK) &&
1106 (myInspectorFrameParent->myAttributesEditor->getEditedACs().front()->getTagProperty().getTag() ==
SUMO_TAG_EDGE)) {
1109 myCopyTemplateButton->show();
1111 if (myInspectorFrameParent->myAttributesEditor->getEditedACs().size() == 1) {
1112 mySetTemplateButton->show();
1113 mySetTemplateButton->setText((
"Set edge '" + myInspectorFrameParent->myAttributesEditor->getEditedACs().front()->getID() +
"' as Template").c_str());
1122 myCopyTemplateButton->hide();
1123 mySetTemplateButton->hide();
1131 return myEdgeTemplate;
1137 if (myEdgeTemplate) {
1138 myEdgeTemplate->decRef(
"GNEInspectorFrame::setEdgeTemplate");
1139 if (myEdgeTemplate->unreferenced()) {
1140 delete myEdgeTemplate;
1143 myEdgeTemplate = tpl;
1144 myEdgeTemplate->
incRef(
"GNEInspectorFrame::setEdgeTemplate");
1150 for (
const auto& it : myInspectorFrameParent->myAttributesEditor->getEditedACs()) {
1151 GNEEdge* edge = dynamic_cast<GNEEdge*>(it);
1153 edge->
copyTemplate(myEdgeTemplate, myInspectorFrameParent->getViewNet()->getUndoList());
1154 myInspectorFrameParent->inspectMultisection(myInspectorFrameParent->myAttributesEditor->getEditedACs());
1162 assert(myInspectorFrameParent->myAttributesEditor->getEditedACs().size() == 1);
1163 GNEEdge* edge = dynamic_cast<GNEEdge*>(myInspectorFrameParent->myAttributesEditor->getEditedACs().front());
1165 setEdgeTemplate(edge);
1174 if (myEdgeTemplate) {
1175 if (myInspectorFrameParent->myAttributesEditor->getEditedACs().size() == 1) {
1176 caption = (
"Copy '" + myEdgeTemplate->getMicrosimID() +
"' into edge '" + myInspectorFrameParent->myAttributesEditor->getEditedACs().front()->getID() +
"'").c_str();
1178 caption = (
"Copy '" + myEdgeTemplate->getMicrosimID() +
"' into " +
toString(myInspectorFrameParent->myAttributesEditor->getEditedACs().size()) +
" selected edges").c_str();
1180 sender->handle(
this, FXSEL(SEL_COMMAND, ID_ENABLE),
nullptr);
1182 caption =
"No edge Template Set";
1183 sender->handle(
this, FXSEL(SEL_COMMAND, ID_DISABLE),
nullptr);
1185 sender->handle(
this, FXSEL(SEL_COMMAND, FXLabel::ID_SETSTRINGVALUE), (
void*)&caption);