aboutsummaryrefslogtreecommitdiffstats
path: root/src/cgeo/geocaching/mapcommon/cgMapOverlay.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/cgeo/geocaching/mapcommon/cgMapOverlay.java')
-rw-r--r--src/cgeo/geocaching/mapcommon/cgMapOverlay.java19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/cgeo/geocaching/mapcommon/cgMapOverlay.java b/src/cgeo/geocaching/mapcommon/cgMapOverlay.java
index 475ded2..de8a6ed 100644
--- a/src/cgeo/geocaching/mapcommon/cgMapOverlay.java
+++ b/src/cgeo/geocaching/mapcommon/cgMapOverlay.java
@@ -26,6 +26,7 @@ import cgeo.geocaching.cgeodetail;
import cgeo.geocaching.cgeonavigate;
import cgeo.geocaching.cgeopopup;
import cgeo.geocaching.cgeowaypoint;
+import cgeo.geocaching.geopoint.Geopoint;
import cgeo.geocaching.mapinterfaces.CacheOverlayItemImpl;
import cgeo.geocaching.mapinterfaces.GeoPointImpl;
import cgeo.geocaching.mapinterfaces.ItemizedOverlayImpl;
@@ -137,11 +138,15 @@ public class cgMapOverlay extends ItemizedOverlayBase implements OverlayBase {
final cgCoord itemCoord = item.getCoord();
float[] result = new float[1];
- Location.distanceBetween(itemCoord.latitude, itemCoord.longitude, itemCoord.latitude, itemCoord.longitude + 1, result);
+ Location.distanceBetween(itemCoord.coords.getLatitude(), itemCoord.coords.getLongitude(),
+ itemCoord.coords.getLatitude(), itemCoord.coords.getLongitude() + 1, result);
final float longitudeLineDistance = result[0];
- GeoPointImpl itemGeo = mapFactory.getGeoPointBase((int)(itemCoord.latitude * 1e6), (int)(itemCoord.longitude * 1e6));
- GeoPointImpl leftGeo = mapFactory.getGeoPointBase((int)(itemCoord.latitude * 1e6), (int)((itemCoord.longitude - 161 / longitudeLineDistance) * 1e6));
+ GeoPointImpl itemGeo = mapFactory.getGeoPointBase(itemCoord.coords);
+
+ final Geopoint leftCoords = new Geopoint(itemCoord.coords.getLatitude(),
+ itemCoord.coords.getLongitude() - 161 / longitudeLineDistance);
+ GeoPointImpl leftGeo = mapFactory.getGeoPointBase(leftCoords);
projection.toPixels(itemGeo, center);
projection.toPixels(leftGeo, left);
@@ -297,8 +302,8 @@ public class cgMapOverlay extends ItemizedOverlayBase implements OverlayBase {
cgeonavigate.coordinates.add(coordinate);
Intent navigateIntent = new Intent(context, navigateActivity.getClass());
- navigateIntent.putExtra("latitude", coordinate.latitude);
- navigateIntent.putExtra("longitude", coordinate.longitude);
+ navigateIntent.putExtra("latitude", coordinate.coords.getLatitude());
+ navigateIntent.putExtra("longitude", coordinate.coords.getLongitude());
navigateIntent.putExtra("geocode", coordinate.geocode.toUpperCase());
context.startActivity(navigateIntent);
dialog.cancel();
@@ -325,8 +330,8 @@ public class cgMapOverlay extends ItemizedOverlayBase implements OverlayBase {
cgeonavigate.coordinates.add(coordinate);
Intent navigateIntent = new Intent(context, navigateActivity.getClass());
- navigateIntent.putExtra("latitude", coordinate.latitude);
- navigateIntent.putExtra("longitude", coordinate.longitude);
+ navigateIntent.putExtra("latitude", coordinate.coords.getLatitude());
+ navigateIntent.putExtra("longitude", coordinate.coords.getLongitude());
navigateIntent.putExtra("geocode", coordinate.name);
context.startActivity(navigateIntent);