From f3fc87261c2f2db71ac9d63b680417836885da13 Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Thu, 18 Feb 2016 17:09:26 +0200 Subject: [core] Coordinate is now GeometryCoordinate Also introduced GeometryCoordinates (vector of GeometryCoordinate items), to better cope with GeometryCollection. --- src/mbgl/annotation/point_annotation_impl.cpp | 2 +- src/mbgl/annotation/shape_annotation_impl.cpp | 2 +- src/mbgl/renderer/line_bucket.cpp | 20 ++++++++++---------- src/mbgl/renderer/line_bucket.hpp | 6 +++--- src/mbgl/renderer/symbol_bucket.cpp | 4 ++-- src/mbgl/renderer/symbol_bucket.hpp | 6 +++--- src/mbgl/text/check_max_angle.cpp | 9 ++++++--- src/mbgl/text/check_max_angle.hpp | 7 ++++--- src/mbgl/text/collision_feature.cpp | 12 ++++++------ src/mbgl/text/collision_feature.hpp | 10 ++++++---- src/mbgl/text/get_anchors.cpp | 8 ++++---- src/mbgl/text/get_anchors.hpp | 3 ++- src/mbgl/text/quads.cpp | 11 ++++++----- src/mbgl/text/quads.hpp | 5 +++-- src/mbgl/tile/geojson_tile.cpp | 2 +- src/mbgl/tile/geometry_tile.hpp | 5 ++++- src/mbgl/tile/vector_tile.cpp | 2 +- src/mbgl/util/clip_lines.cpp | 8 ++++---- src/mbgl/util/clip_lines.hpp | 2 +- src/mbgl/util/merge_lines.cpp | 10 +++++----- src/mbgl/util/merge_lines.hpp | 4 ++-- 21 files changed, 75 insertions(+), 63 deletions(-) (limited to 'src/mbgl') diff --git a/src/mbgl/annotation/point_annotation_impl.cpp b/src/mbgl/annotation/point_annotation_impl.cpp index 8e1aab2edf..2eef68a8eb 100644 --- a/src/mbgl/annotation/point_annotation_impl.cpp +++ b/src/mbgl/annotation/point_annotation_impl.cpp @@ -17,7 +17,7 @@ void PointAnnotationImpl::updateLayer(const TileID& tileID, AnnotationTileLayer& const uint32_t z2 = 1 << tileID.z; const uint32_t x = pp.x * z2; const uint32_t y = pp.y * z2; - const Coordinate coordinate(extent * (pp.x * z2 - x), extent * (pp.y * z2 - y)); + const GeometryCoordinate coordinate(extent * (pp.x * z2 - x), extent * (pp.y * z2 - y)); layer.features.emplace_back( std::make_shared(FeatureType::Point, diff --git a/src/mbgl/annotation/shape_annotation_impl.cpp b/src/mbgl/annotation/shape_annotation_impl.cpp index 418d3adaed..c8b31ef11f 100644 --- a/src/mbgl/annotation/shape_annotation_impl.cpp +++ b/src/mbgl/annotation/shape_annotation_impl.cpp @@ -133,7 +133,7 @@ void ShapeAnnotationImpl::updateTile(const TileID& tileID, AnnotationTile& tile) GeometryCollection renderGeometry; for (auto& shapeRing : shapeFeature.tileGeometry.get()) { - std::vector renderLine; + GeometryCoordinates renderLine; for (auto& shapePoint : shapeRing) { renderLine.emplace_back(shapePoint.x, shapePoint.y); diff --git a/src/mbgl/renderer/line_bucket.cpp b/src/mbgl/renderer/line_bucket.cpp index ba50e6b1f0..316085c0bb 100644 --- a/src/mbgl/renderer/line_bucket.cpp +++ b/src/mbgl/renderer/line_bucket.cpp @@ -41,7 +41,7 @@ void LineBucket::addGeometry(const GeometryCollection& geometryCollection) { const float COS_HALF_SHARP_CORNER = std::cos(75.0 / 2.0 * (M_PI / 180.0)); const float SHARP_CORNER_OFFSET = 15.0f; -void LineBucket::addGeometry(const std::vector& vertices) { +void LineBucket::addGeometry(const GeometryCoordinates& vertices) { const GLsizei len = [&vertices] { GLsizei l = static_cast(vertices.size()); // If the line has duplicate vertices at the end, adjust length to remove them. @@ -60,8 +60,8 @@ void LineBucket::addGeometry(const std::vector& vertices) { const double sharpCornerOffset = SHARP_CORNER_OFFSET * (util::EXTENT / (512.0 * overscaling)); - const Coordinate firstVertex = vertices.front(); - const Coordinate lastVertex = vertices[len - 1]; + const GeometryCoordinate firstVertex = vertices.front(); + const GeometryCoordinate lastVertex = vertices[len - 1]; const bool closed = firstVertex == lastVertex; if (len == 2 && closed) { @@ -75,8 +75,8 @@ void LineBucket::addGeometry(const std::vector& vertices) { int8_t flip = 1; double distance = 0; bool startOfLine = true; - Coordinate currentVertex = Coordinate::null(), prevVertex = Coordinate::null(), - nextVertex = Coordinate::null(); + GeometryCoordinate currentVertex = GeometryCoordinate::null(), prevVertex = GeometryCoordinate::null(), + nextVertex = GeometryCoordinate::null(); vec2 prevNormal = vec2::null(), nextNormal = vec2::null(); // the last three vertices added @@ -99,7 +99,7 @@ void LineBucket::addGeometry(const std::vector& vertices) { nextVertex = vertices[i + 1]; } else { // there is no next vertex - nextVertex = Coordinate::null(); + nextVertex = GeometryCoordinate::null(); } // if two consecutive vertices exist, skip the current one @@ -153,7 +153,7 @@ void LineBucket::addGeometry(const std::vector& vertices) { if (isSharpCorner && i > 0) { const double prevSegmentLength = util::dist(currentVertex, prevVertex); if (prevSegmentLength > 2.0 * sharpCornerOffset) { - Coordinate newPrevVertex = currentVertex - (util::round(vec2(currentVertex - prevVertex) * (sharpCornerOffset / prevSegmentLength))); + GeometryCoordinate newPrevVertex = currentVertex - (util::round(vec2(currentVertex - prevVertex) * (sharpCornerOffset / prevSegmentLength))); distance += util::dist(newPrevVertex, prevVertex); addCurrentVertex(newPrevVertex, flip, distance, prevNormal, 0, 0, false, startVertex, triangleStore); prevVertex = newPrevVertex; @@ -328,7 +328,7 @@ void LineBucket::addGeometry(const std::vector& vertices) { if (isSharpCorner && i < len - 1) { const double nextSegmentLength = util::dist(currentVertex, nextVertex); if (nextSegmentLength > 2 * sharpCornerOffset) { - Coordinate newCurrentVertex = currentVertex + util::round(vec2(nextVertex - currentVertex) * (sharpCornerOffset / nextSegmentLength)); + GeometryCoordinate newCurrentVertex = currentVertex + util::round(vec2(nextVertex - currentVertex) * (sharpCornerOffset / nextSegmentLength)); distance += util::dist(newCurrentVertex, currentVertex); addCurrentVertex(newCurrentVertex, flip, distance, nextNormal, 0, 0, false, startVertex, triangleStore); currentVertex = newCurrentVertex; @@ -361,7 +361,7 @@ void LineBucket::addGeometry(const std::vector& vertices) { } } -void LineBucket::addCurrentVertex(const Coordinate& currentVertex, +void LineBucket::addCurrentVertex(const GeometryCoordinate& currentVertex, float flip, double distance, const vec2& normal, @@ -395,7 +395,7 @@ void LineBucket::addCurrentVertex(const Coordinate& currentVertex, e2 = e3; } -void LineBucket::addPieSliceVertex(const Coordinate& currentVertex, +void LineBucket::addPieSliceVertex(const GeometryCoordinate& currentVertex, float flip, double distance, const vec2& extrude, diff --git a/src/mbgl/renderer/line_bucket.hpp b/src/mbgl/renderer/line_bucket.hpp index dd0ce4ff29..f02293c873 100644 --- a/src/mbgl/renderer/line_bucket.hpp +++ b/src/mbgl/renderer/line_bucket.hpp @@ -32,7 +32,7 @@ public: bool hasData() const override; void addGeometry(const GeometryCollection&); - void addGeometry(const std::vector& line); + void addGeometry(const GeometryCoordinates& line); void drawLines(LineShader&, gl::GLObjectStore&); void drawLineSDF(LineSDFShader&, gl::GLObjectStore&); @@ -43,10 +43,10 @@ private: TriangleElement(uint16_t a_, uint16_t b_, uint16_t c_) : a(a_), b(b_), c(c_) {} uint16_t a, b, c; }; - void addCurrentVertex(const Coordinate& currentVertex, float flip, double distance, + void addCurrentVertex(const GeometryCoordinate& currentVertex, float flip, double distance, const vec2& normal, float endLeft, float endRight, bool round, GLint startVertex, std::vector& triangleStore); - void addPieSliceVertex(const Coordinate& currentVertex, float flip, double distance, + void addPieSliceVertex(const GeometryCoordinate& currentVertex, float flip, double distance, const vec2& extrude, bool lineTurnsLeft, GLint startVertex, std::vector& triangleStore); diff --git a/src/mbgl/renderer/symbol_bucket.cpp b/src/mbgl/renderer/symbol_bucket.cpp index 67c1bf3150..252ebe4fd1 100644 --- a/src/mbgl/renderer/symbol_bucket.cpp +++ b/src/mbgl/renderer/symbol_bucket.cpp @@ -29,7 +29,7 @@ namespace mbgl { -SymbolInstance::SymbolInstance(Anchor& anchor, const std::vector& line, +SymbolInstance::SymbolInstance(Anchor& anchor, const GeometryCoordinates& line, const Shaping& shapedText, const PositionedIcon& shapedIcon, const SymbolLayoutProperties& layout, const bool addToBuffers, const uint32_t index_, const float textBoxScale, const float textPadding, const float textAlongLine, @@ -271,7 +271,7 @@ void SymbolBucket::addFeatures(uintptr_t tileUID, } -void SymbolBucket::addFeature(const std::vector> &lines, +void SymbolBucket::addFeature(const GeometryCollection &lines, const Shaping &shapedText, const PositionedIcon &shapedIcon, const GlyphPositions &face) { const float minScale = 0.5f; diff --git a/src/mbgl/renderer/symbol_bucket.hpp b/src/mbgl/renderer/symbol_bucket.hpp index cebb7e5dbe..0b1e4e5cf3 100644 --- a/src/mbgl/renderer/symbol_bucket.hpp +++ b/src/mbgl/renderer/symbol_bucket.hpp @@ -35,7 +35,7 @@ class GlyphStore; class SymbolFeature { public: - std::vector> geometry; + GeometryCollection geometry; std::u32string label; std::string sprite; }; @@ -44,7 +44,7 @@ struct Anchor; class SymbolInstance { public: - explicit SymbolInstance(Anchor& anchor, const std::vector& line, + explicit SymbolInstance(Anchor& anchor, const GeometryCoordinates& line, const Shaping& shapedText, const PositionedIcon& shapedIcon, const SymbolLayoutProperties& layout, const bool inside, const uint32_t index, const float textBoxScale, const float textPadding, const float textAlongLine, @@ -93,7 +93,7 @@ public: void placeFeatures(CollisionTile&) override; private: - void addFeature(const std::vector> &lines, + void addFeature(const GeometryCollection &lines, const Shaping &shapedText, const PositionedIcon &shapedIcon, const GlyphPositions &face); bool anchorIsTooClose(const std::u32string &text, const float repeatDistance, Anchor &anchor); diff --git a/src/mbgl/text/check_max_angle.cpp b/src/mbgl/text/check_max_angle.cpp index bb32e4235e..4777f66a23 100644 --- a/src/mbgl/text/check_max_angle.cpp +++ b/src/mbgl/text/check_max_angle.cpp @@ -1,4 +1,7 @@ #include +#include +#include + #include namespace mbgl{ @@ -10,14 +13,14 @@ struct Corner { float angleDelta; }; -bool checkMaxAngle(const std::vector &line, Anchor &anchor, const float labelLength, +bool checkMaxAngle(const GeometryCoordinates &line, Anchor &anchor, const float labelLength, const float windowSize, const float maxAngle) { // horizontal labels always pass if (anchor.segment < 0) return true; - Coordinate anchorPoint = Coordinate{ (int16_t)anchor.x, (int16_t)anchor.y }; - Coordinate &p = anchorPoint; + GeometryCoordinate anchorPoint = { (int16_t)anchor.x, (int16_t)anchor.y }; + GeometryCoordinate &p = anchorPoint; int index = anchor.segment + 1; float anchorDistance = 0; diff --git a/src/mbgl/text/check_max_angle.hpp b/src/mbgl/text/check_max_angle.hpp index 1354abe95e..0fb8a715a9 100644 --- a/src/mbgl/text/check_max_angle.hpp +++ b/src/mbgl/text/check_max_angle.hpp @@ -1,12 +1,13 @@ #ifndef MBGL_TEXT_CHECK_MAX_ANGLE #define MBGL_TEXT_CHECK_MAX_ANGLE -#include -#include +#include namespace mbgl { -bool checkMaxAngle(const std::vector &line, Anchor &anchor, const float labelLength, +struct Anchor; + +bool checkMaxAngle(const GeometryCoordinates &line, Anchor &anchor, const float labelLength, const float windowSize, const float maxAngle); } // namespace mbgl diff --git a/src/mbgl/text/collision_feature.cpp b/src/mbgl/text/collision_feature.cpp index 186fb39b5d..42f1119b33 100644 --- a/src/mbgl/text/collision_feature.cpp +++ b/src/mbgl/text/collision_feature.cpp @@ -3,7 +3,7 @@ namespace mbgl { -CollisionFeature::CollisionFeature(const std::vector &line, const Anchor &anchor, +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, const bool straight) { @@ -22,12 +22,12 @@ CollisionFeature::CollisionFeature(const std::vector &line, const An height = std::max(10.0f * boxScale, height); - Coordinate anchorPoint(int16_t(anchor.x), int16_t(anchor.y)); + GeometryCoordinate anchorPoint(int16_t(anchor.x), int16_t(anchor.y)); if (straight) { // used for icon labels that are aligned with the line, but don't curve along it const vec2 vector = util::unit(vec2(line[anchor.segment + 1] - line[anchor.segment])) * length; - const std::vector newLine({ anchorPoint - vector, anchorPoint + vector }); + const GeometryCoordinates newLine({ anchorPoint - vector, anchorPoint + vector }); bboxifyLabel(newLine, anchorPoint, 0, length, height); } else { // used for text labels that curve along a line @@ -38,8 +38,8 @@ CollisionFeature::CollisionFeature(const std::vector &line, const An } } -void CollisionFeature::bboxifyLabel(const std::vector &line, - Coordinate &anchorPoint, const int segment, const float labelLength, const float boxSize) { +void CollisionFeature::bboxifyLabel(const GeometryCoordinates &line, + GeometryCoordinate &anchorPoint, const int segment, const float labelLength, const float boxSize) { const float step = boxSize / 2; const unsigned int nBoxes = std::floor(labelLength / step); @@ -48,7 +48,7 @@ void CollisionFeature::bboxifyLabel(const std::vector &line, // box is at the edge of the label. const float firstBoxOffset = -boxSize / 2; - Coordinate &p = anchorPoint; + GeometryCoordinate &p = anchorPoint; int index = segment + 1; float anchorDistance = firstBoxOffset; diff --git a/src/mbgl/text/collision_feature.hpp b/src/mbgl/text/collision_feature.hpp index a9d227de1b..fcfb8e9ae9 100644 --- a/src/mbgl/text/collision_feature.hpp +++ b/src/mbgl/text/collision_feature.hpp @@ -4,6 +4,8 @@ #include #include #include +#include + #include namespace mbgl { @@ -32,7 +34,7 @@ namespace mbgl { class CollisionFeature { public: // for text - inline explicit CollisionFeature(const std::vector &line, const Anchor &anchor, + inline explicit CollisionFeature(const GeometryCoordinates &line, const Anchor &anchor, const Shaping &shapedText, const float boxScale, const float padding, const bool alongLine) : CollisionFeature(line, anchor, @@ -40,14 +42,14 @@ namespace mbgl { boxScale, padding, alongLine, false) {} // for icons - inline explicit CollisionFeature(const std::vector &line, const Anchor &anchor, + inline explicit CollisionFeature(const GeometryCoordinates &line, const Anchor &anchor, const PositionedIcon &shapedIcon, const float boxScale, const float padding, const bool alongLine) : CollisionFeature(line, anchor, shapedIcon.top, shapedIcon.bottom, shapedIcon.left, shapedIcon.right, boxScale, padding, alongLine, true) {} - explicit CollisionFeature(const std::vector &line, const Anchor &anchor, + 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 bool straight); @@ -55,7 +57,7 @@ namespace mbgl { std::vector boxes; private: - void bboxifyLabel(const std::vector &line, Coordinate &anchorPoint, const int segment, const float length, const float height); + void bboxifyLabel(const GeometryCoordinates &line, GeometryCoordinate &anchorPoint, const int segment, const float length, const float height); }; } // namespace mbgl diff --git a/src/mbgl/text/get_anchors.cpp b/src/mbgl/text/get_anchors.cpp index 7a129d692c..740ec288b3 100644 --- a/src/mbgl/text/get_anchors.cpp +++ b/src/mbgl/text/get_anchors.cpp @@ -7,7 +7,7 @@ namespace mbgl { -Anchors resample(const std::vector &line, const float offset, const float spacing, +Anchors resample(const GeometryCoordinates &line, const float offset, const float spacing, const float angleWindowSize, const float maxAngle, const float labelLength, const bool continuedLine, const bool placeAtMiddle) { const float halfLabelLength = labelLength / 2.0f; @@ -23,8 +23,8 @@ Anchors resample(const std::vector &line, const float offset, const int i = 0; for (auto it = line.begin(), end = line.end() - 1; it != end; it++, i++) { - const Coordinate &a = *(it); - const Coordinate &b = *(it + 1); + const GeometryCoordinate &a = *(it); + const GeometryCoordinate &b = *(it + 1); const float segmentDist = util::dist(a, b); const float angle = util::angle_to(b, a); @@ -65,7 +65,7 @@ Anchors resample(const std::vector &line, const float offset, const return anchors; } -Anchors getAnchors(const std::vector &line, float spacing, +Anchors getAnchors(const GeometryCoordinates &line, float spacing, const float maxAngle, const float textLeft, const float textRight, const float iconLeft, const float iconRight, const float glyphSize, const float boxScale, const float overscaling) { diff --git a/src/mbgl/text/get_anchors.hpp b/src/mbgl/text/get_anchors.hpp index fcb0578d5b..1f76685f9a 100644 --- a/src/mbgl/text/get_anchors.hpp +++ b/src/mbgl/text/get_anchors.hpp @@ -2,11 +2,12 @@ #define MBGL_TEXT_GETANCHORS #include +#include #include namespace mbgl { -Anchors getAnchors(const std::vector &line, float spacing, +Anchors getAnchors(const GeometryCoordinates &line, float spacing, const float maxAngle, const float textLeft, const float textRight, const float iconLeft, const float iconRight, const float glyphSize, const float boxScale, const float overscaling); diff --git a/src/mbgl/text/quads.cpp b/src/mbgl/text/quads.cpp index 1950f41fc7..2117538232 100644 --- a/src/mbgl/text/quads.cpp +++ b/src/mbgl/text/quads.cpp @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -11,7 +12,7 @@ namespace mbgl { const float globalMinScale = 0.5f; // underscale by 1 zoom level SymbolQuads getIconQuads(Anchor& anchor, const PositionedIcon& shapedIcon, - const std::vector& line, const SymbolLayoutProperties& layout, + const GeometryCoordinates& line, const SymbolLayoutProperties& layout, const bool alongLine) { auto image = *(shapedIcon.image); @@ -30,10 +31,10 @@ SymbolQuads getIconQuads(Anchor& anchor, const PositionedIcon& shapedIcon, float angle = layout.icon.rotate * util::DEG2RAD; if (alongLine) { assert(static_cast(anchor.segment) < line.size()); - const Coordinate &prev= line[anchor.segment]; + const GeometryCoordinate &prev= line[anchor.segment]; if (anchor.y == prev.y && anchor.x == prev.x && static_cast(anchor.segment + 1) < line.size()) { - const Coordinate &next= line[anchor.segment + 1]; + const GeometryCoordinate &next= line[anchor.segment + 1]; angle += std::atan2(anchor.y - next.y, anchor.x - next.x) + M_PI; } else { angle += std::atan2(anchor.y - prev.y, anchor.x - prev.x); @@ -74,7 +75,7 @@ struct GlyphInstance { typedef std::vector GlyphInstances; void getSegmentGlyphs(std::back_insert_iterator glyphs, Anchor &anchor, - float offset, const std::vector &line, int segment, bool forward) { + float offset, const GeometryCoordinates &line, int segment, bool forward) { const bool upsideDown = !forward; @@ -132,7 +133,7 @@ void getSegmentGlyphs(std::back_insert_iterator glyphs, Anchor & } SymbolQuads getGlyphQuads(Anchor& anchor, const Shaping& shapedText, - const float boxScale, const std::vector& line, const SymbolLayoutProperties& layout, + const float boxScale, const GeometryCoordinates& line, const SymbolLayoutProperties& layout, const bool alongLine, const GlyphPositions& face) { const float textRotate = layout.text.rotate * util::DEG2RAD; diff --git a/src/mbgl/text/quads.hpp b/src/mbgl/text/quads.hpp index cdf7c23627..12b8893503 100644 --- a/src/mbgl/text/quads.hpp +++ b/src/mbgl/text/quads.hpp @@ -2,6 +2,7 @@ #define MBGL_TEXT_QUADS #include +#include #include #include @@ -37,11 +38,11 @@ namespace mbgl { class PositionedIcon; SymbolQuads getIconQuads(Anchor& anchor, const PositionedIcon& shapedIcon, - const std::vector& line, const SymbolLayoutProperties& layout, + const GeometryCoordinates& line, const SymbolLayoutProperties& layout, const bool alongLine); SymbolQuads getGlyphQuads(Anchor& anchor, const Shaping& shapedText, - const float boxScale, const std::vector& line, const SymbolLayoutProperties& layout, + const float boxScale, const GeometryCoordinates& line, const SymbolLayoutProperties& layout, const bool alongLine, const GlyphPositions& face); } // namespace mbgl diff --git a/src/mbgl/tile/geojson_tile.cpp b/src/mbgl/tile/geojson_tile.cpp index d8eabf00a2..fceae19619 100644 --- a/src/mbgl/tile/geojson_tile.cpp +++ b/src/mbgl/tile/geojson_tile.cpp @@ -51,7 +51,7 @@ std::unique_ptr convertTile(const mapbox::geojsonvt::Tile& tile) { if (tile) { std::vector> features; - std::vector line; + GeometryCoordinates line; for (auto& feature : tile.features) { const FeatureType featureType = diff --git a/src/mbgl/tile/geometry_tile.hpp b/src/mbgl/tile/geometry_tile.hpp index 5cb2f96fdc..13333dab53 100644 --- a/src/mbgl/tile/geometry_tile.hpp +++ b/src/mbgl/tile/geometry_tile.hpp @@ -24,7 +24,10 @@ enum class FeatureType : uint8_t { Polygon = 3 }; -typedef std::vector> GeometryCollection; +// Normalized vector tile coordinates. +using GeometryCoordinate = vec2; +using GeometryCoordinates = std::vector; +using GeometryCollection = std::vector; class GeometryTileFeature : private util::noncopyable { public: diff --git a/src/mbgl/tile/vector_tile.cpp b/src/mbgl/tile/vector_tile.cpp index 9e35debbff..8b58ade169 100644 --- a/src/mbgl/tile/vector_tile.cpp +++ b/src/mbgl/tile/vector_tile.cpp @@ -94,7 +94,7 @@ GeometryCollection VectorTileFeature::getGeometries() const { GeometryCollection lines; lines.emplace_back(); - std::vector* line = &lines.back(); + GeometryCoordinates* line = &lines.back(); while (data.data < data.end) { if (length == 0) { diff --git a/src/mbgl/util/clip_lines.cpp b/src/mbgl/util/clip_lines.cpp index 071e9d09bd..41965876cb 100644 --- a/src/mbgl/util/clip_lines.cpp +++ b/src/mbgl/util/clip_lines.cpp @@ -3,10 +3,10 @@ namespace mbgl { namespace util { -std::vector> clipLines(const std::vector> &lines, +GeometryCollection clipLines(const GeometryCollection &lines, const int16_t x1, const int16_t y1, const int16_t x2, const int16_t y2) { - std::vector> clippedLines; + GeometryCollection clippedLines; for (auto& line : lines) { @@ -15,8 +15,8 @@ std::vector> clipLines(const std::vector> clipLines(const std::vector> &lines, +GeometryCollection clipLines(const GeometryCollection &lines, const int16_t x1, const int16_t y1, const int16_t x2, const int16_t y2); } // end namespace util diff --git a/src/mbgl/util/merge_lines.cpp b/src/mbgl/util/merge_lines.cpp index 4ff1caaf76..ee930c113e 100644 --- a/src/mbgl/util/merge_lines.cpp +++ b/src/mbgl/util/merge_lines.cpp @@ -11,7 +11,7 @@ unsigned int mergeFromRight(std::vector &features, Index &rightIndex, Index::iterator left, size_t rightKey, - std::vector> &geom) { + GeometryCollection &geom) { unsigned int index = left->second; rightIndex.erase(left); @@ -27,7 +27,7 @@ unsigned int mergeFromLeft(std::vector &features, Index &leftIndex, size_t leftKey, Index::iterator right, - std::vector> &geom) { + GeometryCollection &geom) { unsigned int index = right->second; leftIndex.erase(right); @@ -41,8 +41,8 @@ unsigned int mergeFromLeft(std::vector &features, } size_t -getKey(const std::u32string& text, const std::vector>& geom, bool onRight) { - const Coordinate& coord = onRight ? geom[0].back() : geom[0].front(); +getKey(const std::u32string& text, const GeometryCollection& geom, bool onRight) { + const GeometryCoordinate& coord = onRight ? geom[0].back() : geom[0].front(); auto hash = std::hash()(text); boost::hash_combine(hash, coord.x); @@ -57,7 +57,7 @@ void mergeLines(std::vector &features) { for (unsigned int k = 0; k < features.size(); k++) { SymbolFeature &feature = features[k]; - std::vector> &geometry = feature.geometry; + GeometryCollection &geometry = feature.geometry; if (!feature.label.length()) { continue; diff --git a/src/mbgl/util/merge_lines.hpp b/src/mbgl/util/merge_lines.hpp index 4460a0bcea..55ad79036e 100644 --- a/src/mbgl/util/merge_lines.hpp +++ b/src/mbgl/util/merge_lines.hpp @@ -13,13 +13,13 @@ unsigned int mergeFromRight(std::vector &features, std::map &rightIndex, std::map::iterator left, std::string &rightKey, - std::vector> &geom); + GeometryCollection &geom); unsigned int mergeFromLeft(std::vector &features, std::map &leftIndex, std::string &leftKey, std::map::iterator right, - std::vector> &geom); + GeometryCollection &geom); void mergeLines(std::vector &features); -- cgit v1.2.1