diff --git a/CityDoctorParent/CityDoctorModel/src/main/resources/CityDoctorLocalization.properties b/CityDoctorParent/CityDoctorModel/src/main/resources/CityDoctorLocalization.properties index 353fd024c7982ee5048671863bab17dec6aaab14..f7ad5450a9326cca85d4c878c4d12e6e5d3762d0 100644 --- a/CityDoctorParent/CityDoctorModel/src/main/resources/CityDoctorLocalization.properties +++ b/CityDoctorParent/CityDoctorModel/src/main/resources/CityDoctorLocalization.properties @@ -73,6 +73,7 @@ MainWindow.verticesTab=Vertices MainWindow.attributeTab=Attributes MainWindow.logTab=Log MainWindow.globalErrorsTab=Global Errors +MainWindow.focusCityObject=Focus object OpenFileDialog.fileLabel=File: OpenFileDialog.selectBtn=Select OpenFileDialog.loadBtn=Load diff --git a/CityDoctorParent/CityDoctorModel/src/main/resources/CityDoctorLocalization_de.properties b/CityDoctorParent/CityDoctorModel/src/main/resources/CityDoctorLocalization_de.properties index 58c4a4c8ae76531b1f9c89e8affcd069f1360b14..9023f19ae2e1f56ecb5315609304c1e8044ae1e6 100644 --- a/CityDoctorParent/CityDoctorModel/src/main/resources/CityDoctorLocalization_de.properties +++ b/CityDoctorParent/CityDoctorModel/src/main/resources/CityDoctorLocalization_de.properties @@ -71,6 +71,7 @@ MainWindow.verticesTab=Punkte MainWindow.attributeTab=Attribute MainWindow.logTab=Log MainWindow.globalErrorsTab=Globale Fehler +MainWindow.focusCityObject=Objekt fokussieren OpenFileDialog.fileLabel=Datei: OpenFileDialog.selectBtn=Ausw\u00e4hlen OpenFileDialog.loadBtn=Laden diff --git a/CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/MainWindow.java b/CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/MainWindow.java index 6084b578dd17a7f5437120f7071a36eec9599b34..64fb5354f06233ebeaf9d65650e554e520a39963 100644 --- a/CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/MainWindow.java +++ b/CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/MainWindow.java @@ -3,6 +3,7 @@ package de.hft.stuttgart.citydoctor2.gui; import de.hft.stuttgart.citydoctor2.CityDoctorValidation; import de.hft.stuttgart.citydoctor2.check.ValidationConfiguration; import de.hft.stuttgart.citydoctor2.datastructure.BoundingBox; +import de.hft.stuttgart.citydoctor2.datastructure.CityObject; import de.hft.stuttgart.citydoctor2.datastructure.FeatureType; import de.hft.stuttgart.citydoctor2.gui.logger.GuiLogger; import de.hft.stuttgart.citydoctor2.gui.tree.FeatureNode; @@ -300,7 +301,7 @@ public class MainWindow extends Application { BorderPane bp = loader.load(); highlightController = new HighlightController(world); renderer = new Renderer(this, highlightController); - clickHandler = new VertexClickHandler(errorView, renderer, stage); + clickHandler = new VertexClickHandler(errorView, renderer, stage, this); controller = new CityDoctorController(this, highlightController, renderer); mainToolBar = new MainToolBar(stage, controller, featurePane, renderer, this); viewPane.getChildren().add(mainToolBar.getToolBar()); @@ -1145,6 +1146,46 @@ public class MainWindow extends Application { controller.setOriginBB(b); } + public void showCityObjectDetail(CityObject co) { + FeatureType coType = co.getFeatureType(); + TreeView<Renderable> featureView; + Tab featureTab; + if (coType == FeatureType.BUILDING){ + featureView = buildingsView; + featureTab = buildingsTab; + } else if (coType == FeatureType.VEGETATION){ + featureView = vegetationView; + featureTab = vegetationTab; + } else if (coType == FeatureType.TRANSPORTATION){ + featureView = transView; + featureTab = transportationTab; + } else if (coType == FeatureType.TUNNEL){ + featureView = tunnelView; + featureTab = tunnelTab; + } else if (coType == FeatureType.BRIDGE){ + featureView = bridgeView; + featureTab = bridgeTab; + } else if (coType == FeatureType.WATER){ + featureView = waterView; + featureTab = waterTab; + } else if (coType == FeatureType.LAND){ + featureView = terrainView; + featureTab = terrainTab; + } else if (coType == FeatureType.CITY_FURNITURE){ + featureView = cityFurnitureView; + featureTab = cityFurnitureTab; + } else if (coType == FeatureType.GENERIC_CITY_OBJECT){ + featureView = otherObjectsView; + featureTab = otherObjectsTab; + } else { + throw new IllegalArgumentException("unknown feature type: " + coType); + } + featurePane.getSelectionModel().select(featureTab); + searchField.setText(co.getGmlId().getGmlString()); + searchBtn.fire(); + renderer.render(co); + } + public MainToolBar getMainToolbar() { return mainToolBar; } diff --git a/CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/VertexClickHandler.java b/CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/VertexClickHandler.java index e90172e51283865b83f2d5fe55d6f4e25049c2d9..1f4e0dc4c747f96ac487ceeaacb1e3dcc4975a00 100644 --- a/CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/VertexClickHandler.java +++ b/CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/VertexClickHandler.java @@ -25,12 +25,14 @@ public class VertexClickHandler implements ClickHandler { private TreeView<Renderable> errorView; private Renderer renderer; private Stage stage; + private MainWindow mainWindow; private ParserConfiguration config; - public VertexClickHandler(TreeView<Renderable> errorView, Renderer renderer, Stage stage) { + public VertexClickHandler(TreeView<Renderable> errorView, Renderer renderer, Stage stage, MainWindow mainWindow) { this.errorView = errorView; this.renderer = renderer; this.stage = stage; + this.mainWindow = mainWindow; } public void setConfig(ParserConfiguration config) { @@ -58,6 +60,17 @@ public class VertexClickHandler implements ClickHandler { clipboard.setContent(content); }); cMenu.getItems().add(clipMi); + + MenuItem detailMi = new MenuItem(Localization.getText("MainWindow.focusCityObject")); + detailMi.setOnAction(ea -> { + CityObject parent = p.getParent().getParent(); + if (parent instanceof BoundarySurface bs) { + parent = bs.getParent(); + } + mainWindow.showCityObjectDetail(parent); + }); + cMenu.getItems().add(detailMi); + cMenu.show(stage, me.getScreenX(), me.getScreenY()); } }