diff options
author | Juha Alanen <juha.alanen@mapbox.com> | 2019-08-21 16:12:25 +0300 |
---|---|---|
committer | Juha Alanen <19551460+jmalanen@users.noreply.github.com> | 2019-09-18 14:29:15 +0300 |
commit | 7ce9b0d47d794411bdf1315e22b6b8234c4f1a9d (patch) | |
tree | 1df667efa578e5595819f61d5fb476ef82b9bebc | |
parent | 598df1897dcad6f0a003fbae5d9058b1a660f408 (diff) | |
download | qtlocation-mapboxgl-7ce9b0d47d794411bdf1315e22b6b8234c4f1a9d.tar.gz |
[core] Feature state support to RenderLayer classes
-rw-r--r-- | src/mbgl/geometry/feature_index.cpp | 2 | ||||
-rw-r--r-- | src/mbgl/renderer/layers/render_circle_layer.cpp | 7 | ||||
-rw-r--r-- | src/mbgl/renderer/layers/render_circle_layer.hpp | 3 | ||||
-rw-r--r-- | src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp | 3 | ||||
-rw-r--r-- | src/mbgl/renderer/layers/render_fill_extrusion_layer.hpp | 3 | ||||
-rw-r--r-- | src/mbgl/renderer/layers/render_fill_layer.cpp | 3 | ||||
-rw-r--r-- | src/mbgl/renderer/layers/render_fill_layer.hpp | 3 | ||||
-rw-r--r-- | src/mbgl/renderer/layers/render_heatmap_layer.cpp | 3 | ||||
-rw-r--r-- | src/mbgl/renderer/layers/render_heatmap_layer.hpp | 3 | ||||
-rw-r--r-- | src/mbgl/renderer/layers/render_line_layer.cpp | 13 | ||||
-rw-r--r-- | src/mbgl/renderer/layers/render_line_layer.hpp | 5 | ||||
-rw-r--r-- | src/mbgl/renderer/render_layer.hpp | 3 |
12 files changed, 31 insertions, 20 deletions
diff --git a/src/mbgl/geometry/feature_index.cpp b/src/mbgl/geometry/feature_index.cpp index 2601d60979..571ff172f8 100644 --- a/src/mbgl/geometry/feature_index.cpp +++ b/src/mbgl/geometry/feature_index.cpp @@ -161,7 +161,7 @@ void FeatureIndex::addFeature( bool needsCrossTileIndex = renderLayer->baseImpl->getTypeInfo()->crossTileIndex == style::LayerTypeInfo::CrossTileIndex::Required; if (!needsCrossTileIndex && - !renderLayer->queryIntersectsFeature(queryGeometry, *geometryTileFeature, tileID.z, transformState, pixelsToTileUnits, posMatrix)) { + !renderLayer->queryIntersectsFeature(queryGeometry, *geometryTileFeature, tileID.z, transformState, pixelsToTileUnits, posMatrix, state)) { continue; } diff --git a/src/mbgl/renderer/layers/render_circle_layer.cpp b/src/mbgl/renderer/layers/render_circle_layer.cpp index ea0c20f124..76dadd80bf 100644 --- a/src/mbgl/renderer/layers/render_circle_layer.cpp +++ b/src/mbgl/renderer/layers/render_circle_layer.cpp @@ -147,7 +147,8 @@ bool RenderCircleLayer::queryIntersectsFeature( const float zoom, const TransformState& transformState, const float pixelsToTileUnits, - const mat4& posMatrix) const { + const mat4& posMatrix, + const FeatureState& featureState) const { const auto& evaluated = static_cast<const CircleLayerProperties&>(*evaluatedProperties).evaluated; // Translate query geometry const GeometryCoordinates& translatedQueryGeometry = FeatureIndex::translateQueryGeometry( @@ -158,8 +159,8 @@ bool RenderCircleLayer::queryIntersectsFeature( pixelsToTileUnits).value_or(queryGeometry); // Evaluate functions - auto radius = evaluated.evaluate<style::CircleRadius>(zoom, feature); - auto stroke = evaluated.evaluate<style::CircleStrokeWidth>(zoom, feature); + auto radius = evaluated.evaluate<style::CircleRadius>(zoom, feature, featureState); + auto stroke = evaluated.evaluate<style::CircleStrokeWidth>(zoom, feature, featureState); auto size = radius + stroke; // For pitch-alignment: map, compare feature geometry to query geometry in the plane of the tile diff --git a/src/mbgl/renderer/layers/render_circle_layer.hpp b/src/mbgl/renderer/layers/render_circle_layer.hpp index 9348e48929..ee0318da7c 100644 --- a/src/mbgl/renderer/layers/render_circle_layer.hpp +++ b/src/mbgl/renderer/layers/render_circle_layer.hpp @@ -24,7 +24,8 @@ private: const float, const TransformState&, const float, - const mat4&) const override; + const mat4&, + const FeatureState&) const override; // Paint properties style::CirclePaintProperties::Unevaluated unevaluated; diff --git a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp index 835e8c8ee5..b6ffa3f8f9 100644 --- a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp +++ b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp @@ -230,7 +230,8 @@ bool RenderFillExtrusionLayer::queryIntersectsFeature( const float, const TransformState& transformState, const float pixelsToTileUnits, - const mat4&) const { + const mat4&, + const FeatureState&) const { const auto& evaluated = static_cast<const FillExtrusionLayerProperties&>(*evaluatedProperties).evaluated; auto translatedQueryGeometry = FeatureIndex::translateQueryGeometry( queryGeometry, diff --git a/src/mbgl/renderer/layers/render_fill_extrusion_layer.hpp b/src/mbgl/renderer/layers/render_fill_extrusion_layer.hpp index 8bd1f52adf..bad2c26122 100644 --- a/src/mbgl/renderer/layers/render_fill_extrusion_layer.hpp +++ b/src/mbgl/renderer/layers/render_fill_extrusion_layer.hpp @@ -26,7 +26,8 @@ private: const float, const TransformState&, const float, - const mat4&) const override; + const mat4&, + const FeatureState&) const override; // Paint properties style::FillExtrusionPaintProperties::Unevaluated unevaluated; diff --git a/src/mbgl/renderer/layers/render_fill_layer.cpp b/src/mbgl/renderer/layers/render_fill_layer.cpp index 27cb76fede..40b3c289f2 100644 --- a/src/mbgl/renderer/layers/render_fill_layer.cpp +++ b/src/mbgl/renderer/layers/render_fill_layer.cpp @@ -255,7 +255,8 @@ bool RenderFillLayer::queryIntersectsFeature( const float, const TransformState& transformState, const float pixelsToTileUnits, - const mat4&) const { + const mat4&, + const FeatureState&) const { const auto& evaluated = getEvaluated<FillLayerProperties>(evaluatedProperties); auto translatedQueryGeometry = FeatureIndex::translateQueryGeometry( queryGeometry, diff --git a/src/mbgl/renderer/layers/render_fill_layer.hpp b/src/mbgl/renderer/layers/render_fill_layer.hpp index 79adc9dab4..182e0c544c 100644 --- a/src/mbgl/renderer/layers/render_fill_layer.hpp +++ b/src/mbgl/renderer/layers/render_fill_layer.hpp @@ -27,7 +27,8 @@ private: const float, const TransformState&, const float, - const mat4&) const override; + const mat4&, + const FeatureState&) const override; // Paint properties style::FillPaintProperties::Unevaluated unevaluated; diff --git a/src/mbgl/renderer/layers/render_heatmap_layer.cpp b/src/mbgl/renderer/layers/render_heatmap_layer.cpp index 4fa20ffd13..777269f9db 100644 --- a/src/mbgl/renderer/layers/render_heatmap_layer.cpp +++ b/src/mbgl/renderer/layers/render_heatmap_layer.cpp @@ -225,7 +225,8 @@ bool RenderHeatmapLayer::queryIntersectsFeature( const float zoom, const TransformState&, const float pixelsToTileUnits, - const mat4&) const { + const mat4&, + const FeatureState&) const { (void) queryGeometry; (void) feature; (void) zoom; diff --git a/src/mbgl/renderer/layers/render_heatmap_layer.hpp b/src/mbgl/renderer/layers/render_heatmap_layer.hpp index 27e27adb28..1c1eb67ad5 100644 --- a/src/mbgl/renderer/layers/render_heatmap_layer.hpp +++ b/src/mbgl/renderer/layers/render_heatmap_layer.hpp @@ -28,7 +28,8 @@ private: const float, const TransformState&, const float, - const mat4&) const override; + const mat4&, + const FeatureState&) const override; // Paint properties style::HeatmapPaintProperties::Unevaluated unevaluated; diff --git a/src/mbgl/renderer/layers/render_line_layer.cpp b/src/mbgl/renderer/layers/render_line_layer.cpp index 6d635f65e7..fe3ca00f06 100644 --- a/src/mbgl/renderer/layers/render_line_layer.cpp +++ b/src/mbgl/renderer/layers/render_line_layer.cpp @@ -263,7 +263,8 @@ bool RenderLineLayer::queryIntersectsFeature( const float zoom, const TransformState& transformState, const float pixelsToTileUnits, - const mat4&) const { + const mat4&, + const FeatureState& featureState) const { const auto& evaluated = static_cast<const LineLayerProperties&>(*evaluatedProperties).evaluated; // Translate query geometry auto translatedQueryGeometry = FeatureIndex::translateQueryGeometry( @@ -275,9 +276,9 @@ bool RenderLineLayer::queryIntersectsFeature( // Evaluate function auto offset = evaluated.get<style::LineOffset>() - .evaluate(feature, zoom, style::LineOffset::defaultValue()) * pixelsToTileUnits; + .evaluate(feature, zoom, featureState, style::LineOffset::defaultValue()) * pixelsToTileUnits; // Test intersection - const float halfWidth = getLineWidth(feature, zoom) / 2.0 * pixelsToTileUnits; + const float halfWidth = getLineWidth(feature, zoom, featureState) / 2.0 * pixelsToTileUnits; // Apply offset to geometry if (offset != 0.0f && !feature.getGeometries().empty()) { @@ -314,12 +315,12 @@ void RenderLineLayer::updateColorRamp() { } } -float RenderLineLayer::getLineWidth(const GeometryTileFeature& feature, const float zoom) const { +float RenderLineLayer::getLineWidth(const GeometryTileFeature& feature, const float zoom, const FeatureState& featureState) const { const auto& evaluated = static_cast<const LineLayerProperties&>(*evaluatedProperties).evaluated; float lineWidth = evaluated.get<style::LineWidth>() - .evaluate(feature, zoom, style::LineWidth::defaultValue()); + .evaluate(feature, zoom, featureState, style::LineWidth::defaultValue()); float gapWidth = evaluated.get<style::LineGapWidth>() - .evaluate(feature, zoom, style::LineGapWidth::defaultValue()); + .evaluate(feature, zoom, featureState, style::LineGapWidth::defaultValue()); if (gapWidth) { return gapWidth + 2 * lineWidth; } else { diff --git a/src/mbgl/renderer/layers/render_line_layer.hpp b/src/mbgl/renderer/layers/render_line_layer.hpp index 4454d215d9..d4d84eb34e 100644 --- a/src/mbgl/renderer/layers/render_line_layer.hpp +++ b/src/mbgl/renderer/layers/render_line_layer.hpp @@ -30,12 +30,13 @@ private: const float, const TransformState&, const float, - const mat4&) const override; + const mat4&, + const FeatureState&) const override; // Paint properties style::LinePaintProperties::Unevaluated unevaluated; - float getLineWidth(const GeometryTileFeature&, const float) const; + float getLineWidth(const GeometryTileFeature&, const float, const FeatureState&) const; void updateColorRamp(); PremultipliedImage colorRamp; diff --git a/src/mbgl/renderer/render_layer.hpp b/src/mbgl/renderer/render_layer.hpp index 75c729444b..2b65d069ae 100644 --- a/src/mbgl/renderer/render_layer.hpp +++ b/src/mbgl/renderer/render_layer.hpp @@ -94,7 +94,8 @@ public: const float, const TransformState&, const float, - const mat4&) const { return false; }; + const mat4&, + const FeatureState&) const { return false; }; virtual void prepare(const LayerPrepareParameters&); |