# Conflicts: # .idea/compiler.xml # .idea/misc.xmlmain
commit
54d4ea2d03
@ -1,3 +0,0 @@
|
|||||||
<component name="CopyrightManager">
|
|
||||||
<settings default="" />
|
|
||||||
</component>
|
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package seng302;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by cbt24 on 15/03/17.
|
||||||
|
*/
|
||||||
|
public class Coordinate {
|
||||||
|
private int x;
|
||||||
|
private int y;
|
||||||
|
|
||||||
|
public Coordinate(int x, int y) { this.x = x; this.y = y; }
|
||||||
|
|
||||||
|
public int getX() {
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getY() {
|
||||||
|
return y;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
package seng302;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by cbt24 on 15/03/17.
|
||||||
|
*/
|
||||||
|
public class RaceMap {
|
||||||
|
private double x1, x2, y1, y2;
|
||||||
|
private int width, height;
|
||||||
|
|
||||||
|
public RaceMap(double x1, double y1, double x2, double y2, int width, int height) {
|
||||||
|
this.x1 = x1; this.x2 = x2; this.y1 = y1; this.y2 = y2; this.width = width; this.height = height;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts GPS coordinates to coordinates for container
|
||||||
|
* @param lat GPS latitude
|
||||||
|
* @param lon GPS longitude
|
||||||
|
* @return Coordinate (pair of doubles)
|
||||||
|
* @see seng302.Coordinate
|
||||||
|
*/
|
||||||
|
public Coordinate convertGPS(double lat, double lon) {
|
||||||
|
return new Coordinate((int) (width * (lat - x1) / (x2 - x1)), (int) (height - (height * (lon - y1) / (y2 - y1))));
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in new issue