当前位置: 首页>>代码示例>>Java>>正文


Java GeocoderGeometry类代码示例

本文整理汇总了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)));
    }
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:20,代码来源:GoogleEntryGMapsFXView.java

示例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;
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:22,代码来源:GoogleGeocoderService.java

示例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;
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:21,代码来源:GoogleGeocoderService.java

示例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);
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:21,代码来源:GoogleCoordinates.java

示例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());
        }
    };
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:11,代码来源:GoogleEntryGMapsFXView.java

示例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();
}
 
开发者ID:kamir,项目名称:MorphMiner,代码行数:7,代码来源:SimpleGeoCoder.java


注:本文中的com.google.code.geocoder.model.GeocoderGeometry类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。