diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2016-09-06 16:11:29 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2016-09-07 17:56:38 +0200 |
commit | f3191dbbb48f6700419f193ff68cf86a50336190 (patch) | |
tree | c1b0bf865ccd74cc0c17a1ba165938c348bb688c /src/mbgl/text | |
parent | 1845919c25e5ff8845183e1d3e1eeed0b2f09e0c (diff) | |
download | qtlocation-mapboxgl-f3191dbbb48f6700419f193ff68cf86a50336190.tar.gz |
[core] change bool *AlongLine to SymbolPlacementType
Diffstat (limited to 'src/mbgl/text')
-rw-r--r-- | src/mbgl/text/collision_feature.cpp | 4 | ||||
-rw-r--r-- | src/mbgl/text/collision_feature.hpp | 10 | ||||
-rw-r--r-- | src/mbgl/text/quads.cpp | 8 | ||||
-rw-r--r-- | src/mbgl/text/quads.hpp | 5 |
4 files changed, 14 insertions, 13 deletions
diff --git a/src/mbgl/text/collision_feature.cpp b/src/mbgl/text/collision_feature.cpp index 74a41099ff..661c44891f 100644 --- a/src/mbgl/text/collision_feature.cpp +++ b/src/mbgl/text/collision_feature.cpp @@ -5,7 +5,7 @@ namespace mbgl { CollisionFeature::CollisionFeature(const GeometryCoordinates &line, const Anchor &anchor, const float top, const float bottom, const float left, const float right, - const float boxScale, const float padding, const bool alongLine, IndexedSubfeature indexedFeature_, + const float boxScale, const float padding, const style::SymbolPlacementType placement, IndexedSubfeature indexedFeature_, const bool straight) : indexedFeature(std::move(indexedFeature_)) { @@ -16,7 +16,7 @@ CollisionFeature::CollisionFeature(const GeometryCoordinates &line, const Anchor const float x1 = left * boxScale - padding; const float x2 = right * boxScale + padding; - if (alongLine) { + if (placement == style::SymbolPlacementType::Line) { float height = y2 - y1; const double length = x2 - x1; diff --git a/src/mbgl/text/collision_feature.hpp b/src/mbgl/text/collision_feature.hpp index 5c0095bc6d..12c14fe0c1 100644 --- a/src/mbgl/text/collision_feature.hpp +++ b/src/mbgl/text/collision_feature.hpp @@ -35,22 +35,22 @@ namespace mbgl { // for text explicit CollisionFeature(const GeometryCoordinates &line, const Anchor &anchor, const Shaping &shapedText, - const float boxScale, const float padding, const bool alongLine, const IndexedSubfeature& indexedFeature_) + const float boxScale, const float padding, const style::SymbolPlacementType placement, const IndexedSubfeature& indexedFeature_) : CollisionFeature(line, anchor, shapedText.top, shapedText.bottom, shapedText.left, shapedText.right, - boxScale, padding, alongLine, indexedFeature_, false) {} + boxScale, padding, placement, indexedFeature_, false) {} // for icons explicit CollisionFeature(const GeometryCoordinates &line, const Anchor &anchor, const PositionedIcon &shapedIcon, - const float boxScale, const float padding, const bool alongLine, const IndexedSubfeature& indexedFeature_) + const float boxScale, const float padding, const style::SymbolPlacementType placement, const IndexedSubfeature& indexedFeature_) : CollisionFeature(line, anchor, shapedIcon.top, shapedIcon.bottom, shapedIcon.left, shapedIcon.right, - boxScale, padding, alongLine, indexedFeature_, true) {} + boxScale, padding, placement, indexedFeature_, true) {} explicit CollisionFeature(const GeometryCoordinates &line, const Anchor &anchor, const float top, const float bottom, const float left, const float right, - const float boxScale, const float padding, const bool alongLine, + const float boxScale, const float padding, const style::SymbolPlacementType placement, IndexedSubfeature, const bool straight); diff --git a/src/mbgl/text/quads.cpp b/src/mbgl/text/quads.cpp index 727b86f610..3f142cd908 100644 --- a/src/mbgl/text/quads.cpp +++ b/src/mbgl/text/quads.cpp @@ -15,7 +15,7 @@ const float globalMinScale = 0.5f; // underscale by 1 zoom level SymbolQuads getIconQuads(Anchor& anchor, const PositionedIcon& shapedIcon, const GeometryCoordinates& line, const SymbolLayoutProperties& layout, - const bool alongLine, const Shaping& shapedText) { + const style::SymbolPlacementType placement, const Shaping& shapedText) { auto image = *(shapedIcon.image); @@ -63,7 +63,7 @@ SymbolQuads getIconQuads(Anchor& anchor, const PositionedIcon& shapedIcon, } float angle = layout.iconRotate * util::DEG2RAD; - if (alongLine) { + if (placement == style::SymbolPlacementType::Line) { assert(static_cast<unsigned int>(anchor.segment) < line.size()); const GeometryCoordinate &prev= line[anchor.segment]; if (anchor.point.y == prev.y && anchor.point.x == prev.x && @@ -166,7 +166,7 @@ void getSegmentGlyphs(std::back_insert_iterator<GlyphInstances> glyphs, Anchor & SymbolQuads getGlyphQuads(Anchor& anchor, const Shaping& shapedText, const float boxScale, const GeometryCoordinates& line, const SymbolLayoutProperties& layout, - const bool alongLine, const GlyphPositions& face) { + const style::SymbolPlacementType placement, const GlyphPositions& face) { const float textRotate = layout.textRotate * util::DEG2RAD; const bool keepUpright = layout.textKeepUpright; @@ -189,7 +189,7 @@ SymbolQuads getGlyphQuads(Anchor& anchor, const Shaping& shapedText, const float centerX = (positionedGlyph.x + glyph.metrics.advance / 2.0f) * boxScale; GlyphInstances glyphInstances; - if (alongLine) { + if (placement == style::SymbolPlacementType::Line) { getSegmentGlyphs(std::back_inserter(glyphInstances), anchor, centerX, line, anchor.segment, true); if (keepUpright) getSegmentGlyphs(std::back_inserter(glyphInstances), anchor, centerX, line, anchor.segment, false); diff --git a/src/mbgl/text/quads.hpp b/src/mbgl/text/quads.hpp index dd64af682a..d4edbf9493 100644 --- a/src/mbgl/text/quads.hpp +++ b/src/mbgl/text/quads.hpp @@ -1,6 +1,7 @@ #pragma once #include <mbgl/text/glyph.hpp> +#include <mbgl/style/types.hpp> #include <mbgl/tile/geometry_tile_data.hpp> #include <vector> @@ -40,10 +41,10 @@ typedef std::vector<SymbolQuad> SymbolQuads; SymbolQuads getIconQuads(Anchor& anchor, const PositionedIcon& shapedIcon, const GeometryCoordinates& line, const style::SymbolLayoutProperties&, - const bool alongLine, const Shaping& shapedText); + style::SymbolPlacementType placement, const Shaping& shapedText); SymbolQuads getGlyphQuads(Anchor& anchor, const Shaping& shapedText, const float boxScale, const GeometryCoordinates& line, const style::SymbolLayoutProperties&, - const bool alongLine, const GlyphPositions& face); + style::SymbolPlacementType placement, const GlyphPositions& face); } // namespace mbgl |