mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Wakes still broken. Implemented dashed lines that track the progress of individual boats.
#implement #story[483]
This commit is contained in:
@@ -179,7 +179,10 @@ public class CanvasController {
|
|||||||
//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);
|
||||||
|
|
||||||
|
//raceObject.setDestination(p2d.getX(), p2d.getY(), id);
|
||||||
}
|
}
|
||||||
StreamParser.boatPositions.remove((long) id);
|
StreamParser.boatPositions.remove((long) id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package seng302.models;
|
package seng302.models;
|
||||||
|
|
||||||
|
import javafx.geometry.Point2D;
|
||||||
import javafx.scene.Node;
|
import javafx.scene.Node;
|
||||||
import javafx.scene.paint.Color;
|
import javafx.scene.paint.Color;
|
||||||
|
import javafx.scene.shape.Line;
|
||||||
import javafx.scene.shape.Polygon;
|
import javafx.scene.shape.Polygon;
|
||||||
import javafx.scene.text.Text;
|
import javafx.scene.text.Text;
|
||||||
import javafx.scene.transform.Rotate;
|
import javafx.scene.transform.Rotate;
|
||||||
@@ -24,11 +26,18 @@ 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 = 80;
|
private static int WAKE_FRAME_INTERVAL = 30;
|
||||||
|
private double framesForNewLine = 0;
|
||||||
|
private Point2D lastPoint;
|
||||||
|
|
||||||
private Boat boat;
|
private Boat boat;
|
||||||
private int wakeCounter = WAKE_FRAME_INTERVAL;
|
private int wakeCounter = WAKE_FRAME_INTERVAL;
|
||||||
private List<Wake> wakes = new ArrayList<>();
|
private List<Wake> wakes = new ArrayList<>();
|
||||||
|
private List<Line> lines = new ArrayList<>();
|
||||||
|
private Polygon boatPoly;
|
||||||
|
private Polygon wakePoly;
|
||||||
|
private Text teamNameObject;
|
||||||
|
private Text velocityObject;
|
||||||
|
|
||||||
public BoatGroup (Boat boat, Color color){
|
public BoatGroup (Boat boat, Color color){
|
||||||
this.boat = boat;
|
this.boat = boat;
|
||||||
@@ -41,22 +50,21 @@ public class BoatGroup extends RaceObject{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initChildren (Color color, double... points) {
|
private void initChildren (Color color, double... points) {
|
||||||
Polygon boatPoly = new Polygon(points);
|
boatPoly = new Polygon(points);
|
||||||
boatPoly.setFill(color);
|
boatPoly.setFill(color);
|
||||||
|
// boatPoly.setLayoutX(0);
|
||||||
|
// boatPoly.setLayoutY(0);
|
||||||
|
// boatPoly.relocate(boatPoly.getLayoutX(), boatPoly.getLayoutY());
|
||||||
|
|
||||||
Polygon wake = new Polygon(
|
wakePoly = new Polygon(
|
||||||
5.0,0.0,
|
5.0,0.0,
|
||||||
10.0, boat.getVelocity() * VELOCITY_WAKE_RATIO,
|
10.0, boat.getVelocity() * VELOCITY_WAKE_RATIO,
|
||||||
0.0, boat.getVelocity() * VELOCITY_WAKE_RATIO
|
0.0, boat.getVelocity() * VELOCITY_WAKE_RATIO
|
||||||
);
|
);
|
||||||
wake.setFill(Color.DARKBLUE);
|
wakePoly.setFill(Color.DARKBLUE);
|
||||||
|
|
||||||
Text teamNameObject = new Text(boat.getShortName());
|
teamNameObject = new Text(boat.getShortName());
|
||||||
Text velocityObject = new Text(String.valueOf(boat.getVelocity()));
|
velocityObject = new Text(String.valueOf(boat.getVelocity()));
|
||||||
|
|
||||||
boatPoly.setLayoutX(0);
|
|
||||||
boatPoly.setLayoutY(0);
|
|
||||||
boatPoly.relocate(boatPoly.getLayoutX(), boatPoly.getLayoutY());
|
|
||||||
|
|
||||||
teamNameObject.setX(TEAMNAME_X_OFFSET);
|
teamNameObject.setX(TEAMNAME_X_OFFSET);
|
||||||
teamNameObject.setY(TEAMNAME_Y_OFFSET);
|
teamNameObject.setY(TEAMNAME_Y_OFFSET);
|
||||||
@@ -66,7 +74,7 @@ public class BoatGroup extends RaceObject{
|
|||||||
velocityObject.setY(VELOCITY_Y_OFFSET);
|
velocityObject.setY(VELOCITY_Y_OFFSET);
|
||||||
velocityObject.relocate(velocityObject.getX(), velocityObject.getY());
|
velocityObject.relocate(velocityObject.getX(), velocityObject.getY());
|
||||||
|
|
||||||
super.getChildren().addAll(boatPoly, teamNameObject, velocityObject);
|
super.getChildren().addAll(wakePoly, boatPoly, teamNameObject, velocityObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initChildren (Color color) {
|
private void initChildren (Color color) {
|
||||||
@@ -75,14 +83,21 @@ public class BoatGroup extends RaceObject{
|
|||||||
BOAT_WIDTH, BOAT_HEIGHT,
|
BOAT_WIDTH, BOAT_HEIGHT,
|
||||||
0.0, BOAT_HEIGHT);
|
0.0, BOAT_HEIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Moves the boat and its children annotations from its current coordinates by specified amounts.
|
* Moves the boat and its children annotations from its current coordinates by specified amounts.
|
||||||
* @param dx The amount to move the X coordinate by
|
* @param dx The amount to move the X coordinate by
|
||||||
* @param dy The amount to move the Y coordinate by
|
* @param dy The amount to move the Y coordinate by
|
||||||
*/
|
*/
|
||||||
public void moveGroupBy(double dx, double dy, double rotation) {
|
public void moveGroupBy(double dx, double dy, double rotation) {
|
||||||
super.setLayoutX(super.getLayoutX() + dx);
|
boatPoly.setLayoutX(boatPoly.getLayoutX() + dx);
|
||||||
super.setLayoutY(super.getLayoutY() + dy);
|
boatPoly.setLayoutY(boatPoly.getLayoutY() + dy);
|
||||||
|
teamNameObject.setLayoutX(teamNameObject.getLayoutX() + dx);
|
||||||
|
teamNameObject.setLayoutY(teamNameObject.getLayoutY() + dy);
|
||||||
|
velocityObject.setLayoutX(velocityObject.getLayoutX() + dx);
|
||||||
|
velocityObject.setLayoutY(velocityObject.getLayoutY() + dy);
|
||||||
|
wakePoly.setLayoutX(wakePoly.getLayoutX() + dx);
|
||||||
|
wakePoly.setLayoutY(wakePoly.getLayoutY() + dy);
|
||||||
rotateTo(currentRotation + rotation);
|
rotateTo(currentRotation + rotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,11 +109,18 @@ public class BoatGroup extends RaceObject{
|
|||||||
public void moveTo (double x, double y, double rotation) {
|
public void moveTo (double x, double y, double rotation) {
|
||||||
rotateTo(rotation);
|
rotateTo(rotation);
|
||||||
moveTo(x, y);
|
moveTo(x, y);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void moveTo (double x, double y) {
|
public void moveTo (double x, double y) {
|
||||||
super.setLayoutX(x);
|
boatPoly.setLayoutX(x);
|
||||||
super.setLayoutY(y);
|
boatPoly.setLayoutY(y);
|
||||||
|
teamNameObject.setLayoutX(x);
|
||||||
|
teamNameObject.setLayoutY(y);
|
||||||
|
velocityObject.setLayoutX(x);
|
||||||
|
velocityObject.setLayoutY(y);
|
||||||
|
wakePoly.setLayoutX(x);
|
||||||
|
wakePoly.setLayoutY(y);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updatePosition (double timeInterval) {
|
public void updatePosition (double timeInterval) {
|
||||||
@@ -123,6 +145,8 @@ public class BoatGroup extends RaceObject{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (wakeCounter-- == 0) {
|
if (wakeCounter-- == 0) {
|
||||||
|
// if (boat.getShortName().equals("BAR"))
|
||||||
|
// System.out.println("thinking");
|
||||||
wakeCounter = WAKE_FRAME_INTERVAL;
|
wakeCounter = WAKE_FRAME_INTERVAL;
|
||||||
if (pixelVelocityX > 0 && pixelVelocityY > 0) {
|
if (pixelVelocityX > 0 && pixelVelocityY > 0) {
|
||||||
// super.getChildren().add(
|
// super.getChildren().add(
|
||||||
@@ -131,33 +155,37 @@ public class BoatGroup extends RaceObject{
|
|||||||
// )
|
// )
|
||||||
// );
|
// );
|
||||||
Wake wake = new Wake(
|
Wake wake = new Wake(
|
||||||
super.getLayoutX(),
|
boatPoly.getLayoutX(),
|
||||||
super.getLayoutY(),
|
boatPoly.getLayoutY(),
|
||||||
pixelVelocityX,
|
pixelVelocityX,
|
||||||
pixelVelocityY
|
pixelVelocityY,
|
||||||
|
currentRotation
|
||||||
);
|
);
|
||||||
super.getChildren().add(wake);
|
super.getChildren().add(wake);
|
||||||
wakes.add(wake);
|
wakes.add(wake);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if (framesForNewLine == 0) {
|
||||||
|
framesForNewLine = 121;
|
||||||
|
if (lastPoint != null) {
|
||||||
|
Line l = new Line(lastPoint.getX(), lastPoint.getY(), boatPoly.getLayoutX(), boatPoly.getLayoutY());
|
||||||
|
l.getStrokeDashArray().setAll(4d, 4d);
|
||||||
|
lines.add(l);
|
||||||
|
super.getChildren().add(l);
|
||||||
|
}
|
||||||
|
lastPoint = new Point2D(boatPoly.getLayoutX(), boatPoly.getLayoutY());
|
||||||
|
}
|
||||||
|
framesForNewLine -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
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");
|
//System.out.println("MADE IT");
|
||||||
if (hasRaceId(raceIds)) {
|
if (hasRaceId(raceIds)) {
|
||||||
this.pixelVelocityX = (newXValue - super.getLayoutX()) / expectedUpdateInterval;
|
this.pixelVelocityX = (newXValue - boatPoly.getLayoutX()) / expectedUpdateInterval;
|
||||||
this.pixelVelocityY = (newYValue - super.getLayoutY()) / expectedUpdateInterval;
|
this.pixelVelocityY = (newYValue - boatPoly.getLayoutY()) / expectedUpdateInterval;
|
||||||
this.rotationalGoal = rotation;
|
this.rotationalGoal = rotation;
|
||||||
if (Math.abs(rotationalGoal - currentRotation) > 180) {
|
calculateRotationalVelocity();
|
||||||
if (rotationalGoal - currentRotation >= 0) {
|
|
||||||
this.rotationalVelocity = ((rotationalGoal - currentRotation) - 360) / expectedUpdateInterval;
|
|
||||||
} else {
|
|
||||||
this.rotationalVelocity = (360 + (rotationalGoal - currentRotation)) / expectedUpdateInterval;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.rotationalVelocity = (rotationalGoal - currentRotation) / expectedUpdateInterval;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,15 +194,15 @@ public class BoatGroup extends RaceObject{
|
|||||||
double rotation = Math.abs(
|
double rotation = Math.abs(
|
||||||
Math.toDegrees(
|
Math.toDegrees(
|
||||||
Math.atan(
|
Math.atan(
|
||||||
(newYValue - super.getLayoutY()) / (newXValue - super.getLayoutX())
|
(newYValue - boatPoly.getLayoutY()) / (newXValue - boatPoly.getLayoutX())
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
if (super.getLayoutY() >= newYValue && super.getLayoutX() <= newXValue)
|
if (boatPoly.getLayoutY() >= newYValue && boatPoly.getLayoutX() <= newXValue)
|
||||||
rotation = 90 - rotation;
|
rotation = 90 - rotation;
|
||||||
else if (super.getLayoutY() < newYValue && super.getLayoutX() <= newXValue)
|
else if (boatPoly.getLayoutY() < newYValue && boatPoly.getLayoutX() <= newXValue)
|
||||||
rotation = 90 + rotation;
|
rotation = 90 + rotation;
|
||||||
else if (super.getLayoutY() >= newYValue && super.getLayoutX() > newXValue)
|
else if (boatPoly.getLayoutY() >= newYValue && boatPoly.getLayoutX() > newXValue)
|
||||||
rotation = 270 + rotation;
|
rotation = 270 + rotation;
|
||||||
else
|
else
|
||||||
rotation = 270 - rotation;
|
rotation = 270 - rotation;
|
||||||
@@ -183,13 +211,10 @@ public class BoatGroup extends RaceObject{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void rotateTo (double rotation) {
|
public void rotateTo (double rotation) {
|
||||||
Node boatPoly = super.getChildren().get(0);
|
|
||||||
boatPoly.getTransforms().clear();
|
boatPoly.getTransforms().clear();
|
||||||
boatPoly.getTransforms().add(new Rotate(rotation, BOAT_WIDTH/2, 0));
|
boatPoly.getTransforms().add(new Rotate(rotation, 0, 0));
|
||||||
Node wake = super.getChildren().get(1);
|
wakePoly.getTransforms().clear();
|
||||||
wake.getTransforms().clear();
|
wakePoly.getTransforms().add(new Rotate(rotation, 0, 0));
|
||||||
wake.getTransforms().add(new Translate(0, BOAT_HEIGHT));
|
|
||||||
wake.getTransforms().add(new Rotate(rotation, BOAT_WIDTH/2, -BOAT_HEIGHT));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void forceRotation () {
|
public void forceRotation () {
|
||||||
@@ -197,8 +222,13 @@ public class BoatGroup extends RaceObject{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void toggleAnnotations () {
|
public void toggleAnnotations () {
|
||||||
for (Node node : super.getChildren().subList(1, super.getChildren().size())) {
|
teamNameObject.setVisible(!teamNameObject.isVisible());
|
||||||
node.setVisible(false);
|
velocityObject.setVisible(!velocityObject.isVisible());
|
||||||
|
for (Wake wake : wakes) {
|
||||||
|
wake.setVisible(!wake.isVisible());
|
||||||
|
}
|
||||||
|
for (Line line : lines) {
|
||||||
|
line.setVisible(!line.isVisible());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import javafx.scene.Group;
|
|||||||
public abstract class RaceObject extends Group {
|
public abstract class RaceObject extends Group {
|
||||||
|
|
||||||
//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.
|
||||||
protected static double expectedUpdateInterval = 2000;
|
protected static double expectedUpdateInterval = 200;
|
||||||
|
|
||||||
protected double rotationalGoal;
|
protected double rotationalGoal;
|
||||||
protected double currentRotation;
|
protected double currentRotation;
|
||||||
@@ -33,6 +33,18 @@ public abstract class RaceObject extends Group {
|
|||||||
RaceObject.expectedUpdateInterval = expectedUpdateInterval;
|
RaceObject.expectedUpdateInterval = expectedUpdateInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void calculateRotationalVelocity () {
|
||||||
|
if (Math.abs(rotationalGoal - currentRotation) > 180) {
|
||||||
|
if (rotationalGoal - currentRotation >= 0) {
|
||||||
|
this.rotationalVelocity = ((rotationalGoal - currentRotation) - 360) / expectedUpdateInterval;
|
||||||
|
} else {
|
||||||
|
this.rotationalVelocity = (360 + (rotationalGoal - currentRotation)) / expectedUpdateInterval;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.rotationalVelocity = (rotationalGoal - currentRotation) / expectedUpdateInterval;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public abstract void setDestination (double x, double y, double rotation, int... raceIds);
|
public abstract void setDestination (double x, double y, double rotation, int... raceIds);
|
||||||
|
|
||||||
public abstract void setDestination (double x, double y, int... raceIds);
|
public abstract void setDestination (double x, double y, int... raceIds);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package seng302.models;
|
|||||||
import javafx.scene.paint.Color;
|
import javafx.scene.paint.Color;
|
||||||
import javafx.scene.shape.Arc;
|
import javafx.scene.shape.Arc;
|
||||||
import javafx.scene.shape.ArcType;
|
import javafx.scene.shape.ArcType;
|
||||||
|
import javafx.scene.transform.Rotate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by CJIRWIN on 27/04/2017.
|
* Created by CJIRWIN on 27/04/2017.
|
||||||
@@ -10,36 +11,40 @@ 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 = 420;
|
private static int MAX_LIFESPAN = 210;
|
||||||
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 = 120 / MAX_LIFESPAN;
|
||||||
private static double LENGTH_PER_FRAME = 0.08;
|
private static double LENGTH_PER_FRAME = 0.25;
|
||||||
|
|
||||||
private double velocityX;
|
private double velocityX;
|
||||||
private double velocityY;
|
private double velocityY;
|
||||||
private double opacity;
|
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, double rotation) {
|
||||||
super(0, 0, 20, 30, 180, 0);
|
super(startingX + 20, startingY + 30, 20, 30, 180, 0);
|
||||||
//super.setFill(Color.BLUE);
|
//super.setFill(Color.BLUE);
|
||||||
super.setStroke(Color.BLUE);
|
super.setStroke(Color.DEEPSKYBLUE);
|
||||||
super.setType(ArcType.OPEN);
|
super.setType(ArcType.OPEN);
|
||||||
|
super.setFill(new Color(0, 0, 0 ,0));
|
||||||
super.setStrokeWidth(2.0);
|
super.setStrokeWidth(2.0);
|
||||||
this.velocityX = -velocityX / 2;
|
super.getTransforms().add(new Rotate(rotation - 270, startingX + 20, startingY + 20));
|
||||||
this.velocityY = -velocityY / 2;
|
// this.velocityX = -velocityX;
|
||||||
|
// this.velocityY = -velocityY;
|
||||||
|
this.velocityX = 0;
|
||||||
|
this.velocityY = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean updatePosition (double timeInterval) {
|
boolean updatePosition (double timeInterval) {
|
||||||
lifespan--;
|
lifespan--;
|
||||||
//super.setOpacity(LIFESPAN_PER_FRAME * lifespan * super.getOpacity());
|
//super.setOpacity(LIFESPAN_PER_FRAME * lifespan * super.getOpacity());
|
||||||
opacity = LIFESPAN_PER_FRAME * lifespan * opacity;
|
//opacity = LIFESPAN_PER_FRAME * lifespan * opacity;
|
||||||
super.setFill(new Color(0.0f, 0.0f, 1.0f, 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.setLayoutY(super.getLayoutY() + velocityY * timeInterval);
|
super.setLayoutY(super.getLayoutY() + velocityY * timeInterval);
|
||||||
super.setStartAngle(super.getStartAngle() - LENGTH_PER_FRAME);
|
super.setStartAngle(super.getStartAngle() - LENGTH_PER_FRAME);
|
||||||
super.setLength(super.getLength() + LENGTH_PER_FRAME * 2);
|
super.setLength(super.getLength() + LENGTH_PER_FRAME * 2);
|
||||||
return lifespan == 0;
|
return lifespan < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,15 +114,7 @@ public class MarkGroup extends RaceObject {
|
|||||||
public void setDestination (double x, double y, double rotation, int... raceIds) {
|
public void setDestination (double x, double y, double rotation, int... raceIds) {
|
||||||
setDestination(x, y, raceIds);
|
setDestination(x, y, raceIds);
|
||||||
this.rotationalGoal = rotation;
|
this.rotationalGoal = rotation;
|
||||||
if (Math.abs(rotationalGoal - currentRotation) > 180) {
|
calculateRotationalVelocity();
|
||||||
if (rotationalGoal - currentRotation >= 0) {
|
|
||||||
this.rotationalVelocity = ((rotationalGoal - currentRotation) - 360) / expectedUpdateInterval;
|
|
||||||
} else {
|
|
||||||
this.rotationalVelocity = (360 + (rotationalGoal - currentRotation)) / expectedUpdateInterval;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.rotationalVelocity = (rotationalGoal - currentRotation) / expectedUpdateInterval;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDestination (double x, double y, int... raceIds) {
|
public void setDestination (double x, double y, int... raceIds) {
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public class StreamPacket {
|
|||||||
//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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -238,7 +238,7 @@ public class StreamParser extends Thread{
|
|||||||
long lon = bytesToLong(lonBytes);
|
long lon = bytesToLong(lonBytes);
|
||||||
long heading = bytesToLong(headingBytes);
|
long heading = bytesToLong(headingBytes);
|
||||||
|
|
||||||
if ((int)deviceType == 1){
|
if ((int)deviceType == 1 || (int)deviceType == 4){
|
||||||
// System.out.println("boatId = " + boatId);
|
// System.out.println("boatId = " + boatId);
|
||||||
// System.out.println("deviceType = " + (long)deviceType);
|
// System.out.println("deviceType = " + (long)deviceType);
|
||||||
// System.out.println("seq = " + seq);
|
// System.out.println("seq = " + seq);
|
||||||
|
|||||||
Reference in New Issue
Block a user