本文整理匯總了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();
}
示例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));
}