- Changed GPS Coordinate so that latitude and longitude were on the correct orientation
- Map is now centered.
#fix
main
Fan-Wu Yang 9 years ago
parent 3751ee2488
commit 15829628f2

@ -69,7 +69,7 @@ public class ResizableRaceCanvas extends Canvas {
double width = getWidth(); double width = getWidth();
double height = getHeight(); double height = getHeight();
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.321989, -64.873, 32.28, -64.831, (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;
@ -100,7 +100,6 @@ public class ResizableRaceCanvas extends Canvas {
displayLine(startline1, startline2, Color.GREEN); displayLine(startline1, startline2, Color.GREEN);
//display wind direction arrow - specify origin point and angle //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); displayArrow(new GraphCoordinate(500, 20), 100);
} }

@ -19,6 +19,6 @@ public class RaceMap {
* @see GraphCoordinate * @see GraphCoordinate
*/ */
public GraphCoordinate convertGPS(double lat, double lon) { public GraphCoordinate convertGPS(double lat, double lon) {
return new GraphCoordinate((int) (width * (lat - x1) / (x2 - x1)), (int) (height - (height * (lon - y1) / (y2 - y1)))); return new GraphCoordinate((int) ((height * (lon - y1) / (y2 - y1))),(int) (width * (lat - x1) / (x2 - x1)));
} }
} }

Loading…
Cancel
Save