Commit aad64166 authored by Riegel's avatar Riegel
Browse files

Add button for resetting the MeshView camera

parent 76f34f51
...@@ -30,6 +30,7 @@ MainToolBar.culling=Enable/Disable Culling ...@@ -30,6 +30,7 @@ MainToolBar.culling=Enable/Disable Culling
MainToolBar.writeReports=Write Reports MainToolBar.writeReports=Write Reports
MainToolBar.executeChecks=Execute Checks MainToolBar.executeChecks=Execute Checks
MainToolBar.showWorld=Show entire city model MainToolBar.showWorld=Show entire city model
MainToolBar.resetCamera=Reset view
MainWindow.missingConfig=Could not find configuration file. MainWindow.missingConfig=Could not find configuration file.
MainWindow.loadGivenFile=Loading given file, please wait MainWindow.loadGivenFile=Loading given file, please wait
MainWindow.finishedLoading=Finished loading MainWindow.finishedLoading=Finished loading
......
...@@ -28,6 +28,7 @@ MainToolBar.culling=Aktiviere/Deaktiviere Entfernen der R\u00fcckseiten ...@@ -28,6 +28,7 @@ MainToolBar.culling=Aktiviere/Deaktiviere Entfernen der R\u00fcckseiten
MainToolBar.writeReports=Schreibe Reports MainToolBar.writeReports=Schreibe Reports
MainToolBar.executeChecks=F\u00fchre Pr\u00fcfungen aus MainToolBar.executeChecks=F\u00fchre Pr\u00fcfungen aus
MainToolBar.showWorld=Gesamtes Stadtmodell anzeigen MainToolBar.showWorld=Gesamtes Stadtmodell anzeigen
MainToolBar.resetCamera=Ansicht zur\u00fccksetzen
MainWindow.missingConfig=Konnte Konfigurationsdatei nicht finden. MainWindow.missingConfig=Konnte Konfigurationsdatei nicht finden.
MainWindow.loadGivenFile=Lade vorhandene Datei, bitte warten MainWindow.loadGivenFile=Lade vorhandene Datei, bitte warten
MainWindow.finishedLoading=Fertig geladen MainWindow.finishedLoading=Fertig geladen
......
...@@ -59,6 +59,7 @@ public class CityDoctorController { ...@@ -59,6 +59,7 @@ public class CityDoctorController {
private HighlightController highlightController; private HighlightController highlightController;
private Renderer renderer; private Renderer renderer;
private BoundingBox originBB = null;
private AtomicInteger buildingChunkNr = new AtomicInteger(0); private AtomicInteger buildingChunkNr = new AtomicInteger(0);
private AtomicInteger vegetationChunkNr = new AtomicInteger(0); private AtomicInteger vegetationChunkNr = new AtomicInteger(0);
...@@ -137,6 +138,7 @@ public class CityDoctorController { ...@@ -137,6 +138,7 @@ public class CityDoctorController {
mainWindow.getLod4Btn().setDisable(false); mainWindow.getLod4Btn().setDisable(false);
mainWindow.getWorldBtn().setDisable(false); mainWindow.getWorldBtn().setDisable(false);
mainWindow.getSaveBtn().setDisable(false); mainWindow.getSaveBtn().setDisable(false);
mainWindow.getResetCameraBtn().setDisable(false);
mainWindow.getNorthArrow().setVisible(true); mainWindow.getNorthArrow().setVisible(true);
mainWindow.alignNorthArrow(); mainWindow.alignNorthArrow();
setupFeatureTabs(); setupFeatureTabs();
...@@ -1259,4 +1261,13 @@ public class CityDoctorController { ...@@ -1259,4 +1261,13 @@ public class CityDoctorController {
public ParserConfiguration getCurrentConfig() { public ParserConfiguration getCurrentConfig() {
return currentConfig; return currentConfig;
} }
public void setOriginBB(BoundingBox origin){
this.originBB = origin;
}
public BoundingBox getOriginBB() {
return originBB;
}
} }
...@@ -49,6 +49,12 @@ public class MainToolBar { ...@@ -49,6 +49,12 @@ public class MainToolBar {
@FXML @FXML
private ImageView showWorldImageView; private ImageView showWorldImageView;
@FXML
private Button resetCameraBtn;
@FXML
private ImageView resetCameraView;
@FXML @FXML
private Button schematronBtn; private Button schematronBtn;
...@@ -139,6 +145,7 @@ public class MainToolBar { ...@@ -139,6 +145,7 @@ public class MainToolBar {
setupLodButtons(); setupLodButtons();
setupAboutButton(); setupAboutButton();
setupReportButton(); setupReportButton();
setupResetCameraButton();
loadImages(); loadImages();
gridButton.setOnAction(ae -> renderer.showWireFrame(gridButton.isSelected())); gridButton.setOnAction(ae -> renderer.showWireFrame(gridButton.isSelected()));
...@@ -208,6 +215,10 @@ public class MainToolBar { ...@@ -208,6 +215,10 @@ public class MainToolBar {
Image img = new Image(inStream); Image img = new Image(inStream);
saveView.setImage(img); saveView.setImage(img);
} }
try (InputStream inStream = MainWindow.class.getResourceAsStream("icons/reset_camera.png")) {
Image img = new Image(inStream);
resetCameraView.setImage(img);
}
} catch (IOException e) { } catch (IOException e) {
// ignore close exception // ignore close exception
} }
...@@ -298,6 +309,13 @@ public class MainToolBar { ...@@ -298,6 +309,13 @@ public class MainToolBar {
}); });
} }
private void setupResetCameraButton(){
resetCameraBtn.setDisable(true);
resetCameraBtn.setTooltip(new Tooltip(Localization.getText("MainToolBar.resetCamera")));
resetCameraBtn.setOnAction(ae -> mainWindow.resetCamera());
}
public Button getCheckButton() { public Button getCheckButton() {
return checkBtn; return checkBtn;
} }
...@@ -310,6 +328,10 @@ public class MainToolBar { ...@@ -310,6 +328,10 @@ public class MainToolBar {
return cullingButton; return cullingButton;
} }
public Button getSaveButton() {
return saveBtn;
}
public Button getWriteReportButton() { public Button getWriteReportButton() {
return reportBtn; return reportBtn;
} }
...@@ -338,6 +360,10 @@ public class MainToolBar { ...@@ -338,6 +360,10 @@ public class MainToolBar {
return saveBtn; return saveBtn;
} }
public Button getResetCameraBtn(){
return resetCameraBtn;
}
public HBox getToolBar() { public HBox getToolBar() {
return toolBar; return toolBar;
} }
......
...@@ -945,6 +945,18 @@ public class MainWindow extends Application { ...@@ -945,6 +945,18 @@ public class MainWindow extends Application {
northArrow.setRotate(northRot); northArrow.setRotate(northRot);
} }
public void resetCamera(){
cameraXRot = CAMERA_INITIAL_X_ANGLE;
cameraYRot = CAMERA_INITIAL_Y_ANGLE;
cameraZRotation.setAngle(cameraXRot);
cameraXRotation.setAngle(cameraYRot);
alignNorthArrow();
camera.setTranslateX(0);
camera.setTranslateY(0);
if (controller.getOriginBB() != null) {
zoomOutForBoundingBox(controller.getOriginBB());
}
}
public void addFileNameToTitle(String fileName) { public void addFileNameToTitle(String fileName) {
String version = Localization.getText(Localization.VERSION); String version = Localization.getText(Localization.VERSION);
...@@ -1063,6 +1075,10 @@ public class MainWindow extends Application { ...@@ -1063,6 +1075,10 @@ public class MainWindow extends Application {
return mainToolBar.getWorldBtn(); return mainToolBar.getWorldBtn();
} }
public Button getResetCameraBtn(){
return mainToolBar.getResetCameraBtn();
}
public ImageView getNorthArrow(){ public ImageView getNorthArrow(){
return northArrow; return northArrow;
} }
...@@ -1094,6 +1110,7 @@ public class MainWindow extends Application { ...@@ -1094,6 +1110,7 @@ public class MainWindow extends Application {
camera.setTranslateX(0); camera.setTranslateX(0);
camera.setTranslateY(0); camera.setTranslateY(0);
highlightController.changeScaling(-translateZ); highlightController.changeScaling(-translateZ);
controller.setOriginBB(b);
} }
public MainToolBar getMainToolbar() { public MainToolBar getMainToolbar() {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<?import javafx.scene.image.ImageView?> <?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.HBox?> <?import javafx.scene.layout.HBox?>
<HBox maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" spacing="5.0" xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml"> <HBox maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" spacing="5.0" xmlns="http://javafx.com/javafx/22" xmlns:fx="http://javafx.com/fxml/1">
<children> <children>
<HBox spacing="5.0" HBox.hgrow="NEVER"> <HBox spacing="5.0" HBox.hgrow="NEVER">
<children> <children>
...@@ -63,6 +63,12 @@ ...@@ -63,6 +63,12 @@
<ImageView fx:id="lod4View" fitHeight="32.0" fitWidth="32.0" pickOnBounds="true" preserveRatio="true" /> <ImageView fx:id="lod4View" fitHeight="32.0" fitWidth="32.0" pickOnBounds="true" preserveRatio="true" />
</graphic> </graphic>
</ToggleButton> </ToggleButton>
<Separator orientation="VERTICAL" />
<Button fx:id="resetCameraBtn" mnemonicParsing="false">
<graphic>
<ImageView fx:id="resetCameraView" disable="true" fitHeight="32.0" fitWidth="32.0" pickOnBounds="true" preserveRatio="true" />
</graphic>
</Button>
</children> </children>
</HBox> </HBox>
<HBox fx:id="spacer" alignment="TOP_RIGHT" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" spacing="5.0" HBox.hgrow="ALWAYS"> <HBox fx:id="spacer" alignment="TOP_RIGHT" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" spacing="5.0" HBox.hgrow="ALWAYS">
......
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