|
|
|
@ -50,14 +50,16 @@ public class ResizableRaceCanvas extends Canvas {
|
|
|
|
gc.fillOval(graphCoordinate.getX(), graphCoordinate.getY(), 10, 10);
|
|
|
|
gc.fillOval(graphCoordinate.getX(), graphCoordinate.getY(), 10, 10);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void displayArrow(GraphCoordinate coordinate, Paint paint){
|
|
|
|
public void displayArrow(GraphCoordinate coordinate, int angle){
|
|
|
|
rotate(10, 30,30);
|
|
|
|
gc.save();
|
|
|
|
gc.fillPolygon(new double[]{0, 6, 12, 8, 8, 4, 4},
|
|
|
|
rotate(angle, coordinate.getX(),coordinate.getY());
|
|
|
|
new double[]{15, 0, 15, 15, 40, 40, 15},
|
|
|
|
gc.fillPolygon(new double[]{coordinate.getX()-12, coordinate.getX()-6, coordinate.getX(), coordinate.getX()-4, coordinate.getX()-4, coordinate.getX()-8, coordinate.getX()-8},
|
|
|
|
|
|
|
|
new double[]{coordinate.getY()-5, coordinate.getY()-20, coordinate.getY()-5, coordinate.getY()-5, coordinate.getY()+20, coordinate.getY()+20, coordinate.getY()-5},
|
|
|
|
7);
|
|
|
|
7);
|
|
|
|
gc.restore();
|
|
|
|
gc.restore();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void rotate(double angle, double px, double py) {
|
|
|
|
private void rotate(double angle, double px, double py) {
|
|
|
|
Rotate r = new Rotate(angle, px, py);
|
|
|
|
Rotate r = new Rotate(angle, px, py);
|
|
|
|
gc.setTransform(r.getMxx(), r.getMyx(), r.getMxy(), r.getMyy(), r.getTx(), r.getTy());
|
|
|
|
gc.setTransform(r.getMxx(), r.getMyx(), r.getMxy(), r.getMyy(), r.getTx(), r.getTy());
|
|
|
|
@ -75,29 +77,31 @@ public class ResizableRaceCanvas extends Canvas {
|
|
|
|
System.out.println("Drawing");
|
|
|
|
System.out.println("Drawing");
|
|
|
|
gc.clearRect(0, 0, width, height);
|
|
|
|
gc.clearRect(0, 0, width, height);
|
|
|
|
//boat
|
|
|
|
//boat
|
|
|
|
GraphCoordinate boat1coord = map.convertGPS(32.296577, -64.854304);
|
|
|
|
GraphCoordinate boat1coord = this.map.convertGPS(32.296577, -64.854304);
|
|
|
|
displayBoat(boat1coord, Color.AQUAMARINE);
|
|
|
|
displayBoat(boat1coord, Color.AQUAMARINE);
|
|
|
|
//finish line
|
|
|
|
//finish line
|
|
|
|
gc.setLineWidth(2);
|
|
|
|
gc.setLineWidth(2);
|
|
|
|
GraphCoordinate finishLineCoord1 = map.convertGPS(32.317379, -64.839291);
|
|
|
|
GraphCoordinate finishLineCoord1 = this.map.convertGPS(32.317379, -64.839291);
|
|
|
|
GraphCoordinate finishLineCoord2 = map.convertGPS(32.317257, -64.836260);
|
|
|
|
GraphCoordinate finishLineCoord2 = this.map.convertGPS(32.317257, -64.836260);
|
|
|
|
displayLine(finishLineCoord1, finishLineCoord2, Color.DARKRED);
|
|
|
|
displayLine(finishLineCoord1, finishLineCoord2, Color.DARKRED);
|
|
|
|
//marks
|
|
|
|
//marks
|
|
|
|
GraphCoordinate markCoord = map.convertGPS(32.293039, -64.843983);
|
|
|
|
GraphCoordinate markCoord = this.map.convertGPS(32.293039, -64.843983);
|
|
|
|
GraphCoordinate southGate1 = map.convertGPS(32.284680, -64.850045);
|
|
|
|
GraphCoordinate southGate1 = this.map.convertGPS(32.284680, -64.850045);
|
|
|
|
GraphCoordinate southGate2 = map.convertGPS(32.280164, -64.847591);
|
|
|
|
GraphCoordinate southGate2 = this.map.convertGPS(32.280164, -64.847591);
|
|
|
|
GraphCoordinate northGate1 = map.convertGPS(32.309693, -64.835249);
|
|
|
|
GraphCoordinate northGate1 = this.map.convertGPS(32.309693, -64.835249);
|
|
|
|
GraphCoordinate northGate2 = map.convertGPS(32.308046, -64.831785);
|
|
|
|
GraphCoordinate northGate2 = this.map.convertGPS(32.308046, -64.831785);
|
|
|
|
displayBoat(boat1coord, Color.AQUAMARINE);
|
|
|
|
displayBoat(boat1coord, Color.AQUAMARINE);
|
|
|
|
displayBoat(markCoord, Color.GOLD);
|
|
|
|
displayBoat(markCoord, Color.GOLD);
|
|
|
|
displayLine(southGate1, southGate2, Color.DARKCYAN);
|
|
|
|
displayLine(southGate1, southGate2, Color.DARKCYAN);
|
|
|
|
displayLine(northGate1, northGate2, Color.DARKVIOLET);
|
|
|
|
displayLine(northGate1, northGate2, Color.DARKVIOLET);
|
|
|
|
//start line
|
|
|
|
//start line
|
|
|
|
GraphCoordinate startline1 = map.convertGPS(32.296577, -64.854304);
|
|
|
|
GraphCoordinate startline1 = this.map.convertGPS(32.296577, -64.854304);
|
|
|
|
GraphCoordinate startline2 = map.convertGPS(32.293771, -64.855242);
|
|
|
|
GraphCoordinate startline2 = this.map.convertGPS(32.293771, -64.855242);
|
|
|
|
displayLine(startline1, startline2, Color.GREEN);
|
|
|
|
displayLine(startline1, startline2, Color.GREEN);
|
|
|
|
|
|
|
|
|
|
|
|
displayArrow(new GraphCoordinate(100, 100), Color.BLUEVIOLET);
|
|
|
|
//display wind direction arrow - specify origin point and angle
|
|
|
|
|
|
|
|
displayPoint(this.map.convertGPS(32.293771, -64.855242), Color.BLACK);
|
|
|
|
|
|
|
|
displayArrow(new GraphCoordinate(500, 20), 100);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
|