summaryrefslogtreecommitdiff
path: root/src/mbgl/layermanager/line_layer_factory.cpp
diff options
context:
space:
mode:
authorAndrew Hay Kurtz <andrew.hay.kurtz@gmail.com>2019-09-17 17:35:08 -0700
committerAlexander Shalamov <alexander.shalamov@mapbox.com>2019-12-17 14:25:19 +0200
commitda4eb01bc7b74b09405f9911ef506c190b426f9d (patch)
tree11d2d2549150ebb0fbd1db14bc575f628113da5d /src/mbgl/layermanager/line_layer_factory.cpp
parentc3854cedc2b1b7e0fb9b5cb5744d6c9495c1730e (diff)
downloadqtlocation-mapboxgl-da4eb01bc7b74b09405f9911ef506c190b426f9d.tar.gz
[core] Enable 'line-sort-key' and 'fill-sort-key' layout properties (#15839)
- Generate style code for 'line-sort-key' and 'symbol-sort-key' - Add new layout properties to FillLayer::Impl, FillBucket, and FillLayerFactory - Fix consistency of paint and layout properties type alias usage in FillBucket, LineBucket - Add optional feature sorting to fill and line Layout creation - Enable node render tests for fill-sort-key and line-sort-key - Fix FillBucket test construction - Prefer emplace_back to push_back for PatternFeature container - Fix buggy static_cast for PatternFeature indices - Maintain sort of features as they are created - Switch pattern layout features container to list from vector for better insert performance - Fix formatting expected by sanity check - Use subclass PatternLayoutSorted to work around lack of template functions - Fix to retain source order for features with equivalent sort keys during sorting - [core] Fix clang-format - [core] Address review comments - [core] Pass inserting strategy class at compile time - [core] Use sorted strategy only if sort key is defined in layout - [core] Update style generator - [core] Merge PatternLayout and PatternLayoutSorted classes - Use static methods for inserter strategies - Merge PatternLayout and PatternLayoutSorted classes
Diffstat (limited to 'src/mbgl/layermanager/line_layer_factory.cpp')
-rw-r--r--src/mbgl/layermanager/line_layer_factory.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/mbgl/layermanager/line_layer_factory.cpp b/src/mbgl/layermanager/line_layer_factory.cpp
index 5770b19f33..53b91a0705 100644
--- a/src/mbgl/layermanager/line_layer_factory.cpp
+++ b/src/mbgl/layermanager/line_layer_factory.cpp
@@ -28,8 +28,14 @@ std::unique_ptr<Layout> LineLayerFactory::createLayout(const LayoutParameters& p
std::unique_ptr<GeometryTileLayer> layer,
const std::vector<Immutable<style::LayerProperties>>& group) noexcept {
using namespace style;
- using LayoutType = PatternLayout<LineBucket, LineLayerProperties, LinePattern, LineLayoutProperties::PossiblyEvaluated>;
- return std::make_unique<LayoutType>(parameters.bucketParameters, group, std::move(layer), parameters);
+ using LayoutTypeUnsorted = PatternLayout<LineBucket, LineLayerProperties, LinePattern, LineLayoutProperties>;
+ using LayoutTypeSorted =
+ PatternLayout<LineBucket, LineLayerProperties, LinePattern, LineLayoutProperties, LineSortKey>;
+ auto layerProperties = staticImmutableCast<LineLayerProperties>(group.front());
+ if (layerProperties->layerImpl().layout.get<LineSortKey>().isUndefined()) {
+ return std::make_unique<LayoutTypeUnsorted>(parameters.bucketParameters, group, std::move(layer), parameters);
+ }
+ return std::make_unique<LayoutTypeSorted>(parameters.bucketParameters, group, std::move(layer), parameters);
}
std::unique_ptr<RenderLayer> LineLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {