Commit 3dba0e5e authored by Riegel's avatar Riegel
Browse files

Add focusing function to polygon context menu

Showing with 58 additions and 2 deletions
+58 -2
......@@ -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
......
......@@ -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
......
......@@ -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;
}
......
......@@ -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());
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment