diff options
Diffstat (limited to 'platform')
-rw-r--r-- | platform/android/.project | 17 | ||||
-rw-r--r-- | platform/android/.settings/org.eclipse.buildship.core.prefs | 2 | ||||
-rw-r--r-- | platform/android/src/map/camera_position.cpp | 2 | ||||
-rwxr-xr-x | platform/android/src/native_map_view.cpp | 28 | ||||
-rw-r--r-- | platform/darwin/src/MGLMapSnapshotter.mm | 2 | ||||
-rw-r--r-- | platform/glfw/glfw_view.cpp | 8 | ||||
-rw-r--r-- | platform/glfw/main.cpp | 4 | ||||
-rw-r--r-- | platform/ios/src/MGLMapView.mm | 22 | ||||
-rw-r--r-- | platform/macos/src/MGLMapView.mm | 14 | ||||
-rw-r--r-- | platform/node/src/node_map.cpp | 4 | ||||
-rw-r--r-- | platform/qt/include/qmapboxgl.hpp | 2 | ||||
-rw-r--r-- | platform/qt/src/qmapboxgl.cpp | 10 |
12 files changed, 67 insertions, 48 deletions
diff --git a/platform/android/.project b/platform/android/.project new file mode 100644 index 0000000000..3964dd3f5b --- /dev/null +++ b/platform/android/.project @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>android</name> + <comment>Project android created by Buildship.</comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.buildship.core.gradleprojectbuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.buildship.core.gradleprojectnature</nature> + </natures> +</projectDescription> diff --git a/platform/android/.settings/org.eclipse.buildship.core.prefs b/platform/android/.settings/org.eclipse.buildship.core.prefs new file mode 100644 index 0000000000..e8895216fd --- /dev/null +++ b/platform/android/.settings/org.eclipse.buildship.core.prefs @@ -0,0 +1,2 @@ +connection.project.dir= +eclipse.preferences.version=1 diff --git a/platform/android/src/map/camera_position.cpp b/platform/android/src/map/camera_position.cpp index 6c7b78c101..fcbec5639a 100644 --- a/platform/android/src/map/camera_position.cpp +++ b/platform/android/src/map/camera_position.cpp @@ -14,7 +14,7 @@ jni::Local<jni::Object<CameraPosition>> CameraPosition::New(jni::JNIEnv &env, mb // convert bearing, measured in radians counterclockwise from true north. // Wrapped to [−π rad, π rad). Android binding from 0 to 360 degrees - double bearing_degrees = options.angle.value_or(0); + double bearing_degrees = options.bearing.value_or(0); while (bearing_degrees > 360) { bearing_degrees -= 360; } diff --git a/platform/android/src/native_map_view.cpp b/platform/android/src/native_map_view.cpp index 7cea8b00d7..050a5eaaaa 100755 --- a/platform/android/src/native_map_view.cpp +++ b/platform/android/src/native_map_view.cpp @@ -305,10 +305,10 @@ void NativeMapView::moveBy(jni::JNIEnv&, jni::jdouble dx, jni::jdouble dy, jni:: map->moveBy({dx, dy}, animationOptions); } -void NativeMapView::jumpTo(jni::JNIEnv&, jni::jdouble angle, jni::jdouble latitude, jni::jdouble longitude, jni::jdouble pitch, jni::jdouble zoom) { +void NativeMapView::jumpTo(jni::JNIEnv&, jni::jdouble bearing, jni::jdouble latitude, jni::jdouble longitude, jni::jdouble pitch, jni::jdouble zoom) { mbgl::CameraOptions options; - if (angle != -1) { - options.angle = angle; + if (bearing != -1) { + options.bearing = bearing; } options.center = mbgl::LatLng(latitude, longitude); options.padding = insets; @@ -322,10 +322,10 @@ void NativeMapView::jumpTo(jni::JNIEnv&, jni::jdouble angle, jni::jdouble latitu map->jumpTo(options); } -void NativeMapView::easeTo(jni::JNIEnv&, jni::jdouble angle, jni::jdouble latitude, jni::jdouble longitude, jni::jlong duration, jni::jdouble pitch, jni::jdouble zoom, jni::jboolean easing) { +void NativeMapView::easeTo(jni::JNIEnv&, jni::jdouble bearing, jni::jdouble latitude, jni::jdouble longitude, jni::jlong duration, jni::jdouble pitch, jni::jdouble zoom, jni::jboolean easing) { mbgl::CameraOptions cameraOptions; - if (angle != -1) { - cameraOptions.angle = angle; + if (bearing != -1) { + cameraOptions.bearing = bearing; } cameraOptions.center = mbgl::LatLng(latitude, longitude); cameraOptions.padding = insets; @@ -346,10 +346,10 @@ void NativeMapView::easeTo(jni::JNIEnv&, jni::jdouble angle, jni::jdouble latitu map->easeTo(cameraOptions, animationOptions); } -void NativeMapView::flyTo(jni::JNIEnv&, jni::jdouble angle, jni::jdouble latitude, jni::jdouble longitude, jni::jlong duration, jni::jdouble pitch, jni::jdouble zoom) { +void NativeMapView::flyTo(jni::JNIEnv&, jni::jdouble bearing, jni::jdouble latitude, jni::jdouble longitude, jni::jlong duration, jni::jdouble pitch, jni::jdouble zoom) { mbgl::CameraOptions cameraOptions; - if (angle != -1) { - cameraOptions.angle = angle; + if (bearing != -1) { + cameraOptions.bearing = bearing; } cameraOptions.center = mbgl::LatLng(latitude, longitude); cameraOptions.padding = insets; @@ -439,20 +439,20 @@ void NativeMapView::rotateBy(jni::JNIEnv&, jni::jdouble sx, jni::jdouble sy, jni } void NativeMapView::setBearing(jni::JNIEnv&, jni::jdouble degrees, jni::jlong duration) { - map->easeTo(mbgl::CameraOptions().withAngle(degrees), mbgl::AnimationOptions{mbgl::Milliseconds(duration)}); + map->easeTo(mbgl::CameraOptions().withBearing(degrees), mbgl::AnimationOptions{mbgl::Milliseconds(duration)}); } void NativeMapView::setBearingXY(jni::JNIEnv&, jni::jdouble degrees, jni::jdouble cx, jni::jdouble cy, jni::jlong duration) { mbgl::ScreenCoordinate anchor(cx, cy); - map->easeTo(mbgl::CameraOptions().withAngle(degrees).withAnchor(anchor), mbgl::AnimationOptions{mbgl::Milliseconds(duration)}); + map->easeTo(mbgl::CameraOptions().withBearing(degrees).withAnchor(anchor), mbgl::AnimationOptions{mbgl::Milliseconds(duration)}); } jni::jdouble NativeMapView::getBearing(jni::JNIEnv&) { - return *map->getCameraOptions().angle; + return *map->getCameraOptions().bearing; } void NativeMapView::resetNorth(jni::JNIEnv&) { - map->easeTo(mbgl::CameraOptions().withAngle(0.0), mbgl::AnimationOptions {{mbgl::Milliseconds(500)}}); + map->easeTo(mbgl::CameraOptions().withBearing(0.0), mbgl::AnimationOptions {{mbgl::Milliseconds(500)}}); } void NativeMapView::setVisibleCoordinateBounds(JNIEnv& env, const jni::Array<jni::Object<LatLng>>& coordinates, const jni::Object<RectF>& padding, jdouble direction, jni::jlong duration) { @@ -469,7 +469,7 @@ void NativeMapView::setVisibleCoordinateBounds(JNIEnv& env, const jni::Array<jni mbgl::EdgeInsets mbglInsets = { RectF::getTop(env, padding), RectF::getLeft(env, padding), RectF::getBottom(env, padding), RectF::getRight(env, padding) }; mbgl::CameraOptions cameraOptions = map->cameraForLatLngs(latLngs, mbglInsets); if (direction >= 0) { - cameraOptions.angle = direction; + cameraOptions.bearing = direction; } mbgl::AnimationOptions animationOptions; diff --git a/platform/darwin/src/MGLMapSnapshotter.mm b/platform/darwin/src/MGLMapSnapshotter.mm index afcfc91109..3918008b78 100644 --- a/platform/darwin/src/MGLMapSnapshotter.mm +++ b/platform/darwin/src/MGLMapSnapshotter.mm @@ -607,7 +607,7 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64; if (CLLocationCoordinate2DIsValid(options.camera.centerCoordinate)) { cameraOptions.center = MGLLatLngFromLocationCoordinate2D(options.camera.centerCoordinate); } - cameraOptions.angle = MAX(0, options.camera.heading); + cameraOptions.bearing = MAX(0, options.camera.heading); cameraOptions.zoom = MAX(0, options.zoomLevel); cameraOptions.pitch = MAX(0, options.camera.pitch); diff --git a/platform/glfw/glfw_view.cpp b/platform/glfw/glfw_view.cpp index d222112aa2..64c9eb495e 100644 --- a/platform/glfw/glfw_view.cpp +++ b/platform/glfw/glfw_view.cpp @@ -209,7 +209,7 @@ void GLFWView::onKey(GLFWwindow *window, int key, int /*scancode*/, int action, #endif // MBGL_USE_GLES2 case GLFW_KEY_N: if (!mods) - view->map->easeTo(mbgl::CameraOptions().withAngle(0.0), mbgl::AnimationOptions {{mbgl::Milliseconds(500)}}); + view->map->easeTo(mbgl::CameraOptions().withBearing(0.0), mbgl::AnimationOptions {{mbgl::Milliseconds(500)}}); break; case GLFW_KEY_Z: view->nextOrientation(); @@ -273,10 +273,10 @@ void GLFWView::onKey(GLFWwindow *window, int key, int /*scancode*/, int action, const mbgl::LatLng center { point.y, point.x }; auto latLng = *camera.center; double bearing = ruler.bearing({ latLng.longitude(), latLng.latitude() }, point); - double easing = bearing - *camera.angle; + double easing = bearing - *camera.bearing; easing += easing > 180.0 ? -360.0 : easing < -180 ? 360.0 : 0; - bearing = *camera.angle + (easing / 20); - routeMap->jumpTo(mbgl::CameraOptions().withCenter(center).withZoom(18.0).withAngle(bearing).withPitch(60.0)); + bearing = *camera.bearing + (easing / 20); + routeMap->jumpTo(mbgl::CameraOptions().withCenter(center).withZoom(18.0).withBearing(bearing).withPitch(60.0)); }; view->animateRouteCallback(view->map); } break; diff --git a/platform/glfw/main.cpp b/platform/glfw/main.cpp index 9963ca6884..c52ea92512 100644 --- a/platform/glfw/main.cpp +++ b/platform/glfw/main.cpp @@ -120,7 +120,7 @@ int main(int argc, char *argv[]) { map.jumpTo(mbgl::CameraOptions() .withCenter(mbgl::LatLng {settings.latitude, settings.longitude}) .withZoom(settings.zoom) - .withAngle(settings.bearing) + .withBearing(settings.bearing) .withPitch(settings.pitch)); map.setDebug(mbgl::MapDebugOptions(settings.debug)); @@ -178,7 +178,7 @@ int main(int argc, char *argv[]) { settings.latitude = camera.center->latitude(); settings.longitude = camera.center->longitude(); settings.zoom = *camera.zoom; - settings.bearing = *camera.angle; + settings.bearing = *camera.bearing; settings.pitch = *camera.pitch; settings.debug = mbgl::EnumType(map.getDebug()); settings.save(); diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index 353f87ad70..3de6e06e4d 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -1775,7 +1775,7 @@ public: { [self trackGestureEvent:MMEEventGestureRotateStart forRecognizer:rotate]; - self.angle = MGLRadiansFromDegrees(*self.mbglMap.getCameraOptions().angle) * -1; + self.angle = MGLRadiansFromDegrees(*self.mbglMap.getCameraOptions().bearing) * -1; if (self.userTrackingMode != MGLUserTrackingModeNone) { @@ -1803,7 +1803,7 @@ public: if ([self _shouldChangeFromCamera:oldCamera toCamera:toCamera]) { self.mbglMap.jumpTo(mbgl::CameraOptions() - .withAngle(newDegrees) + .withBearing(newDegrees) .withAnchor(mbgl::ScreenCoordinate { centerPoint.x, centerPoint.y})); } @@ -1840,7 +1840,7 @@ public: if ([self _shouldChangeFromCamera:oldCamera toCamera:toCamera]) { self.mbglMap.easeTo(mbgl::CameraOptions() - .withAngle(newDegrees) + .withBearing(newDegrees) .withAnchor(mbgl::ScreenCoordinate { centerPoint.x, centerPoint.y }), MGLDurationFromTimeInterval(decelerationRate)); @@ -2149,7 +2149,7 @@ public: MGLMapCamera *camera; mbgl::ScreenCoordinate anchor = mbgl::ScreenCoordinate { anchorPoint.x, anchorPoint.y }; - currentCameraOptions.angle = degrees; + currentCameraOptions.bearing = degrees; currentCameraOptions.anchor = anchor; camera = [self cameraForCameraOptions:currentCameraOptions]; @@ -2577,7 +2577,7 @@ public: MGLLogInfo(@"Resetting the map to the current style’s default viewport."); auto camera = self.mbglMap.getStyle().getDefaultCamera(); CGFloat pitch = *camera.pitch; - CLLocationDirection heading = mbgl::util::wrap(*camera.angle, 0., 360.); + CLLocationDirection heading = mbgl::util::wrap(*camera.bearing, 0., 360.); CLLocationDistance altitude = MGLAltitudeForZoomLevel(*camera.zoom, pitch, 0, self.frame.size); self.camera = [MGLMapCamera cameraLookingAtCenterCoordinate:MGLLocationCoordinate2DFromLatLng(*camera.center) altitude:altitude @@ -3235,7 +3235,7 @@ public: cameraOptions.zoom = zoomLevel; if (direction >= 0) { - cameraOptions.angle = direction; + cameraOptions.bearing = direction; } mbgl::AnimationOptions animationOptions; @@ -3491,7 +3491,7 @@ public: - (CLLocationDirection)direction { - return *self.mbglMap.getCameraOptions().angle; + return *self.mbglMap.getCameraOptions().bearing; } - (void)setDirection:(CLLocationDirection)direction animated:(BOOL)animated @@ -3524,7 +3524,7 @@ public: if (self.userTrackingMode == MGLUserTrackingModeNone) { self.mbglMap.easeTo(mbgl::CameraOptions() - .withAngle(direction) + .withBearing(direction) .withPadding(MGLEdgeInsetsFromNSEdgeInsets(self.contentInset)), MGLDurationFromTimeInterval(duration)); } @@ -3532,7 +3532,7 @@ public: { CGPoint anchor = self.userLocationAnnotationViewCenter; self.mbglMap.easeTo(mbgl::CameraOptions() - .withAngle(direction) + .withBearing(direction) .withAnchor(mbgl::ScreenCoordinate { anchor.x, anchor.y }), MGLDurationFromTimeInterval(duration)); } @@ -3797,7 +3797,7 @@ public: mbgl::CameraOptions mapCamera = self.mbglMap.getCameraOptions(); CLLocationCoordinate2D centerCoordinate = MGLLocationCoordinate2DFromLatLng(cameraOptions.center ? *cameraOptions.center : self.mbglMap.getLatLng()); double zoomLevel = cameraOptions.zoom ? *cameraOptions.zoom : self.zoomLevel; - CLLocationDirection direction = cameraOptions.angle ? mbgl::util::wrap(*cameraOptions.angle, 0., 360.) : self.direction; + CLLocationDirection direction = cameraOptions.bearing ? mbgl::util::wrap(*cameraOptions.bearing, 0., 360.) : self.direction; CGFloat pitch = cameraOptions.pitch ? *cameraOptions.pitch : *mapCamera.pitch; CLLocationDistance altitude = MGLAltitudeForZoomLevel(zoomLevel, pitch, centerCoordinate.latitude, self.frame.size); return [MGLMapCamera cameraLookingAtCenterCoordinate:centerCoordinate altitude:altitude pitch:pitch heading:direction]; @@ -3818,7 +3818,7 @@ public: self.frame.size); if (camera.heading >= 0) { - options.angle = camera.heading; + options.bearing = camera.heading; } if (camera.pitch >= 0) { diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm index c27cfee775..5f613922d8 100644 --- a/platform/macos/src/MGLMapView.mm +++ b/platform/macos/src/MGLMapView.mm @@ -1124,7 +1124,7 @@ public: } - (CLLocationDirection)direction { - return *_mbglMap->getCameraOptions().angle; + return *_mbglMap->getCameraOptions().bearing; } - (void)setDirection:(CLLocationDirection)direction { @@ -1136,14 +1136,14 @@ public: MGLLogDebug(@"Setting direction: %f animated: %@", direction, MGLStringFromBOOL(animated)); [self willChangeValueForKey:@"direction"]; _mbglMap->easeTo(mbgl::CameraOptions() - .withAngle(direction) + .withBearing(direction) .withPadding(MGLEdgeInsetsFromNSEdgeInsets(self.contentInsets)), MGLDurationFromTimeInterval(animated ? MGLAnimationDuration : 0)); [self didChangeValueForKey:@"direction"]; } - (void)offsetDirectionBy:(CLLocationDegrees)delta animated:(BOOL)animated { - [self setDirection:*_mbglMap->getCameraOptions().angle + delta animated:animated]; + [self setDirection:*_mbglMap->getCameraOptions().bearing + delta animated:animated]; } + (NSSet<NSString *> *)keyPathsForValuesAffectingCamera { @@ -1262,7 +1262,7 @@ public: camera.centerCoordinate.latitude, self.frame.size); if (camera.heading >= 0) { - options.angle = camera.heading; + options.bearing = camera.heading; } if (camera.pitch >= 0) { options.pitch = camera.pitch; @@ -1361,7 +1361,7 @@ public: mbgl::CameraOptions mapCamera = _mbglMap->getCameraOptions(); CLLocationCoordinate2D centerCoordinate = MGLLocationCoordinate2DFromLatLng(cameraOptions.center ? *cameraOptions.center : _mbglMap->getLatLng()); double zoomLevel = cameraOptions.zoom ? *cameraOptions.zoom : self.zoomLevel; - CLLocationDirection direction = cameraOptions.angle ? mbgl::util::wrap(*cameraOptions.angle, 0., 360.) : self.direction; + CLLocationDirection direction = cameraOptions.bearing ? mbgl::util::wrap(*cameraOptions.bearing, 0., 360.) : self.direction; CGFloat pitch = cameraOptions.pitch ? *cameraOptions.pitch : *mapCamera.pitch; CLLocationDistance altitude = MGLAltitudeForZoomLevel(zoomLevel, pitch, centerCoordinate.latitude, @@ -1487,7 +1487,7 @@ public: if (self.rotateEnabled) { CLLocationDirection newDirection = _directionAtBeginningOfGesture - delta.x / 10; [self willChangeValueForKey:@"direction"]; - _mbglMap->jumpTo(mbgl::CameraOptions().withAngle(newDirection).withAnchor(center)); + _mbglMap->jumpTo(mbgl::CameraOptions().withBearing(newDirection).withAnchor(center)); didChangeCamera = YES; [self didChangeValueForKey:@"direction"]; } @@ -1626,7 +1626,7 @@ public: NSPoint rotationPoint = [gestureRecognizer locationInView:self]; mbgl::ScreenCoordinate anchor(rotationPoint.x, self.bounds.size.height - rotationPoint.y); _mbglMap->jumpTo(mbgl::CameraOptions() - .withAngle(_directionAtBeginningOfGesture + gestureRecognizer.rotationInDegrees) + .withBearing(_directionAtBeginningOfGesture + gestureRecognizer.rotationInDegrees) .withAnchor(anchor)); if ([self.delegate respondsToSelector:@selector(mapView:shouldChangeFromCamera:toCamera:)] diff --git a/platform/node/src/node_map.cpp b/platform/node/src/node_map.cpp index 74201554dd..a685c2a12e 100644 --- a/platform/node/src/node_map.cpp +++ b/platform/node/src/node_map.cpp @@ -443,7 +443,7 @@ void NodeMap::startRender(NodeMap::RenderOptions options) { mbgl::CameraOptions camera; camera.center = mbgl::LatLng { options.latitude, options.longitude }; camera.zoom = options.zoom; - camera.angle = options.bearing; + camera.bearing = options.bearing; camera.pitch = options.pitch; if (map->getAxonometric() != options.axonometric) { @@ -976,7 +976,7 @@ void NodeMap::SetBearing(const Nan::FunctionCallbackInfo<v8::Value>& info) { } try { - nodeMap->map->jumpTo(mbgl::CameraOptions().withAngle(info[0]->NumberValue())); + nodeMap->map->jumpTo(mbgl::CameraOptions().withBearing(info[0]->NumberValue())); } catch (const std::exception &ex) { return Nan::ThrowError(ex.what()); } diff --git a/platform/qt/include/qmapboxgl.hpp b/platform/qt/include/qmapboxgl.hpp index 5309c58494..e83be37511 100644 --- a/platform/qt/include/qmapboxgl.hpp +++ b/platform/qt/include/qmapboxgl.hpp @@ -94,7 +94,7 @@ struct Q_MAPBOXGL_EXPORT QMapboxGLCameraOptions { QVariant center; // Coordinate QVariant anchor; // QPointF QVariant zoom; // double - QVariant angle; // double + QVariant bearing; // double QVariant pitch; // double }; diff --git a/platform/qt/src/qmapboxgl.cpp b/platform/qt/src/qmapboxgl.cpp index 3f3b40b7a8..02c38e209d 100644 --- a/platform/qt/src/qmapboxgl.cpp +++ b/platform/qt/src/qmapboxgl.cpp @@ -829,8 +829,8 @@ void QMapboxGL::jumpTo(const QMapboxGLCameraOptions& camera) if (camera.zoom.isValid()) { mbglCamera.zoom = camera.zoom.value<double>(); } - if (camera.angle.isValid()) { - mbglCamera.angle = camera.angle.value<double>(); + if (camera.bearing.isValid()) { + mbglCamera.bearing = camera.bearing.value<double>(); } if (camera.pitch.isValid()) { mbglCamera.pitch = camera.pitch.value<double>(); @@ -855,20 +855,20 @@ void QMapboxGL::jumpTo(const QMapboxGLCameraOptions& camera) */ double QMapboxGL::bearing() const { - return *d_ptr->mapObj->getCameraOptions().angle; + return *d_ptr->mapObj->getCameraOptions().bearing; } void QMapboxGL::setBearing(double degrees) { d_ptr->mapObj->jumpTo(mbgl::CameraOptions() - .withAngle(degrees) + .withBearing(degrees) .withPadding(d_ptr->margins)); } void QMapboxGL::setBearing(double degrees, const QPointF ¢er) { d_ptr->mapObj->jumpTo(mbgl::CameraOptions() - .withAngle(degrees) + .withBearing(degrees) .withAnchor(mbgl::ScreenCoordinate { center.x(), center.y() })); } |