ol 10.4.1-dev.1740542736318 → 10.4.1-dev.1740751716860
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.d.ts +47 -33
- package/dist/ol.d.ts.map +1 -1
- package/dist/ol.js +1 -1
- package/dist/ol.js.map +1 -1
- package/expr/gpu.d.ts +0 -5
- package/expr/gpu.d.ts.map +1 -1
- package/expr/gpu.js +3 -8
- package/layer/BaseVector.d.ts +2 -2
- package/layer/BaseVector.d.ts.map +1 -1
- package/layer/BaseVector.js +1 -1
- package/layer/Flow.d.ts.map +1 -1
- package/layer/Flow.js +2 -3
- package/layer/Heatmap.d.ts +54 -18
- package/layer/Heatmap.d.ts.map +1 -1
- package/layer/Heatmap.js +169 -50
- package/layer/WebGLPoints.d.ts +1 -1
- package/layer/WebGLPoints.d.ts.map +1 -1
- package/layer/WebGLPoints.js +2 -2
- package/layer/WebGLTile.d.ts.map +1 -1
- package/layer/WebGLTile.js +1 -2
- package/package.json +1 -1
- package/render/webgl/MixedGeometryBatch.d.ts.map +1 -1
- package/render/webgl/MixedGeometryBatch.js +4 -0
- package/{webgl → render/webgl}/ShaderBuilder.d.ts +28 -29
- package/render/webgl/ShaderBuilder.d.ts.map +1 -0
- package/{webgl → render/webgl}/ShaderBuilder.js +115 -123
- package/render/webgl/VectorStyleRenderer.d.ts +2 -2
- package/render/webgl/VectorStyleRenderer.d.ts.map +1 -1
- package/render/webgl/VectorStyleRenderer.js +3 -3
- package/render/webgl/{utils.d.ts → bufferUtil.d.ts} +1 -37
- package/render/webgl/bufferUtil.d.ts.map +1 -0
- package/render/webgl/{utils.js → bufferUtil.js} +2 -123
- package/render/webgl/compileUtil.d.ts +51 -0
- package/render/webgl/compileUtil.d.ts.map +1 -0
- package/render/webgl/compileUtil.js +203 -0
- package/render/webgl/encodeUtil.d.ts +20 -0
- package/render/webgl/encodeUtil.d.ts.map +1 -0
- package/render/webgl/encodeUtil.js +39 -0
- package/render/webgl/style.d.ts +57 -0
- package/render/webgl/style.d.ts.map +1 -0
- package/{webgl/styleparser.js → render/webgl/style.js} +187 -322
- package/renderer/webgl/PointsLayer.js +1 -1
- package/renderer/webgl/VectorLayer.d.ts +1 -0
- package/renderer/webgl/VectorLayer.d.ts.map +1 -1
- package/renderer/webgl/VectorLayer.js +4 -1
- package/renderer/webgl/VectorTileLayer.d.ts.map +1 -1
- package/renderer/webgl/VectorTileLayer.js +5 -3
- package/util.js +1 -1
- package/worker/webgl.js +1 -1
- package/render/webgl/utils.d.ts.map +0 -1
- package/webgl/ShaderBuilder.d.ts.map +0 -1
- package/webgl/styleparser.d.ts +0 -57
- package/webgl/styleparser.d.ts.map +0 -1
package/expr/gpu.d.ts
CHANGED
|
@@ -67,7 +67,6 @@ export function uniformNameForVariable(variableName: string): string;
|
|
|
67
67
|
*/
|
|
68
68
|
/**
|
|
69
69
|
* @typedef {Object} CompilationContext
|
|
70
|
-
* @property {boolean} [inFragmentShader] If false, means the expression output should be made for a vertex shader
|
|
71
70
|
* @property {Object<string, CompilationContextProperty>} properties The values for properties used in 'get' expressions.
|
|
72
71
|
* @property {Object<string, CompilationContextVariable>} variables The values for variables used in 'var' expressions.
|
|
73
72
|
* @property {Object<string, string>} functions Lookup of functions used by the style.
|
|
@@ -122,10 +121,6 @@ export type CompilationContextVariable = {
|
|
|
122
121
|
type: number;
|
|
123
122
|
};
|
|
124
123
|
export type CompilationContext = {
|
|
125
|
-
/**
|
|
126
|
-
* If false, means the expression output should be made for a vertex shader
|
|
127
|
-
*/
|
|
128
|
-
inFragmentShader?: boolean | undefined;
|
|
129
124
|
/**
|
|
130
125
|
* The values for properties used in 'get' expressions.
|
|
131
126
|
*/
|
package/expr/gpu.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gpu.d.ts","sourceRoot":"","sources":["gpu.js"],"names":[],"mappings":"AA6BA;;;;GAIG;AACH,gCAHW,MAAM,GACL,MAAM,CAKjB;AAED;;;;GAIG;AACH,mCAHW,KAAK,CAAC,MAAM,CAAC,GACZ,MAAM,CASjB;AAED;;;;;;GAMG;AACH,mCALW,MAAM,GAAC,OAAO,aAAa,EAAE,KAAK,GAGjC,MAAM,CAMjB;AAED;;;;GAIG;AACH,iCAHW,MAAM,GAAC,OAAO,YAAY,EAAE,IAAI,GAC/B,MAAM,CAKjB;AAMD;;;;GAIG;AACH,kDAHW,MAAM,GACL,MAAM,CAOjB;AAED;;;;;;GAMG;AACH,qCAHW,MAAM,GACL,MAAM,CAIjB;AAED;;;;GAIG;AACH,qDAHW,MAAM,GACL,MAAM,CAIjB;AAED;;GAEG;AACH;;;GAGG;AACH;;;GAGG;AAEH;;;;GAIG;AAEH;;;;GAIG;AAEH
|
|
1
|
+
{"version":3,"file":"gpu.d.ts","sourceRoot":"","sources":["gpu.js"],"names":[],"mappings":"AA6BA;;;;GAIG;AACH,gCAHW,MAAM,GACL,MAAM,CAKjB;AAED;;;;GAIG;AACH,mCAHW,KAAK,CAAC,MAAM,CAAC,GACZ,MAAM,CASjB;AAED;;;;;;GAMG;AACH,mCALW,MAAM,GAAC,OAAO,aAAa,EAAE,KAAK,GAGjC,MAAM,CAMjB;AAED;;;;GAIG;AACH,iCAHW,MAAM,GAAC,OAAO,YAAY,EAAE,IAAI,GAC/B,MAAM,CAKjB;AAMD;;;;GAIG;AACH,kDAHW,MAAM,GACL,MAAM,CAOjB;AAED;;;;;;GAMG;AACH,qCAHW,MAAM,GACL,MAAM,CAIjB;AAED;;;;GAIG;AACH,qDAHW,MAAM,GACL,MAAM,CAIjB;AAED;;GAEG;AACH;;;GAGG;AACH;;;GAGG;AAEH;;;;GAIG;AAEH;;;;GAIG;AAEH;;;;;;;;;GASG;AAEH;;GAEG;AACH,yCAFY,kBAAkB,CAW7B;AASD;;GAEG;AAEH;;;GAGG;AAEH;;;;;;GAMG;AACH,yCANW,OAAO,iBAAiB,EAAE,iBAAiB,QAC3C,MAAM,kBACN,OAAO,iBAAiB,EAAE,cAAc,sBACxC,kBAAkB,GACjB,kBAAkB,CAU7B;AA7BD,oCAAqC,mBAAmB,CAAC;AAEzD,uCAAwC,WAAW,CAAC;AACpD,0CAA2C,cAAc,CAAC;6BArD7C,OAAO,iBAAiB,EAAE,cAAc;yBAIxC,OAAO,iBAAiB,EAAE,UAAU;gCAIpC,OAAO,iBAAiB,EAAE,iBAAiB;;;;;UAK1C,MAAM;;;;UACN,MAAM;;;;;;UAKN,MAAM;;;;UACN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAUN,OAAO;;;;kBACP,OAAO;;iCAyBR,MAAM;;;;uBAIN,CAAS,IAAkB,EAAlB,kBAAkB,EAAE,IAAc,EAAd,cAAc,EAAE,IAAM,EAAN,MAAM,KAAG,MAAM;2BAvK9C,4BAA4B;+BAYhD,iBAAiB"}
|
package/expr/gpu.js
CHANGED
|
@@ -136,7 +136,6 @@ export function uniformNameForVariable(variableName) {
|
|
|
136
136
|
|
|
137
137
|
/**
|
|
138
138
|
* @typedef {Object} CompilationContext
|
|
139
|
-
* @property {boolean} [inFragmentShader] If false, means the expression output should be made for a vertex shader
|
|
140
139
|
* @property {Object<string, CompilationContextProperty>} properties The values for properties used in 'get' expressions.
|
|
141
140
|
* @property {Object<string, CompilationContextVariable>} variables The values for variables used in 'var' expressions.
|
|
142
141
|
* @property {Object<string, string>} functions Lookup of functions used by the style.
|
|
@@ -151,7 +150,6 @@ export function uniformNameForVariable(variableName) {
|
|
|
151
150
|
*/
|
|
152
151
|
export function newCompilationContext() {
|
|
153
152
|
return {
|
|
154
|
-
inFragmentShader: false,
|
|
155
153
|
variables: {},
|
|
156
154
|
properties: {},
|
|
157
155
|
functions: {},
|
|
@@ -223,18 +221,15 @@ const compilers = {
|
|
|
223
221
|
type: expression.type,
|
|
224
222
|
};
|
|
225
223
|
}
|
|
226
|
-
|
|
227
|
-
return prefix + propName;
|
|
224
|
+
return 'a_prop_' + propName;
|
|
228
225
|
},
|
|
229
226
|
[Ops.Id]: (context) => {
|
|
230
227
|
context.featureId = true;
|
|
231
|
-
|
|
232
|
-
return prefix + FEATURE_ID_PROPERTY_NAME;
|
|
228
|
+
return 'a_' + FEATURE_ID_PROPERTY_NAME;
|
|
233
229
|
},
|
|
234
230
|
[Ops.GeometryType]: (context) => {
|
|
235
231
|
context.geometryType = true;
|
|
236
|
-
|
|
237
|
-
return prefix + GEOMETRY_TYPE_PROPERTY_NAME;
|
|
232
|
+
return 'a_' + GEOMETRY_TYPE_PROPERTY_NAME;
|
|
238
233
|
},
|
|
239
234
|
[Ops.LineMetric]: () => 'currentLineMetric', // this variable is assumed to always be present in shaders, default is 0.
|
|
240
235
|
[Ops.Var]: (context, expression) => {
|
package/layer/BaseVector.d.ts
CHANGED
|
@@ -119,10 +119,10 @@ export type Options<FeatureType extends import("../Feature").FeatureLike, Vector
|
|
|
119
119
|
* @template {import('../Feature').FeatureLike} FeatureType
|
|
120
120
|
* @template {import("../source/Vector.js").default<FeatureType>|import("../source/VectorTile.js").default<FeatureType>} VectorSourceType<FeatureType>
|
|
121
121
|
* @extends {Layer<VectorSourceType, RendererType>}
|
|
122
|
-
* @template {import("../renderer/canvas/VectorLayer.js").default|import("../renderer/canvas/VectorTileLayer.js").default|import("../renderer/canvas/VectorImageLayer.js").default|import("../renderer/webgl/PointsLayer.js").default} RendererType
|
|
122
|
+
* @template {import("../renderer/canvas/VectorLayer.js").default|import("../renderer/canvas/VectorTileLayer.js").default|import("../renderer/canvas/VectorImageLayer.js").default|import("../renderer/webgl/VectorLayer.js").default|import("../renderer/webgl/PointsLayer.js").default} RendererType
|
|
123
123
|
* @api
|
|
124
124
|
*/
|
|
125
|
-
declare class BaseVectorLayer<FeatureType extends import("../Feature").FeatureLike, VectorSourceType extends import("../source/Vector.js").default<FeatureType> | import("../source/VectorTile.js").default<FeatureType>, RendererType extends import("../renderer/canvas/VectorLayer.js").default | import("../renderer/canvas/VectorTileLayer.js").default | import("../renderer/canvas/VectorImageLayer.js").default | import("../renderer/webgl/PointsLayer.js").default> extends Layer<VectorSourceType, RendererType> {
|
|
125
|
+
declare class BaseVectorLayer<FeatureType extends import("../Feature").FeatureLike, VectorSourceType extends import("../source/Vector.js").default<FeatureType> | import("../source/VectorTile.js").default<FeatureType>, RendererType extends import("../renderer/canvas/VectorLayer.js").default | import("../renderer/canvas/VectorTileLayer.js").default | import("../renderer/canvas/VectorImageLayer.js").default | import("../renderer/webgl/VectorLayer.js").default | import("../renderer/webgl/PointsLayer.js").default> extends Layer<VectorSourceType, RendererType> {
|
|
126
126
|
/**
|
|
127
127
|
* @param {Options<FeatureType, VectorSourceType>} [options] Options.
|
|
128
128
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseVector.d.ts","sourceRoot":"","sources":["BaseVector.js"],"names":[],"mappings":";;;;iCAea,CAAC,IACD,CAAC,SAAS,OAAO,qBAAqB,EAAE,OAAO,CAAC,MAAM,CAAC,SAAS,OAAO,eAAe,EAAE,WAAW,CAAC,GAAG,CAAC,GAAG,KAAK;oBAI7E,WAAW,SAA9C,OAAQ,YAAY,EAAE,WAAY,EAC0E,gBAAgB,SAA3H,OAAO,qBAAqB,EAAE,OAAO,CAAC,WAAW,CAAC,GAAC,OAAO,yBAAyB,EAAE,OAAO,CAAC,WAAW,CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyDxH;;;;;;;;;;;;GAYG;AACH,8BANgD,WAAW,SAA9C,OAAQ,YAAY,EAAE,WAAY,EAC0E,gBAAgB,SAA3H,OAAO,qBAAqB,EAAE,OAAO,CAAC,WAAW,CAAC,GAAC,OAAO,yBAAyB,EAAE,OAAO,CAAC,WAAW,CAAE,
|
|
1
|
+
{"version":3,"file":"BaseVector.d.ts","sourceRoot":"","sources":["BaseVector.js"],"names":[],"mappings":";;;;iCAea,CAAC,IACD,CAAC,SAAS,OAAO,qBAAqB,EAAE,OAAO,CAAC,MAAM,CAAC,SAAS,OAAO,eAAe,EAAE,WAAW,CAAC,GAAG,CAAC,GAAG,KAAK;oBAI7E,WAAW,SAA9C,OAAQ,YAAY,EAAE,WAAY,EAC0E,gBAAgB,SAA3H,OAAO,qBAAqB,EAAE,OAAO,CAAC,WAAW,CAAC,GAAC,OAAO,yBAAyB,EAAE,OAAO,CAAC,WAAW,CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyDxH;;;;;;;;;;;;GAYG;AACH,8BANgD,WAAW,SAA9C,OAAQ,YAAY,EAAE,WAAY,EAC0E,gBAAgB,SAA3H,OAAO,qBAAqB,EAAE,OAAO,CAAC,WAAW,CAAC,GAAC,OAAO,yBAAyB,EAAE,OAAO,CAAC,WAAW,CAAE,EAEkK,YAAY,SAAxR,OAAO,mCAAmC,EAAE,OAAO,GAAC,OAAO,uCAAuC,EAAE,OAAO,GAAC,OAAO,wCAAwC,EAAE,OAAO,GAAC,OAAO,kCAAkC,EAAE,OAAO,GAAC,OAAO,kCAAkC,EAAE,OAAQ;IAIvR;;OAEG;IACH,sBAFW,OAAO,CAAC,WAAW,EAAE,gBAAgB,CAAC,EA2DhD;IA9CC;;;OAGG;IACH,mBAA2E;IAE3E;;;OAGG;IACH,sBACiE;IAEjE;;;;OAIG;IACH,eAAkB;IAElB;;;;OAIG;IACH,uBAA+B;IAI/B;;;OAGG;IACH,8BAGW;IAEX;;;OAGG;IACH,gCAGW;IA8Bb;;OAEG;IACH,mBAFY,MAAM,GAAC,SAAS,CAI3B;IAED;;OAEG;IACH,kBAFY,OAAO,cAAc,EAAE,aAAa,GAAC,IAAI,GAAC,SAAS,CAM9D;IAED;;;;;OAKG;IACH,YAHY,OAAO,mBAAmB,EAAE,SAAS,GAAC,OAAO,kBAAkB,EAAE,aAAa,GAAC,IAAI,GAAC,SAAS,CAKxG;IAED;;;;OAIG;IACH,oBAHY,OAAO,mBAAmB,EAAE,aAAa,GAAC,SAAS,CAK9D;IAED;;;OAGG;IACH,2BAHY,OAAO,CAKlB;IAED;;;OAGG;IACH,6BAHY,OAAO,CAKlB;IAgBD;;;OAGG;IACH,4BAHW,OAAO,cAAc,EAAE,aAAa,GAAC,IAAI,GAAC,SAAS,QAK7D;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,iBAHW,OAAO,mBAAmB,EAAE,SAAS,GAAC,OAAO,kBAAkB,EAAE,aAAa,GAAC,IAAI,QAS7F;IAED;;;OAGG;IACH,wBAHW,OAAO,GAAC,MAAM,GAAC,MAAM,QAM/B;CACF;kBAvRiB,YAAY"}
|
package/layer/BaseVector.js
CHANGED
|
@@ -86,7 +86,7 @@ const Property = {
|
|
|
86
86
|
* @template {import('../Feature').FeatureLike} FeatureType
|
|
87
87
|
* @template {import("../source/Vector.js").default<FeatureType>|import("../source/VectorTile.js").default<FeatureType>} VectorSourceType<FeatureType>
|
|
88
88
|
* @extends {Layer<VectorSourceType, RendererType>}
|
|
89
|
-
* @template {import("../renderer/canvas/VectorLayer.js").default|import("../renderer/canvas/VectorTileLayer.js").default|import("../renderer/canvas/VectorImageLayer.js").default|import("../renderer/webgl/PointsLayer.js").default} RendererType
|
|
89
|
+
* @template {import("../renderer/canvas/VectorLayer.js").default|import("../renderer/canvas/VectorTileLayer.js").default|import("../renderer/canvas/VectorImageLayer.js").default|import("../renderer/webgl/VectorLayer.js").default|import("../renderer/webgl/PointsLayer.js").default} RendererType
|
|
90
90
|
* @api
|
|
91
91
|
*/
|
|
92
92
|
class BaseVectorLayer extends Layer {
|
package/layer/Flow.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Flow.d.ts","sourceRoot":"","sources":["Flow.js"],"names":[],"mappings":";;;;;sBAuRc,MAAM;;;;wBACN,MAAM;;;;yBACN,MAAM;;;;2BACN,MAAM;;;;kCACN,MAAM;;;;oCACN,MAAM;;;;+BACN,MAAM;;;;iCACN,MAAM;;yBA9QP,OAAO,uBAAuB,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;cAetC,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"Flow.d.ts","sourceRoot":"","sources":["Flow.js"],"names":[],"mappings":";;;;;sBAuRc,MAAM;;;;wBACN,MAAM;;;;yBACN,MAAM;;;;2BACN,MAAM;;;;kCACN,MAAM;;;;oCACN,MAAM;;;;+BACN,MAAM;;;;iCACN,MAAM;;yBA9QP,OAAO,uBAAuB,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;cAetC,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6WpB;;;;;;;GAOG;AACH;IACE;;OAEG;IACH,qBAFW,OAAO,EA2CjB;IAlCC;;;OAGG;IACH,eAAiC;IAKjC;;;OAGG;IACH,kBAAiC;IAEjC;;;OAGG;IACH,qBAAuC;IAEvC;;;OAGG;IACH,mBAAmC;IAEnC;;;OAGG;IACH,wBAAkD;IAKpD;;OAEG;IACH,4BAIC;IAED;;;OAGG;IACH;;aAGC;IAED;;;;;OAKG;IACH,mBAJW,OAAO,cAAc,EAAE,MAAM,cAC7B,MAAM,GACL,KAAK,CAAC,UAAU,CAAC,CAM5B;CAgBF;8BArewC,gCAAgC;0BAE/C,eAAe"}
|
package/layer/Flow.js
CHANGED
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
newCompilationContext,
|
|
8
8
|
uniformNameForVariable,
|
|
9
9
|
} from '../expr/gpu.js';
|
|
10
|
+
import {expressionToGlsl} from '../render/webgl/compileUtil.js';
|
|
10
11
|
import FlowLayerRenderer, {A, U, V} from '../renderer/webgl/FlowLayer.js';
|
|
11
12
|
import {Attributes as BA, Uniforms as BU} from '../renderer/webgl/TileLayer.js';
|
|
12
|
-
import {expressionToGlsl} from '../webgl/styleparser.js';
|
|
13
13
|
import BaseTileLayer from './BaseTile.js';
|
|
14
14
|
import LayerProperty from './Property.js';
|
|
15
15
|
|
|
@@ -293,7 +293,6 @@ const particleColorVertexShader = `
|
|
|
293
293
|
*/
|
|
294
294
|
function parseStyle(style) {
|
|
295
295
|
const context = newCompilationContext();
|
|
296
|
-
context.inFragmentShader = true;
|
|
297
296
|
const pipeline = [];
|
|
298
297
|
|
|
299
298
|
if (style.color !== undefined) {
|
|
@@ -364,7 +363,7 @@ function parseStyle(style) {
|
|
|
364
363
|
vx * ${U.ROTATION}.y + vy * ${U.ROTATION}.x
|
|
365
364
|
);
|
|
366
365
|
|
|
367
|
-
float
|
|
366
|
+
float a_prop_speed = length(velocity);
|
|
368
367
|
|
|
369
368
|
vec4 color;
|
|
370
369
|
|
package/layer/Heatmap.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export default Heatmap;
|
|
2
|
+
export type WeightExpression = import("../style/flat.js").NumberExpression | string | ((arg0: import("../Feature.js").default) => number);
|
|
2
3
|
export type Options<FeatureType extends import("../Feature.js").FeatureLike = import("../Feature.js").default<import("../geom.js").Geometry>, VectorSourceType extends import("../source/Vector.js").default<FeatureType> = import("../source/Vector.js").default<FeatureType>> = {
|
|
3
4
|
/**
|
|
4
5
|
* A CSS class name to set to the layer element.
|
|
@@ -50,19 +51,31 @@ export type Options<FeatureType extends import("../Feature.js").FeatureLike = im
|
|
|
50
51
|
*/
|
|
51
52
|
gradient?: string[] | undefined;
|
|
52
53
|
/**
|
|
53
|
-
* Radius size in pixels.
|
|
54
|
+
* Radius size in pixels. Note that for LineStrings,
|
|
55
|
+
* the width of the line will be double the radius.
|
|
54
56
|
*/
|
|
55
|
-
radius?:
|
|
57
|
+
radius?: import("../style/flat.js").NumberExpression | undefined;
|
|
56
58
|
/**
|
|
57
|
-
* Blur size in pixels.
|
|
59
|
+
* Blur size in pixels. This is added to the `radius`
|
|
60
|
+
* parameter above to create the final size of the blur effect.
|
|
58
61
|
*/
|
|
59
|
-
blur?:
|
|
62
|
+
blur?: import("../style/flat.js").NumberExpression | undefined;
|
|
60
63
|
/**
|
|
61
64
|
* The feature
|
|
62
|
-
* attribute to use for the weight or a function that returns a weight from a feature. Weight values
|
|
65
|
+
* attribute to use for the weight. This also supports expressions returning a number or a function that returns a weight from a feature. Weight values
|
|
63
66
|
* should range from 0 to 1 (and values outside will be clamped to that range).
|
|
64
67
|
*/
|
|
65
|
-
weight?:
|
|
68
|
+
weight?: WeightExpression | undefined;
|
|
69
|
+
/**
|
|
70
|
+
* Optional filter expression.
|
|
71
|
+
*/
|
|
72
|
+
filter?: import("../style/flat.js").BooleanExpression | undefined;
|
|
73
|
+
/**
|
|
74
|
+
* Variables used in expressions (optional)
|
|
75
|
+
*/
|
|
76
|
+
variables?: {
|
|
77
|
+
[x: string]: string | number | boolean | number[];
|
|
78
|
+
} | undefined;
|
|
66
79
|
/**
|
|
67
80
|
* Point source.
|
|
68
81
|
*/
|
|
@@ -85,14 +98,20 @@ export type Options<FeatureType extends import("../Feature.js").FeatureLike = im
|
|
|
85
98
|
* @fires import("../render/Event.js").RenderEvent#postrender
|
|
86
99
|
* @template {import("../Feature.js").FeatureLike} [FeatureType=import("../Feature.js").default]
|
|
87
100
|
* @template {import("../source/Vector.js").default<FeatureType>} [VectorSourceType=import("../source/Vector.js").default<FeatureType>]
|
|
88
|
-
* @extends {BaseVector<FeatureType, VectorSourceType,
|
|
101
|
+
* @extends {BaseVector<FeatureType, VectorSourceType, WebGLVectorLayerRenderer>}
|
|
89
102
|
* @api
|
|
90
103
|
*/
|
|
91
|
-
declare class Heatmap<FeatureType extends import("../Feature.js").FeatureLike = import("../Feature.js").default<import("../geom.js").Geometry>, VectorSourceType extends import("../source/Vector.js").default<FeatureType> = import("../source/Vector.js").default<FeatureType>> extends BaseVector<FeatureType, VectorSourceType,
|
|
104
|
+
declare class Heatmap<FeatureType extends import("../Feature.js").FeatureLike = import("../Feature.js").default<import("../geom.js").Geometry>, VectorSourceType extends import("../source/Vector.js").default<FeatureType> = import("../source/Vector.js").default<FeatureType>> extends BaseVector<FeatureType, VectorSourceType, WebGLVectorLayerRenderer> {
|
|
92
105
|
/**
|
|
93
106
|
* @param {Options<FeatureType, VectorSourceType>} [options] Options.
|
|
94
107
|
*/
|
|
95
108
|
constructor(options?: Options<FeatureType, VectorSourceType>);
|
|
109
|
+
filter_: import("../style/flat.js").BooleanExpression;
|
|
110
|
+
/**
|
|
111
|
+
* @type {import('../style/flat.js').StyleVariables}
|
|
112
|
+
* @private
|
|
113
|
+
*/
|
|
114
|
+
private styleVariables_;
|
|
96
115
|
/**
|
|
97
116
|
* @private
|
|
98
117
|
* @type {HTMLCanvasElement}
|
|
@@ -101,14 +120,14 @@ declare class Heatmap<FeatureType extends import("../Feature.js").FeatureLike =
|
|
|
101
120
|
/**
|
|
102
121
|
* @private
|
|
103
122
|
*/
|
|
104
|
-
private
|
|
123
|
+
private weight_;
|
|
105
124
|
/**
|
|
106
125
|
* Return the blur size in pixels.
|
|
107
|
-
* @return {
|
|
126
|
+
* @return {import("../style/flat.js").NumberExpression} Blur size in pixels.
|
|
108
127
|
* @api
|
|
109
128
|
* @observable
|
|
110
129
|
*/
|
|
111
|
-
getBlur():
|
|
130
|
+
getBlur(): import("../style/flat.js").NumberExpression;
|
|
112
131
|
/**
|
|
113
132
|
* Return the gradient colors as array of strings.
|
|
114
133
|
* @return {Array<string>} Colors.
|
|
@@ -118,22 +137,22 @@ declare class Heatmap<FeatureType extends import("../Feature.js").FeatureLike =
|
|
|
118
137
|
getGradient(): Array<string>;
|
|
119
138
|
/**
|
|
120
139
|
* Return the size of the radius in pixels.
|
|
121
|
-
* @return {
|
|
140
|
+
* @return {import("../style/flat.js").NumberExpression} Radius size in pixel.
|
|
122
141
|
* @api
|
|
123
142
|
* @observable
|
|
124
143
|
*/
|
|
125
|
-
getRadius():
|
|
144
|
+
getRadius(): import("../style/flat.js").NumberExpression;
|
|
126
145
|
/**
|
|
127
146
|
* @private
|
|
128
147
|
*/
|
|
129
148
|
private handleGradientChanged_;
|
|
130
149
|
/**
|
|
131
150
|
* Set the blur size in pixels.
|
|
132
|
-
* @param {
|
|
151
|
+
* @param {import("../style/flat.js").NumberExpression} blur Blur size in pixels (supports expressions).
|
|
133
152
|
* @api
|
|
134
153
|
* @observable
|
|
135
154
|
*/
|
|
136
|
-
setBlur(blur:
|
|
155
|
+
setBlur(blur: import("../style/flat.js").NumberExpression): void;
|
|
137
156
|
/**
|
|
138
157
|
* Set the gradient colors as array of strings.
|
|
139
158
|
* @param {Array<string>} colors Gradient.
|
|
@@ -143,16 +162,33 @@ declare class Heatmap<FeatureType extends import("../Feature.js").FeatureLike =
|
|
|
143
162
|
setGradient(colors: Array<string>): void;
|
|
144
163
|
/**
|
|
145
164
|
* Set the size of the radius in pixels.
|
|
146
|
-
* @param {
|
|
165
|
+
* @param {import("../style/flat.js").NumberExpression} radius Radius size in pixel (supports expressions).
|
|
147
166
|
* @api
|
|
148
167
|
* @observable
|
|
149
168
|
*/
|
|
150
|
-
setRadius(radius:
|
|
169
|
+
setRadius(radius: import("../style/flat.js").NumberExpression): void;
|
|
170
|
+
/**
|
|
171
|
+
* Set the filter expression
|
|
172
|
+
* @param {import("../style/flat.js").BooleanExpression} filter Filter expression
|
|
173
|
+
* @api
|
|
174
|
+
*/
|
|
175
|
+
setFilter(filter: import("../style/flat.js").BooleanExpression): void;
|
|
176
|
+
/**
|
|
177
|
+
* Set the weight expression
|
|
178
|
+
* @param {WeightExpression} weight Weight expression
|
|
179
|
+
* @api
|
|
180
|
+
*/
|
|
181
|
+
setWeight(weight: WeightExpression): void;
|
|
182
|
+
/**
|
|
183
|
+
* Update any variables used by the layer style and trigger a re-render.
|
|
184
|
+
* @param {import('../style/flat.js').StyleVariables} variables Variables to update.
|
|
185
|
+
*/
|
|
186
|
+
updateStyleVariables(variables: import("../style/flat.js").StyleVariables): void;
|
|
151
187
|
/**
|
|
152
188
|
* @override
|
|
153
189
|
*/
|
|
154
190
|
override renderDeclutter(): void;
|
|
155
191
|
}
|
|
156
|
-
import
|
|
192
|
+
import WebGLVectorLayerRenderer from '../renderer/webgl/VectorLayer.js';
|
|
157
193
|
import BaseVector from './BaseVector.js';
|
|
158
194
|
//# sourceMappingURL=Heatmap.d.ts.map
|
package/layer/Heatmap.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Heatmap.d.ts","sourceRoot":"","sources":["Heatmap.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Heatmap.d.ts","sourceRoot":"","sources":["Heatmap.js"],"names":[],"mappings":";+BAkBa,OAAO,kBAAkB,EAAE,gBAAgB,GAAC,MAAM,IAAC,CAAS,IAA+B,EAA/B,OAAO,eAAe,EAAE,OAAO,KAAE,MAAM,CAAA;oBAI5D,WAAW,SAAlD,OAAQ,eAAe,EAAE,WAAY,mEACiB,gBAAgB,SAAtE,OAAQ,qBAAqB,EAAE,OAAO,CAAC,WAAW,CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDjE;;;;;;;;;;;;;GAaG;AACH,sBALoD,WAAW,SAAlD,OAAQ,eAAe,EAAE,WAAY,mEACiB,gBAAgB,SAAtE,OAAQ,qBAAqB,EAAE,OAAO,CAAC,WAAW,CAAE;IAK/D;;OAEG;IACH,sBAFW,OAAO,CAAC,WAAW,EAAE,gBAAgB,CAAC,EA6ChD;IAhCC,sDAAqC;IAErC;;;OAGG;IACH,wBAA8C;IAE9C;;;OAGG;IACH,kBAAqB;IAYrB;;OAEG;IACH,gBAAqB;IAOvB;;;;;OAKG;IACH,WAJY,OAAO,kBAAkB,EAAE,gBAAgB,CAQtD;IAED;;;;;OAKG;IACH,eAJY,KAAK,CAAC,MAAM,CAAC,CAMxB;IAED;;;;;OAKG;IACH,aAJY,OAAO,kBAAkB,EAAE,gBAAgB,CAQtD;IAED;;OAEG;IACH,+BAEC;IAED;;;;;OAKG;IACH,cAJW,OAAO,kBAAkB,EAAE,gBAAgB,QAarD;IAED;;;;;OAKG;IACH,oBAJW,KAAK,CAAC,MAAM,CAAC,QAMvB;IAED;;;;;OAKG;IACH,kBAJW,OAAO,kBAAkB,EAAE,gBAAgB,QAarD;IAED;;;;OAIG;IACH,kBAHW,OAAO,kBAAkB,EAAE,iBAAiB,QAOtD;IAED;;;;OAIG;IACH,kBAHW,gBAAgB,QAO1B;IAuHD;;;OAGG;IACH,gCAFW,OAAO,kBAAkB,EAAE,cAAc,QAKnD;IAED;;OAEG;IACH,iCAAoB;CACrB;qCAvWoC,kCAAkC;uBAChD,iBAAiB"}
|
package/layer/Heatmap.js
CHANGED
|
@@ -2,11 +2,23 @@
|
|
|
2
2
|
* @module ol/layer/Heatmap
|
|
3
3
|
*/
|
|
4
4
|
import {createCanvasContext2D} from '../dom.js';
|
|
5
|
+
import {BooleanType, NumberType} from '../expr/expression.js';
|
|
6
|
+
import {newCompilationContext} from '../expr/gpu.js';
|
|
5
7
|
import {clamp} from '../math.js';
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
+
import {ShaderBuilder} from '../render/webgl/ShaderBuilder.js';
|
|
9
|
+
import {
|
|
10
|
+
applyContextToBuilder,
|
|
11
|
+
expressionToGlsl,
|
|
12
|
+
generateAttributesFromContext,
|
|
13
|
+
generateUniformsFromContext,
|
|
14
|
+
} from '../render/webgl/compileUtil.js';
|
|
15
|
+
import WebGLVectorLayerRenderer from '../renderer/webgl/VectorLayer.js';
|
|
8
16
|
import BaseVector from './BaseVector.js';
|
|
9
17
|
|
|
18
|
+
/**
|
|
19
|
+
* @typedef {import("../style/flat.js").NumberExpression|string|function(import("../Feature.js").default):number} WeightExpression
|
|
20
|
+
*/
|
|
21
|
+
|
|
10
22
|
/**
|
|
11
23
|
* @template {import("../Feature.js").FeatureLike} [FeatureType=import("../Feature.js").default]
|
|
12
24
|
* @template {import("../source/Vector.js").default<FeatureType>} [VectorSourceType=import("../source/Vector.js").default<FeatureType>]
|
|
@@ -30,11 +42,15 @@ import BaseVector from './BaseVector.js';
|
|
|
30
42
|
* be visible.
|
|
31
43
|
* @property {Array<string>} [gradient=['#00f', '#0ff', '#0f0', '#ff0', '#f00']] The color gradient
|
|
32
44
|
* of the heatmap, specified as an array of CSS color strings.
|
|
33
|
-
* @property {
|
|
34
|
-
*
|
|
35
|
-
* @property {
|
|
36
|
-
*
|
|
45
|
+
* @property {import("../style/flat.js").NumberExpression} [radius=8] Radius size in pixels. Note that for LineStrings,
|
|
46
|
+
* the width of the line will be double the radius.
|
|
47
|
+
* @property {import("../style/flat.js").NumberExpression} [blur=15] Blur size in pixels. This is added to the `radius`
|
|
48
|
+
* parameter above to create the final size of the blur effect.
|
|
49
|
+
* @property {WeightExpression} [weight='weight'] The feature
|
|
50
|
+
* attribute to use for the weight. This also supports expressions returning a number or a function that returns a weight from a feature. Weight values
|
|
37
51
|
* should range from 0 to 1 (and values outside will be clamped to that range).
|
|
52
|
+
* @property {import("../style/flat.js").BooleanExpression} [filter] Optional filter expression.
|
|
53
|
+
* @property {Object<string, number|Array<number>|string|boolean>} [variables] Variables used in expressions (optional)
|
|
38
54
|
* @property {VectorSourceType} [source] Point source.
|
|
39
55
|
* @property {Object<string, *>} [properties] Arbitrary observable properties. Can be accessed with `#get()` and `#set()`.
|
|
40
56
|
*/
|
|
@@ -66,7 +82,7 @@ const DEFAULT_GRADIENT = ['#00f', '#0ff', '#0f0', '#ff0', '#f00'];
|
|
|
66
82
|
* @fires import("../render/Event.js").RenderEvent#postrender
|
|
67
83
|
* @template {import("../Feature.js").FeatureLike} [FeatureType=import("../Feature.js").default]
|
|
68
84
|
* @template {import("../source/Vector.js").default<FeatureType>} [VectorSourceType=import("../source/Vector.js").default<FeatureType>]
|
|
69
|
-
* @extends {BaseVector<FeatureType, VectorSourceType,
|
|
85
|
+
* @extends {BaseVector<FeatureType, VectorSourceType, WebGLVectorLayerRenderer>}
|
|
70
86
|
* @api
|
|
71
87
|
*/
|
|
72
88
|
class Heatmap extends BaseVector {
|
|
@@ -84,6 +100,14 @@ class Heatmap extends BaseVector {
|
|
|
84
100
|
delete baseOptions.weight;
|
|
85
101
|
super(baseOptions);
|
|
86
102
|
|
|
103
|
+
this.filter_ = options.filter ?? true;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* @type {import('../style/flat.js').StyleVariables}
|
|
107
|
+
* @private
|
|
108
|
+
*/
|
|
109
|
+
this.styleVariables_ = options.variables || {};
|
|
110
|
+
|
|
87
111
|
/**
|
|
88
112
|
* @private
|
|
89
113
|
* @type {HTMLCanvasElement}
|
|
@@ -103,14 +127,7 @@ class Heatmap extends BaseVector {
|
|
|
103
127
|
/**
|
|
104
128
|
* @private
|
|
105
129
|
*/
|
|
106
|
-
this.
|
|
107
|
-
typeof weight === 'string'
|
|
108
|
-
? /**
|
|
109
|
-
* @param {import('../Feature.js').default} feature Feature
|
|
110
|
-
* @return {any} weight
|
|
111
|
-
*/
|
|
112
|
-
(feature) => feature.get(weight)
|
|
113
|
-
: weight;
|
|
130
|
+
this.weight_ = weight;
|
|
114
131
|
|
|
115
132
|
// For performance reasons, don't sort the features before rendering.
|
|
116
133
|
// The render order is not relevant for a heatmap representation.
|
|
@@ -119,12 +136,14 @@ class Heatmap extends BaseVector {
|
|
|
119
136
|
|
|
120
137
|
/**
|
|
121
138
|
* Return the blur size in pixels.
|
|
122
|
-
* @return {
|
|
139
|
+
* @return {import("../style/flat.js").NumberExpression} Blur size in pixels.
|
|
123
140
|
* @api
|
|
124
141
|
* @observable
|
|
125
142
|
*/
|
|
126
143
|
getBlur() {
|
|
127
|
-
return /** @type {
|
|
144
|
+
return /** @type {import("../style/flat.js").NumberExpression} */ (
|
|
145
|
+
this.get(Property.BLUR)
|
|
146
|
+
);
|
|
128
147
|
}
|
|
129
148
|
|
|
130
149
|
/**
|
|
@@ -139,12 +158,14 @@ class Heatmap extends BaseVector {
|
|
|
139
158
|
|
|
140
159
|
/**
|
|
141
160
|
* Return the size of the radius in pixels.
|
|
142
|
-
* @return {
|
|
161
|
+
* @return {import("../style/flat.js").NumberExpression} Radius size in pixel.
|
|
143
162
|
* @api
|
|
144
163
|
* @observable
|
|
145
164
|
*/
|
|
146
165
|
getRadius() {
|
|
147
|
-
return /** @type {
|
|
166
|
+
return /** @type {import("../style/flat.js").NumberExpression} */ (
|
|
167
|
+
this.get(Property.RADIUS)
|
|
168
|
+
);
|
|
148
169
|
}
|
|
149
170
|
|
|
150
171
|
/**
|
|
@@ -156,12 +177,19 @@ class Heatmap extends BaseVector {
|
|
|
156
177
|
|
|
157
178
|
/**
|
|
158
179
|
* Set the blur size in pixels.
|
|
159
|
-
* @param {
|
|
180
|
+
* @param {import("../style/flat.js").NumberExpression} blur Blur size in pixels (supports expressions).
|
|
160
181
|
* @api
|
|
161
182
|
* @observable
|
|
162
183
|
*/
|
|
163
184
|
setBlur(blur) {
|
|
185
|
+
const previousValue = this.get(Property.BLUR);
|
|
164
186
|
this.set(Property.BLUR, blur);
|
|
187
|
+
// if the value stays numerical, simply refresh the layer
|
|
188
|
+
if (typeof blur === 'number' && typeof previousValue === 'number') {
|
|
189
|
+
this.changed();
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
this.clearRenderer();
|
|
165
193
|
}
|
|
166
194
|
|
|
167
195
|
/**
|
|
@@ -176,52 +204,134 @@ class Heatmap extends BaseVector {
|
|
|
176
204
|
|
|
177
205
|
/**
|
|
178
206
|
* Set the size of the radius in pixels.
|
|
179
|
-
* @param {
|
|
207
|
+
* @param {import("../style/flat.js").NumberExpression} radius Radius size in pixel (supports expressions).
|
|
180
208
|
* @api
|
|
181
209
|
* @observable
|
|
182
210
|
*/
|
|
183
211
|
setRadius(radius) {
|
|
212
|
+
const previousValue = this.get(Property.RADIUS);
|
|
184
213
|
this.set(Property.RADIUS, radius);
|
|
214
|
+
// if the value stays numerical, simply refresh the layer
|
|
215
|
+
if (typeof radius === 'number' && typeof previousValue === 'number') {
|
|
216
|
+
this.changed();
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
this.clearRenderer();
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Set the filter expression
|
|
224
|
+
* @param {import("../style/flat.js").BooleanExpression} filter Filter expression
|
|
225
|
+
* @api
|
|
226
|
+
*/
|
|
227
|
+
setFilter(filter) {
|
|
228
|
+
this.filter_ = filter;
|
|
229
|
+
this.changed();
|
|
230
|
+
this.clearRenderer();
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Set the weight expression
|
|
235
|
+
* @param {WeightExpression} weight Weight expression
|
|
236
|
+
* @api
|
|
237
|
+
*/
|
|
238
|
+
setWeight(weight) {
|
|
239
|
+
this.weight_ = weight;
|
|
240
|
+
this.changed();
|
|
241
|
+
this.clearRenderer();
|
|
185
242
|
}
|
|
186
243
|
|
|
187
244
|
/**
|
|
188
245
|
* @override
|
|
189
246
|
*/
|
|
190
247
|
createRenderer() {
|
|
191
|
-
const builder = new ShaderBuilder()
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
248
|
+
const builder = new ShaderBuilder();
|
|
249
|
+
|
|
250
|
+
const context = newCompilationContext();
|
|
251
|
+
const filterCompiled = expressionToGlsl(context, this.filter_, BooleanType);
|
|
252
|
+
let radiusCompiled = expressionToGlsl(
|
|
253
|
+
context,
|
|
254
|
+
this.getRadius(),
|
|
255
|
+
NumberType,
|
|
256
|
+
);
|
|
257
|
+
let blurCompiled = expressionToGlsl(context, this.getBlur(), NumberType);
|
|
258
|
+
|
|
259
|
+
/** @type {import('../render/webgl/VectorStyleRenderer.js').UniformDefinitions} */
|
|
260
|
+
const blurRadiusUniforms = {};
|
|
261
|
+
if (typeof this.getBlur() === 'number') {
|
|
262
|
+
blurCompiled = 'a_blur';
|
|
263
|
+
blurRadiusUniforms['a_blur'] = () => this.getBlur();
|
|
264
|
+
builder.addUniform('float a_blur');
|
|
265
|
+
}
|
|
266
|
+
if (typeof this.getRadius() === 'number') {
|
|
267
|
+
radiusCompiled = 'a_radius';
|
|
268
|
+
blurRadiusUniforms['a_radius'] = () => this.getRadius();
|
|
269
|
+
builder.addUniform('float a_radius');
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/** @type {import('../render/webgl/VectorStyleRenderer.js').AttributeDefinitions} */
|
|
273
|
+
const weightAttribute = {};
|
|
274
|
+
let weightExpression = null;
|
|
275
|
+
if (
|
|
276
|
+
typeof this.weight_ === 'string' ||
|
|
277
|
+
typeof this.weight_ === 'function'
|
|
278
|
+
) {
|
|
279
|
+
const weightFunction =
|
|
280
|
+
typeof this.weight_ === 'string'
|
|
281
|
+
? (feature) => feature.get(this.weight_)
|
|
282
|
+
: this.weight_;
|
|
283
|
+
weightAttribute['prop_weight'] = {
|
|
284
|
+
size: 1,
|
|
285
|
+
callback: (feature) => {
|
|
286
|
+
const weightValue = weightFunction(feature);
|
|
287
|
+
return weightValue !== undefined ? clamp(weightValue, 0, 1) : 1;
|
|
288
|
+
},
|
|
289
|
+
};
|
|
290
|
+
weightExpression = 'a_prop_weight';
|
|
291
|
+
builder.addAttribute('a_prop_weight', 'float');
|
|
292
|
+
} else {
|
|
293
|
+
const clampedWeight = ['clamp', this.weight_, 0, 1];
|
|
294
|
+
weightExpression = expressionToGlsl(context, clampedWeight, NumberType);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
builder
|
|
298
|
+
.addFragmentShaderFunction(
|
|
299
|
+
`float getBlurSlope() {
|
|
300
|
+
float blur = max(1., ${blurCompiled});
|
|
301
|
+
float radius = ${radiusCompiled};
|
|
302
|
+
return radius / blur;
|
|
303
|
+
}`,
|
|
304
|
+
)
|
|
305
|
+
.setSymbolSizeExpression(`vec2(${radiusCompiled} + ${blurCompiled}) * 2.`)
|
|
197
306
|
.setSymbolColorExpression(
|
|
198
|
-
|
|
199
|
-
)
|
|
200
|
-
|
|
201
|
-
|
|
307
|
+
`vec4(smoothstep(0., 1., (1. - length(coordsPx * 2. / v_quadSizePx)) * getBlurSlope()) * ${weightExpression})`,
|
|
308
|
+
)
|
|
309
|
+
.setStrokeColorExpression(
|
|
310
|
+
`vec4(smoothstep(0., 1., (1. - length(currentRadiusPx * 2. / v_width)) * getBlurSlope()) * ${weightExpression})`,
|
|
311
|
+
)
|
|
312
|
+
.setStrokeWidthExpression(`(${radiusCompiled} + ${blurCompiled}) * 2.`)
|
|
313
|
+
.setFillColorExpression(`vec4(${weightExpression})`)
|
|
314
|
+
.setFragmentDiscardExpression(`!${filterCompiled}`);
|
|
315
|
+
|
|
316
|
+
applyContextToBuilder(builder, context);
|
|
317
|
+
const attributes = generateAttributesFromContext(context);
|
|
318
|
+
const uniforms = generateUniformsFromContext(context, this.styleVariables_);
|
|
319
|
+
|
|
320
|
+
return new WebGLVectorLayerRenderer(this, {
|
|
202
321
|
className: this.getClassName(),
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
},
|
|
210
|
-
},
|
|
211
|
-
],
|
|
212
|
-
uniforms: {
|
|
213
|
-
u_size: () => {
|
|
214
|
-
return (this.get(Property.RADIUS) + this.get(Property.BLUR)) * 2;
|
|
322
|
+
variables: this.styleVariables_,
|
|
323
|
+
style: {
|
|
324
|
+
builder,
|
|
325
|
+
attributes: {
|
|
326
|
+
...attributes,
|
|
327
|
+
...weightAttribute,
|
|
215
328
|
},
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
);
|
|
329
|
+
uniforms: {
|
|
330
|
+
...uniforms,
|
|
331
|
+
...blurRadiusUniforms,
|
|
220
332
|
},
|
|
221
333
|
},
|
|
222
|
-
|
|
223
|
-
vertexShader: builder.getSymbolVertexShader(),
|
|
224
|
-
fragmentShader: builder.getSymbolFragmentShader(),
|
|
334
|
+
disableHitDetection: false,
|
|
225
335
|
postProcesses: [
|
|
226
336
|
{
|
|
227
337
|
fragmentShader: `
|
|
@@ -248,6 +358,15 @@ class Heatmap extends BaseVector {
|
|
|
248
358
|
});
|
|
249
359
|
}
|
|
250
360
|
|
|
361
|
+
/**
|
|
362
|
+
* Update any variables used by the layer style and trigger a re-render.
|
|
363
|
+
* @param {import('../style/flat.js').StyleVariables} variables Variables to update.
|
|
364
|
+
*/
|
|
365
|
+
updateStyleVariables(variables) {
|
|
366
|
+
Object.assign(this.styleVariables_, variables);
|
|
367
|
+
this.changed();
|
|
368
|
+
}
|
|
369
|
+
|
|
251
370
|
/**
|
|
252
371
|
* @override
|
|
253
372
|
*/
|
package/layer/WebGLPoints.d.ts
CHANGED
|
@@ -158,7 +158,7 @@ declare class WebGLPointsLayer<VectorSourceType extends import("../source/Vector
|
|
|
158
158
|
private styleVariables_;
|
|
159
159
|
/**
|
|
160
160
|
* @private
|
|
161
|
-
* @type {import('../webgl/
|
|
161
|
+
* @type {import('../render/webgl/style.js').StyleParseResult}
|
|
162
162
|
*/
|
|
163
163
|
private parseResult_;
|
|
164
164
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebGLPoints.d.ts","sourceRoot":"","sources":["WebGLPoints.js"],"names":[],"mappings":";oBAQuF,gBAAgB,SAA1F,OAAQ,qBAAqB,EAAE,OAAO,CAAC,OAAO,YAAY,EAAE,WAAW,CAAE;;;;WAExE,OAAO,kBAAkB,EAAE,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAHlD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,+BANuF,gBAAgB,SAA1F,OAAQ,qBAAqB,EAAE,OAAO,CAAC,OAAO,YAAY,EAAE,WAAW,CAAE;IAOpF;;OAEG;IACH,qBAFW,OAAO,CAAC,gBAAgB,CAAC,EA4BnC;IArBC;;;OAGG;IACH,wBAA8C;IAE9C;;;OAGG;IACH,qBAIC;IAED;;;OAGG;IACH,8BAA0D;IAyB5D;;;OAGG;IACH;;aAGC;CACF;
|
|
1
|
+
{"version":3,"file":"WebGLPoints.d.ts","sourceRoot":"","sources":["WebGLPoints.js"],"names":[],"mappings":";oBAQuF,gBAAgB,SAA1F,OAAQ,qBAAqB,EAAE,OAAO,CAAC,OAAO,YAAY,EAAE,WAAW,CAAE;;;;WAExE,OAAO,kBAAkB,EAAE,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAHlD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,+BANuF,gBAAgB,SAA1F,OAAQ,qBAAqB,EAAE,OAAO,CAAC,OAAO,YAAY,EAAE,WAAW,CAAE;IAOpF;;OAEG;IACH,qBAFW,OAAO,CAAC,gBAAgB,CAAC,EA4BnC;IArBC;;;OAGG;IACH,wBAA8C;IAE9C;;;OAGG;IACH,qBAIC;IAED;;;OAGG;IACH,8BAA0D;IAyB5D;;;OAGG;IACH;;aAGC;CACF;qCAtIoC,kCAAkC;kBACrD,YAAY"}
|
package/layer/WebGLPoints.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module ol/layer/WebGLPoints
|
|
3
3
|
*/
|
|
4
|
+
import {parseLiteralStyle} from '../render/webgl/style.js';
|
|
4
5
|
import WebGLPointsLayerRenderer from '../renderer/webgl/PointsLayer.js';
|
|
5
|
-
import {parseLiteralStyle} from '../webgl/styleparser.js';
|
|
6
6
|
import Layer from './Layer.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -91,7 +91,7 @@ class WebGLPointsLayer extends Layer {
|
|
|
91
91
|
|
|
92
92
|
/**
|
|
93
93
|
* @private
|
|
94
|
-
* @type {import('../webgl/
|
|
94
|
+
* @type {import('../render/webgl/style.js').StyleParseResult}
|
|
95
95
|
*/
|
|
96
96
|
this.parseResult_ = parseLiteralStyle(
|
|
97
97
|
options.style,
|