ol 10.6.2-dev.1750922991910 → 10.6.2-dev.1751277211647
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 +0 -2
- package/dist/ol.d.ts.map +1 -1
- package/dist/ol.js +1 -1
- package/dist/ol.js.map +1 -1
- package/layer/WebGLVectorTile.d.ts.map +1 -1
- package/layer/WebGLVectorTile.js +1 -0
- package/package.json +1 -1
- package/render/webgl/VectorStyleRenderer.d.ts +64 -111
- package/render/webgl/VectorStyleRenderer.d.ts.map +1 -1
- package/render/webgl/VectorStyleRenderer.js +268 -287
- package/render/webgl/style.d.ts +0 -15
- package/render/webgl/style.d.ts.map +1 -1
- package/render/webgl/style.js +0 -72
- package/renderer/webgl/TileLayerBase.d.ts.map +1 -1
- package/renderer/webgl/TileLayerBase.js +1 -4
- package/renderer/webgl/VectorLayer.d.ts +13 -12
- package/renderer/webgl/VectorLayer.d.ts.map +1 -1
- package/renderer/webgl/VectorLayer.js +38 -53
- package/renderer/webgl/VectorTileLayer.d.ts +10 -10
- package/renderer/webgl/VectorTileLayer.d.ts.map +1 -1
- package/renderer/webgl/VectorTileLayer.js +38 -57
- package/util.js +1 -1
- package/webgl/Helper.d.ts +2 -2
- package/webgl/Helper.d.ts.map +1 -1
- package/webgl/Helper.js +11 -8
- package/webgl/TileGeometry.d.ts +5 -10
- package/webgl/TileGeometry.d.ts.map +1 -1
- package/webgl/TileGeometry.js +28 -44
package/render/webgl/style.js
CHANGED
|
@@ -828,75 +828,3 @@ export function parseLiteralStyle(style, variables, filter) {
|
|
|
828
828
|
},
|
|
829
829
|
};
|
|
830
830
|
}
|
|
831
|
-
|
|
832
|
-
/**
|
|
833
|
-
* @typedef {import('./VectorStyleRenderer.js').AsShaders} StyleAsShaders
|
|
834
|
-
*/
|
|
835
|
-
/**
|
|
836
|
-
* @typedef {import('./VectorStyleRenderer.js').AsRule} StyleAsRule
|
|
837
|
-
*/
|
|
838
|
-
|
|
839
|
-
/**
|
|
840
|
-
* Takes in either a Flat Style or an array of shaders (used as input for the webgl vector layer classes)
|
|
841
|
-
* and breaks it down into separate styles to be used by the VectorStyleRenderer class.
|
|
842
|
-
* @param {import('../../style/flat.js').FlatStyleLike | Array<StyleAsShaders> | StyleAsShaders} style Flat style or shaders
|
|
843
|
-
* @return {Array<StyleAsShaders | StyleAsRule>} Separate styles as shaders or rules with a single flat style and a filter
|
|
844
|
-
*/
|
|
845
|
-
export function breakDownFlatStyle(style) {
|
|
846
|
-
// possible cases:
|
|
847
|
-
// - single shader
|
|
848
|
-
// - multiple shaders
|
|
849
|
-
// - single style
|
|
850
|
-
// - multiple styles
|
|
851
|
-
// - multiple rules
|
|
852
|
-
const asArray = Array.isArray(style) ? style : [style];
|
|
853
|
-
|
|
854
|
-
// if array of rules: break rules into separate styles, compute "else" filters
|
|
855
|
-
if ('style' in asArray[0]) {
|
|
856
|
-
/** @type {Array<StyleAsRule>} */
|
|
857
|
-
const styles = [];
|
|
858
|
-
const rules = /** @type {Array<import('../../style/flat.js').Rule>} */ (
|
|
859
|
-
asArray
|
|
860
|
-
);
|
|
861
|
-
const previousFilters = [];
|
|
862
|
-
for (const rule of rules) {
|
|
863
|
-
const ruleStyles = Array.isArray(rule.style) ? rule.style : [rule.style];
|
|
864
|
-
/** @type {import("../../expr/expression.js").EncodedExpression} */
|
|
865
|
-
let currentFilter = rule.filter;
|
|
866
|
-
if (rule.else && previousFilters.length) {
|
|
867
|
-
currentFilter = [
|
|
868
|
-
'all',
|
|
869
|
-
...previousFilters.map((filter) => ['!', filter]),
|
|
870
|
-
];
|
|
871
|
-
if (rule.filter) {
|
|
872
|
-
currentFilter.push(rule.filter);
|
|
873
|
-
}
|
|
874
|
-
if (currentFilter.length < 3) {
|
|
875
|
-
currentFilter = currentFilter[1];
|
|
876
|
-
}
|
|
877
|
-
}
|
|
878
|
-
if (rule.filter) {
|
|
879
|
-
previousFilters.push(rule.filter);
|
|
880
|
-
}
|
|
881
|
-
/** @type {Array<StyleAsRule>} */
|
|
882
|
-
const stylesWithFilters = ruleStyles.map((style) => ({
|
|
883
|
-
style,
|
|
884
|
-
...(currentFilter && {filter: currentFilter}),
|
|
885
|
-
}));
|
|
886
|
-
styles.push(...stylesWithFilters);
|
|
887
|
-
}
|
|
888
|
-
return styles;
|
|
889
|
-
}
|
|
890
|
-
|
|
891
|
-
// if array of shaders: return as is
|
|
892
|
-
if ('builder' in asArray[0]) {
|
|
893
|
-
return /** @type {Array<StyleAsShaders>} */ (asArray);
|
|
894
|
-
}
|
|
895
|
-
|
|
896
|
-
return asArray.map(
|
|
897
|
-
(style) =>
|
|
898
|
-
/** @type {StyleAsRule} */ ({
|
|
899
|
-
style,
|
|
900
|
-
}),
|
|
901
|
-
);
|
|
902
|
-
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TileLayerBase.d.ts","sourceRoot":"","sources":["TileLayerBase.js"],"names":[],"mappings":"AAgDA;;GAEG;AACH;;;;GAIG;AAEH;;GAEG;AACH,+CAFY,wBAAwB,CAInC;AA0DD;;;;GAIG;AACH,oCAJW,OAAO,sBAAsB,EAAE,OAAO,aACtC,OAAO,oBAAoB,EAAE,SAAS,GACrC,MAAM,CAIjB;;;;;;;;;;;;;;yCA9EY,OAAO,uCAAuC,EAAE,OAAO,CAAC,OAAO,eAAe,EAAE,OAAO,CAAC;;;;;aAIvF,GAAG,CAAC,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;AA4EzB;;;;;;GAMG;AAEH;;GAEG;AAEH;;;;;;;GAOG;AACH,yCAL6B,SAAS,SAAxB,aAAc,EACmB,QAAQ,SAA1C,OAAQ,eAAe,EAAE,OAAQ,EACmC,kBAAkB,SAAtF,OAAQ,uCAAuC,EAAE,OAAO,CAAC,QAAQ,CAAE;IAI9E;;;OAGG;IACH,uBAHW,SAAS,WACT,OAAO,EA+DjB;IAvDC;;;OAGG;IACH,gBAFU,OAAO,CAEU;IAE3B;;;;OA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AAc,EAAE,UAAU,UACjC,OAAO,iBAAiB,EAAE,MAAM,YAChC,MAAM,4BACN,wBAAwB,WACxB,MAAM,QAoIhB;IAED;;;;OAIG;IACH,wCAJW,OAAO,cAAc,EAAE,UAAU,kBACjC,OAAO,QAKjB;IAED;;;;OAIG;IACH,4CAJW,OAAO,cAAc,EAAE,UAAU,GAChC,OAAO,CAKlB;IAED;;;;;;;;;;;;;OAaG;IACH,yCAbW,kBAAkB,iBAClB,OAAO,oBAAoB,EAAE,SAAS,cACtC,OAAO,cAAc,EAAE,UAAU,gBACjC,OAAO,iBAAiB,EAAE,MAAM,kBAChC,MAAM,YACN,OAAO,eAAe,EAAE,IAAI,cAC5B,OAAO,qBAAqB,EAAE,UAAU,cACxC,OAAO,iBAAiB,EAAE,MAAM,SAChC,MAAM,UACN,MAAM,SACN,MAAM,QAeb;IAEJ;;;;;;OAMG;IACH,6CANW,kBAAkB,SAClB,MAAM,UACN,OAAO,iBAAiB,EAAE,MAAM,SAChC,MAAM,QAG0C;IAE3D,iIAuEC;IAED;;;;;OAKG;IACH,iCAJW,OAAO,cAAc,EAAE,UAAU,GAChC,WAAW,CAsMtB;IAED;;;OAGG;IACH,qCAHW,OAAO,cAAc,EAAE,UAAU,QAK3C;IAED;;;;;;;;;;OAUG;IACH,sBAsCC;CAkCF;+BAjyB8B,YAAY"}
|
|
@@ -725,10 +725,7 @@ class WebGLBaseTileLayerRenderer extends WebGLLayerRenderer {
|
|
|
725
725
|
const canvas = this.helper.getCanvas();
|
|
726
726
|
|
|
727
727
|
const tileRepresentationCache = this.tileRepresentationCache;
|
|
728
|
-
|
|
729
|
-
const tileRepresentation = tileRepresentationCache.pop();
|
|
730
|
-
tileRepresentation.dispose();
|
|
731
|
-
}
|
|
728
|
+
tileRepresentationCache.expireCache();
|
|
732
729
|
|
|
733
730
|
this.postRender(gl, frameState);
|
|
734
731
|
return canvas;
|
|
@@ -13,8 +13,8 @@ export const Uniforms: {
|
|
|
13
13
|
HIT_DETECTION: string;
|
|
14
14
|
};
|
|
15
15
|
export default WebGLVectorLayerRenderer;
|
|
16
|
-
export type
|
|
17
|
-
export type
|
|
16
|
+
export type StyleShaders = import("../../render/webgl/VectorStyleRenderer.js").StyleShaders;
|
|
17
|
+
export type LayerStyle = import("../../style/flat.js").FlatStyleLike | Array<StyleShaders> | StyleShaders;
|
|
18
18
|
export type Options = {
|
|
19
19
|
/**
|
|
20
20
|
* A CSS class name to set to the canvas element.
|
|
@@ -23,7 +23,7 @@ export type Options = {
|
|
|
23
23
|
/**
|
|
24
24
|
* Flat vector style; also accepts shaders
|
|
25
25
|
*/
|
|
26
|
-
style:
|
|
26
|
+
style: LayerStyle;
|
|
27
27
|
/**
|
|
28
28
|
* Style variables
|
|
29
29
|
*/
|
|
@@ -41,15 +41,15 @@ export type Options = {
|
|
|
41
41
|
postProcesses?: import("./Layer.js").PostProcessesOptions[] | undefined;
|
|
42
42
|
};
|
|
43
43
|
/**
|
|
44
|
-
* @typedef {import('../../render/webgl/VectorStyleRenderer.js').
|
|
44
|
+
* @typedef {import('../../render/webgl/VectorStyleRenderer.js').StyleShaders} StyleShaders
|
|
45
45
|
*/
|
|
46
46
|
/**
|
|
47
|
-
* @typedef {import('../../
|
|
47
|
+
* @typedef {import('../../style/flat.js').FlatStyleLike | Array<StyleShaders> | StyleShaders} LayerStyle
|
|
48
48
|
*/
|
|
49
49
|
/**
|
|
50
50
|
* @typedef {Object} Options
|
|
51
51
|
* @property {string} [className='ol-layer'] A CSS class name to set to the canvas element.
|
|
52
|
-
* @property {
|
|
52
|
+
* @property {LayerStyle} style Flat vector style; also accepts shaders
|
|
53
53
|
* @property {Object<string, number|Array<number>|string|boolean>} variables Style variables
|
|
54
54
|
* @property {boolean} [disableHitDetection=false] Setting this to true will provide a slight performance boost, but will
|
|
55
55
|
* prevent all hit detection on the layer.
|
|
@@ -128,17 +128,17 @@ declare class WebGLVectorLayerRenderer extends WebGLLayerRenderer<any> {
|
|
|
128
128
|
*/
|
|
129
129
|
private styleVariables_;
|
|
130
130
|
/**
|
|
131
|
-
* @type {
|
|
131
|
+
* @type {LayerStyle}
|
|
132
132
|
* @private
|
|
133
133
|
*/
|
|
134
|
-
private
|
|
134
|
+
private style_;
|
|
135
135
|
/**
|
|
136
|
-
* @type {
|
|
137
|
-
* @
|
|
136
|
+
* @type {VectorStyleRenderer}
|
|
137
|
+
* @public
|
|
138
138
|
*/
|
|
139
|
-
|
|
139
|
+
public styleRenderer_: VectorStyleRenderer;
|
|
140
140
|
/**
|
|
141
|
-
* @type {
|
|
141
|
+
* @type {import('../../render/webgl/VectorStyleRenderer.js').WebGLBuffers}
|
|
142
142
|
* @private
|
|
143
143
|
*/
|
|
144
144
|
private buffers_;
|
|
@@ -224,4 +224,5 @@ declare class WebGLVectorLayerRenderer extends WebGLLayerRenderer<any> {
|
|
|
224
224
|
renderDeclutter(): void;
|
|
225
225
|
}
|
|
226
226
|
import WebGLLayerRenderer from './Layer.js';
|
|
227
|
+
import VectorStyleRenderer from '../../render/webgl/VectorStyleRenderer.js';
|
|
227
228
|
//# sourceMappingURL=VectorLayer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VectorLayer.d.ts","sourceRoot":"","sources":["VectorLayer.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"VectorLayer.d.ts","sourceRoot":"","sources":["VectorLayer.js"],"names":[],"mappings":"AAmCA;;;;;;;;;;;;;EAKE;;2BAGW,OAAO,2CAA2C,EAAE,YAAY;yBAGhE,OAAO,qBAAqB,EAAE,aAAa,GAAG,KAAK,CAAC,YAAY,CAAC,GAAG,YAAY;;;;;;;;;WAM/E,UAAU;;;;;;;;;;;;;;;;;AAVxB;;GAEG;AACH;;GAEG;AAEH;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH;IACE;;;OAGG;IACH,mBAHW,OAAO,sBAAsB,EAAE,OAAO,WACtC,OAAO,EA0GjB;IA5FC;;;OAGG;IACH,6BAAwD;IAExD;;;OAGG;IACH,yBAAqB;IAErB;;OAEG;IACH,wBAAyB;IAEzB;;OAEG;IACH,wBAAoC;IAEpC;;;;;;OAMG;IACH,0BAA0C;IAE1C;;OAEG;IACH,mBAAwB;IACxB;;OAEG;IACH,sBAAsC;IACtC;;OAEG;IACH,iBAA4B;IAE5B;;;OAGG;IACH,oCAAoD;IAEpD;;;OAGG;IACH,wBAAyB;IAEzB;;;OAGG;IACH,eAAgB;IAEhB;;;OAGG;IACH,uBAHU,mBAAmB,CAGH;IAE1B;;;OAGG;IACH,iBAAoB;IAIpB;;OAEG;IACH,eAAsC;IAEtC;;;OAGG;IACH,8BAAkC;IAElC;;;OAGG;IACH,0BAA6B;IAG/B;;;OAGG;IACH,4BAoCC;IAED;;;OAGG;IACH,sBAGC;IAED;;OAEG;IACH,yBAQC;IAED;;OAEG;IACH,mCAMC;IAkBD;;;;OAIG;IACH,kCAGC;IAED;;;;OAIG;IACH,oCAGC;IAED;;;OAGG;IACH,mCAGC;IAED;;OAEG;IACH,kCAEC;IAED;;;OAGG;IACH,uBAsBC;IAED;;;;;OAKG;IACH,iCAJW,OAAO,cAAc,EAAE,UAAU,GAChC,WAAW,CA+BtB;IAsED;;;;;;;OAOG;IACH,yBANW,OAAO,cAAc,EAAE,UAAU,mBACjC,OAAO,cACP,MAAM,YACN,MAAM,cACN,MAAM,QAmChB;IA0CD;;;OAGG;IACH,wBAFW,OAAO,2CAA2C,EAAE,YAAY,QAsB1E;IAmBD,wBAAoB;CACrB;+BA9hB8B,YAAY;gCAjBX,2CAA2C"}
|
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
import MixedGeometryBatch from '../../render/webgl/MixedGeometryBatch.js';
|
|
16
16
|
import VectorStyleRenderer from '../../render/webgl/VectorStyleRenderer.js';
|
|
17
17
|
import {colorDecodeId} from '../../render/webgl/encodeUtil.js';
|
|
18
|
-
import {breakDownFlatStyle} from '../../render/webgl/style.js';
|
|
19
18
|
import VectorEventType from '../../source/VectorEventType.js';
|
|
20
19
|
import {
|
|
21
20
|
apply as applyTransform,
|
|
@@ -42,16 +41,16 @@ export const Uniforms = {
|
|
|
42
41
|
};
|
|
43
42
|
|
|
44
43
|
/**
|
|
45
|
-
* @typedef {import('../../render/webgl/VectorStyleRenderer.js').
|
|
44
|
+
* @typedef {import('../../render/webgl/VectorStyleRenderer.js').StyleShaders} StyleShaders
|
|
46
45
|
*/
|
|
47
46
|
/**
|
|
48
|
-
* @typedef {import('../../
|
|
47
|
+
* @typedef {import('../../style/flat.js').FlatStyleLike | Array<StyleShaders> | StyleShaders} LayerStyle
|
|
49
48
|
*/
|
|
50
49
|
|
|
51
50
|
/**
|
|
52
51
|
* @typedef {Object} Options
|
|
53
52
|
* @property {string} [className='ol-layer'] A CSS class name to set to the canvas element.
|
|
54
|
-
* @property {
|
|
53
|
+
* @property {LayerStyle} style Flat vector style; also accepts shaders
|
|
55
54
|
* @property {Object<string, number|Array<number>|string|boolean>} variables Style variables
|
|
56
55
|
* @property {boolean} [disableHitDetection=false] Setting this to true will provide a slight performance boost, but will
|
|
57
56
|
* prevent all hit detection on the layer.
|
|
@@ -150,22 +149,22 @@ class WebGLVectorLayerRenderer extends WebGLLayerRenderer {
|
|
|
150
149
|
this.styleVariables_ = {};
|
|
151
150
|
|
|
152
151
|
/**
|
|
153
|
-
* @type {
|
|
152
|
+
* @type {LayerStyle}
|
|
154
153
|
* @private
|
|
155
154
|
*/
|
|
156
|
-
this.
|
|
155
|
+
this.style_ = [];
|
|
157
156
|
|
|
158
157
|
/**
|
|
159
|
-
* @type {
|
|
160
|
-
* @
|
|
158
|
+
* @type {VectorStyleRenderer}
|
|
159
|
+
* @public
|
|
161
160
|
*/
|
|
162
|
-
this.
|
|
161
|
+
this.styleRenderer_ = null;
|
|
163
162
|
|
|
164
163
|
/**
|
|
165
|
-
* @type {
|
|
164
|
+
* @type {import('../../render/webgl/VectorStyleRenderer.js').WebGLBuffers}
|
|
166
165
|
* @private
|
|
167
166
|
*/
|
|
168
|
-
this.buffers_ =
|
|
167
|
+
this.buffers_ = null;
|
|
169
168
|
|
|
170
169
|
this.applyOptions_(options);
|
|
171
170
|
|
|
@@ -235,23 +234,19 @@ class WebGLVectorLayerRenderer extends WebGLLayerRenderer {
|
|
|
235
234
|
*/
|
|
236
235
|
applyOptions_(options) {
|
|
237
236
|
this.styleVariables_ = options.variables;
|
|
238
|
-
this.
|
|
237
|
+
this.style_ = options.style;
|
|
239
238
|
}
|
|
240
239
|
|
|
241
240
|
/**
|
|
242
241
|
* @private
|
|
243
242
|
*/
|
|
244
243
|
createRenderers_() {
|
|
245
|
-
this.buffers_ =
|
|
246
|
-
this.
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
this.helper,
|
|
252
|
-
this.hitDetectionEnabled_,
|
|
253
|
-
'filter' in style ? style.filter : null,
|
|
254
|
-
),
|
|
244
|
+
this.buffers_ = null;
|
|
245
|
+
this.styleRenderer_ = new VectorStyleRenderer(
|
|
246
|
+
this.style_,
|
|
247
|
+
this.styleVariables_,
|
|
248
|
+
this.helper,
|
|
249
|
+
this.hitDetectionEnabled_,
|
|
255
250
|
);
|
|
256
251
|
}
|
|
257
252
|
|
|
@@ -270,11 +265,9 @@ class WebGLVectorLayerRenderer extends WebGLLayerRenderer {
|
|
|
270
265
|
* @override
|
|
271
266
|
*/
|
|
272
267
|
afterHelperCreated() {
|
|
273
|
-
if (this.
|
|
268
|
+
if (this.styleRenderer_) {
|
|
274
269
|
// To reuse buffers
|
|
275
|
-
this.
|
|
276
|
-
renderer.setHelper(this.helper, this.buffers_[i]),
|
|
277
|
-
);
|
|
270
|
+
this.styleRenderer_.setHelper(this.helper, this.buffers_);
|
|
278
271
|
} else {
|
|
279
272
|
this.createRenderers_();
|
|
280
273
|
}
|
|
@@ -435,18 +428,16 @@ class WebGLVectorLayerRenderer extends WebGLLayerRenderer {
|
|
|
435
428
|
createTransform(),
|
|
436
429
|
);
|
|
437
430
|
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
431
|
+
this.styleRenderer_
|
|
432
|
+
.generateBuffers(this.batch_, transform)
|
|
433
|
+
.then((buffers) => {
|
|
434
|
+
if (this.buffers_) {
|
|
435
|
+
this.disposeBuffers(this.buffers_);
|
|
442
436
|
}
|
|
443
|
-
this.buffers_
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
this.ready = true;
|
|
448
|
-
this.getLayer().changed();
|
|
449
|
-
});
|
|
437
|
+
this.buffers_ = buffers;
|
|
438
|
+
this.ready = true;
|
|
439
|
+
this.getLayer().changed();
|
|
440
|
+
});
|
|
450
441
|
|
|
451
442
|
this.previousExtent_ = frameState.extent.slice();
|
|
452
443
|
}
|
|
@@ -487,17 +478,13 @@ class WebGLVectorLayerRenderer extends WebGLLayerRenderer {
|
|
|
487
478
|
world * worldWidth,
|
|
488
479
|
0,
|
|
489
480
|
);
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
const buffers = this.buffers_[i];
|
|
493
|
-
if (!buffers) {
|
|
494
|
-
continue;
|
|
495
|
-
}
|
|
496
|
-
renderer.render(buffers, frameState, () => {
|
|
497
|
-
this.applyUniforms_(buffers.invertVerticesTransform);
|
|
498
|
-
this.helper.applyHitDetectionUniform(forHitDetection);
|
|
499
|
-
});
|
|
481
|
+
if (!this.buffers_) {
|
|
482
|
+
continue;
|
|
500
483
|
}
|
|
484
|
+
this.styleRenderer_.render(this.buffers_, frameState, () => {
|
|
485
|
+
this.applyUniforms_(this.buffers_.invertVerticesTransform);
|
|
486
|
+
this.helper.applyHitDetectionUniform(forHitDetection);
|
|
487
|
+
});
|
|
501
488
|
} while (++world < endWorld);
|
|
502
489
|
}
|
|
503
490
|
|
|
@@ -522,7 +509,7 @@ class WebGLVectorLayerRenderer extends WebGLLayerRenderer {
|
|
|
522
509
|
this.hitDetectionEnabled_,
|
|
523
510
|
'`forEachFeatureAtCoordinate` cannot be used on a WebGL layer if the hit detection logic has been disabled using the `disableHitDetection: true` option.',
|
|
524
511
|
);
|
|
525
|
-
if (!this.
|
|
512
|
+
if (!this.styleRenderer_ || !this.hitDetectionEnabled_) {
|
|
526
513
|
return undefined;
|
|
527
514
|
}
|
|
528
515
|
|
|
@@ -572,11 +559,9 @@ class WebGLVectorLayerRenderer extends WebGLLayerRenderer {
|
|
|
572
559
|
* @override
|
|
573
560
|
*/
|
|
574
561
|
disposeInternal() {
|
|
575
|
-
this.buffers_
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
}
|
|
579
|
-
});
|
|
562
|
+
if (this.buffers_) {
|
|
563
|
+
this.disposeBuffers(this.buffers_);
|
|
564
|
+
}
|
|
580
565
|
if (this.sourceListenKeys_) {
|
|
581
566
|
this.sourceListenKeys_.forEach(function (key) {
|
|
582
567
|
unlistenByKey(key);
|
|
@@ -16,13 +16,13 @@ export namespace Attributes {
|
|
|
16
16
|
let POSITION: string;
|
|
17
17
|
}
|
|
18
18
|
export default WebGLVectorTileLayerRenderer;
|
|
19
|
-
export type
|
|
20
|
-
export type
|
|
19
|
+
export type StyleShaders = import("../../render/webgl/VectorStyleRenderer.js").StyleShaders;
|
|
20
|
+
export type LayerStyle = import("../../style/flat.js").FlatStyleLike | Array<StyleShaders> | StyleShaders;
|
|
21
21
|
export type Options = {
|
|
22
22
|
/**
|
|
23
23
|
* Flat vector style; also accepts shaders
|
|
24
24
|
*/
|
|
25
|
-
style:
|
|
25
|
+
style: LayerStyle;
|
|
26
26
|
/**
|
|
27
27
|
* Style variables. Each variable must hold a literal value (not
|
|
28
28
|
* an expression). These variables can be used as {@link import ("../../expr/expression.js").ExpressionValue expressions} in the styles properties
|
|
@@ -43,14 +43,14 @@ export type Options = {
|
|
|
43
43
|
};
|
|
44
44
|
export type LayerType = import("../../layer/BaseTile.js").default<any, any>;
|
|
45
45
|
/**
|
|
46
|
-
* @typedef {import('../../render/webgl/VectorStyleRenderer.js').
|
|
46
|
+
* @typedef {import('../../render/webgl/VectorStyleRenderer.js').StyleShaders} StyleShaders
|
|
47
47
|
*/
|
|
48
48
|
/**
|
|
49
|
-
* @typedef {import('../../
|
|
49
|
+
* @typedef {import('../../style/flat.js').FlatStyleLike | Array<StyleShaders> | StyleShaders} LayerStyle
|
|
50
50
|
*/
|
|
51
51
|
/**
|
|
52
52
|
* @typedef {Object} Options
|
|
53
|
-
* @property {
|
|
53
|
+
* @property {LayerStyle} style Flat vector style; also accepts shaders
|
|
54
54
|
* @property {import('../../style/flat.js').StyleVariables} [variables] Style variables. Each variable must hold a literal value (not
|
|
55
55
|
* an expression). These variables can be used as {@link import("../../expr/expression.js").ExpressionValue expressions} in the styles properties
|
|
56
56
|
* using the `['var', 'varName']` operator.
|
|
@@ -78,20 +78,20 @@ declare class WebGLVectorTileLayerRenderer extends WebGLBaseTileLayerRenderer<im
|
|
|
78
78
|
*/
|
|
79
79
|
private hitDetectionEnabled_;
|
|
80
80
|
/**
|
|
81
|
-
* @type {
|
|
81
|
+
* @type {LayerStyle}
|
|
82
82
|
* @private
|
|
83
83
|
*/
|
|
84
|
-
private
|
|
84
|
+
private style_;
|
|
85
85
|
/**
|
|
86
86
|
* @type {import('../../style/flat.js').StyleVariables}
|
|
87
87
|
* @private
|
|
88
88
|
*/
|
|
89
89
|
private styleVariables_;
|
|
90
90
|
/**
|
|
91
|
-
* @type {
|
|
91
|
+
* @type {VectorStyleRenderer}
|
|
92
92
|
* @private
|
|
93
93
|
*/
|
|
94
|
-
private
|
|
94
|
+
private styleRenderer_;
|
|
95
95
|
/**
|
|
96
96
|
* This transform is updated on every frame and is the composition of:
|
|
97
97
|
* - invert of the world->screen transform that was used when rebuilding buffers (see `this.renderTransform_`)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VectorTileLayer.d.ts","sourceRoot":"","sources":["VectorTileLayer.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"VectorTileLayer.d.ts","sourceRoot":"","sources":["VectorTileLayer.js"],"names":[],"mappings":"AA4BA;;;;;;;;;;;;;EAIE;;;;;2BAOW,OAAO,2CAA2C,EAAE,YAAY;yBAGhE,OAAO,qBAAqB,EAAE,aAAa,GAAG,KAAK,CAAC,YAAY,CAAC,GAAG,YAAY;;;;;WAK/E,UAAU;;;;;;;;;;;;;;;;;;;;AATxB;;GAEG;AACH;;GAEG;AAEH;;;;;;;;;GASG;AAEH;;GAEG;AAEH;;;;GAIG;AACH;IACE;;;OAGG;IACH,uBAHW,SAAS,WACT,OAAO,EAuFjB;IA5EC;;;OAGG;IACH,6BAAwD;IAExD;;;OAGG;IACH,eAAkB;IAElB;;;OAGG;IACH,wBAA8C;IAE9C;;;OAGG;IACH,uBAA0B;IAE1B;;;;;;OAMG;IACH,oCAAoD;IAEpD;;OAEG;IACH,sBAAsC;IACtC;;OAEG;IACH,iBAA4B;IAE5B;;;OAGG;IACH,wBAA2B;IAE3B;;OAEG;IACH,yBAGC;IAGD;;;OAGG;IACH,4BAMC;IAED;;;OAGG;IACH,yBAAqB;IAKvB;;;OAGG;IACH,wBAHW,OAAO,QAWjB;IAED;;;OAGG;IACH,sBAEC;IAED;;OAEG;IACH,yBA2BC;IAED;;OAEG;IACH,sBAYC;IAUD;;OAEG;IACH,8DAWC;IAED;;OAEG;IACH,uEAMC;IAED;;OAEG;IACH,yDA0BC;IAED;;OAEG;IACH,4FAeC;IAED;;;;;;;OAOG;IACH,uBAoBC;IAED;;OAEG;IACH,sNA4BC;IAED;;;OAGG;IACH,4BAFW,OAAO,cAAc,EAAE,UAAU,QAEd;CAS/B;uCA5WM,oBAAoB;yBAJF,6BAA6B"}
|
|
@@ -4,11 +4,9 @@
|
|
|
4
4
|
import EventType from '../../events/EventType.js';
|
|
5
5
|
import {getIntersection} from '../../extent.js';
|
|
6
6
|
import {ShaderBuilder} from '../../render/webgl/ShaderBuilder.js';
|
|
7
|
-
import VectorStyleRenderer
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
parseLiteralStyle,
|
|
11
|
-
} from '../../render/webgl/style.js';
|
|
7
|
+
import VectorStyleRenderer, {
|
|
8
|
+
convertStyleToShaders,
|
|
9
|
+
} from '../../render/webgl/VectorStyleRenderer.js';
|
|
12
10
|
import {
|
|
13
11
|
create as createTransform,
|
|
14
12
|
makeInverse as makeInverseTransform,
|
|
@@ -39,15 +37,15 @@ export const Attributes = {
|
|
|
39
37
|
};
|
|
40
38
|
|
|
41
39
|
/**
|
|
42
|
-
* @typedef {import('../../render/webgl/VectorStyleRenderer.js').
|
|
40
|
+
* @typedef {import('../../render/webgl/VectorStyleRenderer.js').StyleShaders} StyleShaders
|
|
43
41
|
*/
|
|
44
42
|
/**
|
|
45
|
-
* @typedef {import('../../
|
|
43
|
+
* @typedef {import('../../style/flat.js').FlatStyleLike | Array<StyleShaders> | StyleShaders} LayerStyle
|
|
46
44
|
*/
|
|
47
45
|
|
|
48
46
|
/**
|
|
49
47
|
* @typedef {Object} Options
|
|
50
|
-
* @property {
|
|
48
|
+
* @property {LayerStyle} style Flat vector style; also accepts shaders
|
|
51
49
|
* @property {import('../../style/flat.js').StyleVariables} [variables] Style variables. Each variable must hold a literal value (not
|
|
52
50
|
* an expression). These variables can be used as {@link import("../../expr/expression.js").ExpressionValue expressions} in the styles properties
|
|
53
51
|
* using the `['var', 'varName']` operator.
|
|
@@ -86,10 +84,10 @@ class WebGLVectorTileLayerRenderer extends WebGLBaseTileLayerRenderer {
|
|
|
86
84
|
this.hitDetectionEnabled_ = !options.disableHitDetection;
|
|
87
85
|
|
|
88
86
|
/**
|
|
89
|
-
* @type {
|
|
87
|
+
* @type {LayerStyle}
|
|
90
88
|
* @private
|
|
91
89
|
*/
|
|
92
|
-
this.
|
|
90
|
+
this.style_ = null;
|
|
93
91
|
|
|
94
92
|
/**
|
|
95
93
|
* @type {import('../../style/flat.js').StyleVariables}
|
|
@@ -98,10 +96,10 @@ class WebGLVectorTileLayerRenderer extends WebGLBaseTileLayerRenderer {
|
|
|
98
96
|
this.styleVariables_ = options.variables || {};
|
|
99
97
|
|
|
100
98
|
/**
|
|
101
|
-
* @type {
|
|
99
|
+
* @type {VectorStyleRenderer}
|
|
102
100
|
* @private
|
|
103
101
|
*/
|
|
104
|
-
this.
|
|
102
|
+
this.styleRenderer_ = null;
|
|
105
103
|
|
|
106
104
|
/**
|
|
107
105
|
* This transform is updated on every frame and is the composition of:
|
|
@@ -176,7 +174,7 @@ class WebGLVectorTileLayerRenderer extends WebGLBaseTileLayerRenderer {
|
|
|
176
174
|
* @private
|
|
177
175
|
*/
|
|
178
176
|
applyOptions_(options) {
|
|
179
|
-
this.
|
|
177
|
+
this.style_ = options.style;
|
|
180
178
|
}
|
|
181
179
|
|
|
182
180
|
/**
|
|
@@ -195,34 +193,20 @@ class WebGLVectorTileLayerRenderer extends WebGLBaseTileLayerRenderer {
|
|
|
195
193
|
builder.addUniform(Uniforms.TILE_ZOOM_LEVEL, 'float');
|
|
196
194
|
}
|
|
197
195
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
uniforms: parseResult.uniforms,
|
|
213
|
-
};
|
|
214
|
-
} else {
|
|
215
|
-
addBuilderParams(style.builder);
|
|
216
|
-
shaders = style;
|
|
217
|
-
}
|
|
218
|
-
return new VectorStyleRenderer(
|
|
219
|
-
shaders,
|
|
220
|
-
this.styleVariables_,
|
|
221
|
-
this.helper,
|
|
222
|
-
this.hitDetectionEnabled_,
|
|
223
|
-
'filter' in style ? style.filter : null,
|
|
224
|
-
);
|
|
225
|
-
});
|
|
196
|
+
const styleShaders = convertStyleToShaders(
|
|
197
|
+
this.style_,
|
|
198
|
+
this.styleVariables_,
|
|
199
|
+
);
|
|
200
|
+
for (const styleShader of styleShaders) {
|
|
201
|
+
addBuilderParams(styleShader.builder);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
this.styleRenderer_ = new VectorStyleRenderer(
|
|
205
|
+
styleShaders,
|
|
206
|
+
this.styleVariables_,
|
|
207
|
+
this.helper,
|
|
208
|
+
this.hitDetectionEnabled_,
|
|
209
|
+
);
|
|
226
210
|
}
|
|
227
211
|
|
|
228
212
|
/**
|
|
@@ -254,7 +238,7 @@ class WebGLVectorTileLayerRenderer extends WebGLBaseTileLayerRenderer {
|
|
|
254
238
|
* @override
|
|
255
239
|
*/
|
|
256
240
|
createTileRepresentation(options) {
|
|
257
|
-
const tileRep = new TileGeometry(options, this.
|
|
241
|
+
const tileRep = new TileGeometry(options, this.styleRenderer_);
|
|
258
242
|
// redraw the layer when the tile is ready
|
|
259
243
|
const listener = () => {
|
|
260
244
|
if (tileRep.ready) {
|
|
@@ -376,22 +360,19 @@ class WebGLVectorTileLayerRenderer extends WebGLBaseTileLayerRenderer {
|
|
|
376
360
|
) {
|
|
377
361
|
const gutterExtent = getIntersection(tileExtent, renderExtent, tileExtent);
|
|
378
362
|
const tileZ = tileRepresentation.tile.getTileCoord()[0];
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
if (!buffers) {
|
|
383
|
-
continue;
|
|
384
|
-
}
|
|
385
|
-
renderer.render(buffers, frameState, () => {
|
|
386
|
-
this.applyUniforms_(
|
|
387
|
-
alpha,
|
|
388
|
-
gutterExtent,
|
|
389
|
-
buffers.invertVerticesTransform,
|
|
390
|
-
tileZ,
|
|
391
|
-
depth,
|
|
392
|
-
);
|
|
393
|
-
});
|
|
363
|
+
const buffers = tileRepresentation.buffers;
|
|
364
|
+
if (!buffers) {
|
|
365
|
+
return;
|
|
394
366
|
}
|
|
367
|
+
this.styleRenderer_.render(buffers, frameState, () => {
|
|
368
|
+
this.applyUniforms_(
|
|
369
|
+
alpha,
|
|
370
|
+
gutterExtent,
|
|
371
|
+
buffers.invertVerticesTransform,
|
|
372
|
+
tileZ,
|
|
373
|
+
depth,
|
|
374
|
+
);
|
|
375
|
+
});
|
|
395
376
|
}
|
|
396
377
|
|
|
397
378
|
/**
|
package/util.js
CHANGED
package/webgl/Helper.d.ts
CHANGED
|
@@ -55,9 +55,9 @@ export type BufferCacheEntry = {
|
|
|
55
55
|
*/
|
|
56
56
|
export type AttributeDescription = {
|
|
57
57
|
/**
|
|
58
|
-
* Attribute name to use in shaders
|
|
58
|
+
* Attribute name to use in shaders; if null, this attribute will not be enabled and is simply used as padding in the buffers
|
|
59
59
|
*/
|
|
60
|
-
name: string;
|
|
60
|
+
name: string | null;
|
|
61
61
|
/**
|
|
62
62
|
* Number of components per attributes
|
|
63
63
|
*/
|
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":"AAmsCA;;;;GAIG;AACH,oDAHW,KAAK,CAAC,oBAAoB,CAAC,GAC1B,MAAM,CASjB;;;;yBAlrCS,MAAM;;;;;;;;;6BAUN,MAAM;;;;;;;;;;;;;;;;4BAiBN,MAAM;;;;;;;;;;;;YAjCF,OAAO,aAAa,EAAE,OAAO;;;;iBAC7B,WAAW;;;;;;;;;UA4CX,MAAM,GAAC,IAAI;;;;UACX,MAAM;;;;;;;;kCAOP,MAAM,GAAC,KAAK,CAAC,MAAM,CAAC,GAAC,iBAAiB,GAAC,gBAAgB,GAAC,SAAS,GAAC,YAAY,GAAC,OAAO,cAAc,EAAE,SAAS;;;;;2BAM/G,mBAAmB,IAAC,CAAS,IAA8B,EAA9B,OAAO,WAAW,EAAE,UAAU,KAAE,mBAAmB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAsB/E,MAAM;;;;;;;;;;;;;;;;;;aASN,qBAAqB;;;;WACrB,MAAM;;8BAhGb,aAAa;+BAAb,aAAa;6BAAb,aAAa;sBAAb,aAAa;AA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IACH,8BAHW,MAAM,SACN,MAAM,QAIhB;IAED;;;;OAIG;IACH,6BAHW,MAAM,SACN,KAAK,CAAC,MAAM,CAAC,QAIvB;IAED;;;;OAIG;IACH,6BAHW,MAAM,SACN,KAAK,CAAC,MAAM,CAAC,QAIvB;IAED;;;;OAIG;IACH,+BAHW,MAAM,SACN,KAAK,CAAC,MAAM,CAAC,QAIvB;IAED;;;OAGG;IACH,8BAIC;IAED;;;;;;;;;OASG;IACH,8BAQC;IAED;;;;;OAKG;IACH,6BAFW,KAAK,CAAC,oBAAoB,CAAC,QAmBrC;IAED;;;;OAIG;IACH,+BAKC;IAED;;;OAGG;IACH,mCAEC;IAED;;;OAGG;IACH,sBAFY,OAAO,CAIlB;IAED;;;;;;;;;;OAUG;IACH,oBANW,KAAK,CAAC,MAAM,CAAC,QACb,SAAS,GAAC,gBAAgB,GAAC,iBAAiB,GAAC,UAAU,GAAC,IAAI,YAC5D,YAAY,YACZ,OAAO,GACN,YAAY,CAgDvB;CACF;uBA9rCsB,kBAAkB"}
|
package/webgl/Helper.js
CHANGED
|
@@ -66,7 +66,7 @@ export const AttributeType = {
|
|
|
66
66
|
/**
|
|
67
67
|
* Description of an attribute in a buffer
|
|
68
68
|
* @typedef {Object} AttributeDescription
|
|
69
|
-
* @property {string} name Attribute name to use in shaders
|
|
69
|
+
* @property {string|null} name Attribute name to use in shaders; if null, this attribute will not be enabled and is simply used as padding in the buffers
|
|
70
70
|
* @property {number} size Number of components per attributes
|
|
71
71
|
* @property {AttributeType} [type] Attribute type, i.e. number of bytes used to store the value. This is
|
|
72
72
|
* determined by the class of typed array which the buffer uses (eg. `Float32Array` for a `FLOAT` attribute).
|
|
@@ -1115,13 +1115,16 @@ class WebGLHelper extends Disposable {
|
|
|
1115
1115
|
let offset = 0;
|
|
1116
1116
|
for (let i = 0; i < attributes.length; i++) {
|
|
1117
1117
|
const attr = attributes[i];
|
|
1118
|
-
this
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1118
|
+
// if a name is not given, simply skip this slot in the buffer
|
|
1119
|
+
if (attr.name) {
|
|
1120
|
+
this.enableAttributeArray_(
|
|
1121
|
+
attr.name,
|
|
1122
|
+
attr.size,
|
|
1123
|
+
attr.type || FLOAT,
|
|
1124
|
+
stride,
|
|
1125
|
+
offset,
|
|
1126
|
+
);
|
|
1127
|
+
}
|
|
1125
1128
|
offset += attr.size * getByteSizeFromType(attr.type);
|
|
1126
1129
|
}
|
|
1127
1130
|
}
|