Repository navigation
[core] Add line-gradient property - #12575
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
1ec5
left a comment
There was a problem hiding this comment.
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.
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
MGLShapeSourcewhoseMGLShapeSource.calculatesLineDistanceMetricsproperty 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.
| 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.
This should say lineDashPattern. The codegen script isn’t aliasing lineDasharray for some reason.
| result += util::dist<double>(coordinates[i], coordinates[i + 1]); | ||
| } | ||
| return result; | ||
| }(); |
There was a problem hiding this comment.
Why is this a self-invoking lambda?
| optional<Distances> lineDistances) { | ||
| Point<double> extrude = normal; | ||
| if (lineDistances) | ||
| distance = lineDistances->scaleToMaxLineDistance(distance); |
There was a problem hiding this comment.
Let's add braces here even if there is just one statement.
|
|
||
| void LineBucket::addCurrentVertex(const GeometryCoordinate& currentCoordinate, | ||
| double &distance, | ||
| double distance, |
There was a problem hiding this comment.
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.
Thanks for the catch! I missed that we need to set it to 0.0 under some conditions
| optional<Distances> lineDistances) { | ||
| Point<double> flippedExtrude = extrude * (lineTurnsLeft ? -1.0 : 1.0); | ||
| if (lineDistances) | ||
| distance = lineDistances->scaleToMaxLineDistance(distance); |
| 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"}});; |
|
|
||
| void LineLayer::setLineGradient(ColorRampPropertyValue value) { | ||
| if (value == getLineGradient()) | ||
| return; |
There was a problem hiding this comment.
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).