本文整理汇总了Java中com.google.code.geocoder.model.GeocoderGeometry类的典型用法代码示例。如果您正苦于以下问题:Java GeocoderGeometry类的具体用法?Java GeocoderGeometry怎么用?Java GeocoderGeometry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GeocoderGeometry类属于com.google.code.geocoder.model包,在下文中一共展示了GeocoderGeometry类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: succeeded
import com.google.code.geocoder.model.GeocoderGeometry; //导入依赖的package包/类
@Override
protected void succeeded() {
super.succeeded();
GeocoderGeometry geometry = getValue();
if (geometry != null) {
LatLong position = new LatLong(geometry.getLocation().getLat().doubleValue(), geometry.getLocation().getLng().doubleValue());
MarkerOptions markerOptions = new MarkerOptions();
markerOptions.position(position);
markerOptions.title(entry.getTitle());
Marker marker = new Marker(markerOptions);
GoogleMap map = createMap();
map.addMarker(marker);
map.setCenter(position);
map.panTo(position);
mapViewWrapper.setVisible(true);
Platform.runLater(() -> Platform.runLater(() -> map.setCenter(position)));
}
}
示例2: locationToCoordinate
import com.google.code.geocoder.model.GeocoderGeometry; //导入依赖的package包/类
public GeocoderGeometry locationToCoordinate(String location) throws IOException {
GeocoderGeometry coordinate = null;
if (location != null && !location.isEmpty()) {
GeocoderRequest request = new GeocoderRequest();
request.setAddress(location);
GeocodeResponse response = geocoder.geocode(request);
if (response.getStatus() == GeocoderStatus.OK) {
List<GeocoderResult> results = response.getResults();
for (GeocoderResult result : results) {
GeocoderGeometry geometry = result.getGeometry();
coordinate = geometry;
break;
}
}
}
return coordinate;
}
示例3: coordinateToLocation
import com.google.code.geocoder.model.GeocoderGeometry; //导入依赖的package包/类
public String coordinateToLocation(GeocoderGeometry coordinate) throws IOException {
String location = null;
if (coordinate != null) {
GeocoderRequest request = new GeocoderRequest();
request.setLocation(coordinate.getLocation());
request.setBounds(coordinate.getBounds());
GeocodeResponse response = geocoder.geocode(request);
if (response.getStatus() == GeocoderStatus.OK) {
List<GeocoderResult> results = response.getResults();
for (GeocoderResult result : results) {
location = result.getFormattedAddress();
break;
}
}
}
return location;
}
示例4: GoogleCoordinates
import com.google.code.geocoder.model.GeocoderGeometry; //导入依赖的package包/类
public GoogleCoordinates(final GeocoderResult result) throws GeocoderException {
super();
if (result == null) {
throw new GeocoderException("No valid geocoder result found!");
}
final GeocoderGeometry geometry = result.getGeometry();
if (geometry == null) {
throw new GeocoderException("No geometry found in Google geocoding response!");
}
final LatLng latLng = geometry.getLocation();
if (latLng == null) {
throw new GeocoderException("No latitude/longitude found in Google geocoding response!");
}
final String lonLatString = latLng.getLng().setScale(PRECISION, ROUND_HALF_EVEN).toString() + "," + latLng.getLat().setScale(6, ROUND_HALF_EVEN).toString();
setCoordinates(lonLatString);
}
示例5: createTask
import com.google.code.geocoder.model.GeocoderGeometry; //导入依赖的package包/类
@Override
protected Task<GeocoderGeometry> createTask() {
return new Task<GeocoderGeometry>() {
@Override
protected GeocoderGeometry call() throws Exception {
Thread.sleep(1000);
return GoogleConnector.getInstance().getGeocoderService().locationToCoordinate(entry.getLocation());
}
};
}
示例6: handleRequest
import com.google.code.geocoder.model.GeocoderGeometry; //导入依赖的package包/类
private static String handleRequest(GeocoderResult r) {
GeocoderGeometry results = r.getGeometry();
LatLng loc = results.getLocation();
String s = loc.toString() + "#" + loc.toUrlValue();
return loc.toUrlValue();
}