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