Skip to content

Commit

Permalink
Implement property functions for line-join
Browse files Browse the repository at this point in the history
  • Loading branch information
Lauren Budorick committed Jul 24, 2017
1 parent 70b779c commit ded25a9
Show file tree
Hide file tree
Showing 6 changed files with 292 additions and 2 deletions.
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.39.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,144 @@
{
"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": "categorical",
"property": "join",
"stops": [
[
"miter",
"miter"
],
[
"round",
"round"
],
[
"bevel",
"bevel"
]
]
}
},
"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.
143 changes: 143 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,143 @@
{
"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": "categorical",
"property": "join",
"stops": [
[
"miter",
"miter"
],
[
"round",
"round"
],
[
"bevel",
"bevel"
]
]
}
},
"paint": {
"line-width": 8
}
}
]
}

0 comments on commit ded25a9

Please sign in to comment.