diff options
author | Ben Burwell <ben.burwell@trifecta.com> | 2016-11-19 17:39:05 -0500 |
---|---|---|
committer | Ben Burwell <ben.burwell@trifecta.com> | 2016-11-19 17:39:05 -0500 |
commit | 9441ed331af3aa6b3ef45bf165e40faad18bc7fd (patch) | |
tree | e4f9155ccce81e3cb2145a41a68dacff6671950a /src/main/java/com/benburwell/planes/gui/aircraftmap/GeoPoint.java | |
parent | 4a7ae2831563622ebb4a1d893764afd0e0e0dfbe (diff) |
Use gradle
Diffstat (limited to 'src/main/java/com/benburwell/planes/gui/aircraftmap/GeoPoint.java')
-rw-r--r-- | src/main/java/com/benburwell/planes/gui/aircraftmap/GeoPoint.java | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/main/java/com/benburwell/planes/gui/aircraftmap/GeoPoint.java b/src/main/java/com/benburwell/planes/gui/aircraftmap/GeoPoint.java new file mode 100644 index 0000000..d3eda40 --- /dev/null +++ b/src/main/java/com/benburwell/planes/gui/aircraftmap/GeoPoint.java @@ -0,0 +1,36 @@ +package com.benburwell.planes.gui.aircraftmap; + +/** + * Created by ben on 11/19/16. + */ +public class GeoPoint { + private double latitude; + private double longitude; + private double altitude; + + public GeoPoint(double latitude, double longitude, double altitude) { + this.latitude = latitude; + this.longitude = longitude; + this.altitude = altitude; + } + + public int getX(AircraftMap map) { + double degreesFromCenter = map.getCenterLongitude() - this.longitude; + double pixelsFromCenter = degreesFromCenter * map.getPixelsPerDegreeLongitude(); + double centerPixels = map.getSize().getWidth() / 2; + int xPosition = (int) (centerPixels - pixelsFromCenter); + return xPosition; + } + + public int getY(AircraftMap map) { + double degreesFromCenter = map.getCenterLatitude() - this.latitude; + double pixelsFromCenter = degreesFromCenter * map.getPixelsPerDegreeLatitude(); + double centerPixels = map.getSize().getHeight() / 2; + int yPosition = (int) (centerPixels + pixelsFromCenter); + return yPosition; + } + + public double getAltitude() { + return this.altitude; + } +} |