ol 10.3.2-dev.1736286916790 → 10.3.2-dev.1736322561926
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 +2 -0
- 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 +173 -0
- package/layer/WebGLVectorTile.d.ts.map +1 -0
- package/layer/WebGLVectorTile.js +120 -0
- package/package.json +1 -1
- package/render/webgl/renderinstructions.js +1 -1
- package/util.js +1 -1
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
export default WebGLVectorTileLayer;
|
|
2
|
+
/**
|
|
3
|
+
* *
|
|
4
|
+
*/
|
|
5
|
+
export type ExtractedFeatureType<T> = T extends import("../source/Vector.js").default<infer U extends import("../Feature.js").FeatureLike> ? U : never;
|
|
6
|
+
export type Options<VectorTileSourceType extends import("../source/VectorTile.js").default<FeatureType> = import("../source/VectorTile.js").default<any>, FeatureType extends import("../Feature.js").FeatureLike = ExtractedFeatureType<VectorTileSourceType>> = {
|
|
7
|
+
/**
|
|
8
|
+
* A CSS class name to set to the layer element.
|
|
9
|
+
*/
|
|
10
|
+
className?: string | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Opacity (0, 1).
|
|
13
|
+
*/
|
|
14
|
+
opacity?: number | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Visibility.
|
|
17
|
+
*/
|
|
18
|
+
visible?: boolean | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* The bounding extent for layer rendering. The layer will not be
|
|
21
|
+
* rendered outside of this extent.
|
|
22
|
+
* FIXME: not supported yet
|
|
23
|
+
*/
|
|
24
|
+
extent?: import("../extent.js").Extent | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* The z-index for layer rendering. At rendering time, the layers
|
|
27
|
+
* will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed
|
|
28
|
+
* for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`
|
|
29
|
+
* method was used.
|
|
30
|
+
*/
|
|
31
|
+
zIndex?: number | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* The minimum resolution (inclusive) at which this layer will be
|
|
34
|
+
* visible.
|
|
35
|
+
*/
|
|
36
|
+
minResolution?: number | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* The maximum resolution (exclusive) below which this layer will
|
|
39
|
+
* be visible.
|
|
40
|
+
*/
|
|
41
|
+
maxResolution?: number | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* The minimum view zoom level (exclusive) above which this layer will be
|
|
44
|
+
* visible.
|
|
45
|
+
*/
|
|
46
|
+
minZoom?: number | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* The maximum view zoom level (inclusive) at which this layer will
|
|
49
|
+
* be visible.
|
|
50
|
+
*/
|
|
51
|
+
maxZoom?: number | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* Source.
|
|
54
|
+
*/
|
|
55
|
+
source?: VectorTileSourceType | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Layer style.
|
|
58
|
+
*/
|
|
59
|
+
style: import("../style/flat.js").FlatStyleLike;
|
|
60
|
+
/**
|
|
61
|
+
* Style variables. Each variable must hold a literal value (not
|
|
62
|
+
* an expression). These variables can be used as {@link import ("../expr/expression.js").ExpressionValue expressions} in the styles properties
|
|
63
|
+
* using the `['var', 'varName']` operator.
|
|
64
|
+
* To update style variables, use the {@link import ("./WebGLVector.js").default#updateStyleVariables} method.
|
|
65
|
+
*/
|
|
66
|
+
variables?: {
|
|
67
|
+
[x: string]: string | number | boolean | number[];
|
|
68
|
+
} | undefined;
|
|
69
|
+
/**
|
|
70
|
+
* Background color for the layer. If not specified, no background
|
|
71
|
+
* will be rendered.
|
|
72
|
+
* FIXME: not supported yet
|
|
73
|
+
*/
|
|
74
|
+
background?: import("./Base.js").BackgroundColor | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* Setting this to true will provide a slight performance boost, but will
|
|
77
|
+
* prevent all hit detection on the layer.
|
|
78
|
+
*/
|
|
79
|
+
disableHitDetection?: boolean | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* Arbitrary observable properties. Can be accessed with `#get()` and `#set()`.
|
|
82
|
+
*/
|
|
83
|
+
properties?: {
|
|
84
|
+
[x: string]: any;
|
|
85
|
+
} | undefined;
|
|
86
|
+
};
|
|
87
|
+
/***
|
|
88
|
+
* @template T
|
|
89
|
+
* @typedef {T extends import("../source/Vector.js").default<infer U extends import("../Feature.js").FeatureLike> ? U : never} ExtractedFeatureType
|
|
90
|
+
*/
|
|
91
|
+
/**
|
|
92
|
+
* @template {import("../source/VectorTile.js").default<FeatureType>} [VectorTileSourceType=import("../source/VectorTile.js").default<*>]
|
|
93
|
+
* @template {import('../Feature.js').FeatureLike} [FeatureType=ExtractedFeatureType<VectorTileSourceType>]
|
|
94
|
+
* @typedef {Object} Options
|
|
95
|
+
* @property {string} [className='ol-layer'] A CSS class name to set to the layer element.
|
|
96
|
+
* @property {number} [opacity=1] Opacity (0, 1).
|
|
97
|
+
* @property {boolean} [visible=true] Visibility.
|
|
98
|
+
* @property {import("../extent.js").Extent} [extent] The bounding extent for layer rendering. The layer will not be
|
|
99
|
+
* rendered outside of this extent.
|
|
100
|
+
* FIXME: not supported yet
|
|
101
|
+
* @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers
|
|
102
|
+
* will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed
|
|
103
|
+
* for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`
|
|
104
|
+
* method was used.
|
|
105
|
+
* @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be
|
|
106
|
+
* visible.
|
|
107
|
+
* @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will
|
|
108
|
+
* be visible.
|
|
109
|
+
* @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be
|
|
110
|
+
* visible.
|
|
111
|
+
* @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will
|
|
112
|
+
* be visible.
|
|
113
|
+
* @property {VectorTileSourceType} [source] Source.
|
|
114
|
+
* @property {import('../style/flat.js').FlatStyleLike} style Layer style.
|
|
115
|
+
* @property {import('../style/flat.js').StyleVariables} [variables] Style variables. Each variable must hold a literal value (not
|
|
116
|
+
* an expression). These variables can be used as {@link import("../expr/expression.js").ExpressionValue expressions} in the styles properties
|
|
117
|
+
* using the `['var', 'varName']` operator.
|
|
118
|
+
* To update style variables, use the {@link import("./WebGLVector.js").default#updateStyleVariables} method.
|
|
119
|
+
* @property {import("./Base.js").BackgroundColor} [background] Background color for the layer. If not specified, no background
|
|
120
|
+
* will be rendered.
|
|
121
|
+
* FIXME: not supported yet
|
|
122
|
+
* @property {boolean} [disableHitDetection=false] Setting this to true will provide a slight performance boost, but will
|
|
123
|
+
* prevent all hit detection on the layer.
|
|
124
|
+
* @property {Object<string, *>} [properties] Arbitrary observable properties. Can be accessed with `#get()` and `#set()`.
|
|
125
|
+
*/
|
|
126
|
+
/**
|
|
127
|
+
* @classdesc
|
|
128
|
+
* Layer optimized for rendering large vector datasets.
|
|
129
|
+
*
|
|
130
|
+
* **Important: a `WebGLVector` layer must be manually disposed when removed, otherwise the underlying WebGL context
|
|
131
|
+
* will not be garbage collected.**
|
|
132
|
+
*
|
|
133
|
+
* Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}
|
|
134
|
+
* property on the layer object; for example, setting `title: 'My Title'` in the
|
|
135
|
+
* options means that `title` is observable, and has get/set accessors.
|
|
136
|
+
*
|
|
137
|
+
* @template {import("../source/VectorTile.js").default<FeatureType>} [VectorTileSourceType=import("../source/VectorTile.js").default<*>]
|
|
138
|
+
* @template {import('../Feature.js').FeatureLike} [FeatureType=ExtractedFeatureType<VectorTileSourceType>]
|
|
139
|
+
* @extends {BaseTileLayer<VectorTileSourceType, WebGLVectorTileLayerRenderer>}
|
|
140
|
+
*/
|
|
141
|
+
declare class WebGLVectorTileLayer<VectorTileSourceType extends import("../source/VectorTile.js").default<FeatureType> = import("../source/VectorTile.js").default<any>, FeatureType extends import("../Feature.js").FeatureLike = ExtractedFeatureType<VectorTileSourceType>> extends BaseTileLayer<VectorTileSourceType, WebGLVectorTileLayerRenderer> {
|
|
142
|
+
/**
|
|
143
|
+
* @param {Options<VectorTileSourceType, FeatureType>} [options] Options.
|
|
144
|
+
*/
|
|
145
|
+
constructor(options?: Options<VectorTileSourceType, FeatureType>);
|
|
146
|
+
/**
|
|
147
|
+
* @type {import('../style/flat.js').StyleVariables}
|
|
148
|
+
* @private
|
|
149
|
+
*/
|
|
150
|
+
private styleVariables_;
|
|
151
|
+
/**
|
|
152
|
+
* @private
|
|
153
|
+
*/
|
|
154
|
+
private style_;
|
|
155
|
+
/**
|
|
156
|
+
* @private
|
|
157
|
+
*/
|
|
158
|
+
private hitDetectionDisabled_;
|
|
159
|
+
/**
|
|
160
|
+
* Update any variables used by the layer style and trigger a re-render.
|
|
161
|
+
* @param {import('../style/flat.js').StyleVariables} variables Variables to update.
|
|
162
|
+
*/
|
|
163
|
+
updateStyleVariables(variables: import("../style/flat.js").StyleVariables): void;
|
|
164
|
+
/**
|
|
165
|
+
* Set the layer style.
|
|
166
|
+
* @param {import('../style/flat.js').FlatStyleLike} style Layer style.
|
|
167
|
+
*/
|
|
168
|
+
setStyle(style: import("../style/flat.js").FlatStyleLike): void;
|
|
169
|
+
style: import("../style/flat.js").FlatStyleLike | undefined;
|
|
170
|
+
}
|
|
171
|
+
import WebGLVectorTileLayerRenderer from '../renderer/webgl/VectorTileLayer.js';
|
|
172
|
+
import BaseTileLayer from './BaseTile.js';
|
|
173
|
+
//# sourceMappingURL=WebGLVectorTile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebGLVectorTile.d.ts","sourceRoot":"","sources":["WebGLVectorTile.js"],"names":[],"mappings":";;;;iCAOa,CAAC,IACD,CAAC,SAAS,OAAO,qBAAqB,EAAE,OAAO,CAAC,MAAM,CAAC,SAAS,OAAO,eAAe,EAAE,WAAW,CAAC,GAAG,CAAC,GAAG,KAAK;oBAItD,oBAAoB,SAA9E,OAAQ,yBAAyB,EAAE,OAAO,CAAC,WAAW,CAAE,mDACjB,WAAW,SAAlD,OAAQ,eAAe,EAAE,WAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAqBpC,OAAO,kBAAkB,EAAE,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA5BtD;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH;;;;;;;;;;;;;;GAcG;AACH,mCAJuE,oBAAoB,SAA9E,OAAQ,yBAAyB,EAAE,OAAO,CAAC,WAAW,CAAE,mDACjB,WAAW,SAAlD,OAAQ,eAAe,EAAE,WAAY;IAIhD;;OAEG;IACH,sBAFW,OAAO,CAAC,oBAAoB,EAAE,WAAW,CAAC,EAsBpD;IAfC;;;OAGG;IACH,wBAA8C;IAE9C;;OAEG;IACH,eAA2B;IAE3B;;OAEG;IACH,8BAA0D;IAc5D;;;OAGG;IACH,gCAFW,OAAO,kBAAkB,EAAE,cAAc,QAKnD;IAED;;;OAGG;IACH,gBAFW,OAAO,kBAAkB,EAAE,aAAa,QAMlD;IAHC,4DAAkB;CAIrB;yCAlHwC,sCAAsC;0BACrD,eAAe"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module ol/layer/WebGLVectorTile
|
|
3
|
+
*/
|
|
4
|
+
import WebGLVectorTileLayerRenderer from '../renderer/webgl/VectorTileLayer.js';
|
|
5
|
+
import BaseTileLayer from './BaseTile.js';
|
|
6
|
+
|
|
7
|
+
/***
|
|
8
|
+
* @template T
|
|
9
|
+
* @typedef {T extends import("../source/Vector.js").default<infer U extends import("../Feature.js").FeatureLike> ? U : never} ExtractedFeatureType
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @template {import("../source/VectorTile.js").default<FeatureType>} [VectorTileSourceType=import("../source/VectorTile.js").default<*>]
|
|
14
|
+
* @template {import('../Feature.js').FeatureLike} [FeatureType=ExtractedFeatureType<VectorTileSourceType>]
|
|
15
|
+
* @typedef {Object} Options
|
|
16
|
+
* @property {string} [className='ol-layer'] A CSS class name to set to the layer element.
|
|
17
|
+
* @property {number} [opacity=1] Opacity (0, 1).
|
|
18
|
+
* @property {boolean} [visible=true] Visibility.
|
|
19
|
+
* @property {import("../extent.js").Extent} [extent] The bounding extent for layer rendering. The layer will not be
|
|
20
|
+
* rendered outside of this extent.
|
|
21
|
+
* FIXME: not supported yet
|
|
22
|
+
* @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers
|
|
23
|
+
* will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed
|
|
24
|
+
* for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`
|
|
25
|
+
* method was used.
|
|
26
|
+
* @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be
|
|
27
|
+
* visible.
|
|
28
|
+
* @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will
|
|
29
|
+
* be visible.
|
|
30
|
+
* @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be
|
|
31
|
+
* visible.
|
|
32
|
+
* @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will
|
|
33
|
+
* be visible.
|
|
34
|
+
* @property {VectorTileSourceType} [source] Source.
|
|
35
|
+
* @property {import('../style/flat.js').FlatStyleLike} style Layer style.
|
|
36
|
+
* @property {import('../style/flat.js').StyleVariables} [variables] Style variables. Each variable must hold a literal value (not
|
|
37
|
+
* an expression). These variables can be used as {@link import("../expr/expression.js").ExpressionValue expressions} in the styles properties
|
|
38
|
+
* using the `['var', 'varName']` operator.
|
|
39
|
+
* To update style variables, use the {@link import("./WebGLVector.js").default#updateStyleVariables} method.
|
|
40
|
+
* @property {import("./Base.js").BackgroundColor} [background] Background color for the layer. If not specified, no background
|
|
41
|
+
* will be rendered.
|
|
42
|
+
* FIXME: not supported yet
|
|
43
|
+
* @property {boolean} [disableHitDetection=false] Setting this to true will provide a slight performance boost, but will
|
|
44
|
+
* prevent all hit detection on the layer.
|
|
45
|
+
* @property {Object<string, *>} [properties] Arbitrary observable properties. Can be accessed with `#get()` and `#set()`.
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @classdesc
|
|
50
|
+
* Layer optimized for rendering large vector datasets.
|
|
51
|
+
*
|
|
52
|
+
* **Important: a `WebGLVector` layer must be manually disposed when removed, otherwise the underlying WebGL context
|
|
53
|
+
* will not be garbage collected.**
|
|
54
|
+
*
|
|
55
|
+
* Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}
|
|
56
|
+
* property on the layer object; for example, setting `title: 'My Title'` in the
|
|
57
|
+
* options means that `title` is observable, and has get/set accessors.
|
|
58
|
+
*
|
|
59
|
+
* @template {import("../source/VectorTile.js").default<FeatureType>} [VectorTileSourceType=import("../source/VectorTile.js").default<*>]
|
|
60
|
+
* @template {import('../Feature.js').FeatureLike} [FeatureType=ExtractedFeatureType<VectorTileSourceType>]
|
|
61
|
+
* @extends {BaseTileLayer<VectorTileSourceType, WebGLVectorTileLayerRenderer>}
|
|
62
|
+
*/
|
|
63
|
+
class WebGLVectorTileLayer extends BaseTileLayer {
|
|
64
|
+
/**
|
|
65
|
+
* @param {Options<VectorTileSourceType, FeatureType>} [options] Options.
|
|
66
|
+
*/
|
|
67
|
+
constructor(options) {
|
|
68
|
+
const baseOptions = Object.assign({}, options);
|
|
69
|
+
|
|
70
|
+
super(baseOptions);
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* @type {import('../style/flat.js').StyleVariables}
|
|
74
|
+
* @private
|
|
75
|
+
*/
|
|
76
|
+
this.styleVariables_ = options.variables || {};
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* @private
|
|
80
|
+
*/
|
|
81
|
+
this.style_ = options.style;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* @private
|
|
85
|
+
*/
|
|
86
|
+
this.hitDetectionDisabled_ = !!options.disableHitDetection;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* @override
|
|
91
|
+
*/
|
|
92
|
+
createRenderer() {
|
|
93
|
+
return new WebGLVectorTileLayerRenderer(this, {
|
|
94
|
+
style: this.style_,
|
|
95
|
+
variables: this.styleVariables_,
|
|
96
|
+
disableHitDetection: this.hitDetectionDisabled_,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Update any variables used by the layer style and trigger a re-render.
|
|
102
|
+
* @param {import('../style/flat.js').StyleVariables} variables Variables to update.
|
|
103
|
+
*/
|
|
104
|
+
updateStyleVariables(variables) {
|
|
105
|
+
Object.assign(this.styleVariables_, variables);
|
|
106
|
+
this.changed();
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Set the layer style.
|
|
111
|
+
* @param {import('../style/flat.js').FlatStyleLike} style Layer style.
|
|
112
|
+
*/
|
|
113
|
+
setStyle(style) {
|
|
114
|
+
this.style = style;
|
|
115
|
+
this.clearRenderer();
|
|
116
|
+
this.changed();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export default WebGLVectorTileLayer;
|
package/package.json
CHANGED
|
@@ -21,7 +21,7 @@ function pushCustomAttributesInRenderInstructions(
|
|
|
21
21
|
for (const key in customAttributes) {
|
|
22
22
|
const attr = customAttributes[key];
|
|
23
23
|
const value = attr.callback.call(batchEntry, batchEntry.feature);
|
|
24
|
-
renderInstructions[currentIndex + shift++] = value[0] ?? value;
|
|
24
|
+
renderInstructions[currentIndex + shift++] = value?.[0] ?? value;
|
|
25
25
|
if (!attr.size || attr.size === 1) {
|
|
26
26
|
continue;
|
|
27
27
|
}
|
package/util.js
CHANGED