Fix indent
This commit is contained in:
parent
61fb17bc76
commit
335a629bf1
1 changed files with 65 additions and 65 deletions
|
@ -332,7 +332,7 @@ public class GeoPointParserUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses geo and map intents:
|
* Parses geo and map intents:
|
||||||
*
|
*
|
||||||
* @param scheme
|
* @param scheme
|
||||||
* The intent scheme
|
* The intent scheme
|
||||||
* @param data
|
* @param data
|
||||||
|
@ -452,79 +452,79 @@ public class GeoPointParserUtil {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if ("geo".equals(scheme) || "osmand.geo".equals(scheme)) {
|
if ("geo".equals(scheme) || "osmand.geo".equals(scheme)) {
|
||||||
String schemeSpecific = data.getSchemeSpecificPart();
|
String schemeSpecific = data.getSchemeSpecificPart();
|
||||||
if (schemeSpecific == null) {
|
if (schemeSpecific == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
String name = null;
|
String name = null;
|
||||||
final Pattern namePattern = Pattern.compile("[\\+\\s]*\\((.*)\\)[\\+\\s]*$");
|
final Pattern namePattern = Pattern.compile("[\\+\\s]*\\((.*)\\)[\\+\\s]*$");
|
||||||
final Matcher nameMatcher = namePattern.matcher(schemeSpecific);
|
final Matcher nameMatcher = namePattern.matcher(schemeSpecific);
|
||||||
if (nameMatcher.find()) {
|
if (nameMatcher.find()) {
|
||||||
name = URLDecoder.decode(nameMatcher.group(1));
|
name = URLDecoder.decode(nameMatcher.group(1));
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
schemeSpecific = schemeSpecific.substring(0, nameMatcher.start());
|
schemeSpecific = schemeSpecific.substring(0, nameMatcher.start());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String positionPart;
|
String positionPart;
|
||||||
String queryPart = "";
|
String queryPart = "";
|
||||||
int queryStartIndex = schemeSpecific.indexOf('?');
|
int queryStartIndex = schemeSpecific.indexOf('?');
|
||||||
if (queryStartIndex == -1) {
|
if (queryStartIndex == -1) {
|
||||||
positionPart = schemeSpecific;
|
positionPart = schemeSpecific;
|
||||||
} else {
|
} else {
|
||||||
positionPart = schemeSpecific.substring(0, queryStartIndex);
|
positionPart = schemeSpecific.substring(0, queryStartIndex);
|
||||||
if (queryStartIndex < schemeSpecific.length())
|
if (queryStartIndex < schemeSpecific.length())
|
||||||
queryPart = schemeSpecific.substring(queryStartIndex + 1);
|
queryPart = schemeSpecific.substring(queryStartIndex + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
final Pattern positionPattern = Pattern.compile(
|
final Pattern positionPattern = Pattern.compile(
|
||||||
"([+-]?\\d+(?:\\.\\d+)?),([+-]?\\d+(?:\\.\\d+)?)");
|
"([+-]?\\d+(?:\\.\\d+)?),([+-]?\\d+(?:\\.\\d+)?)");
|
||||||
final Matcher positionMatcher = positionPattern.matcher(positionPart);
|
final Matcher positionMatcher = positionPattern.matcher(positionPart);
|
||||||
if (!positionMatcher.find()) {
|
if (!positionMatcher.find()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
double lat = Double.valueOf(positionMatcher.group(1));
|
double lat = Double.valueOf(positionMatcher.group(1));
|
||||||
double lon = Double.valueOf(positionMatcher.group(2));
|
double lon = Double.valueOf(positionMatcher.group(2));
|
||||||
|
|
||||||
int zoom = GeoParsedPoint.NO_ZOOM;
|
int zoom = GeoParsedPoint.NO_ZOOM;
|
||||||
String searchRequest = null;
|
String searchRequest = null;
|
||||||
for (String param : queryPart.split("&")) {
|
for (String param : queryPart.split("&")) {
|
||||||
String paramName;
|
String paramName;
|
||||||
String paramValue = null;
|
String paramValue = null;
|
||||||
int nameValueDelimititerIndex = param.indexOf('=');
|
int nameValueDelimititerIndex = param.indexOf('=');
|
||||||
if (nameValueDelimititerIndex == -1) {
|
if (nameValueDelimititerIndex == -1) {
|
||||||
paramName = param;
|
paramName = param;
|
||||||
} else {
|
} else {
|
||||||
paramName = param.substring(0, nameValueDelimititerIndex);
|
paramName = param.substring(0, nameValueDelimititerIndex);
|
||||||
if (nameValueDelimititerIndex < param.length())
|
if (nameValueDelimititerIndex < param.length())
|
||||||
paramValue = param.substring(nameValueDelimititerIndex + 1);
|
paramValue = param.substring(nameValueDelimititerIndex + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("z".equals(paramName) && paramValue != null) {
|
if ("z".equals(paramName) && paramValue != null) {
|
||||||
zoom = Integer.parseInt(paramValue);
|
zoom = Integer.parseInt(paramValue);
|
||||||
} else if ("q".equals(paramName) && paramValue != null) {
|
} else if ("q".equals(paramName) && paramValue != null) {
|
||||||
searchRequest = URLDecoder.decode(paramValue);
|
searchRequest = URLDecoder.decode(paramValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchRequest != null) {
|
if (searchRequest != null) {
|
||||||
final Matcher positionInSearchRequestMatcher =
|
final Matcher positionInSearchRequestMatcher =
|
||||||
positionPattern.matcher(searchRequest);
|
positionPattern.matcher(searchRequest);
|
||||||
if (lat == 0.0 && lon == 0.0 && positionInSearchRequestMatcher.find()) {
|
if (lat == 0.0 && lon == 0.0 && positionInSearchRequestMatcher.find()) {
|
||||||
lat = Double.valueOf(positionInSearchRequestMatcher.group(1));
|
lat = Double.valueOf(positionInSearchRequestMatcher.group(1));
|
||||||
lon = Double.valueOf(positionInSearchRequestMatcher.group(2));
|
lon = Double.valueOf(positionInSearchRequestMatcher.group(2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lat == 0.0 && lon == 0.0 && searchRequest != null) {
|
if (lat == 0.0 && lon == 0.0 && searchRequest != null) {
|
||||||
return new GeoParsedPoint(searchRequest);
|
return new GeoParsedPoint(searchRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (zoom != GeoParsedPoint.NO_ZOOM) {
|
if (zoom != GeoParsedPoint.NO_ZOOM) {
|
||||||
return new GeoParsedPoint(lat, lon, zoom, name);
|
return new GeoParsedPoint(lat, lon, zoom, name);
|
||||||
}
|
}
|
||||||
return new GeoParsedPoint(lat, lon, name);
|
return new GeoParsedPoint(lat, lon, name);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue