ol 7.5.1 → 8.0.0-dev.1692053484481
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/DataTile.d.ts +2 -2
- package/DataTile.d.ts.map +1 -1
- package/DataTile.js +3 -2
- package/Image.d.ts +139 -40
- package/Image.d.ts.map +1 -1
- package/Image.js +194 -96
- package/ImageCanvas.d.ts +2 -2
- package/ImageCanvas.d.ts.map +1 -1
- package/ImageCanvas.js +2 -2
- package/Object.d.ts +7 -0
- package/Object.d.ts.map +1 -1
- package/Object.js +8 -0
- package/dist/ol.js +2 -2
- package/dist/ol.js.map +1 -1
- package/expr/cpu.d.ts +71 -0
- package/expr/cpu.d.ts.map +1 -0
- package/expr/cpu.js +312 -0
- package/expr/expression.d.ts +97 -0
- package/expr/expression.d.ts.map +1 -0
- package/expr/expression.js +373 -0
- package/has.d.ts +5 -0
- package/has.d.ts.map +1 -1
- package/has.js +6 -0
- package/index.d.ts +1 -2
- package/index.js +1 -1
- package/layer/Base.d.ts +12 -8
- package/layer/Base.d.ts.map +1 -1
- package/layer/Base.js +12 -8
- package/layer/BaseVector.d.ts.map +1 -1
- package/layer/BaseVector.js +67 -33
- package/layer/Heatmap.d.ts.map +1 -1
- package/layer/Heatmap.js +16 -55
- package/layer/Layer.d.ts +2 -2
- package/layer/Layer.d.ts.map +1 -1
- package/layer/Layer.js +1 -1
- package/layer/WebGLPoints.d.ts +7 -12
- package/layer/WebGLPoints.d.ts.map +1 -1
- package/layer/WebGLPoints.js +7 -12
- package/package.json +1 -1
- package/render/Feature.d.ts +8 -0
- package/render/Feature.d.ts.map +1 -1
- package/render/Feature.js +9 -0
- package/render/canvas/Immediate.d.ts.map +1 -1
- package/render/canvas/Immediate.js +5 -3
- package/render/canvas/TextBuilder.js +2 -2
- package/render/canvas/style.d.ts +69 -0
- package/render/canvas/style.d.ts.map +1 -0
- package/render/canvas/style.js +1192 -0
- package/render/canvas.js +1 -1
- package/render/webgl/VectorStyleRenderer.d.ts.map +1 -1
- package/render/webgl/VectorStyleRenderer.js +4 -0
- package/renderer/Layer.d.ts +2 -2
- package/renderer/Layer.d.ts.map +1 -1
- package/renderer/Layer.js +1 -1
- package/renderer/canvas/ImageLayer.d.ts +4 -4
- package/renderer/canvas/ImageLayer.d.ts.map +1 -1
- package/renderer/canvas/ImageLayer.js +17 -12
- package/renderer/canvas/Layer.d.ts +2 -2
- package/renderer/canvas/Layer.d.ts.map +1 -1
- package/renderer/canvas/Layer.js +1 -1
- package/renderer/canvas/VectorImageLayer.d.ts.map +1 -1
- package/renderer/canvas/VectorImageLayer.js +3 -2
- package/renderer/webgl/VectorLayer.d.ts +1 -2
- package/renderer/webgl/VectorLayer.d.ts.map +1 -1
- package/reproj/Image.d.ts +5 -5
- package/reproj/Image.d.ts.map +1 -1
- package/reproj/Image.js +6 -6
- package/reproj.d.ts +2 -2
- package/reproj.d.ts.map +1 -1
- package/reproj.js +1 -1
- package/resolution.d.ts +13 -0
- package/resolution.d.ts.map +1 -0
- package/resolution.js +18 -0
- package/source/Image.d.ts +44 -7
- package/source/Image.d.ts.map +1 -1
- package/source/Image.js +97 -8
- package/source/ImageArcGISRest.d.ts +0 -23
- package/source/ImageArcGISRest.d.ts.map +1 -1
- package/source/ImageArcGISRest.js +18 -120
- package/source/ImageMapGuide.d.ts +0 -24
- package/source/ImageMapGuide.d.ts.map +1 -1
- package/source/ImageMapGuide.js +21 -113
- package/source/ImageStatic.d.ts +2 -27
- package/source/ImageStatic.d.ts.map +1 -1
- package/source/ImageStatic.js +20 -70
- package/source/ImageWMS.d.ts +2 -46
- package/source/ImageWMS.d.ts.map +1 -1
- package/source/ImageWMS.js +43 -201
- package/source/{Stamen.d.ts → StadiaMaps.d.ts} +17 -7
- package/source/StadiaMaps.d.ts.map +1 -0
- package/source/{Stamen.js → StadiaMaps.js} +85 -38
- package/source/TileArcGISRest.d.ts.map +1 -1
- package/source/TileArcGISRest.js +11 -22
- package/source/TileWMS.d.ts +0 -1
- package/source/TileWMS.d.ts.map +1 -1
- package/source/TileWMS.js +43 -106
- package/source/arcgisRest.d.ts +88 -0
- package/source/arcgisRest.d.ts.map +1 -0
- package/source/arcgisRest.js +131 -0
- package/source/common.d.ts +5 -0
- package/source/common.d.ts.map +1 -1
- package/source/common.js +6 -0
- package/source/mapguide.d.ts +52 -0
- package/source/mapguide.d.ts.map +1 -0
- package/source/mapguide.js +116 -0
- package/source/static.d.ts +45 -0
- package/source/static.d.ts.map +1 -0
- package/source/static.js +44 -0
- package/source/wms.d.ts +109 -1
- package/source/wms.d.ts.map +1 -1
- package/source/wms.js +170 -0
- package/source.d.ts +5 -1
- package/source.d.ts.map +1 -1
- package/source.js +5 -1
- package/style/flat.d.ts +332 -173
- package/style/flat.d.ts.map +1 -1
- package/style/flat.js +176 -248
- package/style/literal.d.ts +27 -72
- package/style/literal.d.ts.map +1 -1
- package/style/literal.js +14 -35
- package/util.d.ts.map +1 -1
- package/util.js +1 -1
- package/webgl/Helper.d.ts +7 -2
- package/webgl/Helper.d.ts.map +1 -1
- package/webgl/Helper.js +16 -27
- package/webgl/ShaderBuilder.d.ts +4 -14
- package/webgl/ShaderBuilder.d.ts.map +1 -1
- package/webgl/ShaderBuilder.js +72 -72
- package/webgl/styleparser.d.ts +3 -9
- package/webgl/styleparser.d.ts.map +1 -1
- package/webgl/styleparser.js +503 -88
- package/ImageBase.d.ts +0 -65
- package/ImageBase.d.ts.map +0 -1
- package/ImageBase.js +0 -98
- package/source/Stamen.d.ts.map +0 -1
package/style/flat.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flat.d.ts","sourceRoot":"","sources":["flat.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"flat.d.ts","sourceRoot":"","sources":["flat.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH;;;;GAIG;AAEH;;;;GAIG;AAEH;;;;GAIG;AAEH;;;;;GAKG;AAEH;;;;GAIG;AAEH;;;;GAIG;AAEH;;;;;;GAMG;AAEH;;;;GAIG;AAEH;;;;;GAKG;AAEH;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH;;;;;;;;;;;GAWG;AAEH;;GAEG;AACH,sCAFY,YAAY,CAYvB;;;;gCA1OY,OAAO,QAAM;;;;+BAMb,MAAM,QAAM;;;;+BAMZ,MAAM,QAAM;;;;;8BAOZ,OAAO,aAAa,EAAE,KAAK,GAAC,MAAM,QAAM;;;;oCAMxC,MAAM,MAAM,CAAC,QAAM;;;;6BAMnB,MAAM,GAAC,MAAM,MAAM,CAAC,QAAM;;;;;wBAQ1B,QAAQ,GAAG,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU;;;;4BAMpE,SAAS,GAAC,MAAM,SAAS,CAAC,GAAC,MAAM,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BA4GrC,WAAW,GAAC,UAAU,GAAC,MAAM,GAAC,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6BA2BvC,WAAW,GAAC,UAAU,GAAC,MAAM,GAAC,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BAwBvC,WAAW,GAAC,UAAU,GAAC,MAAM,GAAC,SAAS;;;;;;;;;;;;;kBAQvC,MAAM;;;;oBACN,MAAM;;;;oBACN,MAAM;;;;qBACN,MAAM;;;;yBACN,MAAM;;;;2BACN,MAAM;;;;2BACN,MAAM;;;;;;;;;;WAuBN,SAAS,GAAC,MAAM,SAAS,CAAC"}
|
package/style/flat.js
CHANGED
|
@@ -2,13 +2,83 @@
|
|
|
2
2
|
* @module ol/style/flat
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
/**
|
|
6
|
+
* @api
|
|
7
|
+
* @fileoverview Vector layers can be styled with an object literal containing properties for
|
|
8
|
+
* stroke, fill, image, and text styles. The types below can be composed into a single object.
|
|
9
|
+
* For example, a style with both stroke and fill properties could look like this:
|
|
10
|
+
*
|
|
11
|
+
* const style = {
|
|
12
|
+
* 'stroke-color': 'yellow',
|
|
13
|
+
* 'stroke-width': 1.5,
|
|
14
|
+
* 'fill-color': 'orange',
|
|
15
|
+
* };
|
|
16
|
+
*
|
|
17
|
+
* See details about the available properties depending on what type of symbolizer should be applied:
|
|
18
|
+
* * {@link module:ol/style/flat~FlatStroke Stroke} - properties for applying a stroke to lines and polygons
|
|
19
|
+
* * {@link module:ol/style/flat~FlatFill Fill} - properties for filling polygons
|
|
20
|
+
* * {@link module:ol/style/flat~FlatText Text} - properties for labeling points, lines, and polygons
|
|
21
|
+
* * {@link module:ol/style/flat~FlatIcon Icon} - properties for rendering points with an icon
|
|
22
|
+
* * {@link module:ol/style/flat~FlatCircle Circle} - properties for rendering points with a circle
|
|
23
|
+
* * {@link module:ol/style/flat~FlatShape Shape} - properties for rendering points with a regular shape
|
|
24
|
+
*
|
|
25
|
+
* To conditionally apply styles based on a filter, a list of {@link module:ol/style/flat~Rule rules} can be used.
|
|
26
|
+
* For example, to style points with a big orange circle if the population is greater than 1 million and
|
|
27
|
+
* a smaller blue circle otherwise:
|
|
28
|
+
*
|
|
29
|
+
* const rules = [
|
|
30
|
+
* {
|
|
31
|
+
* filter: ['>', 'population', 1_000_000],
|
|
32
|
+
* style: {
|
|
33
|
+
* 'circle-radius': 10,
|
|
34
|
+
* 'circle-color': 'red',
|
|
35
|
+
* }
|
|
36
|
+
* },
|
|
37
|
+
* {
|
|
38
|
+
* else: true,
|
|
39
|
+
* style: {
|
|
40
|
+
* 'circle-radius': 5,
|
|
41
|
+
* 'circle-color': 'blue',
|
|
42
|
+
* },
|
|
43
|
+
* ];
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* A literal boolean (e.g. `true`) or an expression that evaluates to a boolean (e.g. `['>', ['get', 'population'], 1_000_000]`).
|
|
48
|
+
*
|
|
49
|
+
* @typedef {boolean|Array} BooleanExpression
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* A literal string (e.g. `'hello'`) or an expression that evaluates to a string (e.g. `['get', 'greeting']`).
|
|
54
|
+
*
|
|
55
|
+
* @typedef {string|Array} StringExpression
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* A literal number (e.g. `42`) or an expression that evaluates to a number (e.g. `['+', 40, 2]`).
|
|
60
|
+
*
|
|
61
|
+
* @typedef {number|Array} NumberExpression
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* A CSS named color (e.g. `'blue'`), an array of 3 RGB values (e.g. `[0, 255, 0]`), an array of 4 RGBA values
|
|
66
|
+
* (e.g. `[0, 255, 0, 0.5]`), or an expression that evaluates to one of these color types (e.g. `['get', 'color']`).
|
|
67
|
+
*
|
|
68
|
+
* @typedef {import("../color.js").Color|string|Array} ColorExpression
|
|
69
|
+
*/
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* An array of numbers (e.g. `[1, 2, 3]`) or an expression that evaluates to the same (e.g. `['get', 'values']`).
|
|
73
|
+
*
|
|
74
|
+
* @typedef {Array<number>|Array} NumberArrayExpression
|
|
75
|
+
*/
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* An array of two numbers (e.g. `[10, 20]`) or an expression that evaluates to the same (e.g. `['get', 'size']`).
|
|
79
|
+
*
|
|
80
|
+
* @typedef {number|Array<number>|Array} SizeExpression
|
|
81
|
+
*/
|
|
12
82
|
|
|
13
83
|
/**
|
|
14
84
|
* For static styling, the [layer.setStyle()]{@link module:ol/layer/Vector~VectorLayer#setStyle} method
|
|
@@ -21,14 +91,14 @@ import Text from './Text.js';
|
|
|
21
91
|
/**
|
|
22
92
|
* A flat style literal or an array of the same.
|
|
23
93
|
*
|
|
24
|
-
* @typedef {FlatStyle|Array<FlatStyle>} FlatStyleLike
|
|
94
|
+
* @typedef {FlatStyle|Array<FlatStyle>|Array<Rule>} FlatStyleLike
|
|
25
95
|
*/
|
|
26
96
|
|
|
27
97
|
/**
|
|
28
98
|
* Fill style properties applied to polygon features.
|
|
29
99
|
*
|
|
30
100
|
* @typedef {Object} FlatFill
|
|
31
|
-
* @property {
|
|
101
|
+
* @property {ColorExpression} [fill-color] The fill color.
|
|
32
102
|
*/
|
|
33
103
|
|
|
34
104
|
/**
|
|
@@ -36,65 +106,62 @@ import Text from './Text.js';
|
|
|
36
106
|
* `stroke-color` or `stroke-width` must be provided.
|
|
37
107
|
*
|
|
38
108
|
* @typedef {Object} FlatStroke
|
|
39
|
-
* @property {
|
|
40
|
-
* @property {
|
|
41
|
-
* @property {
|
|
42
|
-
* @property {
|
|
43
|
-
* @property {
|
|
44
|
-
* @property {
|
|
45
|
-
* @property {
|
|
109
|
+
* @property {ColorExpression} [stroke-color] The stroke color.
|
|
110
|
+
* @property {NumberExpression} [stroke-width] Stroke pixel width.
|
|
111
|
+
* @property {StringExpression} [stroke-line-cap='round'] Line cap style: `butt`, `round`, or `square`.
|
|
112
|
+
* @property {StringExpression} [stroke-line-join='round'] Line join style: `bevel`, `round`, or `miter`.
|
|
113
|
+
* @property {NumberArrayExpression} [stroke-line-dash] Line dash pattern.
|
|
114
|
+
* @property {NumberExpression} [stroke-line-dash-offset=0] Line dash offset.
|
|
115
|
+
* @property {NumberExpression} [stroke-miter-limit=10] Miter limit.
|
|
116
|
+
* @property {NumberExpression} [z-index] The zIndex of the style.
|
|
46
117
|
*/
|
|
47
118
|
|
|
48
119
|
/**
|
|
49
120
|
* Label style properties applied to all features. At a minimum, a `text-value` must be provided.
|
|
50
121
|
*
|
|
51
122
|
* @typedef {Object} FlatText
|
|
52
|
-
* @property {
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
* **Example:** `['foo', 'bold 10px sans-serif', ' bar', 'italic 10px sans-serif', ' baz', '']` will yield "**foo** *bar* baz".
|
|
56
|
-
* **Note:** Rich text is not supported for `'text-placement': 'line'` or the immediate rendering API.
|
|
57
|
-
* @property {string} [text-font] Font style as CSS `font` value, see:
|
|
58
|
-
* https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/font. Default is `'10px sans-serif'`
|
|
59
|
-
* @property {number} [text-max-angle=Math.PI/4] When `text-placement` is set to `'line'`, allow a maximum angle between adjacent characters.
|
|
123
|
+
* @property {StringExpression} [text-value] Text content (with `\n` for line breaks).
|
|
124
|
+
* @property {StringExpression} [text-font='10px sans-serif'] Font style as [CSS `font`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/font) value.
|
|
125
|
+
* @property {NumberExpression} [text-max-angle=Math.PI/4] When `text-placement` is set to `'line'`, allow a maximum angle between adjacent characters.
|
|
60
126
|
* The expected value is in radians, and the default is 45° (`Math.PI / 4`).
|
|
61
|
-
* @property {
|
|
62
|
-
* @property {
|
|
63
|
-
* @property {
|
|
127
|
+
* @property {NumberExpression} [text-offset-x=0] Horizontal text offset in pixels. A positive will shift the text right.
|
|
128
|
+
* @property {NumberExpression} [text-offset-y=0] Vertical text offset in pixels. A positive will shift the text down.
|
|
129
|
+
* @property {BooleanExpression} [text-overflow=false] For polygon labels or when `placement` is set to `'line'`, allow text to exceed
|
|
64
130
|
* the width of the polygon at the label position or the length of the path that it follows.
|
|
65
|
-
* @property {
|
|
66
|
-
* @property {
|
|
131
|
+
* @property {StringExpression} [text-placement='point'] Text placement.
|
|
132
|
+
* @property {NumberExpression} [text-repeat] Repeat interval in pixels. When set, the text will be repeated at this interval. Only available when
|
|
67
133
|
* `text-placement` is set to `'line'`. Overrides `text-align`.
|
|
68
|
-
* @property {
|
|
69
|
-
* @property {
|
|
70
|
-
* @property {
|
|
71
|
-
* @property {
|
|
134
|
+
* @property {SizeExpression} [text-scale] Scale.
|
|
135
|
+
* @property {BooleanExpression} [text-rotate-with-view=false] Whether to rotate the text with the view.
|
|
136
|
+
* @property {NumberExpression} [text-rotation=0] Rotation in radians (positive rotation clockwise).
|
|
137
|
+
* @property {StringExpression} [text-align] Text alignment. Possible values: `'left'`, `'right'`, `'center'`, `'end'` or `'start'`.
|
|
72
138
|
* Default is `'center'` for `'text-placement': 'point'`. For `'text-placement': 'line'`, the default is to let the renderer choose a
|
|
73
139
|
* placement where `text-max-angle` is not exceeded.
|
|
74
|
-
* @property {
|
|
140
|
+
* @property {StringExpression} [text-justify] Text justification within the text box.
|
|
75
141
|
* If not set, text is justified towards the `textAlign` anchor.
|
|
76
142
|
* Otherwise, use options `'left'`, `'center'`, or `'right'` to justify the text within the text box.
|
|
77
143
|
* **Note:** `text-justify` is ignored for immediate rendering and also for `'text-placement': 'line'`.
|
|
78
|
-
* @property {
|
|
144
|
+
* @property {StringExpression} [text-baseline='middle'] Text base line. Possible values: `'bottom'`, `'top'`, `'middle'`, `'alphabetic'`,
|
|
79
145
|
* `'hanging'`, `'ideographic'`.
|
|
80
|
-
* @property {
|
|
146
|
+
* @property {NumberArrayExpression} [text-padding=[0, 0, 0, 0]] Padding in pixels around the text for decluttering and background. The order of
|
|
81
147
|
* values in the array is `[top, right, bottom, left]`.
|
|
82
|
-
* @property {
|
|
83
|
-
* @property {
|
|
84
|
-
* @property {
|
|
85
|
-
* @property {
|
|
86
|
-
* @property {
|
|
87
|
-
* @property {
|
|
88
|
-
* @property {
|
|
89
|
-
* @property {
|
|
90
|
-
* @property {
|
|
91
|
-
* @property {
|
|
92
|
-
* @property {
|
|
93
|
-
* @property {
|
|
94
|
-
* @property {
|
|
95
|
-
* @property {
|
|
96
|
-
* @property {
|
|
97
|
-
* @property {
|
|
148
|
+
* @property {ColorExpression} [text-fill-color] The fill color. Specify `'none'` to avoid hit detection on the fill.
|
|
149
|
+
* @property {ColorExpression} [text-background-fill-color] The fill color.
|
|
150
|
+
* @property {ColorExpression} [text-stroke-color] The stroke color.
|
|
151
|
+
* @property {StringExpression} [text-stroke-line-cap='round'] Line cap style: `butt`, `round`, or `square`.
|
|
152
|
+
* @property {StringExpression} [text-stroke-line-join='round'] Line join style: `bevel`, `round`, or `miter`.
|
|
153
|
+
* @property {NumberArrayExpression} [text-stroke-line-dash] Line dash pattern.
|
|
154
|
+
* @property {NumberExpression} [text-stroke-line-dash-offset=0] Line dash offset.
|
|
155
|
+
* @property {NumberExpression} [text-stroke-miter-limit=10] Miter limit.
|
|
156
|
+
* @property {NumberExpression} [text-stroke-width] Stroke pixel width.
|
|
157
|
+
* @property {ColorExpression} [text-background-stroke-color] The stroke color.
|
|
158
|
+
* @property {StringExpression} [text-background-stroke-line-cap='round'] Line cap style: `butt`, `round`, or `square`.
|
|
159
|
+
* @property {StringExpression} [text-background-stroke-line-join='round'] Line join style: `bevel`, `round`, or `miter`.
|
|
160
|
+
* @property {NumberArrayExpression} [text-background-stroke-line-dash] Line dash pattern.
|
|
161
|
+
* @property {NumberExpression} [text-background-stroke-line-dash-offset=0] Line dash offset.
|
|
162
|
+
* @property {NumberExpression} [text-background-stroke-miter-limit=10] Miter limit.
|
|
163
|
+
* @property {NumberExpression} [text-background-stroke-width] Stroke pixel width.
|
|
164
|
+
* @property {NumberExpression} [z-index] The zIndex of the style.
|
|
98
165
|
*/
|
|
99
166
|
|
|
100
167
|
/**
|
|
@@ -103,12 +170,7 @@ import Text from './Text.js';
|
|
|
103
170
|
*
|
|
104
171
|
* @typedef {Object} FlatIcon
|
|
105
172
|
* @property {string} [icon-src] Image source URI.
|
|
106
|
-
* @property {
|
|
107
|
-
* provided image must already be loaded. And in that case, it is required
|
|
108
|
-
* to provide the size of the image, with the `icon-img-size` option.
|
|
109
|
-
* @property {import("../size.js").Size} [icon-img-size] Image size in pixels. Only required if `icon-img` is set and `icon-src` is not.
|
|
110
|
-
* The provided size needs to match the actual size of the image.
|
|
111
|
-
* @property {Array<number>} [icon-anchor=[0.5, 0.5]] Anchor. Default value is the icon center.
|
|
173
|
+
* @property {NumberArrayExpression} [icon-anchor=[0.5, 0.5]] Anchor. Default value is the icon center.
|
|
112
174
|
* @property {import("./Icon.js").IconOrigin} [icon-anchor-origin='top-left'] Origin of the anchor: `bottom-left`, `bottom-right`,
|
|
113
175
|
* `top-left` or `top-right`.
|
|
114
176
|
* @property {import("./Icon.js").IconAnchorUnits} [icon-anchor-x-units='fraction'] Units in which the anchor x value is
|
|
@@ -124,20 +186,21 @@ import Text from './Text.js';
|
|
|
124
186
|
* See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.
|
|
125
187
|
* @property {Array<number>} [icon-offset=[0, 0]] Offset, which, together with the size and the offset origin, define the
|
|
126
188
|
* sub-rectangle to use from the original icon image.
|
|
127
|
-
* @property {
|
|
189
|
+
* @property {NumberArrayExpression} [icon-displacement=[0,0]] Displacement of the icon.
|
|
128
190
|
* @property {import("./Icon.js").IconOrigin} [icon-offset-origin='top-left'] Origin of the offset: `bottom-left`, `bottom-right`,
|
|
129
191
|
* `top-left` or `top-right`.
|
|
130
|
-
* @property {
|
|
131
|
-
* @property {
|
|
192
|
+
* @property {NumberExpression} [icon-opacity=1] Opacity of the icon.
|
|
193
|
+
* @property {SizeExpression} [icon-scale=1] Scale.
|
|
132
194
|
* @property {number} [icon-width] Width of the icon. If not specified, the actual image width will be used. Cannot be combined
|
|
133
195
|
* with `scale`.
|
|
134
196
|
* @property {number} [icon-height] Height of the icon. If not specified, the actual image height will be used. Cannot be combined
|
|
135
197
|
* with `scale`.
|
|
136
|
-
* @property {
|
|
137
|
-
* @property {
|
|
198
|
+
* @property {NumberExpression} [icon-rotation=0] Rotation in radians (positive rotation clockwise).
|
|
199
|
+
* @property {BooleanExpression} [icon-rotate-with-view=false] Whether to rotate the icon with the view.
|
|
138
200
|
* @property {import("../size.js").Size} [icon-size] Icon size in pixel. Can be used together with `icon-offset` to define the
|
|
139
201
|
* sub-rectangle to use from the origin (sprite) icon image.
|
|
140
202
|
* @property {"declutter"|"obstacle"|"none"|undefined} [icon-declutter-mode] Declutter mode
|
|
203
|
+
* @property {NumberExpression} [z-index] The zIndex of the style.
|
|
141
204
|
*/
|
|
142
205
|
|
|
143
206
|
/**
|
|
@@ -146,24 +209,25 @@ import Text from './Text.js';
|
|
|
146
209
|
* @typedef {Object} FlatShape
|
|
147
210
|
* @property {number} [shape-points] Number of points for stars and regular polygons. In case of a polygon, the number of points
|
|
148
211
|
* is the number of sides.
|
|
149
|
-
* @property {
|
|
150
|
-
* @property {
|
|
151
|
-
* @property {
|
|
152
|
-
* @property {
|
|
153
|
-
* @property {
|
|
154
|
-
* @property {
|
|
155
|
-
* @property {
|
|
156
|
-
* @property {
|
|
212
|
+
* @property {ColorExpression} [shape-fill-color] The fill color.
|
|
213
|
+
* @property {ColorExpression} [shape-stroke-color] The stroke color.
|
|
214
|
+
* @property {NumberExpression} [shape-stroke-width] Stroke pixel width.
|
|
215
|
+
* @property {StringExpression} [shape-stroke-line-cap='round'] Line cap style: `butt`, `round`, or `square`.
|
|
216
|
+
* @property {StringExpression} [shape-stroke-line-join='round'] Line join style: `bevel`, `round`, or `miter`.
|
|
217
|
+
* @property {NumberArrayExpression} [shape-stroke-line-dash] Line dash pattern.
|
|
218
|
+
* @property {NumberExpression} [shape-stroke-line-dash-offset=0] Line dash offset.
|
|
219
|
+
* @property {NumberExpression} [shape-stroke-miter-limit=10] Miter limit.
|
|
157
220
|
* @property {number} [shape-radius] Radius of a regular polygon.
|
|
158
221
|
* @property {number} [shape-radius1] First radius of a star. Ignored if radius is set.
|
|
159
222
|
* @property {number} [shape-radius2] Second radius of a star.
|
|
160
223
|
* @property {number} [shape-angle=0] Shape's angle in radians. A value of 0 will have one of the shape's point facing up.
|
|
161
|
-
* @property {
|
|
162
|
-
* @property {
|
|
163
|
-
* @property {
|
|
164
|
-
* @property {
|
|
224
|
+
* @property {NumberArrayExpression} [shape-displacement=[0,0]] Displacement of the shape
|
|
225
|
+
* @property {NumberExpression} [shape-rotation=0] Rotation in radians (positive rotation clockwise).
|
|
226
|
+
* @property {BooleanExpression} [shape-rotate-with-view=false] Whether to rotate the shape with the view.
|
|
227
|
+
* @property {SizeExpression} [shape-scale=1] Scale. Unless two dimensional scaling is required a better
|
|
165
228
|
* result may be obtained with appropriate settings for `shape-radius`, `shape-radius1` and `shape-radius2`.
|
|
166
229
|
* @property {"declutter"|"obstacle"|"none"|undefined} [shape-declutter-mode] Declutter mode.
|
|
230
|
+
* @property {NumberExpression} [z-index] The zIndex of the style.
|
|
167
231
|
*/
|
|
168
232
|
|
|
169
233
|
/**
|
|
@@ -171,189 +235,40 @@ import Text from './Text.js';
|
|
|
171
235
|
*
|
|
172
236
|
* @typedef {Object} FlatCircle
|
|
173
237
|
* @property {number} [circle-radius] Circle radius.
|
|
174
|
-
* @property {
|
|
175
|
-
* @property {
|
|
176
|
-
* @property {
|
|
177
|
-
* @property {
|
|
178
|
-
* @property {
|
|
179
|
-
* @property {
|
|
180
|
-
* @property {
|
|
181
|
-
* @property {
|
|
182
|
-
* @property {
|
|
183
|
-
* @property {
|
|
238
|
+
* @property {ColorExpression} [circle-fill-color] The fill color.
|
|
239
|
+
* @property {ColorExpression} [circle-stroke-color] The stroke color.
|
|
240
|
+
* @property {NumberExpression} [circle-stroke-width] Stroke pixel width.
|
|
241
|
+
* @property {StringExpression} [circle-stroke-line-cap='round'] Line cap style: `butt`, `round`, or `square`.
|
|
242
|
+
* @property {StringExpression} [circle-stroke-line-join='round'] Line join style: `bevel`, `round`, or `miter`.
|
|
243
|
+
* @property {NumberArrayExpression} [circle-stroke-line-dash] Line dash pattern.
|
|
244
|
+
* @property {NumberExpression} [circle-stroke-line-dash-offset=0] Line dash offset.
|
|
245
|
+
* @property {NumberExpression} [circle-stroke-miter-limit=10] Miter limit.
|
|
246
|
+
* @property {NumberArrayExpression} [circle-displacement=[0,0]] displacement
|
|
247
|
+
* @property {SizeExpression} [circle-scale=1] Scale. A two dimensional scale will produce an ellipse.
|
|
184
248
|
* Unless two dimensional scaling is required a better result may be obtained with an appropriate setting for `circle-radius`.
|
|
185
|
-
* @property {
|
|
249
|
+
* @property {NumberExpression} [circle-rotation=0] Rotation in radians
|
|
186
250
|
* (positive rotation clockwise, meaningful only when used in conjunction with a two dimensional scale).
|
|
187
|
-
* @property {
|
|
251
|
+
* @property {BooleanExpression} [circle-rotate-with-view=false] Whether to rotate the shape with the view
|
|
188
252
|
* (meaningful only when used in conjunction with a two dimensional scale).
|
|
189
253
|
* @property {"declutter"|"obstacle"|"none"|undefined} [circle-declutter-mode] Declutter mode
|
|
254
|
+
* @property {NumberExpression} [z-index] The zIndex of the style.
|
|
190
255
|
*/
|
|
191
256
|
|
|
192
257
|
/**
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
return style;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* @param {FlatStyle} flatStyle The flat style.
|
|
209
|
-
* @param {string} prefix The property prefix.
|
|
210
|
-
* @return {Fill|null|undefined} The fill (if any).
|
|
211
|
-
*/
|
|
212
|
-
function getFill(flatStyle, prefix) {
|
|
213
|
-
const color = flatStyle[prefix + 'fill-color'];
|
|
214
|
-
if (!color) {
|
|
215
|
-
return;
|
|
216
|
-
}
|
|
217
|
-
if (color === 'none') {
|
|
218
|
-
return null;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
return new Fill({color: color});
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* @param {FlatStyle} flatStyle The flat style.
|
|
226
|
-
* @param {string} prefix The property prefix.
|
|
227
|
-
* @return {Stroke|undefined} The stroke (if any).
|
|
228
|
-
*/
|
|
229
|
-
function getStroke(flatStyle, prefix) {
|
|
230
|
-
const width = flatStyle[prefix + 'stroke-width'];
|
|
231
|
-
const color = flatStyle[prefix + 'stroke-color'];
|
|
232
|
-
if (!width && !color) {
|
|
233
|
-
return;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
return new Stroke({
|
|
237
|
-
width: width,
|
|
238
|
-
color: color,
|
|
239
|
-
lineCap: flatStyle[prefix + 'stroke-line-cap'],
|
|
240
|
-
lineJoin: flatStyle[prefix + 'stroke-line-join'],
|
|
241
|
-
lineDash: flatStyle[prefix + 'stroke-line-dash'],
|
|
242
|
-
lineDashOffset: flatStyle[prefix + 'stroke-line-dash-offset'],
|
|
243
|
-
miterLimit: flatStyle[prefix + 'stroke-miter-limit'],
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* @param {FlatStyle} flatStyle The flat style.
|
|
249
|
-
* @return {Text|undefined} The text (if any).
|
|
250
|
-
*/
|
|
251
|
-
function getText(flatStyle) {
|
|
252
|
-
const value = flatStyle['text-value'];
|
|
253
|
-
if (!value) {
|
|
254
|
-
return;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
const text = new Text({
|
|
258
|
-
text: value,
|
|
259
|
-
font: flatStyle['text-font'],
|
|
260
|
-
maxAngle: flatStyle['text-max-angle'],
|
|
261
|
-
offsetX: flatStyle['text-offset-x'],
|
|
262
|
-
offsetY: flatStyle['text-offset-y'],
|
|
263
|
-
overflow: flatStyle['text-overflow'],
|
|
264
|
-
placement: flatStyle['text-placement'],
|
|
265
|
-
repeat: flatStyle['text-repeat'],
|
|
266
|
-
scale: flatStyle['text-scale'],
|
|
267
|
-
rotateWithView: flatStyle['text-rotate-with-view'],
|
|
268
|
-
rotation: flatStyle['text-rotation'],
|
|
269
|
-
textAlign: flatStyle['text-align'],
|
|
270
|
-
justify: flatStyle['text-justify'],
|
|
271
|
-
textBaseline: flatStyle['text-baseline'],
|
|
272
|
-
padding: flatStyle['text-padding'],
|
|
273
|
-
fill: getFill(flatStyle, 'text-'),
|
|
274
|
-
backgroundFill: getFill(flatStyle, 'text-background-'),
|
|
275
|
-
stroke: getStroke(flatStyle, 'text-'),
|
|
276
|
-
backgroundStroke: getStroke(flatStyle, 'text-background-'),
|
|
277
|
-
});
|
|
278
|
-
|
|
279
|
-
return text;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* @param {FlatStyle} flatStyle The flat style.
|
|
284
|
-
* @return {import("./Image.js").default|undefined} The image (if any).
|
|
258
|
+
* These default style properties are applied when no other style is given.
|
|
259
|
+
*
|
|
260
|
+
* @typedef {Object} DefaultStyle
|
|
261
|
+
* @property {string} fill-color `'rgba(255,255,255,0.4)'`
|
|
262
|
+
* @property {string} stroke-color `'#3399CC'`
|
|
263
|
+
* @property {number} stroke-width `1.25`
|
|
264
|
+
* @property {number} circle-radius `5`
|
|
265
|
+
* @property {string} circle-fill-color `'rgba(255,255,255,0.4)'`
|
|
266
|
+
* @property {number} circle-stroke-width `1.25`
|
|
267
|
+
* @property {string} circle-stroke-color `'#3399CC'`
|
|
285
268
|
*/
|
|
286
|
-
function getImage(flatStyle) {
|
|
287
|
-
const iconSrc = flatStyle['icon-src'];
|
|
288
|
-
const iconImg = flatStyle['icon-img'];
|
|
289
|
-
if (iconSrc || iconImg) {
|
|
290
|
-
const icon = new Icon({
|
|
291
|
-
src: iconSrc,
|
|
292
|
-
img: iconImg,
|
|
293
|
-
imgSize: flatStyle['icon-img-size'],
|
|
294
|
-
anchor: flatStyle['icon-anchor'],
|
|
295
|
-
anchorOrigin: flatStyle['icon-anchor-origin'],
|
|
296
|
-
anchorXUnits: flatStyle['icon-anchor-x-units'],
|
|
297
|
-
anchorYUnits: flatStyle['icon-anchor-y-units'],
|
|
298
|
-
color: flatStyle['icon-color'],
|
|
299
|
-
crossOrigin: flatStyle['icon-cross-origin'],
|
|
300
|
-
offset: flatStyle['icon-offset'],
|
|
301
|
-
displacement: flatStyle['icon-displacement'],
|
|
302
|
-
opacity: flatStyle['icon-opacity'],
|
|
303
|
-
scale: flatStyle['icon-scale'],
|
|
304
|
-
width: flatStyle['icon-width'],
|
|
305
|
-
height: flatStyle['icon-height'],
|
|
306
|
-
rotation: flatStyle['icon-rotation'],
|
|
307
|
-
rotateWithView: flatStyle['icon-rotate-with-view'],
|
|
308
|
-
size: flatStyle['icon-size'],
|
|
309
|
-
declutterMode: flatStyle['icon-declutter-mode'],
|
|
310
|
-
});
|
|
311
|
-
return icon;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
const shapePoints = flatStyle['shape-points'];
|
|
315
|
-
if (shapePoints) {
|
|
316
|
-
const prefix = 'shape-';
|
|
317
|
-
const shape = new RegularShape({
|
|
318
|
-
points: shapePoints,
|
|
319
|
-
fill: getFill(flatStyle, prefix),
|
|
320
|
-
stroke: getStroke(flatStyle, prefix),
|
|
321
|
-
radius: flatStyle['shape-radius'],
|
|
322
|
-
radius1: flatStyle['shape-radius1'],
|
|
323
|
-
radius2: flatStyle['shape-radius2'],
|
|
324
|
-
angle: flatStyle['shape-angle'],
|
|
325
|
-
displacement: flatStyle['shape-displacement'],
|
|
326
|
-
rotation: flatStyle['shape-rotation'],
|
|
327
|
-
rotateWithView: flatStyle['shape-rotate-with-view'],
|
|
328
|
-
scale: flatStyle['shape-scale'],
|
|
329
|
-
declutterMode: flatStyle['shape-declutter-mode'],
|
|
330
|
-
});
|
|
331
|
-
|
|
332
|
-
return shape;
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
const circleRadius = flatStyle['circle-radius'];
|
|
336
|
-
if (circleRadius) {
|
|
337
|
-
const prefix = 'circle-';
|
|
338
|
-
const circle = new Circle({
|
|
339
|
-
radius: circleRadius,
|
|
340
|
-
fill: getFill(flatStyle, prefix),
|
|
341
|
-
stroke: getStroke(flatStyle, prefix),
|
|
342
|
-
displacement: flatStyle['circle-displacement'],
|
|
343
|
-
scale: flatStyle['circle-scale'],
|
|
344
|
-
rotation: flatStyle['circle-rotation'],
|
|
345
|
-
rotateWithView: flatStyle['circle-rotate-with-view'],
|
|
346
|
-
declutterMode: flatStyle['circle-declutter-mode'],
|
|
347
|
-
});
|
|
348
|
-
|
|
349
|
-
return circle;
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
return;
|
|
353
|
-
}
|
|
354
269
|
|
|
355
270
|
/**
|
|
356
|
-
* @return {
|
|
271
|
+
* @return {DefaultStyle} The default flat style.
|
|
357
272
|
*/
|
|
358
273
|
export function createDefaultStyle() {
|
|
359
274
|
return {
|
|
@@ -366,3 +281,16 @@ export function createDefaultStyle() {
|
|
|
366
281
|
'circle-stroke-color': '#3399CC',
|
|
367
282
|
};
|
|
368
283
|
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* A rule is used to conditionally apply a style. If the rule's filter evaluates to true,
|
|
287
|
+
* the style will be applied.
|
|
288
|
+
*
|
|
289
|
+
* @typedef {Object} Rule
|
|
290
|
+
* @property {FlatStyle|Array<FlatStyle>} style The style to be applied if the filter matches.
|
|
291
|
+
* @property {import("../expr/expression.js").EncodedExpression} [filter] The filter used
|
|
292
|
+
* to determine if a style applies. If no filter is included, the rule always applies
|
|
293
|
+
* (unless it is an else rule).
|
|
294
|
+
* @property {boolean} [else] If true, the rule applies only if no other previous rule applies.
|
|
295
|
+
* If the else rule also has a filter, the rule will not apply if the filter does not match.
|
|
296
|
+
*/
|