From 84b66279bfae87c280f0a9083f6514d959b9844a Mon Sep 17 00:00:00 2001 From: Niels Vistisen Date: Tue, 27 Jul 2021 10:07:42 +0200 Subject: [PATCH 1/5] Prohibited location visualization implemented --- .../java/ecdar/abstractions/Location.java | 2 +- .../ecdar/controllers/LocationController.java | 1 + .../presentations/LocationPresentation.java | 23 +++++++++++++++---- .../presentations/LocationPresentation.fxml | 2 ++ 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/main/java/ecdar/abstractions/Location.java b/src/main/java/ecdar/abstractions/Location.java index d5b21990..0586b88b 100644 --- a/src/main/java/ecdar/abstractions/Location.java +++ b/src/main/java/ecdar/abstractions/Location.java @@ -441,7 +441,7 @@ public enum Type { } public enum Urgency { - NORMAL, URGENT, COMMITTED + NORMAL, URGENT, COMMITTED, PROHIBITED } public enum Reachability { diff --git a/src/main/java/ecdar/controllers/LocationController.java b/src/main/java/ecdar/controllers/LocationController.java index 238a1c07..d097ba31 100644 --- a/src/main/java/ecdar/controllers/LocationController.java +++ b/src/main/java/ecdar/controllers/LocationController.java @@ -63,6 +63,7 @@ public class LocationController implements Initializable, SelectHelper.ItemSelec public Label idLabel; public Line nameTagLine; public Line invariantTagLine; + public Line crossOut; private DropDownMenu dropDownMenu; private boolean dropDownMenuInitialized = false; diff --git a/src/main/java/ecdar/presentations/LocationPresentation.java b/src/main/java/ecdar/presentations/LocationPresentation.java index b0847d50..6ef3cf71 100644 --- a/src/main/java/ecdar/presentations/LocationPresentation.java +++ b/src/main/java/ecdar/presentations/LocationPresentation.java @@ -350,7 +350,6 @@ private void initializeLocationShapes() { final Location location = controller.getLocation(); - BiConsumer updateUrgencies = (oldUrgency, newUrgency) -> { final Transition toUrgent = new Transition() { { @@ -374,10 +373,11 @@ protected void interpolate(final double frac) { } }; - if(oldUrgency.equals(Location.Urgency.NORMAL) && !newUrgency.equals(Location.Urgency.NORMAL)) { - toUrgent.play(); + boolean normalOrProhibited = newUrgency.equals(Location.Urgency.NORMAL) || newUrgency.equals(Location.Urgency.PROHIBITED); - } else if(newUrgency.equals(Location.Urgency.NORMAL)) { + if(oldUrgency.equals(Location.Urgency.NORMAL) && !(normalOrProhibited)) { + toUrgent.play(); + } else if(normalOrProhibited) { toNormal.play(); } @@ -388,6 +388,16 @@ protected void interpolate(final double frac) { committedShape.setVisible(false); notCommittedShape.setVisible(true); } + + if(newUrgency.equals(Location.Urgency.PROHIBITED)) { + notCommittedShape.setStrokeWidth(4); + notCommittedShape.setStroke(Color.RED.getColor(Color.Intensity.I600)); + controller.crossOut.setVisible(true); + } else { + notCommittedShape.setStrokeWidth(1); + notCommittedShape.setStroke(location.getColor().getColor(location.getColorIntensity().next(2))); + controller.crossOut.setVisible(false); + } }; location.urgencyProperty().addListener((obsUrgency, oldUrgency, newUrgency) -> { @@ -403,7 +413,10 @@ protected void interpolate(final double frac) { // Delegate to style the label based on the color of the location final BiConsumer updateColor = (newColor, newIntensity) -> { notCommittedShape.setFill(newColor.getColor(newIntensity)); - notCommittedShape.setStroke(newColor.getColor(newIntensity.next(2))); + + if (!location.getUrgency().equals(Location.Urgency.PROHIBITED)) { + notCommittedShape.setStroke(newColor.getColor(newIntensity.next(2))); + } committedShape.setFill(newColor.getColor(newIntensity)); committedShape.setStroke(newColor.getColor(newIntensity.next(2))); diff --git a/src/main/resources/ecdar/presentations/LocationPresentation.fxml b/src/main/resources/ecdar/presentations/LocationPresentation.fxml index b6d02cc0..554de54e 100644 --- a/src/main/resources/ecdar/presentations/LocationPresentation.fxml +++ b/src/main/resources/ecdar/presentations/LocationPresentation.fxml @@ -46,6 +46,8 @@