mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Removed drawGoogleMap()
#story[1248]
This commit is contained in:
@@ -20,7 +20,6 @@ import javafx.scene.Node;
|
|||||||
import javafx.scene.image.ImageView;
|
import javafx.scene.image.ImageView;
|
||||||
import javafx.scene.input.KeyCode;
|
import javafx.scene.input.KeyCode;
|
||||||
import javafx.scene.input.KeyEvent;
|
import javafx.scene.input.KeyEvent;
|
||||||
import javafx.scene.layout.AnchorPane;
|
|
||||||
import javafx.scene.layout.Pane;
|
import javafx.scene.layout.Pane;
|
||||||
import javafx.scene.paint.Color;
|
import javafx.scene.paint.Color;
|
||||||
import javafx.scene.paint.Paint;
|
import javafx.scene.paint.Paint;
|
||||||
@@ -43,8 +42,6 @@ import seng302.visualiser.fxObjects.CourseBoundary;
|
|||||||
import seng302.visualiser.fxObjects.Gate;
|
import seng302.visualiser.fxObjects.Gate;
|
||||||
import seng302.visualiser.fxObjects.MarkArrowFactory;
|
import seng302.visualiser.fxObjects.MarkArrowFactory;
|
||||||
import seng302.visualiser.fxObjects.Marker;
|
import seng302.visualiser.fxObjects.Marker;
|
||||||
import seng302.visualiser.map.Boundary;
|
|
||||||
import seng302.visualiser.map.CanvasMap;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by cir27 on 20/07/17.
|
* Created by cir27 on 20/07/17.
|
||||||
@@ -52,8 +49,6 @@ import seng302.visualiser.map.CanvasMap;
|
|||||||
public class GameView extends Pane {
|
public class GameView extends Pane {
|
||||||
|
|
||||||
private double bufferSize = 50;
|
private double bufferSize = 50;
|
||||||
private double panelWidth = 1260; // it should be 1280 but, minors 40 to cancel the bias.
|
|
||||||
private double panelHeight = 960;
|
|
||||||
private double canvasWidth = 1100;
|
private double canvasWidth = 1100;
|
||||||
private double canvasHeight = 920;
|
private double canvasHeight = 920;
|
||||||
private boolean horizontalInversion = false;
|
private boolean horizontalInversion = false;
|
||||||
@@ -64,8 +59,6 @@ public class GameView extends Pane {
|
|||||||
private double referencePointX, referencePointY;
|
private double referencePointX, referencePointY;
|
||||||
private double metersPerPixelX, metersPerPixelY;
|
private double metersPerPixelX, metersPerPixelY;
|
||||||
|
|
||||||
final double SCALE_DELTA = 1.1;
|
|
||||||
|
|
||||||
private Text fpsDisplay = new Text();
|
private Text fpsDisplay = new Text();
|
||||||
private Polygon raceBorder = new CourseBoundary();
|
private Polygon raceBorder = new CourseBoundary();
|
||||||
|
|
||||||
@@ -241,43 +234,6 @@ public class GameView extends Pane {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* First find the top right and bottom left points' geo locations, then retrieve map from google
|
|
||||||
* to display on image view. - Haoming 22/5/2017
|
|
||||||
*/
|
|
||||||
private void drawGoogleMap() {
|
|
||||||
findMetersPerPixel();
|
|
||||||
Point2D topLeftPoint = findScaledXY(maxLatPoint.getLat(), minLonPoint.getLng());
|
|
||||||
// distance from top left extreme to panel origin (top left corner)
|
|
||||||
double distanceFromTopLeftToOrigin = Math.sqrt(
|
|
||||||
Math.pow(topLeftPoint.getX() * metersPerPixelX, 2) + Math
|
|
||||||
.pow(topLeftPoint.getY() * metersPerPixelY, 2));
|
|
||||||
// angle from top left extreme to panel origin
|
|
||||||
double bearingFromTopLeftToOrigin = Math
|
|
||||||
.toDegrees(Math.atan2(-topLeftPoint.getX(), topLeftPoint.getY()));
|
|
||||||
// the top left extreme
|
|
||||||
GeoPoint topLeftPos = new GeoPoint(maxLatPoint.getLat(), minLonPoint.getLng());
|
|
||||||
GeoPoint originPos = GeoUtility
|
|
||||||
.getGeoCoordinate(topLeftPos, bearingFromTopLeftToOrigin, distanceFromTopLeftToOrigin);
|
|
||||||
|
|
||||||
// distance from origin corner to bottom right corner of the panel
|
|
||||||
double distanceFromOriginToBottomRight = Math.sqrt(
|
|
||||||
Math.pow(panelHeight * metersPerPixelY, 2) + Math
|
|
||||||
.pow(panelWidth * metersPerPixelX, 2));
|
|
||||||
double bearingFromOriginToBottomRight = Math
|
|
||||||
.toDegrees(Math.atan2(panelWidth, -panelHeight));
|
|
||||||
GeoPoint bottomRightPos = GeoUtility
|
|
||||||
.getGeoCoordinate(originPos, bearingFromOriginToBottomRight,
|
|
||||||
distanceFromOriginToBottomRight);
|
|
||||||
|
|
||||||
Boundary boundary = new Boundary(originPos.getLat(), bottomRightPos.getLng(),
|
|
||||||
bottomRightPos.getLat(), originPos.getLng());
|
|
||||||
CanvasMap canvasMap = new CanvasMap(boundary);
|
|
||||||
mapImage.setImage(canvasMap.getMapImage());
|
|
||||||
mapImage.fitWidthProperty().bind(((AnchorPane) this.getParent()).heightProperty());
|
|
||||||
mapImage.fitHeightProperty().bind(((AnchorPane) this.getParent()).heightProperty());
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: 16/08/17 Break up this function
|
// TODO: 16/08/17 Break up this function
|
||||||
/**
|
/**
|
||||||
* Adds a course to the GameView. The view is scaled accordingly unless a border is set in which
|
* Adds a course to the GameView. The view is scaled accordingly unless a border is set in which
|
||||||
@@ -518,7 +474,6 @@ public class GameView extends Pane {
|
|||||||
findMinMaxPoint(limitingCoordinates);
|
findMinMaxPoint(limitingCoordinates);
|
||||||
double minLonToMaxLon = scaleRaceExtremities();
|
double minLonToMaxLon = scaleRaceExtremities();
|
||||||
calculateReferencePointLocation(minLonToMaxLon);
|
calculateReferencePointLocation(minLonToMaxLon);
|
||||||
// drawGoogleMap();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setSelectedBoat(BoatObject bo, Boolean isSelected) {
|
private void setSelectedBoat(BoatObject bo, Boolean isSelected) {
|
||||||
|
|||||||
Reference in New Issue
Block a user