Implemented redrawing boat with each loop
- Not complete. New gps coordinate needs work around bearing -> azimuth conversion #implement #story[9]
This commit is contained in:
Generated
+7
@@ -18,6 +18,13 @@
|
|||||||
<option name="OPEN_IN_BROWSER" value="true" />
|
<option name="OPEN_IN_BROWSER" value="true" />
|
||||||
<option name="OPTION_INCLUDE_LIBS" value="false" />
|
<option name="OPTION_INCLUDE_LIBS" value="false" />
|
||||||
</component>
|
</component>
|
||||||
|
<component name="MavenProjectsManager">
|
||||||
|
<option name="originalFiles">
|
||||||
|
<list>
|
||||||
|
<option value="$PROJECT_DIR$/pom.xml" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/out" />
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
</component>
|
</component>
|
||||||
|
|||||||
@@ -8,12 +8,9 @@ import javafx.scene.layout.BorderPane;
|
|||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import seng302.Controllers.Controller;
|
import seng302.Controllers.Controller;
|
||||||
import seng302.Controllers.MainController;
|
import seng302.Controllers.MainController;
|
||||||
import seng302.Model.BoatInRace;
|
|
||||||
import seng302.Model.ConstantVelocityRace;
|
|
||||||
import seng302.Model.Leg;
|
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Scanner;
|
|
||||||
|
|
||||||
public class App extends Application
|
public class App extends Application
|
||||||
{
|
{
|
||||||
@@ -26,42 +23,6 @@ public class App extends Application
|
|||||||
|
|
||||||
|
|
||||||
launch(args);
|
launch(args);
|
||||||
/* SPRINT 1 Leftovers
|
|
||||||
int timescale = 0; // Scale 5 min to 1 min, 1min = 200 5 min = 1000
|
|
||||||
|
|
||||||
Scanner sc = new Scanner(System.in);
|
|
||||||
while(timescale != 1 && timescale != 5) {
|
|
||||||
System.out.println("Enter whether you wish the race to last 1 or 5 minutes.");
|
|
||||||
String input = sc.nextLine();
|
|
||||||
try {
|
|
||||||
timescale = Integer.parseInt(input);
|
|
||||||
}catch (Exception e){
|
|
||||||
System.out.println("Please Enter a 1 or 5.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
timescale = timescale == 1 ? 200: 1000; //200ms = 1000ms if 1 minute elapse else 1000ms = 1000ms if 5 minutes
|
|
||||||
|
|
||||||
Boat[] boats = {
|
|
||||||
new Boat("ORACLE TEAM USA", 11),
|
|
||||||
new Boat("Artemis Racing", 10),
|
|
||||||
new Boat("Emirates Team New Zealand", 12),
|
|
||||||
new Boat("Groupama Team France", 11.5),
|
|
||||||
new Boat("Land Rover BAR", 11),
|
|
||||||
new Boat("SoftBank Team Japan", 10.5)
|
|
||||||
};
|
|
||||||
|
|
||||||
Leg[] marks = {
|
|
||||||
new Leg("Start", 0, 0, 295),
|
|
||||||
new Leg("Mark", 360, 360, 250),
|
|
||||||
new Leg("Leeward Gate", 965, 630, 790),
|
|
||||||
new Leg("Windward Gate", 1865, 205, 0),
|
|
||||||
new Leg("Leeward Gate", 2765, 630, 790),
|
|
||||||
new Leg("Finish", 3035, 475, 1015)
|
|
||||||
};
|
|
||||||
|
|
||||||
Race race = new ConstantVelocityRace(boats, marks, timescale);
|
|
||||||
race.simulateRace();*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -5,40 +5,34 @@ import javafx.beans.property.ReadOnlyObjectWrapper;
|
|||||||
import javafx.beans.value.ObservableValue;
|
import javafx.beans.value.ObservableValue;
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.canvas.Canvas;
|
|
||||||
import javafx.scene.canvas.GraphicsContext;
|
import javafx.scene.canvas.GraphicsContext;
|
||||||
import javafx.scene.control.TableColumn;
|
import javafx.scene.control.TableColumn;
|
||||||
import javafx.scene.control.TableView;
|
import javafx.scene.control.TableView;
|
||||||
import javafx.scene.control.cell.PropertyValueFactory;
|
import javafx.scene.control.cell.PropertyValueFactory;
|
||||||
import javafx.scene.layout.AnchorPane;
|
import javafx.scene.layout.AnchorPane;
|
||||||
import javafx.scene.layout.GridPane;
|
|
||||||
import javafx.scene.layout.StackPane;
|
|
||||||
import javafx.scene.paint.Color;
|
import javafx.scene.paint.Color;
|
||||||
import javafx.scene.paint.Paint;
|
|
||||||
import javafx.util.Callback;
|
import javafx.util.Callback;
|
||||||
import seng302.GPSCoordinate;
|
import seng302.GPSCoordinate;
|
||||||
import javafx.scene.transform.Rotate;
|
|
||||||
import seng302.GraphCoordinate;
|
|
||||||
import seng302.Model.ResizableRaceCanvas;
|
import seng302.Model.ResizableRaceCanvas;
|
||||||
import seng302.Model.*;
|
import seng302.Model.*;
|
||||||
import seng302.RaceMap;
|
import seng302.RaceMap;
|
||||||
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Observable;
|
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Gondr on 15/03/2017.
|
* Created by Gondr on 15/03/2017.
|
||||||
*/
|
*/
|
||||||
public class RaceController extends Controller{
|
public class RaceController extends Controller{
|
||||||
@FXML
|
|
||||||
TableView boatInfoTable;
|
|
||||||
@FXML
|
@FXML
|
||||||
AnchorPane canvasBase;
|
AnchorPane canvasBase;
|
||||||
@FXML
|
@FXML
|
||||||
ResizableRaceCanvas raceMap;
|
ResizableRaceCanvas raceMap;
|
||||||
|
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
TableView boatInfoTable;
|
||||||
@FXML
|
@FXML
|
||||||
TableColumn<BoatInRace, String> boatPlacingColumn;
|
TableColumn<BoatInRace, String> boatPlacingColumn;
|
||||||
@FXML
|
@FXML
|
||||||
@@ -49,6 +43,13 @@ public class RaceController extends Controller{
|
|||||||
private GraphicsContext gc;
|
private GraphicsContext gc;
|
||||||
private RaceMap map;
|
private RaceMap map;
|
||||||
|
|
||||||
|
|
||||||
|
public void updateMap(BoatInRace[] boats) {
|
||||||
|
raceMap.setBoats(boats);
|
||||||
|
raceMap.drawRaceMap();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void updateInfoTable(Race race) {
|
public void updateInfoTable(Race race) {
|
||||||
boatInfoTable.getItems().clear();
|
boatInfoTable.getItems().clear();
|
||||||
boatInfoTable.setItems(FXCollections.observableArrayList(race.getStartingBoats()));
|
boatInfoTable.setItems(FXCollections.observableArrayList(race.getStartingBoats()));
|
||||||
@@ -65,17 +66,23 @@ public class RaceController extends Controller{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize(URL location, ResourceBundle resources) {
|
public void initialize(URL location, ResourceBundle resources) {
|
||||||
|
|
||||||
|
BoatInRace boat = new BoatInRace("NZ", 100);
|
||||||
|
boat.setColour(Color.DARKVIOLET);
|
||||||
|
boat.setCurrentPosition(new GPSCoordinate(0, 0));
|
||||||
|
BoatInRace[] boats = new BoatInRace[] {boat};
|
||||||
|
|
||||||
raceMap = new ResizableRaceCanvas();
|
raceMap = new ResizableRaceCanvas();
|
||||||
raceMap.widthProperty().bind(canvasBase.widthProperty());
|
raceMap.widthProperty().bind(canvasBase.widthProperty());
|
||||||
raceMap.heightProperty().bind(canvasBase.heightProperty());
|
raceMap.heightProperty().bind(canvasBase.heightProperty());
|
||||||
raceMap.draw();
|
raceMap.setBoats(boats);
|
||||||
|
raceMap.drawRaceMap();
|
||||||
|
|
||||||
canvasBase.getChildren().add(raceMap);
|
canvasBase.getChildren().add(raceMap);
|
||||||
|
|
||||||
BoatInRace boat = new BoatInRace("NZ", 1000);
|
|
||||||
BoatInRace[] boats = new BoatInRace[] {boat};
|
|
||||||
ArrayList<Leg> legs = new ArrayList<>();
|
ArrayList<Leg> legs = new ArrayList<>();
|
||||||
legs.add(new Leg("Start", 1, new GPSCoordinate(0,0), new GPSCoordinate(1,1), 0));
|
legs.add(new Leg("Start", 10, new GPSCoordinate(32.296577, -64.854304), new GPSCoordinate(32.296576, -64.854304), 0));
|
||||||
legs.add(new Leg("Mark", 1, new GPSCoordinate(0,0), new GPSCoordinate(1,1), 1));
|
legs.add(new Leg("Mark", 50, new GPSCoordinate(32.296577, -64.854304), new GPSCoordinate(32.308046, -64.831785), 1));
|
||||||
|
|
||||||
ConstantVelocityRace race = new ConstantVelocityRace(boats, legs, this);
|
ConstantVelocityRace race = new ConstantVelocityRace(boats, legs, this);
|
||||||
|
|
||||||
|
|||||||
@@ -18,5 +18,9 @@ public class GPSCoordinate {
|
|||||||
return longitude;
|
return longitude;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return String.format("Latitude: %f Longitude: %f", latitude, longitude);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package seng302.Model;
|
package seng302.Model;
|
||||||
|
|
||||||
|
import javafx.scene.paint.Color;
|
||||||
import seng302.GPSCoordinate;
|
import seng302.GPSCoordinate;
|
||||||
import seng302.GraphCoordinate;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by esa46 on 15/03/17.
|
* Created by esa46 on 15/03/17.
|
||||||
@@ -12,6 +14,23 @@ public class BoatInRace extends Boat {
|
|||||||
private double distanceTravelledInLeg;
|
private double distanceTravelledInLeg;
|
||||||
private GPSCoordinate currentPosition;
|
private GPSCoordinate currentPosition;
|
||||||
private long timeFinished;
|
private long timeFinished;
|
||||||
|
private Color colour;
|
||||||
|
|
||||||
|
public GPSCoordinate getCurrentPosition() {
|
||||||
|
return currentPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getTimeFinished() {
|
||||||
|
return timeFinished;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Color getColour() {
|
||||||
|
return colour;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColour(Color colour) {
|
||||||
|
this.colour = colour;
|
||||||
|
}
|
||||||
|
|
||||||
public void setTimeFinished(long timeFinished) {
|
public void setTimeFinished(long timeFinished) {
|
||||||
this.timeFinished = timeFinished;
|
this.timeFinished = timeFinished;
|
||||||
@@ -43,7 +62,6 @@ public class BoatInRace extends Boat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculates the bearing of the travel via map coordinates of the raceMarkers
|
* Calculates the bearing of the travel via map coordinates of the raceMarkers
|
||||||
* @return
|
* @return
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class ConstantVelocityRace extends Race {
|
|||||||
boat.setDistanceTravelledInLeg(totalDistanceTravelled);
|
boat.setDistanceTravelledInLeg(totalDistanceTravelled);
|
||||||
boat.setCurrentPosition(calculatePosition(boat.getCurrentLeg().getStartGraphCoordinate(),
|
boat.setCurrentPosition(calculatePosition(boat.getCurrentLeg().getStartGraphCoordinate(),
|
||||||
totalDistanceTravelled, boat.calculateHeading()));
|
totalDistanceTravelled, boat.calculateHeading()));
|
||||||
//Calculate new coordinates based on boat's heading for the leg, and distance traveled
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GPSCoordinate calculatePosition(GPSCoordinate oldCoordinates, double distanceTravelled, double heading) {
|
public static GPSCoordinate calculatePosition(GPSCoordinate oldCoordinates, double distanceTravelled, double heading) {
|
||||||
@@ -53,12 +53,13 @@ public class ConstantVelocityRace extends Race {
|
|||||||
|
|
||||||
Point2D startPoint = new Point2D.Double(oldCoordinates.getLatitude(), oldCoordinates.getLongitude());
|
Point2D startPoint = new Point2D.Double(oldCoordinates.getLatitude(), oldCoordinates.getLongitude());
|
||||||
geodeticCalculator.setStartingGeographicPoint(startPoint);
|
geodeticCalculator.setStartingGeographicPoint(startPoint);
|
||||||
|
heading = 1;
|
||||||
double azimuth = heading - 180;
|
double azimuth = 180 - heading;
|
||||||
geodeticCalculator.setDirection(azimuth, distanceTravelled);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
System.out.println(heading);
|
||||||
|
geodeticCalculator.setDirection(azimuth, distanceTravelled * 1852 );
|
||||||
|
|
||||||
Point2D endPoint = geodeticCalculator.getDestinationGeographicPoint();
|
Point2D endPoint = geodeticCalculator.getDestinationGeographicPoint();
|
||||||
|
|
||||||
|
|||||||
@@ -81,6 +81,8 @@ public abstract class Race implements Runnable {
|
|||||||
updatePosition(boat, SLEEP_TIME);
|
updatePosition(boat, SLEEP_TIME);
|
||||||
checkPosition(boat, totalTimeElapsed);
|
checkPosition(boat, totalTimeElapsed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
controller.updateMap(startingBoats);
|
||||||
try {
|
try {
|
||||||
timeLoopEnded = System.currentTimeMillis();
|
timeLoopEnded = System.currentTimeMillis();
|
||||||
Thread.sleep(SLEEP_TIME - (timeLoopEnded - timeLoopStarted));
|
Thread.sleep(SLEEP_TIME - (timeLoopEnded - timeLoopStarted));
|
||||||
|
|||||||
@@ -5,22 +5,30 @@ import javafx.scene.canvas.GraphicsContext;
|
|||||||
import javafx.scene.paint.Color;
|
import javafx.scene.paint.Color;
|
||||||
import javafx.scene.paint.Paint;
|
import javafx.scene.paint.Paint;
|
||||||
import javafx.scene.transform.Rotate;
|
import javafx.scene.transform.Rotate;
|
||||||
|
import seng302.GPSCoordinate;
|
||||||
import seng302.GraphCoordinate;
|
import seng302.GraphCoordinate;
|
||||||
import seng302.RaceMap;
|
import seng302.RaceMap;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by fwy13 on 17/03/17.
|
* Created by fwy13 on 17/03/17.
|
||||||
*/
|
*/
|
||||||
public class ResizableRaceCanvas extends Canvas {
|
public class ResizableRaceCanvas extends Canvas {
|
||||||
GraphicsContext gc;
|
GraphicsContext gc;
|
||||||
RaceMap map;
|
RaceMap map;
|
||||||
|
private BoatInRace[] boats;
|
||||||
|
|
||||||
|
public void setBoats(BoatInRace[] boats) {
|
||||||
|
this.boats = boats;
|
||||||
|
}
|
||||||
|
|
||||||
public ResizableRaceCanvas(RaceMap map) {
|
public ResizableRaceCanvas(RaceMap map) {
|
||||||
this.map = map;
|
this.map = map;
|
||||||
gc = this.getGraphicsContext2D();
|
gc = this.getGraphicsContext2D();
|
||||||
// Redraw canvas when size changes.
|
// Redraw canvas when size changes.
|
||||||
widthProperty().addListener(evt -> draw());
|
widthProperty().addListener(evt -> drawRaceMap());
|
||||||
heightProperty().addListener(evt -> draw());
|
heightProperty().addListener(evt -> drawRaceMap());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResizableRaceCanvas(){
|
public ResizableRaceCanvas(){
|
||||||
@@ -31,7 +39,7 @@ public class ResizableRaceCanvas extends Canvas {
|
|||||||
this.map = map;
|
this.map = map;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void displayBoat(GraphCoordinate graphCoordinate, Paint paint){
|
public void displayMark(GraphCoordinate graphCoordinate, Paint paint){
|
||||||
gc.setFill(paint);
|
gc.setFill(paint);
|
||||||
gc.fillOval(graphCoordinate.getX(), graphCoordinate.getY(), 15, 15);
|
gc.fillOval(graphCoordinate.getX(), graphCoordinate.getY(), 15, 15);
|
||||||
}
|
}
|
||||||
@@ -44,7 +52,6 @@ public class ResizableRaceCanvas extends Canvas {
|
|||||||
gc.strokeLine(graphCoordinateA.getX(), graphCoordinateA.getY(), graphCoordinateB.getX(), graphCoordinateB.getY());
|
gc.strokeLine(graphCoordinateA.getX(), graphCoordinateA.getY(), graphCoordinateB.getX(), graphCoordinateB.getY());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void displayPoint(GraphCoordinate graphCoordinate, Paint paint){
|
public void displayPoint(GraphCoordinate graphCoordinate, Paint paint){
|
||||||
gc.setFill(paint);
|
gc.setFill(paint);
|
||||||
gc.fillOval(graphCoordinate.getX(), graphCoordinate.getY(), 10, 10);
|
gc.fillOval(graphCoordinate.getX(), graphCoordinate.getY(), 10, 10);
|
||||||
@@ -65,20 +72,20 @@ public class ResizableRaceCanvas extends Canvas {
|
|||||||
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());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void draw() {
|
|
||||||
|
public void drawRaceMap() {
|
||||||
|
|
||||||
double width = getWidth();
|
double width = getWidth();
|
||||||
double height = getHeight();
|
double height = getHeight();
|
||||||
|
|
||||||
|
gc.clearRect(0, 0, width, height);
|
||||||
System.out.println("Race Map Canvas Width: "+ width + ", Height:" + height);
|
System.out.println("Race Map Canvas Width: "+ width + ", Height:" + height);
|
||||||
this.map = new RaceMap(32.320989, -64.863, 32.278, -64.821, (int)width, (int)height);
|
this.map = new RaceMap(32.320989, -64.863, 32.278, -64.821, (int)width, (int)height);
|
||||||
|
|
||||||
if (map == null){
|
if (map == null){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
System.out.println("Drawing");
|
|
||||||
gc.clearRect(0, 0, width, height);
|
|
||||||
//boat
|
|
||||||
GraphCoordinate boat1coord = this.map.convertGPS(32.296577, -64.854304);
|
|
||||||
displayBoat(boat1coord, Color.AQUAMARINE);
|
|
||||||
//finish line
|
//finish line
|
||||||
gc.setLineWidth(2);
|
gc.setLineWidth(2);
|
||||||
GraphCoordinate finishLineCoord1 = this.map.convertGPS(32.317379, -64.839291);
|
GraphCoordinate finishLineCoord1 = this.map.convertGPS(32.317379, -64.839291);
|
||||||
@@ -90,19 +97,33 @@ public class ResizableRaceCanvas extends Canvas {
|
|||||||
GraphCoordinate southGate2 = this.map.convertGPS(32.280164, -64.847591);
|
GraphCoordinate southGate2 = this.map.convertGPS(32.280164, -64.847591);
|
||||||
GraphCoordinate northGate1 = this.map.convertGPS(32.309693, -64.835249);
|
GraphCoordinate northGate1 = this.map.convertGPS(32.309693, -64.835249);
|
||||||
GraphCoordinate northGate2 = this.map.convertGPS(32.308046, -64.831785);
|
GraphCoordinate northGate2 = this.map.convertGPS(32.308046, -64.831785);
|
||||||
displayBoat(boat1coord, Color.AQUAMARINE);
|
displayMark(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 = this.map.convertGPS(32.296577, -64.854304);
|
GraphCoordinate startline1 = this.map.convertGPS(32.296577, -64.854304);
|
||||||
GraphCoordinate startline2 = this.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);
|
||||||
|
|
||||||
|
|
||||||
|
if (boats != null) {
|
||||||
|
for (BoatInRace boat : boats) {
|
||||||
|
System.out.print("Drawing Boat At: " + boat.getCurrentPosition());
|
||||||
|
displayMark(this.map.convertGPS(boat.getCurrentPosition()), boat.getColour());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//display wind direction arrow - specify origin point and angle
|
//display wind direction arrow - specify origin point and angle
|
||||||
displayArrow(new GraphCoordinate(500, 20), 100);
|
displayArrow(new GraphCoordinate(500, 20), 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void drawBoat(Color colour, GPSCoordinate gpsCoordinates) {
|
||||||
|
GraphCoordinate graphCoordinate = this.map.convertGPS(gpsCoordinates);
|
||||||
|
System.out.println("DrawingBoat" + gpsCoordinates.getLongitude());
|
||||||
|
displayPoint(graphCoordinate, colour);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isResizable() {
|
public boolean isResizable() {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -21,4 +21,8 @@ public class RaceMap {
|
|||||||
public GraphCoordinate convertGPS(double lat, double lon) {
|
public GraphCoordinate convertGPS(double lat, double lon) {
|
||||||
return new GraphCoordinate((int) ((height * (lon - y1) / (y2 - y1))),(int) (width * (lat - x1) / (x2 - x1)));
|
return new GraphCoordinate((int) ((height * (lon - y1) / (y2 - y1))),(int) (width * (lat - x1) / (x2 - x1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public GraphCoordinate convertGPS(GPSCoordinate coordinate) {
|
||||||
|
return convertGPS(coordinate.getLatitude(), coordinate.getLongitude());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user