aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2012-04-20 11:59:38 +0200
committerSamuel Tardieu <sam@rfc1149.net>2012-04-20 12:59:07 +0200
commitc77cc3cf5362c359997e430285953eff854b88a5 (patch)
tree8997f3765f6de61c7b162c80528c1eede1786720 /main
parentf6c6b2067c5eac3abb4c9d95de1806a7721f7d0b (diff)
downloadcgeo-c77cc3cf5362c359997e430285953eff854b88a5.zip
cgeo-c77cc3cf5362c359997e430285953eff854b88a5.tar.gz
cgeo-c77cc3cf5362c359997e430285953eff854b88a5.tar.bz2
Add getViewport() to MapViewImpl interface
Diffstat (limited to 'main')
-rw-r--r--main/src/cgeo/geocaching/maps/google/GoogleMapView.java6
-rw-r--r--main/src/cgeo/geocaching/maps/interfaces/MapViewImpl.java3
-rw-r--r--main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapView.java6
3 files changed, 15 insertions, 0 deletions
diff --git a/main/src/cgeo/geocaching/maps/google/GoogleMapView.java b/main/src/cgeo/geocaching/maps/google/GoogleMapView.java
index deebcce..8bf7deb 100644
--- a/main/src/cgeo/geocaching/maps/google/GoogleMapView.java
+++ b/main/src/cgeo/geocaching/maps/google/GoogleMapView.java
@@ -3,6 +3,7 @@ package cgeo.geocaching.maps.google;
import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
import cgeo.geocaching.Settings;
+import cgeo.geocaching.geopoint.Viewport;
import cgeo.geocaching.maps.CachesOverlay;
import cgeo.geocaching.maps.OtherCachersOverlay;
import cgeo.geocaching.maps.PositionOverlay;
@@ -90,6 +91,11 @@ public class GoogleMapView extends MapView implements MapViewImpl {
}
@Override
+ public Viewport getViewport() {
+ return new Viewport(getMapViewCenter(), getLatitudeSpan() / 1e6, getLongitudeSpan() / 1e6);
+ }
+
+ @Override
public void addOverlay(OverlayImpl ovl) {
getOverlays().add((Overlay) ovl);
}
diff --git a/main/src/cgeo/geocaching/maps/interfaces/MapViewImpl.java b/main/src/cgeo/geocaching/maps/interfaces/MapViewImpl.java
index 08e04f1..c567cf2 100644
--- a/main/src/cgeo/geocaching/maps/interfaces/MapViewImpl.java
+++ b/main/src/cgeo/geocaching/maps/interfaces/MapViewImpl.java
@@ -1,5 +1,6 @@
package cgeo.geocaching.maps.interfaces;
+import cgeo.geocaching.geopoint.Viewport;
import cgeo.geocaching.maps.CachesOverlay;
import cgeo.geocaching.maps.OtherCachersOverlay;
import cgeo.geocaching.maps.PositionOverlay;
@@ -78,4 +79,6 @@ public interface MapViewImpl {
*/
boolean needsInvertedColors();
+ Viewport getViewport();
+
}
diff --git a/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapView.java b/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapView.java
index 048f7a2..aaede4d 100644
--- a/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapView.java
+++ b/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapView.java
@@ -2,6 +2,7 @@ package cgeo.geocaching.maps.mapsforge;
import cgeo.geocaching.R;
import cgeo.geocaching.Settings;
+import cgeo.geocaching.geopoint.Viewport;
import cgeo.geocaching.maps.CachesOverlay;
import cgeo.geocaching.maps.OtherCachersOverlay;
import cgeo.geocaching.maps.PositionOverlay;
@@ -71,6 +72,11 @@ public class MapsforgeMapView extends MapView implements MapViewImpl {
}
@Override
+ public Viewport getViewport() {
+ return new Viewport(getMapViewCenter(), getLatitudeSpan() / 1e6, getLongitudeSpan() / 1e6);
+ }
+
+ @Override
public void addOverlay(OverlayImpl ovl) {
getOverlays().add((Overlay) ovl);
}