ol 10.7.1-dev.1763902953397 → 10.7.1-dev.1763911630652
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 +6 -0
- package/dist/ol.d.ts.map +1 -1
- package/dist/ol.js +1 -1
- package/dist/ol.js.map +1 -1
- package/package.json +1 -1
- package/proj/proj4.d.ts +43 -6
- package/proj/proj4.d.ts.map +1 -1
- package/proj/proj4.js +89 -28
- package/proj.js +2 -2
- package/renderer/canvas/VectorLayer.d.ts +7 -0
- package/renderer/canvas/VectorLayer.d.ts.map +1 -1
- package/renderer/canvas/VectorLayer.js +34 -7
- package/source/Vector.d.ts +3 -3
- package/source/Vector.d.ts.map +1 -1
- package/source/Vector.js +3 -3
- package/util.js +1 -1
package/package.json
CHANGED
package/proj/proj4.d.ts
CHANGED
|
@@ -30,26 +30,61 @@ export function register(proj4: typeof import("proj4/dist/lib/core.js").default
|
|
|
30
30
|
version: string;
|
|
31
31
|
}): void;
|
|
32
32
|
/**
|
|
33
|
-
* Set the lookup function for getting proj4 definitions given an
|
|
33
|
+
* Set the lookup function for getting proj4 or WKT definitions given an
|
|
34
|
+
* projection code. By default, the {@link module:ol/proj/proj4.fromProjectionCode}
|
|
35
|
+
* function uses the spatialreference.org website for WKT definitions.
|
|
36
|
+
* This can be changed by providing a different lookup function.
|
|
37
|
+
*
|
|
38
|
+
* @param {function(string):Promise<string>} func The lookup function.
|
|
39
|
+
* @api
|
|
40
|
+
*/
|
|
41
|
+
export function setProjectionCodeLookup(func: (arg0: string) => Promise<string>): void;
|
|
42
|
+
/**
|
|
43
|
+
* Get the current projection code lookup function.
|
|
44
|
+
*
|
|
45
|
+
* @return {function(string):Promise<string>} The projection lookup function.
|
|
46
|
+
*/
|
|
47
|
+
export function getProjectionCodeLookup(): (arg0: string) => Promise<string>;
|
|
48
|
+
/**
|
|
49
|
+
* Get a projection from a projection code (i.e., authority:number).
|
|
50
|
+
* This function fetches the projection definition from the
|
|
51
|
+
* https://spatialreference.org website, registers this definition for use with
|
|
52
|
+
* proj4, and returns a configured projection. You must call import proj4 and
|
|
53
|
+
* call {@link module:ol/proj/proj4.register} before using this function.
|
|
54
|
+
*
|
|
55
|
+
* If the projection definition is already registered with proj4, it will not
|
|
56
|
+
* be fetched again (so it is ok to call this function multiple times with the
|
|
57
|
+
* same code).
|
|
58
|
+
*
|
|
59
|
+
* @param {string} code The projection code (e.g., 'EPSG:4326' or 'OGC:CRS84').
|
|
60
|
+
* @return {Promise<Projection>} The projection.
|
|
61
|
+
* @api
|
|
62
|
+
*/
|
|
63
|
+
export function fromProjectionCode(code: string): Promise<Projection>;
|
|
64
|
+
/**
|
|
65
|
+
* Set the lookup function for getting proj4 or WKT definitions given an EPSG code.
|
|
34
66
|
* By default, the {@link module:ol/proj/proj4.fromEPSGCode} function uses the
|
|
35
|
-
*
|
|
36
|
-
* different lookup function.
|
|
67
|
+
* spatialreference.org website for WKT definitions.
|
|
68
|
+
* This can be changed by providing a different lookup function.
|
|
37
69
|
*
|
|
38
70
|
* @param {function(number):Promise<string>} func The lookup function.
|
|
39
71
|
* @api
|
|
72
|
+
* @deprecated Use {@link module:ol/proj/proj4.setProjectionCodeLookup} instead.
|
|
40
73
|
*/
|
|
41
74
|
export function setEPSGLookup(func: (arg0: number) => Promise<string>): void;
|
|
42
75
|
/**
|
|
43
76
|
* Get the current EPSG lookup function.
|
|
44
77
|
*
|
|
45
78
|
* @return {function(number):Promise<string>} The EPSG lookup function.
|
|
79
|
+
* @deprecated Use {@link module:ol/proj/proj4.getProjectionCodeLookup} instead.
|
|
46
80
|
*/
|
|
47
81
|
export function getEPSGLookup(): (arg0: number) => Promise<string>;
|
|
48
82
|
/**
|
|
49
83
|
* Get a projection from an EPSG code. This function fetches the projection
|
|
50
|
-
* definition from the
|
|
51
|
-
* proj4, and returns a configured projection. You must call
|
|
52
|
-
* call {@link module:ol/proj/proj4.register} before using this
|
|
84
|
+
* definition from the spatialreference.org website, registers this definition
|
|
85
|
+
* for use with proj4, and returns a configured projection. You must call
|
|
86
|
+
* import proj4 and call {@link module:ol/proj/proj4.register} before using this
|
|
87
|
+
* function.
|
|
53
88
|
*
|
|
54
89
|
* If the projection definition is already registered with proj4, it will not
|
|
55
90
|
* be fetched again (so it is ok to call this function multiple times with the
|
|
@@ -58,6 +93,7 @@ export function getEPSGLookup(): (arg0: number) => Promise<string>;
|
|
|
58
93
|
* @param {number|string} code The EPSG code (e.g. 4326 or 'EPSG:4326').
|
|
59
94
|
* @return {Promise<Projection>} The projection.
|
|
60
95
|
* @api
|
|
96
|
+
* @deprecated Use {@link module:ol/proj/proj4.fromProjectionCode} instead.
|
|
61
97
|
*/
|
|
62
98
|
export function fromEPSGCode(code: number | string): Promise<Projection>;
|
|
63
99
|
/**
|
|
@@ -69,6 +105,7 @@ export function fromEPSGCode(code: number | string): Promise<Projection>;
|
|
|
69
105
|
* @param {string} key MapTiler API key. Get your own API key at https://www.maptiler.com/cloud/.
|
|
70
106
|
* @return {function(number):Promise<string>} The EPSG lookup function.
|
|
71
107
|
* @api
|
|
108
|
+
* @deprecated Not needed any more, the default lookup provides this functionality now.
|
|
72
109
|
*/
|
|
73
110
|
export function epsgLookupMapTiler(key: string): (arg0: number) => Promise<string>;
|
|
74
111
|
import Projection from './Projection.js';
|
package/proj/proj4.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proj4.d.ts","sourceRoot":"","sources":["proj4.js"],"names":[],"mappings":"AAkBA;;GAEG;AACH,gCAFY,OAAO,CAIlB;AAED;;GAEG;AACH,mCAEC;AAED;;;;;;;;;;GAUG;AACH;;;;;;;;;;;SA6CC;
|
|
1
|
+
{"version":3,"file":"proj4.d.ts","sourceRoot":"","sources":["proj4.js"],"names":[],"mappings":"AAkBA;;GAEG;AACH,gCAFY,OAAO,CAIlB;AAED;;GAEG;AACH,mCAEC;AAED;;;;;;;;;;GAUG;AACH;;;;;;;;;;;SA6CC;AAsBD;;;;;;;;GAQG;AACH,8CAHW,CAAS,IAAM,EAAN,MAAM,KAAE,OAAO,CAAC,MAAM,CAAC,QAK1C;AAED;;;;GAIG;AACH,2CAFY,CAAS,IAAM,EAAN,MAAM,KAAE,OAAO,CAAC,MAAM,CAAC,CAI3C;AAED;;;;;;;;;;;;;;GAcG;AACH,yCAJW,MAAM,GACL,OAAO,CAAC,UAAU,CAAC,CAiB9B;AAWD;;;;;;;;;GASG;AACH,oCAJW,CAAS,IAAM,EAAN,MAAM,KAAE,OAAO,CAAC,MAAM,CAAC,QAM1C;AAED;;;;;GAKG;AACH,iCAHY,CAAS,IAAM,EAAN,MAAM,KAAE,OAAO,CAAC,MAAM,CAAC,CAK3C;AAED;;;;;;;;;;;;;;;GAeG;AACH,mCALW,MAAM,GAAC,MAAM,GACZ,OAAO,CAAC,UAAU,CAAC,CAS9B;AAED;;;;;;;;;;GAUG;AACH,wCALW,MAAM,GACL,CAAS,IAAM,EAAN,MAAM,KAAE,OAAO,CAAC,MAAM,CAAC,CA2D3C;uBApRsB,iBAAiB"}
|
package/proj/proj4.js
CHANGED
|
@@ -89,25 +89,96 @@ export function register(proj4) {
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
/**
|
|
92
|
-
* @param {
|
|
93
|
-
* @return {Promise<string>} The
|
|
92
|
+
* @param {string} code The projection code.
|
|
93
|
+
* @return {Promise<string>} The WKT definition.
|
|
94
94
|
*/
|
|
95
|
-
let
|
|
96
|
-
|
|
95
|
+
let projLookup = async function (code) {
|
|
96
|
+
if (typeof code !== 'string' || !code.includes(':')) {
|
|
97
|
+
throw new Error('Invalid code');
|
|
98
|
+
}
|
|
99
|
+
const [authority, num] = code.toLowerCase().split(':', 2);
|
|
100
|
+
const response = await fetch(
|
|
101
|
+
`https://spatialreference.org/ref/${authority}/${num}/ogcwkt/`,
|
|
102
|
+
);
|
|
97
103
|
if (!response.ok) {
|
|
98
|
-
throw new Error(
|
|
104
|
+
throw new Error(
|
|
105
|
+
`Unexpected response from spatialreference.org: ${response.status}`,
|
|
106
|
+
);
|
|
99
107
|
}
|
|
100
108
|
return response.text();
|
|
101
109
|
};
|
|
102
110
|
|
|
103
111
|
/**
|
|
104
|
-
* Set the lookup function for getting proj4 definitions given an
|
|
112
|
+
* Set the lookup function for getting proj4 or WKT definitions given an
|
|
113
|
+
* projection code. By default, the {@link module:ol/proj/proj4.fromProjectionCode}
|
|
114
|
+
* function uses the spatialreference.org website for WKT definitions.
|
|
115
|
+
* This can be changed by providing a different lookup function.
|
|
116
|
+
*
|
|
117
|
+
* @param {function(string):Promise<string>} func The lookup function.
|
|
118
|
+
* @api
|
|
119
|
+
*/
|
|
120
|
+
export function setProjectionCodeLookup(func) {
|
|
121
|
+
projLookup = func;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Get the current projection code lookup function.
|
|
126
|
+
*
|
|
127
|
+
* @return {function(string):Promise<string>} The projection lookup function.
|
|
128
|
+
*/
|
|
129
|
+
export function getProjectionCodeLookup() {
|
|
130
|
+
return projLookup;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Get a projection from a projection code (i.e., authority:number).
|
|
135
|
+
* This function fetches the projection definition from the
|
|
136
|
+
* https://spatialreference.org website, registers this definition for use with
|
|
137
|
+
* proj4, and returns a configured projection. You must call import proj4 and
|
|
138
|
+
* call {@link module:ol/proj/proj4.register} before using this function.
|
|
139
|
+
*
|
|
140
|
+
* If the projection definition is already registered with proj4, it will not
|
|
141
|
+
* be fetched again (so it is ok to call this function multiple times with the
|
|
142
|
+
* same code).
|
|
143
|
+
*
|
|
144
|
+
* @param {string} code The projection code (e.g., 'EPSG:4326' or 'OGC:CRS84').
|
|
145
|
+
* @return {Promise<Projection>} The projection.
|
|
146
|
+
* @api
|
|
147
|
+
*/
|
|
148
|
+
export async function fromProjectionCode(code) {
|
|
149
|
+
const proj4 = registered;
|
|
150
|
+
if (!proj4) {
|
|
151
|
+
throw new Error('Proj4 must be registered first with register(proj4)');
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (proj4.defs(code)) {
|
|
155
|
+
return getCachedProjection(code);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
proj4.defs(code, await projLookup(code));
|
|
159
|
+
register(proj4);
|
|
160
|
+
|
|
161
|
+
return getCachedProjection(code);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* @param {number} code The EPSG code.
|
|
166
|
+
* @return {Promise<string>} The proj4 or WKT definition.
|
|
167
|
+
* @deprecated Use {@link module:ol/proj/proj4.projLookup} instead.
|
|
168
|
+
*/
|
|
169
|
+
let epsgLookup = async function (code) {
|
|
170
|
+
return await projLookup('EPSG:' + code);
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Set the lookup function for getting proj4 or WKT definitions given an EPSG code.
|
|
105
175
|
* By default, the {@link module:ol/proj/proj4.fromEPSGCode} function uses the
|
|
106
|
-
*
|
|
107
|
-
* different lookup function.
|
|
176
|
+
* spatialreference.org website for WKT definitions.
|
|
177
|
+
* This can be changed by providing a different lookup function.
|
|
108
178
|
*
|
|
109
179
|
* @param {function(number):Promise<string>} func The lookup function.
|
|
110
180
|
* @api
|
|
181
|
+
* @deprecated Use {@link module:ol/proj/proj4.setProjectionCodeLookup} instead.
|
|
111
182
|
*/
|
|
112
183
|
export function setEPSGLookup(func) {
|
|
113
184
|
epsgLookup = func;
|
|
@@ -117,6 +188,7 @@ export function setEPSGLookup(func) {
|
|
|
117
188
|
* Get the current EPSG lookup function.
|
|
118
189
|
*
|
|
119
190
|
* @return {function(number):Promise<string>} The EPSG lookup function.
|
|
191
|
+
* @deprecated Use {@link module:ol/proj/proj4.getProjectionCodeLookup} instead.
|
|
120
192
|
*/
|
|
121
193
|
export function getEPSGLookup() {
|
|
122
194
|
return epsgLookup;
|
|
@@ -124,9 +196,10 @@ export function getEPSGLookup() {
|
|
|
124
196
|
|
|
125
197
|
/**
|
|
126
198
|
* Get a projection from an EPSG code. This function fetches the projection
|
|
127
|
-
* definition from the
|
|
128
|
-
* proj4, and returns a configured projection. You must call
|
|
129
|
-
* call {@link module:ol/proj/proj4.register} before using this
|
|
199
|
+
* definition from the spatialreference.org website, registers this definition
|
|
200
|
+
* for use with proj4, and returns a configured projection. You must call
|
|
201
|
+
* import proj4 and call {@link module:ol/proj/proj4.register} before using this
|
|
202
|
+
* function.
|
|
130
203
|
*
|
|
131
204
|
* If the projection definition is already registered with proj4, it will not
|
|
132
205
|
* be fetched again (so it is ok to call this function multiple times with the
|
|
@@ -135,26 +208,13 @@ export function getEPSGLookup() {
|
|
|
135
208
|
* @param {number|string} code The EPSG code (e.g. 4326 or 'EPSG:4326').
|
|
136
209
|
* @return {Promise<Projection>} The projection.
|
|
137
210
|
* @api
|
|
211
|
+
* @deprecated Use {@link module:ol/proj/proj4.fromProjectionCode} instead.
|
|
138
212
|
*/
|
|
139
213
|
export async function fromEPSGCode(code) {
|
|
140
|
-
if (typeof code === '
|
|
141
|
-
code =
|
|
214
|
+
if (typeof code === 'number') {
|
|
215
|
+
code = 'EPSG:' + code;
|
|
142
216
|
}
|
|
143
|
-
|
|
144
|
-
const proj4 = registered;
|
|
145
|
-
if (!proj4) {
|
|
146
|
-
throw new Error('Proj4 must be registered first with register(proj4)');
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
const epsgCode = 'EPSG:' + code;
|
|
150
|
-
if (proj4.defs(epsgCode)) {
|
|
151
|
-
return getCachedProjection(epsgCode);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
proj4.defs(epsgCode, await epsgLookup(code));
|
|
155
|
-
register(proj4);
|
|
156
|
-
|
|
157
|
-
return getCachedProjection(epsgCode);
|
|
217
|
+
return await fromProjectionCode(code);
|
|
158
218
|
}
|
|
159
219
|
|
|
160
220
|
/**
|
|
@@ -166,6 +226,7 @@ export async function fromEPSGCode(code) {
|
|
|
166
226
|
* @param {string} key MapTiler API key. Get your own API key at https://www.maptiler.com/cloud/.
|
|
167
227
|
* @return {function(number):Promise<string>} The EPSG lookup function.
|
|
168
228
|
* @api
|
|
229
|
+
* @deprecated Not needed any more, the default lookup provides this functionality now.
|
|
169
230
|
*/
|
|
170
231
|
export function epsgLookupMapTiler(key) {
|
|
171
232
|
return async function (code) {
|
package/proj.js
CHANGED
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
* Proj4js, or create a custom build to support those projections you need; see
|
|
24
24
|
* the Proj4js website for how to do this. You also need the Proj4js definitions
|
|
25
25
|
* for the required projections. These definitions can be obtained from
|
|
26
|
-
* https://
|
|
27
|
-
* tag (as in the examples) or pasted into your application.
|
|
26
|
+
* https://spatialreference.org/, and are a JS function, so can be loaded in a
|
|
27
|
+
* script tag (as in the examples) or pasted into your application.
|
|
28
28
|
*
|
|
29
29
|
* After all required projection definitions are added to proj4's registry (by
|
|
30
30
|
* using `proj4.defs()`), simply call `register(proj4)` from the `ol/proj/proj4`
|
|
@@ -26,6 +26,13 @@ declare class CanvasVectorLayerRenderer extends CanvasLayerRenderer<any> {
|
|
|
26
26
|
* @type {boolean}
|
|
27
27
|
*/
|
|
28
28
|
private clipped_;
|
|
29
|
+
/**
|
|
30
|
+
* Do we need to extend the rendered area on the x-axis to handle
|
|
31
|
+
* features that cross the antimeridian?
|
|
32
|
+
* @private
|
|
33
|
+
* @type {boolean}
|
|
34
|
+
*/
|
|
35
|
+
private extendX_;
|
|
29
36
|
/**
|
|
30
37
|
* @private
|
|
31
38
|
* @type {Array<import("../../Feature.js").default>}
|
|
@@ -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":";AA6CA;;;;GAIG;AACH;IACE;;OAEG;IACH,qFA+HC;IA5HC,eAAe;IACf,qCAA2E;IAE3E;;;OAG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"}
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
getHeight,
|
|
13
13
|
getWidth,
|
|
14
14
|
intersects as intersectsExtent,
|
|
15
|
+
isEmpty,
|
|
15
16
|
wrapX as wrapExtentX,
|
|
16
17
|
} from '../../extent.js';
|
|
17
18
|
import {
|
|
@@ -75,6 +76,14 @@ class CanvasVectorLayerRenderer extends CanvasLayerRenderer {
|
|
|
75
76
|
*/
|
|
76
77
|
this.clipped_ = false;
|
|
77
78
|
|
|
79
|
+
/**
|
|
80
|
+
* Do we need to extend the rendered area on the x-axis to handle
|
|
81
|
+
* features that cross the antimeridian?
|
|
82
|
+
* @private
|
|
83
|
+
* @type {boolean}
|
|
84
|
+
*/
|
|
85
|
+
this.extendX_ = false;
|
|
86
|
+
|
|
78
87
|
/**
|
|
79
88
|
* @private
|
|
80
89
|
* @type {Array<import("../../Feature.js").default>}
|
|
@@ -200,10 +209,12 @@ class CanvasVectorLayerRenderer extends CanvasLayerRenderer {
|
|
|
200
209
|
const multiWorld = vectorSource.getWrapX() && projection.canWrapX();
|
|
201
210
|
const worldWidth = multiWorld ? getWidth(projectionExtent) : null;
|
|
202
211
|
const endWorld = multiWorld
|
|
203
|
-
? Math.ceil((extent[2] - projectionExtent[2]) / worldWidth) +
|
|
212
|
+
? Math.ceil((extent[2] - projectionExtent[2]) / worldWidth) +
|
|
213
|
+
(this.extendX_ ? 2 : 1)
|
|
204
214
|
: 1;
|
|
205
215
|
let world = multiWorld
|
|
206
|
-
? Math.floor((extent[0] - projectionExtent[0]) / worldWidth)
|
|
216
|
+
? Math.floor((extent[0] - projectionExtent[0]) / worldWidth) -
|
|
217
|
+
(this.extendX_ ? 1 : 0)
|
|
207
218
|
: 0;
|
|
208
219
|
do {
|
|
209
220
|
let transform = this.getRenderTransform(
|
|
@@ -604,10 +615,20 @@ class CanvasVectorLayerRenderer extends CanvasLayerRenderer {
|
|
|
604
615
|
const loadExtents = [extent.slice()];
|
|
605
616
|
const projectionExtent = projection.getExtent();
|
|
606
617
|
|
|
618
|
+
const canWrapX = vectorSource.getWrapX() && projection.canWrapX();
|
|
619
|
+
this.extendX_ = false;
|
|
620
|
+
if (canWrapX) {
|
|
621
|
+
const sourceExtent = vectorSource.getExtent();
|
|
622
|
+
if (sourceExtent && !isEmpty(sourceExtent)) {
|
|
623
|
+
this.extendX_ =
|
|
624
|
+
sourceExtent[0] < projectionExtent[0] ||
|
|
625
|
+
sourceExtent[2] > projectionExtent[2];
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
|
|
607
629
|
if (
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
!containsExtent(projectionExtent, frameState.extent)
|
|
630
|
+
canWrapX &&
|
|
631
|
+
(!containsExtent(projectionExtent, frameState.extent) || this.extendX_)
|
|
611
632
|
) {
|
|
612
633
|
// For the replay group, we need an extent that intersects the real world
|
|
613
634
|
// (-180° to +180°). To support geometries in a coordinate range from -540°
|
|
@@ -616,8 +637,14 @@ class CanvasVectorLayerRenderer extends CanvasLayerRenderer {
|
|
|
616
637
|
// the viewport width to make sure we cover the whole viewport.
|
|
617
638
|
const worldWidth = getWidth(projectionExtent);
|
|
618
639
|
const gutter = Math.max(getWidth(extent) / 2, worldWidth);
|
|
619
|
-
|
|
620
|
-
|
|
640
|
+
let projMinX = projectionExtent[0];
|
|
641
|
+
let projMaxX = projectionExtent[2];
|
|
642
|
+
if (this.extendX_) {
|
|
643
|
+
projMinX -= worldWidth;
|
|
644
|
+
projMaxX += worldWidth;
|
|
645
|
+
}
|
|
646
|
+
extent[0] = projMinX - gutter;
|
|
647
|
+
extent[2] = projMaxX + gutter;
|
|
621
648
|
wrapCoordinateX(center, projection);
|
|
622
649
|
const loadExtent = wrapExtentX(loadExtents[0], projection);
|
|
623
650
|
// If the extent crosses the date line, we load data for both edges of the worlds
|
package/source/Vector.d.ts
CHANGED
|
@@ -534,14 +534,14 @@ declare class VectorSource<FeatureType extends import("../Feature.js").FeatureLi
|
|
|
534
534
|
/**
|
|
535
535
|
* Get the extent of the features currently in the source.
|
|
536
536
|
*
|
|
537
|
-
* This
|
|
537
|
+
* This will return `null` when the source is configured with
|
|
538
538
|
* `useSpatialIndex` set to `false`.
|
|
539
539
|
* @param {import("../extent.js").Extent} [extent] Destination extent. If provided, no new extent
|
|
540
540
|
* will be created. Instead, that extent's coordinates will be overwritten.
|
|
541
|
-
* @return {import("../extent.js").Extent} Extent.
|
|
541
|
+
* @return {import("../extent.js").Extent | null} Extent.
|
|
542
542
|
* @api
|
|
543
543
|
*/
|
|
544
|
-
getExtent(extent?: import("../extent.js").Extent): import("../extent.js").Extent;
|
|
544
|
+
getExtent(extent?: import("../extent.js").Extent): import("../extent.js").Extent | null;
|
|
545
545
|
/**
|
|
546
546
|
* Get a feature by its identifier (the value returned by feature.getId()). When `RenderFeature`s
|
|
547
547
|
* are used, `getFeatureById()` can return an array of `RenderFeature`s. This allows for handling
|
package/source/Vector.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Vector.d.ts","sourceRoot":"","sources":["Vector.js"],"names":[],"mappings":"AAuBA;;;;;;;GAOG;AAEH;;;;;GAKG;AACH,+BAFoD,WAAW,SAAlD,OAAQ,eAAe,EAAE,WAAY;IAGhD;;;;OAIG;IACH,kBAJW,MAAM,YACN,WAAW,aACX,KAAK,CAAC,WAAW,CAAC,EAkB5B;IAbC;;;;OAIG;IACH,SAHU,WAAW,GAAC,SAAS,CAGT;IAEtB;;;;OAIG;IACH,UAHU,KAAK,CAAC,WAAW,CAAC,GAAC,SAAS,CAGd;CAE3B;;;;;;;8BAjCY,CAAS,IAA6B,EAA7B,OAAO,cAAc,EAAE,MAAM,EAAE,IAAM,EAAN,MAAM,EAAE,IAAuC,EAAvC,OAAO,uBAAuB,EAAE,OAAO,KAAG,KAAK,CAAC,OAAO,cAAc,EAAE,MAAM,CAAC;;;;gDAoCvF,CAAC,SAAxC,OAAQ,eAAe,EAAE,WAAY,qEACrC,CAAC,SAAS,aA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;;;OAGG;IACH,6BAuCC;IAED;;;;;OAKG;IACH,oBAJW,WAAW,GACV,OAAO,CASlB;IAED;;OAEG;IACH,WAFY,OAAO,CAYlB;IAED;;;;OAIG;IACH,qBAJW,OAAO,cAAc,EAAE,MAAM,cAC7B,MAAM,cACN,OAAO,uBAAuB,EAAE,OAAO,QAoDjD;IAWD;;;;OAIG;IACH,2BAHW,OAAO,cAAc,EAAE,MAAM,QAavC;IAED;;;;;;OAMG;IACH,yBAHW,KAAK,CAAC,WAAW,CAAC,QAW5B;IAED;;;;;;OAMG;IACH,uBAHW,WAAW,QAWrB;IAED;;;;;OAKG;IACH,yCAJW,WAAW,GACV,OAAO,CAyClB;IAED;;;;;OAKG;IACH,2BAOC;IAED;;;;;OAKG;IACH,kBAHW,OAAO,qBAAqB,EAAE,aAAa,QAKrD;IAED;;;;OAIG;IACH,YAHW,MAAM,GAAC,OAAO,qBAAqB,EAAE,kBAAkB,QAOjE;IAED;;OAEG;IACH,sBAFW,OAAO,QAKjB;CACF;0BAxpCyB,sBAAsB;uBAbzB,kBAAkB;mBAgBtB,aAAa"}
|
package/source/Vector.js
CHANGED
|
@@ -841,15 +841,15 @@ class VectorSource extends Source {
|
|
|
841
841
|
/**
|
|
842
842
|
* Get the extent of the features currently in the source.
|
|
843
843
|
*
|
|
844
|
-
* This
|
|
844
|
+
* This will return `null` when the source is configured with
|
|
845
845
|
* `useSpatialIndex` set to `false`.
|
|
846
846
|
* @param {import("../extent.js").Extent} [extent] Destination extent. If provided, no new extent
|
|
847
847
|
* will be created. Instead, that extent's coordinates will be overwritten.
|
|
848
|
-
* @return {import("../extent.js").Extent} Extent.
|
|
848
|
+
* @return {import("../extent.js").Extent | null} Extent.
|
|
849
849
|
* @api
|
|
850
850
|
*/
|
|
851
851
|
getExtent(extent) {
|
|
852
|
-
return this.featuresRtree_
|
|
852
|
+
return this.featuresRtree_?.getExtent(extent) ?? null;
|
|
853
853
|
}
|
|
854
854
|
|
|
855
855
|
/**
|
package/util.js
CHANGED