-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Conversation
63208a2
to
1f50d02
Compare
1f50d02
to
cb59411
Compare
@kkaefer please review, tagging @tmpsantos @brunoabinader |
4573d8d
to
fb3060f
Compare
This PR fixes #11718 |
fb3060f
to
e388aaa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition to the following, please update the iOS and macOS changelogs to note the addition of these new properties. Thanks!
#if TARGET_OS_IPHONE | ||
/** | ||
Defines a gradient with which to color a line feature. Can only be used with | ||
GeoJSON sources that specify `"lineMetrics": true`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This documentation comment uses JSON notation, so we’ll need to override it in an entry in platform/darwin/scripts/style-spec-overrides-v8.json:
Defines a gradient with which to color a line feature. This property only has an effect on lines defined by an
MGLShapeSource
whoseMGLShapeSource.calculatesLineDistanceMetrics
property is set toYES
.
Speaking of which, we’ll need to add that calculatesLineDistanceMetrics
property to MGLShapeSource before developers will be able to use this property on iOS/macOS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Defines a gradient with which to color a line feature. Can only be used with | ||
GeoJSON sources that specify `"lineMetrics": true`. | ||
|
||
This property is only applied to the style if `lineDasharray` is set to `nil`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should say lineDashPattern
. The codegen script isn’t aliasing lineDasharray
for some reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
result += util::dist<double>(coordinates[i], coordinates[i + 1]); | ||
} | ||
return result; | ||
}(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this a self-invoking lambda?
Point<double> extrude = normal; | ||
if (lineDistances) | ||
distance = lineDistances->scaleToMaxLineDistance(distance); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add braces here even if there is just one statement.
@@ -392,14 +427,18 @@ void LineBucket::addGeometry(const GeometryCoordinates& coordinates, const Geome | |||
} | |||
|
|||
void LineBucket::addCurrentVertex(const GeometryCoordinate& currentCoordinate, | |||
double &distance, | |||
double distance, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we no longer need the distance as a reference? We still seem to be modifying it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the catch! I missed that we need to set it to 0.0
under some conditions
Point<double> flippedExtrude = extrude * (lineTurnsLeft ? -1.0 : 1.0); | ||
if (lineDistances) | ||
distance = lineDistances->scaleToMaxLineDistance(distance); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Braces please :)
@@ -68,7 +68,8 @@ bool isConstant(const Expression& expression) { | |||
} | |||
|
|||
return isFeatureConstant(expression) && | |||
isGlobalPropertyConstant(expression, std::array<std::string, 2>{{"zoom", "heatmap-density"}}); | |||
isGlobalPropertyConstant(expression, std::array<std::string, 2>{{"zoom", "heatmap-density"}}) && | |||
isGlobalPropertyConstant(expression, std::array<std::string, 2>{{"zoom", "line-progress"}});; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: double semicoli
|
||
void LineLayer::setLineGradient(ColorRampPropertyValue value) { | ||
if (value == getLineGradient()) | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Braces
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a generated file, I could introduce braces generation to scripts/generate-style-code.js
in a follow-up PR
d304e75
to
19e5c4d
Compare
@kkaefer Thanks for the review! The latest patch is modified accordingly. |
d7fefa8
to
7f5d5c8
Compare
@kkaefer could you take a look? |
Porting of mapbox/mapbox-gl-js#6303 See the link above for the description of the feature and its limitations). Based on patch from @lbud (Lauren Budorick).
9e47037
to
96094ce
Compare
For future spelunkers: this was included in |
Porting of mapbox/mapbox-gl-js#6303
See the link above for the description of the feature and
its limitations).
Based on patch from @lbud (Lauren Budorick).