mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Reformatted double value lat and lon to final double VIEW_CORNER_LAT and VIEW_CORNER_LON
This commit is contained in:
@@ -31,12 +31,15 @@ import static java.lang.Math.abs;
|
|||||||
* Modified by Haoming Yin (hyi25) on 20/3/2017.
|
* Modified by Haoming Yin (hyi25) on 20/3/2017.
|
||||||
*/
|
*/
|
||||||
public class CanvasController {
|
public class CanvasController {
|
||||||
|
@FXML
|
||||||
|
private Canvas canvas;
|
||||||
|
|
||||||
private Race race;
|
private Race race;
|
||||||
private GraphicsContext gc;
|
private GraphicsContext gc;
|
||||||
private HashMap<Boat, TimelineInfo> timelineInfos;
|
private HashMap<Boat, TimelineInfo> timelineInfos;
|
||||||
@FXML
|
private final double VIEW_CORNER_LAT = 32.280808;
|
||||||
private Canvas canvas;
|
private final double VIEW_CORNER_LON = -64.858401;
|
||||||
|
|
||||||
|
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
gc = canvas.getGraphicsContext2D();
|
gc = canvas.getGraphicsContext2D();
|
||||||
@@ -133,8 +136,8 @@ public class CanvasController {
|
|||||||
//Double x = (MAP_WIDTH / 360.0) * (180 + lon);
|
//Double x = (MAP_WIDTH / 360.0) * (180 + lon);
|
||||||
//Double y = (MAP_HEIGHT / 180.0) * (80 - lat);
|
//Double y = (MAP_HEIGHT / 180.0) * (80 - lat);
|
||||||
|
|
||||||
double x = abs(lat - 32.283808) * 1000; // to prevent negative longitude
|
double x = (lat - VIEW_CORNER_LAT) * 1000; // to prevent negative longitude
|
||||||
double y = abs(lon + 64.854401) * 1000; // to prevent negative latitude
|
double y = (lon - VIEW_CORNER_LON) * 1000; // to prevent negative latitude
|
||||||
|
|
||||||
double diameter = 0.5;
|
double diameter = 0.5;
|
||||||
gc.setFill(color);
|
gc.setFill(color);
|
||||||
@@ -160,8 +163,8 @@ public class CanvasController {
|
|||||||
* @param singleMark
|
* @param singleMark
|
||||||
*/
|
*/
|
||||||
private void drawSingleMark(SingleMark singleMark) {
|
private void drawSingleMark(SingleMark singleMark) {
|
||||||
double x = abs(singleMark.getLatitude() - 32.283808) * 1000; // to prevent negative longitude
|
double x = (singleMark.getLatitude() - VIEW_CORNER_LAT) * 1000; // to prevent negative longitude
|
||||||
double y = abs(singleMark.getLongitude() + 64.854401) * 1000; // to prevent negative latitude
|
double y = (singleMark.getLongitude() - VIEW_CORNER_LON) * 1000; // to prevent negative latitude
|
||||||
|
|
||||||
gc.setFill(Color.BLACK);
|
gc.setFill(Color.BLACK);
|
||||||
gc.fillOval(x, y, 0.5, 0.5);
|
gc.fillOval(x, y, 0.5, 0.5);
|
||||||
|
|||||||
Reference in New Issue
Block a user