diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2014-03-18 17:57:51 +0100 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2014-03-18 17:57:51 +0100 |
commit | 98bb797a4adf52993835f016f577ac7de5d56dce (patch) | |
tree | e5b59390f1708ffcb4b3846beea5c7e8a914a038 | |
parent | 25ff0b253f99f401e79ad7e009fd09cd8b5a4314 (diff) | |
download | qtlocation-mapboxgl-98bb797a4adf52993835f016f577ac7de5d56dce.tar.gz |
explicit names
-rw-r--r-- | include/llmr/geometry/anchor.hpp | 4 | ||||
-rw-r--r-- | include/llmr/text/collision.hpp | 13 | ||||
-rw-r--r-- | src/text/collision.cpp | 13 |
3 files changed, 16 insertions, 14 deletions
diff --git a/include/llmr/geometry/anchor.hpp b/include/llmr/geometry/anchor.hpp index 879213ab05..dd97c507f2 100644 --- a/include/llmr/geometry/anchor.hpp +++ b/include/llmr/geometry/anchor.hpp @@ -12,9 +12,9 @@ struct Anchor { float scale = 0.0f; int segment = -1; - Anchor(float x, float y, float angle, float scale) + explicit Anchor(float x, float y, float angle, float scale) : x(x), y(y), angle(angle), scale(scale) {} - Anchor(float x, float y, float angle, float scale, int segment) + explicit Anchor(float x, float y, float angle, float scale, int segment) : x(x), y(y), angle(angle), scale(scale), segment(segment) {} }; diff --git a/include/llmr/text/collision.hpp b/include/llmr/text/collision.hpp index 02369b3f9d..941f64ff73 100644 --- a/include/llmr/text/collision.hpp +++ b/include/llmr/text/collision.hpp @@ -39,9 +39,9 @@ struct PlacementBox { float padding = 0.0f; }; -struct Placement { - explicit Placement() {} - explicit Placement(float zoom, const PlacementRange &rotationRange) +struct PlacementProperty { + explicit PlacementProperty() {} + explicit PlacementProperty(float zoom, const PlacementRange &rotationRange) : zoom(zoom), rotationRange(rotationRange) {} float zoom = -1.0f; @@ -59,9 +59,10 @@ class Collision { public: Collision(); - Placement place(const GlyphBoxes &boxes, const CollisionAnchor &anchor, - float minPlacementScale, float maxPlacementScale, - float padding, bool horizontal); + PlacementProperty place(const GlyphBoxes &boxes, + const CollisionAnchor &anchor, + float minPlacementScale, float maxPlacementScale, + float padding, bool horizontal); float getPlacementScale(const GlyphBoxes &glyphs, float minPlacementScale, float maxPlacementScale, float pad); PlacementRange getPlacementRange(const GlyphBoxes &glyphs, diff --git a/src/text/collision.cpp b/src/text/collision.cpp index 37f065b4b2..1d08b53a2a 100644 --- a/src/text/collision.cpp +++ b/src/text/collision.cpp @@ -50,10 +50,11 @@ GlyphBox getMergedGlyphs(const GlyphBoxes &glyphs, bool horizontal, return mergedGlyphs; } -Placement Collision::place(const GlyphBoxes &boxes, - const CollisionAnchor &anchor, - float minPlacementScale, float maxPlacementScale, - float padding, bool horizontal) { +PlacementProperty Collision::place(const GlyphBoxes &boxes, + const CollisionAnchor &anchor, + float minPlacementScale, + float maxPlacementScale, float padding, + bool horizontal) { float minScale = std::numeric_limits<float>::infinity(); for (const GlyphBox &box : boxes) { @@ -93,7 +94,7 @@ Placement Collision::place(const GlyphBoxes &boxes, // Return if the label can never be placed without collision if (scale < 0) { - return Placement{}; + return PlacementProperty{}; } // Calculate the range it is safe to rotate all glyphs @@ -102,7 +103,7 @@ Placement Collision::place(const GlyphBoxes &boxes, float zoom = log(scale) / log(2); - return Placement{zoom, rotationRange}; + return PlacementProperty{zoom, rotationRange}; } float Collision::getPlacementScale(const GlyphBoxes &glyphs, |