ol 7.3.1-dev.1681144772646 → 7.3.1-dev.1681303152721
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/dist/ol.js +2 -2
- package/dist/ol.js.map +1 -1
- package/layer/WebGLPoints.d.ts +1 -1
- package/layer/WebGLPoints.js +2 -2
- package/package.json +1 -1
- package/render/canvas/Immediate.d.ts.map +1 -1
- package/render/canvas/Immediate.js +9 -1
- package/renderer/webgl/VectorLayer.d.ts +1 -1
- package/renderer/webgl/shaders.js +7 -7
- package/style/literal.d.ts +203 -2
- package/style/literal.d.ts.map +1 -1
- package/style/literal.js +105 -2
- package/util.js +1 -1
- package/webgl/Helper.d.ts +1 -1
- package/webgl/Helper.d.ts.map +1 -1
- package/webgl/Helper.js +5 -2
- package/webgl/ShaderBuilder.d.ts +58 -60
- package/webgl/ShaderBuilder.d.ts.map +1 -1
- package/webgl/ShaderBuilder.js +341 -227
- package/webgl/styleparser.d.ts +57 -0
- package/webgl/styleparser.d.ts.map +1 -0
- package/webgl/styleparser.js +318 -0
package/layer/WebGLPoints.d.ts
CHANGED
|
@@ -136,7 +136,7 @@ declare class WebGLPointsLayer<VectorSourceType extends import("../source/Vector
|
|
|
136
136
|
constructor(options: Options<VectorSourceType>);
|
|
137
137
|
/**
|
|
138
138
|
* @private
|
|
139
|
-
* @type {import('../webgl/
|
|
139
|
+
* @type {import('../webgl/styleparser.js').StyleParseResult}
|
|
140
140
|
*/
|
|
141
141
|
private parseResult_;
|
|
142
142
|
/**
|
package/layer/WebGLPoints.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import Layer from './Layer.js';
|
|
5
5
|
import WebGLPointsLayerRenderer from '../renderer/webgl/PointsLayer.js';
|
|
6
|
-
import {parseLiteralStyle} from '../webgl/
|
|
6
|
+
import {parseLiteralStyle} from '../webgl/styleparser.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @template {import("../source/Vector.js").default<import("../geom/Point.js").default>} VectorSourceType
|
|
@@ -82,7 +82,7 @@ class WebGLPointsLayer extends Layer {
|
|
|
82
82
|
|
|
83
83
|
/**
|
|
84
84
|
* @private
|
|
85
|
-
* @type {import('../webgl/
|
|
85
|
+
* @type {import('../webgl/styleparser.js').StyleParseResult}
|
|
86
86
|
*/
|
|
87
87
|
this.parseResult_ = parseLiteralStyle(options.style);
|
|
88
88
|
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Immediate.d.ts","sourceRoot":"","sources":["Immediate.js"],"names":[],"mappings":";AAgCA;;;;;;;;GAQG;AACH;IACE;;;;;;;;OAQG;IACH,qBARW,wBAAwB,cACxB,MAAM,UACN,OAAO,iBAAiB,EAAE,MAAM,aAChC,OAAO,oBAAoB,EAAE,SAAS,gBACtC,MAAM,gHAkOhB;IAnNC;;;OAGG;IACH,iBAAuB;IAEvB;;;OAGG;IACH,oBAA6B;IAE7B;;;OAGG;IACH,gBAAqB;IAErB;;;OAGG;IACH,mBAA2B;IAE3B;;;OAGG;IACH,2BAEK;IAEL;;;OAGG;IACH,sBAAiC;IAEjC;;;OAGG;IACH,0BAAyC;IAEzC;;;OAGG;IACH,uBAAmC;IAEnC;;;OAGG;IACH,0BAA6B;IAE7B;;;OAGG;IACH,4BAA+B;IAE/B;;;OAGG;IACH,0BAA6B;IAE7B;;;OAGG;IACH,mBAAsB;IAEtB;;;OAGG;IACH,qBAAwB;IAExB;;;OAGG;IACH,eAAkB;IAElB;;;OAGG;IACH,sBAAsB;IAEtB;;;OAGG;IACH,sBAAsB;IAEtB;;;OAGG;IACH,qBAAqB;IAErB;;;OAGG;IACH,sBAAsB;IAEtB;;;OAGG;IACH,sBAAsB;IAEtB;;;OAGG;IACH,sBAAsB;IAEtB;;;OAGG;IACH,6BAAiC;IAEjC;;;OAGG;IACH,uBAAuB;IAEvB;;;OAGG;IACH,oBAAyB;IAEzB;;;OAGG;IACH,oBAAoB;IAEpB;;;OAGG;IACH,cAAe;IAEf;;;OAGG;IACH,qBAAqB;IAErB;;;OAGG;IACH,qBAAqB;IAErB;;;OAGG;IACH,4BAAgC;IAEhC;;;OAGG;IACH,sBAAsB;IAEtB;;;OAGG;IACH,mBAAwB;IAExB;;;OAGG;IACH,uBAA0B;IAE1B;;;OAGG;IACH,yBAA4B;IAE5B;;;OAGG;IACH,mBAAsB;IAEtB;;;OAGG;IACH,0BAA2B;IAE3B;;;OAGG;IACH,2BAA2C;IAG7C;;;;;;OAMG;IACH,oBA6EC;IAED;;;;;;OAMG;IACH,kBAuDC;IAED;;;;;;;;OAQG;IACH,sBAsBC;IAED;;;;;;;OAOG;IACH,mBAWC;IAED;;;;;;OAMG;IACH,qBAHW,OAAO,sBAAsB,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"Immediate.d.ts","sourceRoot":"","sources":["Immediate.js"],"names":[],"mappings":";AAgCA;;;;;;;;GAQG;AACH;IACE;;;;;;;;OAQG;IACH,qBARW,wBAAwB,cACxB,MAAM,UACN,OAAO,iBAAiB,EAAE,MAAM,aAChC,OAAO,oBAAoB,EAAE,SAAS,gBACtC,MAAM,gHAkOhB;IAnNC;;;OAGG;IACH,iBAAuB;IAEvB;;;OAGG;IACH,oBAA6B;IAE7B;;;OAGG;IACH,gBAAqB;IAErB;;;OAGG;IACH,mBAA2B;IAE3B;;;OAGG;IACH,2BAEK;IAEL;;;OAGG;IACH,sBAAiC;IAEjC;;;OAGG;IACH,0BAAyC;IAEzC;;;OAGG;IACH,uBAAmC;IAEnC;;;OAGG;IACH,0BAA6B;IAE7B;;;OAGG;IACH,4BAA+B;IAE/B;;;OAGG;IACH,0BAA6B;IAE7B;;;OAGG;IACH,mBAAsB;IAEtB;;;OAGG;IACH,qBAAwB;IAExB;;;OAGG;IACH,eAAkB;IAElB;;;OAGG;IACH,sBAAsB;IAEtB;;;OAGG;IACH,sBAAsB;IAEtB;;;OAGG;IACH,qBAAqB;IAErB;;;OAGG;I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,GAAC,OAAO,eAAe,EAAE,OAAO,QAuCzF;IAED;;;;;OAKG;IACH,sBAFW,OAAO,uBAAuB,EAAE,OAAO,GAAC,OAAO,eAAe,EAAE,OAAO,QAwCjF;IAED;;;;OAIG;IACH,2BAFW,OAAO,4BAA4B,EAAE,OAAO,QA0CtD;IAED;;;OAGG;IACH,6BAcC;IAED;;;OAGG;IACH,+BAmDC;IAED;;;OAGG;IACH,6BA6BC;IAiED;;;;;OAKG;IACH,0BAFW,OAAO,sBAAsB,EAAE,OAAO,QA0BhD;IAED;;;;;OAKG;IACH,wBAFW,OAAO,qBAAqB,EAAE,OAAO,QA6F/C;CACF;0BAhpCyB,qBAAqB"}
|
|
@@ -485,6 +485,14 @@ class CanvasImmediateRenderer extends VectorContext {
|
|
|
485
485
|
* @api
|
|
486
486
|
*/
|
|
487
487
|
drawCircle(geometry) {
|
|
488
|
+
if (this.squaredTolerance_) {
|
|
489
|
+
geometry = /** @type {import("../../geom/Circle.js").default} */ (
|
|
490
|
+
geometry.simplifyTransformed(
|
|
491
|
+
this.squaredTolerance_,
|
|
492
|
+
this.userTransform_
|
|
493
|
+
)
|
|
494
|
+
);
|
|
495
|
+
}
|
|
488
496
|
if (!intersects(this.extent_, geometry.getExtent())) {
|
|
489
497
|
return;
|
|
490
498
|
}
|
|
@@ -614,7 +622,7 @@ class CanvasImmediateRenderer extends VectorContext {
|
|
|
614
622
|
*/
|
|
615
623
|
drawFeature(feature, style) {
|
|
616
624
|
const geometry = style.getGeometryFunction()(feature);
|
|
617
|
-
if (!geometry
|
|
625
|
+
if (!geometry) {
|
|
618
626
|
return;
|
|
619
627
|
}
|
|
620
628
|
this.setStyle(style);
|
|
@@ -62,14 +62,14 @@ export const FILL_FRAGMENT_SHADER = `
|
|
|
62
62
|
uniform float u_globalAlpha;
|
|
63
63
|
uniform mat4 u_projectionMatrix;
|
|
64
64
|
uniform mat4 u_screenToWorldMatrix;
|
|
65
|
-
uniform vec2
|
|
65
|
+
uniform vec2 u_viewportSizePx;
|
|
66
66
|
uniform float u_pixelRatio;
|
|
67
67
|
uniform vec4 u_renderExtent;
|
|
68
68
|
varying vec3 v_color;
|
|
69
69
|
varying float v_opacity;
|
|
70
70
|
|
|
71
71
|
vec2 pxToWorld(vec2 pxPos) {
|
|
72
|
-
vec2 screenPos = 2.0 * pxPos /
|
|
72
|
+
vec2 screenPos = 2.0 * pxPos / u_viewportSizePx - 1.0;
|
|
73
73
|
return (u_screenToWorldMatrix * vec4(screenPos, 0.0, 1.0)).xy;
|
|
74
74
|
}
|
|
75
75
|
|
|
@@ -102,7 +102,7 @@ export const STROKE_VERTEX_SHADER = `
|
|
|
102
102
|
precision mediump float;
|
|
103
103
|
#endif
|
|
104
104
|
uniform mat4 u_projectionMatrix;
|
|
105
|
-
uniform vec2
|
|
105
|
+
uniform vec2 u_viewportSizePx;
|
|
106
106
|
attribute vec2 a_segmentStart;
|
|
107
107
|
attribute vec2 a_segmentEnd;
|
|
108
108
|
attribute float a_parameters;
|
|
@@ -119,11 +119,11 @@ export const STROKE_VERTEX_SHADER = `
|
|
|
119
119
|
|
|
120
120
|
vec2 worldToPx(vec2 worldPos) {
|
|
121
121
|
vec4 screenPos = u_projectionMatrix * vec4(worldPos, 0.0, 1.0);
|
|
122
|
-
return (0.5 * screenPos.xy + 0.5) *
|
|
122
|
+
return (0.5 * screenPos.xy + 0.5) * u_viewportSizePx;
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
vec4 pxToScreen(vec2 pxPos) {
|
|
126
|
-
vec2 screenPos = pxPos * 4.0 /
|
|
126
|
+
vec2 screenPos = pxPos * 4.0 / u_viewportSizePx;
|
|
127
127
|
return vec4(screenPos.xy, 0.0, 0.0);
|
|
128
128
|
}
|
|
129
129
|
|
|
@@ -172,7 +172,7 @@ export const STROKE_FRAGMENT_SHADER = `
|
|
|
172
172
|
#endif
|
|
173
173
|
uniform mat4 u_projectionMatrix;
|
|
174
174
|
uniform mat4 u_screenToWorldMatrix;
|
|
175
|
-
uniform vec2
|
|
175
|
+
uniform vec2 u_viewportSizePx;
|
|
176
176
|
uniform float u_pixelRatio;
|
|
177
177
|
uniform float u_globalAlpha;
|
|
178
178
|
uniform vec4 u_renderExtent;
|
|
@@ -185,7 +185,7 @@ export const STROKE_FRAGMENT_SHADER = `
|
|
|
185
185
|
varying float v_width;
|
|
186
186
|
|
|
187
187
|
vec2 pxToWorld(vec2 pxPos) {
|
|
188
|
-
vec2 screenPos = 2.0 * pxPos /
|
|
188
|
+
vec2 screenPos = 2.0 * pxPos / u_viewportSizePx - 1.0;
|
|
189
189
|
return (u_screenToWorldMatrix * vec4(screenPos, 0.0, 1.0)).xy;
|
|
190
190
|
}
|
|
191
191
|
|
package/style/literal.d.ts
CHANGED
|
@@ -6,7 +6,8 @@ export namespace SymbolType {
|
|
|
6
6
|
const IMAGE: string;
|
|
7
7
|
}
|
|
8
8
|
export type ExpressionValue = import("./expressions.js").ExpressionValue;
|
|
9
|
-
export type
|
|
9
|
+
export type ColorExpression = import("../color.js").Color | string | Array<ExpressionValue>;
|
|
10
|
+
export type BaseProps = {
|
|
10
11
|
/**
|
|
11
12
|
* Filter expression. If it resolves to a number strictly greater than 0, the
|
|
12
13
|
* point will be displayed. If undefined, all points will show.
|
|
@@ -44,7 +45,7 @@ export type LiteralSymbolStyle = {
|
|
|
44
45
|
/**
|
|
45
46
|
* Color used for the representation (either fill, line or symbol).
|
|
46
47
|
*/
|
|
47
|
-
color?:
|
|
48
|
+
color?: ColorExpression | undefined;
|
|
48
49
|
/**
|
|
49
50
|
* Opacity.
|
|
50
51
|
*/
|
|
@@ -66,4 +67,204 @@ export type LiteralSymbolStyle = {
|
|
|
66
67
|
*/
|
|
67
68
|
rotateWithView?: boolean | undefined;
|
|
68
69
|
};
|
|
70
|
+
export type FillProps = {
|
|
71
|
+
/**
|
|
72
|
+
* The fill color.
|
|
73
|
+
*/
|
|
74
|
+
"fill-color"?: ColorExpression | undefined;
|
|
75
|
+
};
|
|
76
|
+
export type StrokeProps = {
|
|
77
|
+
/**
|
|
78
|
+
* The stroke color.
|
|
79
|
+
*/
|
|
80
|
+
"stroke-color"?: ColorExpression | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* Stroke pixel width.
|
|
83
|
+
*/
|
|
84
|
+
"stroke-width"?: import("./expressions.js").ExpressionValue | undefined;
|
|
85
|
+
};
|
|
86
|
+
export type IconProps = {
|
|
87
|
+
/**
|
|
88
|
+
* Image source URI.
|
|
89
|
+
*/
|
|
90
|
+
"icon-src"?: string | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* Image object for the icon. If the `icon-src` option is not provided then the
|
|
93
|
+
* provided image must already be loaded. And in that case, it is required
|
|
94
|
+
* to provide the size of the image, with the `icon-img-size` option.
|
|
95
|
+
*/
|
|
96
|
+
"icon-img"?: HTMLCanvasElement | HTMLImageElement | undefined;
|
|
97
|
+
/**
|
|
98
|
+
* Image size in pixels. Only required if `icon-img` is set and `icon-src` is not.
|
|
99
|
+
* The provided size needs to match the actual size of the image.
|
|
100
|
+
*/
|
|
101
|
+
"icon-img-size"?: import("../size.js").Size | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* Anchor. Default value is the icon center.
|
|
104
|
+
*/
|
|
105
|
+
"icon-anchor"?: number[] | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* Origin of the anchor: `bottom-left`, `bottom-right`,
|
|
108
|
+
* `top-left` or `top-right`.
|
|
109
|
+
*/
|
|
110
|
+
"icon-anchor-origin"?: import("./Icon.js").IconOrigin | undefined;
|
|
111
|
+
/**
|
|
112
|
+
* Units in which the anchor x value is
|
|
113
|
+
* specified. A value of `'fraction'` indicates the x value is a fraction of the icon. A value of `'pixels'` indicates
|
|
114
|
+
* the x value in pixels.
|
|
115
|
+
*/
|
|
116
|
+
"icon-anchor-x-units"?: import("./Icon.js").IconAnchorUnits | undefined;
|
|
117
|
+
/**
|
|
118
|
+
* Units in which the anchor y value is
|
|
119
|
+
* specified. A value of `'fraction'` indicates the y value is a fraction of the icon. A value of `'pixels'` indicates
|
|
120
|
+
* the y value in pixels.
|
|
121
|
+
*/
|
|
122
|
+
"icon-anchor-y-units"?: import("./Icon.js").IconAnchorUnits | undefined;
|
|
123
|
+
/**
|
|
124
|
+
* Color to tint the icon. If not specified,
|
|
125
|
+
* the icon will be left as is.
|
|
126
|
+
*/
|
|
127
|
+
"icon-color"?: ColorExpression | undefined;
|
|
128
|
+
/**
|
|
129
|
+
* The `crossOrigin` attribute for loaded images. Note that you must provide a
|
|
130
|
+
* `icon-cross-origin` value if you want to access pixel data with the Canvas renderer.
|
|
131
|
+
* See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.
|
|
132
|
+
*/
|
|
133
|
+
"icon-cross-origin"?: string | null | undefined;
|
|
134
|
+
/**
|
|
135
|
+
* Offset, which, together with the size and the offset origin, define the
|
|
136
|
+
* sub-rectangle to use from the original icon image.
|
|
137
|
+
*/
|
|
138
|
+
"icon-offset"?: number[] | import("./expressions.js").ExpressionValue[] | undefined;
|
|
139
|
+
/**
|
|
140
|
+
* Displacement of the icon.
|
|
141
|
+
*/
|
|
142
|
+
"icon-displacement"?: number[] | import("./expressions.js").ExpressionValue[] | undefined;
|
|
143
|
+
/**
|
|
144
|
+
* Origin of the offset: `bottom-left`, `bottom-right`,
|
|
145
|
+
* `top-left` or `top-right`.
|
|
146
|
+
*/
|
|
147
|
+
"icon-offset-origin"?: import("./Icon.js").IconOrigin | undefined;
|
|
148
|
+
/**
|
|
149
|
+
* Opacity of the icon.
|
|
150
|
+
*/
|
|
151
|
+
"icon-opacity"?: number | undefined;
|
|
152
|
+
/**
|
|
153
|
+
* Scale.
|
|
154
|
+
*/
|
|
155
|
+
"icon-scale"?: import("../size.js").Size | import("./expressions.js").ExpressionValue | import("./expressions.js").ExpressionValue[] | undefined;
|
|
156
|
+
/**
|
|
157
|
+
* Width of the icon. If not specified, the actual image width will be used. Cannot be combined
|
|
158
|
+
* with `scale`.
|
|
159
|
+
*/
|
|
160
|
+
"icon-width"?: import("./expressions.js").ExpressionValue | undefined;
|
|
161
|
+
/**
|
|
162
|
+
* Height of the icon. If not specified, the actual image height will be used. Cannot be combined
|
|
163
|
+
* with `scale`.
|
|
164
|
+
*/
|
|
165
|
+
"icon-height"?: import("./expressions.js").ExpressionValue | undefined;
|
|
166
|
+
/**
|
|
167
|
+
* Rotation in radians (positive rotation clockwise).
|
|
168
|
+
*/
|
|
169
|
+
"icon-rotation"?: import("./expressions.js").ExpressionValue | undefined;
|
|
170
|
+
/**
|
|
171
|
+
* Whether to rotate the icon with the view.
|
|
172
|
+
*/
|
|
173
|
+
"icon-rotate-with-view"?: boolean | undefined;
|
|
174
|
+
/**
|
|
175
|
+
* Icon size in pixel. Can be used together with `icon-offset` to define the
|
|
176
|
+
* sub-rectangle to use from the origin (sprite) icon image.
|
|
177
|
+
*/
|
|
178
|
+
"icon-size"?: import("../size.js").Size | import("./expressions.js").ExpressionValue[] | undefined;
|
|
179
|
+
};
|
|
180
|
+
export type ShapeProps = {
|
|
181
|
+
/**
|
|
182
|
+
* Number of points for stars and regular polygons. In case of a polygon, the number of points
|
|
183
|
+
* is the number of sides.
|
|
184
|
+
*/
|
|
185
|
+
"shape-points"?: number | undefined;
|
|
186
|
+
/**
|
|
187
|
+
* The fill color.
|
|
188
|
+
*/
|
|
189
|
+
"shape-fill-color"?: ColorExpression | undefined;
|
|
190
|
+
/**
|
|
191
|
+
* The stroke color.
|
|
192
|
+
*/
|
|
193
|
+
"shape-stroke-color"?: ColorExpression | undefined;
|
|
194
|
+
/**
|
|
195
|
+
* Stroke pixel width.
|
|
196
|
+
*/
|
|
197
|
+
"shape-stroke-width"?: import("./expressions.js").ExpressionValue | undefined;
|
|
198
|
+
/**
|
|
199
|
+
* Radius of a regular polygon.
|
|
200
|
+
*/
|
|
201
|
+
"shape-radius"?: import("./expressions.js").ExpressionValue | undefined;
|
|
202
|
+
/**
|
|
203
|
+
* First radius of a star. Ignored if radius is set.
|
|
204
|
+
*/
|
|
205
|
+
"shape-radius1"?: import("./expressions.js").ExpressionValue | undefined;
|
|
206
|
+
/**
|
|
207
|
+
* Second radius of a star.
|
|
208
|
+
*/
|
|
209
|
+
"shape-radius2"?: import("./expressions.js").ExpressionValue | undefined;
|
|
210
|
+
/**
|
|
211
|
+
* Shape's angle in radians. A value of 0 will have one of the shape's point facing up.
|
|
212
|
+
*/
|
|
213
|
+
"shape-angle"?: import("./expressions.js").ExpressionValue | undefined;
|
|
214
|
+
/**
|
|
215
|
+
* Displacement of the shape
|
|
216
|
+
*/
|
|
217
|
+
"shape-displacement"?: number[] | import("./expressions.js").ExpressionValue[] | undefined;
|
|
218
|
+
/**
|
|
219
|
+
* Rotation in radians (positive rotation clockwise).
|
|
220
|
+
*/
|
|
221
|
+
"shape-rotation"?: import("./expressions.js").ExpressionValue | undefined;
|
|
222
|
+
/**
|
|
223
|
+
* Whether to rotate the shape with the view.
|
|
224
|
+
*/
|
|
225
|
+
"shape-rotate-with-view"?: boolean | undefined;
|
|
226
|
+
/**
|
|
227
|
+
* Scale. Unless two dimensional scaling is required a better
|
|
228
|
+
* result may be obtained with appropriate settings for `shape-radius`, `shape-radius1` and `shape-radius2`.
|
|
229
|
+
*/
|
|
230
|
+
"shape-scale"?: import("../size.js").Size | import("./expressions.js").ExpressionValue | import("./expressions.js").ExpressionValue[] | undefined;
|
|
231
|
+
};
|
|
232
|
+
export type CircleProps = {
|
|
233
|
+
/**
|
|
234
|
+
* Circle radius.
|
|
235
|
+
*/
|
|
236
|
+
"circle-radius"?: import("./expressions.js").ExpressionValue | undefined;
|
|
237
|
+
/**
|
|
238
|
+
* The fill color.
|
|
239
|
+
*/
|
|
240
|
+
"circle-fill-color"?: ColorExpression | undefined;
|
|
241
|
+
/**
|
|
242
|
+
* The stroke color.
|
|
243
|
+
*/
|
|
244
|
+
"circle-stroke-color"?: ColorExpression | undefined;
|
|
245
|
+
/**
|
|
246
|
+
* Stroke pixel width.
|
|
247
|
+
*/
|
|
248
|
+
"circle-stroke-width"?: import("./expressions.js").ExpressionValue | undefined;
|
|
249
|
+
/**
|
|
250
|
+
* displacement
|
|
251
|
+
*/
|
|
252
|
+
"circle-displacement"?: number[] | import("./expressions.js").ExpressionValue[] | undefined;
|
|
253
|
+
/**
|
|
254
|
+
* Scale. A two dimensional scale will produce an ellipse.
|
|
255
|
+
* Unless two dimensional scaling is required a better result may be obtained with an appropriate setting for `circle-radius`.
|
|
256
|
+
*/
|
|
257
|
+
"circle-scale"?: import("../size.js").Size | import("./expressions.js").ExpressionValue | import("./expressions.js").ExpressionValue[] | undefined;
|
|
258
|
+
/**
|
|
259
|
+
* Rotation in radians
|
|
260
|
+
* (positive rotation clockwise, meaningful only when used in conjunction with a two dimensional scale).
|
|
261
|
+
*/
|
|
262
|
+
"circle-rotation"?: import("./expressions.js").ExpressionValue | undefined;
|
|
263
|
+
/**
|
|
264
|
+
* Whether to rotate the shape with the view
|
|
265
|
+
* (meaningful only when used in conjunction with a two dimensional scale).
|
|
266
|
+
*/
|
|
267
|
+
"circle-rotate-with-view"?: boolean | undefined;
|
|
268
|
+
};
|
|
269
|
+
export type LiteralStyle = BaseProps & IconProps & StrokeProps & FillProps & CircleProps & ShapeProps;
|
|
69
270
|
//# sourceMappingURL=literal.d.ts.map
|
package/style/literal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"literal.d.ts","sourceRoot":"","sources":["literal.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"literal.d.ts","sourceRoot":"","sources":["literal.js"],"names":[],"mappings":"yBAuBU,MAAM;;;;;;;8BAhBH,OAAO,kBAAkB,EAAE,eAAe;8BAG1C,OAAO,aAAa,EAAE,KAAK,GAAC,MAAM,GAAC,MAAM,eAAe,CAAC;;;;;;;;;;;;;;;;;;;;;;;UAwBxD,eAAe,GAAC,MAAM,eAAe,CAAC;;;;gBACtC,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BA4GX,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU"}
|
package/style/literal.js
CHANGED
|
@@ -7,9 +7,12 @@
|
|
|
7
7
|
/**
|
|
8
8
|
* @typedef {import("./expressions.js").ExpressionValue} ExpressionValue
|
|
9
9
|
*/
|
|
10
|
+
/**
|
|
11
|
+
* @typedef {import("../color.js").Color|string|Array<ExpressionValue>} ColorExpression
|
|
12
|
+
*/
|
|
10
13
|
|
|
11
14
|
/**
|
|
12
|
-
* @typedef {Object}
|
|
15
|
+
* @typedef {Object} BaseProps
|
|
13
16
|
* @property {ExpressionValue} [filter] Filter expression. If it resolves to a number strictly greater than 0, the
|
|
14
17
|
* point will be displayed. If undefined, all points will show.
|
|
15
18
|
* @property {Object<string, number>} [variables] Style variables; each variable must hold a number.
|
|
@@ -33,10 +36,110 @@ export const SymbolType = {
|
|
|
33
36
|
* @property {SymbolType} symbolType Symbol type to use, either a regular shape or an image.
|
|
34
37
|
* @property {string} [src] Path to the image to be used for the symbol. Only required with `symbolType: 'image'`.
|
|
35
38
|
* @property {string} [crossOrigin='anonymous'] The `crossOrigin` attribute for loading `src`.
|
|
36
|
-
* @property {
|
|
39
|
+
* @property {ColorExpression} [color] Color used for the representation (either fill, line or symbol).
|
|
37
40
|
* @property {ExpressionValue} [opacity=1] Opacity.
|
|
38
41
|
* @property {ExpressionValue} [rotation=0] Symbol rotation in radians.
|
|
39
42
|
* @property {Array<ExpressionValue, ExpressionValue>} [offset] Offset on X and Y axis for symbols. If not specified, the symbol will be centered.
|
|
40
43
|
* @property {Array<ExpressionValue, ExpressionValue, ExpressionValue, ExpressionValue>} [textureCoord] Texture coordinates. If not specified, the whole texture will be used (range for 0 to 1 on both axes).
|
|
41
44
|
* @property {boolean} [rotateWithView=false] Specify whether the symbol must rotate with the view or stay upwards.
|
|
42
45
|
*/
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @typedef {Object} FillProps
|
|
49
|
+
* @property {ColorExpression} [fill-color] The fill color.
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @typedef {Object} StrokeProps
|
|
54
|
+
* @property {ColorExpression} [stroke-color] The stroke color.
|
|
55
|
+
* @property {number|ExpressionValue} [stroke-width] Stroke pixel width.
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @typedef {Object} IconProps
|
|
60
|
+
* @property {string} [icon-src] Image source URI.
|
|
61
|
+
* @property {HTMLImageElement|HTMLCanvasElement} [icon-img] Image object for the icon. If the `icon-src` option is not provided then the
|
|
62
|
+
* provided image must already be loaded. And in that case, it is required
|
|
63
|
+
* to provide the size of the image, with the `icon-img-size` option.
|
|
64
|
+
* @property {import("../size.js").Size} [icon-img-size] Image size in pixels. Only required if `icon-img` is set and `icon-src` is not.
|
|
65
|
+
* The provided size needs to match the actual size of the image.
|
|
66
|
+
* @property {Array<number>} [icon-anchor=[0.5, 0.5]] Anchor. Default value is the icon center.
|
|
67
|
+
* @property {import("./Icon.js").IconOrigin} [icon-anchor-origin='top-left'] Origin of the anchor: `bottom-left`, `bottom-right`,
|
|
68
|
+
* `top-left` or `top-right`.
|
|
69
|
+
* @property {import("./Icon.js").IconAnchorUnits} [icon-anchor-x-units='fraction'] Units in which the anchor x value is
|
|
70
|
+
* specified. A value of `'fraction'` indicates the x value is a fraction of the icon. A value of `'pixels'` indicates
|
|
71
|
+
* the x value in pixels.
|
|
72
|
+
* @property {import("./Icon.js").IconAnchorUnits} [icon-anchor-y-units='fraction'] Units in which the anchor y value is
|
|
73
|
+
* specified. A value of `'fraction'` indicates the y value is a fraction of the icon. A value of `'pixels'` indicates
|
|
74
|
+
* the y value in pixels.
|
|
75
|
+
* @property {ColorExpression} [icon-color] Color to tint the icon. If not specified,
|
|
76
|
+
* the icon will be left as is.
|
|
77
|
+
* @property {null|string} [icon-cross-origin] The `crossOrigin` attribute for loaded images. Note that you must provide a
|
|
78
|
+
* `icon-cross-origin` value if you want to access pixel data with the Canvas renderer.
|
|
79
|
+
* See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.
|
|
80
|
+
* @property {Array<number>|Array<ExpressionValue>} [icon-offset=[0, 0]] Offset, which, together with the size and the offset origin, define the
|
|
81
|
+
* sub-rectangle to use from the original icon image.
|
|
82
|
+
* @property {Array<number>|Array<ExpressionValue>} [icon-displacement=[0,0]] Displacement of the icon.
|
|
83
|
+
* @property {import("./Icon.js").IconOrigin} [icon-offset-origin='top-left'] Origin of the offset: `bottom-left`, `bottom-right`,
|
|
84
|
+
* `top-left` or `top-right`.
|
|
85
|
+
* @property {number} [icon-opacity=1] Opacity of the icon.
|
|
86
|
+
* @property {ExpressionValue|Array<ExpressionValue>|number|import("../size.js").Size} [icon-scale=1] Scale.
|
|
87
|
+
* @property {ExpressionValue|number} [icon-width] Width of the icon. If not specified, the actual image width will be used. Cannot be combined
|
|
88
|
+
* with `scale`.
|
|
89
|
+
* @property {ExpressionValue|number} [icon-height] Height of the icon. If not specified, the actual image height will be used. Cannot be combined
|
|
90
|
+
* with `scale`.
|
|
91
|
+
* @property {ExpressionValue|number} [icon-rotation=0] Rotation in radians (positive rotation clockwise).
|
|
92
|
+
* @property {boolean} [icon-rotate-with-view=false] Whether to rotate the icon with the view.
|
|
93
|
+
* @property {Array<ExpressionValue>|import("../size.js").Size} [icon-size] Icon size in pixel. Can be used together with `icon-offset` to define the
|
|
94
|
+
* sub-rectangle to use from the origin (sprite) icon image.
|
|
95
|
+
*/
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* @typedef {Object} ShapeProps
|
|
99
|
+
* @property {number} [shape-points] Number of points for stars and regular polygons. In case of a polygon, the number of points
|
|
100
|
+
* is the number of sides.
|
|
101
|
+
* @property {ColorExpression} [shape-fill-color] The fill color.
|
|
102
|
+
* @property {ColorExpression} [shape-stroke-color] The stroke color.
|
|
103
|
+
* @property {ExpressionValue|number} [shape-stroke-width] Stroke pixel width.
|
|
104
|
+
* @property {ExpressionValue|number} [shape-radius] Radius of a regular polygon.
|
|
105
|
+
* @property {ExpressionValue|number} [shape-radius1] First radius of a star. Ignored if radius is set.
|
|
106
|
+
* @property {ExpressionValue|number} [shape-radius2] Second radius of a star.
|
|
107
|
+
* @property {ExpressionValue|number} [shape-angle=0] Shape's angle in radians. A value of 0 will have one of the shape's point facing up.
|
|
108
|
+
* @property {Array<ExpressionValue>|Array<number>} [shape-displacement=[0,0]] Displacement of the shape
|
|
109
|
+
* @property {ExpressionValue|number} [shape-rotation=0] Rotation in radians (positive rotation clockwise).
|
|
110
|
+
* @property {boolean} [shape-rotate-with-view=false] Whether to rotate the shape with the view.
|
|
111
|
+
* @property {ExpressionValue|Array<ExpressionValue>|number|import("../size.js").Size} [shape-scale=1] Scale. Unless two dimensional scaling is required a better
|
|
112
|
+
* result may be obtained with appropriate settings for `shape-radius`, `shape-radius1` and `shape-radius2`.
|
|
113
|
+
*/
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* @typedef {Object} CircleProps
|
|
117
|
+
* @property {ExpressionValue|number} [circle-radius] Circle radius.
|
|
118
|
+
* @property {ColorExpression} [circle-fill-color] The fill color.
|
|
119
|
+
* @property {ColorExpression} [circle-stroke-color] The stroke color.
|
|
120
|
+
* @property {ExpressionValue|number} [circle-stroke-width] Stroke pixel width.
|
|
121
|
+
* @property {Array<ExpressionValue>|Array<number>} [circle-displacement=[0,0]] displacement
|
|
122
|
+
* @property {ExpressionValue|Array<ExpressionValue>|number|import("../size.js").Size} [circle-scale=1] Scale. A two dimensional scale will produce an ellipse.
|
|
123
|
+
* Unless two dimensional scaling is required a better result may be obtained with an appropriate setting for `circle-radius`.
|
|
124
|
+
* @property {ExpressionValue|number} [circle-rotation=0] Rotation in radians
|
|
125
|
+
* (positive rotation clockwise, meaningful only when used in conjunction with a two dimensional scale).
|
|
126
|
+
* @property {boolean} [circle-rotate-with-view=false] Whether to rotate the shape with the view
|
|
127
|
+
* (meaningful only when used in conjunction with a two dimensional scale).
|
|
128
|
+
*/
|
|
129
|
+
|
|
130
|
+
// FIXME Present in flat style but not implemented in literal webgl style:
|
|
131
|
+
// - color like (fill patterns etc.)
|
|
132
|
+
// - stroke line cap/join/miter limit
|
|
133
|
+
// - stroke dash pattern/offset
|
|
134
|
+
// - icon declutter mode
|
|
135
|
+
// - circle line cap/join/miter limit
|
|
136
|
+
// - circle dash pattern/offset
|
|
137
|
+
// - circle declutter mode
|
|
138
|
+
// - shape line cap/join/miter limit
|
|
139
|
+
// - shape dash pattern/offset
|
|
140
|
+
// - shape declutter mode
|
|
141
|
+
// - text style
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* @typedef {BaseProps & IconProps & StrokeProps & FillProps & CircleProps & ShapeProps} LiteralStyle
|
|
145
|
+
*/
|
package/util.js
CHANGED
package/webgl/Helper.d.ts
CHANGED
package/webgl/Helper.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Helper.d.ts","sourceRoot":"","sources":["Helper.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Helper.d.ts","sourceRoot":"","sources":["Helper.js"],"names":[],"mappings":"AA+jCA;;;;GAIG;AACH,oDAHW,MAAM,oBAAoB,CAAC,GAC1B,MAAM,CASjB;;;;yBA3iCS,MAAM;;;;;;;;;6BAUN,MAAM;;;;;;;;;;;;;;;4BAgBN,MAAM;;;;;;;;;;;;YAhCF,OAAO,aAAa,EAAE,OAAO;;;;iBAC7B,WAAW;;;;;;;;;UA2CX,MAAM;;;;UACN,MAAM;;;;;;;;kCAOP,MAAM,GAAC,MAAM,MAAM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;;OAIG;IACH,6BAHW,MAAM,SACN,MAAM,MAAM,CAAC,QAIvB;IAED;;;;OAIG;IACH,6BAHW,MAAM,SACN,MAAM,MAAM,CAAC,QAIvB;IAED;;;;OAIG;IACH,+BAHW,MAAM,SACN,MAAM,MAAM,CAAC,QAQvB;IAED;;;;;;;;;OASG;IACH,8BAeC;IAED;;;;;OAKG;IACH,6BAFW,MAAM,oBAAoB,CAAC,QAgBrC;IAED;;;OAGG;IACH,+BAGC;IAED;;;OAGG;IACH,mCAA+B;IAE/B;;;;;;;;;OASG;IACH,oBALW,MAAM,MAAM,CAAC,4GAGZ,YAAY,CAiCvB;CACF;uBAzjCsB,kBAAkB"}
|
package/webgl/Helper.js
CHANGED
|
@@ -49,7 +49,7 @@ export const DefaultUniform = {
|
|
|
49
49
|
TIME: 'u_time',
|
|
50
50
|
ZOOM: 'u_zoom',
|
|
51
51
|
RESOLUTION: 'u_resolution',
|
|
52
|
-
|
|
52
|
+
VIEWPORT_SIZE_PX: 'u_viewportSizePx',
|
|
53
53
|
PIXEL_RATIO: 'u_pixelRatio',
|
|
54
54
|
};
|
|
55
55
|
|
|
@@ -704,7 +704,10 @@ class WebGLHelper extends Disposable {
|
|
|
704
704
|
frameState.viewState.resolution
|
|
705
705
|
);
|
|
706
706
|
this.setUniformFloatValue(DefaultUniform.PIXEL_RATIO, pixelRatio);
|
|
707
|
-
this.setUniformFloatVec2(DefaultUniform.
|
|
707
|
+
this.setUniformFloatVec2(DefaultUniform.VIEWPORT_SIZE_PX, [
|
|
708
|
+
size[0],
|
|
709
|
+
size[1],
|
|
710
|
+
]);
|
|
708
711
|
}
|
|
709
712
|
|
|
710
713
|
/**
|