From 2ea450205d8b89db28f7160365b73d26bf4b8812 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Tue, 19 Apr 2016 10:16:21 -0700 Subject: [PATCH] =?UTF-8?q?[core]=20PlacementType=20=E2=87=A2=20SymbolPlac?= =?UTF-8?q?ementType?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/mbgl/style/types.hpp | 8 ++++---- src/mbgl/layer/symbol_layer.cpp | 2 +- src/mbgl/layer/symbol_layer.hpp | 2 +- src/mbgl/renderer/symbol_bucket.cpp | 16 ++++++++-------- src/mbgl/style/function.cpp | 4 ++-- src/mbgl/style/property_parsing.cpp | 8 ++++---- src/mbgl/util/interpolate.hpp | 2 +- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/include/mbgl/style/types.hpp b/include/mbgl/style/types.hpp index 56821c32b..999b8d8b7 100644 --- a/include/mbgl/style/types.hpp +++ b/include/mbgl/style/types.hpp @@ -113,14 +113,14 @@ MBGL_DEFINE_ENUM_CLASS(RotateAnchorTypeClass, RotateAnchorType, { // ------------------------------------------------------------------------------------------------- -enum class PlacementType : bool { +enum class SymbolPlacementType : bool { Point, Line, }; -MBGL_DEFINE_ENUM_CLASS(PlacementTypeClass, PlacementType, { - { PlacementType::Point, "point" }, - { PlacementType::Line, "line" }, +MBGL_DEFINE_ENUM_CLASS(SymbolPlacementTypeClass, SymbolPlacementType, { + { SymbolPlacementType::Point, "point" }, + { SymbolPlacementType::Line, "line" }, }); // ------------------------------------------------------------------------------------------------- diff --git a/src/mbgl/layer/symbol_layer.cpp b/src/mbgl/layer/symbol_layer.cpp index d590406cd..477d28b6e 100644 --- a/src/mbgl/layer/symbol_layer.cpp +++ b/src/mbgl/layer/symbol_layer.cpp @@ -121,7 +121,7 @@ std::unique_ptr SymbolLayer::createBucket(StyleBucketParameters& paramet StyleCalculationParameters p(parameters.tileID.z); bucket->layout.placement.calculate(p); - if (bucket->layout.placement.value == PlacementType::Line) { + if (bucket->layout.placement.value == SymbolPlacementType::Line) { bucket->layout.icon.rotationAlignment.value = RotationAlignmentType::Map; bucket->layout.text.rotationAlignment.value = RotationAlignmentType::Map; }; diff --git a/src/mbgl/layer/symbol_layer.hpp b/src/mbgl/layer/symbol_layer.hpp index a2b3b0acf..75759e2a1 100644 --- a/src/mbgl/layer/symbol_layer.hpp +++ b/src/mbgl/layer/symbol_layer.hpp @@ -11,7 +11,7 @@ class SpriteAtlas; class SymbolLayoutProperties { public: - LayoutProperty placement { PlacementType::Point }; + LayoutProperty placement { SymbolPlacementType::Point }; LayoutProperty spacing { 250.0f }; LayoutProperty avoidEdges { false }; diff --git a/src/mbgl/renderer/symbol_bucket.cpp b/src/mbgl/renderer/symbol_bucket.cpp index e18910449..1bc38fe06 100644 --- a/src/mbgl/renderer/symbol_bucket.cpp +++ b/src/mbgl/renderer/symbol_bucket.cpp @@ -163,7 +163,7 @@ void SymbolBucket::parseFeatures(const GeometryTileLayer& layer, } } - if (layout.placement == PlacementType::Line) { + if (layout.placement == SymbolPlacementType::Line) { util::mergeLines(features); } } @@ -238,7 +238,7 @@ void SymbolBucket::addFeatures(uintptr_t tileUID, if (feature.label.length()) { shapedText = fontStack->getShaping( /* string */ feature.label, - /* maxWidth: ems */ layout.placement != PlacementType::Line ? + /* maxWidth: ems */ layout.placement != SymbolPlacementType::Line ? layout.text.maxWidth * 24 : 0, /* lineHeight: ems */ layout.text.lineHeight * 24, /* horizontalAlign */ horizontalAlign, @@ -289,19 +289,19 @@ void SymbolBucket::addFeature(const GeometryCollection &lines, const float textMaxBoxScale = tilePixelRatio * layout.textMaxSize / glyphSize; const float iconBoxScale = tilePixelRatio * layout.icon.size; const float symbolSpacing = tilePixelRatio * layout.spacing; - const bool avoidEdges = layout.avoidEdges && layout.placement != PlacementType::Line; + const bool avoidEdges = layout.avoidEdges && layout.placement != SymbolPlacementType::Line; const float textPadding = layout.text.padding * tilePixelRatio; const float iconPadding = layout.icon.padding * tilePixelRatio; const float textMaxAngle = layout.text.maxAngle * util::DEG2RAD; const bool textAlongLine = layout.text.rotationAlignment == RotationAlignmentType::Map && - layout.placement == PlacementType::Line; + layout.placement == SymbolPlacementType::Line; const bool iconAlongLine = layout.icon.rotationAlignment == RotationAlignmentType::Map && - layout.placement == PlacementType::Line; + layout.placement == SymbolPlacementType::Line; const bool mayOverlap = layout.text.allowOverlap || layout.icon.allowOverlap || layout.text.ignorePlacement || layout.icon.ignorePlacement; - const bool isLine = layout.placement == PlacementType::Line; + const bool isLine = layout.placement == SymbolPlacementType::Line; const float textRepeatDistance = symbolSpacing / 2; auto& clippedLines = isLine ? @@ -373,10 +373,10 @@ void SymbolBucket::placeFeatures(CollisionTile& collisionTile) { const bool textAlongLine = layout.text.rotationAlignment == RotationAlignmentType::Map && - layout.placement == PlacementType::Line; + layout.placement == SymbolPlacementType::Line; const bool iconAlongLine = layout.icon.rotationAlignment == RotationAlignmentType::Map && - layout.placement == PlacementType::Line; + layout.placement == SymbolPlacementType::Line; const bool mayOverlap = layout.text.allowOverlap || layout.icon.allowOverlap || layout.text.ignorePlacement || layout.icon.ignorePlacement; diff --git a/src/mbgl/style/function.cpp b/src/mbgl/style/function.cpp index a3427fd4d..55643ed43 100644 --- a/src/mbgl/style/function.cpp +++ b/src/mbgl/style/function.cpp @@ -21,7 +21,7 @@ template <> inline TranslateAnchorType defaultStopsValue() { return {}; }; template <> inline RotateAnchorType defaultStopsValue() { return {}; }; template <> inline LineCapType defaultStopsValue() { return {}; }; template <> inline LineJoinType defaultStopsValue() { return {}; }; -template <> inline PlacementType defaultStopsValue() { return {}; }; +template <> inline SymbolPlacementType defaultStopsValue() { return {}; }; template <> inline TextAnchorType defaultStopsValue() { return {}; }; template <> inline TextJustifyType defaultStopsValue() { return {}; }; template <> inline TextTransformType defaultStopsValue() { return {}; }; @@ -86,7 +86,7 @@ template class Function; template class Function; template class Function; template class Function; -template class Function; +template class Function; template class Function; template class Function; template class Function; diff --git a/src/mbgl/style/property_parsing.cpp b/src/mbgl/style/property_parsing.cpp index d1f3fb350..879f61411 100644 --- a/src/mbgl/style/property_parsing.cpp +++ b/src/mbgl/style/property_parsing.cpp @@ -121,13 +121,13 @@ optional parseProperty(const char* name, const JSVal } template <> -optional parseProperty(const char* name, const JSValue& value) { +optional parseProperty(const char* name, const JSValue& value) { if (!value.IsString()) { Log::Warning(Event::ParseStyle, "value of '%s' must be a string", name); return {}; } - return { PlacementTypeClass({ value.GetString(), value.GetStringLength() }) }; + return { SymbolPlacementTypeClass({ value.GetString(), value.GetStringLength() }) }; } template <> @@ -330,8 +330,8 @@ template <> optional> parseProperty(const char* name, con return parseFunction(name, value); } -template <> optional> parseProperty(const char* name, const JSValue& value) { - return parseFunction(name, value); +template <> optional> parseProperty(const char* name, const JSValue& value) { + return parseFunction(name, value); } template <> optional> parseProperty(const char* name, const JSValue& value) { diff --git a/src/mbgl/util/interpolate.hpp b/src/mbgl/util/interpolate.hpp index 7d8627e7d..7d1a857e8 100644 --- a/src/mbgl/util/interpolate.hpp +++ b/src/mbgl/util/interpolate.hpp @@ -40,7 +40,7 @@ template<> inline TranslateAnchorType interpolate(const TranslateAnchorType a, c template<> inline RotateAnchorType interpolate(const RotateAnchorType a, const RotateAnchorType, const double) { return a; } template<> inline LineCapType interpolate(const LineCapType a, const LineCapType, const double) { return a; } template<> inline LineJoinType interpolate(const LineJoinType a, const LineJoinType, const double) { return a; } -template<> inline PlacementType interpolate(const PlacementType a, const PlacementType, const double) { return a; } +template<> inline SymbolPlacementType interpolate(const SymbolPlacementType a, const SymbolPlacementType, const double) { return a; } template<> inline TextAnchorType interpolate(const TextAnchorType a, const TextAnchorType, const double) { return a; } template<> inline TextJustifyType interpolate(const TextJustifyType a, const TextJustifyType, const double) { return a; } template<> inline TextTransformType interpolate(const TextTransformType a, const TextTransformType, const double) { return a; }