From 85bbb950d2838614ed9308cf5ce859d792af8a11 Mon Sep 17 00:00:00 2001 From: Jimmy Shih Date: Wed, 7 Nov 2012 10:27:17 -0800 Subject: [PATCH] Remove dependency on Google Api. Remove dependency on maps.jar --- MyTracks/AndroidManifest.xml | 1 - MyTracks/project.properties | 2 +- .../mytracks/io/gdata/maps/MapsFeature.java | 44 ++---- .../io/gdata/maps/MapsGDataConverter.java | 8 +- .../apps/mytracks/io/maps/SendMapsUtils.java | 24 +--- .../android/apps/mytracks/util/GeoRect.java | 64 --------- .../apps/mytracks/util/LocationUtils.java | 132 +++--------------- MyTracksLib/project.properties | 2 +- MyTracksTest/project.properties | 2 +- .../endtoendtest/EndToEndTestUtils.java | 2 +- .../mytracks/io/maps/SendMapsUtilsTest.java | 64 ++++----- 11 files changed, 80 insertions(+), 265 deletions(-) delete mode 100644 MyTracks/src/com/google/android/apps/mytracks/util/GeoRect.java diff --git a/MyTracks/AndroidManifest.xml b/MyTracks/AndroidManifest.xml index 617d351e4..344fde5f3 100755 --- a/MyTracks/AndroidManifest.xml +++ b/MyTracks/AndroidManifest.xml @@ -261,6 +261,5 @@ limitations under the License. android:authorities="com.google.android.maps.mytracks.search" android:exported="false" android:name="com.google.android.apps.mytracks.content.SearchEngineProvider" /> - \ No newline at end of file diff --git a/MyTracks/project.properties b/MyTracks/project.properties index 044ccf9a5..a30df1980 100644 --- a/MyTracks/project.properties +++ b/MyTracks/project.properties @@ -11,6 +11,6 @@ split.density=false proguard.config=proguard.cfg # Project target. -target=Google Inc.:Google APIs:16 +target=android-16 android.library.reference.1=../MyTracksLib android.library.reference.2=../google_play_services_lib diff --git a/MyTracks/src/com/google/android/apps/mytracks/io/gdata/maps/MapsFeature.java b/MyTracks/src/com/google/android/apps/mytracks/io/gdata/maps/MapsFeature.java index d8f8c7fa5..93439a3b0 100644 --- a/MyTracks/src/com/google/android/apps/mytracks/io/gdata/maps/MapsFeature.java +++ b/MyTracks/src/com/google/android/apps/mytracks/io/gdata/maps/MapsFeature.java @@ -1,7 +1,7 @@ // Copyright 2009 Google Inc. All Rights Reserved. package com.google.android.apps.mytracks.io.gdata.maps; -import com.google.android.maps.GeoPoint; +import android.location.Location; import java.util.Random; import java.util.Vector; @@ -32,18 +32,9 @@ public class MapsFeature { /** The local feature id for this feature, if needed. */ private String androidId; - /** - * The latitudes of the points of this feature in order, specified in - * millionths of a degree north. - */ - private final Vector latitudeE6 = new Vector(); - - /** - * The longitudes of the points of this feature in order, specified in - * millionths of a degree east. - */ - private final Vector longitudeE6 = new Vector(); - + // Points of this feature in order. + private final Vector points = new Vector(); + /** The metadata of this feature in a format efficient for transmission. */ private MapsFeatureMetadata featureInfo = new MapsFeatureMetadata(); @@ -60,11 +51,10 @@ public class MapsFeature { /** * Adds a new point to the end of this feature. * - * @param point The new point to add + * @param location the new point to add */ - public void addPoint(GeoPoint point) { - latitudeE6.add(point.getLatitudeE6()); - longitudeE6.add(point.getLongitudeE6()); + public void addPoint(Location location) { + points.add(location); } /** @@ -107,26 +97,22 @@ public class MapsFeature { } /** - * Retrieves the point at the given index for this feature. + * Gets the point at a given index. * - * @param index The index of the point desired - * @return A {@link GeoPoint} representing the point or null if that point - * doesn't exist + * @param index the index */ - public GeoPoint getPoint(int index) { - if (latitudeE6.size() <= index) { + public Location getPoint(int index) { + if (index >= points.size()) { return null; } - return new GeoPoint(latitudeE6.get(index), longitudeE6.get(index)); + return points.get(index); } - + /** - * Counts the number of points in this feature and return that count. - * - * @return The number of points in this feature + * Gets the number of points. */ public int getPointCount() { - return latitudeE6.size(); + return points.size(); } /** diff --git a/MyTracks/src/com/google/android/apps/mytracks/io/gdata/maps/MapsGDataConverter.java b/MyTracks/src/com/google/android/apps/mytracks/io/gdata/maps/MapsGDataConverter.java index fdbfa87c2..a515969d1 100644 --- a/MyTracks/src/com/google/android/apps/mytracks/io/gdata/maps/MapsGDataConverter.java +++ b/MyTracks/src/com/google/android/apps/mytracks/io/gdata/maps/MapsGDataConverter.java @@ -127,9 +127,9 @@ public class MapsGDataConverter { if (i > 0) { pointBuilder.append('\n'); } - pointBuilder.append(feature.getPoint(i).getLongitudeE6() / 1e6); + pointBuilder.append(feature.getPoint(i).getLongitude()); pointBuilder.append(','); - pointBuilder.append(feature.getPoint(i).getLatitudeE6() / 1e6); + pointBuilder.append(feature.getPoint(i).getLatitude()); pointBuilder.append(",0.000000"); } String pointString = pointBuilder.toString(); @@ -157,9 +157,9 @@ public class MapsGDataConverter { xmlSerializer.endTag(null, "tessellate"); xmlSerializer.startTag(null, "coordinates"); xmlSerializer.text(pointString + "\n" - + Double.toString(feature.getPoint(0).getLongitudeE6() / 1e6) + + Double.toString(feature.getPoint(0).getLongitude()) + "," - + Double.toString(feature.getPoint(0).getLatitudeE6() / 1e6) + + Double.toString(feature.getPoint(0).getLatitude()) + ",0.000000"); xmlSerializer.endTag(null, "coordinates"); xmlSerializer.endTag(null, "LinearRing"); diff --git a/MyTracks/src/com/google/android/apps/mytracks/io/maps/SendMapsUtils.java b/MyTracks/src/com/google/android/apps/mytracks/io/maps/SendMapsUtils.java index 9a9ee09c7..f930039ae 100644 --- a/MyTracks/src/com/google/android/apps/mytracks/io/maps/SendMapsUtils.java +++ b/MyTracks/src/com/google/android/apps/mytracks/io/maps/SendMapsUtils.java @@ -21,7 +21,6 @@ import com.google.android.apps.mytracks.io.gdata.maps.MapsClient; import com.google.android.apps.mytracks.io.gdata.maps.MapsFeature; import com.google.android.apps.mytracks.io.gdata.maps.MapsGDataConverter; import com.google.android.apps.mytracks.io.gdata.maps.MapsMapMetadata; -import com.google.android.maps.GeoPoint; import com.google.common.annotations.VisibleForTesting; import com.google.wireless.gdata.client.HttpException; import com.google.wireless.gdata.data.Entry; @@ -108,7 +107,7 @@ public class SendMapsUtils { MapsGDataConverter mapsGDataConverter) throws ParseException, HttpException, IOException { String featuresFeed = MapsClient.getFeaturesFeed(mapId); MapsFeature mapsFeature = buildMapsMarkerFeature( - title, description, iconUrl, getGeoPoint(location)); + title, description, iconUrl, location); Entry entry = mapsGDataConverter.getEntryForFeature(mapsFeature); try { mapsClient.createEntry(featuresFeed, authToken, entry); @@ -135,7 +134,7 @@ public class SendMapsUtils { throws ParseException, HttpException, IOException { String featuresFeed = MapsClient.getFeaturesFeed(mapId); MapsFeature feature = buildMapsMarkerFeature(waypoint.getName(), waypoint.getDescription(), - waypoint.getIcon(), getGeoPoint(waypoint.getLocation())); + waypoint.getIcon(), waypoint.getLocation()); Entry entry = mapsGDataConverter.getEntryForFeature(feature); try { mapsClient.createEntry(featuresFeed, authToken, entry); @@ -179,11 +178,11 @@ public class SendMapsUtils { * @param title feature title * @param description the feature description * @param iconUrl the feature icon URL - * @param geoPoint the marker + * @param location the marker */ @VisibleForTesting static MapsFeature buildMapsMarkerFeature( - String title, String description, String iconUrl, GeoPoint geoPoint) { + String title, String description, String iconUrl, Location location) { MapsFeature mapsFeature = new MapsFeature(); mapsFeature.setType(MapsFeature.MARKER); mapsFeature.generateAndroidId(); @@ -191,7 +190,7 @@ public class SendMapsUtils { mapsFeature.setTitle(TextUtils.isEmpty(title) ? EMPTY_TITLE : title); mapsFeature.setDescription(description.replaceAll("\n", "
")); mapsFeature.setIconUrl(iconUrl); - mapsFeature.addPoint(geoPoint); + mapsFeature.addPoint(location); return mapsFeature; } @@ -210,19 +209,8 @@ public class SendMapsUtils { mapsFeature.setTitle(TextUtils.isEmpty(title) ? EMPTY_TITLE : title); mapsFeature.setColor(LINE_COLOR); for (Location location : locations) { - mapsFeature.addPoint(getGeoPoint(location)); + mapsFeature.addPoint(location); } return mapsFeature; } - - /** - * Gets a {@link GeoPoint} from a {@link Location}. - * - * @param location the location - */ - @VisibleForTesting - static GeoPoint getGeoPoint(Location location) { - return new GeoPoint( - (int) (location.getLatitude() * 1E6), (int) (location.getLongitude() * 1E6)); - } } diff --git a/MyTracks/src/com/google/android/apps/mytracks/util/GeoRect.java b/MyTracks/src/com/google/android/apps/mytracks/util/GeoRect.java deleted file mode 100644 index 6605f1453..000000000 --- a/MyTracks/src/com/google/android/apps/mytracks/util/GeoRect.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2009 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.google.android.apps.mytracks.util; - -import com.google.android.maps.GeoPoint; - -/** - * A rectangle in geographical space. - */ -public class GeoRect { - public int top; - public int left; - public int bottom; - public int right; - - public GeoRect() { - top = 0; - left = 0; - bottom = 0; - right = 0; - } - - public GeoRect(GeoPoint center, int latSpan, int longSpan) { - top = center.getLatitudeE6() - latSpan / 2; - left = center.getLongitudeE6() - longSpan / 2; - bottom = center.getLatitudeE6() + latSpan / 2; - right = center.getLongitudeE6() + longSpan / 2; - } - - public GeoPoint getCenter() { - return new GeoPoint(top / 2 + bottom / 2, left / 2 + right / 2); - } - - public int getLatSpan() { - return bottom - top; - } - - public int getLongSpan() { - return right - left; - } - - public boolean contains(GeoPoint geoPoint) { - if (geoPoint.getLatitudeE6() >= top - && geoPoint.getLatitudeE6() <= bottom - && geoPoint.getLongitudeE6() >= left - && geoPoint.getLongitudeE6() <= right) { - return true; - } - return false; - } -} \ No newline at end of file diff --git a/MyTracks/src/com/google/android/apps/mytracks/util/LocationUtils.java b/MyTracks/src/com/google/android/apps/mytracks/util/LocationUtils.java index 8107ca8c7..b9f2b116f 100644 --- a/MyTracks/src/com/google/android/apps/mytracks/util/LocationUtils.java +++ b/MyTracks/src/com/google/android/apps/mytracks/util/LocationUtils.java @@ -17,33 +17,32 @@ package com.google.android.apps.mytracks.util; import com.google.android.apps.mytracks.Constants; import com.google.android.apps.mytracks.content.Track; -import com.google.android.apps.mytracks.stats.TripStatistics; -import com.google.android.maps.GeoPoint; import android.location.Location; import android.util.Log; import java.util.ArrayList; -import java.util.List; import java.util.Stack; /** * Utility class for decimating tracks at a given level of precision. - * + * * @author Leif Hendrik Wilden */ public class LocationUtils { + + private LocationUtils() {} + /** * Computes the distance on the two sphere between the point c0 and the line * segment c1 to c2. - * + * * @param c0 the first coordinate * @param c1 the beginning of the line segment * @param c2 the end of the lone segment * @return the distance in m (assuming spherical earth) */ - public static double distance( - final Location c0, final Location c1, final Location c2) { + private static double distance(final Location c0, final Location c1, final Location c2) { if (c1.equals(c2)) { return c2.distanceTo(c0); } @@ -57,9 +56,8 @@ public class LocationUtils { double s2s1lat = s2lat - s1lat; double s2s1lng = s2lng - s1lng; - final double u = - ((s0lat - s1lat) * s2s1lat + (s0lng - s1lng) * s2s1lng) - / (s2s1lat * s2s1lat + s2s1lng * s2s1lng); + final double u = ((s0lat - s1lat) * s2s1lat + (s0lng - s1lng) * s2s1lng) + / (s2s1lat * s2s1lat + s2s1lng * s2s1lng); if (u <= 0) { return c0.distanceTo(c1); } @@ -78,13 +76,13 @@ public class LocationUtils { /** * Decimates the given locations for a given zoom level. This uses a * Douglas-Peucker decimation algorithm. - * + * * @param tolerance in meters * @param locations input * @param decimated output */ - public static void decimate(double tolerance, ArrayList locations, - ArrayList decimated) { + private static void decimate( + double tolerance, ArrayList locations, ArrayList decimated) { final int n = locations.size(); if (n < 1) { return; @@ -100,16 +98,14 @@ public class LocationUtils { int[] current; if (n > 2) { - int[] stackVal = new int[] {0, (n - 1)}; + int[] stackVal = new int[] { 0, (n - 1) }; stack.push(stackVal); while (stack.size() > 0) { current = stack.pop(); maxDist = 0; for (idx = current[0] + 1; idx < current[1]; ++idx) { dist = LocationUtils.distance( - locations.get(idx), - locations.get(current[0]), - locations.get(current[1])); + locations.get(idx), locations.get(current[0]), locations.get(current[1])); if (dist > maxDist) { maxDist = dist; maxIdx = idx; @@ -117,9 +113,9 @@ public class LocationUtils { } if (maxDist > tolerance) { dists[maxIdx] = maxDist; - int[] stackValCurMax = {current[0], maxIdx}; + int[] stackValCurMax = { current[0], maxIdx }; stack.push(stackValCurMax); - int[] stackValMaxCur = {maxIdx, current[1]}; + int[] stackValMaxCur = { maxIdx, current[1] }; stack.push(stackValMaxCur); } } @@ -135,13 +131,12 @@ public class LocationUtils { } idx++; } - Log.d(Constants.TAG, "Decimating " + n + " points to " + i - + " w/ tolerance = " + tolerance); + Log.d(Constants.TAG, "Decimating " + n + " points to " + i + " w/ tolerance = " + tolerance); } /** * Decimates the given track for the given precision. - * + * * @param track a track * @param precision desired precision in meters */ @@ -151,73 +146,12 @@ public class LocationUtils { track.setLocations(decimated); } - /** - * Limits number of points by dropping any points beyond the given number of - * points. Note: That'll actually discard points. - * - * @param track a track - * @param numberOfPoints maximum number of points - */ - public static void cut(Track track, int numberOfPoints) { - ArrayList locations = track.getLocations(); - while (locations.size() > numberOfPoints) { - locations.remove(locations.size() - 1); - } - } - - /** - * Splits a track in multiple tracks where each piece has less or equal than - * maxPoints. - * - * @param track the track to split - * @param maxPoints maximum number of points for each piece - * @return a list of one or more track pieces - */ - public static ArrayList split(Track track, int maxPoints) { - ArrayList result = new ArrayList(); - final int nTotal = track.getLocations().size(); - int n = 0; - Track piece = null; - do { - piece = new Track(); - TripStatistics pieceStats = piece.getTripStatistics(); - piece.setId(track.getId()); - piece.setName(track.getName()); - piece.setDescription(track.getDescription()); - piece.setCategory(track.getCategory()); - List pieceLocations = piece.getLocations(); - for (int i = n; i < nTotal && pieceLocations.size() < maxPoints; i++) { - piece.addLocation(track.getLocations().get(i)); - } - int nPointsPiece = pieceLocations.size(); - if (nPointsPiece >= 2) { - pieceStats.setStartTime(pieceLocations.get(0).getTime()); - pieceStats.setStopTime(pieceLocations.get(nPointsPiece - 1).getTime()); - result.add(piece); - } - n += (pieceLocations.size() - 1); - } while (n < nTotal && piece.getLocations().size() > 1); - - return result; - } - - /** - * Test if a given GeoPoint is valid, i.e. within physical bounds. - * - * @param geoPoint the point to be tested - * @return true, if it is a physical location on earth. - */ - public static boolean isValidGeoPoint(GeoPoint geoPoint) { - return Math.abs(geoPoint.getLatitudeE6()) < 90E6 - && Math.abs(geoPoint.getLongitudeE6()) <= 180E6; - } - /** * Checks if a given location is a valid (i.e. physically possible) location - * on Earth. Note: The special separator locations (which have latitude = - * 100) will not qualify as valid. Neither will locations with lat=0 and lng=0 - * as these are most likely "bad" measurements which often cause trouble. - * + * on Earth. Note: The special separator locations (which have latitude = 100) + * will not qualify as valid. Neither will locations with lat=0 and lng=0 as + * these are most likely "bad" measurements which often cause trouble. + * * @param location the location to test * @return true if the location is a valid location. */ @@ -225,28 +159,4 @@ public class LocationUtils { return location != null && Math.abs(location.getLatitude()) <= 90 && Math.abs(location.getLongitude()) <= 180; } - - /** - * Gets a location from a GeoPoint. - * - * @param p a GeoPoint - * @return the corresponding location - */ - public static Location getLocation(GeoPoint p) { - Location result = new Location(""); - result.setLatitude(p.getLatitudeE6() / 1.0E6); - result.setLongitude(p.getLongitudeE6() / 1.0E6); - return result; - } - - public static GeoPoint getGeoPoint(Location location) { - return new GeoPoint((int) (location.getLatitude() * 1E6), - (int) (location.getLongitude() * 1E6)); - } - - /** - * This is a utility class w/ only static members. - */ - private LocationUtils() { - } } diff --git a/MyTracksLib/project.properties b/MyTracksLib/project.properties index b15f1208a..616f300c3 100644 --- a/MyTracksLib/project.properties +++ b/MyTracksLib/project.properties @@ -9,4 +9,4 @@ android.library=true # Project target. -target=Google Inc.:Google APIs:16 +target=android-16 diff --git a/MyTracksTest/project.properties b/MyTracksTest/project.properties index 58f8bc2af..8f816735d 100644 --- a/MyTracksTest/project.properties +++ b/MyTracksTest/project.properties @@ -10,4 +10,4 @@ # Indicates whether an apk should be generated for each density. split.density=false # Project target. -target=Google Inc.:Google APIs:16 +target=android-16 diff --git a/MyTracksTest/src/com/google/android/apps/mytracks/endtoendtest/EndToEndTestUtils.java b/MyTracksTest/src/com/google/android/apps/mytracks/endtoendtest/EndToEndTestUtils.java index e5c997be6..5b4f88565 100644 --- a/MyTracksTest/src/com/google/android/apps/mytracks/endtoendtest/EndToEndTestUtils.java +++ b/MyTracksTest/src/com/google/android/apps/mytracks/endtoendtest/EndToEndTestUtils.java @@ -234,7 +234,7 @@ public class EndToEndTestUtils { * Checks whether the Google Play Services need update. */ private static boolean isGooglePlayServicesLatest() { - return !SOLO.searchText(activityMytracks.getString(R.string.common_google_play_services_update_text)); + return !SOLO.searchText("Google Play services"); } /** diff --git a/MyTracksTest/src/com/google/android/apps/mytracks/io/maps/SendMapsUtilsTest.java b/MyTracksTest/src/com/google/android/apps/mytracks/io/maps/SendMapsUtilsTest.java index a22e09a60..65876c7d8 100644 --- a/MyTracksTest/src/com/google/android/apps/mytracks/io/maps/SendMapsUtilsTest.java +++ b/MyTracksTest/src/com/google/android/apps/mytracks/io/maps/SendMapsUtilsTest.java @@ -17,7 +17,6 @@ package com.google.android.apps.mytracks.io.maps; import com.google.android.apps.mytracks.content.Track; import com.google.android.apps.mytracks.io.gdata.maps.MapsFeature; -import com.google.android.maps.GeoPoint; import android.location.Location; @@ -62,15 +61,18 @@ public class SendMapsUtilsTest extends TestCase { * GeoPoint)} with a title. */ public void testBuildMapsMarkerFeature_with_title() { + Location location = new Location("test"); + location.setLatitude(123.0); + location.setLongitude(456.0); MapsFeature mapFeature = SendMapsUtils.buildMapsMarkerFeature( - "name", "this\nmap\ndescription", "url", new GeoPoint(123, 456)); + "name", "this\nmap\ndescription", "url", location); assertEquals(MapsFeature.MARKER, mapFeature.getType()); assertNotNull(mapFeature.getAndroidId()); assertEquals("name", mapFeature.getTitle()); assertEquals("this
map
description", mapFeature.getDescription()); assertEquals("url", mapFeature.getIconUrl()); - assertEquals(123, mapFeature.getPoint(0).getLatitudeE6()); - assertEquals(456, mapFeature.getPoint(0).getLongitudeE6()); + assertEquals(123.0, mapFeature.getPoint(0).getLatitude()); + assertEquals(456.0, mapFeature.getPoint(0).getLongitude()); } /** @@ -78,15 +80,18 @@ public class SendMapsUtilsTest extends TestCase { * GeoPoint)} with an empty title. */ public void testBuildMapsMarkerFeature_empty_title() { + Location location = new Location("test"); + location.setLatitude(123.0); + location.setLongitude(456.0); MapsFeature mapFeature = SendMapsUtils.buildMapsMarkerFeature( - "", "description", "url", new GeoPoint(123, 456)); + "", "description", "url", location); assertEquals(MapsFeature.MARKER, mapFeature.getType()); assertNotNull(mapFeature.getAndroidId()); assertEquals("-", mapFeature.getTitle()); assertEquals("description", mapFeature.getDescription()); assertEquals("url", mapFeature.getIconUrl()); - assertEquals(123, mapFeature.getPoint(0).getLatitudeE6()); - assertEquals(456, mapFeature.getPoint(0).getLongitudeE6()); + assertEquals(123.0, mapFeature.getPoint(0).getLatitude()); + assertEquals(456.0, mapFeature.getPoint(0).getLongitude()); } /** @@ -94,15 +99,18 @@ public class SendMapsUtilsTest extends TestCase { * GeoPoint)} with a null title. */ public void testBuildMapsMarkerFeature_null_title() { + Location location = new Location("test"); + location.setLatitude(123.0); + location.setLongitude(456.0); MapsFeature mapFeature = SendMapsUtils.buildMapsMarkerFeature( - null, "description", "url", new GeoPoint(123, 456)); + null, "description", "url", location); assertEquals(MapsFeature.MARKER, mapFeature.getType()); assertNotNull(mapFeature.getAndroidId()); assertEquals("-", mapFeature.getTitle()); assertEquals("description", mapFeature.getDescription()); assertEquals("url", mapFeature.getIconUrl()); - assertEquals(123, mapFeature.getPoint(0).getLatitudeE6()); - assertEquals(456, mapFeature.getPoint(0).getLongitudeE6()); + assertEquals(123.0, mapFeature.getPoint(0).getLatitude()); + assertEquals(456.0, mapFeature.getPoint(0).getLongitude()); } /** @@ -112,8 +120,8 @@ public class SendMapsUtilsTest extends TestCase { public void testBuildMapsLineFeature_with_title() { ArrayList locations = new ArrayList(); Location location = new Location("test"); - location.setLatitude(50); - location.setLongitude(100); + location.setLatitude(50.0); + location.setLongitude(100.0); locations.add(location); MapsFeature mapFeature = SendMapsUtils.buildMapsLineFeature("name", locations); @@ -121,8 +129,8 @@ public class SendMapsUtilsTest extends TestCase { assertNotNull(mapFeature.getAndroidId()); assertEquals("name", mapFeature.getTitle()); assertEquals(0x80FF0000, mapFeature.getColor()); - assertEquals(50000000, mapFeature.getPoint(0).getLatitudeE6()); - assertEquals(100000000, mapFeature.getPoint(0).getLongitudeE6()); + assertEquals(50.0, mapFeature.getPoint(0).getLatitude()); + assertEquals(100.0, mapFeature.getPoint(0).getLongitude()); } /** @@ -132,8 +140,8 @@ public class SendMapsUtilsTest extends TestCase { public void testBuildMapsLineFeature_empty_title() { ArrayList locations = new ArrayList(); Location location = new Location("test"); - location.setLatitude(50); - location.setLongitude(100); + location.setLatitude(50.0); + location.setLongitude(100.0); locations.add(location); MapsFeature mapFeature = SendMapsUtils.buildMapsLineFeature("", locations); @@ -141,8 +149,8 @@ public class SendMapsUtilsTest extends TestCase { assertNotNull(mapFeature.getAndroidId()); assertEquals("-", mapFeature.getTitle()); assertEquals(0x80FF0000, mapFeature.getColor()); - assertEquals(50000000, mapFeature.getPoint(0).getLatitudeE6()); - assertEquals(100000000, mapFeature.getPoint(0).getLongitudeE6()); + assertEquals(50.0, mapFeature.getPoint(0).getLatitude()); + assertEquals(100.0, mapFeature.getPoint(0).getLongitude()); } /** @@ -152,8 +160,8 @@ public class SendMapsUtilsTest extends TestCase { public void testBuildMapsLineFeature_null_title() { ArrayList locations = new ArrayList(); Location location = new Location("test"); - location.setLatitude(50); - location.setLongitude(100); + location.setLatitude(50.0); + location.setLongitude(100.0); locations.add(location); MapsFeature mapFeature = SendMapsUtils.buildMapsLineFeature(null, locations); @@ -161,19 +169,7 @@ public class SendMapsUtilsTest extends TestCase { assertNotNull(mapFeature.getAndroidId()); assertEquals("-", mapFeature.getTitle()); assertEquals(0x80FF0000, mapFeature.getColor()); - assertEquals(50000000, mapFeature.getPoint(0).getLatitudeE6()); - assertEquals(100000000, mapFeature.getPoint(0).getLongitudeE6()); - } - - /** - * Test {@link SendMapsUtils#getGeoPoint(Location)}. - */ - public void testGeoPoint() { - Location location = new Location("test"); - location.setLatitude(50); - location.setLongitude(100); - GeoPoint geoPoint = SendMapsUtils.getGeoPoint(location); - assertEquals(50000000, geoPoint.getLatitudeE6()); - assertEquals(100000000, geoPoint.getLongitudeE6()); + assertEquals(50.0, mapFeature.getPoint(0).getLatitude()); + assertEquals(100.0, mapFeature.getPoint(0).getLongitude()); } } \ No newline at end of file