Added factory class for producing mark arrows.

#story[1118]
This commit is contained in:
Calum
2017-08-09 15:24:32 +12:00
parent 43788bd153
commit 126d8ea870
2 changed files with 73 additions and 3 deletions
@@ -0,0 +1,56 @@
package seng302.visualiser.fxObjects;
import javafx.scene.Group;
import javafx.scene.paint.Paint;
import javafx.scene.shape.Line;
import javafx.scene.shape.Polyline;
/**
* Created by cir27 on 9/08/17.
*/
public class MarkArrowFactory {
public enum RoundingType {
PORT,
STARBOARD,
}
public static Group constructEntryArrow (RoundingType roundingSide, double angleOfEntry,
double angleOfExit, Paint colour) {
Group arrow = new Group();
return arrow;
}
public static Group constructExitArrow (RoundingType roundingSide, double angleOfEntry, Paint colour) {
Group arrow = new Group();
Line arrowBody;
Polyline arrowHead = constructArrowHead();
if (roundingSide == RoundingType.PORT) {
arrowBody = new Line(
-10, -10,
-10, -30
);
arrowHead.setLayoutX(-10);
arrowHead.setLayoutY(-10);
} else {
arrowBody = new Line(
10, -10,
10, -30
);
arrowHead.setLayoutX(10);
arrowHead.setLayoutY(-10);
}
arrowBody.setFill(colour);
arrowHead.setFill(colour);
arrow.getChildren().addAll(arrowBody, arrowHead);
return arrow;
}
private static Polyline constructArrowHead () {
return new Polyline(
-5, -5,
0, 0,
5, -5
);
}
}
@@ -1,19 +1,33 @@
package seng302.visualiser.fxObjects;
import javafx.application.Platform;
import javafx.scene.Group;
import javafx.scene.paint.Paint;
import javafx.scene.shape.Circle;
/**
* Visual object for a mark.
*/
public class Marker extends Circle {
public class Marker extends Group {
Circle mark = new Circle();
Group enterArrow;
Group exitArrow;
public Marker() {
super.setRadius(5);
mark.setRadius(5);
}
public Marker(Paint colour) {
this();
super.setFill(colour);
mark.setFill(colour);
}
public void showEnterArrow () {
Platform.runLater(() -> this.getChildren().setAll(enterArrow));
}
public void showExitArrow () {
Platform.runLater(() -> this.getChildren().setAll(exitArrow));
}
}