Commit 8018e1ba authored by Riegel's avatar Riegel
Browse files

Add upside-down icon for NorthArrow

parent aad64166
Pipeline #10279 passed with stage
in 1 minute and 12 seconds
...@@ -237,6 +237,9 @@ public class MainWindow extends Application { ...@@ -237,6 +237,9 @@ public class MainWindow extends Application {
@FXML @FXML
private Label availableLabel; private Label availableLabel;
private Image north;
private Image northFlip;
private Group meshGroup; private Group meshGroup;
private Group world; private Group world;
...@@ -858,7 +861,8 @@ public class MainWindow extends Application { ...@@ -858,7 +861,8 @@ public class MainWindow extends Application {
meshGroup = new Group(); meshGroup = new Group();
world.getChildren().add(meshGroup); world.getChildren().add(meshGroup);
Image north = new Image(getClass().getResourceAsStream("icons/north.png")); north = new Image(getClass().getResourceAsStream("icons/north.png"));
northFlip = new Image(getClass().getResourceAsStream("icons/north_flip.png"));
northArrow = new ImageView(north); northArrow = new ImageView(north);
northArrow.setFitHeight(50); northArrow.setFitHeight(50);
northArrow.setFitWidth(50); northArrow.setFitWidth(50);
...@@ -940,8 +944,19 @@ public class MainWindow extends Application { ...@@ -940,8 +944,19 @@ public class MainWindow extends Application {
double absRotZ = cameraZRotation.getAngle() - 360 * Math.floor(cameraZRotation.getAngle() / 360); double absRotZ = cameraZRotation.getAngle() - 360 * Math.floor(cameraZRotation.getAngle() / 360);
double absRotX = cameraXRotation.getAngle() - 360 * Math.floor(cameraXRotation.getAngle() / 360); double absRotX = cameraXRotation.getAngle() - 360 * Math.floor(cameraXRotation.getAngle() / 360);
double northRot = ((80 <= absRotX && absRotX <= 260) ? 360-absRotZ: (absRotZ+180)%360 ); double northRot;
if (80 <= absRotX && absRotX <= 260){
northRot = 360-absRotZ;
if (northArrow.getImage() != north){
northArrow.setImage(north);
}
} else {
//Camera is below horizon line -> flip north arrow horizontally
northRot = (absRotZ+180)%360;
if (northArrow.getImage() != northFlip){
northArrow.setImage(northFlip);
}
}
northArrow.setRotate(northRot); northArrow.setRotate(northRot);
} }
......
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