aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/geopoint
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2011-11-07 14:23:44 +0100
committerSamuel Tardieu <sam@rfc1149.net>2011-11-09 20:27:34 +0100
commit97803bb9bfaaa9b1b7cd2b0adf3c582ba3ca04b1 (patch)
treebffe3bb47f8632f9ed5f1026d469c5babdddd42d /main/src/cgeo/geocaching/geopoint
parent33ceb51ad3220bad6aaa6cb741d1365fcb061027 (diff)
downloadcgeo-97803bb9bfaaa9b1b7cd2b0adf3c582ba3ca04b1.zip
cgeo-97803bb9bfaaa9b1b7cd2b0adf3c582ba3ca04b1.tar.gz
cgeo-97803bb9bfaaa9b1b7cd2b0adf3c582ba3ca04b1.tar.bz2
Add new Viewport type to encompass Viewport information
Also, remove unused reason parameter.
Diffstat (limited to 'main/src/cgeo/geocaching/geopoint')
-rw-r--r--main/src/cgeo/geocaching/geopoint/Viewport.java35
1 files changed, 35 insertions, 0 deletions
diff --git a/main/src/cgeo/geocaching/geopoint/Viewport.java b/main/src/cgeo/geocaching/geopoint/Viewport.java
new file mode 100644
index 0000000..ef80ae3
--- /dev/null
+++ b/main/src/cgeo/geocaching/geopoint/Viewport.java
@@ -0,0 +1,35 @@
+package cgeo.geocaching.geopoint;
+
+public class Viewport {
+
+ public final Geopoint bottomLeft;
+ public final Geopoint topRight;
+
+ public Viewport(final Geopoint bottomLeft, final Geopoint topRight) {
+ this.bottomLeft = bottomLeft;
+ this.topRight = topRight;
+ }
+
+ public Viewport(final Geopoint center, final double latSpan, final double lonSpan) {
+ final double centerLat = center.getLatitude();
+ final double centerLon = center.getLongitude();
+ bottomLeft = new Geopoint(centerLat - latSpan / 2, centerLon - lonSpan / 2);
+ topRight = new Geopoint(centerLat + latSpan / 2, centerLon + lonSpan / 2);
+ }
+
+ public double getLatitudeMin() {
+ return bottomLeft.getLatitude();
+ }
+
+ public double getLatitudeMax() {
+ return topRight.getLatitude();
+ }
+
+ public double getLongitudeMin() {
+ return bottomLeft.getLongitude();
+ }
+
+ public double getLongitudeMax() {
+ return topRight.getLongitude();
+ }
+}