From cc60e1851be24d2eee89485e723265e10d0027bd Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Thu, 3 Oct 2019 12:38:39 -0400 Subject: [PATCH 1/3] fix #8832 broken fill pattern layers ResolvedImage was not registered for serialization. This registers it and fixes a couple codegen'd files so that they generate properly. --- build/generate-style-code.js | 2 +- src/style/style_layer/background_style_layer_properties.js | 1 + src/style/style_layer/circle_style_layer_properties.js | 2 ++ src/style/style_layer/fill_extrusion_style_layer_properties.js | 1 + src/style/style_layer/heatmap_style_layer_properties.js | 2 ++ src/style/style_layer/hillshade_style_layer_properties.js | 2 ++ src/style/style_layer/layer_properties.js.ejs | 2 ++ src/style/style_layer/raster_style_layer_properties.js | 2 ++ src/util/web_worker_transfer.js | 2 ++ 9 files changed, 15 insertions(+), 1 deletion(-) diff --git a/build/generate-style-code.js b/build/generate-style-code.js index 2e816288071..42dc2d48045 100644 --- a/build/generate-style-code.js +++ b/build/generate-style-code.js @@ -33,7 +33,7 @@ global.flowType = function (property) { case 'formatted': return `Formatted`; case 'image': - return `Image`; + return `ResolvedImage`; case 'array': if (property.length) { return `[${new Array(property.length).fill(flowType({type: property.value})).join(', ')}]`; diff --git a/src/style/style_layer/background_style_layer_properties.js b/src/style/style_layer/background_style_layer_properties.js index 3d7e45e4ab9..868663cfce1 100644 --- a/src/style/style_layer/background_style_layer_properties.js +++ b/src/style/style_layer/background_style_layer_properties.js @@ -19,6 +19,7 @@ import type Formatted from '../../style-spec/expression/types/formatted'; import type ResolvedImage from '../../style-spec/expression/types/resolved_image'; + export type PaintProps = {| "background-color": DataConstantProperty, "background-pattern": CrossFadedProperty, diff --git a/src/style/style_layer/circle_style_layer_properties.js b/src/style/style_layer/circle_style_layer_properties.js index e5574c4f005..5b8224423bb 100644 --- a/src/style/style_layer/circle_style_layer_properties.js +++ b/src/style/style_layer/circle_style_layer_properties.js @@ -17,6 +17,8 @@ import type Color from '../../style-spec/util/color'; import type Formatted from '../../style-spec/expression/types/formatted'; +import type ResolvedImage from '../../style-spec/expression/types/resolved_image'; + export type LayoutProps = {| "circle-sort-key": DataDrivenProperty, |}; diff --git a/src/style/style_layer/fill_extrusion_style_layer_properties.js b/src/style/style_layer/fill_extrusion_style_layer_properties.js index 6d13b8639a8..7118f906338 100644 --- a/src/style/style_layer/fill_extrusion_style_layer_properties.js +++ b/src/style/style_layer/fill_extrusion_style_layer_properties.js @@ -19,6 +19,7 @@ import type Formatted from '../../style-spec/expression/types/formatted'; import type ResolvedImage from '../../style-spec/expression/types/resolved_image'; + export type PaintProps = {| "fill-extrusion-opacity": DataConstantProperty, "fill-extrusion-color": DataDrivenProperty, diff --git a/src/style/style_layer/heatmap_style_layer_properties.js b/src/style/style_layer/heatmap_style_layer_properties.js index 76b6079e550..53bdaf3baa3 100644 --- a/src/style/style_layer/heatmap_style_layer_properties.js +++ b/src/style/style_layer/heatmap_style_layer_properties.js @@ -17,6 +17,8 @@ import type Color from '../../style-spec/util/color'; import type Formatted from '../../style-spec/expression/types/formatted'; +import type ResolvedImage from '../../style-spec/expression/types/resolved_image'; + export type PaintProps = {| "heatmap-radius": DataDrivenProperty, diff --git a/src/style/style_layer/hillshade_style_layer_properties.js b/src/style/style_layer/hillshade_style_layer_properties.js index 39d94286ad8..7a82d3e36a3 100644 --- a/src/style/style_layer/hillshade_style_layer_properties.js +++ b/src/style/style_layer/hillshade_style_layer_properties.js @@ -17,6 +17,8 @@ import type Color from '../../style-spec/util/color'; import type Formatted from '../../style-spec/expression/types/formatted'; +import type ResolvedImage from '../../style-spec/expression/types/resolved_image'; + export type PaintProps = {| "hillshade-illumination-direction": DataConstantProperty, diff --git a/src/style/style_layer/layer_properties.js.ejs b/src/style/style_layer/layer_properties.js.ejs index 9fabb9505f5..497242d7c23 100644 --- a/src/style/style_layer/layer_properties.js.ejs +++ b/src/style/style_layer/layer_properties.js.ejs @@ -21,6 +21,8 @@ import { import type Color from '../../style-spec/util/color'; import type Formatted from '../../style-spec/expression/types/formatted'; + +import type ResolvedImage from '../../style-spec/expression/types/resolved_image'; <% const overridables = paintProperties.filter(p => p.overridable) if (overridables.length) { -%> diff --git a/src/style/style_layer/raster_style_layer_properties.js b/src/style/style_layer/raster_style_layer_properties.js index b813a73459c..15356168308 100644 --- a/src/style/style_layer/raster_style_layer_properties.js +++ b/src/style/style_layer/raster_style_layer_properties.js @@ -17,6 +17,8 @@ import type Color from '../../style-spec/util/color'; import type Formatted from '../../style-spec/expression/types/formatted'; +import type ResolvedImage from '../../style-spec/expression/types/resolved_image'; + export type PaintProps = {| "raster-opacity": DataConstantProperty, diff --git a/src/util/web_worker_transfer.js b/src/util/web_worker_transfer.js index 6e90b374e09..5dab5da5d78 100644 --- a/src/util/web_worker_transfer.js +++ b/src/util/web_worker_transfer.js @@ -7,6 +7,7 @@ import Color from '../style-spec/util/color'; import {StylePropertyFunction, StyleExpression, ZoomDependentExpression, ZoomConstantExpression} from '../style-spec/expression'; import CompoundExpression from '../style-spec/expression/compound_expression'; import expressions from '../style-spec/expression/definitions'; +import ResolvedImage from '../style-spec/expression/types/resolved_image' import window from './window'; const {ImageData} = window; @@ -86,6 +87,7 @@ register('Grid', Grid); register('Color', Color); register('Error', Error); +register('ResolvedImage', ResolvedImage); register('StylePropertyFunction', StylePropertyFunction); register('StyleExpression', StyleExpression, {omit: ['_evaluator']}); From e9e94303cd7647cbb5387a10e9538300a2551f2a Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Thu, 3 Oct 2019 12:42:22 -0400 Subject: [PATCH 2/3] fixup --- src/util/web_worker_transfer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/web_worker_transfer.js b/src/util/web_worker_transfer.js index 5dab5da5d78..84a41469bfc 100644 --- a/src/util/web_worker_transfer.js +++ b/src/util/web_worker_transfer.js @@ -7,7 +7,7 @@ import Color from '../style-spec/util/color'; import {StylePropertyFunction, StyleExpression, ZoomDependentExpression, ZoomConstantExpression} from '../style-spec/expression'; import CompoundExpression from '../style-spec/expression/compound_expression'; import expressions from '../style-spec/expression/definitions'; -import ResolvedImage from '../style-spec/expression/types/resolved_image' +import ResolvedImage from '../style-spec/expression/types/resolved_image'; import window from './window'; const {ImageData} = window; From e6fc649c7e5f4ccd8778d0222271100d74d68d3f Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Thu, 3 Oct 2019 12:59:03 -0400 Subject: [PATCH 3/3] add render test --- .../line-pattern/zoom-expression/expected.png | Bin 0 -> 9334 bytes .../line-pattern/zoom-expression/style.json | 101 ++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 test/integration/render-tests/line-pattern/zoom-expression/expected.png create mode 100644 test/integration/render-tests/line-pattern/zoom-expression/style.json diff --git a/test/integration/render-tests/line-pattern/zoom-expression/expected.png b/test/integration/render-tests/line-pattern/zoom-expression/expected.png new file mode 100644 index 0000000000000000000000000000000000000000..38c3ab2ad09d6db4d104f38255598c71a71aa0d9 GIT binary patch literal 9334 zcmd^__di?x|NpHLsv5H?iXe!+#V8tDVhc4=wKtae#V+e+`V)aR&C{F)?RmuVbE*O7pyfeIr*^n@UUM*vGV;_+lg9eG!TX0Tj?=8KL& zG?)!aM@v>EG$I(B2!F2W*-%2+sa-AjqPL+$ZBP<8hMK}lwk5>Mns^=v4fkpMN?)NT zt3I*k@wxD&O@m@;`dyAig9wh{N2S72UHGb{c4qf9yuS39QnW$;lSZ9pd^x#zdS zQ5IGDx?icDdcxhFe1~dDvtnsMoVG*~6`RlHXDaF^2h-FKrd5}My<+-SY5IkusCeIh z*31ZIS&f%_Yh(LJ?Y1r`+KP=@cuL;vPVnJ+BkgHJ(BS4fx|E4?sVFLH#EaJZe4D)Q zF1SS2H)!8`lL)4%5vI|vc6&6tvGd-8;lz!S`H9HLRdF7YO-18x7jmreQMHVx|HRoX zdhISNln#TU%d{bBw@=U4jX3D6-0uX zvOog$xzXW`Jr1Q;cJhjK{PIL>2-1#5G@#Ca&zt+6luSR!eoD@{=M&d)U{4sUwzCxN zfqTMRP4zh$^@JH|<2uCc&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hYV^DDcXKD?iy)Yq_%-i;b+Z$OuVy;*8$R9q=6aY;nft*jPN<*Uz)C{Ajj(E zgw(}|4y(3SJGV-WQCI2M`dsxKd5btnzzd`$N7v`_%cpN2VRp9ybBKG2z{Apy0seVL zoDFu(t;`69eoW*bqJ!eo*GjsXJ3Im0H;51Le^IzO7&y5lKgSF4If5=8meg`?OIzED zn<^BLfKvibxh0eY7@Gf(0)FQh95Hso6eTDGOcMytShpXHx|hCgk`XN9djGMJmca+D zR&DrD=70Mj0Cu$IyoQEnIB3z{^w>Xaii;MiwoM>rNHg&zG1qrua8y{bccs4a=7i@x z$WD{1n_n_DT#2?rxteUeI~gL%ECvYSwMXw=cTTtYzZ7>>Dd!Z`G0(ebM2k5u~h6>%J`A(o(0dzOWK19*d5S0)K53^d5B>7)R z?EndRZ3+LAoTUUp><5TEJcGgKypij>C~dC`WT!G$KS5H0&v_uDU#g-cc*2gL6anRU zqv6G_k2LHBiUMYs*dPcT$dmWxKhgkQ0!M2{Pz)+^P&F|Pn!OiV_p(!0k4&`6;tynTb{YI9l@$b7W2fJL?P?x1nGR2YsLwh~1n43&2Mlj% zwy1O+uS?wRh71&;po10n(Iq!PV5A_93c3@kVgGS&sGV`v!QnA`KVsI1>6+$d_MRd# z>a5WO6wSZ1`!3gX%XsJX2UD?Z|E@b4wC7cduVAG)>u=Epod{&)y~GCIiTVEC`fr?E zx=J=O)AYDZBMmHo(*>%SV+d<&TF#DOZ+qK;6ip3iE8vL1eiU8y0!|LJxqxZ31{aA^ zr87lyKMy$7oKhD@%fL$$ns8Ggy0h+@GsEw96APFI%7I4O`|K4&{fhtp{h{?!%dtg4 W|K)Y#8K9qt3U%E?_XW~1=Klb+oru){ literal 0 HcmV?d00001 diff --git a/test/integration/render-tests/line-pattern/zoom-expression/style.json b/test/integration/render-tests/line-pattern/zoom-expression/style.json new file mode 100644 index 00000000000..bf6e5f3deac --- /dev/null +++ b/test/integration/render-tests/line-pattern/zoom-expression/style.json @@ -0,0 +1,101 @@ +{ + "version": 8, + "metadata": { + "test": { + "height": 128, + "width": 128 + } + }, + "zoom": 2, + "sprite": "local://sprites/emerald", + "sources": { + "a": { + "type": "geojson", + "data": { + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": { + "class": "trunk" + }, + "geometry": { + "type": "LineString", + "coordinates": [ + [ + 10, + -10 + ], + [ + -10, + -10 + ] + ] + } + }, + { + "type": "Feature", + "properties": { + "class": "path" + }, + "geometry": { + "type": "LineString", + "coordinates": [ + [ + -10, + 0 + ], + [ + 10, + 0 + ] + ] + } + }, + { + "type": "Feature", + "properties": { + "class": "street" + }, + "geometry": { + "type": "LineString", + "coordinates": [ + [ + -10, + 10 + ], + [ + 10, + 10 + ] + ] + } + } + ] + } + } + }, + "layers": [ + { + "id": "background", + "type": "background", + "paint": { + "background-color": "white" + } + }, + { + "id": "road", + "type": "line", + "source": "a", + "paint": { + "line-width": 10, + "line-pattern": [ + "step", ["zoom"], + "generic_icon", + 2, + "generic_metro" + ] + } + } + ] +}