rename GeoParsedPoint's named point var to "Label" after Google standard
This outlines the named point format of a geo: URI: https://developer.android.com/guide/components/intents-common.html#Maps
This commit is contained in:
parent
6f2e0029a5
commit
58485d8ba9
2 changed files with 26 additions and 22 deletions
|
@ -408,11 +408,11 @@ public class GeoPointParserUtil {
|
||||||
} else {
|
} else {
|
||||||
double aLat = actual.getLatitude(), eLat = expected.getLatitude(), aLon = actual.getLongitude(), eLon = expected.getLongitude();
|
double aLat = actual.getLatitude(), eLat = expected.getLatitude(), aLon = actual.getLongitude(), eLon = expected.getLongitude();
|
||||||
int aZoom = actual.getZoom(), eZoom = expected.getZoom();
|
int aZoom = actual.getZoom(), eZoom = expected.getZoom();
|
||||||
String aName = actual.getName(), eName = expected.getName();
|
String aLabel = actual.getLabel(), eLabel = expected.getLabel();
|
||||||
if (eName != null) {
|
if (eLabel != null) {
|
||||||
if (!aName.equals(eName)) {
|
if (!aLabel.equals(eLabel)) {
|
||||||
throw new RuntimeException("Point name\\capture is not equal; actual=" + aName + ", expected="
|
throw new RuntimeException("Point label is not equal; actual="
|
||||||
+ eName);
|
+ aLabel + ", expected=" + eLabel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!areCloseEnough(eLat, aLat, 5)) {
|
if (!areCloseEnough(eLat, aLat, 5)) {
|
||||||
|
@ -435,11 +435,11 @@ public class GeoPointParserUtil {
|
||||||
} else {
|
} else {
|
||||||
double aLat = actual.getLatitude(), eLat = expected.getLatitude(), aLon = actual.getLongitude(), eLon = expected.getLongitude();
|
double aLat = actual.getLatitude(), eLat = expected.getLatitude(), aLon = actual.getLongitude(), eLon = expected.getLongitude();
|
||||||
int aZoom = actual.getZoom(), eZoom = expected.getZoom();
|
int aZoom = actual.getZoom(), eZoom = expected.getZoom();
|
||||||
String aName = actual.getName(), eName = expected.getName();
|
String aLabel = actual.getLabel(), eLabel = expected.getLabel();
|
||||||
if (eName != null) {
|
if (eLabel != null) {
|
||||||
if (!aName.equals(eName)) {
|
if (!aLabel.equals(eLabel)) {
|
||||||
throw new RuntimeException("Point name\\capture is not equal; actual=" + aName + ", expected="
|
throw new RuntimeException("Point label is not equal; actual="
|
||||||
+ eName);
|
+ aLabel + ", expected=" + eLabel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (((int)eLat) != ((int)aLat)) {
|
if (((int)eLat) != ((int)aLat)) {
|
||||||
|
@ -780,10 +780,10 @@ public class GeoPointParserUtil {
|
||||||
public static class GeoParsedPoint {
|
public static class GeoParsedPoint {
|
||||||
private static final int NO_ZOOM = -1;
|
private static final int NO_ZOOM = -1;
|
||||||
|
|
||||||
private double lat;
|
private double lat = 0;
|
||||||
private double lon;
|
private double lon = 0;
|
||||||
private int zoom = NO_ZOOM;
|
private int zoom = NO_ZOOM;
|
||||||
private String name;
|
private String label;
|
||||||
private String query;
|
private String query;
|
||||||
private boolean geoPoint;
|
private boolean geoPoint;
|
||||||
private boolean geoAddress;
|
private boolean geoAddress;
|
||||||
|
@ -795,10 +795,10 @@ public class GeoPointParserUtil {
|
||||||
this.geoPoint = true;
|
this.geoPoint = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GeoParsedPoint(double lat, double lon, String name) {
|
public GeoParsedPoint(double lat, double lon, String label) {
|
||||||
this(lat, lon);
|
this(lat, lon);
|
||||||
if (name != null)
|
if (label != null)
|
||||||
this.name = name.replaceAll("\\+", " ");
|
this.label = label.replaceAll("\\+", " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
public GeoParsedPoint(double lat, double lon, int zoom) {
|
public GeoParsedPoint(double lat, double lon, int zoom) {
|
||||||
|
@ -806,8 +806,8 @@ public class GeoPointParserUtil {
|
||||||
this.zoom = zoom;
|
this.zoom = zoom;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GeoParsedPoint(double lat, double lon, int zoom, String name) {
|
public GeoParsedPoint(double lat, double lon, int zoom, String label) {
|
||||||
this(lat, lon, name);
|
this(lat, lon, label);
|
||||||
this.zoom = zoom;
|
this.zoom = zoom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -839,8 +839,8 @@ public class GeoPointParserUtil {
|
||||||
return zoom;
|
return zoom;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getLabel() {
|
||||||
return name;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getQuery() {
|
public String getQuery() {
|
||||||
|
@ -855,6 +855,10 @@ public class GeoPointParserUtil {
|
||||||
return geoAddress;
|
return geoAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates a URI string according to http://geouri.org and
|
||||||
|
* https://developer.android.com/guide/components/intents-common.html#Maps
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return isGeoPoint() ? "GeoParsedPoint [lat=" + lat + ", lon=" + lon + ", zoom=" + zoom + ", name=" + name
|
return isGeoPoint() ? "GeoParsedPoint [lat=" + lat + ", lon=" + lon + ", zoom=" + zoom + ", name=" + name
|
||||||
|
|
|
@ -210,8 +210,8 @@ public class GeoIntentActivity extends OsmandListActivity {
|
||||||
private MyService extract(final Uri uri) {
|
private MyService extract(final Uri uri) {
|
||||||
GeoPointParserUtil.GeoParsedPoint p = GeoPointParserUtil.parse(uri.toString());
|
GeoPointParserUtil.GeoParsedPoint p = GeoPointParserUtil.parse(uri.toString());
|
||||||
if (p.isGeoPoint()) {
|
if (p.isGeoPoint()) {
|
||||||
if (p.getName() != null) {
|
if (p.getLabel() != null) {
|
||||||
return new GeoPointSearch(p.getLatitude(), p.getLongitude(), p.getName(), p.getZoom());
|
return new GeoPointSearch(p.getLatitude(), p.getLongitude(), p.getLabel(), p.getZoom());
|
||||||
}
|
}
|
||||||
return new GeoPointSearch(p.getLatitude(), p.getLongitude(), p.getZoom());
|
return new GeoPointSearch(p.getLatitude(), p.getLongitude(), p.getZoom());
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue