[core] PlacementType ⇢ SymbolPlacementType
This commit is contained in:
@@ -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" },
|
||||
});
|
||||
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -121,7 +121,7 @@ std::unique_ptr<Bucket> 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;
|
||||
};
|
||||
|
||||
@@ -11,7 +11,7 @@ class SpriteAtlas;
|
||||
|
||||
class SymbolLayoutProperties {
|
||||
public:
|
||||
LayoutProperty<PlacementType> placement { PlacementType::Point };
|
||||
LayoutProperty<SymbolPlacementType> placement { SymbolPlacementType::Point };
|
||||
LayoutProperty<float> spacing { 250.0f };
|
||||
LayoutProperty<bool> avoidEdges { false };
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<TranslateAnchorType>;
|
||||
template class Function<RotateAnchorType>;
|
||||
template class Function<LineCapType>;
|
||||
template class Function<LineJoinType>;
|
||||
template class Function<PlacementType>;
|
||||
template class Function<SymbolPlacementType>;
|
||||
template class Function<TextAnchorType>;
|
||||
template class Function<TextJustifyType>;
|
||||
template class Function<TextTransformType>;
|
||||
|
||||
@@ -121,13 +121,13 @@ optional<LineJoinType> parseProperty<LineJoinType>(const char* name, const JSVal
|
||||
}
|
||||
|
||||
template <>
|
||||
optional<PlacementType> parseProperty<PlacementType>(const char* name, const JSValue& value) {
|
||||
optional<SymbolPlacementType> parseProperty<SymbolPlacementType>(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<Function<LineJoinType>> parseProperty(const char* name, con
|
||||
return parseFunction<LineJoinType>(name, value);
|
||||
}
|
||||
|
||||
template <> optional<Function<PlacementType>> parseProperty(const char* name, const JSValue& value) {
|
||||
return parseFunction<PlacementType>(name, value);
|
||||
template <> optional<Function<SymbolPlacementType>> parseProperty(const char* name, const JSValue& value) {
|
||||
return parseFunction<SymbolPlacementType>(name, value);
|
||||
}
|
||||
|
||||
template <> optional<Function<TextAnchorType>> parseProperty(const char* name, const JSValue& value) {
|
||||
|
||||
@@ -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; }
|
||||
|
||||
Reference in New Issue
Block a user