From 11bfe2398111dbca232b744db9b50119e7d3c495 Mon Sep 17 00:00:00 2001 From: Mikhail Pozdnyakov Date: Sun, 21 Jul 2019 23:11:27 +0300 Subject: [PATCH] [core] Symbol bucket uses shared layout sizeof(SymbolBucket): 2296 -> 1024 --- src/mbgl/layout/symbol_layout.cpp | 148 +++++++++--------- src/mbgl/layout/symbol_layout.hpp | 4 +- src/mbgl/renderer/buckets/symbol_bucket.cpp | 6 +- src/mbgl/renderer/buckets/symbol_bucket.hpp | 4 +- .../renderer/layers/render_symbol_layer.cpp | 4 +- src/mbgl/text/placement.cpp | 18 +-- test/gl/bucket.test.cpp | 4 +- test/text/cross_tile_symbol_index.test.cpp | 12 +- 8 files changed, 103 insertions(+), 97 deletions(-) diff --git a/src/mbgl/layout/symbol_layout.cpp b/src/mbgl/layout/symbol_layout.cpp index d8d143632..098a872c0 100644 --- a/src/mbgl/layout/symbol_layout.cpp +++ b/src/mbgl/layout/symbol_layout.cpp @@ -46,7 +46,38 @@ inline const SymbolLayerProperties& toSymbolLayerProperties(const Immutable(*layer); } +inline Immutable createLayout(const SymbolLayoutProperties::Unevaluated& unevaluated, float zoom) { + auto layout = makeMutable(unevaluated.evaluate(PropertyEvaluationParameters(zoom))); + + if (layout->get() == AlignmentType::Auto) { + if (layout->get() != SymbolPlacementType::Point) { + layout->get() = AlignmentType::Map; + } else { + layout->get() = AlignmentType::Viewport; + } + } + + if (layout->get() == AlignmentType::Auto) { + if (layout->get() != SymbolPlacementType::Point) { + layout->get() = AlignmentType::Map; + } else { + layout->get() = AlignmentType::Viewport; + } + } + + // If unspecified `*-pitch-alignment` inherits `*-rotation-alignment` + if (layout->get() == AlignmentType::Auto) { + layout->get() = layout->get(); + } + if (layout->get() == AlignmentType::Auto) { + layout->get() = layout->get(); + } + + return layout; +} + } // namespace + SymbolLayout::SymbolLayout(const BucketParameters& parameters, const std::vector>& layers, std::unique_ptr sourceLayer_, @@ -61,50 +92,23 @@ SymbolLayout::SymbolLayout(const BucketParameters& parameters, tileSize(util::tileSize * overscaling), tilePixelRatio(float(util::EXTENT) / tileSize), textSize(toSymbolLayerProperties(layers.at(0)).layerImpl().layout.get()), - iconSize(toSymbolLayerProperties(layers.at(0)).layerImpl().layout.get()) - { - + iconSize(toSymbolLayerProperties(layers.at(0)).layerImpl().layout.get()), + layout(createLayout(toSymbolLayerProperties(layers.at(0)).layerImpl().layout, zoom)) { const SymbolLayer::Impl& leader = toSymbolLayerProperties(layers.at(0)).layerImpl(); - layout = leader.layout.evaluate(PropertyEvaluationParameters(zoom)); - - if (layout.get() == AlignmentType::Auto) { - if (layout.get() != SymbolPlacementType::Point) { - layout.get() = AlignmentType::Map; - } else { - layout.get() = AlignmentType::Viewport; - } - } - - if (layout.get() == AlignmentType::Auto) { - if (layout.get() != SymbolPlacementType::Point) { - layout.get() = AlignmentType::Map; - } else { - layout.get() = AlignmentType::Viewport; - } - } - - // If unspecified `*-pitch-alignment` inherits `*-rotation-alignment` - if (layout.get() == AlignmentType::Auto) { - layout.get() = layout.get(); - } - if (layout.get() == AlignmentType::Auto) { - layout.get() = layout.get(); - } - - const bool hasText = has(layout) && has(layout); - const bool hasIcon = has(layout); + const bool hasText = has(*layout) && has(*layout); + const bool hasIcon = has(*layout); if (!hasText && !hasIcon) { return; } const bool hasSymbolSortKey = !leader.layout.get().isUndefined(); - const auto symbolZOrder = layout.get(); + const auto symbolZOrder = layout->get(); const bool sortFeaturesByKey = symbolZOrder != SymbolZOrderType::ViewportY && hasSymbolSortKey; const bool zOrderByViewportY = symbolZOrder == SymbolZOrderType::ViewportY || (symbolZOrder == SymbolZOrderType::Auto && !sortFeaturesByKey); - sortFeaturesByY = zOrderByViewportY && (layout.get() || layout.get() || - layout.get() || layout.get()); + sortFeaturesByY = zOrderByViewportY && (layout->get() || layout->get() || + layout->get() || layout->get()); for (const auto& layer : layers) { layerPaintProperties.emplace(layer->baseImpl->id, layer); @@ -122,9 +126,9 @@ SymbolLayout::SymbolLayout(const BucketParameters& parameters, ft.index = i; if (hasText) { - auto formatted = layout.evaluate(zoom, ft); - auto textTransform = layout.evaluate(zoom, ft); - FontStack baseFontStack = layout.evaluate(zoom, ft); + auto formatted = layout->evaluate(zoom, ft); + auto textTransform = layout->evaluate(zoom, ft); + FontStack baseFontStack = layout->evaluate(zoom, ft); ft.formattedText = TaggedString(); for (const auto & section : formatted.sections) { @@ -142,8 +146,8 @@ SymbolLayout::SymbolLayout(const BucketParameters& parameters, } - const bool canVerticalizeText = layout.get() == AlignmentType::Map - && layout.get() != SymbolPlacementType::Point + const bool canVerticalizeText = layout->get() == AlignmentType::Map + && layout->get() != SymbolPlacementType::Point && util::i18n::allowsVerticalWritingMode(ft.formattedText->rawText()); // Loop through all characters of this text and collect unique codepoints. @@ -161,13 +165,13 @@ SymbolLayout::SymbolLayout(const BucketParameters& parameters, } if (hasIcon) { - ft.icon = layout.evaluate(zoom, ft); + ft.icon = layout->evaluate(zoom, ft); imageDependencies.emplace(*ft.icon, ImageType::Icon); } if (ft.formattedText || ft.icon) { if (sortFeaturesByKey) { - ft.sortKey = layout.evaluate(zoom, ft); + ft.sortKey = layout->evaluate(zoom, ft); const auto lowerBound = std::lower_bound(features.begin(), features.end(), ft); features.insert(lowerBound, std::move(ft)); } else { @@ -176,7 +180,7 @@ SymbolLayout::SymbolLayout(const BucketParameters& parameters, } } - if (layout.get() == SymbolPlacementType::Line) { + if (layout->get() == SymbolPlacementType::Line) { util::mergeLines(features); } } @@ -270,8 +274,8 @@ Point SymbolLayout::evaluateRadialOffset(SymbolAnchorType anchor, float r void SymbolLayout::prepareSymbols(const GlyphMap& glyphMap, const GlyphPositions& glyphPositions, const ImageMap& imageMap, const ImagePositions& imagePositions) { - const bool isPointPlacement = layout.get() == SymbolPlacementType::Point; - const bool textAlongLine = layout.get() == AlignmentType::Map && !isPointPlacement; + const bool isPointPlacement = layout->get() == SymbolPlacementType::Point; + const bool textAlongLine = layout->get() == AlignmentType::Map && !isPointPlacement; for (auto it = features.begin(); it != features.end(); ++it) { auto& feature = *it; @@ -283,13 +287,13 @@ void SymbolLayout::prepareSymbols(const GlyphMap& glyphMap, const GlyphPositions // if feature has text, shape the text if (feature.formattedText) { - const float lineHeight = layout.get() * util::ONE_EM; - const float spacing = util::i18n::allowsLetterSpacing(feature.formattedText->rawText()) ? layout.evaluate(zoom, feature) * util::ONE_EM : 0.0f; + const float lineHeight = layout->get() * util::ONE_EM; + const float spacing = util::i18n::allowsLetterSpacing(feature.formattedText->rawText()) ? layout->evaluate(zoom, feature) * util::ONE_EM : 0.0f; auto applyShaping = [&] (const TaggedString& formattedText, WritingModeType writingMode, SymbolAnchorType textAnchor, TextJustifyType textJustify) { const Shaping result = getShaping( /* string */ formattedText, - /* maxWidth: ems */ isPointPlacement ? layout.evaluate(zoom, feature) * util::ONE_EM : 0.0f, + /* maxWidth: ems */ isPointPlacement ? layout->evaluate(zoom, feature) * util::ONE_EM : 0.0f, /* ems */ lineHeight, textAnchor, textJustify, @@ -301,9 +305,9 @@ void SymbolLayout::prepareSymbols(const GlyphMap& glyphMap, const GlyphPositions return result; }; - const std::vector variableTextAnchor = layout.evaluate(zoom, feature); - const float radialOffset = layout.evaluate(zoom, feature); - const SymbolAnchorType textAnchor = layout.evaluate(zoom, feature); + const std::vector variableTextAnchor = layout->evaluate(zoom, feature); + const float radialOffset = layout->evaluate(zoom, feature); + const SymbolAnchorType textAnchor = layout->evaluate(zoom, feature); if (variableTextAnchor.empty()) { // Layers with variable anchors use the `text-radial-offset` property and the [x, y] offset vector // is calculated at placement time instead of layout time @@ -312,11 +316,11 @@ void SymbolLayout::prepareSymbols(const GlyphMap& glyphMap, const GlyphPositions // but doesn't actually specify what happens if you use both. We go with the radial offset. textOffset = evaluateRadialOffset(textAnchor, radialOffset * util::ONE_EM); } else { - textOffset = { layout.evaluate(zoom, feature)[0] * util::ONE_EM, - layout.evaluate(zoom, feature)[1] * util::ONE_EM}; + textOffset = { layout->evaluate(zoom, feature)[0] * util::ONE_EM, + layout->evaluate(zoom, feature)[1] * util::ONE_EM}; } } - TextJustifyType textJustify = textAlongLine ? TextJustifyType::Center : layout.evaluate(zoom, feature); + TextJustifyType textJustify = textAlongLine ? TextJustifyType::Center : layout->evaluate(zoom, feature); // If this layer uses text-variable-anchor, generate shapings for all justification possibilities. if (!textAlongLine && !variableTextAnchor.empty()) { std::vector justifications; @@ -365,15 +369,15 @@ void SymbolLayout::prepareSymbols(const GlyphMap& glyphMap, const GlyphPositions if (image != imageMap.end()) { shapedIcon = PositionedIcon::shapeIcon( imagePositions.at(*feature.icon), - layout.evaluate(zoom, feature), - layout.evaluate(zoom, feature), - layout.evaluate(zoom, feature) * util::DEG2RAD); + layout->evaluate(zoom, feature), + layout->evaluate(zoom, feature), + layout->evaluate(zoom, feature) * util::DEG2RAD); if (image->second->sdf) { sdfIcons = true; } if (image->second->pixelRatio != pixelRatio) { iconsNeedLinear = true; - } else if (layout.get().constantOr(1) != 0) { + } else if (layout->get().constantOr(1) != 0) { iconsNeedLinear = true; } } @@ -399,34 +403,34 @@ void SymbolLayout::addFeature(const std::size_t layoutFeatureIndex, const float minScale = 0.5f; const float glyphSize = 24.0f; - const float layoutTextSize = layout.evaluate(zoom + 1, feature); - const float layoutIconSize = layout.evaluate(zoom + 1, feature); + const float layoutTextSize = layout->evaluate(zoom + 1, feature); + const float layoutIconSize = layout->evaluate(zoom + 1, feature); const std::array textOffset = {{ offset.x, offset.y }}; - const std::array iconOffset = layout.evaluate(zoom, feature); + const std::array iconOffset = layout->evaluate(zoom, feature); // To reduce the number of labels that jump around when zooming we need // to use a text-size value that is the same for all zoom levels. // This calculates text-size at a high zoom level so that all tiles can // use the same value when calculating anchor positions. - const float textMaxSize = layout.evaluate(18, feature); + const float textMaxSize = layout->evaluate(18, feature); const float fontScale = layoutTextSize / glyphSize; const float textBoxScale = tilePixelRatio * fontScale; const float textMaxBoxScale = tilePixelRatio * textMaxSize / glyphSize; const float iconBoxScale = tilePixelRatio * layoutIconSize; - const float symbolSpacing = tilePixelRatio * layout.get(); - const float textPadding = layout.get() * tilePixelRatio; - const float iconPadding = layout.get() * tilePixelRatio; - const float textMaxAngle = layout.get() * util::DEG2RAD; - const float rotation = layout.evaluate(zoom, feature); - const float radialTextOffset = layout.evaluate(zoom, feature) * util::ONE_EM; - const SymbolPlacementType textPlacement = layout.get() != AlignmentType::Map + const float symbolSpacing = tilePixelRatio * layout->get(); + const float textPadding = layout->get() * tilePixelRatio; + const float iconPadding = layout->get() * tilePixelRatio; + const float textMaxAngle = layout->get() * util::DEG2RAD; + const float rotation = layout->evaluate(zoom, feature); + const float radialTextOffset = layout->evaluate(zoom, feature) * util::ONE_EM; + const SymbolPlacementType textPlacement = layout->get() != AlignmentType::Map ? SymbolPlacementType::Point - : layout.get(); + : layout->get(); const float textRepeatDistance = symbolSpacing / 2; - const auto evaluatedLayoutProperties = layout.evaluate(zoom, feature); + const auto evaluatedLayoutProperties = layout->evaluate(zoom, feature); IndexedSubfeature indexedFeature(feature.index, sourceLayer->getName(), bucketLeaderID, symbolInstances.size()); auto addSymbolInstance = [&] (const GeometryCoordinates& line, Anchor& anchor) { @@ -449,7 +453,7 @@ void SymbolLayout::addFeature(const std::size_t layoutFeatureIndex, const auto& type = feature.getType(); - if (layout.get() == SymbolPlacementType::Line) { + if (layout->get() == SymbolPlacementType::Line) { auto clippedLines = util::clipLines(feature.geometry, 0, 0, util::EXTENT, util::EXTENT); for (const auto& line : clippedLines) { Anchors anchors = getAnchors(line, @@ -469,7 +473,7 @@ void SymbolLayout::addFeature(const std::size_t layoutFeatureIndex, } } } - } else if (layout.get() == SymbolPlacementType::LineCenter) { + } else if (layout->get() == SymbolPlacementType::LineCenter) { // No clipping, multiple lines per feature are allowed // "lines" with only one point are ignored as in clipLines for (const auto& line : feature.geometry) { diff --git a/src/mbgl/layout/symbol_layout.hpp b/src/mbgl/layout/symbol_layout.hpp index 4397c5543..23f883f56 100644 --- a/src/mbgl/layout/symbol_layout.hpp +++ b/src/mbgl/layout/symbol_layout.hpp @@ -90,8 +90,6 @@ private: const MapMode mode; const float pixelRatio; - style::SymbolLayoutProperties::PossiblyEvaluated layout; - const uint32_t tileSize; const float tilePixelRatio; @@ -101,7 +99,7 @@ private: style::TextSize::UnevaluatedType textSize; style::IconSize::UnevaluatedType iconSize; - + Immutable layout; std::vector features; BiDi bidi; // Consider moving this up to geometry tile worker to reduce reinstantiation costs; use of BiDi/ubiditransform object must be constrained to one thread diff --git a/src/mbgl/renderer/buckets/symbol_bucket.cpp b/src/mbgl/renderer/buckets/symbol_bucket.cpp index cc26f1b26..cd9fb08d3 100644 --- a/src/mbgl/renderer/buckets/symbol_bucket.cpp +++ b/src/mbgl/renderer/buckets/symbol_bucket.cpp @@ -13,7 +13,7 @@ namespace { std::atomic maxBucketInstanceId; } // namespace -SymbolBucket::SymbolBucket(style::SymbolLayoutProperties::PossiblyEvaluated layout_, +SymbolBucket::SymbolBucket(Immutable layout_, const std::map>& paintProperties_, const style::PropertyValue& textSize, const style::PropertyValue& iconSize, @@ -176,7 +176,7 @@ void SymbolBucket::sortFeatures(const float angle) { if (!sortFeaturesByY) { return; } - assert (angle != std::numeric_limits::max()); + assert(angle != std::numeric_limits::max()); if (sortedAngle == angle) { return; @@ -246,7 +246,7 @@ std::vector> SymbolBucket::getSortedSymbo bool SymbolBucket::hasFormatSectionOverrides() const { if (!hasFormatSectionOverrides_) { - hasFormatSectionOverrides_= SymbolLayerPaintPropertyOverrides::hasOverrides(layout.get()); + hasFormatSectionOverrides_= SymbolLayerPaintPropertyOverrides::hasOverrides(layout->get()); } return *hasFormatSectionOverrides_; } diff --git a/src/mbgl/renderer/buckets/symbol_bucket.hpp b/src/mbgl/renderer/buckets/symbol_bucket.hpp index bee3e3f7c..1c975e93e 100644 --- a/src/mbgl/renderer/buckets/symbol_bucket.hpp +++ b/src/mbgl/renderer/buckets/symbol_bucket.hpp @@ -43,7 +43,7 @@ public: class SymbolBucket final : public Bucket { public: - SymbolBucket(style::SymbolLayoutProperties::PossiblyEvaluated, + SymbolBucket(Immutable, const std::map>&, const style::PropertyValue& textSize, const style::PropertyValue& iconSize, @@ -72,7 +72,7 @@ public: // The result contains references to the `symbolInstances` items, sorted by viewport Y. std::vector> getSortedSymbols(const float angle); - const style::SymbolLayoutProperties::PossiblyEvaluated layout; + Immutable layout; const std::string bucketLeaderID; float sortedAngle = std::numeric_limits::max(); diff --git a/src/mbgl/renderer/layers/render_symbol_layer.cpp b/src/mbgl/renderer/layers/render_symbol_layer.cpp index c79008d08..8c3bae383 100644 --- a/src/mbgl/renderer/layers/render_symbol_layer.cpp +++ b/src/mbgl/renderer/layers/render_symbol_layer.cpp @@ -113,7 +113,7 @@ void drawIcon(const DrawFn& draw, const PaintParameters& parameters) { auto& bucket = static_cast(*renderData.bucket); const auto& evaluated = getEvaluated(renderData.layerProperties); - const auto& layout = bucket.layout; + const auto& layout = *bucket.layout; auto values = iconPropertyValues(evaluated, layout); const auto& paintPropertyValues = RenderSymbolLayer::iconPaintProperties(evaluated); @@ -184,7 +184,7 @@ void drawText(const DrawFn& draw, const PaintParameters& parameters) { auto& bucket = static_cast(*renderData.bucket); const auto& evaluated = getEvaluated(renderData.layerProperties); - const auto& layout = bucket.layout; + const auto& layout = *bucket.layout; const gfx::TextureBinding textureBinding{ tile.getGlyphAtlasTexture().getResource(), gfx::TextureFilterType::Linear }; diff --git a/src/mbgl/text/placement.cpp b/src/mbgl/text/placement.cpp index 130c2d050..99c7b7f16 100644 --- a/src/mbgl/text/placement.cpp +++ b/src/mbgl/text/placement.cpp @@ -101,7 +101,7 @@ void Placement::placeBucket( SymbolBucket& bucket, const BucketPlacementParameters& params, std::set& seenCrossTileIDs) { - const auto& layout = bucket.layout; + const auto& layout = *bucket.layout; const auto& renderTile = params.tile; const auto& state = collisionIndex.getTransformState(); const float pixelsToTileUnits = renderTile.id.pixelsToTileUnits(1, state.getZoom()); @@ -409,7 +409,7 @@ Point calculateVariableRenderShift(style::SymbolAnchorType anchor, float bool Placement::updateBucketDynamicVertices(SymbolBucket& bucket, const TransformState& state, const RenderTile& tile) { using namespace style; - const auto& layout = bucket.layout; + const auto& layout = *bucket.layout; const bool alongLine = layout.get() != SymbolPlacementType::Point; bool result = false; @@ -512,19 +512,19 @@ void Placement::updateBucketOpacities(SymbolBucket& bucket, const TransformState JointOpacityState duplicateOpacityState(false, false, true); - const bool textAllowOverlap = bucket.layout.get(); - const bool iconAllowOverlap = bucket.layout.get(); - const bool variablePlacement = !bucket.layout.get().empty(); - const bool rotateWithMap = bucket.layout.get() == style::AlignmentType::Map; - const bool pitchWithMap = bucket.layout.get() == style::AlignmentType::Map; + const bool textAllowOverlap = bucket.layout->get(); + const bool iconAllowOverlap = bucket.layout->get(); + const bool variablePlacement = !bucket.layout->get().empty(); + const bool rotateWithMap = bucket.layout->get() == style::AlignmentType::Map; + const bool pitchWithMap = bucket.layout->get() == style::AlignmentType::Map; // If allow-overlap is true, we can show symbols before placement runs on them // But we have to wait for placement if we potentially depend on a paired icon/text // with allow-overlap: false. // See https://github.com/mapbox/mapbox-gl-native/issues/12483 JointOpacityState defaultOpacityState( - textAllowOverlap && (iconAllowOverlap || !bucket.hasIconData() || bucket.layout.get()), - iconAllowOverlap && (textAllowOverlap || !bucket.hasTextData() || bucket.layout.get()), + textAllowOverlap && (iconAllowOverlap || !bucket.hasIconData() || bucket.layout->get()), + iconAllowOverlap && (textAllowOverlap || !bucket.hasTextData() || bucket.layout->get()), true); for (SymbolInstance& symbolInstance : bucket.symbolInstances) { diff --git a/test/gl/bucket.test.cpp b/test/gl/bucket.test.cpp index ff01b590f..9c9847cf4 100644 --- a/test/gl/bucket.test.cpp +++ b/test/gl/bucket.test.cpp @@ -114,7 +114,7 @@ TEST(Buckets, SymbolBucket) { gl::HeadlessBackend backend({ 512, 256 }); gfx::BackendScope scope { backend }; - style::SymbolLayoutProperties::PossiblyEvaluated layout; + auto layout = makeMutable(); bool sdfIcons = false; bool iconsNeedLinear = false; bool sortFeaturesByY = false; @@ -122,7 +122,7 @@ TEST(Buckets, SymbolBucket) { std::vector symbolInstances; gl::Context context{ backend }; - SymbolBucket bucket { layout, {}, 16.0f, 1.0f, 0, sdfIcons, iconsNeedLinear, sortFeaturesByY, bucketLeaderID, std::move(symbolInstances), 1.0f }; + SymbolBucket bucket { std::move(layout), {}, 16.0f, 1.0f, 0, sdfIcons, iconsNeedLinear, sortFeaturesByY, bucketLeaderID, std::move(symbolInstances), 1.0f }; ASSERT_FALSE(bucket.hasIconData()); ASSERT_FALSE(bucket.hasTextData()); ASSERT_FALSE(bucket.hasCollisionBoxData()); diff --git a/test/text/cross_tile_symbol_index.test.cpp b/test/text/cross_tile_symbol_index.test.cpp index f12178176..841f73c69 100644 --- a/test/text/cross_tile_symbol_index.test.cpp +++ b/test/text/cross_tile_symbol_index.test.cpp @@ -21,7 +21,8 @@ TEST(CrossTileSymbolLayerIndex, addBucket) { uint32_t maxBucketInstanceId = 0; CrossTileSymbolLayerIndex index; - style::SymbolLayoutProperties::PossiblyEvaluated layout; + Immutable layout = + makeMutable(); bool sdfIcons = false; bool iconsNeedLinear = false; bool sortFeaturesByY = false; @@ -95,7 +96,8 @@ TEST(CrossTileSymbolLayerIndex, resetIDs) { uint32_t maxBucketInstanceId = 0; CrossTileSymbolLayerIndex index; - style::SymbolLayoutProperties::PossiblyEvaluated layout; + Immutable layout = + makeMutable(); bool sdfIcons = false; bool iconsNeedLinear = false; bool sortFeaturesByY = false; @@ -135,7 +137,8 @@ TEST(CrossTileSymbolLayerIndex, noDuplicatesWithinZoomLevel) { uint32_t maxBucketInstanceId = 0; CrossTileSymbolLayerIndex index; - style::SymbolLayoutProperties::PossiblyEvaluated layout; + Immutable layout = + makeMutable(); bool sdfIcons = false; bool iconsNeedLinear = false; bool sortFeaturesByY = false; @@ -173,7 +176,8 @@ TEST(CrossTileSymbolLayerIndex, bucketReplacement) { uint32_t maxBucketInstanceId = 0; CrossTileSymbolLayerIndex index; - style::SymbolLayoutProperties::PossiblyEvaluated layout; + Immutable layout = + makeMutable(); bool sdfIcons = false; bool iconsNeedLinear = false; bool sortFeaturesByY = false;