diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-04-19 10:12:23 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-04-21 14:05:40 -0700 |
commit | 2df1c36ab82af663c6f612da2ffda1fdc13531c2 (patch) | |
tree | 0fde1733d2fcb2ee15967da15035716154c35618 /src | |
parent | a14f0d2eddd4d9eb1bbf33fed3bfffe2329acf5e (diff) | |
download | qtlocation-mapboxgl-2df1c36ab82af663c6f612da2ffda1fdc13531c2.tar.gz |
[core] JoinType ⇢ LineJoinType
Diffstat (limited to 'src')
-rw-r--r-- | src/mbgl/annotation/shape_annotation_impl.cpp | 2 | ||||
-rw-r--r-- | src/mbgl/layer/line_layer.hpp | 2 | ||||
-rw-r--r-- | src/mbgl/renderer/line_bucket.cpp | 30 | ||||
-rw-r--r-- | src/mbgl/style/function.cpp | 4 | ||||
-rw-r--r-- | src/mbgl/style/property_parsing.cpp | 8 | ||||
-rw-r--r-- | src/mbgl/util/interpolate.hpp | 2 |
6 files changed, 24 insertions, 24 deletions
diff --git a/src/mbgl/annotation/shape_annotation_impl.cpp b/src/mbgl/annotation/shape_annotation_impl.cpp index cac5fa0725..380a5b7746 100644 --- a/src/mbgl/annotation/shape_annotation_impl.cpp +++ b/src/mbgl/annotation/shape_annotation_impl.cpp @@ -31,7 +31,7 @@ void ShapeAnnotationImpl::updateStyle(Style& style) { type = geojsonvt::ProjectedFeatureType::LineString; std::unique_ptr<LineLayer> layer = std::make_unique<LineLayer>(); - layer->layout.join = JoinType::Round; + layer->layout.join = LineJoinType::Round; const LineAnnotationProperties& properties = shape.properties.get<LineAnnotationProperties>(); layer->paint.opacity = properties.opacity; diff --git a/src/mbgl/layer/line_layer.hpp b/src/mbgl/layer/line_layer.hpp index 0aa8d3af8e..f7f5abdbfc 100644 --- a/src/mbgl/layer/line_layer.hpp +++ b/src/mbgl/layer/line_layer.hpp @@ -10,7 +10,7 @@ namespace mbgl { class LineLayoutProperties { public: LayoutProperty<LineCapType> cap { LineCapType::Butt }; - LayoutProperty<JoinType> join { JoinType::Miter }; + LayoutProperty<LineJoinType> join { LineJoinType::Miter }; LayoutProperty<float> miterLimit { 2.0f }; LayoutProperty<float> roundLimit { 1.0f }; }; diff --git a/src/mbgl/renderer/line_bucket.cpp b/src/mbgl/renderer/line_bucket.cpp index 2ae2998b92..3d8ef69003 100644 --- a/src/mbgl/renderer/line_bucket.cpp +++ b/src/mbgl/renderer/line_bucket.cpp @@ -67,7 +67,7 @@ void LineBucket::addGeometry(const GeometryCoordinates& vertices) { return; } - const float miterLimit = layout.join == JoinType::Bevel ? 1.05f : float(layout.miterLimit); + const float miterLimit = layout.join == LineJoinType::Bevel ? 1.05f : float(layout.miterLimit); const double sharpCornerOffset = SHARP_CORNER_OFFSET * (float(util::EXTENT) / (util::tileSize * overscaling)); @@ -172,33 +172,33 @@ void LineBucket::addGeometry(const GeometryCoordinates& vertices) { // The join if a middle vertex, otherwise the cap const bool middleVertex = prevVertex && nextVertex; - JoinType currentJoin = layout.join; + LineJoinType currentJoin = layout.join; const LineCapType currentCap = nextVertex ? beginCap : endCap; if (middleVertex) { - if (currentJoin == JoinType::Round) { + if (currentJoin == LineJoinType::Round) { if (miterLength < layout.roundLimit) { - currentJoin = JoinType::Miter; + currentJoin = LineJoinType::Miter; } else if (miterLength <= 2) { - currentJoin = JoinType::FakeRound; + currentJoin = LineJoinType::FakeRound; } } - if (currentJoin == JoinType::Miter && miterLength > miterLimit) { - currentJoin = JoinType::Bevel; + if (currentJoin == LineJoinType::Miter && miterLength > miterLimit) { + currentJoin = LineJoinType::Bevel; } - if (currentJoin == JoinType::Bevel) { + if (currentJoin == LineJoinType::Bevel) { // The maximum extrude length is 128 / 63 = 2 times the width of the line // so if miterLength >= 2 we need to draw a different type of bevel where. if (miterLength > 2) { - currentJoin = JoinType::FlipBevel; + currentJoin = LineJoinType::FlipBevel; } // If the miterLength is really small and the line bevel wouldn't be visible, // just draw a miter join to save a triangle. if (miterLength < miterLimit) { - currentJoin = JoinType::Miter; + currentJoin = LineJoinType::Miter; } } } @@ -207,12 +207,12 @@ void LineBucket::addGeometry(const GeometryCoordinates& vertices) { if (prevVertex) distance += util::dist<double>(currentVertex, prevVertex); - if (middleVertex && currentJoin == JoinType::Miter) { + if (middleVertex && currentJoin == LineJoinType::Miter) { joinNormal = joinNormal * miterLength; addCurrentVertex(currentVertex, distance, joinNormal, 0, 0, false, startVertex, triangleStore); - } else if (middleVertex && currentJoin == JoinType::FlipBevel) { + } else if (middleVertex && currentJoin == LineJoinType::FlipBevel) { // miter is too big, flip the direction to make a beveled join if (miterLength > 100) { @@ -230,7 +230,7 @@ void LineBucket::addGeometry(const GeometryCoordinates& vertices) { addCurrentVertex(currentVertex, distance, joinNormal * -1.0, 0, 0, false, startVertex, triangleStore); - } else if (middleVertex && (currentJoin == JoinType::Bevel || currentJoin == JoinType::FakeRound)) { + } else if (middleVertex && (currentJoin == LineJoinType::Bevel || currentJoin == LineJoinType::FakeRound)) { const bool lineTurnsLeft = (prevNormal.x * nextNormal.y - prevNormal.y * nextNormal.x) > 0; const float offset = -std::sqrt(miterLength * miterLength - 1); float offsetA; @@ -250,7 +250,7 @@ void LineBucket::addGeometry(const GeometryCoordinates& vertices) { startVertex, triangleStore); } - if (currentJoin == JoinType::FakeRound) { + if (currentJoin == LineJoinType::FakeRound) { // The join angle is sharp enough that a round join would be visible. // Bevel joins fill the gap between segments with a single pie slice triangle. // Create a round join by adding multiple pie slices. The join isn't actually round, but @@ -308,7 +308,7 @@ void LineBucket::addGeometry(const GeometryCoordinates& vertices) { startVertex, triangleStore); } - } else if (middleVertex ? currentJoin == JoinType::Round : currentCap == LineCapType::Round) { + } else if (middleVertex ? currentJoin == LineJoinType::Round : currentCap == LineCapType::Round) { if (!startOfLine) { // Close previous segment with a butt addCurrentVertex(currentVertex, distance, prevNormal, 0, 0, false, diff --git a/src/mbgl/style/function.cpp b/src/mbgl/style/function.cpp index 501f27fcad..a3427fd4d1 100644 --- a/src/mbgl/style/function.cpp +++ b/src/mbgl/style/function.cpp @@ -20,7 +20,7 @@ template <> inline std:: string defaultStopsValue() { return {}; } template <> inline TranslateAnchorType defaultStopsValue() { return {}; }; template <> inline RotateAnchorType defaultStopsValue() { return {}; }; template <> inline LineCapType defaultStopsValue() { return {}; }; -template <> inline JoinType defaultStopsValue() { return {}; }; +template <> inline LineJoinType defaultStopsValue() { return {}; }; template <> inline PlacementType defaultStopsValue() { return {}; }; template <> inline TextAnchorType defaultStopsValue() { return {}; }; template <> inline TextJustifyType defaultStopsValue() { return {}; }; @@ -85,7 +85,7 @@ template class Function<std::string>; template class Function<TranslateAnchorType>; template class Function<RotateAnchorType>; template class Function<LineCapType>; -template class Function<JoinType>; +template class Function<LineJoinType>; template class Function<PlacementType>; template class Function<TextAnchorType>; template class Function<TextJustifyType>; diff --git a/src/mbgl/style/property_parsing.cpp b/src/mbgl/style/property_parsing.cpp index 056c78bcfc..d1f3fb350d 100644 --- a/src/mbgl/style/property_parsing.cpp +++ b/src/mbgl/style/property_parsing.cpp @@ -111,13 +111,13 @@ optional<LineCapType> parseProperty<LineCapType>(const char* name, const JSValue } template <> -optional<JoinType> parseProperty<JoinType>(const char* name, const JSValue& value) { +optional<LineJoinType> parseProperty<LineJoinType>(const char* name, const JSValue& value) { if (!value.IsString()) { Log::Warning(Event::ParseStyle, "value of '%s' must be a string", name); return {}; } - return { JoinTypeClass({ value.GetString(), value.GetStringLength() }) }; + return { LineJoinTypeClass({ value.GetString(), value.GetStringLength() }) }; } template <> @@ -326,8 +326,8 @@ template <> optional<Function<LineCapType>> parseProperty(const char* name, cons return parseFunction<LineCapType>(name, value); } -template <> optional<Function<JoinType>> parseProperty(const char* name, const JSValue& value) { - return parseFunction<JoinType>(name, value); +template <> optional<Function<LineJoinType>> parseProperty(const char* name, const JSValue& value) { + return parseFunction<LineJoinType>(name, value); } template <> optional<Function<PlacementType>> parseProperty(const char* name, const JSValue& value) { diff --git a/src/mbgl/util/interpolate.hpp b/src/mbgl/util/interpolate.hpp index 499783342f..7d8627e7d6 100644 --- a/src/mbgl/util/interpolate.hpp +++ b/src/mbgl/util/interpolate.hpp @@ -39,7 +39,7 @@ template<> inline std::string interpolate(const std::string a, const std::string template<> inline TranslateAnchorType interpolate(const TranslateAnchorType a, const TranslateAnchorType, const double) { return a; } 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 JoinType interpolate(const JoinType a, const JoinType, 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 TextAnchorType interpolate(const TextAnchorType a, const TextAnchorType, const double) { return a; } template<> inline TextJustifyType interpolate(const TextJustifyType a, const TextJustifyType, const double) { return a; } |