mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Laylines are now togglable. Still not completely fool proof
Laylines appear only for the selected boat. The dissapear if the boat is not seleccted. Laylines are the colour of the boat Laylines do not yet automatically update for a selected boat when it passes a mark There is still a polling interval of a second in which if you select a boat after it has just passed a mark it still thinks the next mark is that mark and laylines are displayed incorrectly #story[956] #pair[wmu16, mra106]
This commit is contained in:
@@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javafx.geometry.Point2D;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.shape.Circle;
|
||||
import javafx.scene.shape.Line;
|
||||
@@ -46,34 +47,27 @@ public class MarkGroup extends Group {
|
||||
super.getChildren().add(markCircle);
|
||||
}
|
||||
|
||||
private Point2D getPointRotation(Point2D ref, Double distance, Double angle){
|
||||
Double newX = ref.getX() + (ref.getX() + distance -ref.getX())*Math.cos(angle) - (ref.getY() + distance -ref.getY())*Math.sin(angle);
|
||||
Double newY = ref.getY() + (ref.getX() + distance -ref.getX())*Math.sin(angle) + (ref.getY() + distance -ref.getY())*Math.cos(angle);
|
||||
public void addLaylines(Line line1, Line line2) {
|
||||
|
||||
return new Point2D(newX, newY);
|
||||
super.getChildren().addAll(line1, line2);
|
||||
}
|
||||
|
||||
|
||||
public void addLeftLayline(Point2D startPoint, Double layLineAngle, Double baseAngle) {
|
||||
|
||||
Point2D ep = getPointRotation(startPoint, 50.0, baseAngle + layLineAngle);
|
||||
Line line = new Line(startPoint.getX(), startPoint.getY(), ep.getX(), ep.getY());
|
||||
line.setStrokeWidth(1);
|
||||
line.setStroke(Color.GREEN);
|
||||
|
||||
super.getChildren().addAll(line);
|
||||
|
||||
}
|
||||
|
||||
public void addRightLayline(Point2D startPoint, Double layLineAngle, Double baseAngle) {
|
||||
|
||||
Point2D ep = getPointRotation(startPoint, 50.0, baseAngle - layLineAngle);
|
||||
Line line = new Line(startPoint.getX(), startPoint.getY(), ep.getX(), ep.getY());
|
||||
line.setStrokeWidth(1);
|
||||
line.setStroke(Color.GREEN);
|
||||
|
||||
super.getChildren().addAll(line);
|
||||
public void removeLaylines() {
|
||||
ArrayList<Node> toRemove = new ArrayList<>();
|
||||
for(Node node : super.getChildren()) {
|
||||
if (node instanceof Line) {
|
||||
Line layLine = (Line) node;
|
||||
|
||||
/***
|
||||
* OOHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHhhh
|
||||
*/
|
||||
if (layLine.getStrokeWidth() == 0.5){
|
||||
toRemove.add(layLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
super.getChildren().removeAll(toRemove);
|
||||
}
|
||||
|
||||
public MarkGroup(GateMark mark, Point2D points1, Point2D points2) {
|
||||
|
||||
Reference in New Issue
Block a user