當前位置: 首頁>>代碼示例>>Java>>正文


Java Circle.setCenter方法代碼示例

本文整理匯總了Java中com.google.android.gms.maps.model.Circle.setCenter方法的典型用法代碼示例。如果您正苦於以下問題:Java Circle.setCenter方法的具體用法?Java Circle.setCenter怎麽用?Java Circle.setCenter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.android.gms.maps.model.Circle的用法示例。


在下文中一共展示了Circle.setCenter方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setCenter

import com.google.android.gms.maps.model.Circle; //導入方法依賴的package包/類
/**
 * set center
 * @param args
 * @param callbackContext
 * @throws JSONException
 */
@SuppressWarnings("unused")
private void setCenter(final JSONArray args, final CallbackContext callbackContext) throws JSONException {
  String id = args.getString(1);
  LatLng center = new LatLng(args.getDouble(2), args.getDouble(3));
  Circle circle = this.getCircle(id);
  circle.setCenter(center);
  callbackContext.success();
}
 
開發者ID:AdrianBZG,項目名稱:PhoneChat,代碼行數:15,代碼來源:PluginCircle.java

示例2: updateMarker

import com.google.android.gms.maps.model.Circle; //導入方法依賴的package包/類
private void updateMarker(double latitude, double longitude, String geofenceId, boolean move) {
    String geofenceExitId = geofenceId + "-exit";
    LatLng current = new LatLng(latitude, longitude);
    Marker marker;
    Circle circle;
    if (mapMarkers.containsKey(geofenceId)) {
        marker = mapMarkers.get(geofenceId);
        marker.setPosition(current);

        circle = mapCircles.get(geofenceId);
        if (circle != null) {
            circle.setCenter(current);
            circle.setRadius(fenceRadius);
        } else {
            Log.e(TAG, "missing circle for " + geofenceId);
        }
        circle = mapCircles.get(geofenceExitId);
        if (circle != null) {
            circle.setCenter(current);
            circle.setRadius(fenceRadiusExit);
        } else {
            Log.e(TAG, "missing circle for " + geofenceExitId);
        }
    } else {
        int iconId;
        if (geofenceId.equals(FENCE_HOME)) {
            iconId = R.drawable.home;
        } else {
            iconId = R.drawable.my_briefcase;
        }
        if (map != null) {

            CircleOptions circleOptions = new CircleOptions()
                    .center(current)
                    .radius(fenceRadius); // In meters

            CircleOptions circleExitOptions = new CircleOptions()
                    .center(current)
                    .strokeColor(Color.BLUE)
                    .radius(fenceRadiusExit); // In meters

            circle = map.addCircle(circleOptions);
            mapCircles.put(geofenceId, circle);

            circle = map.addCircle(circleExitOptions);
            mapCircles.put(geofenceExitId, circle);

            marker = map.addMarker(new MarkerOptions()
                    .icon(BitmapDescriptorFactory.fromResource(iconId))
                    .anchor(0.5f, 0.5f)
                    .title(geofenceId)
                    .position(current));
            mapMarkers.put(geofenceId, marker);
        }
    }
    if ((move) && (map != null)) map.moveCamera(CameraUpdateFactory.newLatLngZoom(current, 14));
}
 
開發者ID:rmceoin,項目名稱:cominghome,代碼行數:58,代碼來源:MainActivity.java


注:本文中的com.google.android.gms.maps.model.Circle.setCenter方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。