use of com.mapbox.maps.CameraOptions in project maps by rnmapbox.
the class RCTMGLCamera method getUserLocationUpdateCameraOptions.
private CameraOptions getUserLocationUpdateCameraOptions(double zoomLevel) {
LatLng center = mUserLocation.getCoordinate();
ScreenCoordinate anchor = CameraAnimationsUtils.getCamera(mMapView).getAnchor();
CameraState actState = mMapView.getMapboxMap().getCameraState();
if (mUserLocationVerticalAlignment != UserLocationVerticalAlignment.CENTER) {
CameraOptions options = ExtensionUtils.toCameraOptions(actState, anchor);
CoordinateBounds bounds = mMapView.getMapboxMap().coordinateBoundsForCamera(options);
switch(mUserLocationVerticalAlignment) {
case UserLocationVerticalAlignment.TOP:
center = new LatLng(bounds.getNortheast().latitude(), center.getLongitude());
break;
case UserLocationVerticalAlignment.BOTTOM:
center = new LatLng(bounds.getSouthwest().latitude(), center.getLongitude());
break;
}
}
return new CameraOptions.Builder().center(center.getPoint()).bearing(getDirectionForUserLocationUpdate()).pitch(mPitch).anchor(anchor).padding(actState.getPadding()).zoom(zoomLevel).build();
}
use of com.mapbox.maps.CameraOptions in project maps by rnmapbox.
the class RCTMGLSnapshotModule method getCameraOptions.
private CameraOptions getCameraOptions(ReadableMap jsOptions) {
Feature centerPoint = Feature.fromJson(jsOptions.getString("centerCoordinate"));
Point point = (Point) centerPoint.geometry();
CameraOptions.Builder cameraOptionsBuilder = new CameraOptions.Builder();
CameraOptions cameraOptions = cameraOptionsBuilder.center(point).pitch(jsOptions.getDouble("pitch")).bearing(jsOptions.getDouble("heading")).zoom(jsOptions.getDouble("zoomLevel")).build();
return cameraOptions;
}
Aggregations