diff options
Diffstat (limited to 'src/mbgl/text/get_anchors.cpp')
-rw-r--r-- | src/mbgl/text/get_anchors.cpp | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/src/mbgl/text/get_anchors.cpp b/src/mbgl/text/get_anchors.cpp index b912c7763e..82702b20f0 100644 --- a/src/mbgl/text/get_anchors.cpp +++ b/src/mbgl/text/get_anchors.cpp @@ -8,9 +8,14 @@ namespace mbgl { -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) { - +static 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; float lineLength = 0; for (auto it = line.begin(), end = line.end() - 1; it != end; it++) { @@ -26,8 +31,8 @@ Anchors resample(const GeometryCoordinates &line, const float offset, const floa int i = 0; for (auto it = line.begin(), end = line.end() - 1; it != end; it++, i++) { - const GeometryCoordinate &a = *(it); - const GeometryCoordinate &b = *(it + 1); + const GeometryCoordinate& a = *(it); + const GeometryCoordinate& b = *(it + 1); const float segmentDist = util::dist<float>(a, b); const float angle = util::angle_to(b, a); @@ -68,11 +73,19 @@ Anchors resample(const GeometryCoordinates &line, const float offset, const floa return anchors; } -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) { - if (line.empty()) return {}; +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) { + if (line.empty()) { + return {}; + } // Resample a line to get anchor points for labels and check that each // potential label passes text-max-angle check and has enough froom to fit |