summaryrefslogtreecommitdiff
path: root/src/mbgl/text/get_anchors.cpp
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2016-07-01 11:51:54 +0200
committerKonstantin Käfer <mail@kkaefer.com>2016-07-01 12:38:33 +0200
commit77e784675687d13439a8104c97c5bb0a9ccd8b01 (patch)
treeac5fe39c7c1d0db0923fec2b00b56291ef0f548e /src/mbgl/text/get_anchors.cpp
parentda863c6e52f656bd35c3d3346093a24d747d0bbd (diff)
downloadqtlocation-mapboxgl-77e784675687d13439a8104c97c5bb0a9ccd8b01.tar.gz
[core] code style cleanups
- puts function definitions in a namespace ... {} rather than using namespace ...; - remove trailing whitespace - add trailing newline - protect SQL statements from being formatted by clang-format
Diffstat (limited to 'src/mbgl/text/get_anchors.cpp')
-rw-r--r--src/mbgl/text/get_anchors.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/mbgl/text/get_anchors.cpp b/src/mbgl/text/get_anchors.cpp
index c55f238e52..ce45e05d9c 100644
--- a/src/mbgl/text/get_anchors.cpp
+++ b/src/mbgl/text/get_anchors.cpp
@@ -80,25 +80,25 @@ Anchors getAnchors(const GeometryCoordinates &line, float spacing,
const float angleWindowSize = (textLeft - textRight) != 0.0f ?
3.0f / 5.0f * glyphSize * boxScale :
0;
-
+
const float labelLength = fmax(textRight - textLeft, iconRight - iconLeft);
-
+
// Is the line continued from outside the tile boundary?
const bool continuedLine = (line[0].x == 0 || line[0].x == util::EXTENT || line[0].y == 0 || line[0].y == util::EXTENT);
-
+
// Is the label long, relative to the spacing?
// If so, adjust the spacing so there is always a minimum space of `spacing / 4` between label edges.
if (spacing - labelLength * boxScale < spacing / 4) {
spacing = labelLength * boxScale + spacing / 4;
}
-
+
// Offset the first anchor by:
// Either half the label length plus a fixed extra offset if the line is not continued
// Or half the spacing if the line is continued.
// For non-continued lines, add a bit of fixed extra offset to avoid collisions at T intersections.
const float fixedExtraOffset = glyphSize * 2;
-
+
const float offset = !continuedLine ?
std::fmod((labelLength / 2 + fixedExtraOffset) * boxScale * overscaling, spacing) :
std::fmod(spacing / 2 * overscaling, spacing);