diff options
author | zmiao <miao.zhao@mapbox.com> | 2019-11-13 14:41:35 +0200 |
---|---|---|
committer | zmiao <miao.zhao@mapbox.com> | 2019-11-13 14:41:35 +0200 |
commit | 228d28004633a81fd6a899ad5a64943505e53bd7 (patch) | |
tree | 5452031093f290bbf3d489d751e9819dc6de4a71 | |
parent | 4c1d03c257754ecc1555f3e31b3c6ccf45c4bf7b (diff) | |
download | qtlocation-mapboxgl-228d28004633a81fd6a899ad5a64943505e53bd7.tar.gz |
[Core] refactor transform state
-rw-r--r-- | src/mbgl/map/transform.cpp | 142 | ||||
-rw-r--r-- | src/mbgl/map/transform_state.cpp | 37 | ||||
-rw-r--r-- | src/mbgl/map/transform_state.hpp | 36 | ||||
-rw-r--r-- | src/mbgl/renderer/renderer_state.cpp | 4 |
4 files changed, 135 insertions, 84 deletions
diff --git a/src/mbgl/map/transform.cpp b/src/mbgl/map/transform.cpp index 6b44e633d9..c3b0c588be 100644 --- a/src/mbgl/map/transform.cpp +++ b/src/mbgl/map/transform.cpp @@ -49,14 +49,15 @@ void Transform::resize(const Size size) { throw std::runtime_error("failed to resize: size is empty"); } - if (state.size == size) { + if (state.getSize() == size) { return; } observer.onCameraWillChange(MapObserver::CameraChangeMode::Immediate); - state.size = size; - state.constrain(state.scale, state.x, state.y); + state.setSize(size); + state.constrain(); + state.updateMatrix(); observer.onCameraDidChange(MapObserver::CameraChangeMode::Immediate); } @@ -83,14 +84,14 @@ void Transform::jumpTo(const CameraOptions& camera) { */ void Transform::easeTo(const CameraOptions& camera, const AnimationOptions& animation) { Duration duration = animation.duration.value_or(Duration::zero()); - if (state.bounds == LatLngBounds() && !isGestureInProgress() && duration != Duration::zero()) { + if (state.getLatLngBounds() == LatLngBounds() && !isGestureInProgress() && duration != Duration::zero()) { // reuse flyTo, without exaggerated animation, to achieve constant ground speed. return flyTo(camera, animation, true); } - const EdgeInsets& padding = camera.padding.value_or(state.edgeInsets); + const EdgeInsets& padding = camera.padding.value_or(state.getEdgeInsets()); LatLng startLatLng = getLatLng(LatLng::Unwrapped); const LatLng& unwrappedLatLng = camera.center.value_or(startLatLng); - const LatLng& latLng = state.bounds != LatLngBounds() ? unwrappedLatLng : unwrappedLatLng.wrapped(); + const LatLng& latLng = state.getLatLngBounds() != LatLngBounds() ? unwrappedLatLng : unwrappedLatLng.wrapped(); double zoom = camera.zoom.value_or(getZoom()); double bearing = camera.bearing ? -*camera.bearing * util::DEG2RAD : getBearing(); double pitch = camera.pitch ? *camera.pitch * util::DEG2RAD : getPitch(); @@ -102,7 +103,7 @@ void Transform::easeTo(const CameraOptions& camera, const AnimationOptions& anim return; } - if (state.bounds == LatLngBounds()) { + if (state.getLatLngBounds() == LatLngBounds()) { if (isGestureInProgress()) { // If gesture in progress, we transfer the wrap rounds from the end longitude into // start, so the "scroll effect" of rounding the world is the same while assuring the @@ -115,24 +116,24 @@ void Transform::easeTo(const CameraOptions& camera, const AnimationOptions& anim } } - const Point<double> startPoint = Projection::project(startLatLng, state.scale); - const Point<double> endPoint = Projection::project(latLng, state.scale); + const Point<double> startPoint = Projection::project(startLatLng, state.getScale()); + const Point<double> endPoint = Projection::project(latLng, state.getScale()); // Constrain camera options. zoom = util::clamp(zoom, state.getMinZoom(), state.getMaxZoom()); pitch = util::clamp(pitch, util::PITCH_MIN, util::PITCH_MAX); // Minimize rotation by taking the shorter path around the circle. - bearing = _normalizeAngle(bearing, state.bearing); - state.bearing = _normalizeAngle(state.bearing, bearing); + bearing = _normalizeAngle(bearing, state.getBearing()); + state.setBearing( _normalizeAngle(state.getBearing(), bearing)); const double startZoom = state.getZoom(); - const double startBearing = state.bearing; - const double startPitch = state.pitch; - state.panning = unwrappedLatLng != startLatLng; - state.scaling = zoom != startZoom; - state.rotating = bearing != startBearing; - const EdgeInsets startEdgeInsets = state.edgeInsets; + const double startBearing = state.getBearing(); + const double startPitch = state.getPitch(); + state.setPanning(unwrappedLatLng != startLatLng); + state.setScaling(zoom != startZoom); + state.setRotating(bearing != startBearing); + const EdgeInsets startEdgeInsets = state.getEdgeInsets(); startTransition(camera, animation, [=](double t) { Point<double> framePoint = util::interpolate(startPoint, endPoint, t); @@ -141,22 +142,23 @@ void Transform::easeTo(const CameraOptions& camera, const AnimationOptions& anim state.setLatLngZoom(frameLatLng, frameZoom); if (bearing != startBearing) { - state.bearing = util::wrap(util::interpolate(startBearing, bearing, t), -M_PI, M_PI); + state.setBearing(util::wrap(util::interpolate(startBearing, bearing, t), -M_PI, M_PI)); } if (padding != startEdgeInsets) { // Interpolate edge insets - state.edgeInsets = { + state.setEdgeInsets({ util::interpolate(startEdgeInsets.top(), padding.top(), t), util::interpolate(startEdgeInsets.left(), padding.left(), t), util::interpolate(startEdgeInsets.bottom(), padding.bottom(), t), util::interpolate(startEdgeInsets.right(), padding.right(), t) - }; + }); } - auto maxPitch = getMaxPitchForEdgeInsets(state.edgeInsets); + auto maxPitch = getMaxPitchForEdgeInsets(state.getEdgeInsets()); if (pitch != startPitch || maxPitch < startPitch) { - state.pitch = std::min(maxPitch, util::interpolate(startPitch, pitch, t)); + state.setPitch(std::min(maxPitch, util::interpolate(startPitch, pitch, t))); } }, duration); + state.updateMatrix(); } /** This method implements an “optimal path” animation, as detailed in: @@ -168,13 +170,13 @@ void Transform::easeTo(const CameraOptions& camera, const AnimationOptions& anim Where applicable, local variable documentation begins with the associated variable or function in van Wijk (2003). */ void Transform::flyTo(const CameraOptions &camera, const AnimationOptions &animation, bool linearZoomInterpolation) { - const EdgeInsets& padding = camera.padding.value_or(state.edgeInsets); + const EdgeInsets& padding = camera.padding.value_or(state.getEdgeInsets()); const LatLng& latLng = camera.center.value_or(getLatLng(LatLng::Unwrapped)).wrapped(); double zoom = camera.zoom.value_or(getZoom()); double bearing = camera.bearing ? -*camera.bearing * util::DEG2RAD : getBearing(); double pitch = camera.pitch ? *camera.pitch * util::DEG2RAD : getPitch(); - if (std::isnan(zoom) || std::isnan(bearing) || std::isnan(pitch) || state.size.isEmpty()) { + if (std::isnan(zoom) || std::isnan(bearing) || std::isnan(pitch) || state.getSize().isEmpty()) { if (animation.transitionFinishFn) { animation.transitionFinishFn(); } @@ -185,25 +187,26 @@ void Transform::flyTo(const CameraOptions &camera, const AnimationOptions &anima LatLng startLatLng = getLatLng(LatLng::Unwrapped).wrapped(); startLatLng.unwrapForShortestPath(latLng); - const Point<double> startPoint = Projection::project(startLatLng, state.scale); - const Point<double> endPoint = Projection::project(latLng, state.scale); + const Point<double> startPoint = Projection::project(startLatLng, state.getScale()); + const Point<double> endPoint = Projection::project(latLng, state.getScale()); // Constrain camera options. zoom = util::clamp(zoom, state.getMinZoom(), state.getMaxZoom()); pitch = util::clamp(pitch, util::PITCH_MIN, util::PITCH_MAX); // Minimize rotation by taking the shorter path around the circle. - bearing = _normalizeAngle(bearing, state.bearing); - state.bearing = _normalizeAngle(state.bearing, bearing); + bearing = _normalizeAngle(bearing, state.getBearing()); + state.setBearing(_normalizeAngle(state.getBearing(), bearing)); - const double startZoom = state.scaleZoom(state.scale); - const double startBearing = state.bearing; - const double startPitch = state.pitch; + const double startZoom = state.scaleZoom(state.getScale()); + const double startBearing = state.getBearing(); + const double startPitch = state.getPitch(); /// w₀: Initial visible span, measured in pixels at the initial scale. /// Known henceforth as a <i>screenful</i>. - double w0 = std::max(state.size.width - padding.left() - padding.right(), - state.size.height - padding.top() - padding.bottom()); + + double w0 = std::max(state.getSize().width - padding.left() - padding.right(), + state.getSize().height - padding.top() - padding.bottom()); /// w₁: Final visible span, measured in pixels with respect to the initial /// scale. double w1 = w0 / state.zoomScale(zoom - startZoom); @@ -286,11 +289,11 @@ void Transform::flyTo(const CameraOptions &camera, const AnimationOptions &anima return; } - const double startScale = state.scale; - state.panning = true; - state.scaling = true; - state.rotating = bearing != startBearing; - const EdgeInsets startEdgeInsets = state.edgeInsets; + const double startScale = state.getScale(); + state.setPanning(true); + state.setScaling(true); + state.setRotating( bearing != startBearing); + const EdgeInsets startEdgeInsets = state.getEdgeInsets(); startTransition(camera, animation, [=](double k) { /// s: The distance traveled along the flight path, measured in @@ -313,29 +316,31 @@ void Transform::flyTo(const CameraOptions &camera, const AnimationOptions &anima state.setLatLngZoom(frameLatLng, frameZoom); if (bearing != startBearing) { - state.bearing = util::wrap(util::interpolate(startBearing, bearing, k), -M_PI, M_PI); + state.setBearing(util::wrap(util::interpolate(startBearing, bearing, k), -M_PI, M_PI)); } if (padding != startEdgeInsets) { // Interpolate edge insets - state.edgeInsets = { + state.setEdgeInsets({ util::interpolate(startEdgeInsets.top(), padding.top(), k), util::interpolate(startEdgeInsets.left(), padding.left(), k), util::interpolate(startEdgeInsets.bottom(), padding.bottom(), k), util::interpolate(startEdgeInsets.right(), padding.right(), k) - }; + }); } - auto maxPitch = getMaxPitchForEdgeInsets(state.edgeInsets); + auto maxPitch = getMaxPitchForEdgeInsets(state.getEdgeInsets()); if (pitch != startPitch || maxPitch < startPitch) { - state.pitch = std::min(maxPitch, util::interpolate(startPitch, pitch, k)); + state.setPitch(std::min(maxPitch, util::interpolate(startPitch, pitch, k))); } }, duration); + state.updateMatrix(); + } #pragma mark - Position void Transform::moveBy(const ScreenCoordinate& offset, const AnimationOptions& animation) { ScreenCoordinate centerOffset = { offset.x, offset.y }; - ScreenCoordinate pointOnScreen = state.edgeInsets.getCenter(state.size.width, state.size.height) - centerOffset; + ScreenCoordinate pointOnScreen = state.getEdgeInsets().getCenter(state.getSize().width, state.getSize().height) - centerOffset; // Use unwrapped LatLng to carry information about moveBy direction. easeTo(CameraOptions().withCenter(screenCoordinateToLatLng(pointOnScreen, LatLng::Unwrapped)), animation); } @@ -372,7 +377,7 @@ void Transform::setMaxZoom(const double maxZoom) { #pragma mark - Bearing void Transform::rotateBy(const ScreenCoordinate& first, const ScreenCoordinate& second, const AnimationOptions& animation) { - ScreenCoordinate center = state.edgeInsets.getCenter(state.size.width, state.size.height); + ScreenCoordinate center = state.getEdgeInsets().getCenter(state.getSize().width, state.getSize().height); const ScreenCoordinate offset = first - center; const double distance = std::sqrt(std::pow(2, offset.x) + std::pow(2, offset.y)); @@ -385,25 +390,26 @@ void Transform::rotateBy(const ScreenCoordinate& first, const ScreenCoordinate& center.y = first.y + std::sin(rotateBearing) * heightOffset; } - const double bearing = -(state.bearing + util::angle_between(first - center, second - center)) * util::RAD2DEG; + const double bearing = -(state.getBearing() + util::angle_between(first - center, second - center)) * util::RAD2DEG; easeTo(CameraOptions().withBearing(bearing), animation); } double Transform::getBearing() const { - return state.bearing; + return state.getBearing(); } #pragma mark - Pitch double Transform::getPitch() const { - return state.pitch; + return state.getPitch(); } #pragma mark - North Orientation void Transform::setNorthOrientation(NorthOrientation orientation) { - state.orientation = orientation; - state.constrain(state.scale, state.x, state.y); + state.setNorthOrientation( orientation); + state.constrain(); + state.updateMatrix(); } NorthOrientation Transform::getNorthOrientation() const { @@ -413,8 +419,9 @@ NorthOrientation Transform::getNorthOrientation() const { #pragma mark - Constrain mode void Transform::setConstrainMode(mbgl::ConstrainMode mode) { - state.constrainMode = mode; - state.constrain(state.scale, state.x, state.y); + state.setConstrainMode(mode); + state.constrain(); + state.updateMatrix(); } ConstrainMode Transform::getConstrainMode() const { @@ -424,7 +431,7 @@ ConstrainMode Transform::getConstrainMode() const { #pragma mark - Viewport mode void Transform::setViewportMode(mbgl::ViewportMode mode) { - state.viewportMode = mode; + state.setViewportMode(mode); } ViewportMode Transform::getViewportMode() const { @@ -434,16 +441,17 @@ ViewportMode Transform::getViewportMode() const { #pragma mark - Projection mode void Transform::setProjectionMode(const ProjectionMode& options) { - state.axonometric = options.axonometric.value_or(state.axonometric); - state.xSkew = options.xSkew.value_or(state.xSkew); - state.ySkew = options.ySkew.value_or(state.ySkew); + state.setAxonometric(options.axonometric.value_or(state.getAxonometric())); + state.setXSkew(options.xSkew.value_or(state.getXSkew())); + state.setYSkew(options.ySkew.value_or(state.getYSkew())); + state.updateMatrix(); } ProjectionMode Transform::getProjectionMode() const { return ProjectionMode() - .withAxonometric(state.axonometric) - .withXSkew(state.xSkew) - .withYSkew(state.ySkew); + .withAxonometric(state.getAxonometric()) + .withXSkew(state.getXSkew()) + .withYSkew(state.getYSkew()); } #pragma mark - Transition @@ -465,7 +473,7 @@ void Transform::startTransition(const CameraOptions& camera, optional<ScreenCoordinate> anchor = camera.center ? nullopt : camera.anchor; LatLng anchorLatLng; if (anchor) { - anchor->y = state.size.height - anchor->y; + anchor->y = state.getSize().height - anchor->y; anchorLatLng = state.screenCoordinateToLatLng(*anchor); } @@ -497,9 +505,9 @@ void Transform::startTransition(const CameraOptions& camera, }; transitionFinishFn = [isAnimated, animation, this] { - state.panning = false; - state.scaling = false; - state.rotating = false; + state.setPanning(false); + state.setScaling(false); + state.setRotating(false); if (animation.transitionFinishFn) { animation.transitionFinishFn(); } @@ -573,20 +581,20 @@ void Transform::cancelTransitions() { } void Transform::setGestureInProgress(bool inProgress) { - state.gestureInProgress = inProgress; + state.setGestureInProgress(inProgress); } #pragma mark Conversion and projection ScreenCoordinate Transform::latLngToScreenCoordinate(const LatLng& latLng) const { ScreenCoordinate point = state.latLngToScreenCoordinate(latLng); - point.y = state.size.height - point.y; + point.y = state.getSize().height - point.y; return point; } LatLng Transform::screenCoordinateToLatLng(const ScreenCoordinate& point, LatLng::WrapMode wrapMode) const { ScreenCoordinate flippedPoint = point; - flippedPoint.y = state.size.height - flippedPoint.y; + flippedPoint.y = state.getSize().height - flippedPoint.y; return state.screenCoordinateToLatLng(flippedPoint, wrapMode); } @@ -594,7 +602,7 @@ double Transform::getMaxPitchForEdgeInsets(const EdgeInsets &insets) const { double centerOffsetY = 0.5 * (insets.top() - insets.bottom()); // See TransformState::getCenterOffset. - const auto height = state.size.height; + const auto height = state.getSize().height; assert(height); // For details, see description at https://github.com/mapbox/mapbox-gl-native/pull/15195 // The definition of half of TransformState::fov with no inset, is: fov = arctan((height / 2) / (height * 1.5)). diff --git a/src/mbgl/map/transform_state.cpp b/src/mbgl/map/transform_state.cpp index f3cd8c3886..dcbe32807b 100644 --- a/src/mbgl/map/transform_state.cpp +++ b/src/mbgl/map/transform_state.cpp @@ -104,12 +104,27 @@ void TransformState::getProjMatrix(mat4& projMatrix, uint16_t nearZ, bool aligne } } +void TransformState::updateMatrix() { + if(size.isEmpty()) { + return; + } + coordiMatrix = coordinatePointMatrix(); + mat4 mat = coordiMatrix; + + bool err = matrix::invert(invertedMatrix, mat); + + if (err) throw std::runtime_error("failed to invert coordinatePointMatrix"); +} + +void TransformState::setSize(const Size& size_) { + size = size_; +} + #pragma mark - Dimensions Size TransformState::getSize() const { return size; } - #pragma mark - North Orientation NorthOrientation TransformState::getNorthOrientation() const { @@ -278,11 +293,11 @@ ScreenCoordinate TransformState::latLngToScreenCoordinate(const LatLng& latLng) return {}; } - mat4 mat = coordinatePointMatrix(); + // mat4 mat = coordinatePointMatrix(); vec4 p; Point<double> pt = Projection::project(latLng, scale) / util::tileSize; vec4 c = {{ pt.x, pt.y, 0, 1 }}; - matrix::transformMat4(p, c, mat); + matrix::transformMat4(p, c, coordiMatrix); return { p[0] / p[3], size.height - p[1] / p[3] }; } @@ -292,12 +307,12 @@ TileCoordinate TransformState::screenCoordinateToTileCoordinate(const ScreenCoor } float targetZ = 0; - mat4 mat = coordinatePointMatrix(); + // mat4 mat = coordinatePointMatrix(); - mat4 inverted; - bool err = matrix::invert(inverted, mat); + // mat4 inverted; + // bool err = matrix::invert(inverted, mat); - if (err) throw std::runtime_error("failed to invert coordinatePointMatrix"); + // if (err) throw std::runtime_error("failed to invert coordinatePointMatrix"); double flippedY = size.height - point.y; @@ -309,8 +324,8 @@ TileCoordinate TransformState::screenCoordinateToTileCoordinate(const ScreenCoor vec4 coord1; vec4 point0 = {{ point.x, flippedY, 0, 1 }}; vec4 point1 = {{ point.x, flippedY, 1, 1 }}; - matrix::transformMat4(coord0, point0, inverted); - matrix::transformMat4(coord1, point1, inverted); + matrix::transformMat4(coord0, point0, invertedMatrix); + matrix::transformMat4(coord1, point1, invertedMatrix); double w0 = coord0[3]; double w1 = coord1[3]; @@ -435,11 +450,11 @@ float TransformState::maxPitchScaleFactor() const { return {}; } auto latLng = screenCoordinateToLatLng({ 0, static_cast<float>(getSize().height) }); - mat4 mat = coordinatePointMatrix(); + // mat4 mat = coordinatePointMatrix(); Point<double> pt = Projection::project(latLng, scale) / util::tileSize; vec4 p = {{ pt.x, pt.y, 0, 1 }}; vec4 topPoint; - matrix::transformMat4(topPoint, p, mat); + matrix::transformMat4(topPoint, p, coordiMatrix); return topPoint[3] / getCameraToCenterDistance(); } diff --git a/src/mbgl/map/transform_state.hpp b/src/mbgl/map/transform_state.hpp index 10a92187d5..165e4fcec6 100644 --- a/src/mbgl/map/transform_state.hpp +++ b/src/mbgl/map/transform_state.hpp @@ -20,8 +20,8 @@ class UnwrappedTileID; class TileCoordinate; class TransformState { - friend class Transform; - friend class RendererState; + // friend class Transform; + // friend class RendererState; public: TransformState(ConstrainMode = ConstrainMode::HeightOnly, ViewportMode = ViewportMode::Default); @@ -32,19 +32,25 @@ public: // Dimensions Size getSize() const; + void setSize(const Size& size_); // North Orientation NorthOrientation getNorthOrientation() const; double getNorthOrientationAngle() const; + void setNorthOrientation(NorthOrientation val) {orientation = val;} // Constrain mode ConstrainMode getConstrainMode() const; + void setConstrainMode(ConstrainMode val) {constrainMode = val;} // Viewport mode ViewportMode getViewportMode() const; + void setViewportMode(ViewportMode val) {viewportMode = val;} CameraOptions getCameraOptions(optional<EdgeInsets>) const; + EdgeInsets getEdgeInsets() const {return edgeInsets;} + void setEdgeInsets(const EdgeInsets& val) {edgeInsets = val;} // Position LatLng getLatLng(LatLng::WrapMode = LatLng::Unwrapped) const; double pixel_x() const; @@ -57,6 +63,7 @@ public: // Scale double getScale() const { return scale; } + void setScale(const double val ) {scale = val;} // Bounds void setLatLngBounds(LatLngBounds); @@ -68,16 +75,29 @@ public: // Rotation float getBearing() const; + void setBearing(float val) {bearing = val;} float getFieldOfView() const; float getCameraToCenterDistance() const; float getPitch() const; + void setPitch(float val) {pitch = val;} + + double getXSkew() const {return xSkew;} + void setXSkew(double val) {xSkew = val;} + double getYSkew() const {return ySkew;} + void setYSkew(double val) {ySkew = val;} + bool getAxonometric() const {return axonometric;} + void setAxonometric(bool val) {axonometric = val;} // State bool isChanging() const; bool isRotating() const; + void setRotating(bool val) {rotating = val;} bool isScaling() const; + void setScaling(bool val) {scaling = val;} bool isPanning() const; + void setPanning(bool val) {panning = val;} bool isGestureInProgress() const; + void setGestureInProgress(bool val) {gestureInProgress = val;} // Conversion ScreenCoordinate latLngToScreenCoordinate(const LatLng&) const; @@ -95,6 +115,12 @@ public: float getCameraToTileDistance(const UnwrappedTileID&) const; float maxPitchScaleFactor() const; + void constrain() {constrain(scale, x, y);} + void moveLatLng(const LatLng&, const ScreenCoordinate&); + + void setLatLngZoom(const LatLng &latLng, double zoom); + + void updateMatrix(); private: bool rotatedNorth() const; void constrain(double& scale, double& x, double& y) const; @@ -119,8 +145,7 @@ private: /** Recenter the map so that the given coordinate is located at the given point on screen. */ - void moveLatLng(const LatLng&, const ScreenCoordinate&); - void setLatLngZoom(const LatLng &latLng, double zoom); + void setScalePoint(const double scale, const ScreenCoordinate& point); private: @@ -152,6 +177,9 @@ private: // cache values for spherical mercator math double Bc = Projection::worldSize(scale) / util::DEGREES_MAX; double Cc = Projection::worldSize(scale) / util::M2PI; + + mat4 coordiMatrix; + mat4 invertedMatrix; }; } // namespace mbgl diff --git a/src/mbgl/renderer/renderer_state.cpp b/src/mbgl/renderer/renderer_state.cpp index 33f6eb27dd..492c8b5d4a 100644 --- a/src/mbgl/renderer/renderer_state.cpp +++ b/src/mbgl/renderer/renderer_state.cpp @@ -45,12 +45,12 @@ ScreenCoordinate RendererState::pixelForLatLng(const UpdateParameters& updatePar LatLng unwrappedLatLng = latLng.wrapped(); unwrappedLatLng.unwrapForShortestPath(updateParameters.transformState.getLatLng()); const ScreenCoordinate point = updateParameters.transformState.latLngToScreenCoordinate(latLng); - return ScreenCoordinate { point.x, updateParameters.transformState.size.height - point.y }; + return ScreenCoordinate { point.x, updateParameters.transformState.getSize().height - point.y }; } LatLng RendererState::latLngForPixel(const UpdateParameters& updateParameters, const ScreenCoordinate& point) { ScreenCoordinate flippedPoint = point; - flippedPoint.y = updateParameters.transformState.size.height - flippedPoint.y; + flippedPoint.y = updateParameters.transformState.getSize().height - flippedPoint.y; return updateParameters.transformState.screenCoordinateToLatLng(flippedPoint); } |