ol 10.3.2-dev.1734966546937 → 10.3.2-dev.1735553764538

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/style/flat.js CHANGED
@@ -99,16 +99,20 @@
99
99
  * Fill style properties applied to polygon features.
100
100
  *
101
101
  * @typedef {Object} FlatFill
102
- * @property {ColorExpression} [fill-color] The fill color. `'none'` means no fill and no hit detection.
103
- * @property {StringExpression} [fill-pattern-src] Fill pattern image URL.
102
+ * @property {ColorExpression} [fill-color] The fill color. `'none'` means no fill and no hit detection (applies to Canvas only).
103
+ * @property {StringExpression} [fill-pattern-src] Fill pattern image source URI. If `fill-color` is defined as well,
104
+ * it will be used to tint this image. (Expressions only in Canvas)
104
105
  * @property {SizeExpression} [fill-pattern-size] Fill pattern image size in pixels.
105
106
  * Can be used together with `fill-pattern-offset` to define the sub-rectangle to use
106
107
  * from a fill pattern image sprite sheet.
107
- * @property {SizeExpression} [fill-pattern-offset] Fill pattern image offset in pixels.
108
+ * @property {SizeExpression} [fill-pattern-offset=[0, 0]] Offset, which, together with the size and the offset origin, define the
109
+ * sub-rectangle to use from the original fill pattern image.
110
+ * @property {import("./Icon.js").IconOrigin} [fill-pattern-offset-origin='top-left'] Origin of the offset: `bottom-left`, `bottom-right`,
111
+ * `top-left` or `top-right`. (WebGL only)
108
112
  */
109
113
 
110
114
  /**
111
- * Stroke style properties applied to line strings and polygon boundaries. To apply a stroke, at least one of
115
+ * Stroke style properties applied to line strings and polygon boundaries. To apply a stroke, at least one of
112
116
  * `stroke-color` or `stroke-width` must be provided.
113
117
  *
114
118
  * @typedef {Object} FlatStroke
@@ -119,11 +123,23 @@
119
123
  * @property {NumberArrayExpression} [stroke-line-dash] Line dash pattern.
120
124
  * @property {NumberExpression} [stroke-line-dash-offset=0] Line dash offset.
121
125
  * @property {NumberExpression} [stroke-miter-limit=10] Miter limit.
126
+ * @property {NumberExpression} [stroke-offset] Stroke offset in pixel. A positive value offsets the line to the right,
127
+ * relative to the direction of the line. (WebGL only)
128
+ * @property {string} [stroke-pattern-src] Stroke pattern image source URI. If `stroke-color` is defined as well,
129
+ * it will be used to tint this image. (WebGL only)
130
+ * @property {SizeExpression} [stroke-pattern-offset=[0, 0]] Offset, which, together with the size and the offset origin,
131
+ * define the sub-rectangle to use from the original fill pattern image. (WebGL only)
132
+ * @property {import("./Icon.js").IconOrigin} [stroke-pattern-offset-origin='top-left'] Origin of the offset: `bottom-left`, `bottom-right`,
133
+ * `top-left` or `top-right`. (WebGL only)
134
+ * @property {SizeExpression} [stroke-pattern-size] Stroke pattern image size in pixel. Can be used together with `stroke-pattern-offset` to define the
135
+ * sub-rectangle to use from the origin (sprite) fill pattern image. (WebGL only)
136
+ * @property {NumberExpression} [stroke-pattern-spacing] Spacing between each pattern occurrence in pixels; 0 if undefined.
122
137
  * @property {NumberExpression} [z-index] The zIndex of the style.
123
138
  */
124
139
 
125
140
  /**
126
- * Label style properties applied to all features. At a minimum, a `text-value` must be provided.
141
+ * Label style properties applied to all features. At a minimum, a `text-value` must be provided.
142
+ * Note: text style is currently not supported in WebGL layers
127
143
  *
128
144
  * @typedef {Object} FlatText
129
145
  * @property {StringExpression} [text-value] Text content (with `\n` for line breaks).
@@ -186,78 +202,80 @@
186
202
  * @property {import("./Icon.js").IconAnchorUnits} [icon-anchor-y-units='fraction'] Units in which the anchor y value is
187
203
  * specified. A value of `'fraction'` indicates the y value is a fraction of the icon. A value of `'pixels'` indicates
188
204
  * the y value in pixels.
189
- * @property {import("../color.js").Color|string} [icon-color] Color to tint the icon. If not specified,
205
+ * @property {ColorExpression} [icon-color] Color to tint the icon. If not specified,
190
206
  * the icon will be left as is.
191
207
  * @property {null|string} [icon-cross-origin] The `crossOrigin` attribute for loaded images. Note that you must provide a
192
208
  * `icon-cross-origin` value if you want to access pixel data with the Canvas renderer.
193
209
  * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.
194
- * @property {Array<number>} [icon-offset=[0, 0]] Offset, which, together with the size and the offset origin, define the
210
+ * @property {SizeExpression} [icon-offset=[0, 0]] Offset, which, together with the size and the offset origin, define the
195
211
  * sub-rectangle to use from the original icon image.
196
212
  * @property {NumberArrayExpression} [icon-displacement=[0,0]] Displacement of the icon.
197
213
  * @property {import("./Icon.js").IconOrigin} [icon-offset-origin='top-left'] Origin of the offset: `bottom-left`, `bottom-right`,
198
214
  * `top-left` or `top-right`.
199
215
  * @property {NumberExpression} [icon-opacity=1] Opacity of the icon.
200
216
  * @property {SizeExpression} [icon-scale=1] Scale.
201
- * @property {number} [icon-width] Width of the icon. If not specified, the actual image width will be used. Cannot be combined
202
- * with `scale`.
203
- * @property {number} [icon-height] Height of the icon. If not specified, the actual image height will be used. Cannot be combined
204
- * with `scale`.
217
+ * @property {NumberExpression} [icon-width] Width of the icon. If not specified, the actual image width will be used. Cannot be combined
218
+ * with `scale`. (Expressions only in WebGL)
219
+ * @property {NumberExpression} [icon-height] Height of the icon. If not specified, the actual image height will be used. Cannot be combined
220
+ * with `scale`. (Expressions only in WebGL)
205
221
  * @property {NumberExpression} [icon-rotation=0] Rotation in radians (positive rotation clockwise).
206
- * @property {BooleanExpression} [icon-rotate-with-view=false] Whether to rotate the icon with the view.
207
- * @property {import("../size.js").Size} [icon-size] Icon size in pixel. Can be used together with `icon-offset` to define the
208
- * sub-rectangle to use from the origin (sprite) icon image.
209
- * @property {import("./Style.js").DeclutterMode} [icon-declutter-mode] Declutter mode
210
- * @property {NumberExpression} [z-index] The zIndex of the style.
222
+ * @property {BooleanExpression} [icon-rotate-with-view=false] Whether to rotate the icon with the view. (Expressions only supported in Canvas)
223
+ * @property {SizeExpression} [icon-size] Icon size in pixel. Can be used together with `icon-offset` to define the
224
+ * sub-rectangle to use from the origin (sprite) icon image. (Expressions only in WebGL)
225
+ * @property {import("./Style.js").DeclutterMode} [icon-declutter-mode] Declutter mode (Canvas only)
226
+ * @property {NumberExpression} [z-index] The zIndex of the style. (Canvas only)
211
227
  */
212
228
 
213
229
  /**
214
- * Regular shape style properties for rendering point features. At least `shape-points` must be provided.
230
+ * Regular shape style properties for rendering point features. At least `shape-points` must be provided.
215
231
  *
216
232
  * @typedef {Object} FlatShape
217
- * @property {number} [shape-points] Number of points for stars and regular polygons. In case of a polygon, the number of points
218
- * is the number of sides.
233
+ * @property {NumberExpression} [shape-points] Number of points for stars and regular polygons. In case of a polygon, the number of points
234
+ * is the number of sides. (Expressions only in WebGL)
219
235
  * @property {ColorExpression} [shape-fill-color] The fill color. `'none'` means no fill and no hit detection.
220
236
  * @property {ColorExpression} [shape-stroke-color] The stroke color.
221
237
  * @property {NumberExpression} [shape-stroke-width] Stroke pixel width.
222
- * @property {StringExpression} [shape-stroke-line-cap='round'] Line cap style: `butt`, `round`, or `square`.
223
- * @property {StringExpression} [shape-stroke-line-join='round'] Line join style: `bevel`, `round`, or `miter`.
224
- * @property {NumberArrayExpression} [shape-stroke-line-dash] Line dash pattern.
225
- * @property {NumberExpression} [shape-stroke-line-dash-offset=0] Line dash offset.
226
- * @property {NumberExpression} [shape-stroke-miter-limit=10] Miter limit.
227
- * @property {number} [shape-radius] Radius of a regular polygon.
228
- * @property {number} [shape-radius2] Second radius to make a star instead of a regular polygon.
229
- * @property {number} [shape-angle=0] Shape's angle in radians. A value of 0 will have one of the shape's point facing up.
238
+ * @property {StringExpression} [shape-stroke-line-cap='round'] Line cap style: `butt`, `round`, or `square`. (Canvas only)
239
+ * @property {StringExpression} [shape-stroke-line-join='round'] Line join style: `bevel`, `round`, or `miter`. (Canvas only)
240
+ * @property {NumberArrayExpression} [shape-stroke-line-dash] Line dash pattern. (Canvas only)
241
+ * @property {NumberExpression} [shape-stroke-line-dash-offset=0] Line dash offset. (Canvas only)
242
+ * @property {NumberExpression} [shape-stroke-miter-limit=10] Miter limit. (Canvas only)
243
+ * @property {NumberExpression} [shape-radius] Radius of a regular polygon. (Expressions only in WebGL)
244
+ * @property {NumberExpression} [shape-radius2] Second radius to make a star instead of a regular polygon. (Expressions only in WebGL)
245
+ * @property {NumberExpression} [shape-angle=0] Shape's angle in radians. A value of 0 will have one of the shape's point facing up. (Expressions only in WebGL)
230
246
  * @property {NumberArrayExpression} [shape-displacement=[0,0]] Displacement of the shape
247
+ * @property {NumberExpression} [shape-opacity] Shape opacity. (WebGL only)
231
248
  * @property {NumberExpression} [shape-rotation=0] Rotation in radians (positive rotation clockwise).
232
- * @property {BooleanExpression} [shape-rotate-with-view=false] Whether to rotate the shape with the view.
233
- * @property {SizeExpression} [shape-scale=1] Scale. Unless two dimensional scaling is required a better
249
+ * @property {BooleanExpression} [shape-rotate-with-view=false] Whether to rotate the shape with the view. (Expression only supported in Canvas)
250
+ * @property {SizeExpression} [shape-scale=1] Scale. Unless two-dimensional scaling is required a better
234
251
  * result may be obtained with appropriate settings for `shape-radius` and `shape-radius2`.
235
- * @property {import("./Style.js").DeclutterMode} [shape-declutter-mode] Declutter mode.
236
- * @property {NumberExpression} [z-index] The zIndex of the style.
252
+ * @property {import("./Style.js").DeclutterMode} [shape-declutter-mode] Declutter mode. (Canvas only)
253
+ * @property {NumberExpression} [z-index] The zIndex of the style. (Canvas only)
237
254
  */
238
255
 
239
256
  /**
240
- * Circle style properties for rendering point features. At least `circle-radius` must be provided.
257
+ * Circle style properties for rendering point features. At least `circle-radius` must be provided.
241
258
  *
242
259
  * @typedef {Object} FlatCircle
243
- * @property {number} [circle-radius] Circle radius.
260
+ * @property {NumberExpression} [circle-radius] Circle radius.
244
261
  * @property {ColorExpression} [circle-fill-color] The fill color. `'none'` means no fill and no hit detection.
245
262
  * @property {ColorExpression} [circle-stroke-color] The stroke color.
246
263
  * @property {NumberExpression} [circle-stroke-width] Stroke pixel width.
247
- * @property {StringExpression} [circle-stroke-line-cap='round'] Line cap style: `butt`, `round`, or `square`.
248
- * @property {StringExpression} [circle-stroke-line-join='round'] Line join style: `bevel`, `round`, or `miter`.
249
- * @property {NumberArrayExpression} [circle-stroke-line-dash] Line dash pattern.
250
- * @property {NumberExpression} [circle-stroke-line-dash-offset=0] Line dash offset.
251
- * @property {NumberExpression} [circle-stroke-miter-limit=10] Miter limit.
264
+ * @property {StringExpression} [circle-stroke-line-cap='round'] Line cap style: `butt`, `round`, or `square`. (Canvas only)
265
+ * @property {StringExpression} [circle-stroke-line-join='round'] Line join style: `bevel`, `round`, or `miter`. (Canvas only)
266
+ * @property {NumberArrayExpression} [circle-stroke-line-dash] Line dash pattern. (Canvas only)
267
+ * @property {NumberExpression} [circle-stroke-line-dash-offset=0] Line dash offset. (Canvas only)
268
+ * @property {NumberExpression} [circle-stroke-miter-limit=10] Miter limit. (Canvas only)
252
269
  * @property {NumberArrayExpression} [circle-displacement=[0,0]] displacement
253
- * @property {SizeExpression} [circle-scale=1] Scale. A two dimensional scale will produce an ellipse.
254
- * Unless two dimensional scaling is required a better result may be obtained with an appropriate setting for `circle-radius`.
270
+ * @property {SizeExpression} [circle-scale=1] Scale. A two-dimensional scale will produce an ellipse.
271
+ * Unless two-dimensional scaling is required a better result may be obtained with an appropriate setting for `circle-radius`.
272
+ * @property {NumberExpression} [circle-opacity] Circle opacity. (WebGL only)
255
273
  * @property {NumberExpression} [circle-rotation=0] Rotation in radians
256
- * (positive rotation clockwise, meaningful only when used in conjunction with a two dimensional scale).
257
- * @property {BooleanExpression} [circle-rotate-with-view=false] Whether to rotate the shape with the view
258
- * (meaningful only when used in conjunction with a two dimensional scale).
259
- * @property {import("./Style.js").DeclutterMode} [circle-declutter-mode] Declutter mode
260
- * @property {NumberExpression} [z-index] The zIndex of the style.
274
+ * (positive rotation clockwise, meaningful only when used in conjunction with a two-dimensional scale).
275
+ * @property {BooleanExpression} [circle-rotate-with-view=false] Whether to rotate the shape with the view (Expression only supported in Canvas)
276
+ * (meaningful only when used in conjunction with a two-dimensional scale).
277
+ * @property {import("./Style.js").DeclutterMode} [circle-declutter-mode] Declutter mode (Canvas only)
278
+ * @property {NumberExpression} [z-index] The zIndex of the style. (Canvas only)
261
279
  */
262
280
 
263
281
  /**
@@ -289,13 +307,13 @@ export function createDefaultStyle() {
289
307
  }
290
308
 
291
309
  /**
292
- * A rule is used to conditionally apply a style. If the rule's filter evaluates to true,
310
+ * A rule is used to conditionally apply a style. If the rule's filter evaluates to true,
293
311
  * the style will be applied.
294
312
  *
295
313
  * @typedef {Object} Rule
296
314
  * @property {FlatStyle|Array<FlatStyle>} style The style to be applied if the filter matches.
297
315
  * @property {import("../expr/expression.js").EncodedExpression} [filter] The filter used
298
- * to determine if a style applies. If no filter is included, the rule always applies
316
+ * to determine if a style applies. If no filter is included, the rule always applies
299
317
  * (unless it is an else rule).
300
318
  * @property {boolean} [else] If true, the rule applies only if no other previous rule applies.
301
319
  * If the else rule also has a filter, the rule will not apply if the filter does not match.
package/util.js CHANGED
@@ -33,4 +33,4 @@ export function getUid(obj) {
33
33
  * OpenLayers version.
34
34
  * @type {string}
35
35
  */
36
- export const VERSION = '10.3.2-dev.1734966546937';
36
+ export const VERSION = '10.3.2-dev.1735553764538';
@@ -26,18 +26,19 @@ export function computeHash(input: any | string): string;
26
26
  * @property {import("../render/webgl/VectorStyleRenderer.js").AttributeDefinitions} attributes Attribute definitions
27
27
  */
28
28
  /**
29
- * Parses a {@link import("../style/webgl.js").WebGLStyle} object and returns a {@link ShaderBuilder}
29
+ * Parses a {@link import("../style/flat.js").FlatStyle} object and returns a {@link ShaderBuilder}
30
30
  * object that has been configured according to the given style, as well as `attributes` and `uniforms`
31
31
  * arrays to be fed to the `WebGLPointsRenderer` class.
32
32
  *
33
33
  * Also returns `uniforms` and `attributes` properties as expected by the
34
34
  * {@link module:ol/renderer/webgl/PointsLayer~WebGLPointsLayerRenderer}.
35
35
  *
36
- * @param {import("../style/webgl.js").WebGLStyle} style Literal style.
37
- * @param {import('../style/flat.js').StyleVariables} variables Style variables.
36
+ * @param {import("../style/flat.js").FlatStyle} style Flat style.
37
+ * @param {import('../style/flat.js').StyleVariables} [variables] Style variables.
38
+ * @param {import("../expr/expression.js").EncodedExpression} [filter] Filter (if any)
38
39
  * @return {StyleParseResult} Result containing shader params, attributes and uniforms.
39
40
  */
40
- export function parseLiteralStyle(style: import("../style/webgl.js").WebGLStyle, variables: import("../style/flat.js").StyleVariables): StyleParseResult;
41
+ export function parseLiteralStyle(style: import("../style/flat.js").FlatStyle, variables?: import("../style/flat.js").StyleVariables, filter?: import("../expr/expression.js").EncodedExpression): StyleParseResult;
41
42
  export type StyleParseResult = {
42
43
  /**
43
44
  * Shader builder pre-configured according to a given style
@@ -1 +1 @@
1
- {"version":3,"file":"styleparser.d.ts","sourceRoot":"","sources":["styleparser.js"],"names":[],"mappings":"AA0BA;;;;;;;GAOG;AACH,qDALW,OAAO,gBAAgB,EAAE,kBAAkB,SAC3C,OAAO,uBAAuB,EAAE,iBAAiB,iBACjD,MAAM,GACL,MAAM,CAUjB;AAED;;;;GAIG;AACH,iCAHW,OAAO,aAAa,EAAE,KAAK,GAAC,MAAM,GACjC,KAAK,CAAC,MAAM,CAAC,CASxB;AAqCD;;;;GAIG;AACH,mCAHW,MAAO,MAAM,GACZ,MAAM,CAOjB;AA4uBD;;;;;GAKG;AAEH;;;;;;;;;;;GAWG;AACH,yCAJW,OAAO,mBAAmB,EAAE,UAAU,aACtC,OAAO,kBAAkB,EAAE,cAAc,GACxC,gBAAgB,CAoK3B;;;;;aAnLa,aAAa;;;;cACb,OAAO,wCAAwC,EAAE,kBAAkB;;;;gBACnE,OAAO,wCAAwC,EAAE,oBAAoB;;8BA/zBvD,oBAAoB"}
1
+ {"version":3,"file":"styleparser.d.ts","sourceRoot":"","sources":["styleparser.js"],"names":[],"mappings":"AA2BA;;;;;;;GAOG;AACH,qDALW,OAAO,gBAAgB,EAAE,kBAAkB,SAC3C,OAAO,uBAAuB,EAAE,iBAAiB,iBACjD,MAAM,GACL,MAAM,CAUjB;AAED;;;;GAIG;AACH,iCAHW,OAAO,aAAa,EAAE,KAAK,GAAC,MAAM,GACjC,KAAK,CAAC,MAAM,CAAC,CASxB;AAqCD;;;;GAIG;AACH,mCAHW,MAAO,MAAM,GACZ,MAAM,CAOjB;AAgvBD;;;;;GAKG;AAEH;;;;;;;;;;;;GAYG;AACH,yCALW,OAAO,kBAAkB,EAAE,SAAS,cACpC,OAAO,kBAAkB,EAAE,cAAc,WACzC,OAAO,uBAAuB,EAAE,iBAAiB,GAChD,gBAAgB,CAgK3B;;;;;aAhLa,aAAa;;;;cACb,OAAO,wCAAwC,EAAE,kBAAkB;;;;gBACnE,OAAO,wCAAwC,EAAE,oBAAoB;;8BAn0BvD,oBAAoB"}
@@ -2,6 +2,7 @@
2
2
  * Utilities for parsing literal style objects
3
3
  * @module ol/webgl/styleparser
4
4
  */
5
+ import {assert} from '../asserts.js';
5
6
  import {asArray} from '../color.js';
6
7
  import {
7
8
  BooleanType,
@@ -104,7 +105,7 @@ export function computeHash(input) {
104
105
  }
105
106
 
106
107
  /**
107
- * @param {import("../style/webgl.js").WebGLStyle} style Style
108
+ * @param {import("../style/flat.js").FlatStyle} style Style
108
109
  * @param {ShaderBuilder} builder Shader builder
109
110
  * @param {import("../expr/gpu.js").CompilationContext} vertContext Vertex shader compilation context
110
111
  * @param {'shape-'|'circle-'|'icon-'} prefix Properties prefix
@@ -196,7 +197,7 @@ function getColorFromDistanceField(
196
197
  /**
197
198
  * This will parse an image property provided by `<prefix>-src`
198
199
  * The image size expression in GLSL will be returned
199
- * @param {import("../style/webgl.js").WebGLStyle} style Style
200
+ * @param {import("../style/flat.js").FlatStyle} style Style
200
201
  * @param {ShaderBuilder} builder Shader builder
201
202
  * @param {Object<string,import("../webgl/Helper").UniformValue>} uniforms Uniforms
202
203
  * @param {'icon-'|'fill-pattern-'|'stroke-pattern-'} prefix Property prefix
@@ -209,7 +210,11 @@ function parseImageProperties(style, builder, uniforms, prefix, textureId) {
209
210
  style[`${prefix}cross-origin`] === undefined
210
211
  ? 'anonymous'
211
212
  : style[`${prefix}cross-origin`];
212
- image.src = style[`${prefix}src`];
213
+ assert(
214
+ typeof style[`${prefix}src`] === 'string',
215
+ `WebGL layers do not support expressions for the ${prefix}src style property`,
216
+ );
217
+ image.src = /** @type {string} */ (style[`${prefix}src`]);
213
218
 
214
219
  // the size is provided asynchronously using a uniform
215
220
  uniforms[`u_texture${textureId}_size`] = () => {
@@ -225,7 +230,7 @@ function parseImageProperties(style, builder, uniforms, prefix, textureId) {
225
230
 
226
231
  /**
227
232
  * This will parse an image's offset properties provided by `<prefix>-offset`, `<prefix>-offset-origin` and `<prefix>-size`
228
- * @param {import("../style/webgl.js").WebGLStyle} style Style
233
+ * @param {import("../style/flat.js").FlatStyle} style Style
229
234
  * @param {'icon-'|'fill-pattern-'|'stroke-pattern-'} prefix Property prefix
230
235
  * @param {import("../expr/gpu.js").CompilationContext} context Shader compilation context (vertex or fragment)
231
236
  * @param {string} imageSize Pixel size of the full image as a GLSL expression
@@ -262,7 +267,7 @@ function parseImageOffsetProperties(
262
267
  }
263
268
 
264
269
  /**
265
- * @param {import("../style/webgl.js").WebGLStyle} style Style
270
+ * @param {import("../style/flat.js").FlatStyle} style Style
266
271
  * @param {ShaderBuilder} builder Shader builder
267
272
  * @param {Object<string,import("../webgl/Helper").UniformValue>} uniforms Uniforms
268
273
  * @param {import("../expr/gpu.js").CompilationContext} vertContext Vertex shader compilation context
@@ -356,7 +361,7 @@ function parseCircleProperties(
356
361
  }
357
362
 
358
363
  /**
359
- * @param {import("../style/webgl.js").WebGLStyle} style Style
364
+ * @param {import("../style/flat.js").FlatStyle} style Style
360
365
  * @param {ShaderBuilder} builder Shader builder
361
366
  * @param {Object<string,import("../webgl/Helper").UniformValue>} uniforms Uniforms
362
367
  * @param {import("../expr/gpu.js").CompilationContext} vertContext Vertex shader compilation context
@@ -494,7 +499,7 @@ function parseShapeProperties(
494
499
  }
495
500
 
496
501
  /**
497
- * @param {import("../style/webgl.js").WebGLStyle} style Style
502
+ * @param {import("../style/flat.js").FlatStyle} style Style
498
503
  * @param {ShaderBuilder} builder Shader builder
499
504
  * @param {Object<string,import("../webgl/Helper").UniformValue>} uniforms Uniforms
500
505
  * @param {import("../expr/gpu.js").CompilationContext} vertContext Vertex shader compilation context
@@ -617,7 +622,7 @@ function parseIconProperties(
617
622
  }
618
623
 
619
624
  /**
620
- * @param {import("../style/webgl.js").WebGLStyle} style Style
625
+ * @param {import("../style/flat.js").FlatStyle} style Style
621
626
  * @param {ShaderBuilder} builder Shader Builder
622
627
  * @param {Object<string,import("../webgl/Helper").UniformValue>} uniforms Uniforms
623
628
  * @param {import("../expr/gpu.js").CompilationContext} vertContext Vertex shader compilation context
@@ -782,7 +787,7 @@ function parseStrokeProperties(
782
787
  }
783
788
 
784
789
  /**
785
- * @param {import("../style/webgl.js").WebGLStyle} style Style
790
+ * @param {import("../style/flat.js").FlatStyle} style Style
786
791
  * @param {ShaderBuilder} builder Shader Builder
787
792
  * @param {Object<string,import("../webgl/Helper").UniformValue>} uniforms Uniforms
788
793
  * @param {import("../expr/gpu.js").CompilationContext} vertContext Vertex shader compilation context
@@ -857,18 +862,19 @@ function parseFillProperties(
857
862
  */
858
863
 
859
864
  /**
860
- * Parses a {@link import("../style/webgl.js").WebGLStyle} object and returns a {@link ShaderBuilder}
865
+ * Parses a {@link import("../style/flat.js").FlatStyle} object and returns a {@link ShaderBuilder}
861
866
  * object that has been configured according to the given style, as well as `attributes` and `uniforms`
862
867
  * arrays to be fed to the `WebGLPointsRenderer` class.
863
868
  *
864
869
  * Also returns `uniforms` and `attributes` properties as expected by the
865
870
  * {@link module:ol/renderer/webgl/PointsLayer~WebGLPointsLayerRenderer}.
866
871
  *
867
- * @param {import("../style/webgl.js").WebGLStyle} style Literal style.
868
- * @param {import('../style/flat.js').StyleVariables} variables Style variables.
872
+ * @param {import("../style/flat.js").FlatStyle} style Flat style.
873
+ * @param {import('../style/flat.js').StyleVariables} [variables] Style variables.
874
+ * @param {import("../expr/expression.js").EncodedExpression} [filter] Filter (if any)
869
875
  * @return {StyleParseResult} Result containing shader params, attributes and uniforms.
870
876
  */
871
- export function parseLiteralStyle(style, variables) {
877
+ export function parseLiteralStyle(style, variables, filter) {
872
878
  const vertContext = newCompilationContext();
873
879
 
874
880
  /**
@@ -895,12 +901,8 @@ export function parseLiteralStyle(style, variables) {
895
901
  parseStrokeProperties(style, builder, uniforms, vertContext, fragContext);
896
902
  parseFillProperties(style, builder, uniforms, vertContext, fragContext);
897
903
 
898
- if (style.filter) {
899
- const parsedFilter = expressionToGlsl(
900
- fragContext,
901
- style.filter,
902
- BooleanType,
903
- );
904
+ if (filter) {
905
+ const parsedFilter = expressionToGlsl(fragContext, filter, BooleanType);
904
906
  builder.setFragmentDiscardExpression(`!${parsedFilter}`);
905
907
  }
906
908
 
package/style/webgl.d.ts DELETED
@@ -1,269 +0,0 @@
1
- export type ExpressionValue = import("../expr/expression.js").ExpressionValue;
2
- export type ColorExpression = import("../color.js").Color | string | Array<ExpressionValue>;
3
- export type BaseProps = {
4
- /**
5
- * Filter expression. If it resolves to a number strictly greater than 0, the
6
- * point will be displayed. If undefined, all points will show.
7
- */
8
- filter?: import("../expr/expression.js").ExpressionValue | undefined;
9
- };
10
- export type FillProps = {
11
- /**
12
- * Fill color.
13
- */
14
- "fill-color"?: ColorExpression | undefined;
15
- /**
16
- * Fill pattern image source URI. If `fill-color` is defined as well, it will be used to tint this image.
17
- */
18
- "fill-pattern-src"?: string | undefined;
19
- /**
20
- * Offset, which, together with the size and the offset origin, define the
21
- * sub-rectangle to use from the original fill pattern image.
22
- */
23
- "fill-pattern-offset"?: number[] | import("../expr/expression.js").ExpressionValue | undefined;
24
- /**
25
- * Origin of the offset: `bottom-left`, `bottom-right`,
26
- * `top-left` or `top-right`.
27
- */
28
- "fill-pattern-offset-origin"?: import("./Icon.js").IconOrigin | undefined;
29
- /**
30
- * Fill pattern image size in pixel. Can be used together with `fill-pattern-offset` to define the
31
- * sub-rectangle to use from the origin (sprite) fill pattern image.
32
- */
33
- "fill-pattern-size"?: import("../size.js").Size | import("../expr/expression.js").ExpressionValue | undefined;
34
- };
35
- export type StrokeProps = {
36
- /**
37
- * The stroke color.
38
- */
39
- "stroke-color"?: ColorExpression | undefined;
40
- /**
41
- * Stroke pixel width.
42
- */
43
- "stroke-width"?: import("../expr/expression.js").ExpressionValue | undefined;
44
- /**
45
- * Stroke offset in pixel. A positive value offsets the line to the right, relative to the direction of the line.
46
- */
47
- "stroke-offset"?: import("../expr/expression.js").ExpressionValue | undefined;
48
- /**
49
- * Line cap style: `butt`, `round`, or `square`.
50
- */
51
- "stroke-line-cap"?: string | number | boolean | any[] | import("../color.js").Color | undefined;
52
- /**
53
- * Line join style: `bevel`, `round`, or `miter`.
54
- */
55
- "stroke-line-join"?: string | number | boolean | any[] | import("../color.js").Color | undefined;
56
- /**
57
- * Line dash pattern.
58
- */
59
- "stroke-line-dash"?: number[] | import("../expr/expression.js").ExpressionValue[] | undefined;
60
- /**
61
- * Line dash offset.
62
- */
63
- "stroke-line-dash-offset"?: import("../expr/expression.js").ExpressionValue | undefined;
64
- /**
65
- * Miter limit.
66
- */
67
- "stroke-miter-limit"?: import("../expr/expression.js").ExpressionValue | undefined;
68
- /**
69
- * Stroke pattern image source URI. If `stroke-color` is defined as well, it will be used to tint this image.
70
- */
71
- "stroke-pattern-src"?: string | undefined;
72
- /**
73
- * Offset, which, together with the size and the offset origin, define the
74
- * sub-rectangle to use from the original fill pattern image.
75
- */
76
- "stroke-pattern-offset"?: number[] | import("../expr/expression.js").ExpressionValue | undefined;
77
- /**
78
- * Origin of the offset: `bottom-left`, `bottom-right`,
79
- * `top-left` or `top-right`.
80
- */
81
- "stroke-pattern-offset-origin"?: import("./Icon.js").IconOrigin | undefined;
82
- /**
83
- * Stroke pattern image size in pixel. Can be used together with `stroke-pattern-offset` to define the
84
- * sub-rectangle to use from the origin (sprite) fill pattern image.
85
- */
86
- "stroke-pattern-size"?: import("../size.js").Size | import("../expr/expression.js").ExpressionValue | undefined;
87
- /**
88
- * Spacing between each pattern occurrence in pixels; 0 if undefined.
89
- */
90
- "stroke-pattern-spacing"?: import("../expr/expression.js").ExpressionValue | undefined;
91
- };
92
- export type IconProps = {
93
- /**
94
- * Image source URI.
95
- */
96
- "icon-src"?: string | undefined;
97
- /**
98
- * Anchor. Default value is the icon center.
99
- */
100
- "icon-anchor"?: number[] | import("../expr/expression.js").ExpressionValue | undefined;
101
- /**
102
- * Origin of the anchor: `bottom-left`, `bottom-right`,
103
- * `top-left` or `top-right`.
104
- */
105
- "icon-anchor-origin"?: import("./Icon.js").IconOrigin | undefined;
106
- /**
107
- * Units in which the anchor x value is
108
- * specified. A value of `'fraction'` indicates the x value is a fraction of the icon. A value of `'pixels'` indicates
109
- * the x value in pixels.
110
- */
111
- "icon-anchor-x-units"?: import("./Icon.js").IconAnchorUnits | undefined;
112
- /**
113
- * Units in which the anchor y value is
114
- * specified. A value of `'fraction'` indicates the y value is a fraction of the icon. A value of `'pixels'` indicates
115
- * the y value in pixels.
116
- */
117
- "icon-anchor-y-units"?: import("./Icon.js").IconAnchorUnits | undefined;
118
- /**
119
- * Color to tint the icon. If not specified,
120
- * the icon will be left as is.
121
- */
122
- "icon-color"?: ColorExpression | undefined;
123
- /**
124
- * Opacity of the icon.
125
- */
126
- "icon-opacity"?: import("../expr/expression.js").ExpressionValue | undefined;
127
- /**
128
- * The `crossOrigin` attribute for loaded images. Note that you must provide a
129
- * `icon-cross-origin` value if you want to access pixel data with the Canvas renderer.
130
- * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.
131
- */
132
- "icon-cross-origin"?: string | null | undefined;
133
- /**
134
- * Displacement of the icon.
135
- */
136
- "icon-displacement"?: number[] | import("../expr/expression.js").ExpressionValue | undefined;
137
- /**
138
- * Scale.
139
- */
140
- "icon-scale"?: import("../size.js").Size | import("../expr/expression.js").ExpressionValue | undefined;
141
- /**
142
- * Width of the icon. If not specified, the actual image width will be used. Cannot be combined
143
- * with `scale`.
144
- */
145
- "icon-width"?: import("../expr/expression.js").ExpressionValue | undefined;
146
- /**
147
- * Height of the icon. If not specified, the actual image height will be used. Cannot be combined
148
- * with `scale`.
149
- */
150
- "icon-height"?: import("../expr/expression.js").ExpressionValue | undefined;
151
- /**
152
- * Rotation in radians (positive rotation clockwise).
153
- */
154
- "icon-rotation"?: import("../expr/expression.js").ExpressionValue | undefined;
155
- /**
156
- * Whether to rotate the icon with the view.
157
- */
158
- "icon-rotate-with-view"?: boolean | undefined;
159
- /**
160
- * Offset, which, together with the size and the offset origin, define the
161
- * sub-rectangle to use from the original icon image.
162
- */
163
- "icon-offset"?: number[] | import("../expr/expression.js").ExpressionValue | undefined;
164
- /**
165
- * Origin of the offset: `bottom-left`, `bottom-right`,
166
- * `top-left` or `top-right`.
167
- */
168
- "icon-offset-origin"?: import("./Icon.js").IconOrigin | undefined;
169
- /**
170
- * Icon size in pixel. Can be used together with `icon-offset` to define the
171
- * sub-rectangle to use from the origin (sprite) icon image.
172
- */
173
- "icon-size"?: import("../size.js").Size | import("../expr/expression.js").ExpressionValue | undefined;
174
- };
175
- export type ShapeProps = {
176
- /**
177
- * Number of points for stars and regular polygons. In case of a polygon, the number of points
178
- * is the number of sides.
179
- */
180
- "shape-points"?: import("../expr/expression.js").ExpressionValue | undefined;
181
- /**
182
- * The fill color.
183
- */
184
- "shape-fill-color"?: ColorExpression | undefined;
185
- /**
186
- * The stroke color.
187
- */
188
- "shape-stroke-color"?: ColorExpression | undefined;
189
- /**
190
- * Stroke pixel width.
191
- */
192
- "shape-stroke-width"?: import("../expr/expression.js").ExpressionValue | undefined;
193
- /**
194
- * Shape opacity.
195
- */
196
- "shape-opacity"?: import("../expr/expression.js").ExpressionValue | undefined;
197
- /**
198
- * Radius of a regular polygon.
199
- */
200
- "shape-radius"?: import("../expr/expression.js").ExpressionValue | undefined;
201
- /**
202
- * Second radius to make a star instead of a regular polygon.
203
- */
204
- "shape-radius2"?: import("../expr/expression.js").ExpressionValue | undefined;
205
- /**
206
- * Shape's angle in radians. A value of 0 will have one of the shape's point facing up.
207
- */
208
- "shape-angle"?: import("../expr/expression.js").ExpressionValue | undefined;
209
- /**
210
- * Displacement of the shape
211
- */
212
- "shape-displacement"?: number[] | import("../expr/expression.js").ExpressionValue[] | undefined;
213
- /**
214
- * Rotation in radians (positive rotation clockwise).
215
- */
216
- "shape-rotation"?: import("../expr/expression.js").ExpressionValue | undefined;
217
- /**
218
- * Whether to rotate the shape with the view.
219
- */
220
- "shape-rotate-with-view"?: boolean | undefined;
221
- /**
222
- * Scale. Unless two dimensional scaling is required a better
223
- * result may be obtained with appropriate settings for `shape-radius` and `shape-radius2`.
224
- */
225
- "shape-scale"?: import("../size.js").Size | import("../expr/expression.js").ExpressionValue | import("../expr/expression.js").ExpressionValue[] | undefined;
226
- };
227
- export type CircleProps = {
228
- /**
229
- * Circle radius.
230
- */
231
- "circle-radius"?: import("../expr/expression.js").ExpressionValue | undefined;
232
- /**
233
- * The fill color.
234
- */
235
- "circle-fill-color"?: ColorExpression | undefined;
236
- /**
237
- * The stroke color.
238
- */
239
- "circle-stroke-color"?: ColorExpression | undefined;
240
- /**
241
- * Stroke pixel width.
242
- */
243
- "circle-stroke-width"?: import("../expr/expression.js").ExpressionValue | undefined;
244
- /**
245
- * Circle opacity.
246
- */
247
- "circle-opacity"?: import("../expr/expression.js").ExpressionValue | undefined;
248
- /**
249
- * displacement
250
- */
251
- "circle-displacement"?: number[] | import("../expr/expression.js").ExpressionValue[] | undefined;
252
- /**
253
- * Scale. A two dimensional scale will produce an ellipse.
254
- * Unless two dimensional scaling is required a better result may be obtained with an appropriate setting for `circle-radius`.
255
- */
256
- "circle-scale"?: import("../size.js").Size | import("../expr/expression.js").ExpressionValue | import("../expr/expression.js").ExpressionValue[] | undefined;
257
- /**
258
- * Rotation in radians
259
- * (positive rotation clockwise, meaningful only when used in conjunction with a two dimensional scale).
260
- */
261
- "circle-rotation"?: import("../expr/expression.js").ExpressionValue | undefined;
262
- /**
263
- * Whether to rotate the shape with the view
264
- * (meaningful only when used in conjunction with a two dimensional scale).
265
- */
266
- "circle-rotate-with-view"?: boolean | undefined;
267
- };
268
- export type WebGLStyle = BaseProps & IconProps & StrokeProps & FillProps & CircleProps & ShapeProps;
269
- //# sourceMappingURL=webgl.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"webgl.d.ts","sourceRoot":"","sources":["webgl.js"],"names":[],"mappings":"8BAMa,OAAO,uBAAuB,EAAE,eAAe;8BAG/C,OAAO,aAAa,EAAE,KAAK,GAAC,MAAM,GAAC,KAAK,CAAC,eAAe,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAwHzD,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU"}