Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement property functions for line-join #5020

Merged
merged 2 commits into from
Jul 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/data/bucket/line_bucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class LineBucket extends Bucket {

addFeature(feature: VectorTileFeature) {
const layout = this.layers[0].layout;
const join = layout['line-join'];
const join = this.layers[0].getLayoutValue('line-join', {zoom: this.zoom}, feature.properties);
const cap = layout['line-cap'];
const miterLimit = layout['line-miter-limit'];
const roundLimit = layout['line-round-limit'];
Expand Down
5 changes: 4 additions & 1 deletion src/style-spec/reference/v8.json
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,7 @@
"type": "enum",
"function": "piecewise-constant",
"zoom-function": true,
"property-function": true,
"values": {
"bevel": {
"doc": "A join with a squared-off end which is drawn beyond the endpoint of the line at a distance of one-half of the line's width."
Expand All @@ -584,7 +585,9 @@
"ios": "2.0.0",
"macos": "0.1.0"
},
"data-driven styling": {}
"data-driven styling": {
"js": "0.40.0"
}
}
},
"line-miter-limit": {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
{
"version": 8,
"metadata": {
"test": {
"width": 128,
"height": 64
}
},
"zoom": 0,
"sources": {
"geojson": {
"type": "geojson",
"data": {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"join": "miter"
},
"geometry": {
"type": "LineString",
"coordinates": [
[
-36,
16
],
[
-36,
0
],
[
-20,
-16
],
[
-20,
16
],
[
-28,
16
]
]
}
},
{
"type": "Feature",
"properties": {
"join": "round"
},
"geometry": {
"type": "LineString",
"coordinates": [
[
-8,
16
],
[
-8,
0
],
[
8,
-16
],
[
8,
16
],
[
0,
16
]
]
}
},
{
"type": "Feature",
"properties": {
"join": "bevel"
},
"geometry": {
"type": "LineString",
"coordinates": [
[
20,
16
],
[
20,
0
],
[
36,
-16
],
[
36,
16
],
[
28,
16
]
]
}
}
]
}
}
},
"layers": [
{
"id": "line",
"type": "line",
"source": "geojson",
"layout": {
"line-join": {
"type": "identity",
"property": "join"
}
},
"paint": {
"line-width": 8,
"line-dasharray": [1, 1]
}
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
129 changes: 129 additions & 0 deletions test/integration/render-tests/line-join/property-function/style.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
{
"version": 8,
"metadata": {
"test": {
"width": 128,
"height": 64
}
},
"zoom": 0,
"sources": {
"geojson": {
"type": "geojson",
"data": {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"join": "miter"
},
"geometry": {
"type": "LineString",
"coordinates": [
[
-36,
16
],
[
-36,
0
],
[
-20,
-16
],
[
-20,
16
],
[
-28,
16
]
]
}
},
{
"type": "Feature",
"properties": {
"join": "round"
},
"geometry": {
"type": "LineString",
"coordinates": [
[
-8,
16
],
[
-8,
0
],
[
8,
-16
],
[
8,
16
],
[
0,
16
]
]
}
},
{
"type": "Feature",
"properties": {
"join": "bevel"
},
"geometry": {
"type": "LineString",
"coordinates": [
[
20,
16
],
[
20,
0
],
[
36,
-16
],
[
36,
16
],
[
28,
16
]
]
}
}
]
}
}
},
"layers": [
{
"id": "line",
"type": "line",
"source": "geojson",
"layout": {
"line-join": {
"type": "identity",
"property": "join"
}
},
"paint": {
"line-width": 8
}
}
]
}