mirror of
https://gitlab.com/oeffi/oeffi.git
synced 2025-07-10 17:48:50 +00:00
Adapt to: Point: Store coordinate as pair of double, rather than 1E6 ints.
This commit is contained in:
parent
18229f3f05
commit
5873e26d46
19 changed files with 128 additions and 114 deletions
|
@ -317,7 +317,7 @@ public class OeffiMapView extends MapView {
|
|||
Station selectedStation = null;
|
||||
|
||||
for (final Station station : stations) {
|
||||
if (station.location.hasLocation()) {
|
||||
if (station.location.hasCoord()) {
|
||||
projection.toPixels(new GeoPoint(station.location.getLatAsDouble(),
|
||||
station.location.getLonAsDouble()), point);
|
||||
|
||||
|
|
|
@ -788,23 +788,23 @@ public class DirectionsActivity extends OeffiMainActivity implements ActivityCom
|
|||
mapView.setFromViaToAware(new FromViaToAware() {
|
||||
public Point getFrom() {
|
||||
final Location from = viewFromLocation.getLocation();
|
||||
if (from == null || !from.hasLocation())
|
||||
if (from == null || !from.hasCoord())
|
||||
return null;
|
||||
return new Point(from.lat, from.lon);
|
||||
return from.coord;
|
||||
}
|
||||
|
||||
public Point getVia() {
|
||||
final Location via = viewViaLocation.getLocation();
|
||||
if (via == null || !via.hasLocation() || viewViaLocation.getVisibility() != View.VISIBLE)
|
||||
if (via == null || !via.hasCoord() || viewViaLocation.getVisibility() != View.VISIBLE)
|
||||
return null;
|
||||
return new Point(via.lat, via.lon);
|
||||
return via.coord;
|
||||
}
|
||||
|
||||
public Point getTo() {
|
||||
final Location to = viewToLocation.getLocation();
|
||||
if (to == null || !to.hasLocation())
|
||||
if (to == null || !to.hasCoord())
|
||||
return null;
|
||||
return new Point(to.lat, to.lon);
|
||||
return to.coord;
|
||||
}
|
||||
});
|
||||
mapView.zoomToAll();
|
||||
|
@ -933,7 +933,7 @@ public class DirectionsActivity extends OeffiMainActivity implements ActivityCom
|
|||
return false;
|
||||
if (location.type == LocationType.ANY && location.name == null)
|
||||
return false;
|
||||
if (!allowIncompleteAddress && location.type == LocationType.ADDRESS && !location.hasLocation()
|
||||
if (!allowIncompleteAddress && location.type == LocationType.ADDRESS && !location.hasCoord()
|
||||
&& location.name == null)
|
||||
return false;
|
||||
|
||||
|
@ -1301,8 +1301,9 @@ public class DirectionsActivity extends OeffiMainActivity implements ActivityCom
|
|||
.contains(constraintStr.toLowerCase(Constants.DEFAULT_LOCALE))) {
|
||||
final Location location = new Location(
|
||||
QueryHistoryProvider.convert(cursor.getInt(fromTypeC)),
|
||||
cursor.getString(fromIdC), cursor.getInt(fromLatC),
|
||||
cursor.getInt(fromLonC), cursor.getString(fromPlaceC), fromName);
|
||||
cursor.getString(fromIdC),
|
||||
Point.from1E6(cursor.getInt(fromLatC), cursor.getInt(fromLonC)),
|
||||
cursor.getString(fromPlaceC), fromName);
|
||||
if (!results.contains(location))
|
||||
results.add(location);
|
||||
}
|
||||
|
@ -1311,7 +1312,8 @@ public class DirectionsActivity extends OeffiMainActivity implements ActivityCom
|
|||
.contains(constraintStr.toLowerCase(Constants.DEFAULT_LOCALE))) {
|
||||
final Location location = new Location(
|
||||
QueryHistoryProvider.convert(cursor.getInt(toTypeC)),
|
||||
cursor.getString(toIdC), cursor.getInt(toLatC), cursor.getInt(toLonC),
|
||||
cursor.getString(toIdC),
|
||||
Point.from1E6(cursor.getInt(toLatC), cursor.getInt(toLonC)),
|
||||
cursor.getString(toPlaceC), toName);
|
||||
if (!results.contains(location))
|
||||
results.add(location);
|
||||
|
|
|
@ -214,7 +214,8 @@ public class DirectionsShortcutActivity extends OeffiActivity
|
|||
final String id = getLocationIdExtra(intent);
|
||||
final int lat = intent.getIntExtra(INTENT_EXTRA_LAT, 0);
|
||||
final int lon = intent.getIntExtra(INTENT_EXTRA_LON, 0);
|
||||
final Location to = new Location(type, id, lat, lon, null, id != null ? name : name + "!");
|
||||
final Point coord = lat != 0 || lon != 0 ? Point.from1E6(lat, lon) : null;
|
||||
final Location to = new Location(type, id, coord, null, id != null ? name : name + "!");
|
||||
|
||||
if (networkProvider != null) {
|
||||
final Optimize optimize = prefs.contains(Constants.PREFS_KEY_OPTIMIZE_TRIP)
|
||||
|
|
|
@ -69,7 +69,7 @@ public class LocationTextView extends TextView {
|
|||
text.append(location.place).append(",<br>");
|
||||
if (location.name != null)
|
||||
text.append("<b>").append(location.name).append("</b>");
|
||||
if (text.length() == 0 && location.hasLocation())
|
||||
if (text.length() == 0 && location.hasCoord())
|
||||
text.append(getContext().getString(R.string.directions_location_view_coordinate)).append(":<br/>")
|
||||
.append(String.format(Locale.ENGLISH, "%1$.6f, %2$.6f", location.getLatAsDouble(),
|
||||
location.getLonAsDouble()));
|
||||
|
|
|
@ -96,8 +96,8 @@ public class QueryHistoryProvider extends ContentProvider {
|
|||
|
||||
if (cursor.getInt(cursor.getColumnIndexOrThrow(QueryHistoryProvider.KEY_FROM_LAT)) == 0
|
||||
&& cursor.getInt(cursor.getColumnIndexOrThrow(QueryHistoryProvider.KEY_FROM_LON)) == 0) {
|
||||
values.put(QueryHistoryProvider.KEY_FROM_LAT, from.lat);
|
||||
values.put(QueryHistoryProvider.KEY_FROM_LON, from.lon);
|
||||
values.put(QueryHistoryProvider.KEY_FROM_LAT, from.getLatAs1E6());
|
||||
values.put(QueryHistoryProvider.KEY_FROM_LON, from.getLonAs1E6());
|
||||
}
|
||||
|
||||
if (cursor.getInt(cursor.getColumnIndexOrThrow(QueryHistoryProvider.KEY_TO_ID)) == 0)
|
||||
|
@ -105,8 +105,8 @@ public class QueryHistoryProvider extends ContentProvider {
|
|||
|
||||
if (cursor.getInt(cursor.getColumnIndexOrThrow(QueryHistoryProvider.KEY_TO_LAT)) == 0
|
||||
&& cursor.getInt(cursor.getColumnIndexOrThrow(QueryHistoryProvider.KEY_TO_LON)) == 0) {
|
||||
values.put(QueryHistoryProvider.KEY_TO_LAT, to.lat);
|
||||
values.put(QueryHistoryProvider.KEY_TO_LON, to.lon);
|
||||
values.put(QueryHistoryProvider.KEY_TO_LAT, to.getLatAs1E6());
|
||||
values.put(QueryHistoryProvider.KEY_TO_LON, to.getLonAs1E6());
|
||||
}
|
||||
|
||||
if (favorite != null)
|
||||
|
@ -125,14 +125,14 @@ public class QueryHistoryProvider extends ContentProvider {
|
|||
final ContentValues values = new ContentValues();
|
||||
values.put(QueryHistoryProvider.KEY_FROM_TYPE, QueryHistoryProvider.convert(from.type));
|
||||
values.put(QueryHistoryProvider.KEY_FROM_ID, from.id);
|
||||
values.put(QueryHistoryProvider.KEY_FROM_LAT, from.lat);
|
||||
values.put(QueryHistoryProvider.KEY_FROM_LON, from.lon);
|
||||
values.put(QueryHistoryProvider.KEY_FROM_LAT, from.getLatAs1E6());
|
||||
values.put(QueryHistoryProvider.KEY_FROM_LON, from.getLonAs1E6());
|
||||
values.put(QueryHistoryProvider.KEY_FROM_PLACE, from.place);
|
||||
values.put(QueryHistoryProvider.KEY_FROM_NAME, from.name);
|
||||
values.put(QueryHistoryProvider.KEY_TO_TYPE, QueryHistoryProvider.convert(to.type));
|
||||
values.put(QueryHistoryProvider.KEY_TO_ID, to.id);
|
||||
values.put(QueryHistoryProvider.KEY_TO_LAT, to.lat);
|
||||
values.put(QueryHistoryProvider.KEY_TO_LON, to.lon);
|
||||
values.put(QueryHistoryProvider.KEY_TO_LAT, to.getLatAs1E6());
|
||||
values.put(QueryHistoryProvider.KEY_TO_LON, to.getLonAs1E6());
|
||||
values.put(QueryHistoryProvider.KEY_TO_PLACE, to.place);
|
||||
values.put(QueryHistoryProvider.KEY_TO_NAME, to.name);
|
||||
|
||||
|
|
|
@ -494,7 +494,7 @@ public class TripDetailsActivity extends OeffiActivity implements LocationListen
|
|||
if (leg instanceof Trip.Public) {
|
||||
final Trip.Public publicLeg = (Trip.Public) leg;
|
||||
|
||||
if (publicLeg.departure.hasLocation()) {
|
||||
if (publicLeg.departure.hasCoord()) {
|
||||
android.location.Location.distanceBetween(publicLeg.departure.getLatAsDouble(),
|
||||
publicLeg.departure.getLonAsDouble(), location.getLatAsDouble(),
|
||||
location.getLonAsDouble(), distanceBetweenResults);
|
||||
|
@ -508,7 +508,7 @@ public class TripDetailsActivity extends OeffiActivity implements LocationListen
|
|||
final List<Stop> intermediateStops = publicLeg.intermediateStops;
|
||||
if (intermediateStops != null) {
|
||||
for (final Stop stop : intermediateStops) {
|
||||
if (stop.location.hasLocation()) {
|
||||
if (stop.location.hasCoord()) {
|
||||
android.location.Location.distanceBetween(stop.location.getLatAsDouble(),
|
||||
stop.location.getLonAsDouble(), location.getLatAsDouble(),
|
||||
location.getLonAsDouble(), distanceBetweenResults);
|
||||
|
@ -521,7 +521,7 @@ public class TripDetailsActivity extends OeffiActivity implements LocationListen
|
|||
}
|
||||
}
|
||||
|
||||
if (publicLeg.arrival.hasLocation()) {
|
||||
if (publicLeg.arrival.hasCoord()) {
|
||||
android.location.Location.distanceBetween(publicLeg.arrival.getLatAsDouble(),
|
||||
publicLeg.arrival.getLonAsDouble(), location.getLatAsDouble(),
|
||||
location.getLonAsDouble(), distanceBetweenResults);
|
||||
|
@ -705,7 +705,7 @@ public class TripDetailsActivity extends OeffiActivity implements LocationListen
|
|||
final ImageButton mapView = (ImageButton) row.findViewById(R.id.directions_trip_details_individual_entry_map);
|
||||
mapView.setVisibility(View.GONE);
|
||||
mapView.setOnClickListener(null);
|
||||
if (leg.arrival.hasLocation()) {
|
||||
if (leg.arrival.hasCoord()) {
|
||||
mapView.setVisibility(View.VISIBLE);
|
||||
mapView.setOnClickListener(new MapClickListener(leg.arrival));
|
||||
} else if (leg.arrival.hasId()) {
|
||||
|
@ -970,7 +970,7 @@ public class TripDetailsActivity extends OeffiActivity implements LocationListen
|
|||
if (cursor.moveToFirst()) {
|
||||
final int latColumnIndex = cursor.getColumnIndexOrThrow(NetworkContentProvider.KEY_LAT);
|
||||
final int lonColumnIndex = cursor.getColumnIndexOrThrow(NetworkContentProvider.KEY_LON);
|
||||
point = new Point(cursor.getInt(latColumnIndex), cursor.getInt(lonColumnIndex));
|
||||
point = Point.from1E6(cursor.getInt(latColumnIndex), cursor.getInt(lonColumnIndex));
|
||||
} else {
|
||||
point = null;
|
||||
}
|
||||
|
@ -994,7 +994,7 @@ public class TripDetailsActivity extends OeffiActivity implements LocationListen
|
|||
if (cursor.moveToFirst()) {
|
||||
final int latColumnIndex = cursor.getColumnIndexOrThrow(NetworkContentProvider.KEY_LAT);
|
||||
final int lonColumnIndex = cursor.getColumnIndexOrThrow(NetworkContentProvider.KEY_LON);
|
||||
point = new Point(cursor.getInt(latColumnIndex), cursor.getInt(lonColumnIndex));
|
||||
point = Point.from1E6(cursor.getInt(latColumnIndex), cursor.getInt(lonColumnIndex));
|
||||
} else {
|
||||
point = null;
|
||||
}
|
||||
|
@ -1127,8 +1127,8 @@ public class TripDetailsActivity extends OeffiActivity implements LocationListen
|
|||
}
|
||||
|
||||
private Point pointFromLocation(final Location location) {
|
||||
if (location.hasLocation())
|
||||
return new Point(location.lat, location.lon);
|
||||
if (location.hasCoord())
|
||||
return location.coord;
|
||||
|
||||
if (location.hasId()) {
|
||||
final Point point = pointFromStationDb(location.id);
|
||||
|
|
|
@ -22,6 +22,7 @@ import de.schildbach.oeffi.directions.QueryHistoryProvider;
|
|||
import de.schildbach.oeffi.stations.FavoriteStationsProvider;
|
||||
import de.schildbach.pte.NetworkId;
|
||||
import de.schildbach.pte.dto.Location;
|
||||
import de.schildbach.pte.dto.Point;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.content.ContentValues;
|
||||
|
@ -184,10 +185,11 @@ public class QueryHistoryAdapter extends RecyclerView.Adapter<QueryHistoryViewHo
|
|||
cursor.moveToPosition(position);
|
||||
final long rowId = cursor.getLong(rowIdColumn);
|
||||
final Location from = new Location(QueryHistoryProvider.convert(cursor.getInt(fromTypeColumn)),
|
||||
cursor.getString(fromIdColumn), cursor.getInt(fromLatColumn), cursor.getInt(fromLonColumn),
|
||||
cursor.getString(fromIdColumn),
|
||||
Point.from1E6(cursor.getInt(fromLatColumn), cursor.getInt(fromLonColumn)),
|
||||
cursor.getString(fromPlaceColumn), cursor.getString(fromNameColumn));
|
||||
final Location to = new Location(QueryHistoryProvider.convert(cursor.getInt(toTypeColumn)),
|
||||
cursor.getString(toIdColumn), cursor.getInt(toLatColumn), cursor.getInt(toLonColumn),
|
||||
cursor.getString(toIdColumn), Point.from1E6(cursor.getInt(toLatColumn), cursor.getInt(toLonColumn)),
|
||||
cursor.getString(toPlaceColumn), cursor.getString(toNameColumn));
|
||||
final boolean isFavorite = cursor.getInt(favoriteColumn) == 1;
|
||||
final long savedTripDepartureTime = cursor.getLong(savedTripDepartureTimeColumn);
|
||||
|
|
|
@ -499,8 +499,8 @@ public class NetworkPickerActivity extends Activity implements ActivityCompat.On
|
|||
if (area == null || area.length <= 2)
|
||||
return false;
|
||||
|
||||
final int lat = deviceLocation.lat;
|
||||
final int lon = deviceLocation.lon;
|
||||
final double lat = deviceLocation.getLatAsDouble();
|
||||
final double lon = deviceLocation.getLonAsDouble();
|
||||
|
||||
// raycast point in polygon test
|
||||
final int numPoints = area.length;
|
||||
|
@ -510,9 +510,11 @@ public class NetworkPickerActivity extends Activity implements ActivityCompat.On
|
|||
final Point vertex1 = area[i];
|
||||
final Point vertex2 = area[j];
|
||||
|
||||
if (vertex1.lon < lon && vertex2.lon >= lon || vertex2.lon < lon && vertex1.lon >= lon) {
|
||||
if ((double) (vertex1.lat + (lon - vertex1.lon)) / (vertex2.lon - vertex1.lon)
|
||||
* (vertex2.lat - vertex1.lat) < lat)
|
||||
if (vertex1.getLonAsDouble() < lon && vertex2.getLonAsDouble() >= lon
|
||||
|| vertex2.getLonAsDouble() < lon && vertex1.getLonAsDouble() >= lon) {
|
||||
if ((vertex1.getLatAsDouble() + (lon - vertex1.getLonAsDouble()))
|
||||
/ (vertex2.getLonAsDouble() - vertex1.getLonAsDouble())
|
||||
* (vertex2.getLatAsDouble() - vertex1.getLatAsDouble()) < lat)
|
||||
inArea = !inArea;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@ import de.schildbach.pte.dto.Line;
|
|||
import de.schildbach.pte.dto.LineDestination;
|
||||
import de.schildbach.pte.dto.Location;
|
||||
import de.schildbach.pte.dto.LocationType;
|
||||
import de.schildbach.pte.dto.Point;
|
||||
import de.schildbach.pte.dto.QueryDeparturesResult;
|
||||
import de.schildbach.pte.dto.StationDepartures;
|
||||
|
||||
|
@ -215,7 +216,8 @@ public class PlanActivity extends Activity {
|
|||
final String label = stationsCursor.getString(labelColumn);
|
||||
final int x = stationsCursor.getInt(xColumn);
|
||||
final int y = stationsCursor.getInt(yColumn);
|
||||
stations.add(new Station(network, new Location(LocationType.STATION, localId, y, x, null, label)));
|
||||
final Point point = Point.from1E6(y, x);
|
||||
stations.add(new Station(network, new Location(LocationType.STATION, localId, point, null, label)));
|
||||
}
|
||||
stationsCursor.close();
|
||||
}
|
||||
|
@ -283,7 +285,7 @@ public class PlanActivity extends Activity {
|
|||
private void selectStation(final Station selection) {
|
||||
this.selection = selection;
|
||||
|
||||
plan.animatePlanIntoView(selection.location.lon, selection.location.lat);
|
||||
plan.animatePlanIntoView(selection.location.getLonAs1E6(), selection.location.getLatAs1E6());
|
||||
|
||||
bubble.setVisibility(View.VISIBLE);
|
||||
bubbleName.setText(selection.location.name);
|
||||
|
@ -331,7 +333,7 @@ public class PlanActivity extends Activity {
|
|||
private void updateBubble() {
|
||||
final Station selection = this.selection;
|
||||
if (selection != null) {
|
||||
final int[] coords = new int[] { selection.location.lon, selection.location.lat };
|
||||
final int[] coords = new int[] { selection.location.getLonAs1E6(), selection.location.getLatAs1E6() };
|
||||
plan.translateToViewCoordinates(coords);
|
||||
final BubbleLayout.LayoutParams layoutParams = (BubbleLayout.LayoutParams) bubble.getLayoutParams();
|
||||
layoutParams.x = coords[0];
|
||||
|
|
|
@ -234,7 +234,7 @@ public class PlanContentProvider extends ContentProvider {
|
|||
filterMatch = false;
|
||||
|
||||
if (filterMatch) {
|
||||
cursor.newRow().add(rowId).add(planId).add(planName).add(p.lat).add(p.lon)
|
||||
cursor.newRow().add(rowId).add(planId).add(planName).add(p.getLatAs1E6()).add(p.getLonAs1E6())
|
||||
.add(planValidFrom != null ? planValidFrom.getTime() : 0).add(planDisclaimer).add(planUrl)
|
||||
.add(planNetworkLogo);
|
||||
}
|
||||
|
@ -373,13 +373,13 @@ public class PlanContentProvider extends ContentProvider {
|
|||
|
||||
public int compare(final Integer index1, final Integer index2) {
|
||||
cursor.moveToPosition(index1);
|
||||
final Point p1 = new Point(cursor.getInt(latColumn), cursor.getInt(lonColumn));
|
||||
final Point p1 = Point.from1E6(cursor.getInt(latColumn), cursor.getInt(lonColumn));
|
||||
android.location.Location.distanceBetween(lat, lon, p1.getLatAsDouble(), p1.getLonAsDouble(),
|
||||
distanceBetweenResults);
|
||||
final float dist1 = distanceBetweenResults[0];
|
||||
|
||||
cursor.moveToPosition(index2);
|
||||
final Point p2 = new Point(cursor.getInt(latColumn), cursor.getInt(lonColumn));
|
||||
final Point p2 = Point.from1E6(cursor.getInt(latColumn), cursor.getInt(lonColumn));
|
||||
android.location.Location.distanceBetween(lat, lon, p2.getLatAsDouble(), p2.getLonAsDouble(),
|
||||
distanceBetweenResults);
|
||||
final float dist2 = distanceBetweenResults[0];
|
||||
|
|
|
@ -351,8 +351,8 @@ public class ScrollImageView extends ImageView implements Runnable {
|
|||
double tappedDistance = 0;
|
||||
|
||||
for (final Station station : stations) {
|
||||
coords[0] = station.location.lon;
|
||||
coords[1] = station.location.lat;
|
||||
coords[0] = station.location.getLonAs1E6();
|
||||
coords[1] = station.location.getLatAs1E6();
|
||||
translateToViewCoordinates(coords);
|
||||
final double distance = Math
|
||||
.sqrt(Math.pow(e.getX() - coords[0], 2) + Math.pow(e.getY() - coords[1], 2));
|
||||
|
|
|
@ -25,6 +25,7 @@ import de.schildbach.oeffi.Application;
|
|||
import de.schildbach.pte.NetworkId;
|
||||
import de.schildbach.pte.dto.Location;
|
||||
import de.schildbach.pte.dto.LocationType;
|
||||
import de.schildbach.pte.dto.Point;
|
||||
|
||||
import android.content.ContentProvider;
|
||||
import android.content.ContentResolver;
|
||||
|
@ -130,8 +131,9 @@ public class FavoriteStationsProvider extends ContentProvider {
|
|||
final int nameIndex = cursor.getColumnIndexOrThrow(FavoriteStationsProvider.KEY_STATION_NAME);
|
||||
final int latIndex = cursor.getColumnIndexOrThrow(FavoriteStationsProvider.KEY_STATION_LAT);
|
||||
final int lonIndex = cursor.getColumnIndexOrThrow(FavoriteStationsProvider.KEY_STATION_LON);
|
||||
return new Location(LocationType.STATION, cursor.getString(idIndex), cursor.getInt(latIndex),
|
||||
cursor.getInt(lonIndex), cursor.getString(placeIndex), cursor.getString(nameIndex));
|
||||
return new Location(LocationType.STATION, cursor.getString(idIndex),
|
||||
Point.from1E6(cursor.getInt(latIndex), cursor.getInt(lonIndex)), cursor.getString(placeIndex),
|
||||
cursor.getString(nameIndex));
|
||||
}
|
||||
|
||||
public static Integer favState(final ContentResolver contentResolver, final NetworkId network,
|
||||
|
|
|
@ -41,8 +41,8 @@ public class FavoriteUtils {
|
|||
values.put(FavoriteStationsProvider.KEY_STATION_ID, station.id);
|
||||
values.put(FavoriteStationsProvider.KEY_STATION_PLACE, station.place);
|
||||
values.put(FavoriteStationsProvider.KEY_STATION_NAME, station.name);
|
||||
values.put(FavoriteStationsProvider.KEY_STATION_LAT, station.lat);
|
||||
values.put(FavoriteStationsProvider.KEY_STATION_LON, station.lon);
|
||||
values.put(FavoriteStationsProvider.KEY_STATION_LAT, station.getLatAs1E6());
|
||||
values.put(FavoriteStationsProvider.KEY_STATION_LON, station.getLonAs1E6());
|
||||
|
||||
final Uri rowUri = contentResolver.insert(FavoriteStationsProvider.CONTENT_URI, values);
|
||||
|
||||
|
|
|
@ -195,7 +195,7 @@ public class NearestFavoriteStationWidgetService extends JobIntentService {
|
|||
final String stationId = favCursor.getString(stationIdCol);
|
||||
String stationPlace = favCursor.getString(stationPlaceCol);
|
||||
String stationName = favCursor.getString(stationNameCol);
|
||||
Point stationPoint = new Point(favCursor.getInt(stationLatCol), favCursor.getInt(stationLonCol));
|
||||
Point stationPoint = Point.from1E6(favCursor.getInt(stationLatCol), favCursor.getInt(stationLonCol));
|
||||
|
||||
try {
|
||||
final NetworkId networkId = NetworkId.valueOf(network);
|
||||
|
@ -214,13 +214,13 @@ public class NearestFavoriteStationWidgetService extends JobIntentService {
|
|||
if (placeCol != -1)
|
||||
stationPlace = stationCursor.getString(placeCol);
|
||||
stationName = stationCursor.getString(nameCol);
|
||||
stationPoint = new Point(stationCursor.getInt(latCol), stationCursor.getInt(lonCol));
|
||||
stationPoint = Point.from1E6(stationCursor.getInt(latCol), stationCursor.getInt(lonCol));
|
||||
}
|
||||
|
||||
stationCursor.close();
|
||||
}
|
||||
|
||||
if (stationPoint.lat > 0 || stationPoint.lon > 0) {
|
||||
if (stationPoint.getLatAsDouble() > 0 || stationPoint.getLonAsDouble() > 0) {
|
||||
final float[] distanceBetweenResults = new float[1];
|
||||
android.location.Location.distanceBetween(here.getLatitude(), here.getLongitude(),
|
||||
stationPoint.getLatAsDouble(), stationPoint.getLonAsDouble(), distanceBetweenResults);
|
||||
|
|
|
@ -64,7 +64,7 @@ public class StationContextMenu extends PopupMenu {
|
|||
menu.findItem(R.id.station_context_add_ignore).setVisible(showIgnore && !isIgnored);
|
||||
menu.findItem(R.id.station_context_remove_ignore).setVisible(showIgnore && isIgnored);
|
||||
final MenuItem mapItem = menu.findItem(R.id.station_context_map);
|
||||
if (showMap && station.hasLocation())
|
||||
if (showMap && station.hasCoord())
|
||||
prepareMapMenu(context, mapItem.getSubMenu(), network, station);
|
||||
else
|
||||
mapItem.setVisible(false);
|
||||
|
@ -96,9 +96,11 @@ public class StationContextMenu extends PopupMenu {
|
|||
if (location.type == LocationType.STATION
|
||||
&& (networkId != NetworkId.BVG || Integer.parseInt(location.id) >= 1000000))
|
||||
shortcutIntent.putExtra(DirectionsShortcutActivity.INTENT_EXTRA_ID, location.id);
|
||||
if (location.hasLocation()) {
|
||||
shortcutIntent.putExtra(DirectionsShortcutActivity.INTENT_EXTRA_LAT, location.lat);
|
||||
shortcutIntent.putExtra(DirectionsShortcutActivity.INTENT_EXTRA_LON, location.lon);
|
||||
if (location.hasCoord()) {
|
||||
shortcutIntent.putExtra(DirectionsShortcutActivity.INTENT_EXTRA_LAT,
|
||||
location.getLatAs1E6());
|
||||
shortcutIntent.putExtra(DirectionsShortcutActivity.INTENT_EXTRA_LON,
|
||||
location.getLonAs1E6());
|
||||
}
|
||||
|
||||
ShortcutManagerCompat.requestPinShortcut(context,
|
||||
|
@ -132,7 +134,7 @@ public class StationContextMenu extends PopupMenu {
|
|||
name != null ? '(' + URLEncoder.encode(name.replaceAll("[()]", "")) + ')' : "")));
|
||||
googleMapsIntent.setComponent(
|
||||
new ComponentName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity"));
|
||||
googleMapsItem.setVisible(location.hasLocation() && pm.resolveActivity(googleMapsIntent, 0) != null);
|
||||
googleMapsItem.setVisible(location.hasCoord() && pm.resolveActivity(googleMapsIntent, 0) != null);
|
||||
googleMapsItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
public boolean onMenuItemClick(final MenuItem item) {
|
||||
context.startActivity(googleMapsIntent);
|
||||
|
@ -146,7 +148,7 @@ public class StationContextMenu extends PopupMenu {
|
|||
name != null ? '(' + URLEncoder.encode(name.replaceAll("[()]", "")) + ')' : "")));
|
||||
amazonMapsIntent.setComponent(
|
||||
new ComponentName("com.amazon.geo.client.maps", "com.amazon.geo.client.renderer.MapsAppActivityDuke"));
|
||||
amazonMapsItem.setVisible(location.hasLocation() && pm.resolveActivity(amazonMapsIntent, 0) != null);
|
||||
amazonMapsItem.setVisible(location.hasCoord() && pm.resolveActivity(amazonMapsIntent, 0) != null);
|
||||
amazonMapsItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
public boolean onMenuItemClick(final MenuItem item) {
|
||||
context.startActivity(amazonMapsIntent);
|
||||
|
@ -158,7 +160,7 @@ public class StationContextMenu extends PopupMenu {
|
|||
final Intent openStreetMapsIntent = new Intent(Intent.ACTION_VIEW,
|
||||
Uri.parse(String.format(Locale.ENGLISH, "osmand.geo:%.6f,%.6f?q=%.6f,%.6f%s", lat, lon, lat, lon,
|
||||
name != null ? '(' + URLEncoder.encode(name.replaceAll("[()]", "")) + ')' : "")));
|
||||
openStreetMapsItem.setVisible(location.hasLocation() && pm.resolveActivity(openStreetMapsIntent, 0) != null);
|
||||
openStreetMapsItem.setVisible(location.hasCoord() && pm.resolveActivity(openStreetMapsIntent, 0) != null);
|
||||
openStreetMapsItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
public boolean onMenuItemClick(final MenuItem item) {
|
||||
context.startActivity(openStreetMapsIntent);
|
||||
|
@ -171,8 +173,7 @@ public class StationContextMenu extends PopupMenu {
|
|||
Uri.parse(String.format(Locale.ENGLISH, "google.streetview:cbll=%.6f,%.6f", lat, lon)));
|
||||
googleStreetViewIntent
|
||||
.setComponent(new ComponentName("com.google.android.street", "com.google.android.street.Street"));
|
||||
googleStreetViewItem
|
||||
.setVisible(location.hasLocation() && pm.resolveActivity(googleStreetViewIntent, 0) != null);
|
||||
googleStreetViewItem.setVisible(location.hasCoord() && pm.resolveActivity(googleStreetViewIntent, 0) != null);
|
||||
googleStreetViewItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
public boolean onMenuItemClick(final MenuItem item) {
|
||||
context.startActivity(googleStreetViewIntent);
|
||||
|
@ -186,8 +187,7 @@ public class StationContextMenu extends PopupMenu {
|
|||
name != null ? URLEncoder.encode(name) : "")));
|
||||
googleNavigationIntent.setComponent(new ComponentName("com.google.android.apps.maps",
|
||||
"com.google.android.maps.driveabout.app.NavigationActivity"));
|
||||
googleNavigationItem
|
||||
.setVisible(location.hasLocation() && pm.resolveActivity(googleNavigationIntent, 0) != null);
|
||||
googleNavigationItem.setVisible(location.hasCoord() && pm.resolveActivity(googleNavigationIntent, 0) != null);
|
||||
googleNavigationItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
public boolean onMenuItemClick(final MenuItem item) {
|
||||
context.startActivity(googleNavigationIntent);
|
||||
|
|
|
@ -57,6 +57,7 @@ import de.schildbach.pte.dto.Line;
|
|||
import de.schildbach.pte.dto.LineDestination;
|
||||
import de.schildbach.pte.dto.Location;
|
||||
import de.schildbach.pte.dto.LocationType;
|
||||
import de.schildbach.pte.dto.Point;
|
||||
import de.schildbach.pte.dto.Product;
|
||||
import de.schildbach.pte.dto.QueryDeparturesResult;
|
||||
import de.schildbach.pte.dto.StationDepartures;
|
||||
|
@ -410,7 +411,7 @@ public class StationDetailsActivity extends OeffiActivity implements StationsAwa
|
|||
.getColumnIndexOrThrow(NetworkContentProvider.KEY_LINES);
|
||||
|
||||
location = new Location(LocationType.STATION, location.id,
|
||||
cursor.getInt(latCol), cursor.getInt(lonCol),
|
||||
Point.from1E6(cursor.getInt(latCol), cursor.getInt(lonCol)),
|
||||
placeCol != -1 ? cursor.getString(placeCol) : selectedStation.place,
|
||||
cursor.getString(nameCol));
|
||||
|
||||
|
@ -520,8 +521,8 @@ public class StationDetailsActivity extends OeffiActivity implements StationsAwa
|
|||
final int lonCol = stationCursor.getColumnIndexOrThrow(NetworkContentProvider.KEY_LON);
|
||||
final int linesCol = stationCursor.getColumnIndexOrThrow(NetworkContentProvider.KEY_LINES);
|
||||
|
||||
selectedStation = new Location(LocationType.STATION, selectedStation.id, stationCursor.getInt(latCol),
|
||||
stationCursor.getInt(lonCol),
|
||||
selectedStation = new Location(LocationType.STATION, selectedStation.id,
|
||||
Point.from1E6(stationCursor.getInt(latCol), stationCursor.getInt(lonCol)),
|
||||
placeCol != -1 ? stationCursor.getString(placeCol) : selectedStation.place,
|
||||
stationCursor.getString(nameCol));
|
||||
|
||||
|
@ -551,7 +552,7 @@ public class StationDetailsActivity extends OeffiActivity implements StationsAwa
|
|||
|
||||
selectedFavState = FavoriteStationsProvider.favState(getContentResolver(), selectedNetwork, selectedStation);
|
||||
|
||||
if (selectedStation.hasLocation())
|
||||
if (selectedStation.hasCoord())
|
||||
mapView.getController()
|
||||
.animateTo(new GeoPoint(selectedStation.getLatAsDouble(), selectedStation.getLonAsDouble()));
|
||||
|
||||
|
|
|
@ -612,7 +612,7 @@ public class StationsActivity extends OeffiMainActivity implements StationsAware
|
|||
if (favState == null || favState != FavoriteStationsProvider.TYPE_FAVORITE) {
|
||||
i.remove();
|
||||
stationsMap.remove(station.location.id);
|
||||
} else if (station.location.hasLocation()) {
|
||||
} else if (station.location.hasCoord()) {
|
||||
android.location.Location.distanceBetween(deviceLocation.getLatAsDouble(),
|
||||
deviceLocation.getLonAsDouble(), station.location.getLatAsDouble(),
|
||||
station.location.getLonAsDouble(), distanceBetweenResults);
|
||||
|
@ -839,8 +839,8 @@ public class StationsActivity extends OeffiMainActivity implements StationsAware
|
|||
|
||||
final Builder uriBuilder = NetworkContentProvider.CONTENT_URI.buildUpon();
|
||||
uriBuilder.appendPath(network.name());
|
||||
uriBuilder.appendQueryParameter("lat", Integer.toString(referenceLocation.lat));
|
||||
uriBuilder.appendQueryParameter("lon", Integer.toString(referenceLocation.lon));
|
||||
uriBuilder.appendQueryParameter("lat", Integer.toString(referenceLocation.getLatAs1E6()));
|
||||
uriBuilder.appendQueryParameter("lon", Integer.toString(referenceLocation.getLonAs1E6()));
|
||||
uriBuilder.appendQueryParameter("ids", favoriteIds.toString());
|
||||
final Cursor cursor = getContentResolver().query(uriBuilder.build(), null, null, null, null);
|
||||
|
||||
|
@ -877,7 +877,8 @@ public class StationsActivity extends OeffiMainActivity implements StationsAware
|
|||
: cursor.getString(nativeIdColumnIndex);
|
||||
final String place = placeColumnIndex != -1 ? cursor.getString(placeColumnIndex) : null;
|
||||
final String name = cursor.getString(nameColumnIndex);
|
||||
final Point p = new Point(cursor.getInt(latColumnIndex), cursor.getInt(lonColumnIndex));
|
||||
final Point p = Point.from1E6(cursor.getInt(latColumnIndex),
|
||||
cursor.getInt(lonColumnIndex));
|
||||
final Station station = new Station(network,
|
||||
new de.schildbach.pte.dto.Location(LocationType.STATION, id, p, place, name),
|
||||
lineDestinations);
|
||||
|
@ -923,7 +924,7 @@ public class StationsActivity extends OeffiMainActivity implements StationsAware
|
|||
|
||||
if (favType == FavoriteStationsProvider.TYPE_FAVORITE) {
|
||||
final Station station = new Station(network, location, null);
|
||||
if (deviceLocation != null && location.hasLocation()) {
|
||||
if (deviceLocation != null && location.hasCoord()) {
|
||||
android.location.Location.distanceBetween(deviceLocation.getLatAsDouble(),
|
||||
deviceLocation.getLonAsDouble(), location.getLatAsDouble(), location.getLonAsDouble(),
|
||||
distanceBetweenResults);
|
||||
|
@ -950,7 +951,7 @@ public class StationsActivity extends OeffiMainActivity implements StationsAware
|
|||
final float[] distanceBetweenResults = new float[2];
|
||||
|
||||
for (final Station freshStation : freshStations) {
|
||||
if (freshStation.location.hasLocation()) {
|
||||
if (freshStation.location.hasCoord()) {
|
||||
android.location.Location.distanceBetween(referenceLat, referenceLon,
|
||||
freshStation.location.getLatAsDouble(), freshStation.location.getLonAsDouble(),
|
||||
distanceBetweenResults);
|
||||
|
@ -1316,7 +1317,7 @@ public class StationsActivity extends OeffiMainActivity implements StationsAware
|
|||
}
|
||||
|
||||
// scroll map
|
||||
if (station != null && station.location.hasLocation())
|
||||
if (station != null && station.location.hasCoord())
|
||||
mapView.zoomToStations(Arrays.asList(station));
|
||||
else if (!stations.isEmpty())
|
||||
mapView.zoomToStations(stations);
|
||||
|
@ -1494,7 +1495,7 @@ public class StationsActivity extends OeffiMainActivity implements StationsAware
|
|||
final float[] distanceBetweenResults = new float[2];
|
||||
|
||||
for (final Station station : stations) {
|
||||
if (station.location.hasLocation()) {
|
||||
if (station.location.hasCoord()) {
|
||||
android.location.Location.distanceBetween(hereLat, hereLon, station.location.getLatAsDouble(),
|
||||
station.location.getLonAsDouble(), distanceBetweenResults);
|
||||
station.setDistanceAndBearing(distanceBetweenResults[0], distanceBetweenResults[1]);
|
||||
|
@ -1616,6 +1617,7 @@ public class StationsActivity extends OeffiMainActivity implements StationsAware
|
|||
|| mQuery.reset(name).find()) {
|
||||
final int lat = cursor.getInt(latColumnIndex);
|
||||
final int lon = cursor.getInt(lonColumnIndex);
|
||||
final Point coord = Point.from1E6(lat, lon);
|
||||
final List<LineDestination> lineDestinations = new LinkedList<>();
|
||||
for (final String lineStr : cursor.getString(linesColumnIndex).split(",")) {
|
||||
if (!lineStr.isEmpty()) {
|
||||
|
@ -1626,7 +1628,7 @@ public class StationsActivity extends OeffiMainActivity implements StationsAware
|
|||
.add(new LineDestination(new Line(null, null, product, label, style), null));
|
||||
}
|
||||
}
|
||||
final Location location = new Location(LocationType.STATION, id, lat, lon, place, name);
|
||||
final Location location = new Location(LocationType.STATION, id, coord, place, name);
|
||||
stations.add(new Station(network, location, lineDestinations));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ public class LocationUriParser {
|
|||
final Point coord;
|
||||
if (m.matches()) {
|
||||
final Point c = Point.fromDouble(Double.parseDouble(m.group(1)), Double.parseDouble(m.group(2)));
|
||||
if (c.lat != 0 || c.lon != 0)
|
||||
if (c.getLatAs1E6() != 0 || c.getLonAs1E6() != 0)
|
||||
coord = c;
|
||||
else
|
||||
coord = null;
|
||||
|
|
|
@ -34,13 +34,13 @@ public class LocationUriParserTest {
|
|||
final Location toLocation = results[1];
|
||||
|
||||
Assert.assertEquals(LocationType.ADDRESS, fromLocation.type);
|
||||
Assert.assertEquals(9905079, fromLocation.lon);
|
||||
Assert.assertEquals(53587885, fromLocation.lat);
|
||||
Assert.assertEquals(9905079, fromLocation.getLonAs1E6());
|
||||
Assert.assertEquals(53587885, fromLocation.getLatAs1E6());
|
||||
Assert.assertNull(fromLocation.name);
|
||||
|
||||
Assert.assertEquals(LocationType.ADDRESS, toLocation.type);
|
||||
Assert.assertEquals(9719720, toLocation.lon);
|
||||
Assert.assertEquals(52368950, toLocation.lat);
|
||||
Assert.assertEquals(9719720, toLocation.getLonAs1E6());
|
||||
Assert.assertEquals(52368950, toLocation.getLatAs1E6());
|
||||
Assert.assertEquals("home", toLocation.name);
|
||||
}
|
||||
|
||||
|
@ -54,13 +54,13 @@ public class LocationUriParserTest {
|
|||
final Location toLocation = results[1];
|
||||
|
||||
Assert.assertEquals(LocationType.COORD, fromLocation.type);
|
||||
Assert.assertEquals(13426309, fromLocation.lon);
|
||||
Assert.assertEquals(52536088, fromLocation.lat);
|
||||
Assert.assertEquals(13426309, fromLocation.getLonAs1E6());
|
||||
Assert.assertEquals(52536088, fromLocation.getLatAs1E6());
|
||||
Assert.assertNull(fromLocation.name);
|
||||
|
||||
Assert.assertEquals(LocationType.ADDRESS, toLocation.type);
|
||||
Assert.assertEquals(13374129, toLocation.lon);
|
||||
Assert.assertEquals(52525681, toLocation.lat);
|
||||
Assert.assertEquals(13374129, toLocation.getLonAs1E6());
|
||||
Assert.assertEquals(52525681, toLocation.getLatAs1E6());
|
||||
Assert.assertEquals("Work", toLocation.name);
|
||||
}
|
||||
|
||||
|
@ -74,13 +74,13 @@ public class LocationUriParserTest {
|
|||
final Location toLocation = results[1];
|
||||
|
||||
Assert.assertEquals(LocationType.COORD, fromLocation.type);
|
||||
Assert.assertEquals(13344510, fromLocation.lon);
|
||||
Assert.assertEquals(52547400, fromLocation.lat);
|
||||
Assert.assertEquals(13344510, fromLocation.getLonAs1E6());
|
||||
Assert.assertEquals(52547400, fromLocation.getLatAs1E6());
|
||||
Assert.assertNull(fromLocation.name);
|
||||
|
||||
Assert.assertEquals(LocationType.COORD, toLocation.type);
|
||||
Assert.assertEquals(13353884, toLocation.lon);
|
||||
Assert.assertEquals(52505719, toLocation.lat);
|
||||
Assert.assertEquals(13353884, toLocation.getLonAs1E6());
|
||||
Assert.assertEquals(52505719, toLocation.getLatAs1E6());
|
||||
Assert.assertNull(toLocation.name);
|
||||
}
|
||||
|
||||
|
@ -95,8 +95,8 @@ public class LocationUriParserTest {
|
|||
final Location location = results[0];
|
||||
|
||||
Assert.assertEquals(LocationType.ADDRESS, location.type);
|
||||
Assert.assertEquals(13413215, location.lon);
|
||||
Assert.assertEquals(52521918, location.lat);
|
||||
Assert.assertEquals(13413215, location.getLonAs1E6());
|
||||
Assert.assertEquals(52521918, location.getLatAs1E6());
|
||||
Assert.assertEquals("Alexanderplatz, 10178 Berlin", location.name);
|
||||
}
|
||||
|
||||
|
@ -109,8 +109,8 @@ public class LocationUriParserTest {
|
|||
final Location location = results[0];
|
||||
|
||||
Assert.assertEquals(LocationType.ADDRESS, location.type);
|
||||
Assert.assertEquals(13420671, location.lon);
|
||||
Assert.assertEquals(52512845, location.lat);
|
||||
Assert.assertEquals(13420671, location.getLonAs1E6());
|
||||
Assert.assertEquals(52512845, location.getLatAs1E6());
|
||||
Assert.assertEquals("c-base", location.name);
|
||||
}
|
||||
|
||||
|
@ -123,8 +123,8 @@ public class LocationUriParserTest {
|
|||
final Location location = results[0];
|
||||
|
||||
Assert.assertEquals(LocationType.ADDRESS, location.type);
|
||||
Assert.assertEquals(9634707, location.lon);
|
||||
Assert.assertEquals(47460045, location.lat);
|
||||
Assert.assertEquals(9634707, location.getLonAs1E6());
|
||||
Assert.assertEquals(47460045, location.getLatAs1E6());
|
||||
Assert.assertEquals("Work", location.name);
|
||||
}
|
||||
|
||||
|
@ -136,8 +136,8 @@ public class LocationUriParserTest {
|
|||
final Location location = results[0];
|
||||
|
||||
Assert.assertEquals(LocationType.ANY, location.type);
|
||||
Assert.assertEquals(0, location.lon);
|
||||
Assert.assertEquals(0, location.lat);
|
||||
Assert.assertEquals(0, location.getLonAs1E6());
|
||||
Assert.assertEquals(0, location.getLatAs1E6());
|
||||
Assert.assertEquals("gleimstr.", location.name);
|
||||
}
|
||||
|
||||
|
@ -150,8 +150,8 @@ public class LocationUriParserTest {
|
|||
final Location location = results[0];
|
||||
|
||||
Assert.assertEquals(LocationType.ADDRESS, location.type);
|
||||
Assert.assertEquals(13401525, location.lon);
|
||||
Assert.assertEquals(52535836, location.lat);
|
||||
Assert.assertEquals(13401525, location.getLonAs1E6());
|
||||
Assert.assertEquals(52535836, location.getLatAs1E6());
|
||||
Assert.assertEquals("Zionskirchstraße 7, 10119 Berlin, Germany", location.name);
|
||||
}
|
||||
|
||||
|
@ -164,8 +164,8 @@ public class LocationUriParserTest {
|
|||
final Location location = results[0];
|
||||
|
||||
Assert.assertEquals(LocationType.ADDRESS, location.type);
|
||||
Assert.assertEquals(13420106, location.lon);
|
||||
Assert.assertEquals(52513064, location.lat);
|
||||
Assert.assertEquals(13420106, location.getLonAs1E6());
|
||||
Assert.assertEquals(52513064, location.getLatAs1E6());
|
||||
Assert.assertEquals("C-Base, Rungestraße, Berlin, Germany", location.name);
|
||||
}
|
||||
|
||||
|
@ -177,8 +177,8 @@ public class LocationUriParserTest {
|
|||
final Location location = results[0];
|
||||
|
||||
Assert.assertEquals(LocationType.ANY, location.type);
|
||||
Assert.assertEquals(0, location.lat);
|
||||
Assert.assertEquals(0, location.lon);
|
||||
Assert.assertEquals(0, location.getLatAs1E6());
|
||||
Assert.assertEquals(0, location.getLonAs1E6());
|
||||
Assert.assertEquals("Karl-Marx-Allee 84, Berlin", location.name);
|
||||
}
|
||||
|
||||
|
@ -190,8 +190,8 @@ public class LocationUriParserTest {
|
|||
final Location locationNewline = resultsNewline[0];
|
||||
|
||||
Assert.assertEquals(LocationType.ANY, locationNewline.type);
|
||||
Assert.assertEquals(0, locationNewline.lat);
|
||||
Assert.assertEquals(0, locationNewline.lon);
|
||||
Assert.assertEquals(0, locationNewline.getLatAs1E6());
|
||||
Assert.assertEquals(0, locationNewline.getLonAs1E6());
|
||||
Assert.assertEquals("Karl-Marx-Allee 84, Berlin", locationNewline.name);
|
||||
|
||||
final Location[] resultsEncodedNewline = LocationUriParser
|
||||
|
@ -201,8 +201,8 @@ public class LocationUriParserTest {
|
|||
final Location locationEncodedNewline = resultsEncodedNewline[0];
|
||||
|
||||
Assert.assertEquals(LocationType.ANY, locationEncodedNewline.type);
|
||||
Assert.assertEquals(0, locationEncodedNewline.lat);
|
||||
Assert.assertEquals(0, locationEncodedNewline.lon);
|
||||
Assert.assertEquals(0, locationEncodedNewline.getLatAs1E6());
|
||||
Assert.assertEquals(0, locationEncodedNewline.getLonAs1E6());
|
||||
Assert.assertEquals("Karl-Marx-Allee 84, Berlin", locationEncodedNewline.name);
|
||||
|
||||
final Location[] resultsComma = LocationUriParser.parseLocations("geo:0,0?q=Karl-Marx-Allee+84,%0aBerlin");
|
||||
|
@ -211,8 +211,8 @@ public class LocationUriParserTest {
|
|||
final Location locationComma = resultsComma[0];
|
||||
|
||||
Assert.assertEquals(LocationType.ANY, locationComma.type);
|
||||
Assert.assertEquals(0, locationComma.lat);
|
||||
Assert.assertEquals(0, locationComma.lon);
|
||||
Assert.assertEquals(0, locationComma.getLatAs1E6());
|
||||
Assert.assertEquals(0, locationComma.getLonAs1E6());
|
||||
Assert.assertEquals("Karl-Marx-Allee 84, Berlin", locationComma.name);
|
||||
}
|
||||
|
||||
|
@ -224,8 +224,8 @@ public class LocationUriParserTest {
|
|||
final Location location = results[0];
|
||||
|
||||
Assert.assertEquals(LocationType.ANY, location.type);
|
||||
Assert.assertEquals(0, location.lat);
|
||||
Assert.assertEquals(0, location.lon);
|
||||
Assert.assertEquals(0, location.getLatAs1E6());
|
||||
Assert.assertEquals(0, location.getLonAs1E6());
|
||||
Assert.assertEquals("Prinzenstraße 85, Berlin", location.name);
|
||||
}
|
||||
|
||||
|
@ -238,8 +238,8 @@ public class LocationUriParserTest {
|
|||
final Location location = results[0];
|
||||
|
||||
Assert.assertEquals(LocationType.ADDRESS, location.type);
|
||||
Assert.assertEquals(52503520, location.lat);
|
||||
Assert.assertEquals(13409188, location.lon);
|
||||
Assert.assertEquals(52503520, location.getLatAs1E6());
|
||||
Assert.assertEquals(13409188, location.getLonAs1E6());
|
||||
Assert.assertEquals(
|
||||
"motion*s Tanz- und Bewegungsstudio - Stella Caric GmbH, Prinzenstraße 85, Aufgang B1 - Zugang von der Oranienstraße, 10969 Berlin, Germany",
|
||||
location.name);
|
||||
|
@ -253,8 +253,8 @@ public class LocationUriParserTest {
|
|||
final Location location = results[0];
|
||||
|
||||
Assert.assertEquals(LocationType.COORD, location.type);
|
||||
Assert.assertEquals(52133331, location.lat);
|
||||
Assert.assertEquals(11600000, location.lon);
|
||||
Assert.assertEquals(52133331, location.getLatAs1E6());
|
||||
Assert.assertEquals(11600000, location.getLonAs1E6());
|
||||
Assert.assertNull(location.name);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue