summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--benchmark/util/tilecover.benchmark.cpp2
-rw-r--r--bin/render.cpp2
-rw-r--r--include/mbgl/map/camera.hpp6
-rw-r--r--platform/android/.project17
-rw-r--r--platform/android/.settings/org.eclipse.buildship.core.prefs2
-rw-r--r--platform/android/src/map/camera_position.cpp2
-rwxr-xr-xplatform/android/src/native_map_view.cpp28
-rw-r--r--platform/darwin/src/MGLMapSnapshotter.mm2
-rw-r--r--platform/glfw/glfw_view.cpp8
-rw-r--r--platform/glfw/main.cpp4
-rw-r--r--platform/ios/src/MGLMapView.mm22
-rw-r--r--platform/macos/src/MGLMapView.mm14
-rw-r--r--platform/node/src/node_map.cpp4
-rw-r--r--platform/qt/include/qmapboxgl.hpp2
-rw-r--r--platform/qt/src/qmapboxgl.cpp10
-rw-r--r--src/mbgl/layout/symbol_projection.cpp4
-rw-r--r--src/mbgl/map/map.cpp6
-rw-r--r--src/mbgl/map/transform.cpp48
-rw-r--r--src/mbgl/map/transform.hpp7
-rw-r--r--src/mbgl/map/transform_state.cpp14
-rw-r--r--src/mbgl/map/transform_state.hpp4
-rw-r--r--src/mbgl/programs/fill_extrusion_program.cpp2
-rw-r--r--src/mbgl/renderer/layers/render_circle_layer.cpp2
-rw-r--r--src/mbgl/renderer/layers/render_custom_layer.cpp2
-rw-r--r--src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp2
-rw-r--r--src/mbgl/renderer/layers/render_fill_layer.cpp2
-rw-r--r--src/mbgl/renderer/layers/render_hillshade_layer.cpp2
-rw-r--r--src/mbgl/renderer/layers/render_line_layer.cpp2
-rw-r--r--src/mbgl/renderer/layers/render_symbol_layer.cpp4
-rw-r--r--src/mbgl/renderer/render_tile.cpp4
-rw-r--r--src/mbgl/style/style_impl.cpp2
-rw-r--r--src/mbgl/text/placement.cpp2
-rw-r--r--test/api/annotations.test.cpp4
-rw-r--r--test/map/map.test.cpp20
-rw-r--r--test/map/transform.test.cpp22
-rw-r--r--test/style/style.test.cpp4
-rw-r--r--test/util/tile_cover.test.cpp2
37 files changed, 151 insertions, 135 deletions
diff --git a/benchmark/util/tilecover.benchmark.cpp b/benchmark/util/tilecover.benchmark.cpp
index 03c9149d9e..e966875a65 100644
--- a/benchmark/util/tilecover.benchmark.cpp
+++ b/benchmark/util/tilecover.benchmark.cpp
@@ -22,7 +22,7 @@ static void TileCoverPitchedViewport(benchmark::State& state) {
Transform transform;
transform.resize({ 512, 512 });
// slightly offset center so that tile order is better defined
- transform.jumpTo(CameraOptions().withCenter(LatLng { 0.1, -0.1 }).withZoom(8.0).withAngle(5.0).withPitch(40.0));
+ transform.jumpTo(CameraOptions().withCenter(LatLng { 0.1, -0.1 }).withZoom(8.0).withBearing(5.0).withPitch(40.0));
std::size_t length = 0;
while (state.KeepRunning()) {
diff --git a/bin/render.cpp b/bin/render.cpp
index 8fb7a8877f..bf64570965 100644
--- a/bin/render.cpp
+++ b/bin/render.cpp
@@ -94,7 +94,7 @@ int main(int argc, char *argv[]) {
map.jumpTo(CameraOptions()
.withCenter(LatLng { lat, lon })
.withZoom(zoom)
- .withAngle(bearing)
+ .withBearing(bearing)
.withPitch(pitch));
if (debug) {
diff --git a/include/mbgl/map/camera.hpp b/include/mbgl/map/camera.hpp
index 69d699a4e4..e3d6677c0a 100644
--- a/include/mbgl/map/camera.hpp
+++ b/include/mbgl/map/camera.hpp
@@ -19,7 +19,7 @@ struct CameraOptions {
CameraOptions& withPadding(const EdgeInsets& p) { padding = p; return *this; }
CameraOptions& withAnchor(const optional<ScreenCoordinate>& o) { anchor = o; return *this; }
CameraOptions& withZoom(const optional<double>& o) { zoom = o; return *this; }
- CameraOptions& withAngle(const optional<double>& o) { angle = o; return *this; }
+ CameraOptions& withBearing(const optional<double>& o) { bearing = o; return *this; }
CameraOptions& withPitch(const optional<double>& o) { pitch = o; return *this; }
/** Coordinate at the center of the map. */
@@ -38,7 +38,7 @@ struct CameraOptions {
optional<double> zoom;
/** Bearing, measured in degrees from true north. Wrapped to [0, 360). */
- optional<double> angle;
+ optional<double> bearing;
/** Pitch toward the horizon measured in degrees , with 0 deg resulting in a
two-dimensional map. */
@@ -50,7 +50,7 @@ constexpr bool operator==(const CameraOptions& a, const CameraOptions& b) {
&& a.padding == b.padding
&& a.anchor == b.anchor
&& a.zoom == b.zoom
- && a.angle == b.angle
+ && a.bearing == b.bearing
&& a.pitch == b.pitch;
}
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 &center)
{
d_ptr->mapObj->jumpTo(mbgl::CameraOptions()
- .withAngle(degrees)
+ .withBearing(degrees)
.withAnchor(mbgl::ScreenCoordinate { center.x(), center.y() }));
}
diff --git a/src/mbgl/layout/symbol_projection.cpp b/src/mbgl/layout/symbol_projection.cpp
index edf916484b..293cdc5427 100644
--- a/src/mbgl/layout/symbol_projection.cpp
+++ b/src/mbgl/layout/symbol_projection.cpp
@@ -62,7 +62,7 @@ namespace mbgl {
if (pitchWithMap) {
matrix::scale(m, m, 1 / pixelsToTileUnits, 1 / pixelsToTileUnits, 1);
if (!rotateWithMap) {
- matrix::rotate_z(m, m, state.getAngle());
+ matrix::rotate_z(m, m, state.getBearing());
}
} else {
matrix::scale(m, m, state.getSize().width / 2.0, -(state.getSize().height / 2.0), 1.0);
@@ -82,7 +82,7 @@ namespace mbgl {
matrix::multiply(m, m, posMatrix);
matrix::scale(m, m, pixelsToTileUnits, pixelsToTileUnits, 1);
if (!rotateWithMap) {
- matrix::rotate_z(m, m, -state.getAngle());
+ matrix::rotate_z(m, m, -state.getBearing());
}
} else {
matrix::scale(m, m, 1, -1, 1);
diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp
index d7a1020262..3bc4c9f8d9 100644
--- a/src/mbgl/map/map.cpp
+++ b/src/mbgl/map/map.cpp
@@ -181,7 +181,7 @@ LatLng Map::getLatLng(const EdgeInsets& padding) const {
void Map::resetPosition(const EdgeInsets& padding) {
impl->cameraMutated = true;
- impl->transform.jumpTo(CameraOptions().withCenter(LatLng()).withPadding(padding).withZoom(0.0).withAngle(0.0).withPitch(0.0));
+ impl->transform.jumpTo(CameraOptions().withCenter(LatLng()).withPadding(padding).withZoom(0.0).withBearing(0.0).withPitch(0.0));
impl->onUpdate();
}
@@ -260,11 +260,11 @@ CameraOptions Map::cameraForLatLngs(const std::vector<LatLng>& latLngs, const Ed
Transform transform(impl->transform.getState());
if (bearing || pitch) {
- transform.jumpTo(CameraOptions().withAngle(bearing).withPitch(pitch));
+ transform.jumpTo(CameraOptions().withBearing(bearing).withPitch(pitch));
}
return mbgl::cameraForLatLngs(latLngs, transform, padding)
- .withAngle(-transform.getAngle() * util::RAD2DEG)
+ .withBearing(-transform.getBearing() * util::RAD2DEG)
.withPitch(transform.getPitch() * util::RAD2DEG);
}
diff --git a/src/mbgl/map/transform.cpp b/src/mbgl/map/transform.cpp
index 8065bc17ce..96aa5d2f4a 100644
--- a/src/mbgl/map/transform.cpp
+++ b/src/mbgl/map/transform.cpp
@@ -87,10 +87,10 @@ void Transform::easeTo(const CameraOptions& camera, const AnimationOptions& anim
const LatLng& unwrappedLatLng = camera.center.value_or(startLatLng);
const LatLng& latLng = state.bounds ? unwrappedLatLng : unwrappedLatLng.wrapped();
double zoom = camera.zoom.value_or(getZoom());
- double angle = camera.angle ? -*camera.angle * util::DEG2RAD : getAngle();
+ double bearing = camera.bearing ? -*camera.bearing * util::DEG2RAD : getBearing();
double pitch = camera.pitch ? *camera.pitch * util::DEG2RAD : getPitch();
- if (std::isnan(zoom) || std::isnan(angle) || std::isnan(pitch)) {
+ if (std::isnan(zoom) || std::isnan(bearing) || std::isnan(pitch)) {
return;
}
@@ -119,17 +119,17 @@ void Transform::easeTo(const CameraOptions& camera, const AnimationOptions& anim
pitch = util::clamp(pitch, state.min_pitch, state.max_pitch);
// Minimize rotation by taking the shorter path around the circle.
- angle = _normalizeAngle(angle, state.angle);
- state.angle = _normalizeAngle(state.angle, angle);
+ bearing = _normalizeAngle(bearing, state.bearing);
+ state.bearing = _normalizeAngle(state.bearing, bearing);
Duration duration = animation.duration ? *animation.duration : Duration::zero();
const double startScale = state.scale;
- const double startAngle = state.angle;
+ const double startBearing = state.bearing;
const double startPitch = state.pitch;
state.panning = unwrappedLatLng != startLatLng;
state.scaling = scale != startScale;
- state.rotating = angle != startAngle;
+ state.rotating = bearing != startBearing;
startTransition(camera, animation, [=](double t) {
Point<double> framePoint = util::interpolate(startPoint, endPoint, t);
@@ -137,8 +137,8 @@ void Transform::easeTo(const CameraOptions& camera, const AnimationOptions& anim
double frameScale = util::interpolate(startScale, scale, t);
state.setLatLngZoom(frameLatLng, state.scaleZoom(frameScale));
- if (angle != startAngle) {
- state.angle = util::wrap(util::interpolate(startAngle, angle, t), -M_PI, M_PI);
+ if (bearing != startBearing) {
+ state.bearing = util::wrap(util::interpolate(startBearing, bearing, t), -M_PI, M_PI);
}
if (pitch != startPitch) {
state.pitch = util::interpolate(startPitch, pitch, t);
@@ -162,10 +162,10 @@ void Transform::flyTo(const CameraOptions &camera, const AnimationOptions &anima
const EdgeInsets& padding = camera.padding;
const LatLng& latLng = camera.center.value_or(getLatLng(padding, LatLng::Unwrapped)).wrapped();
double zoom = camera.zoom.value_or(getZoom());
- double angle = camera.angle ? -*camera.angle * util::DEG2RAD : getAngle();
+ double bearing = camera.bearing ? -*camera.bearing * util::DEG2RAD : getBearing();
double pitch = camera.pitch ? *camera.pitch * util::DEG2RAD : getPitch();
- if (std::isnan(zoom) || std::isnan(angle) || std::isnan(pitch) || state.size.isEmpty()) {
+ if (std::isnan(zoom) || std::isnan(bearing) || std::isnan(pitch) || state.size.isEmpty()) {
return;
}
@@ -184,11 +184,11 @@ void Transform::flyTo(const CameraOptions &camera, const AnimationOptions &anima
pitch = util::clamp(pitch, state.min_pitch, state.max_pitch);
// Minimize rotation by taking the shorter path around the circle.
- angle = _normalizeAngle(angle, state.angle);
- state.angle = _normalizeAngle(state.angle, angle);
+ bearing = _normalizeAngle(bearing, state.bearing);
+ state.bearing = _normalizeAngle(state.bearing, bearing);
const double startZoom = state.scaleZoom(state.scale);
- const double startAngle = state.angle;
+ const double startBearing = state.bearing;
const double startPitch = state.pitch;
/// w₀: Initial visible span, measured in pixels at the initial scale.
@@ -277,7 +277,7 @@ void Transform::flyTo(const CameraOptions &camera, const AnimationOptions &anima
const double startScale = state.scale;
state.panning = true;
state.scaling = true;
- state.rotating = angle != startAngle;
+ state.rotating = bearing != startBearing;
startTransition(camera, animation, [=](double k) {
/// s: The distance traveled along the flight path, measured in
@@ -298,8 +298,8 @@ void Transform::flyTo(const CameraOptions &camera, const AnimationOptions &anima
LatLng frameLatLng = Projection::unproject(framePoint, startScale);
state.setLatLngZoom(frameLatLng, frameZoom);
- if (angle != startAngle) {
- state.angle = util::wrap(util::interpolate(startAngle, angle, k), -M_PI, M_PI);
+ if (bearing != startBearing) {
+ state.bearing = util::wrap(util::interpolate(startBearing, bearing, k), -M_PI, M_PI);
}
if (pitch != startPitch) {
state.pitch = util::interpolate(startPitch, pitch, k);
@@ -371,7 +371,7 @@ void Transform::setMaxPitch(double maxPitch) {
state.setMaxPitch(maxPitch);
}
-#pragma mark - Angle
+#pragma mark - Bearing
void Transform::rotateBy(const ScreenCoordinate& first, const ScreenCoordinate& second, const AnimationOptions& animation) {
ScreenCoordinate center = getScreenCoordinate();
@@ -382,17 +382,17 @@ void Transform::rotateBy(const ScreenCoordinate& first, const ScreenCoordinate&
// in the direction of the click.
if (distance < 200) {
const double heightOffset = -200;
- const double rotateAngle = std::atan2(offset.y, offset.x);
- center.x = first.x + std::cos(rotateAngle) * heightOffset;
- center.y = first.y + std::sin(rotateAngle) * heightOffset;
+ const double rotateBearing = std::atan2(offset.y, offset.x);
+ center.x = first.x + std::cos(rotateBearing) * heightOffset;
+ center.y = first.y + std::sin(rotateBearing) * heightOffset;
}
- const double angle = -(state.angle + util::angle_between(first - center, second - center)) * util::RAD2DEG;
- easeTo(CameraOptions().withAngle(angle), animation);
+ const double bearing = -(state.bearing + util::angle_between(first - center, second - center)) * util::RAD2DEG;
+ easeTo(CameraOptions().withBearing(bearing), animation);
}
-double Transform::getAngle() const {
- return state.angle;
+double Transform::getBearing() const {
+ return state.bearing;
}
#pragma mark - Pitch
diff --git a/src/mbgl/map/transform.hpp b/src/mbgl/map/transform.hpp
index da62a3f04e..cf342181b1 100644
--- a/src/mbgl/map/transform.hpp
+++ b/src/mbgl/map/transform.hpp
@@ -62,13 +62,10 @@ public:
/** Returns the zoom level. */
double getZoom() const;
- // Angle
+ // Bearing
void rotateBy(const ScreenCoordinate& first, const ScreenCoordinate& second, const AnimationOptions& = {});
- /** Returns the angle of rotation.
- @return The angle of rotation, measured in radians counterclockwise from
- true north. */
- double getAngle() const;
+ double getBearing() const;
// Pitch
diff --git a/src/mbgl/map/transform_state.cpp b/src/mbgl/map/transform_state.cpp
index 778d4bd7e7..e911067c5b 100644
--- a/src/mbgl/map/transform_state.cpp
+++ b/src/mbgl/map/transform_state.cpp
@@ -61,7 +61,7 @@ void TransformState::getProjMatrix(mat4& projMatrix, uint16_t nearZ, bool aligne
default: matrix::rotate_x(projMatrix, projMatrix, getPitch()); break;
}
- matrix::rotate_z(projMatrix, projMatrix, getAngle() + getNorthOrientationAngle());
+ matrix::rotate_z(projMatrix, projMatrix, getBearing() + getNorthOrientationAngle());
const double dx = pixel_x() - size.width / 2.0f, dy = pixel_y() - size.height / 2.0f;
matrix::translate(projMatrix, projMatrix, dx, dy, 0);
@@ -86,10 +86,10 @@ void TransformState::getProjMatrix(mat4& projMatrix, uint16_t nearZ, bool aligne
// it is always <= 0.5 pixels.
if (aligned) {
const float xShift = float(size.width % 2) / 2, yShift = float(size.height % 2) / 2;
- const double angleCos = std::cos(angle), angleSin = std::sin(angle);
+ const double bearingCos = std::cos(bearing), bearingSin = std::sin(bearing);
double devNull;
- const float dxa = -std::modf(dx, &devNull) + angleCos * xShift + angleSin * yShift;
- const float dya = -std::modf(dy, &devNull) + angleCos * yShift + angleSin * xShift;
+ const float dxa = -std::modf(dx, &devNull) + bearingCos * xShift + bearingSin * yShift;
+ const float dya = -std::modf(dy, &devNull) + bearingCos * yShift + bearingSin * xShift;
matrix::translate(projMatrix, projMatrix, dxa > 0.5 ? dxa - 1 : dxa, dya > 0.5 ? dya - 1 : dya, 0);
}
}
@@ -145,7 +145,7 @@ CameraOptions TransformState::getCameraOptions(const EdgeInsets& padding) const
.withCenter(center)
.withPadding(padding)
.withZoom(getZoom())
- .withAngle(-angle * util::RAD2DEG)
+ .withBearing(-bearing * util::RAD2DEG)
.withPitch(pitch * util::RAD2DEG);
}
@@ -243,8 +243,8 @@ double TransformState::getMaxPitch() const {
#pragma mark - Rotation
-float TransformState::getAngle() const {
- return angle;
+float TransformState::getBearing() const {
+ return bearing;
}
float TransformState::getFieldOfView() const {
diff --git a/src/mbgl/map/transform_state.hpp b/src/mbgl/map/transform_state.hpp
index fe716d8ea8..be7c300803 100644
--- a/src/mbgl/map/transform_state.hpp
+++ b/src/mbgl/map/transform_state.hpp
@@ -67,7 +67,7 @@ public:
double getMaxPitch() const;
// Rotation
- float getAngle() const;
+ float getBearing() const;
float getFieldOfView() const;
float getCameraToCenterDistance() const;
float getPitch() const;
@@ -131,7 +131,7 @@ private:
// map position
double x = 0, y = 0;
- double angle = 0;
+ double bearing = 0;
double scale = 1;
// This fov value is somewhat arbitrary. The altitude of the camera used
// to be defined as 1.5 screen heights above the ground, which was an
diff --git a/src/mbgl/programs/fill_extrusion_program.cpp b/src/mbgl/programs/fill_extrusion_program.cpp
index b262485b35..92916a61ab 100644
--- a/src/mbgl/programs/fill_extrusion_program.cpp
+++ b/src/mbgl/programs/fill_extrusion_program.cpp
@@ -21,7 +21,7 @@ std::array<float, 3> lightPosition(const EvaluatedLight& light, const TransformS
mat3 lightMat;
matrix::identity(lightMat);
if (light.get<LightAnchor>() == LightAnchorType::Viewport) {
- matrix::rotate(lightMat, lightMat, -state.getAngle());
+ matrix::rotate(lightMat, lightMat, -state.getBearing());
}
matrix::transformMat3f(lightPos, lightPos, lightMat);
return lightPos;
diff --git a/src/mbgl/renderer/layers/render_circle_layer.cpp b/src/mbgl/renderer/layers/render_circle_layer.cpp
index 10f38a3413..aec6813823 100644
--- a/src/mbgl/renderer/layers/render_circle_layer.cpp
+++ b/src/mbgl/renderer/layers/render_circle_layer.cpp
@@ -142,7 +142,7 @@ bool RenderCircleLayer::queryIntersectsFeature(
queryGeometry,
evaluated.get<style::CircleTranslate>(),
evaluated.get<style::CircleTranslateAnchor>(),
- transformState.getAngle(),
+ transformState.getBearing(),
pixelsToTileUnits).value_or(queryGeometry);
// Evaluate functions
diff --git a/src/mbgl/renderer/layers/render_custom_layer.cpp b/src/mbgl/renderer/layers/render_custom_layer.cpp
index 5eef5d2cb1..bcb0decb74 100644
--- a/src/mbgl/renderer/layers/render_custom_layer.cpp
+++ b/src/mbgl/renderer/layers/render_custom_layer.cpp
@@ -74,7 +74,7 @@ void RenderCustomLayer::render(PaintParameters& paintParameters, RenderSource*)
parameters.latitude = state.getLatLng().latitude();
parameters.longitude = state.getLatLng().longitude();
parameters.zoom = state.getZoom();
- parameters.bearing = -state.getAngle() * util::RAD2DEG;
+ parameters.bearing = -state.getBearing() * util::RAD2DEG;
parameters.pitch = state.getPitch();
parameters.fieldOfView = state.getFieldOfView();
mat4 projMatrix;
diff --git a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp
index 2753fcd533..3224397fb7 100644
--- a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp
+++ b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp
@@ -218,7 +218,7 @@ bool RenderFillExtrusionLayer::queryIntersectsFeature(
queryGeometry,
evaluated.get<style::FillExtrusionTranslate>(),
evaluated.get<style::FillExtrusionTranslateAnchor>(),
- transformState.getAngle(),
+ transformState.getBearing(),
pixelsToTileUnits);
return util::polygonIntersectsMultiPolygon(translatedQueryGeometry.value_or(queryGeometry), feature.getGeometries());
diff --git a/src/mbgl/renderer/layers/render_fill_layer.cpp b/src/mbgl/renderer/layers/render_fill_layer.cpp
index 226c8a11b7..51019875e3 100644
--- a/src/mbgl/renderer/layers/render_fill_layer.cpp
+++ b/src/mbgl/renderer/layers/render_fill_layer.cpp
@@ -233,7 +233,7 @@ bool RenderFillLayer::queryIntersectsFeature(
queryGeometry,
evaluated.get<style::FillTranslate>(),
evaluated.get<style::FillTranslateAnchor>(),
- transformState.getAngle(),
+ transformState.getBearing(),
pixelsToTileUnits);
return util::polygonIntersectsMultiPolygon(translatedQueryGeometry.value_or(queryGeometry), feature.getGeometries());
diff --git a/src/mbgl/renderer/layers/render_hillshade_layer.cpp b/src/mbgl/renderer/layers/render_hillshade_layer.cpp
index c18e09512d..2ee824dcf3 100644
--- a/src/mbgl/renderer/layers/render_hillshade_layer.cpp
+++ b/src/mbgl/renderer/layers/render_hillshade_layer.cpp
@@ -32,7 +32,7 @@ const std::array<float, 2> RenderHillshadeLayer::getLatRange(const UnwrappedTile
const std::array<float, 2> RenderHillshadeLayer::getLight(const PaintParameters& parameters){
float azimuthal = evaluated.get<HillshadeIlluminationDirection>() * util::DEG2RAD;
- if (evaluated.get<HillshadeIlluminationAnchor>() == HillshadeIlluminationAnchorType::Viewport) azimuthal = azimuthal - parameters.state.getAngle();
+ if (evaluated.get<HillshadeIlluminationAnchor>() == HillshadeIlluminationAnchorType::Viewport) azimuthal = azimuthal - parameters.state.getBearing();
return {{evaluated.get<HillshadeExaggeration>(), azimuthal}};
}
diff --git a/src/mbgl/renderer/layers/render_line_layer.cpp b/src/mbgl/renderer/layers/render_line_layer.cpp
index 5b36cd4158..b0c441f5a1 100644
--- a/src/mbgl/renderer/layers/render_line_layer.cpp
+++ b/src/mbgl/renderer/layers/render_line_layer.cpp
@@ -207,7 +207,7 @@ bool RenderLineLayer::queryIntersectsFeature(
queryGeometry,
evaluated.get<style::LineTranslate>(),
evaluated.get<style::LineTranslateAnchor>(),
- transformState.getAngle(),
+ transformState.getBearing(),
pixelsToTileUnits);
// Evaluate function
diff --git a/src/mbgl/renderer/layers/render_symbol_layer.cpp b/src/mbgl/renderer/layers/render_symbol_layer.cpp
index 44d0c0001e..19edb6afbd 100644
--- a/src/mbgl/renderer/layers/render_symbol_layer.cpp
+++ b/src/mbgl/renderer/layers/render_symbol_layer.cpp
@@ -379,8 +379,8 @@ void RenderSymbolLayer::sortRenderTiles(const TransformState& state) {
Point<float> pa(a.get().id.canonical.x, a.get().id.canonical.y);
Point<float> pb(b.get().id.canonical.x, b.get().id.canonical.y);
- auto par = util::rotate(pa, state.getAngle());
- auto pbr = util::rotate(pb, state.getAngle());
+ auto par = util::rotate(pa, state.getBearing());
+ auto pbr = util::rotate(pb, state.getBearing());
return std::tie(b.get().id.canonical.z, par.y, par.x) < std::tie(a.get().id.canonical.z, pbr.y, pbr.x);
});
diff --git a/src/mbgl/renderer/render_tile.cpp b/src/mbgl/renderer/render_tile.cpp
index 1ea39f6bd7..beb0a06af9 100644
--- a/src/mbgl/renderer/render_tile.cpp
+++ b/src/mbgl/renderer/render_tile.cpp
@@ -23,8 +23,8 @@ mat4 RenderTile::translateVtxMatrix(const mat4& tileMatrix,
mat4 vtxMatrix;
const float angle = inViewportPixelUnits ?
- (anchor == TranslateAnchorType::Map ? state.getAngle() : 0) :
- (anchor == TranslateAnchorType::Viewport ? -state.getAngle() : 0);
+ (anchor == TranslateAnchorType::Map ? state.getBearing() : 0) :
+ (anchor == TranslateAnchorType::Viewport ? -state.getBearing() : 0);
Point<float> translate = util::rotate(Point<float>{ translation[0], translation[1] }, angle);
diff --git a/src/mbgl/style/style_impl.cpp b/src/mbgl/style/style_impl.cpp
index 760e2bc396..d65e9c9de2 100644
--- a/src/mbgl/style/style_impl.cpp
+++ b/src/mbgl/style/style_impl.cpp
@@ -105,7 +105,7 @@ void Style::Impl::parse(const std::string& json_) {
name = parser.name;
defaultCamera.center = parser.latLng;
defaultCamera.zoom = parser.zoom;
- defaultCamera.angle = parser.bearing;
+ defaultCamera.bearing = parser.bearing;
defaultCamera.pitch = parser.pitch;
setLight(std::make_unique<Light>(parser.light));
diff --git a/src/mbgl/text/placement.cpp b/src/mbgl/text/placement.cpp
index 078d646dc4..4cc12b0980 100644
--- a/src/mbgl/text/placement.cpp
+++ b/src/mbgl/text/placement.cpp
@@ -399,7 +399,7 @@ void Placement::updateBucketOpacities(SymbolBucket& bucket, std::set<uint32_t>&
}
bucket.updateOpacity();
- bucket.sortFeatures(state.getAngle());
+ bucket.sortFeatures(state.getBearing());
auto retainedData = retainedQueryData.find(bucket.bucketInstanceId);
if (retainedData != retainedQueryData.end()) {
retainedData->second.featureSortOrder = bucket.featureSortOrder;
diff --git a/test/api/annotations.test.cpp b/test/api/annotations.test.cpp
index a4534825a5..8d2dae177b 100644
--- a/test/api/annotations.test.cpp
+++ b/test/api/annotations.test.cpp
@@ -418,7 +418,7 @@ TEST(Annotations, VisibleFeatures) {
}
// Change bearing *after* adding annotations causes them to be reordered.
- test.map.jumpTo(CameraOptions().withAngle(45.0));
+ test.map.jumpTo(CameraOptions().withBearing(45.0));
test.frontend.render(test.map);
auto features = test.frontend.getRenderer()->queryRenderedFeatures(box, {});
@@ -428,7 +428,7 @@ TEST(Annotations, VisibleFeatures) {
features.erase(std::unique(features.begin(), features.end(), sameID), features.end());
EXPECT_EQ(features.size(), ids.size());
- test.map.jumpTo(CameraOptions().withZoom(4.0).withAngle(0.0));
+ test.map.jumpTo(CameraOptions().withZoom(4.0).withBearing(0.0));
test.frontend.render(test.map);
features = test.frontend.getRenderer()->queryRenderedFeatures(box);
std::sort(features.begin(), features.end(), sortID);
diff --git a/test/map/map.test.cpp b/test/map/map.test.cpp
index da3abfcb24..1b64e48614 100644
--- a/test/map/map.test.cpp
+++ b/test/map/map.test.cpp
@@ -64,7 +64,7 @@ TEST(Map, RendererState) {
double bearingInDegrees = 30.0;
test.map.getStyle().loadJSON(util::read_file("test/fixtures/api/empty.json"));
- test.map.jumpTo(CameraOptions().withCenter(coordinate).withZoom(zoom).withPitch(pitchInDegrees).withAngle(bearingInDegrees));
+ test.map.jumpTo(CameraOptions().withCenter(coordinate).withZoom(zoom).withPitch(pitchInDegrees).withBearing(bearingInDegrees));
test.runLoop.runOnce();
test.frontend.render(test.map);
@@ -75,7 +75,7 @@ TEST(Map, RendererState) {
EXPECT_NEAR(options.center->longitude(), coordinate.longitude(), 1e-7);
ASSERT_DOUBLE_EQ(*options.zoom, zoom);
ASSERT_DOUBLE_EQ(*options.pitch, pitchInDegrees);
- EXPECT_NEAR(*options.angle, bearingInDegrees, 1e-7);
+ EXPECT_NEAR(*options.bearing, bearingInDegrees, 1e-7);
{
const LatLng& latLng = test.frontend.latLngForPixel(ScreenCoordinate { 0, 0 });
@@ -148,7 +148,7 @@ TEST(Map, LatLngBoundsToCamera) {
EXPECT_NEAR(*virtualCamera.zoom, 1.55467, 1e-5);
}
-TEST(Map, LatLngBoundsToCameraWithAngle) {
+TEST(Map, LatLngBoundsToCameraWithBearing) {
MapTest<> test;
test.map.jumpTo(CameraOptions().withCenter(LatLng { 40.712730, -74.005953 }).withZoom(16.0));
@@ -158,10 +158,10 @@ TEST(Map, LatLngBoundsToCameraWithAngle) {
CameraOptions virtualCamera = test.map.cameraForLatLngBounds(bounds, {}, 35.0);
ASSERT_TRUE(bounds.contains(*virtualCamera.center));
EXPECT_NEAR(*virtualCamera.zoom, 1.21385, 1e-5);
- EXPECT_NEAR(virtualCamera.angle.value_or(0), 35.0, 1e-5);
+ EXPECT_NEAR(virtualCamera.bearing.value_or(0), 35.0, 1e-5);
}
-TEST(Map, LatLngBoundsToCameraWithAngleAndPitch) {
+TEST(Map, LatLngBoundsToCameraWithBearingAndPitch) {
MapTest<> test;
test.map.jumpTo(CameraOptions().withCenter(LatLng { 40.712730, -74.005953 }).withZoom(16.0));
@@ -172,7 +172,7 @@ TEST(Map, LatLngBoundsToCameraWithAngleAndPitch) {
ASSERT_TRUE(bounds.contains(*virtualCamera.center));
EXPECT_NEAR(*virtualCamera.zoom, 13.66272, 1e-5);
ASSERT_DOUBLE_EQ(*virtualCamera.pitch, 20.0);
- EXPECT_NEAR(virtualCamera.angle.value_or(0), 35.0, 1e-5);
+ EXPECT_NEAR(virtualCamera.bearing.value_or(0), 35.0, 1e-5);
}
TEST(Map, LatLngsToCamera) {
@@ -181,19 +181,19 @@ TEST(Map, LatLngsToCamera) {
std::vector<LatLng> latLngs{{ 40.712730, 74.005953 }, {15.68169,73.499857}, {30.82678, 83.4082}};
CameraOptions virtualCamera = test.map.cameraForLatLngs(latLngs, {}, 23.0);
- EXPECT_NEAR(virtualCamera.angle.value_or(0), 23.0, 1e-5);
+ EXPECT_NEAR(virtualCamera.bearing.value_or(0), 23.0, 1e-5);
EXPECT_NEAR(virtualCamera.zoom.value_or(0), 2.75434, 1e-5);
EXPECT_NEAR(virtualCamera.center->latitude(), 28.49288, 1e-5);
EXPECT_NEAR(virtualCamera.center->longitude(), 74.97437, 1e-5);
}
-TEST(Map, LatLngsToCameraWithAngleAndPitch) {
+TEST(Map, LatLngsToCameraWithBearingAndPitch) {
MapTest<> test;
std::vector<LatLng> latLngs{{ 40.712730, 74.005953 }, {15.68169,73.499857}, {30.82678, 83.4082}};
CameraOptions virtualCamera = test.map.cameraForLatLngs(latLngs, {}, 23, 20);
- EXPECT_NEAR(virtualCamera.angle.value_or(0), 23.0, 1e-5);
+ EXPECT_NEAR(virtualCamera.bearing.value_or(0), 23.0, 1e-5);
EXPECT_NEAR(virtualCamera.zoom.value_or(0), 3.04378, 1e-5);
EXPECT_NEAR(virtualCamera.center->latitude(), 28.53718, 1e-5);
EXPECT_NEAR(virtualCamera.center->longitude(), 74.31746, 1e-5);
@@ -256,7 +256,7 @@ TEST(Map, SetStyleDefaultCamera) {
CameraOptions camera = test.map.getCameraOptions();
EXPECT_DOUBLE_EQ(*camera.zoom, 0.0);
EXPECT_DOUBLE_EQ(*camera.pitch, 0.0);
- EXPECT_DOUBLE_EQ(*camera.angle, 0.0);
+ EXPECT_DOUBLE_EQ(*camera.bearing, 0.0);
EXPECT_EQ(*camera.center, LatLng {});
test.map.getStyle().loadJSON(util::read_file("test/fixtures/api/empty-zoomed.json"));
diff --git a/test/map/transform.test.cpp b/test/map/transform.test.cpp
index 85f92ae52c..540761212a 100644
--- a/test/map/transform.test.cpp
+++ b/test/map/transform.test.cpp
@@ -61,19 +61,19 @@ TEST(Transform, InvalidBearing) {
ASSERT_DOUBLE_EQ(0, transform.getLatLng().longitude());
ASSERT_DOUBLE_EQ(0, transform.getZoom());
- transform.jumpTo(CameraOptions().withZoom(1.0).withAngle(2.0));
+ transform.jumpTo(CameraOptions().withZoom(1.0).withBearing(2.0));
ASSERT_DOUBLE_EQ(0, transform.getLatLng().latitude());
ASSERT_DOUBLE_EQ(0, transform.getLatLng().longitude());
ASSERT_DOUBLE_EQ(1, transform.getZoom());
- ASSERT_NEAR(-2.0 * util::DEG2RAD, transform.getAngle(), 1e-15);
+ ASSERT_NEAR(-2.0 * util::DEG2RAD, transform.getBearing(), 1e-15);
const double invalid = NAN;
- transform.jumpTo(CameraOptions().withAngle(invalid));
+ transform.jumpTo(CameraOptions().withBearing(invalid));
ASSERT_DOUBLE_EQ(0, transform.getLatLng().latitude());
ASSERT_DOUBLE_EQ(0, transform.getLatLng().longitude());
ASSERT_DOUBLE_EQ(1, transform.getZoom());
- ASSERT_NEAR(-2.0 * util::DEG2RAD, transform.getAngle(), 1e-15);
+ ASSERT_NEAR(-2.0 * util::DEG2RAD, transform.getBearing(), 1e-15);
}
TEST(Transform, IntegerZoom) {
@@ -196,7 +196,7 @@ TEST(Transform, Anchor) {
ASSERT_DOUBLE_EQ(latLng.latitude(), transform.getLatLng().latitude());
ASSERT_DOUBLE_EQ(latLng.longitude(), transform.getLatLng().longitude());
ASSERT_DOUBLE_EQ(10, transform.getZoom());
- ASSERT_DOUBLE_EQ(0, transform.getAngle());
+ ASSERT_DOUBLE_EQ(0, transform.getBearing());
const LatLng anchorLatLng = transform.getState().screenCoordinateToLatLng(anchorPoint);
ASSERT_NE(latLng.latitude(), anchorLatLng.latitude());
@@ -247,18 +247,18 @@ TEST(Transform, Anchor) {
ASSERT_NE(latLng.latitude(), transform.getLatLng().latitude());
ASSERT_NE(latLng.longitude(), transform.getLatLng().longitude());
- transform.jumpTo(CameraOptions().withCenter(latLng).withZoom(10.0).withAngle(-45.0));
- ASSERT_NEAR(M_PI_4, transform.getAngle(), 0.000001);
+ transform.jumpTo(CameraOptions().withCenter(latLng).withZoom(10.0).withBearing(-45.0));
+ ASSERT_NEAR(M_PI_4, transform.getBearing(), 0.000001);
ASSERT_DOUBLE_EQ(latLng.latitude(), transform.getLatLng().latitude());
ASSERT_DOUBLE_EQ(latLng.longitude(), transform.getLatLng().longitude());
- transform.jumpTo(CameraOptions().withAngle(0.0));
- ASSERT_DOUBLE_EQ(0, transform.getAngle());
+ transform.jumpTo(CameraOptions().withBearing(0.0));
+ ASSERT_DOUBLE_EQ(0, transform.getBearing());
ASSERT_DOUBLE_EQ(latLng.latitude(), transform.getLatLng().latitude());
ASSERT_DOUBLE_EQ(latLng.longitude(), transform.getLatLng().longitude());
- transform.jumpTo(CameraOptions().withAngle(45.0).withAnchor(anchorPoint));
- ASSERT_NEAR(-45.0 * util::DEG2RAD, transform.getAngle(), 0.000001);
+ transform.jumpTo(CameraOptions().withBearing(45.0).withAnchor(anchorPoint));
+ ASSERT_NEAR(-45.0 * util::DEG2RAD, transform.getBearing(), 0.000001);
ASSERT_NEAR(anchorLatLng.latitude(), transform.getLatLng().latitude(), 1);
ASSERT_NEAR(anchorLatLng.longitude(), transform.getLatLng().longitude(), 1);
diff --git a/test/style/style.test.cpp b/test/style/style.test.cpp
index 2371e91107..7f57651331 100644
--- a/test/style/style.test.cpp
+++ b/test/style/style.test.cpp
@@ -33,7 +33,7 @@ TEST(Style, Properties) {
style.loadJSON(R"STYLE({"bearing": 24})STYLE");
ASSERT_EQ("", style.getName());
ASSERT_EQ(LatLng {}, *style.getDefaultCamera().center);
- ASSERT_EQ(24, *style.getDefaultCamera().angle);
+ ASSERT_EQ(24, *style.getDefaultCamera().bearing);
style.loadJSON(R"STYLE({"zoom": 13.3})STYLE");
ASSERT_EQ("", style.getName());
@@ -55,7 +55,7 @@ TEST(Style, Properties) {
ASSERT_EQ("", style.getName());
ASSERT_EQ(LatLng {}, *style.getDefaultCamera().center);
ASSERT_EQ(0, *style.getDefaultCamera().zoom);
- ASSERT_EQ(0, *style.getDefaultCamera().angle);
+ ASSERT_EQ(0, *style.getDefaultCamera().bearing);
ASSERT_EQ(0, *style.getDefaultCamera().pitch);
}
diff --git a/test/util/tile_cover.test.cpp b/test/util/tile_cover.test.cpp
index 326e3da69a..7045305625 100644
--- a/test/util/tile_cover.test.cpp
+++ b/test/util/tile_cover.test.cpp
@@ -35,7 +35,7 @@ TEST(TileCover, Pitch) {
transform.resize({ 512, 512 });
// slightly offset center so that tile order is better defined
- transform.jumpTo(CameraOptions().withCenter(LatLng { 0.1, -0.1, }).withZoom(2.0).withAngle(5.0).withPitch(40.0));
+ transform.jumpTo(CameraOptions().withCenter(LatLng { 0.1, -0.1, }).withZoom(2.0).withBearing(5.0).withPitch(40.0));
EXPECT_EQ((std::vector<UnwrappedTileID>{
{ 2, 1, 1 }, { 2, 2, 1 }, { 2, 1, 2 }, { 2, 2, 2 }