mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Fixed markergroup bugs. Improved wakes. Still WIP
This commit is contained in:
@@ -37,7 +37,6 @@ public class CanvasController {
|
|||||||
private ResizableCanvas canvas;
|
private ResizableCanvas canvas;
|
||||||
private Group group;
|
private Group group;
|
||||||
private GraphicsContext gc;
|
private GraphicsContext gc;
|
||||||
private List<BoatGroup> boatGroups = new ArrayList<>();
|
|
||||||
|
|
||||||
private final int MARK_SIZE = 10;
|
private final int MARK_SIZE = 10;
|
||||||
private final int BUFFER_SIZE = 25;
|
private final int BUFFER_SIZE = 25;
|
||||||
@@ -154,6 +153,7 @@ public class CanvasController {
|
|||||||
|
|
||||||
Mark nextMark;
|
Mark nextMark;
|
||||||
//if (countdown == 0) {
|
//if (countdown == 0) {
|
||||||
|
//System.out.println("called the at");
|
||||||
for (RaceObject raceObject : raceObjects) {
|
for (RaceObject raceObject : raceObjects) {
|
||||||
//if (currentRaceMarker[boatIndex] < marks.size()) {
|
//if (currentRaceMarker[boatIndex] < marks.size()) {
|
||||||
//if (currentRaceMarker[boatIndex] == 6) {
|
//if (currentRaceMarker[boatIndex] == 6) {
|
||||||
@@ -166,18 +166,23 @@ public class CanvasController {
|
|||||||
//descending = nextMark.getY() > boatGroup.getLayoutY();
|
//descending = nextMark.getY() > boatGroup.getLayoutY();
|
||||||
//leftToRight = nextMark.getX() < boatGroup.getLayoutX();
|
//leftToRight = nextMark.getX() < boatGroup.getLayoutX();
|
||||||
|
|
||||||
|
|
||||||
raceObject.updatePosition(1000 / 60);
|
raceObject.updatePosition(1000 / 60);
|
||||||
for (int id : raceObject.getRaceIds()) {
|
for (int id : raceObject.getRaceIds()) {
|
||||||
if (StreamParser.boatPositions.containsKey(id)) {
|
//System.out.println("id = " + id);
|
||||||
Point3D p = StreamParser.boatPositions.get((long) id);
|
if (id != 0 && StreamParser.boatPositions.size() > 0) {
|
||||||
Point2D p2d = latLonToXY(p.getX(), p.getY());
|
boolean test = StreamParser.boatPositions.containsKey(id);
|
||||||
//System.out.println("p2d = " + p2d);
|
if (StreamParser.boatPositions.containsKey((long) id)) {
|
||||||
|
Point3D p = StreamParser.boatPositions.get((long) id);
|
||||||
|
Point2D p2d = latLonToXY(p.getX(), p.getY());
|
||||||
|
//System.out.println("p2d = " + p2d);
|
||||||
//System.out.println("p.toString() = " + p.toString());
|
//System.out.println("p.toString() = " + p.toString());
|
||||||
double heading = 360.0 / 0xffff * p.getZ();
|
double heading = 360.0 / 0xffff * p.getZ();
|
||||||
//System.out.println("heading = " + heading);
|
//System.out.println("heading = " + heading);
|
||||||
raceObject.setDestination(p2d.getX(), p2d.getY(), heading, id);
|
raceObject.setDestination(p2d.getX(), p2d.getY(), heading, id);
|
||||||
|
}
|
||||||
|
StreamParser.boatPositions.remove((long) id);
|
||||||
}
|
}
|
||||||
StreamParser.boatPositions.remove((long) id);
|
|
||||||
}
|
}
|
||||||
//Point3D p = StreamParser.boatPositions.get((long) raceObject.getRaceIds()[0]);
|
//Point3D p = StreamParser.boatPositions.get((long) raceObject.getRaceIds()[0]);
|
||||||
//System.out.println("boatGroup = " + boatGroup.getBoat().getId());
|
//System.out.println("boatGroup = " + boatGroup.getBoat().getId());
|
||||||
@@ -292,10 +297,11 @@ public class CanvasController {
|
|||||||
private void drawBoats() {
|
private void drawBoats() {
|
||||||
// Map<Boat, TimelineInfo> timelineInfos = raceViewController.getTimelineInfos();
|
// Map<Boat, TimelineInfo> timelineInfos = raceViewController.getTimelineInfos();
|
||||||
List<Boat> boats = raceViewController.getStartingBoats();
|
List<Boat> boats = raceViewController.getStartingBoats();
|
||||||
Double startingX = group.getChildren().get(0).getLayoutX();
|
System.out.println("raceObjects " + raceObjects);
|
||||||
Double startingY = group.getChildren().get(0).getLayoutY();
|
Double startingX = raceObjects.get(0).getLayoutX();
|
||||||
Double firstMarkX = group.getChildren().get(1).getLayoutX();
|
Double startingY = raceObjects.get(0).getLayoutY();
|
||||||
Double firstMarkY = group.getChildren().get(1).getLayoutY();
|
Double firstMarkX = raceObjects.get(1).getLayoutX();
|
||||||
|
Double firstMarkY = raceObjects.get(1).getLayoutY();
|
||||||
|
|
||||||
for (Boat boat : boats) {
|
for (Boat boat : boats) {
|
||||||
BoatGroup boatGroup = new BoatGroup(boat, Colors.getColor());
|
BoatGroup boatGroup = new BoatGroup(boat, Colors.getColor());
|
||||||
@@ -303,7 +309,7 @@ public class CanvasController {
|
|||||||
boatGroup.setDestination(firstMarkX, firstMarkY);
|
boatGroup.setDestination(firstMarkX, firstMarkY);
|
||||||
boatGroup.forceRotation();
|
boatGroup.forceRotation();
|
||||||
group.getChildren().add(boatGroup);
|
group.getChildren().add(boatGroup);
|
||||||
boatGroups.add(boatGroup);
|
raceObjects.add(boatGroup);
|
||||||
// drawBoat(boat.getLongitude(), boat.getLatitude(), boat.getColor(), boat.getShortName(), boat.getSpeedInKnots(), boat.getHeading());
|
// drawBoat(boat.getLongitude(), boat.getLatitude(), boat.getColor(), boat.getShortName(), boat.getSpeedInKnots(), boat.getHeading());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -529,14 +535,16 @@ public class CanvasController {
|
|||||||
*/
|
*/
|
||||||
private void givePointsXY() {
|
private void givePointsXY() {
|
||||||
//Point2D canvasLocation;
|
//Point2D canvasLocation;
|
||||||
// List<Mark> allPoints = new ArrayList<>(raceViewController.getRace().getCourse());
|
List<Mark> allPoints = new ArrayList<>(raceViewController.getRace().getCourse());
|
||||||
Set<Mark> unqiuePoints = new HashSet<>(raceViewController.getRace().getCourse());
|
List<Mark> processed = new ArrayList<>();
|
||||||
System.out.println("unqiuePoints = " + unqiuePoints);
|
//Set<Mark> unqiuePoints = new HashSet<>(raceViewController.getRace().getCourse());
|
||||||
|
//System.out.println("unqiuePoints = " + unqiuePoints);
|
||||||
RaceObject markGroup;
|
RaceObject markGroup;
|
||||||
|
|
||||||
for (Mark mark : unqiuePoints) {
|
for (Mark mark : allPoints) {
|
||||||
if (mark.getMarkType() != MarkType.SINGLE_MARK) {
|
if (!processed.contains(mark)) {
|
||||||
GateMark gateMark = (GateMark) mark;
|
if (mark.getMarkType() != MarkType.SINGLE_MARK) {
|
||||||
|
GateMark gateMark = (GateMark) mark;
|
||||||
// canvasLocation = findScaledXY(gateMark.getSingleMark1());
|
// canvasLocation = findScaledXY(gateMark.getSingleMark1());
|
||||||
// gateMark.getSingleMark1().setX((int) canvasLocation.getX());
|
// gateMark.getSingleMark1().setX((int) canvasLocation.getX());
|
||||||
// gateMark.getSingleMark1().setY((int) canvasLocation.getY());
|
// gateMark.getSingleMark1().setY((int) canvasLocation.getY());
|
||||||
@@ -545,14 +553,17 @@ public class CanvasController {
|
|||||||
// gateMark.getSingleMark2().setX((int) canvasLocation.getX());
|
// gateMark.getSingleMark2().setX((int) canvasLocation.getX());
|
||||||
// gateMark.getSingleMark2().setY((int) canvasLocation.getY());
|
// gateMark.getSingleMark2().setY((int) canvasLocation.getY());
|
||||||
|
|
||||||
markGroup = new MarkGroup(mark, findScaledXY(gateMark.getSingleMark1()), findScaledXY(gateMark.getSingleMark2()));
|
markGroup = new MarkGroup(mark, findScaledXY(gateMark.getSingleMark1()), findScaledXY(gateMark.getSingleMark2()));
|
||||||
group.getChildren().add(markGroup);
|
group.getChildren().add(markGroup);
|
||||||
}
|
raceObjects.add(markGroup);
|
||||||
else {
|
} else {
|
||||||
// canvasLocation = findScaledXY(mark);
|
// canvasLocation = findScaledXY(mark);
|
||||||
// mark.setX((int) canvasLocation.getX());
|
// mark.setX((int) canvasLocation.getX());
|
||||||
// mark.setY((int) canvasLocation.getY());
|
// mark.setY((int) canvasLocation.getY());
|
||||||
markGroup = new MarkGroup(mark, findScaledXY(mark));
|
markGroup = new MarkGroup(mark, findScaledXY(mark));
|
||||||
|
group.getChildren().add(markGroup);
|
||||||
|
}
|
||||||
|
processed.add(mark);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ import javafx.scene.text.Text;
|
|||||||
import javafx.scene.transform.Rotate;
|
import javafx.scene.transform.Rotate;
|
||||||
import javafx.scene.transform.Translate;
|
import javafx.scene.transform.Translate;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by CJIRWIN on 25/04/2017.
|
* Created by CJIRWIN on 25/04/2017.
|
||||||
*/
|
*/
|
||||||
@@ -21,10 +24,11 @@ public class BoatGroup extends RaceObject{
|
|||||||
private static final double BOAT_WIDTH = 10d;
|
private static final double BOAT_WIDTH = 10d;
|
||||||
//Time between sections of race - Should be changed to 200 for actual program.
|
//Time between sections of race - Should be changed to 200 for actual program.
|
||||||
private static double expectedUpdateInterval = 200;
|
private static double expectedUpdateInterval = 200;
|
||||||
private static int WAKE_FRAME_INTERVAL = 40;
|
private static int WAKE_FRAME_INTERVAL = 80;
|
||||||
|
|
||||||
private Boat boat;
|
private Boat boat;
|
||||||
private int wakeCounter = WAKE_FRAME_INTERVAL;
|
private int wakeCounter = WAKE_FRAME_INTERVAL;
|
||||||
|
private List<Wake> wakes = new ArrayList<>();
|
||||||
|
|
||||||
public BoatGroup (Boat boat, Color color){
|
public BoatGroup (Boat boat, Color color){
|
||||||
this.boat = boat;
|
this.boat = boat;
|
||||||
@@ -107,21 +111,40 @@ public class BoatGroup extends RaceObject{
|
|||||||
rotation = rotationalVelocity * timeInterval;
|
rotation = rotationalVelocity * timeInterval;
|
||||||
}
|
}
|
||||||
moveGroupBy(dx, dy, rotation);
|
moveGroupBy(dx, dy, rotation);
|
||||||
for (Node wake : super.getChildren().subList(4, super.getChildren().size())) {
|
// if (super.getChildren().size() > 3) {
|
||||||
if (!((Wake) wake).updatePosition(timeInterval))
|
// for (Node wake : super.getChildren().subList(4, super.getChildren().size())) {
|
||||||
|
// if (!((Wake) wake).updatePosition(timeInterval))
|
||||||
|
// super.getChildren().remove(wake);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
for (Wake wake : wakes) {
|
||||||
|
if (wake.updatePosition(timeInterval)) {
|
||||||
super.getChildren().remove(wake);
|
super.getChildren().remove(wake);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (wakeCounter-- == 0) {
|
if (wakeCounter-- == 0) {
|
||||||
wakeCounter = WAKE_FRAME_INTERVAL;
|
wakeCounter = WAKE_FRAME_INTERVAL;
|
||||||
super.getChildren().add(
|
if (pixelVelocityX > 0 && pixelVelocityY > 0) {
|
||||||
new Wake(
|
// super.getChildren().add(
|
||||||
super.getLayoutX(), super.getLayoutY(), pixelVelocityX, pixelVelocityY
|
// new Wake(
|
||||||
)
|
// super.getLayoutX() + BOAT_HEIGHT, super.getLayoutY() + BOAT_HEIGHT, pixelVelocityX, pixelVelocityY
|
||||||
);
|
// )
|
||||||
|
// );
|
||||||
|
Wake wake = new Wake(
|
||||||
|
super.getLayoutX(),
|
||||||
|
super.getLayoutY(),
|
||||||
|
pixelVelocityX,
|
||||||
|
pixelVelocityY
|
||||||
|
);
|
||||||
|
super.getChildren().add(wake);
|
||||||
|
wakes.add(wake);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDestination (double newXValue, double newYValue, double rotation, int... raceIds) {
|
public void setDestination (double newXValue, double newYValue, double rotation, int... raceIds) {
|
||||||
|
//System.out.println("MADE IT");
|
||||||
if (hasRaceId(raceIds)) {
|
if (hasRaceId(raceIds)) {
|
||||||
this.pixelVelocityX = (newXValue - super.getLayoutX()) / expectedUpdateInterval;
|
this.pixelVelocityX = (newXValue - super.getLayoutX()) / expectedUpdateInterval;
|
||||||
this.pixelVelocityY = (newYValue - super.getLayoutY()) / expectedUpdateInterval;
|
this.pixelVelocityY = (newYValue - super.getLayoutY()) / expectedUpdateInterval;
|
||||||
|
|||||||
@@ -10,27 +10,35 @@ import javafx.scene.shape.ArcType;
|
|||||||
class Wake extends Arc {
|
class Wake extends Arc {
|
||||||
|
|
||||||
private static int VELOCITY_SCALE_FACTOR = 3;
|
private static int VELOCITY_SCALE_FACTOR = 3;
|
||||||
private static int MAX_LIFESPAN = 180;
|
private static int MAX_LIFESPAN = 420;
|
||||||
private static double LIFESPAN_PER_FRAME = 1.0 / MAX_LIFESPAN;
|
private static double LIFESPAN_PER_FRAME = 1.0 / MAX_LIFESPAN;
|
||||||
|
//private static double LENGTH_PER_FRAME = 120 / MAX_LIFESPAN;
|
||||||
|
private static double LENGTH_PER_FRAME = 0.08;
|
||||||
|
|
||||||
private double velocityX;
|
private double velocityX;
|
||||||
private double velocityY;
|
private double velocityY;
|
||||||
|
private double opacity;
|
||||||
private int lifespan = MAX_LIFESPAN;
|
private int lifespan = MAX_LIFESPAN;
|
||||||
|
|
||||||
Wake (double startingX, double startingY, double velocityX, double velocityY) {
|
Wake (double startingX, double startingY, double velocityX, double velocityY) {
|
||||||
super(startingX, startingY, 25, 15, 160, 40);
|
super(0, 0, 20, 30, 180, 0);
|
||||||
super.setFill(Color.BLUE);
|
//super.setFill(Color.BLUE);
|
||||||
|
super.setStroke(Color.BLUE);
|
||||||
super.setType(ArcType.OPEN);
|
super.setType(ArcType.OPEN);
|
||||||
super.setStrokeWidth(2.0);
|
super.setStrokeWidth(2.0);
|
||||||
this.velocityX = -velocityX;
|
this.velocityX = -velocityX / 2;
|
||||||
this.velocityY = -velocityY;
|
this.velocityY = -velocityY / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean updatePosition (double timeInterval) {
|
boolean updatePosition (double timeInterval) {
|
||||||
lifespan--;
|
lifespan--;
|
||||||
|
//super.setOpacity(LIFESPAN_PER_FRAME * lifespan * super.getOpacity());
|
||||||
|
opacity = LIFESPAN_PER_FRAME * lifespan * opacity;
|
||||||
|
super.setFill(new Color(0.0f, 0.0f, 1.0f, opacity));
|
||||||
super.setLayoutX(super.getLayoutX() + velocityX * timeInterval);
|
super.setLayoutX(super.getLayoutX() + velocityX * timeInterval);
|
||||||
super.setLayoutX(super.getLayoutX() + velocityX * timeInterval);
|
super.setLayoutY(super.getLayoutY() + velocityY * timeInterval);
|
||||||
super.setOpacity(LIFESPAN_PER_FRAME * lifespan * super.getOpacity());
|
super.setStartAngle(super.getStartAngle() - LENGTH_PER_FRAME);
|
||||||
|
super.setLength(super.getLength() + LENGTH_PER_FRAME * 2);
|
||||||
return lifespan == 0;
|
return lifespan == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,10 @@ public class MarkGroup extends RaceObject {
|
|||||||
private Point2D[] nodeDestinations;
|
private Point2D[] nodeDestinations;
|
||||||
|
|
||||||
public MarkGroup (Mark mark, Point2D... points) {
|
public MarkGroup (Mark mark, Point2D... points) {
|
||||||
|
// for (Point2D p : points) {
|
||||||
|
// System.out.println("p.getX() = " + p.getX());
|
||||||
|
// System.out.println("p.getY() = " + p.getY());
|
||||||
|
// }
|
||||||
marks.add(mark);
|
marks.add(mark);
|
||||||
mainMark = mark;
|
mainMark = mark;
|
||||||
Color color = Color.BLACK;
|
Color color = Color.BLACK;
|
||||||
@@ -36,43 +40,75 @@ public class MarkGroup extends RaceObject {
|
|||||||
} else if (mark.getName().equals("Finish")){
|
} else if (mark.getName().equals("Finish")){
|
||||||
color = Color.RED;
|
color = Color.RED;
|
||||||
}
|
}
|
||||||
|
System.out.println("HERE ARE THE CHILDREN LOL");
|
||||||
if (mark.getMarkType() == MarkType.SINGLE_MARK) {
|
if (mark.getMarkType() == MarkType.SINGLE_MARK) {
|
||||||
super.getChildren().add(new Circle(0, 0, MARK_RADIUS, color));
|
super.getChildren().add(new Circle(0, 0, MARK_RADIUS, color));
|
||||||
|
// System.out.println("SingleMark?");
|
||||||
|
// System.out.println("super.getChildren().get(0).getLayoutX() = " + super.getChildren().get(0).getLayoutX());
|
||||||
|
// System.out.println("super.getChildren().get(0).getLayoutY() = " + super.getChildren().get(0).getLayoutY());
|
||||||
} else {
|
} else {
|
||||||
marks.add(((GateMark) mark).getSingleMark1());
|
marks.add(((GateMark) mark).getSingleMark1());
|
||||||
marks.add(((GateMark) mark).getSingleMark2());
|
marks.add(((GateMark) mark).getSingleMark2());
|
||||||
super.getChildren().add(
|
super.getChildren().add(
|
||||||
new Circle(
|
new Circle(
|
||||||
(points[1].getX() - points[0].getX() / 2),
|
(points[1].getX() - points[0].getX()) / 2d,
|
||||||
(points[1].getY() - points[0].getY() / 2),
|
(points[1].getY() - points[0].getY()) / 2d,
|
||||||
MARK_RADIUS,
|
MARK_RADIUS,
|
||||||
color
|
color
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
// super.getChildren().add(new Circle(0, 0, MARK_RADIUS, color));
|
||||||
|
// super.getChildren().get(0).setLayoutX((points[1].getX() - points[0].getX()) / 2d);
|
||||||
|
// super.getChildren().get(0).setLayoutY((points[1].getY() - points[0].getY()) / 2d);
|
||||||
|
// System.out.println("!!!!!!!!!!!!!!!!!");
|
||||||
|
// System.out.println((points[1].getX() - points[0].getX()) / 2d);
|
||||||
|
// System.out.println((points[1].getY() - points[0].getY()) / 2d);
|
||||||
|
// System.out.println(super.getChildren().get(0));
|
||||||
super.getChildren().add(
|
super.getChildren().add(
|
||||||
new Circle(
|
new Circle(
|
||||||
-(points[1].getX() - points[0].getX() / 2),
|
-(points[1].getX() - points[0].getX()) / 2d,
|
||||||
-(points[1].getY() - points[0].getY() / 2),
|
-(points[1].getY() - points[0].getY()) / 2d,
|
||||||
MARK_RADIUS,
|
MARK_RADIUS,
|
||||||
color
|
color
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
// super.getChildren().add(new Circle(0, 0, MARK_RADIUS, color));
|
||||||
|
// super.getChildren().get(1).setLayoutX(-(points[1].getX() - points[0].getX()) / 2d);
|
||||||
|
// super.getChildren().get(1).setLayoutY(-(points[1].getY() - points[0].getY()) / 2d);
|
||||||
Line line = new Line(
|
Line line = new Line(
|
||||||
0,
|
(points[1].getX() - points[0].getX()) / 2d,
|
||||||
0,
|
(points[1].getY() - points[0].getY()) / 2d,
|
||||||
points[1].getX() - points[0].getX(),
|
-(points[1].getX() - points[0].getX()) / 2d,
|
||||||
points[1].getY() - points[0].getY()
|
-(points[1].getY() - points[0].getY()) / 2d
|
||||||
);
|
);
|
||||||
line.setStrokeWidth(LINE_THICKNESS);
|
line.setStrokeWidth(LINE_THICKNESS);
|
||||||
|
line.setStroke(color);
|
||||||
if (mark.getMarkType() == MarkType.OPEN_GATE) {
|
if (mark.getMarkType() == MarkType.OPEN_GATE) {
|
||||||
line.getStrokeDashArray().addAll(DASHED_GAP_LEN, DASHED_LINE_LEN);
|
line.getStrokeDashArray().addAll(DASHED_GAP_LEN, DASHED_LINE_LEN);
|
||||||
}
|
}
|
||||||
super.getChildren().add(line);
|
super.getChildren().add(line);
|
||||||
nodePixelVelocitiesX = new double[2];
|
nodePixelVelocitiesX = new double[]{0d,0d};
|
||||||
nodePixelVelocitiesY = new double[2];
|
nodePixelVelocitiesY = new double[]{0d,0d};
|
||||||
nodeDestinations = new Point2D[2];
|
nodeDestinations = new Point2D[]{
|
||||||
|
new Point2D(super.getChildren().get(0).getLayoutX(), super.getChildren().get(0).getLayoutY()),
|
||||||
|
new Point2D(super.getChildren().get(1).getLayoutX(), super.getChildren().get(1).getLayoutY())
|
||||||
|
};
|
||||||
|
// nodeDestinations = new Point2D[]{new Point2D(0,0), new Point2D(0,0)};
|
||||||
|
// System.out.println("super.getChildren().get(0).getLayoutX() = " + super.getChildren().get(0).getLayoutX());
|
||||||
|
// System.out.println("super.getChildren().get(0).getLayoutY() = " + super.getChildren().get(0).getLayoutY());
|
||||||
|
// System.out.println("super.getChildren().get(1).getLayoutX() = " + super.getChildren().get(1).getLayoutX());
|
||||||
|
// System.out.println("super.getChildren().get(1).getLayoutY() = " + super.getChildren().get(1).getLayoutY());
|
||||||
}
|
}
|
||||||
moveTo(points[0].getX(), points[0].getY());
|
moveTo(points[0].getX(), points[0].getY());
|
||||||
|
// System.out.println("OKAY HERE IS A MARK");
|
||||||
|
// System.out.println("super.getLayoutX() = " + super.getLayoutX());
|
||||||
|
// System.out.println("super.getLayoutY() = " + super.getLayoutY());
|
||||||
|
// System.out.println("super.getChildren().get(0).getLayoutX() = " + super.getChildren().get(0).getLayoutX());
|
||||||
|
// System.out.println("super.getChildren().get(0).getLayoutY() = " + super.getChildren().get(0).getLayoutY());
|
||||||
|
// pixelVelocityX = 0;
|
||||||
|
// pixelVelocityY = 0;
|
||||||
|
// rotationalVelocity = 0;
|
||||||
|
// rotationalGoal = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDestination (double x, double y, double rotation, int... raceIds) {
|
public void setDestination (double x, double y, double rotation, int... raceIds) {
|
||||||
@@ -118,13 +154,14 @@ public class MarkGroup extends RaceObject {
|
|||||||
|
|
||||||
public void rotateTo (double rotation) {
|
public void rotateTo (double rotation) {
|
||||||
super.getTransforms().clear();
|
super.getTransforms().clear();
|
||||||
super.getTransforms().add(
|
// super.getTransforms().add(
|
||||||
new Rotate(
|
// new Rotate(
|
||||||
rotation,
|
// rotation,
|
||||||
super.getChildren().get(1).getLayoutX() - super.getChildren().get(0).getLayoutX(),
|
// super.getChildren().get(1).getLayoutX() - super.getChildren().get(0).getLayoutX(),
|
||||||
super.getChildren().get(1).getLayoutY() - super.getChildren().get(0).getLayoutY()
|
// super.getChildren().get(1).getLayoutY() - super.getChildren().get(0).getLayoutY()
|
||||||
)
|
// )
|
||||||
);
|
// );
|
||||||
|
super.getTransforms().add(new Rotate(rotation, 0 , 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updatePosition (double timeInterval) {
|
public void updatePosition (double timeInterval) {
|
||||||
@@ -137,7 +174,7 @@ public class MarkGroup extends RaceObject {
|
|||||||
|
|
||||||
public void moveGroupBy (double x, double y, double rotation) {
|
public void moveGroupBy (double x, double y, double rotation) {
|
||||||
super.setLayoutX(super.getLayoutX() + x);
|
super.setLayoutX(super.getLayoutX() + x);
|
||||||
super.setLayoutY(super.getOpacity() + y);
|
super.setLayoutY(super.getLayoutY() + y);
|
||||||
rotateTo(rotation + currentRotation);
|
rotateTo(rotation + currentRotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,11 +17,11 @@ public class StreamPacket {
|
|||||||
this.messageLength = messageLength;
|
this.messageLength = messageLength;
|
||||||
this.timeStamp = timeStamp;
|
this.timeStamp = timeStamp;
|
||||||
this.payload = payload;
|
this.payload = payload;
|
||||||
System.out.println("type = " + this.type.toString());
|
//System.out.println("type = " + this.type.toString());
|
||||||
//switch the packet type to deal with what ever specific packet you want to deal with
|
//switch the packet type to deal with what ever specific packet you want to deal with
|
||||||
if (this.type == PacketType.XML_MESSAGE){
|
if (this.type == PacketType.XML_MESSAGE){
|
||||||
System.out.println("--------");
|
//System.out.println("--------");
|
||||||
System.out.println(new String(payload));
|
//System.out.println(new String(payload));
|
||||||
StreamParser.parsePacket(this);
|
StreamParser.parsePacket(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,7 +96,8 @@ public class StreamParser extends Thread{
|
|||||||
extractAvgWind(packet);
|
extractAvgWind(packet);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
System.out.println(packet.getType().toString());
|
break;
|
||||||
|
//System.out.println(packet.getType().toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user