Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[core] Increase pitch to 67.5 degrees
Browse files Browse the repository at this point in the history
  • Loading branch information
brunoabinader committed Jul 10, 2018
1 parent 69dcb4c commit f629012
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion include/mbgl/util/constants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ constexpr double EARTH_RADIUS_M = 6378137;
constexpr double LATITUDE_MAX = 85.051128779806604;
constexpr double LONGITUDE_MAX = 180;
constexpr double DEGREES_MAX = 360;
constexpr double PITCH_MAX = M_PI / 3;
constexpr double PITCH_MAX = 67.5 * DEG2RAD;
constexpr double MIN_ZOOM = 0.0;
constexpr double MAX_ZOOM = 25.5;
constexpr float MIN_ZOOM_F = MIN_ZOOM;
Expand Down
2 changes: 1 addition & 1 deletion mapbox-gl-js
Submodule mapbox-gl-js updated 34 files
+4 −0 docs/pages/plugins.js
+2 −1 flow-typed/style-spec.js
+1 −1 src/data/bucket/symbol_bucket.js
+1 −1 src/render/draw_symbol.js
+85 −39 src/style-spec/reference/v8.json
+1 −1 src/style-spec/style-spec.js
+2 −2 src/style/style_layer/symbol_style_layer.js
+65 −12 src/symbol/get_anchors.js
+22 −5 src/symbol/symbol_layout.js
+1 −1 test/integration/render-tests/circle-pitch-alignment/map-scale-map/style.json
+1 −1 test/integration/render-tests/circle-pitch-alignment/map-scale-viewport/style.json
+1 −1 test/integration/render-tests/circle-pitch-alignment/viewport-scale-map/style.json
+1 −1 test/integration/render-tests/circle-pitch-alignment/viewport-scale-viewport/style.json
+1 −1 test/integration/render-tests/circle-pitch-scale/default/style.json
+1 −1 test/integration/render-tests/circle-pitch-scale/map/style.json
+1 −1 test/integration/render-tests/circle-pitch-scale/viewport/style.json
+1 −1 test/integration/render-tests/fill-extrusion-base/default/style.json
+1 −1 test/integration/render-tests/fill-extrusion-base/function/style.json
+1 −1 test/integration/render-tests/fill-extrusion-base/literal/style.json
+1 −1 test/integration/render-tests/fill-extrusion-base/negative/style.json
+1 −1 test/integration/render-tests/fill-extrusion-base/property-function/style.json
+1 −1 test/integration/render-tests/fill-extrusion-base/zoom-and-property-function/style.json
+1 −1 test/integration/render-tests/line-pattern/pitch/style.json
+1 −1 test/integration/render-tests/regressions/mapbox-gl-js#3548/style.json
+ test/integration/render-tests/symbol-placement/line-center-buffer/expected.png
+60 −0 test/integration/render-tests/symbol-placement/line-center-buffer/style.json
+ test/integration/render-tests/symbol-placement/line-center/expected.png
+69 −0 test/integration/render-tests/symbol-placement/line-center/style.json
+ test/integration/render-tests/text-max-angle/line-center/expected.png
+52 −0 test/integration/render-tests/text-max-angle/line-center/style.json
+ test/integration/tiles/mapbox.mapbox-streets-v7/4-4-7.mvt
+ test/integration/tiles/mapbox.mapbox-streets-v7/4-5-7.mvt
+1 −1 test/unit/style-spec/spec.test.js
+25 −1 test/unit/symbol/get_anchors.test.js
2 changes: 1 addition & 1 deletion platform/glfw/glfw_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ void GLFWView::onKey(GLFWwindow *window, int key, int /*scancode*/, int action,
double easing = bearing - routeMap->getBearing();
easing += easing > 180.0 ? -360.0 : easing < -180 ? 360.0 : 0;
routeMap->setBearing(routeMap->getBearing() + (easing / 20));
routeMap->setPitch(60.0);
routeMap->setPitch(67.5);
routeMap->setZoom(18.0);
};
view->animateRouteCallback(view->map);
Expand Down
5 changes: 4 additions & 1 deletion platform/node/test/ignores.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,8 @@
"render-tests/combinations/symbol-translucent--fill-extrusion-translucent": "needs investigation",
"render-tests/feature-state/composite-expression": "skip - port https://github.com/mapbox/mapbox-gl-js/pull/6263 - needs issue",
"render-tests/feature-state/data-expression": "skip - port https://github.com/mapbox/mapbox-gl-js/pull/6263 - needs issue",
"render-tests/feature-state/vector-source": "skip - port https://github.com/mapbox/mapbox-gl-js/pull/6263 - needs issue"
"render-tests/feature-state/vector-source": "skip - port https://github.com/mapbox/mapbox-gl-js/pull/6263 - needs issue",
"render-tests/symbol-placement/line-center-buffer": "https://github.com/mapbox/mapbox-gl-native/issues/12300",
"render-tests/symbol-placement/line-center": "https://github.com/mapbox/mapbox-gl-native/issues/12300",
"render-tests/text-max-angle/line-center": "https://github.com/mapbox/mapbox-gl-native/issues/12300"
}
10 changes: 10 additions & 0 deletions scripts/style-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,13 @@ var spec = module.exports = require('../mapbox-gl-js/src/style-spec/reference/v8

// Make temporary modifications here when Native doesn't have all features that JS has.
delete spec.paint_line['line-gradient'];

// https://github.com/mapbox/mapbox-gl-native/issues/12300
delete spec.layout_symbol['symbol-placement']['values']['line-center'];
spec.layout_symbol['icon-keep-upright']['requires'][2]['symbol-placement'] = 'line';
spec.layout_symbol['text-keep-upright']['requires'][2]['symbol-placement'] = 'line';
spec.layout_symbol['text-max-angle']['requires'][1]['symbol-placement'] = 'line';
spec.layout_symbol['icon-rotation-alignment']['values']['map']['doc'] = spec.layout_symbol['icon-rotation-alignment']['values']['map']['doc'].replace(" or `line-center`","");
spec.layout_symbol['icon-rotation-alignment']['values']['auto']['doc'] = spec.layout_symbol['icon-rotation-alignment']['values']['auto']['doc'].replace(" or `line-center`","");
spec.layout_symbol['text-rotation-alignment']['values']['map']['doc'] = spec.layout_symbol['text-rotation-alignment']['values']['map']['doc'].replace(" or `line-center`","");
spec.layout_symbol['text-rotation-alignment']['values']['auto']['doc'] = spec.layout_symbol['text-rotation-alignment']['values']['auto']['doc'].replace(" or `line-center`","");
3 changes: 2 additions & 1 deletion src/mbgl/util/tile_cover.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ std::vector<UnwrappedTileID> tileCover(Point<double> tl,

std::vector<ID> t;

constexpr double maxPitchForUnlimitedCoverage = 45.0 * DEG2RAD;
// Increase 0.1 radians to cover for conversion precision loss.
constexpr double maxPitchForUnlimitedCoverage = 60.0 * DEG2RAD + 0.1;

// Clamp the axis-aligned coverage area to the nearest 3 neighbor tiles.
if (pitch > maxPitchForUnlimitedCoverage) {
Expand Down
2 changes: 1 addition & 1 deletion test/map/transform.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ TEST(Transform, PitchBounds) {

ASSERT_DOUBLE_EQ(transform.getState().getPitch() * util::RAD2DEG, 0.0);
ASSERT_DOUBLE_EQ(transform.getState().getMinPitch() * util::RAD2DEG, 0.0);
ASSERT_DOUBLE_EQ(transform.getState().getMaxPitch() * util::RAD2DEG, 60.0);
ASSERT_NEAR(transform.getState().getMaxPitch() * util::RAD2DEG, 67.5, 1e-5);

transform.setMinPitch(45.0 * util::DEG2RAD);
transform.setPitch(0.0 * util::DEG2RAD);
Expand Down

0 comments on commit f629012

Please sign in to comment.