diff options
| author | Samuel Tardieu <sam@rfc1149.net> | 2012-04-12 13:20:12 +0200 |
|---|---|---|
| committer | Samuel Tardieu <sam@rfc1149.net> | 2012-04-12 14:52:25 +0200 |
| commit | 018e7db82858c3ab0fdc7dc5aba70eddbe1fa3fe (patch) | |
| tree | 57e7eb31856c8a05d2f33ccbc37746efa74ed319 /main/src | |
| parent | 65caf4985175662cb1c11314a860506b648d342b (diff) | |
| download | cgeo-018e7db82858c3ab0fdc7dc5aba70eddbe1fa3fe.zip cgeo-018e7db82858c3ab0fdc7dc5aba70eddbe1fa3fe.tar.gz cgeo-018e7db82858c3ab0fdc7dc5aba70eddbe1fa3fe.tar.bz2 | |
Refactoring: remove int based Geopoint and Viewport constructors
Those were source of errors, and have no legitimate reason to be used in
our current code base as this changeset shows.
Diffstat (limited to 'main/src')
| -rw-r--r-- | main/src/cgeo/geocaching/cgeocaches.java | 2 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgeocoords.java | 2 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/connector/gc/GCBase.java | 7 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/geopoint/Geopoint.java | 13 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/geopoint/Viewport.java | 5 |
5 files changed, 5 insertions, 24 deletions
diff --git a/main/src/cgeo/geocaching/cgeocaches.java b/main/src/cgeo/geocaching/cgeocaches.java index 09c0f5a..7d165b3 100644 --- a/main/src/cgeo/geocaching/cgeocaches.java +++ b/main/src/cgeo/geocaching/cgeocaches.java @@ -505,7 +505,7 @@ public class cgeocaches extends AbstractListActivity { if (Intent.ACTION_VIEW.equals(getIntent().getAction())) { type = CacheListType.OFFLINE; if (coords == null) { - coords = new Geopoint(0, 0); + coords = new Geopoint(0.0, 0.0); } } diff --git a/main/src/cgeo/geocaching/cgeocoords.java b/main/src/cgeo/geocaching/cgeocoords.java index b4868ce..fdedfda 100644 --- a/main/src/cgeo/geocaching/cgeocoords.java +++ b/main/src/cgeo/geocaching/cgeocoords.java @@ -419,7 +419,7 @@ public class cgeocoords extends Dialog { if (geo != null && geo.coordsNow != null) { gp = geo.coordsNow; } else { - gp = new Geopoint(0, 0); + gp = new Geopoint(0.0, 0.0); } } } diff --git a/main/src/cgeo/geocaching/connector/gc/GCBase.java b/main/src/cgeo/geocaching/connector/gc/GCBase.java index 91d3274..2f79fab 100644 --- a/main/src/cgeo/geocaching/connector/gc/GCBase.java +++ b/main/src/cgeo/geocaching/connector/gc/GCBase.java @@ -194,12 +194,7 @@ public class GCBase { if (search != null) { List<Number> bounds = cgeoapplication.getInstance().getBounds(search.getGeocodes()); - int minLat = (int) ((Double) bounds.get(1) * 1e6); - int maxLat = (int) ((Double) bounds.get(2) * 1e6); - int maxLon = (int) ((Double) bounds.get(3) * 1e6); - int minLon = (int) ((Double) bounds.get(4) * 1e6); - - lastSearchViewport = new Viewport(minLat, maxLat, minLon, maxLon); + lastSearchViewport = new Viewport(bounds.get(1).doubleValue(), bounds.get(2).doubleValue(), bounds.get(4).doubleValue(), bounds.get(3).doubleValue()); searchResult.addGeocodes(search.getGeocodes()); } } diff --git a/main/src/cgeo/geocaching/geopoint/Geopoint.java b/main/src/cgeo/geocaching/geopoint/Geopoint.java index 965a346..a672a6e 100644 --- a/main/src/cgeo/geocaching/geopoint/Geopoint.java +++ b/main/src/cgeo/geocaching/geopoint/Geopoint.java @@ -47,19 +47,6 @@ public final class Geopoint implements ICoordinates { } /** - * Creates new Geopoint with given latitude and longitude (both microdegree). - * - * @param lat - * latitude - * @param lon - * longitude - */ - public Geopoint(final int lat, final int lon) - { - this(lat / 1e6, lon / 1e6); - } - - /** * Creates new Geopoint with latitude and longitude parsed from string. * * @param text diff --git a/main/src/cgeo/geocaching/geopoint/Viewport.java b/main/src/cgeo/geocaching/geopoint/Viewport.java index 0937b6d..8fe2ea6 100644 --- a/main/src/cgeo/geocaching/geopoint/Viewport.java +++ b/main/src/cgeo/geocaching/geopoint/Viewport.java @@ -27,9 +27,8 @@ public class Viewport { topRight = new Geopoint(centerLat + Math.abs(latSpan) / 2, centerLon + Math.abs(lonSpan) / 2); } - public Viewport(final int minLat, final int maxLat, final int minLon, final int maxLon) { - this(new Geopoint(Math.min(minLat, maxLat), Math.min(minLon, maxLon)), - new Geopoint(Math.max(minLat, maxLat), Math.max(minLon, maxLon))); + public Viewport(final double lat1, final double lat2, final double lon1, final double lon2) { + this(new Geopoint(lat1, lon1), new Geopoint(lat2, lon2)); } public double getLatitudeMin() { |
