ol 10.3.2-dev.1735646205796 → 10.3.2-dev.1736174878428
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 +1 -1
- package/dist/ol.js.map +1 -1
- package/layer/WebGLTile.d.ts.map +1 -1
- package/layer/WebGLTile.js +1 -0
- package/package.json +1 -1
- package/renderer/webgl/PointsLayer.d.ts +11 -7
- package/renderer/webgl/PointsLayer.d.ts.map +1 -1
- package/renderer/webgl/PointsLayer.js +81 -57
- package/util.js +1 -1
package/layer/WebGLTile.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebGLTile.d.ts","sourceRoot":"","sources":["WebGLTile.js"],"names":[],"mappings":";yBAmBa,OAAO,uBAAuB,EAAE,OAAO,CAAC,OAAO,gBAAgB,EAAE,OAAO,GAAC,OAAO,iBAAiB,EAAE,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wIA+C/E,OAAO,cAAc,EAAE,MAAM,QAAE,MAAM,KAAE,KAAK,CAAC,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAiBnF,MAAM;;;;oBACN,MAAM;;;;;;;;;;qBAEN,KAAK,CAAC,OAAO,4BAA4B,EAAE,OAAO,CAAC;;AAyLjE;;;;;;;;;;;;GAYG;AACH;IACE;;OAEG;IACH,qBAFW,OAAO,
|
|
1
|
+
{"version":3,"file":"WebGLTile.d.ts","sourceRoot":"","sources":["WebGLTile.js"],"names":[],"mappings":";yBAmBa,OAAO,uBAAuB,EAAE,OAAO,CAAC,OAAO,gBAAgB,EAAE,OAAO,GAAC,OAAO,iBAAiB,EAAE,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wIA+C/E,OAAO,cAAc,EAAE,MAAM,QAAE,MAAM,KAAE,KAAK,CAAC,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAiBnF,MAAM;;;;oBACN,MAAM;;;;;;;;;;qBAEN,KAAK,CAAC,OAAO,4BAA4B,EAAE,OAAO,CAAC;;AAyLjE;;;;;;;;;;;;GAYG;AACH;IACE;;OAEG;IACH,qBAFW,OAAO,EA0CjB;IAhCC;;;OAGG;IACH,iBAA+B;IAE/B;;;OAGG;IACH,wBAA2B;IAE3B;;;OAGG;IACH,4BAA8B;IAE9B;;;OAGG;IACH,eAAmB;IAEnB;;;OAGG;IACH,wBAAkD;IAMpD;;;;;OAKG;IACH,mBAJW,OAAO,cAAc,EAAE,MAAM,cAC7B,MAAM,GACL,KAAK,CAAC,UAAU,CAAC,CAW5B;IAED;;;OAGG;IACH,4BAHY,UAAU,CAKrB;IAWD;;OAEG;IACH,4BAkBC;IAED;;;OAGG;IACH,4BAMC;IAED;;OAEG;IACH,wDAUC;IAED;;;;OAIG;IACH,0BAJW,OAAO,QAAQ,EAAE,UAAU,WAC3B,KAAK,CAAC,UAAU,CAAC,GAChB,WAAW,CAYtB;IAED;;;;;;OAMG;IACH,4BANY,OAAO,WAAW,EAAE,UAAU,OAAA,UAC/B,WAAW,GAEV,WAAW,CAuCtB;IAED;;;;;;;OAOG;IACH,gBAFW,KAAK,QAgBf;IAED;;;;OAIG;IACH;;aAGC;CACF;mCA/eM,gCAAgC;0BAEb,eAAe"}
|
package/layer/WebGLTile.js
CHANGED
package/package.json
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export default WebGLPointsLayerRenderer;
|
|
2
|
+
export type Point = import("../../geom/Point.js").default;
|
|
3
|
+
export type PointFeature = import("../../Feature").default<Point>;
|
|
2
4
|
/**
|
|
3
5
|
* A description of a custom attribute to be passed on to the GPU, with a value different
|
|
4
6
|
* for each feature.
|
|
@@ -12,7 +14,7 @@ export type CustomAttribute = {
|
|
|
12
14
|
* This callback computes the numerical value of the
|
|
13
15
|
* attribute for a given feature (properties are available as 2nd arg for quicker access).
|
|
14
16
|
*/
|
|
15
|
-
callback: (arg0:
|
|
17
|
+
callback: (arg0: PointFeature, arg1: {
|
|
16
18
|
[x: string]: any;
|
|
17
19
|
}) => number;
|
|
18
20
|
};
|
|
@@ -24,7 +26,7 @@ export type FeatureCacheItem = {
|
|
|
24
26
|
/**
|
|
25
27
|
* Feature
|
|
26
28
|
*/
|
|
27
|
-
feature:
|
|
29
|
+
feature: PointFeature;
|
|
28
30
|
/**
|
|
29
31
|
* Feature properties
|
|
30
32
|
*/
|
|
@@ -32,9 +34,9 @@ export type FeatureCacheItem = {
|
|
|
32
34
|
[x: string]: any;
|
|
33
35
|
};
|
|
34
36
|
/**
|
|
35
|
-
*
|
|
37
|
+
* Point coordinates
|
|
36
38
|
*/
|
|
37
|
-
|
|
39
|
+
flatCoordinates: import("../../coordinate.js").Coordinate;
|
|
38
40
|
};
|
|
39
41
|
export type Options = {
|
|
40
42
|
/**
|
|
@@ -73,19 +75,21 @@ export type Options = {
|
|
|
73
75
|
*/
|
|
74
76
|
postProcesses?: import("./Layer.js").PostProcessesOptions[] | undefined;
|
|
75
77
|
};
|
|
78
|
+
/** @typedef {import("../../geom/Point.js").default} Point */
|
|
79
|
+
/** @typedef {import("../../Feature").default<Point>} PointFeature */
|
|
76
80
|
/**
|
|
77
81
|
* @typedef {Object} CustomAttribute A description of a custom attribute to be passed on to the GPU, with a value different
|
|
78
82
|
* for each feature.
|
|
79
83
|
* @property {string} name Attribute name.
|
|
80
|
-
* @property {function(
|
|
84
|
+
* @property {function(PointFeature, Object<string, *>):number} callback This callback computes the numerical value of the
|
|
81
85
|
* attribute for a given feature (properties are available as 2nd arg for quicker access).
|
|
82
86
|
*/
|
|
83
87
|
/**
|
|
84
88
|
* @typedef {Object} FeatureCacheItem Object that holds a reference to a feature, its geometry and properties. Used to optimize
|
|
85
89
|
* rebuildBuffers by accessing these objects quicker.
|
|
86
|
-
* @property {
|
|
90
|
+
* @property {PointFeature} feature Feature
|
|
87
91
|
* @property {Object<string, *>} properties Feature properties
|
|
88
|
-
* @property {import("../../
|
|
92
|
+
* @property {import("../../coordinate.js").Coordinate} flatCoordinates Point coordinates
|
|
89
93
|
*/
|
|
90
94
|
/**
|
|
91
95
|
* @typedef {Object} Options
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PointsLayer.d.ts","sourceRoot":"","sources":["PointsLayer.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PointsLayer.d.ts","sourceRoot":"","sources":["PointsLayer.js"],"names":[],"mappings":";oBA4Bc,OAAO,qBAAqB,EAAE,OAAO;2BACrC,OAAO,eAAe,EAAE,OAAO,CAAC,KAAK,CAAC;;;;;;;;;UAKtC,MAAM;;;;;cACN,CAAS,IAAY,EAAZ,YAAY,EAAE,IAAiB,EAAjB;YAAO,MAAM,GAAE,GAAC;KAAC,KAAE,MAAM;;;;;;;;;;aAOhD,YAAY;;;;;;;;;;qBAEZ,OAAO,qBAAqB,EAAE,UAAU;;;;;;;;;;;;;;;;;;kBAWxC,MAAM;;;;oBACN,MAAM;;;;;;;;;;;;;;;;;AA5BpB,6DAA6D;AAC7D,qEAAqE;AAErE;;;;;;GAMG;AAEH;;;;;;GAMG;AAEH;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AACH;IACE;;;OAGG;IACH,mBAHW,OAAO,sBAAsB,EAAE,OAAO,WACtC,OAAO,EAyOjB;IA7NC;;OAEG;IACH,wBAAyB;IAEzB;;OAEG;IACH,wBAAuE;IACvE;;OAEG;IACH,uBAGC;IAED;;OAEG;IACH,sBAAyC;IAEzC;;OAEG;IACH,wBAA6C;IAE7C;;;OAGG;IACH,iBAAa;IAEb;;;OAGG;IACH,6BAA+D;IAY/D;;;;OAIG;IACH,YAFU,KAAK,CAAC,OAAO,uBAAuB,EAAE,oBAAoB,CAAC,CAapE;IAgBD,oCAAoE;IAEpE;;OAEG;IACH,wBAAoC;IAEpC;;;;;;OAMG;IACH,0BAAkD;IAElD;;;;OAIG;IACH,yBAAyC;IAEzC;;;OAGG;IACH,+BAA+C;IAE/C;;;OAGG;IACH,4BAA8C;IAE9C;;;OAGG;IACH,yBAAqB;IAErB;;;;OAIG;IACH,mBAAmB;IAEnB;;OAEG;IACH,gBAAkC;IAgClC;;;;OAIG;IACH,sBAAuB;IAEvB;;;;OAIG;IACH,sBAAsB;IAKtB;;OAEG;IACH,0BAyBC;IAoCH;;;OAGG;IACH,kCAWC;IAED;;;OAGG;IACH,oCAyBC;IAED;;;OAGG;IACH,mCAOC;IAED;;OAEG;IACH,kCAGC;IAED;;;;;OAKG;IACH,iCAJW,OAAO,cAAc,EAAE,UAAU,GAChC,WAAW,CA6BtB;IA8CD;;;;OAIG;IACH,wBAwEC;IA8CD;;;;;;;OAOG;IACH,yBANW,OAAO,cAAc,EAAE,UAAU,mBACjC,OAAO,cACP,MAAM,YACN,MAAM,cACN,MAAM,QAgChB;IAeD,wBAAoB;CACrB;+BA7qB8B,YAAY"}
|
|
@@ -26,20 +26,23 @@ import {create as createWebGLWorker} from '../../worker/webgl.js';
|
|
|
26
26
|
import WebGLLayerRenderer from './Layer.js';
|
|
27
27
|
import {getWorldParameters} from './worldUtil.js';
|
|
28
28
|
|
|
29
|
+
/** @typedef {import("../../geom/Point.js").default} Point */
|
|
30
|
+
/** @typedef {import("../../Feature").default<Point>} PointFeature */
|
|
31
|
+
|
|
29
32
|
/**
|
|
30
33
|
* @typedef {Object} CustomAttribute A description of a custom attribute to be passed on to the GPU, with a value different
|
|
31
34
|
* for each feature.
|
|
32
35
|
* @property {string} name Attribute name.
|
|
33
|
-
* @property {function(
|
|
36
|
+
* @property {function(PointFeature, Object<string, *>):number} callback This callback computes the numerical value of the
|
|
34
37
|
* attribute for a given feature (properties are available as 2nd arg for quicker access).
|
|
35
38
|
*/
|
|
36
39
|
|
|
37
40
|
/**
|
|
38
41
|
* @typedef {Object} FeatureCacheItem Object that holds a reference to a feature, its geometry and properties. Used to optimize
|
|
39
42
|
* rebuildBuffers by accessing these objects quicker.
|
|
40
|
-
* @property {
|
|
43
|
+
* @property {PointFeature} feature Feature
|
|
41
44
|
* @property {Object<string, *>} properties Feature properties
|
|
42
|
-
* @property {import("../../
|
|
45
|
+
* @property {import("../../coordinate.js").Coordinate} flatCoordinates Point coordinates
|
|
43
46
|
*/
|
|
44
47
|
|
|
45
48
|
/**
|
|
@@ -314,7 +317,9 @@ class WebGLPointsLayerRenderer extends WebGLLayerRenderer {
|
|
|
314
317
|
*/
|
|
315
318
|
this.featureCount_ = 0;
|
|
316
319
|
|
|
317
|
-
const source =
|
|
320
|
+
const source = /** @type {import("../../source/Vector.js").default} */ (
|
|
321
|
+
this.getLayer().getSource()
|
|
322
|
+
);
|
|
318
323
|
/**
|
|
319
324
|
* @private
|
|
320
325
|
*/
|
|
@@ -345,12 +350,15 @@ class WebGLPointsLayerRenderer extends WebGLLayerRenderer {
|
|
|
345
350
|
),
|
|
346
351
|
];
|
|
347
352
|
source.forEachFeature((feature) => {
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
353
|
+
const geometry = feature.getGeometry();
|
|
354
|
+
if (geometry && geometry.getType() === 'Point') {
|
|
355
|
+
this.featureCache_[getUid(feature)] = {
|
|
356
|
+
feature: /** @type {PointFeature} */ (feature),
|
|
357
|
+
properties: feature.getProperties(),
|
|
358
|
+
flatCoordinates: /** @type {Point} */ (geometry).getFlatCoordinates(),
|
|
359
|
+
};
|
|
360
|
+
this.featureCount_++;
|
|
361
|
+
}
|
|
354
362
|
});
|
|
355
363
|
}
|
|
356
364
|
|
|
@@ -382,12 +390,15 @@ class WebGLPointsLayerRenderer extends WebGLLayerRenderer {
|
|
|
382
390
|
*/
|
|
383
391
|
handleSourceFeatureAdded_(event) {
|
|
384
392
|
const feature = event.feature;
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
393
|
+
const geometry = feature.getGeometry();
|
|
394
|
+
if (geometry && geometry.getType() === 'Point') {
|
|
395
|
+
this.featureCache_[getUid(feature)] = {
|
|
396
|
+
feature: /** @type {PointFeature} */ (feature),
|
|
397
|
+
properties: feature.getProperties(),
|
|
398
|
+
flatCoordinates: /** @type {Point} */ (geometry).getFlatCoordinates(),
|
|
399
|
+
};
|
|
400
|
+
this.featureCount_++;
|
|
401
|
+
}
|
|
391
402
|
}
|
|
392
403
|
|
|
393
404
|
/**
|
|
@@ -396,11 +407,29 @@ class WebGLPointsLayerRenderer extends WebGLLayerRenderer {
|
|
|
396
407
|
*/
|
|
397
408
|
handleSourceFeatureChanged_(event) {
|
|
398
409
|
const feature = event.feature;
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
410
|
+
const featureUid = getUid(feature);
|
|
411
|
+
const item = this.featureCache_[featureUid];
|
|
412
|
+
const geometry = feature.getGeometry();
|
|
413
|
+
if (item) {
|
|
414
|
+
if (geometry && geometry.getType() === 'Point') {
|
|
415
|
+
item.properties = feature.getProperties();
|
|
416
|
+
item.flatCoordinates = /** @type {Point} */ (
|
|
417
|
+
geometry
|
|
418
|
+
).getFlatCoordinates();
|
|
419
|
+
} else {
|
|
420
|
+
delete this.featureCache_[featureUid];
|
|
421
|
+
this.featureCount_--;
|
|
422
|
+
}
|
|
423
|
+
} else {
|
|
424
|
+
if (geometry && geometry.getType() === 'Point') {
|
|
425
|
+
this.featureCache_[featureUid] = {
|
|
426
|
+
feature: /** @type {PointFeature} */ (feature),
|
|
427
|
+
properties: feature.getProperties(),
|
|
428
|
+
flatCoordinates: /** @type {Point} */ (geometry).getFlatCoordinates(),
|
|
429
|
+
};
|
|
430
|
+
this.featureCount_++;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
404
433
|
}
|
|
405
434
|
|
|
406
435
|
/**
|
|
@@ -409,8 +438,11 @@ class WebGLPointsLayerRenderer extends WebGLLayerRenderer {
|
|
|
409
438
|
*/
|
|
410
439
|
handleSourceFeatureDelete_(event) {
|
|
411
440
|
const feature = event.feature;
|
|
412
|
-
|
|
413
|
-
this.
|
|
441
|
+
const featureUid = getUid(feature);
|
|
442
|
+
if (featureUid in this.featureCache_) {
|
|
443
|
+
delete this.featureCache_[featureUid];
|
|
444
|
+
this.featureCount_--;
|
|
445
|
+
}
|
|
414
446
|
}
|
|
415
447
|
|
|
416
448
|
/**
|
|
@@ -515,51 +547,44 @@ class WebGLPointsLayerRenderer extends WebGLLayerRenderer {
|
|
|
515
547
|
const singleInstructionLength =
|
|
516
548
|
baseInstructionLength + this.customAttributes.length;
|
|
517
549
|
const totalSize = singleInstructionLength * this.featureCount_;
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
}
|
|
550
|
+
const renderInstructions =
|
|
551
|
+
this.renderInstructions_ && this.renderInstructions_.length === totalSize
|
|
552
|
+
? this.renderInstructions_
|
|
553
|
+
: new Float32Array(totalSize);
|
|
554
|
+
this.renderInstructions_ = null;
|
|
524
555
|
|
|
525
|
-
// loop
|
|
526
|
-
|
|
527
|
-
|
|
556
|
+
// loop over features to fill the buffer
|
|
557
|
+
/** @type {import('../../coordinate.js').Coordinate} */
|
|
558
|
+
let tmpCoords = [];
|
|
559
|
+
/** @type {Array<number>} */
|
|
528
560
|
const tmpColor = [];
|
|
529
561
|
let idx = -1;
|
|
562
|
+
const projection = frameState.viewState.projection;
|
|
530
563
|
for (const featureUid in this.featureCache_) {
|
|
531
|
-
featureCache = this.featureCache_[featureUid];
|
|
532
|
-
geometry = /** @type {import("../../geom").Point} */ (
|
|
533
|
-
featureCache.geometry
|
|
534
|
-
);
|
|
535
|
-
if (!geometry || geometry.getType() !== 'Point') {
|
|
536
|
-
continue;
|
|
537
|
-
}
|
|
564
|
+
const featureCache = this.featureCache_[featureUid];
|
|
538
565
|
if (userProjection) {
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
566
|
+
tmpCoords = fromUserCoordinate(
|
|
567
|
+
featureCache.flatCoordinates,
|
|
568
|
+
projection,
|
|
542
569
|
);
|
|
543
|
-
tmpCoords[0] = userCoords[0];
|
|
544
|
-
tmpCoords[1] = userCoords[1];
|
|
545
570
|
} else {
|
|
546
|
-
tmpCoords[0] =
|
|
547
|
-
tmpCoords[1] =
|
|
571
|
+
tmpCoords[0] = featureCache.flatCoordinates[0];
|
|
572
|
+
tmpCoords[1] = featureCache.flatCoordinates[1];
|
|
548
573
|
}
|
|
549
574
|
applyTransform(projectionTransform, tmpCoords);
|
|
550
575
|
|
|
551
|
-
|
|
552
|
-
|
|
576
|
+
renderInstructions[++idx] = tmpCoords[0];
|
|
577
|
+
renderInstructions[++idx] = tmpCoords[1];
|
|
553
578
|
|
|
554
579
|
// for hit detection, the feature uid is saved in the opacity value
|
|
555
580
|
// and the index of the opacity value is encoded in the color values
|
|
556
581
|
if (this.hitDetectionEnabled_) {
|
|
557
582
|
const hitColor = colorEncodeId(idx + 5, tmpColor);
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
583
|
+
renderInstructions[++idx] = hitColor[0];
|
|
584
|
+
renderInstructions[++idx] = hitColor[1];
|
|
585
|
+
renderInstructions[++idx] = hitColor[2];
|
|
586
|
+
renderInstructions[++idx] = hitColor[3];
|
|
587
|
+
renderInstructions[++idx] = Number(featureUid);
|
|
563
588
|
}
|
|
564
589
|
|
|
565
590
|
// pushing custom attributes
|
|
@@ -568,7 +593,7 @@ class WebGLPointsLayerRenderer extends WebGLLayerRenderer {
|
|
|
568
593
|
featureCache.feature,
|
|
569
594
|
featureCache.properties,
|
|
570
595
|
);
|
|
571
|
-
|
|
596
|
+
renderInstructions[++idx] = value;
|
|
572
597
|
}
|
|
573
598
|
}
|
|
574
599
|
|
|
@@ -576,14 +601,13 @@ class WebGLPointsLayerRenderer extends WebGLLayerRenderer {
|
|
|
576
601
|
const message = {
|
|
577
602
|
id: ++this.lastSentId,
|
|
578
603
|
type: WebGLWorkerMessageType.GENERATE_POINT_BUFFERS,
|
|
579
|
-
renderInstructions:
|
|
604
|
+
renderInstructions: renderInstructions.buffer,
|
|
580
605
|
customAttributesSize: singleInstructionLength - 2,
|
|
581
606
|
};
|
|
582
607
|
// additional properties will be sent back as-is by the worker
|
|
583
608
|
message['projectionTransform'] = projectionTransform;
|
|
584
609
|
this.ready = false;
|
|
585
|
-
this.worker_.postMessage(message, [
|
|
586
|
-
this.renderInstructions_ = null;
|
|
610
|
+
this.worker_.postMessage(message, [renderInstructions.buffer]);
|
|
587
611
|
}
|
|
588
612
|
|
|
589
613
|
/**
|
package/util.js
CHANGED