aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/geopoint
diff options
context:
space:
mode:
authorblafoo <github@blafoo.de>2012-02-23 23:13:45 +0100
committerblafoo <github@blafoo.de>2012-02-23 23:31:35 +0100
commitadfd915fa19c03b9b505a141f8c8c9658a7b5bbd (patch)
tree669202f1484acd2ae58e1e34baefb181b187e2c9 /main/src/cgeo/geocaching/geopoint
parent196dd6ab57977f778459ec4bb2a873b6d7734f6f (diff)
downloadcgeo-adfd915fa19c03b9b505a141f8c8c9658a7b5bbd.zip
cgeo-adfd915fa19c03b9b505a141f8c8c9658a7b5bbd.tar.gz
cgeo-adfd915fa19c03b9b505a141f8c8c9658a7b5bbd.tar.bz2
Live Map. Closes #1121
Diffstat (limited to 'main/src/cgeo/geocaching/geopoint')
-rw-r--r--main/src/cgeo/geocaching/geopoint/Viewport.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/main/src/cgeo/geocaching/geopoint/Viewport.java b/main/src/cgeo/geocaching/geopoint/Viewport.java
index 2b76624..981f0c8 100644
--- a/main/src/cgeo/geocaching/geopoint/Viewport.java
+++ b/main/src/cgeo/geocaching/geopoint/Viewport.java
@@ -2,15 +2,19 @@ package cgeo.geocaching.geopoint;
public class Viewport {
+ public final Geopoint center;
public final Geopoint bottomLeft;
public final Geopoint topRight;
public Viewport(final Geopoint bottomLeft, final Geopoint topRight) {
this.bottomLeft = bottomLeft;
this.topRight = topRight;
+ this.center = new Geopoint((bottomLeft.getLatitude() + topRight.getLatitude()) / 2,
+ (bottomLeft.getLongitude() + topRight.getLongitude()) / 2);
}
public Viewport(final Geopoint center, final double latSpan, final double lonSpan) {
+ this.center = center;
final double centerLat = center.getLatitude();
final double centerLon = center.getLongitude();
bottomLeft = new Geopoint(centerLat - latSpan / 2, centerLon - lonSpan / 2);
@@ -33,6 +37,10 @@ public class Viewport {
return topRight.getLongitude();
}
+ public Geopoint getCenter() {
+ return center;
+ }
+
@Override
public String toString() {
return "(" + bottomLeft.toString() + "," + topRight.toString() + ")";