@loaders.gl/wms 3.3.0-alpha.13 → 3.3.0-alpha.14
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/dist.min.js +182 -1046
- package/dist/es5/index.js +20 -13
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lerc-loader.js +1 -1
- package/dist/es5/lib/data-sources/adhoc-image-service.js +4 -0
- package/dist/es5/lib/data-sources/adhoc-image-service.js.map +1 -1
- package/dist/es5/lib/data-sources/arcgis-image-service.js +180 -0
- package/dist/es5/lib/data-sources/arcgis-image-service.js.map +1 -0
- package/dist/es5/lib/data-sources/create-image-source.js +45 -0
- package/dist/es5/lib/data-sources/create-image-source.js.map +1 -0
- package/dist/es5/lib/data-sources/image-services/arcgis-image-service.js +179 -0
- package/dist/es5/lib/data-sources/image-services/arcgis-image-service.js.map +1 -0
- package/dist/es5/lib/data-sources/image-services/image-service.js +163 -0
- package/dist/es5/lib/data-sources/image-services/image-service.js.map +1 -0
- package/dist/es5/lib/data-sources/{wms-service.js → image-services/wms-service.js} +116 -75
- package/dist/es5/lib/data-sources/image-services/wms-service.js.map +1 -0
- package/dist/es5/wip/arcgis-feature-service.js +45 -0
- package/dist/es5/wip/arcgis-feature-service.js.map +1 -0
- package/dist/es5/wip/data-source.js.map +1 -1
- package/dist/es5/wip/gml-loader.js +1 -1
- package/dist/es5/wip/wcs-capabilities-loader.js +1 -1
- package/dist/es5/wip/wfs-capabilities-loader.js +1 -1
- package/dist/es5/wip/wmts-capabilities-loader.js +1 -1
- package/dist/es5/wms-capabilities-loader.js +1 -1
- package/dist/es5/wms-error-loader.js +1 -1
- package/dist/esm/index.js +5 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lerc-loader.js +1 -1
- package/dist/esm/lib/data-sources/adhoc-image-service.js +2 -0
- package/dist/esm/lib/data-sources/adhoc-image-service.js.map +1 -1
- package/dist/esm/lib/data-sources/arcgis-image-service.js +62 -0
- package/dist/esm/lib/data-sources/arcgis-image-service.js.map +1 -0
- package/dist/esm/lib/data-sources/create-image-source.js +30 -0
- package/dist/esm/lib/data-sources/create-image-source.js.map +1 -0
- package/dist/esm/lib/data-sources/image-services/arcgis-image-service.js +61 -0
- package/dist/esm/lib/data-sources/image-services/arcgis-image-service.js.map +1 -0
- package/dist/esm/lib/data-sources/image-services/image-service.js +72 -0
- package/dist/esm/lib/data-sources/image-services/image-service.js.map +1 -0
- package/dist/esm/lib/data-sources/{wms-service.js → image-services/wms-service.js} +46 -32
- package/dist/esm/lib/data-sources/image-services/wms-service.js.map +1 -0
- package/dist/esm/wip/arcgis-feature-service.js +28 -0
- package/dist/esm/wip/arcgis-feature-service.js.map +1 -0
- package/dist/esm/wip/data-source.js.map +1 -1
- package/dist/esm/wip/gml-loader.js +1 -1
- package/dist/esm/wip/wcs-capabilities-loader.js +1 -1
- package/dist/esm/wip/wfs-capabilities-loader.js +1 -1
- package/dist/esm/wip/wmts-capabilities-loader.js +1 -1
- package/dist/esm/wms-capabilities-loader.js +1 -1
- package/dist/esm/wms-error-loader.js +1 -1
- package/dist/index.d.ts +9 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -8
- package/dist/lib/data-sources/adhoc-image-service.d.ts +2 -0
- package/dist/lib/data-sources/adhoc-image-service.d.ts.map +1 -1
- package/dist/lib/data-sources/adhoc-image-service.js +2 -0
- package/dist/lib/data-sources/arcgis-image-service.d.ts +79 -0
- package/dist/lib/data-sources/arcgis-image-service.d.ts.map +1 -0
- package/dist/lib/data-sources/arcgis-image-service.js +85 -0
- package/dist/lib/data-sources/create-image-source.d.ts +16 -0
- package/dist/lib/data-sources/create-image-source.d.ts.map +1 -0
- package/dist/lib/data-sources/create-image-source.js +39 -0
- package/dist/lib/data-sources/image-services/arcgis-image-service.d.ts +71 -0
- package/dist/lib/data-sources/image-services/arcgis-image-service.d.ts.map +1 -0
- package/dist/lib/data-sources/image-services/arcgis-image-service.js +85 -0
- package/dist/lib/data-sources/image-services/image-service.d.ts +39 -0
- package/dist/lib/data-sources/image-services/image-service.d.ts.map +1 -0
- package/dist/lib/data-sources/image-services/image-service.js +82 -0
- package/dist/lib/data-sources/{wms-service.d.ts → image-services/wms-service.d.ts} +33 -38
- package/dist/lib/data-sources/image-services/wms-service.d.ts.map +1 -0
- package/dist/lib/data-sources/{wms-service.js → image-services/wms-service.js} +40 -28
- package/dist/wip/arcgis-feature-service.d.ts +56 -0
- package/dist/wip/arcgis-feature-service.d.ts.map +1 -0
- package/dist/wip/arcgis-feature-service.js +28 -0
- package/dist/wip/data-source.d.ts +14 -13
- package/dist/wip/data-source.d.ts.map +1 -1
- package/dist/wip/data-source.js +15 -13
- package/package.json +6 -6
- package/src/index.ts +13 -8
- package/src/lib/data-sources/adhoc-image-service.ts +3 -0
- package/src/lib/data-sources/arcgis-image-service.ts +146 -0
- package/src/lib/data-sources/create-image-source.ts +46 -0
- package/src/lib/data-sources/image-services/arcgis-image-service.ts +136 -0
- package/src/lib/data-sources/image-services/image-service.ts +105 -0
- package/src/lib/data-sources/{wms-service.ts → image-services/wms-service.ts} +51 -47
- package/src/wip/arcgis-feature-service.ts +89 -0
- package/src/wip/data-source.ts +15 -13
- package/dist/es5/lib/data-sources/wms-service.js.map +0 -1
- package/dist/esm/lib/data-sources/wms-service.js.map +0 -1
- package/dist/lib/data-sources/wms-service.d.ts.map +0 -1
package/dist/dist.min.js
CHANGED
|
@@ -1770,6 +1770,15 @@ var init_wms_capabilities_loader = __esm({
|
|
|
1770
1770
|
}
|
|
1771
1771
|
});
|
|
1772
1772
|
|
|
1773
|
+
// src/lib/data-sources/image-source.ts
|
|
1774
|
+
var ImageSource;
|
|
1775
|
+
var init_image_source = __esm({
|
|
1776
|
+
"src/lib/data-sources/image-source.ts"() {
|
|
1777
|
+
ImageSource = class {
|
|
1778
|
+
};
|
|
1779
|
+
}
|
|
1780
|
+
});
|
|
1781
|
+
|
|
1773
1782
|
// ../images/src/lib/utils/version.ts
|
|
1774
1783
|
var VERSION4;
|
|
1775
1784
|
var init_version = __esm({
|
|
@@ -1937,13 +1946,13 @@ var init_svg_utils = __esm({
|
|
|
1937
1946
|
// ../images/src/lib/parsers/parse-to-image.ts
|
|
1938
1947
|
async function parseToImage(arrayBuffer, options, url) {
|
|
1939
1948
|
const blobOrDataUrl = getBlobOrSVGDataUrl(arrayBuffer, url);
|
|
1940
|
-
const
|
|
1941
|
-
const objectUrl = typeof blobOrDataUrl !== "string" &&
|
|
1949
|
+
const URL = self.URL || self.webkitURL;
|
|
1950
|
+
const objectUrl = typeof blobOrDataUrl !== "string" && URL.createObjectURL(blobOrDataUrl);
|
|
1942
1951
|
try {
|
|
1943
1952
|
return await loadToImage(objectUrl || blobOrDataUrl, options);
|
|
1944
1953
|
} finally {
|
|
1945
1954
|
if (objectUrl) {
|
|
1946
|
-
|
|
1955
|
+
URL.revokeObjectURL(objectUrl);
|
|
1947
1956
|
}
|
|
1948
1957
|
}
|
|
1949
1958
|
}
|
|
@@ -2225,12 +2234,63 @@ var init_src3 = __esm({
|
|
|
2225
2234
|
}
|
|
2226
2235
|
});
|
|
2227
2236
|
|
|
2228
|
-
// src/lib/data-sources/image-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
"
|
|
2232
|
-
|
|
2237
|
+
// src/lib/data-sources/image-services/image-service.ts
|
|
2238
|
+
function getFetchFunction(options) {
|
|
2239
|
+
const fetchFunction = options?.fetch;
|
|
2240
|
+
if (fetchFunction && typeof fetchFunction === "function") {
|
|
2241
|
+
return (url, fetchOptions2) => fetchFunction(url, fetchOptions2);
|
|
2242
|
+
}
|
|
2243
|
+
const fetchOptions = options?.fetch;
|
|
2244
|
+
if (fetchOptions && typeof fetchOptions !== "function") {
|
|
2245
|
+
return (url) => fetch(url, fetchOptions);
|
|
2246
|
+
}
|
|
2247
|
+
return (url) => fetch(url);
|
|
2248
|
+
}
|
|
2249
|
+
function mergeImageServiceProps(props) {
|
|
2250
|
+
return {
|
|
2251
|
+
...props,
|
|
2252
|
+
loadOptions: {
|
|
2253
|
+
...props.loadOptions,
|
|
2254
|
+
fetch: getFetchFunction(props.loadOptions)
|
|
2255
|
+
}
|
|
2256
|
+
};
|
|
2257
|
+
}
|
|
2258
|
+
var ImageService;
|
|
2259
|
+
var init_image_service = __esm({
|
|
2260
|
+
"src/lib/data-sources/image-services/image-service.ts"() {
|
|
2261
|
+
init_src3();
|
|
2262
|
+
init_image_source();
|
|
2263
|
+
ImageService = class extends ImageSource {
|
|
2264
|
+
constructor(props) {
|
|
2265
|
+
super();
|
|
2266
|
+
this.props = mergeImageServiceProps(props);
|
|
2267
|
+
this.fetch = getFetchFunction(props);
|
|
2268
|
+
}
|
|
2269
|
+
async getMetadata() {
|
|
2270
|
+
throw new Error("ImageSource.getMetadata not implemented");
|
|
2271
|
+
}
|
|
2272
|
+
async getImage(parameters) {
|
|
2273
|
+
const granularParameters = this.getGranularParameters(parameters);
|
|
2274
|
+
const url = this.getURLFromTemplate(granularParameters);
|
|
2275
|
+
const response = await this.fetch(url);
|
|
2276
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
2277
|
+
return await ImageLoader.parse(arrayBuffer);
|
|
2278
|
+
}
|
|
2279
|
+
getGranularParameters(parameters) {
|
|
2280
|
+
const [east, north, west, south] = parameters.bbox;
|
|
2281
|
+
return { ...parameters, east, north, south, west };
|
|
2282
|
+
}
|
|
2283
|
+
getURLFromTemplate(parameters) {
|
|
2284
|
+
let url = this.props.url;
|
|
2285
|
+
for (const [key, value] of Object.entries(parameters)) {
|
|
2286
|
+
url = url.replace(`\${${key}}`, String(value));
|
|
2287
|
+
url = url.replace(`{${key}}`, String(value));
|
|
2288
|
+
}
|
|
2289
|
+
return url;
|
|
2290
|
+
}
|
|
2233
2291
|
};
|
|
2292
|
+
ImageService.type = "template";
|
|
2293
|
+
ImageService.testURL = (url) => url.toLowerCase().includes("{");
|
|
2234
2294
|
}
|
|
2235
2295
|
});
|
|
2236
2296
|
|
|
@@ -2266,12 +2326,13 @@ var init_wms_layer_description_loader = __esm({
|
|
|
2266
2326
|
}
|
|
2267
2327
|
});
|
|
2268
2328
|
|
|
2269
|
-
// src/lib/data-sources/wms-service.ts
|
|
2329
|
+
// src/lib/data-sources/image-services/wms-service.ts
|
|
2270
2330
|
var WMSService;
|
|
2271
2331
|
var init_wms_service = __esm({
|
|
2272
|
-
"src/lib/data-sources/wms-service.ts"() {
|
|
2332
|
+
"src/lib/data-sources/image-services/wms-service.ts"() {
|
|
2273
2333
|
init_src3();
|
|
2274
2334
|
init_image_source();
|
|
2335
|
+
init_image_service();
|
|
2275
2336
|
init_wms_capabilities_loader();
|
|
2276
2337
|
init_wms_feature_info_loader();
|
|
2277
2338
|
init_wms_layer_description_loader();
|
|
@@ -2279,9 +2340,7 @@ var init_wms_service = __esm({
|
|
|
2279
2340
|
WMSService = class extends ImageSource {
|
|
2280
2341
|
constructor(props) {
|
|
2281
2342
|
super();
|
|
2282
|
-
this.
|
|
2283
|
-
wms: { throwOnError: true }
|
|
2284
|
-
};
|
|
2343
|
+
this.capabilities = null;
|
|
2285
2344
|
this.loaders = [
|
|
2286
2345
|
ImageLoader,
|
|
2287
2346
|
WMSErrorLoader,
|
|
@@ -2289,9 +2348,12 @@ var init_wms_service = __esm({
|
|
|
2289
2348
|
WMSFeatureInfoLoader,
|
|
2290
2349
|
WMSLayerDescriptionLoader
|
|
2291
2350
|
];
|
|
2292
|
-
this.
|
|
2293
|
-
|
|
2294
|
-
this.
|
|
2351
|
+
this.props = mergeImageServiceProps(props);
|
|
2352
|
+
this.fetch = getFetchFunction(this.props);
|
|
2353
|
+
this.props.loadOptions = {
|
|
2354
|
+
...this.props.loadOptions,
|
|
2355
|
+
wms: { ...this.props.loadOptions?.wms, throwOnError: true }
|
|
2356
|
+
};
|
|
2295
2357
|
}
|
|
2296
2358
|
getMetadata() {
|
|
2297
2359
|
return this.getCapabilities();
|
|
@@ -2301,45 +2363,53 @@ var init_wms_service = __esm({
|
|
|
2301
2363
|
}
|
|
2302
2364
|
async getCapabilities(wmsParameters, vendorParameters) {
|
|
2303
2365
|
const url = this.getCapabilitiesURL(wmsParameters, vendorParameters);
|
|
2304
|
-
const
|
|
2305
|
-
const response = await fetch2(url, this.loadOptions);
|
|
2366
|
+
const response = await this.fetch(url);
|
|
2306
2367
|
const arrayBuffer = await response.arrayBuffer();
|
|
2307
2368
|
this._checkResponse(response, arrayBuffer);
|
|
2308
|
-
|
|
2369
|
+
const capabilities = await WMSCapabilitiesLoader.parse(arrayBuffer, this.props.loadOptions);
|
|
2370
|
+
this.capabilities = capabilities;
|
|
2371
|
+
return capabilities;
|
|
2309
2372
|
}
|
|
2310
2373
|
async getMap(options, vendorParameters) {
|
|
2311
2374
|
const url = this.getMapURL(options, vendorParameters);
|
|
2312
|
-
const
|
|
2313
|
-
const response = await fetch2(url, this.loadOptions);
|
|
2375
|
+
const response = await this.fetch(url);
|
|
2314
2376
|
const arrayBuffer = await response.arrayBuffer();
|
|
2315
2377
|
this._checkResponse(response, arrayBuffer);
|
|
2316
2378
|
try {
|
|
2317
|
-
return await ImageLoader.parse(arrayBuffer, this.loadOptions);
|
|
2379
|
+
return await ImageLoader.parse(arrayBuffer, this.props.loadOptions);
|
|
2318
2380
|
} catch {
|
|
2319
2381
|
throw this._parseError(arrayBuffer);
|
|
2320
2382
|
}
|
|
2321
2383
|
}
|
|
2322
2384
|
async getFeatureInfo(options, vendorParameters) {
|
|
2323
2385
|
const url = this.getFeatureInfoURL(options, vendorParameters);
|
|
2324
|
-
const response = await this.fetch(url
|
|
2386
|
+
const response = await this.fetch(url);
|
|
2325
2387
|
const arrayBuffer = await response.arrayBuffer();
|
|
2326
2388
|
this._checkResponse(response, arrayBuffer);
|
|
2327
|
-
return await WMSFeatureInfoLoader.parse(arrayBuffer, this.loadOptions);
|
|
2389
|
+
return await WMSFeatureInfoLoader.parse(arrayBuffer, this.props.loadOptions);
|
|
2390
|
+
}
|
|
2391
|
+
async getFeatureInfoText(options, vendorParameters) {
|
|
2392
|
+
options = { ...options, info_format: "text/plain" };
|
|
2393
|
+
const url = this.getFeatureInfoURL(options, vendorParameters);
|
|
2394
|
+
const response = await this.fetch(url);
|
|
2395
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
2396
|
+
this._checkResponse(response, arrayBuffer);
|
|
2397
|
+
return new TextDecoder().decode(arrayBuffer);
|
|
2328
2398
|
}
|
|
2329
2399
|
async describeLayer(options, vendorParameters) {
|
|
2330
2400
|
const url = this.describeLayerURL(options, vendorParameters);
|
|
2331
|
-
const response = await this.fetch(url
|
|
2401
|
+
const response = await this.fetch(url);
|
|
2332
2402
|
const arrayBuffer = await response.arrayBuffer();
|
|
2333
2403
|
this._checkResponse(response, arrayBuffer);
|
|
2334
|
-
return await WMSLayerDescriptionLoader.parse(arrayBuffer, this.loadOptions);
|
|
2404
|
+
return await WMSLayerDescriptionLoader.parse(arrayBuffer, this.props.loadOptions);
|
|
2335
2405
|
}
|
|
2336
2406
|
async getLegendGraphic(options, vendorParameters) {
|
|
2337
2407
|
const url = this.getLegendGraphicURL(options, vendorParameters);
|
|
2338
|
-
const response = await this.fetch(url
|
|
2408
|
+
const response = await this.fetch(url);
|
|
2339
2409
|
const arrayBuffer = await response.arrayBuffer();
|
|
2340
2410
|
this._checkResponse(response, arrayBuffer);
|
|
2341
2411
|
try {
|
|
2342
|
-
return await ImageLoader.parse(arrayBuffer, this.loadOptions);
|
|
2412
|
+
return await ImageLoader.parse(arrayBuffer, this.props.loadOptions);
|
|
2343
2413
|
} catch {
|
|
2344
2414
|
throw this._parseError(arrayBuffer);
|
|
2345
2415
|
}
|
|
@@ -2402,7 +2472,7 @@ var init_wms_service = __esm({
|
|
|
2402
2472
|
return this._getWMSUrl(options, vendorParameters);
|
|
2403
2473
|
}
|
|
2404
2474
|
_getWMSUrl(options, vendorParameters) {
|
|
2405
|
-
let url =
|
|
2475
|
+
let url = this.props.url;
|
|
2406
2476
|
let first = true;
|
|
2407
2477
|
for (const [key, value] of Object.entries(options)) {
|
|
2408
2478
|
url += first ? "?" : "&";
|
|
@@ -2418,51 +2488,103 @@ var init_wms_service = __esm({
|
|
|
2418
2488
|
_checkResponse(response, arrayBuffer) {
|
|
2419
2489
|
const contentType = response.headers["content-type"];
|
|
2420
2490
|
if (!response.ok || WMSErrorLoader.mimeTypes.includes(contentType)) {
|
|
2421
|
-
const error = WMSErrorLoader.parseSync(arrayBuffer, this.loadOptions);
|
|
2491
|
+
const error = WMSErrorLoader.parseSync(arrayBuffer, this.props.loadOptions);
|
|
2422
2492
|
throw new Error(error);
|
|
2423
2493
|
}
|
|
2424
2494
|
}
|
|
2425
2495
|
_parseError(arrayBuffer) {
|
|
2426
|
-
const error = WMSErrorLoader.parseSync(arrayBuffer, this.loadOptions);
|
|
2496
|
+
const error = WMSErrorLoader.parseSync(arrayBuffer, this.props.loadOptions);
|
|
2427
2497
|
return new Error(error);
|
|
2428
2498
|
}
|
|
2429
2499
|
};
|
|
2500
|
+
WMSService.type = "wms";
|
|
2501
|
+
WMSService.testURL = (url) => url.toLowerCase().includes("wms");
|
|
2430
2502
|
}
|
|
2431
2503
|
});
|
|
2432
2504
|
|
|
2433
|
-
// src/lib/data-sources/
|
|
2434
|
-
var
|
|
2435
|
-
var
|
|
2436
|
-
"src/lib/data-sources/
|
|
2437
|
-
init_src3();
|
|
2505
|
+
// src/lib/data-sources/image-services/arcgis-image-service.ts
|
|
2506
|
+
var ArcGISImageService;
|
|
2507
|
+
var init_arcgis_image_service = __esm({
|
|
2508
|
+
"src/lib/data-sources/image-services/arcgis-image-service.ts"() {
|
|
2438
2509
|
init_image_source();
|
|
2439
|
-
|
|
2510
|
+
init_image_service();
|
|
2511
|
+
ArcGISImageService = class extends ImageSource {
|
|
2440
2512
|
constructor(props) {
|
|
2441
2513
|
super();
|
|
2442
|
-
this.
|
|
2514
|
+
this.props = mergeImageServiceProps(props);
|
|
2515
|
+
this.fetch = getFetchFunction(this.props);
|
|
2443
2516
|
}
|
|
2444
2517
|
async getMetadata() {
|
|
2445
|
-
|
|
2518
|
+
return await this.info();
|
|
2446
2519
|
}
|
|
2447
2520
|
async getImage(parameters) {
|
|
2448
|
-
|
|
2449
|
-
const url = this.getURLFromTemplate(granularParameters);
|
|
2450
|
-
const response = await fetch(url);
|
|
2451
|
-
const arrayBuffer = await response.arrayBuffer();
|
|
2452
|
-
return await ImageLoader.parse(arrayBuffer);
|
|
2521
|
+
throw new Error("not implemented");
|
|
2453
2522
|
}
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
return { ...parameters, east, north, south, west };
|
|
2523
|
+
async info() {
|
|
2524
|
+
throw new Error("not implemented");
|
|
2457
2525
|
}
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2526
|
+
exportImage(options) {
|
|
2527
|
+
throw new Error("not implemented");
|
|
2528
|
+
}
|
|
2529
|
+
infoURL(options) {
|
|
2530
|
+
return this.props.url;
|
|
2531
|
+
}
|
|
2532
|
+
exportImageURL(options) {
|
|
2533
|
+
return this.props.url;
|
|
2534
|
+
}
|
|
2535
|
+
getUrl(options, extra) {
|
|
2536
|
+
let url = `${this.props.url}`;
|
|
2537
|
+
let first = true;
|
|
2538
|
+
for (const [key, value] of Object.entries(options)) {
|
|
2539
|
+
url += first ? "?" : "&";
|
|
2540
|
+
first = false;
|
|
2541
|
+
if (Array.isArray(value)) {
|
|
2542
|
+
url += `${key.toUpperCase()}=${value.join(",")}`;
|
|
2543
|
+
} else {
|
|
2544
|
+
url += `${key.toUpperCase()}=${value ? String(value) : ""}`;
|
|
2545
|
+
}
|
|
2462
2546
|
}
|
|
2463
2547
|
return url;
|
|
2464
2548
|
}
|
|
2549
|
+
async checkResponse(response) {
|
|
2550
|
+
if (!response.ok) {
|
|
2551
|
+
throw new Error("error");
|
|
2552
|
+
}
|
|
2553
|
+
}
|
|
2465
2554
|
};
|
|
2555
|
+
ArcGISImageService.type = "arcgis-image-server";
|
|
2556
|
+
ArcGISImageService.testURL = (url) => url.toLowerCase().includes("ImageServer");
|
|
2557
|
+
}
|
|
2558
|
+
});
|
|
2559
|
+
|
|
2560
|
+
// src/lib/data-sources/create-image-source.ts
|
|
2561
|
+
function createImageSource(props) {
|
|
2562
|
+
const { type = "auto" } = props;
|
|
2563
|
+
const serviceType = type === "auto" ? guessServiceType(props.url) : type;
|
|
2564
|
+
switch (serviceType) {
|
|
2565
|
+
case "template":
|
|
2566
|
+
return new ImageService(props);
|
|
2567
|
+
case "wms":
|
|
2568
|
+
return new WMSService(props);
|
|
2569
|
+
default:
|
|
2570
|
+
throw new Error("Not a valid image source type");
|
|
2571
|
+
}
|
|
2572
|
+
}
|
|
2573
|
+
function guessServiceType(url) {
|
|
2574
|
+
for (const Service of SERVICES) {
|
|
2575
|
+
if (Service.testURL && Service.testURL(url)) {
|
|
2576
|
+
return Service.type;
|
|
2577
|
+
}
|
|
2578
|
+
}
|
|
2579
|
+
return "wms";
|
|
2580
|
+
}
|
|
2581
|
+
var SERVICES;
|
|
2582
|
+
var init_create_image_source = __esm({
|
|
2583
|
+
"src/lib/data-sources/create-image-source.ts"() {
|
|
2584
|
+
init_image_service();
|
|
2585
|
+
init_wms_service();
|
|
2586
|
+
init_arcgis_image_service();
|
|
2587
|
+
SERVICES = [WMSService, ArcGISImageService, ImageService];
|
|
2466
2588
|
}
|
|
2467
2589
|
});
|
|
2468
2590
|
|
|
@@ -4187,1006 +4309,36 @@ var init_gml_loader = __esm({
|
|
|
4187
4309
|
}
|
|
4188
4310
|
});
|
|
4189
4311
|
|
|
4190
|
-
// ../../node_modules/lerc/LercDecode.js
|
|
4191
|
-
var require_LercDecode = __commonJS({
|
|
4192
|
-
"../../node_modules/lerc/LercDecode.js"(exports2, module2) {
|
|
4193
|
-
(function(global2, factory) {
|
|
4194
|
-
typeof exports2 === "object" && typeof module2 !== "undefined" ? factory(exports2) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.Lerc = {}));
|
|
4195
|
-
})(exports2, function(exports3) {
|
|
4196
|
-
"use strict";
|
|
4197
|
-
var Module = (() => {
|
|
4198
|
-
var _scriptDir = typeof document === "undefined" && typeof location === "undefined" ? new (require("url")).URL("file:" + __filename).href : typeof document === "undefined" ? location.href : document.currentScript && document.currentScript.src || new URL("LercDecode.js", document.baseURI).href;
|
|
4199
|
-
return function(Module2) {
|
|
4200
|
-
Module2 = Module2 || {};
|
|
4201
|
-
var Module2 = typeof Module2 != "undefined" ? Module2 : {};
|
|
4202
|
-
var readyPromiseResolve, readyPromiseReject;
|
|
4203
|
-
Module2["ready"] = new Promise(function(resolve, reject) {
|
|
4204
|
-
readyPromiseResolve = resolve;
|
|
4205
|
-
readyPromiseReject = reject;
|
|
4206
|
-
});
|
|
4207
|
-
var moduleOverrides = Object.assign({}, Module2);
|
|
4208
|
-
var ENVIRONMENT_IS_WEB = typeof window == "object";
|
|
4209
|
-
var ENVIRONMENT_IS_WORKER = typeof importScripts == "function";
|
|
4210
|
-
var ENVIRONMENT_IS_NODE = typeof process == "object" && typeof process.versions == "object" && typeof process.versions.node == "string";
|
|
4211
|
-
var scriptDirectory = "";
|
|
4212
|
-
function locateFile(path) {
|
|
4213
|
-
if (Module2["locateFile"]) {
|
|
4214
|
-
return Module2["locateFile"](path, scriptDirectory);
|
|
4215
|
-
}
|
|
4216
|
-
return scriptDirectory + path;
|
|
4217
|
-
}
|
|
4218
|
-
var read_, readAsync, readBinary;
|
|
4219
|
-
var fs;
|
|
4220
|
-
var nodePath;
|
|
4221
|
-
var requireNodeFS;
|
|
4222
|
-
if (ENVIRONMENT_IS_NODE) {
|
|
4223
|
-
if (ENVIRONMENT_IS_WORKER) {
|
|
4224
|
-
scriptDirectory = require("path").dirname(scriptDirectory) + "/";
|
|
4225
|
-
} else {
|
|
4226
|
-
scriptDirectory = __dirname + "/";
|
|
4227
|
-
}
|
|
4228
|
-
requireNodeFS = () => {
|
|
4229
|
-
if (!nodePath) {
|
|
4230
|
-
fs = require("fs");
|
|
4231
|
-
nodePath = require("path");
|
|
4232
|
-
}
|
|
4233
|
-
};
|
|
4234
|
-
read_ = function shell_read(filename, binary) {
|
|
4235
|
-
requireNodeFS();
|
|
4236
|
-
filename = nodePath["normalize"](filename);
|
|
4237
|
-
return fs.readFileSync(filename, binary ? void 0 : "utf8");
|
|
4238
|
-
};
|
|
4239
|
-
readBinary = (filename) => {
|
|
4240
|
-
var ret = read_(filename, true);
|
|
4241
|
-
if (!ret.buffer) {
|
|
4242
|
-
ret = new Uint8Array(ret);
|
|
4243
|
-
}
|
|
4244
|
-
return ret;
|
|
4245
|
-
};
|
|
4246
|
-
readAsync = (filename, onload, onerror) => {
|
|
4247
|
-
requireNodeFS();
|
|
4248
|
-
filename = nodePath["normalize"](filename);
|
|
4249
|
-
fs.readFile(filename, function(err2, data) {
|
|
4250
|
-
if (err2)
|
|
4251
|
-
onerror(err2);
|
|
4252
|
-
else
|
|
4253
|
-
onload(data.buffer);
|
|
4254
|
-
});
|
|
4255
|
-
};
|
|
4256
|
-
if (process["argv"].length > 1) {
|
|
4257
|
-
process["argv"][1].replace(/\\/g, "/");
|
|
4258
|
-
}
|
|
4259
|
-
process["argv"].slice(2);
|
|
4260
|
-
process["on"]("uncaughtException", function(ex) {
|
|
4261
|
-
if (!(ex instanceof ExitStatus)) {
|
|
4262
|
-
throw ex;
|
|
4263
|
-
}
|
|
4264
|
-
});
|
|
4265
|
-
process["on"]("unhandledRejection", function(reason) {
|
|
4266
|
-
throw reason;
|
|
4267
|
-
});
|
|
4268
|
-
Module2["inspect"] = function() {
|
|
4269
|
-
return "[Emscripten Module object]";
|
|
4270
|
-
};
|
|
4271
|
-
} else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
|
|
4272
|
-
if (ENVIRONMENT_IS_WORKER) {
|
|
4273
|
-
scriptDirectory = self.location.href;
|
|
4274
|
-
} else if (typeof document != "undefined" && document.currentScript) {
|
|
4275
|
-
scriptDirectory = document.currentScript.src;
|
|
4276
|
-
}
|
|
4277
|
-
if (_scriptDir) {
|
|
4278
|
-
scriptDirectory = _scriptDir;
|
|
4279
|
-
}
|
|
4280
|
-
if (scriptDirectory.indexOf("blob:") !== 0) {
|
|
4281
|
-
scriptDirectory = scriptDirectory.substr(0, scriptDirectory.replace(/[?#].*/, "").lastIndexOf("/") + 1);
|
|
4282
|
-
} else {
|
|
4283
|
-
scriptDirectory = "";
|
|
4284
|
-
}
|
|
4285
|
-
{
|
|
4286
|
-
read_ = (url) => {
|
|
4287
|
-
var xhr = new XMLHttpRequest();
|
|
4288
|
-
xhr.open("GET", url, false);
|
|
4289
|
-
xhr.send(null);
|
|
4290
|
-
return xhr.responseText;
|
|
4291
|
-
};
|
|
4292
|
-
if (ENVIRONMENT_IS_WORKER) {
|
|
4293
|
-
readBinary = (url) => {
|
|
4294
|
-
var xhr = new XMLHttpRequest();
|
|
4295
|
-
xhr.open("GET", url, false);
|
|
4296
|
-
xhr.responseType = "arraybuffer";
|
|
4297
|
-
xhr.send(null);
|
|
4298
|
-
return new Uint8Array(xhr.response);
|
|
4299
|
-
};
|
|
4300
|
-
}
|
|
4301
|
-
readAsync = (url, onload, onerror) => {
|
|
4302
|
-
var xhr = new XMLHttpRequest();
|
|
4303
|
-
xhr.open("GET", url, true);
|
|
4304
|
-
xhr.responseType = "arraybuffer";
|
|
4305
|
-
xhr.onload = () => {
|
|
4306
|
-
if (xhr.status == 200 || xhr.status == 0 && xhr.response) {
|
|
4307
|
-
onload(xhr.response);
|
|
4308
|
-
return;
|
|
4309
|
-
}
|
|
4310
|
-
onerror();
|
|
4311
|
-
};
|
|
4312
|
-
xhr.onerror = onerror;
|
|
4313
|
-
xhr.send(null);
|
|
4314
|
-
};
|
|
4315
|
-
}
|
|
4316
|
-
} else
|
|
4317
|
-
;
|
|
4318
|
-
Module2["print"] || console.log.bind(console);
|
|
4319
|
-
var err = Module2["printErr"] || console.warn.bind(console);
|
|
4320
|
-
Object.assign(Module2, moduleOverrides);
|
|
4321
|
-
moduleOverrides = null;
|
|
4322
|
-
if (Module2["arguments"])
|
|
4323
|
-
;
|
|
4324
|
-
if (Module2["thisProgram"])
|
|
4325
|
-
;
|
|
4326
|
-
if (Module2["quit"])
|
|
4327
|
-
;
|
|
4328
|
-
var wasmBinary;
|
|
4329
|
-
if (Module2["wasmBinary"])
|
|
4330
|
-
wasmBinary = Module2["wasmBinary"];
|
|
4331
|
-
Module2["noExitRuntime"] || true;
|
|
4332
|
-
if (typeof WebAssembly != "object") {
|
|
4333
|
-
abort("no native wasm support detected");
|
|
4334
|
-
}
|
|
4335
|
-
var wasmMemory;
|
|
4336
|
-
var ABORT = false;
|
|
4337
|
-
var UTF8Decoder = typeof TextDecoder != "undefined" ? new TextDecoder("utf8") : void 0;
|
|
4338
|
-
function UTF8ArrayToString(heapOrArray, idx, maxBytesToRead) {
|
|
4339
|
-
var endIdx = idx + maxBytesToRead;
|
|
4340
|
-
var endPtr = idx;
|
|
4341
|
-
while (heapOrArray[endPtr] && !(endPtr >= endIdx))
|
|
4342
|
-
++endPtr;
|
|
4343
|
-
if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) {
|
|
4344
|
-
return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr));
|
|
4345
|
-
} else {
|
|
4346
|
-
var str = "";
|
|
4347
|
-
while (idx < endPtr) {
|
|
4348
|
-
var u0 = heapOrArray[idx++];
|
|
4349
|
-
if (!(u0 & 128)) {
|
|
4350
|
-
str += String.fromCharCode(u0);
|
|
4351
|
-
continue;
|
|
4352
|
-
}
|
|
4353
|
-
var u1 = heapOrArray[idx++] & 63;
|
|
4354
|
-
if ((u0 & 224) == 192) {
|
|
4355
|
-
str += String.fromCharCode((u0 & 31) << 6 | u1);
|
|
4356
|
-
continue;
|
|
4357
|
-
}
|
|
4358
|
-
var u2 = heapOrArray[idx++] & 63;
|
|
4359
|
-
if ((u0 & 240) == 224) {
|
|
4360
|
-
u0 = (u0 & 15) << 12 | u1 << 6 | u2;
|
|
4361
|
-
} else {
|
|
4362
|
-
u0 = (u0 & 7) << 18 | u1 << 12 | u2 << 6 | heapOrArray[idx++] & 63;
|
|
4363
|
-
}
|
|
4364
|
-
if (u0 < 65536) {
|
|
4365
|
-
str += String.fromCharCode(u0);
|
|
4366
|
-
} else {
|
|
4367
|
-
var ch = u0 - 65536;
|
|
4368
|
-
str += String.fromCharCode(55296 | ch >> 10, 56320 | ch & 1023);
|
|
4369
|
-
}
|
|
4370
|
-
}
|
|
4371
|
-
}
|
|
4372
|
-
return str;
|
|
4373
|
-
}
|
|
4374
|
-
function UTF8ToString(ptr, maxBytesToRead) {
|
|
4375
|
-
return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : "";
|
|
4376
|
-
}
|
|
4377
|
-
var buffer, HEAP8, HEAPU8, HEAP32, HEAPU32;
|
|
4378
|
-
function updateGlobalBufferAndViews(buf) {
|
|
4379
|
-
buffer = buf;
|
|
4380
|
-
Module2["HEAP8"] = HEAP8 = new Int8Array(buf);
|
|
4381
|
-
Module2["HEAP16"] = new Int16Array(buf);
|
|
4382
|
-
Module2["HEAP32"] = HEAP32 = new Int32Array(buf);
|
|
4383
|
-
Module2["HEAPU8"] = HEAPU8 = new Uint8Array(buf);
|
|
4384
|
-
Module2["HEAPU16"] = new Uint16Array(buf);
|
|
4385
|
-
Module2["HEAPU32"] = HEAPU32 = new Uint32Array(buf);
|
|
4386
|
-
Module2["HEAPF32"] = new Float32Array(buf);
|
|
4387
|
-
Module2["HEAPF64"] = new Float64Array(buf);
|
|
4388
|
-
}
|
|
4389
|
-
Module2["INITIAL_MEMORY"] || 16777216;
|
|
4390
|
-
var wasmTable;
|
|
4391
|
-
var __ATPRERUN__ = [];
|
|
4392
|
-
var __ATINIT__ = [];
|
|
4393
|
-
var __ATPOSTRUN__ = [];
|
|
4394
|
-
function preRun() {
|
|
4395
|
-
if (Module2["preRun"]) {
|
|
4396
|
-
if (typeof Module2["preRun"] == "function")
|
|
4397
|
-
Module2["preRun"] = [Module2["preRun"]];
|
|
4398
|
-
while (Module2["preRun"].length) {
|
|
4399
|
-
addOnPreRun(Module2["preRun"].shift());
|
|
4400
|
-
}
|
|
4401
|
-
}
|
|
4402
|
-
callRuntimeCallbacks(__ATPRERUN__);
|
|
4403
|
-
}
|
|
4404
|
-
function initRuntime() {
|
|
4405
|
-
callRuntimeCallbacks(__ATINIT__);
|
|
4406
|
-
}
|
|
4407
|
-
function postRun() {
|
|
4408
|
-
if (Module2["postRun"]) {
|
|
4409
|
-
if (typeof Module2["postRun"] == "function")
|
|
4410
|
-
Module2["postRun"] = [Module2["postRun"]];
|
|
4411
|
-
while (Module2["postRun"].length) {
|
|
4412
|
-
addOnPostRun(Module2["postRun"].shift());
|
|
4413
|
-
}
|
|
4414
|
-
}
|
|
4415
|
-
callRuntimeCallbacks(__ATPOSTRUN__);
|
|
4416
|
-
}
|
|
4417
|
-
function addOnPreRun(cb) {
|
|
4418
|
-
__ATPRERUN__.unshift(cb);
|
|
4419
|
-
}
|
|
4420
|
-
function addOnInit(cb) {
|
|
4421
|
-
__ATINIT__.unshift(cb);
|
|
4422
|
-
}
|
|
4423
|
-
function addOnPostRun(cb) {
|
|
4424
|
-
__ATPOSTRUN__.unshift(cb);
|
|
4425
|
-
}
|
|
4426
|
-
var runDependencies = 0;
|
|
4427
|
-
var dependenciesFulfilled = null;
|
|
4428
|
-
function addRunDependency(id) {
|
|
4429
|
-
runDependencies++;
|
|
4430
|
-
if (Module2["monitorRunDependencies"]) {
|
|
4431
|
-
Module2["monitorRunDependencies"](runDependencies);
|
|
4432
|
-
}
|
|
4433
|
-
}
|
|
4434
|
-
function removeRunDependency(id) {
|
|
4435
|
-
runDependencies--;
|
|
4436
|
-
if (Module2["monitorRunDependencies"]) {
|
|
4437
|
-
Module2["monitorRunDependencies"](runDependencies);
|
|
4438
|
-
}
|
|
4439
|
-
if (runDependencies == 0) {
|
|
4440
|
-
if (dependenciesFulfilled) {
|
|
4441
|
-
var callback = dependenciesFulfilled;
|
|
4442
|
-
dependenciesFulfilled = null;
|
|
4443
|
-
callback();
|
|
4444
|
-
}
|
|
4445
|
-
}
|
|
4446
|
-
}
|
|
4447
|
-
function abort(what) {
|
|
4448
|
-
{
|
|
4449
|
-
if (Module2["onAbort"]) {
|
|
4450
|
-
Module2["onAbort"](what);
|
|
4451
|
-
}
|
|
4452
|
-
}
|
|
4453
|
-
what = "Aborted(" + what + ")";
|
|
4454
|
-
err(what);
|
|
4455
|
-
ABORT = true;
|
|
4456
|
-
what += ". Build with -sASSERTIONS for more info.";
|
|
4457
|
-
var e = new WebAssembly.RuntimeError(what);
|
|
4458
|
-
readyPromiseReject(e);
|
|
4459
|
-
throw e;
|
|
4460
|
-
}
|
|
4461
|
-
var dataURIPrefix = "data:application/octet-stream;base64,";
|
|
4462
|
-
function isDataURI(filename) {
|
|
4463
|
-
return filename.startsWith(dataURIPrefix);
|
|
4464
|
-
}
|
|
4465
|
-
function isFileURI(filename) {
|
|
4466
|
-
return filename.startsWith("file://");
|
|
4467
|
-
}
|
|
4468
|
-
var wasmBinaryFile;
|
|
4469
|
-
if (Module2["locateFile"]) {
|
|
4470
|
-
wasmBinaryFile = "lerc-wasm.wasm";
|
|
4471
|
-
if (!isDataURI(wasmBinaryFile)) {
|
|
4472
|
-
wasmBinaryFile = locateFile(wasmBinaryFile);
|
|
4473
|
-
}
|
|
4474
|
-
} else {
|
|
4475
|
-
wasmBinaryFile = new URL("lerc-wasm.wasm", typeof document === "undefined" && typeof location === "undefined" ? new (require("url")).URL("file:" + __filename).href : typeof document === "undefined" ? location.href : document.currentScript && document.currentScript.src || new URL("LercDecode.js", document.baseURI).href).toString();
|
|
4476
|
-
}
|
|
4477
|
-
function getBinary(file) {
|
|
4478
|
-
try {
|
|
4479
|
-
if (file == wasmBinaryFile && wasmBinary) {
|
|
4480
|
-
return new Uint8Array(wasmBinary);
|
|
4481
|
-
}
|
|
4482
|
-
if (readBinary) {
|
|
4483
|
-
return readBinary(file);
|
|
4484
|
-
} else {
|
|
4485
|
-
throw "both async and sync fetching of the wasm failed";
|
|
4486
|
-
}
|
|
4487
|
-
} catch (err2) {
|
|
4488
|
-
abort(err2);
|
|
4489
|
-
}
|
|
4490
|
-
}
|
|
4491
|
-
function getBinaryPromise() {
|
|
4492
|
-
if (!wasmBinary && (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER)) {
|
|
4493
|
-
if (typeof fetch == "function" && !isFileURI(wasmBinaryFile)) {
|
|
4494
|
-
return fetch(wasmBinaryFile, { credentials: "same-origin" }).then(function(response) {
|
|
4495
|
-
if (!response["ok"]) {
|
|
4496
|
-
throw "failed to load wasm binary file at '" + wasmBinaryFile + "'";
|
|
4497
|
-
}
|
|
4498
|
-
return response["arrayBuffer"]();
|
|
4499
|
-
}).catch(function() {
|
|
4500
|
-
return getBinary(wasmBinaryFile);
|
|
4501
|
-
});
|
|
4502
|
-
} else {
|
|
4503
|
-
if (readAsync) {
|
|
4504
|
-
return new Promise(function(resolve, reject) {
|
|
4505
|
-
readAsync(wasmBinaryFile, function(response) {
|
|
4506
|
-
resolve(new Uint8Array(response));
|
|
4507
|
-
}, reject);
|
|
4508
|
-
});
|
|
4509
|
-
}
|
|
4510
|
-
}
|
|
4511
|
-
}
|
|
4512
|
-
return Promise.resolve().then(function() {
|
|
4513
|
-
return getBinary(wasmBinaryFile);
|
|
4514
|
-
});
|
|
4515
|
-
}
|
|
4516
|
-
function createWasm() {
|
|
4517
|
-
var info = { "a": asmLibraryArg };
|
|
4518
|
-
function receiveInstance(instance, module3) {
|
|
4519
|
-
var exports5 = instance.exports;
|
|
4520
|
-
Module2["asm"] = exports5;
|
|
4521
|
-
wasmMemory = Module2["asm"]["g"];
|
|
4522
|
-
updateGlobalBufferAndViews(wasmMemory.buffer);
|
|
4523
|
-
wasmTable = Module2["asm"]["m"];
|
|
4524
|
-
addOnInit(Module2["asm"]["h"]);
|
|
4525
|
-
removeRunDependency();
|
|
4526
|
-
}
|
|
4527
|
-
addRunDependency();
|
|
4528
|
-
function receiveInstantiationResult(result) {
|
|
4529
|
-
receiveInstance(result["instance"]);
|
|
4530
|
-
}
|
|
4531
|
-
function instantiateArrayBuffer(receiver) {
|
|
4532
|
-
return getBinaryPromise().then(function(binary) {
|
|
4533
|
-
return WebAssembly.instantiate(binary, info);
|
|
4534
|
-
}).then(function(instance) {
|
|
4535
|
-
return instance;
|
|
4536
|
-
}).then(receiver, function(reason) {
|
|
4537
|
-
err("failed to asynchronously prepare wasm: " + reason);
|
|
4538
|
-
abort(reason);
|
|
4539
|
-
});
|
|
4540
|
-
}
|
|
4541
|
-
function instantiateAsync() {
|
|
4542
|
-
if (!wasmBinary && typeof WebAssembly.instantiateStreaming == "function" && !isDataURI(wasmBinaryFile) && !isFileURI(wasmBinaryFile) && !ENVIRONMENT_IS_NODE && typeof fetch == "function") {
|
|
4543
|
-
return fetch(wasmBinaryFile, { credentials: "same-origin" }).then(function(response) {
|
|
4544
|
-
var result = WebAssembly.instantiateStreaming(response, info);
|
|
4545
|
-
return result.then(receiveInstantiationResult, function(reason) {
|
|
4546
|
-
err("wasm streaming compile failed: " + reason);
|
|
4547
|
-
err("falling back to ArrayBuffer instantiation");
|
|
4548
|
-
return instantiateArrayBuffer(receiveInstantiationResult);
|
|
4549
|
-
});
|
|
4550
|
-
});
|
|
4551
|
-
} else {
|
|
4552
|
-
return instantiateArrayBuffer(receiveInstantiationResult);
|
|
4553
|
-
}
|
|
4554
|
-
}
|
|
4555
|
-
if (Module2["instantiateWasm"]) {
|
|
4556
|
-
try {
|
|
4557
|
-
var exports4 = Module2["instantiateWasm"](info, receiveInstance);
|
|
4558
|
-
return exports4;
|
|
4559
|
-
} catch (e) {
|
|
4560
|
-
err("Module.instantiateWasm callback failed with error: " + e);
|
|
4561
|
-
return false;
|
|
4562
|
-
}
|
|
4563
|
-
}
|
|
4564
|
-
instantiateAsync().catch(readyPromiseReject);
|
|
4565
|
-
return {};
|
|
4566
|
-
}
|
|
4567
|
-
function callRuntimeCallbacks(callbacks) {
|
|
4568
|
-
while (callbacks.length > 0) {
|
|
4569
|
-
var callback = callbacks.shift();
|
|
4570
|
-
if (typeof callback == "function") {
|
|
4571
|
-
callback(Module2);
|
|
4572
|
-
continue;
|
|
4573
|
-
}
|
|
4574
|
-
var func = callback.func;
|
|
4575
|
-
if (typeof func == "number") {
|
|
4576
|
-
if (callback.arg === void 0) {
|
|
4577
|
-
getWasmTableEntry(func)();
|
|
4578
|
-
} else {
|
|
4579
|
-
getWasmTableEntry(func)(callback.arg);
|
|
4580
|
-
}
|
|
4581
|
-
} else {
|
|
4582
|
-
func(callback.arg === void 0 ? null : callback.arg);
|
|
4583
|
-
}
|
|
4584
|
-
}
|
|
4585
|
-
}
|
|
4586
|
-
var wasmTableMirror = [];
|
|
4587
|
-
function getWasmTableEntry(funcPtr) {
|
|
4588
|
-
var func = wasmTableMirror[funcPtr];
|
|
4589
|
-
if (!func) {
|
|
4590
|
-
if (funcPtr >= wasmTableMirror.length)
|
|
4591
|
-
wasmTableMirror.length = funcPtr + 1;
|
|
4592
|
-
wasmTableMirror[funcPtr] = func = wasmTable.get(funcPtr);
|
|
4593
|
-
}
|
|
4594
|
-
return func;
|
|
4595
|
-
}
|
|
4596
|
-
function ___assert_fail(condition, filename, line, func) {
|
|
4597
|
-
abort("Assertion failed: " + UTF8ToString(condition) + ", at: " + [filename ? UTF8ToString(filename) : "unknown filename", line, func ? UTF8ToString(func) : "unknown function"]);
|
|
4598
|
-
}
|
|
4599
|
-
function ___cxa_allocate_exception(size) {
|
|
4600
|
-
return _malloc(size + 24) + 24;
|
|
4601
|
-
}
|
|
4602
|
-
function ExceptionInfo(excPtr) {
|
|
4603
|
-
this.excPtr = excPtr;
|
|
4604
|
-
this.ptr = excPtr - 24;
|
|
4605
|
-
this.set_type = function(type) {
|
|
4606
|
-
HEAPU32[this.ptr + 4 >> 2] = type;
|
|
4607
|
-
};
|
|
4608
|
-
this.get_type = function() {
|
|
4609
|
-
return HEAPU32[this.ptr + 4 >> 2];
|
|
4610
|
-
};
|
|
4611
|
-
this.set_destructor = function(destructor) {
|
|
4612
|
-
HEAPU32[this.ptr + 8 >> 2] = destructor;
|
|
4613
|
-
};
|
|
4614
|
-
this.get_destructor = function() {
|
|
4615
|
-
return HEAPU32[this.ptr + 8 >> 2];
|
|
4616
|
-
};
|
|
4617
|
-
this.set_refcount = function(refcount) {
|
|
4618
|
-
HEAP32[this.ptr >> 2] = refcount;
|
|
4619
|
-
};
|
|
4620
|
-
this.set_caught = function(caught) {
|
|
4621
|
-
caught = caught ? 1 : 0;
|
|
4622
|
-
HEAP8[this.ptr + 12 >> 0] = caught;
|
|
4623
|
-
};
|
|
4624
|
-
this.get_caught = function() {
|
|
4625
|
-
return HEAP8[this.ptr + 12 >> 0] != 0;
|
|
4626
|
-
};
|
|
4627
|
-
this.set_rethrown = function(rethrown) {
|
|
4628
|
-
rethrown = rethrown ? 1 : 0;
|
|
4629
|
-
HEAP8[this.ptr + 13 >> 0] = rethrown;
|
|
4630
|
-
};
|
|
4631
|
-
this.get_rethrown = function() {
|
|
4632
|
-
return HEAP8[this.ptr + 13 >> 0] != 0;
|
|
4633
|
-
};
|
|
4634
|
-
this.init = function(type, destructor) {
|
|
4635
|
-
this.set_adjusted_ptr(0);
|
|
4636
|
-
this.set_type(type);
|
|
4637
|
-
this.set_destructor(destructor);
|
|
4638
|
-
this.set_refcount(0);
|
|
4639
|
-
this.set_caught(false);
|
|
4640
|
-
this.set_rethrown(false);
|
|
4641
|
-
};
|
|
4642
|
-
this.add_ref = function() {
|
|
4643
|
-
var value = HEAP32[this.ptr >> 2];
|
|
4644
|
-
HEAP32[this.ptr >> 2] = value + 1;
|
|
4645
|
-
};
|
|
4646
|
-
this.release_ref = function() {
|
|
4647
|
-
var prev = HEAP32[this.ptr >> 2];
|
|
4648
|
-
HEAP32[this.ptr >> 2] = prev - 1;
|
|
4649
|
-
return prev === 1;
|
|
4650
|
-
};
|
|
4651
|
-
this.set_adjusted_ptr = function(adjustedPtr) {
|
|
4652
|
-
HEAPU32[this.ptr + 16 >> 2] = adjustedPtr;
|
|
4653
|
-
};
|
|
4654
|
-
this.get_adjusted_ptr = function() {
|
|
4655
|
-
return HEAPU32[this.ptr + 16 >> 2];
|
|
4656
|
-
};
|
|
4657
|
-
this.get_exception_ptr = function() {
|
|
4658
|
-
var isPointer = ___cxa_is_pointer_type(this.get_type());
|
|
4659
|
-
if (isPointer) {
|
|
4660
|
-
return HEAPU32[this.excPtr >> 2];
|
|
4661
|
-
}
|
|
4662
|
-
var adjusted = this.get_adjusted_ptr();
|
|
4663
|
-
if (adjusted !== 0)
|
|
4664
|
-
return adjusted;
|
|
4665
|
-
return this.excPtr;
|
|
4666
|
-
};
|
|
4667
|
-
}
|
|
4668
|
-
function ___cxa_throw(ptr, type, destructor) {
|
|
4669
|
-
var info = new ExceptionInfo(ptr);
|
|
4670
|
-
info.init(type, destructor);
|
|
4671
|
-
throw ptr;
|
|
4672
|
-
}
|
|
4673
|
-
function _abort() {
|
|
4674
|
-
abort("");
|
|
4675
|
-
}
|
|
4676
|
-
function _emscripten_memcpy_big(dest, src, num) {
|
|
4677
|
-
HEAPU8.copyWithin(dest, src, src + num);
|
|
4678
|
-
}
|
|
4679
|
-
function getHeapMax() {
|
|
4680
|
-
return 2147483648;
|
|
4681
|
-
}
|
|
4682
|
-
function emscripten_realloc_buffer(size) {
|
|
4683
|
-
try {
|
|
4684
|
-
wasmMemory.grow(size - buffer.byteLength + 65535 >>> 16);
|
|
4685
|
-
updateGlobalBufferAndViews(wasmMemory.buffer);
|
|
4686
|
-
return 1;
|
|
4687
|
-
} catch (e) {
|
|
4688
|
-
}
|
|
4689
|
-
}
|
|
4690
|
-
function _emscripten_resize_heap(requestedSize) {
|
|
4691
|
-
var oldSize = HEAPU8.length;
|
|
4692
|
-
requestedSize = requestedSize >>> 0;
|
|
4693
|
-
var maxHeapSize = getHeapMax();
|
|
4694
|
-
if (requestedSize > maxHeapSize) {
|
|
4695
|
-
return false;
|
|
4696
|
-
}
|
|
4697
|
-
let alignUp = (x, multiple) => x + (multiple - x % multiple) % multiple;
|
|
4698
|
-
for (var cutDown = 1; cutDown <= 4; cutDown *= 2) {
|
|
4699
|
-
var overGrownHeapSize = oldSize * (1 + 0.2 / cutDown);
|
|
4700
|
-
overGrownHeapSize = Math.min(overGrownHeapSize, requestedSize + 100663296);
|
|
4701
|
-
var newSize = Math.min(maxHeapSize, alignUp(Math.max(requestedSize, overGrownHeapSize), 65536));
|
|
4702
|
-
var replacement = emscripten_realloc_buffer(newSize);
|
|
4703
|
-
if (replacement) {
|
|
4704
|
-
return true;
|
|
4705
|
-
}
|
|
4706
|
-
}
|
|
4707
|
-
return false;
|
|
4708
|
-
}
|
|
4709
|
-
var asmLibraryArg = { "a": ___assert_fail, "c": ___cxa_allocate_exception, "b": ___cxa_throw, "d": _abort, "f": _emscripten_memcpy_big, "e": _emscripten_resize_heap };
|
|
4710
|
-
createWasm();
|
|
4711
|
-
Module2["___wasm_call_ctors"] = function() {
|
|
4712
|
-
return (Module2["___wasm_call_ctors"] = Module2["asm"]["h"]).apply(null, arguments);
|
|
4713
|
-
};
|
|
4714
|
-
Module2["_lerc_getBlobInfo"] = function() {
|
|
4715
|
-
return (Module2["_lerc_getBlobInfo"] = Module2["asm"]["i"]).apply(null, arguments);
|
|
4716
|
-
};
|
|
4717
|
-
Module2["_lerc_getDataRanges"] = function() {
|
|
4718
|
-
return (Module2["_lerc_getDataRanges"] = Module2["asm"]["j"]).apply(null, arguments);
|
|
4719
|
-
};
|
|
4720
|
-
Module2["_lerc_decode"] = function() {
|
|
4721
|
-
return (Module2["_lerc_decode"] = Module2["asm"]["k"]).apply(null, arguments);
|
|
4722
|
-
};
|
|
4723
|
-
Module2["_lerc_decode_4D"] = function() {
|
|
4724
|
-
return (Module2["_lerc_decode_4D"] = Module2["asm"]["l"]).apply(null, arguments);
|
|
4725
|
-
};
|
|
4726
|
-
var _malloc = Module2["_malloc"] = function() {
|
|
4727
|
-
return (_malloc = Module2["_malloc"] = Module2["asm"]["n"]).apply(null, arguments);
|
|
4728
|
-
};
|
|
4729
|
-
Module2["_free"] = function() {
|
|
4730
|
-
return (Module2["_free"] = Module2["asm"]["o"]).apply(null, arguments);
|
|
4731
|
-
};
|
|
4732
|
-
var ___cxa_is_pointer_type = Module2["___cxa_is_pointer_type"] = function() {
|
|
4733
|
-
return (___cxa_is_pointer_type = Module2["___cxa_is_pointer_type"] = Module2["asm"]["p"]).apply(null, arguments);
|
|
4734
|
-
};
|
|
4735
|
-
var calledRun;
|
|
4736
|
-
function ExitStatus(status) {
|
|
4737
|
-
this.name = "ExitStatus";
|
|
4738
|
-
this.message = "Program terminated with exit(" + status + ")";
|
|
4739
|
-
this.status = status;
|
|
4740
|
-
}
|
|
4741
|
-
dependenciesFulfilled = function runCaller() {
|
|
4742
|
-
if (!calledRun)
|
|
4743
|
-
run();
|
|
4744
|
-
if (!calledRun)
|
|
4745
|
-
dependenciesFulfilled = runCaller;
|
|
4746
|
-
};
|
|
4747
|
-
function run(args) {
|
|
4748
|
-
if (runDependencies > 0) {
|
|
4749
|
-
return;
|
|
4750
|
-
}
|
|
4751
|
-
preRun();
|
|
4752
|
-
if (runDependencies > 0) {
|
|
4753
|
-
return;
|
|
4754
|
-
}
|
|
4755
|
-
function doRun() {
|
|
4756
|
-
if (calledRun)
|
|
4757
|
-
return;
|
|
4758
|
-
calledRun = true;
|
|
4759
|
-
Module2["calledRun"] = true;
|
|
4760
|
-
if (ABORT)
|
|
4761
|
-
return;
|
|
4762
|
-
initRuntime();
|
|
4763
|
-
readyPromiseResolve(Module2);
|
|
4764
|
-
if (Module2["onRuntimeInitialized"])
|
|
4765
|
-
Module2["onRuntimeInitialized"]();
|
|
4766
|
-
postRun();
|
|
4767
|
-
}
|
|
4768
|
-
if (Module2["setStatus"]) {
|
|
4769
|
-
Module2["setStatus"]("Running...");
|
|
4770
|
-
setTimeout(function() {
|
|
4771
|
-
setTimeout(function() {
|
|
4772
|
-
Module2["setStatus"]("");
|
|
4773
|
-
}, 1);
|
|
4774
|
-
doRun();
|
|
4775
|
-
}, 1);
|
|
4776
|
-
} else {
|
|
4777
|
-
doRun();
|
|
4778
|
-
}
|
|
4779
|
-
}
|
|
4780
|
-
Module2["run"] = run;
|
|
4781
|
-
if (Module2["preInit"]) {
|
|
4782
|
-
if (typeof Module2["preInit"] == "function")
|
|
4783
|
-
Module2["preInit"] = [Module2["preInit"]];
|
|
4784
|
-
while (Module2["preInit"].length > 0) {
|
|
4785
|
-
Module2["preInit"].pop()();
|
|
4786
|
-
}
|
|
4787
|
-
}
|
|
4788
|
-
run();
|
|
4789
|
-
return Module2.ready;
|
|
4790
|
-
};
|
|
4791
|
-
})();
|
|
4792
|
-
const pixelTypeInfoMap = [
|
|
4793
|
-
{
|
|
4794
|
-
pixelType: "S8",
|
|
4795
|
-
size: 1,
|
|
4796
|
-
ctor: Int8Array,
|
|
4797
|
-
range: [-128, 128]
|
|
4798
|
-
},
|
|
4799
|
-
{
|
|
4800
|
-
pixelType: "U8",
|
|
4801
|
-
size: 1,
|
|
4802
|
-
ctor: Uint8Array,
|
|
4803
|
-
range: [0, 255]
|
|
4804
|
-
},
|
|
4805
|
-
{
|
|
4806
|
-
pixelType: "S16",
|
|
4807
|
-
size: 2,
|
|
4808
|
-
ctor: Int16Array,
|
|
4809
|
-
range: [-32768, 32767]
|
|
4810
|
-
},
|
|
4811
|
-
{
|
|
4812
|
-
pixelType: "U16",
|
|
4813
|
-
size: 2,
|
|
4814
|
-
ctor: Uint16Array,
|
|
4815
|
-
range: [0, 65536]
|
|
4816
|
-
},
|
|
4817
|
-
{
|
|
4818
|
-
pixelType: "S32",
|
|
4819
|
-
size: 4,
|
|
4820
|
-
ctor: Int32Array,
|
|
4821
|
-
range: [-2147483648, 2147483647]
|
|
4822
|
-
},
|
|
4823
|
-
{
|
|
4824
|
-
pixelType: "U32",
|
|
4825
|
-
size: 4,
|
|
4826
|
-
ctor: Uint32Array,
|
|
4827
|
-
range: [0, 4294967296]
|
|
4828
|
-
},
|
|
4829
|
-
{
|
|
4830
|
-
pixelType: "F32",
|
|
4831
|
-
size: 4,
|
|
4832
|
-
ctor: Float32Array,
|
|
4833
|
-
range: [-34027999387901484e22, 34027999387901484e22]
|
|
4834
|
-
},
|
|
4835
|
-
{
|
|
4836
|
-
pixelType: "F64",
|
|
4837
|
-
size: 8,
|
|
4838
|
-
ctor: Float64Array,
|
|
4839
|
-
range: [-17976931348623157e292, 17976931348623157e292]
|
|
4840
|
-
}
|
|
4841
|
-
];
|
|
4842
|
-
let loadPromise = null;
|
|
4843
|
-
let loaded = false;
|
|
4844
|
-
function load2(options = {}) {
|
|
4845
|
-
if (loadPromise) {
|
|
4846
|
-
return loadPromise;
|
|
4847
|
-
}
|
|
4848
|
-
const locateFile = options.locateFile || ((wasmFileName, scriptDir) => `${scriptDir}${wasmFileName}`);
|
|
4849
|
-
loadPromise = Module({ locateFile }).then((lercFactory) => lercFactory.ready.then(() => {
|
|
4850
|
-
initLercLib(lercFactory);
|
|
4851
|
-
loaded = true;
|
|
4852
|
-
}));
|
|
4853
|
-
return loadPromise;
|
|
4854
|
-
}
|
|
4855
|
-
function isLoaded() {
|
|
4856
|
-
return loaded;
|
|
4857
|
-
}
|
|
4858
|
-
const lercLib = {
|
|
4859
|
-
getBlobInfo: null,
|
|
4860
|
-
decode: null
|
|
4861
|
-
};
|
|
4862
|
-
function normalizeByteLength(n) {
|
|
4863
|
-
return (n >> 3 << 3) + 16;
|
|
4864
|
-
}
|
|
4865
|
-
function copyBytesFromWasm(wasmHeapU8, ptr_data, data) {
|
|
4866
|
-
data.set(wasmHeapU8.slice(ptr_data, ptr_data + data.length));
|
|
4867
|
-
}
|
|
4868
|
-
function initLercLib(lercFactory) {
|
|
4869
|
-
const { _malloc, _free, _lerc_getBlobInfo, _lerc_getDataRanges, _lerc_decode_4D, asm } = lercFactory;
|
|
4870
|
-
let heapU8;
|
|
4871
|
-
const memory = Object.values(asm).find((val) => val && "buffer" in val && val.buffer === lercFactory.HEAPU8.buffer);
|
|
4872
|
-
const mallocMultiple = (byteLengths) => {
|
|
4873
|
-
const lens = byteLengths.map((len) => normalizeByteLength(len));
|
|
4874
|
-
const byteLength = lens.reduce((a, b) => a + b);
|
|
4875
|
-
const ret = _malloc(byteLength);
|
|
4876
|
-
heapU8 = new Uint8Array(memory.buffer);
|
|
4877
|
-
let prev = lens[0];
|
|
4878
|
-
lens[0] = ret;
|
|
4879
|
-
for (let i = 1; i < lens.length; i++) {
|
|
4880
|
-
const next = lens[i];
|
|
4881
|
-
lens[i] = lens[i - 1] + prev;
|
|
4882
|
-
prev = next;
|
|
4883
|
-
}
|
|
4884
|
-
return lens;
|
|
4885
|
-
};
|
|
4886
|
-
lercLib.getBlobInfo = (blob) => {
|
|
4887
|
-
const infoArrSize = 12;
|
|
4888
|
-
const rangeArrSize = 3;
|
|
4889
|
-
const infoArr = new Uint8Array(infoArrSize * 4);
|
|
4890
|
-
const rangeArr = new Uint8Array(rangeArrSize * 8);
|
|
4891
|
-
const [ptr, ptr_info, ptr_range] = mallocMultiple([blob.length, infoArr.length, rangeArr.length]);
|
|
4892
|
-
heapU8.set(blob, ptr);
|
|
4893
|
-
heapU8.set(infoArr, ptr_info);
|
|
4894
|
-
heapU8.set(rangeArr, ptr_range);
|
|
4895
|
-
let hr = _lerc_getBlobInfo(ptr, blob.length, ptr_info, ptr_range, infoArrSize, rangeArrSize);
|
|
4896
|
-
if (hr) {
|
|
4897
|
-
_free(ptr);
|
|
4898
|
-
throw `lerc-getBlobInfo: error code is ${hr}`;
|
|
4899
|
-
}
|
|
4900
|
-
heapU8 = new Uint8Array(memory.buffer);
|
|
4901
|
-
copyBytesFromWasm(heapU8, ptr_info, infoArr);
|
|
4902
|
-
copyBytesFromWasm(heapU8, ptr_range, rangeArr);
|
|
4903
|
-
const lercInfoArr = new Uint32Array(infoArr.buffer);
|
|
4904
|
-
const statsArr = new Float64Array(rangeArr.buffer);
|
|
4905
|
-
const [version, dataType, dimCount, width, height, bandCount, validPixelCount, blobSize, maskCount, depthCount, bandCountWithNoData] = lercInfoArr;
|
|
4906
|
-
const headerInfo = {
|
|
4907
|
-
version,
|
|
4908
|
-
dimCount,
|
|
4909
|
-
width,
|
|
4910
|
-
height,
|
|
4911
|
-
validPixelCount,
|
|
4912
|
-
bandCount,
|
|
4913
|
-
blobSize,
|
|
4914
|
-
maskCount,
|
|
4915
|
-
depthCount,
|
|
4916
|
-
dataType,
|
|
4917
|
-
minValue: statsArr[0],
|
|
4918
|
-
maxValue: statsArr[1],
|
|
4919
|
-
maxZerror: statsArr[2],
|
|
4920
|
-
statistics: [],
|
|
4921
|
-
bandCountWithNoData
|
|
4922
|
-
};
|
|
4923
|
-
if (bandCountWithNoData) {
|
|
4924
|
-
return headerInfo;
|
|
4925
|
-
}
|
|
4926
|
-
if (depthCount === 1 && bandCount === 1) {
|
|
4927
|
-
_free(ptr);
|
|
4928
|
-
headerInfo.statistics.push({
|
|
4929
|
-
minValue: statsArr[0],
|
|
4930
|
-
maxValue: statsArr[1]
|
|
4931
|
-
});
|
|
4932
|
-
return headerInfo;
|
|
4933
|
-
}
|
|
4934
|
-
const numStatsBytes = depthCount * bandCount * 8;
|
|
4935
|
-
const bandStatsMinArr = new Uint8Array(numStatsBytes);
|
|
4936
|
-
const bandStatsMaxArr = new Uint8Array(numStatsBytes);
|
|
4937
|
-
let ptr_blob = ptr, ptr_min = 0, ptr_max = 0, blob_freed = false;
|
|
4938
|
-
if (heapU8.byteLength < ptr + numStatsBytes * 2) {
|
|
4939
|
-
_free(ptr);
|
|
4940
|
-
blob_freed = true;
|
|
4941
|
-
[ptr_blob, ptr_min, ptr_max] = mallocMultiple([blob.length, numStatsBytes, numStatsBytes]);
|
|
4942
|
-
heapU8.set(blob, ptr_blob);
|
|
4943
|
-
} else {
|
|
4944
|
-
[ptr_min, ptr_max] = mallocMultiple([numStatsBytes, numStatsBytes]);
|
|
4945
|
-
}
|
|
4946
|
-
heapU8.set(bandStatsMinArr, ptr_min);
|
|
4947
|
-
heapU8.set(bandStatsMaxArr, ptr_max);
|
|
4948
|
-
hr = _lerc_getDataRanges(ptr_blob, blob.length, depthCount, bandCount, ptr_min, ptr_max);
|
|
4949
|
-
if (hr) {
|
|
4950
|
-
_free(ptr_blob);
|
|
4951
|
-
if (!blob_freed) {
|
|
4952
|
-
_free(ptr_min);
|
|
4953
|
-
}
|
|
4954
|
-
throw `lerc-getDataRanges: error code is ${hr}`;
|
|
4955
|
-
}
|
|
4956
|
-
heapU8 = new Uint8Array(memory.buffer);
|
|
4957
|
-
copyBytesFromWasm(heapU8, ptr_min, bandStatsMinArr);
|
|
4958
|
-
copyBytesFromWasm(heapU8, ptr_max, bandStatsMaxArr);
|
|
4959
|
-
const allMinValues = new Float64Array(bandStatsMinArr.buffer);
|
|
4960
|
-
const allMaxValues = new Float64Array(bandStatsMaxArr.buffer);
|
|
4961
|
-
const statistics = headerInfo.statistics;
|
|
4962
|
-
for (let i = 0; i < bandCount; i++) {
|
|
4963
|
-
if (depthCount > 1) {
|
|
4964
|
-
const minValues = allMinValues.slice(i * depthCount, (i + 1) * depthCount);
|
|
4965
|
-
const maxValues = allMaxValues.slice(i * depthCount, (i + 1) * depthCount);
|
|
4966
|
-
const minValue = Math.min.apply(null, minValues);
|
|
4967
|
-
const maxValue = Math.max.apply(null, maxValues);
|
|
4968
|
-
statistics.push({
|
|
4969
|
-
minValue,
|
|
4970
|
-
maxValue,
|
|
4971
|
-
dimStats: { minValues, maxValues },
|
|
4972
|
-
depthStats: { minValues, maxValues }
|
|
4973
|
-
});
|
|
4974
|
-
} else {
|
|
4975
|
-
statistics.push({
|
|
4976
|
-
minValue: allMinValues[i],
|
|
4977
|
-
maxValue: allMaxValues[i]
|
|
4978
|
-
});
|
|
4979
|
-
}
|
|
4980
|
-
}
|
|
4981
|
-
_free(ptr_blob);
|
|
4982
|
-
if (!blob_freed) {
|
|
4983
|
-
_free(ptr_min);
|
|
4984
|
-
}
|
|
4985
|
-
return headerInfo;
|
|
4986
|
-
};
|
|
4987
|
-
lercLib.decode = (blob, blobInfo) => {
|
|
4988
|
-
const { maskCount, depthCount, bandCount, width, height, dataType, bandCountWithNoData } = blobInfo;
|
|
4989
|
-
const pixelTypeInfo = pixelTypeInfoMap[dataType];
|
|
4990
|
-
const numPixels = width * height;
|
|
4991
|
-
const maskData = new Uint8Array(numPixels * bandCount);
|
|
4992
|
-
const numDataBytes = numPixels * depthCount * bandCount * pixelTypeInfo.size;
|
|
4993
|
-
const data = new Uint8Array(numDataBytes);
|
|
4994
|
-
const useNoDataArr = new Uint8Array(bandCount);
|
|
4995
|
-
const noDataArr = new Uint8Array(bandCount * 8);
|
|
4996
|
-
const [ptr, ptr_mask, ptr_data, ptr_useNoData, ptr_noData] = mallocMultiple([
|
|
4997
|
-
blob.length,
|
|
4998
|
-
maskData.length,
|
|
4999
|
-
data.length,
|
|
5000
|
-
useNoDataArr.length,
|
|
5001
|
-
noDataArr.length
|
|
5002
|
-
]);
|
|
5003
|
-
heapU8.set(blob, ptr);
|
|
5004
|
-
heapU8.set(maskData, ptr_mask);
|
|
5005
|
-
heapU8.set(data, ptr_data);
|
|
5006
|
-
heapU8.set(useNoDataArr, ptr_useNoData);
|
|
5007
|
-
heapU8.set(noDataArr, ptr_noData);
|
|
5008
|
-
const hr = _lerc_decode_4D(ptr, blob.length, maskCount, ptr_mask, depthCount, width, height, bandCount, dataType, ptr_data, ptr_useNoData, ptr_noData);
|
|
5009
|
-
if (hr) {
|
|
5010
|
-
_free(ptr);
|
|
5011
|
-
throw `lerc-decode: error code is ${hr}`;
|
|
5012
|
-
}
|
|
5013
|
-
heapU8 = new Uint8Array(memory.buffer);
|
|
5014
|
-
copyBytesFromWasm(heapU8, ptr_data, data);
|
|
5015
|
-
copyBytesFromWasm(heapU8, ptr_mask, maskData);
|
|
5016
|
-
let noDataValues = null;
|
|
5017
|
-
if (bandCountWithNoData) {
|
|
5018
|
-
copyBytesFromWasm(heapU8, ptr_useNoData, useNoDataArr);
|
|
5019
|
-
copyBytesFromWasm(heapU8, ptr_noData, noDataArr);
|
|
5020
|
-
noDataValues = [];
|
|
5021
|
-
const noDataArr64 = new Float64Array(noDataArr.buffer);
|
|
5022
|
-
for (let i = 0; i < useNoDataArr.length; i++) {
|
|
5023
|
-
noDataValues.push(useNoDataArr[i] ? noDataArr64[i] : null);
|
|
5024
|
-
}
|
|
5025
|
-
}
|
|
5026
|
-
_free(ptr);
|
|
5027
|
-
return {
|
|
5028
|
-
data,
|
|
5029
|
-
maskData,
|
|
5030
|
-
noDataValues
|
|
5031
|
-
};
|
|
5032
|
-
};
|
|
5033
|
-
}
|
|
5034
|
-
function swapDepthValuesOrder(pixels, numPixels, depthCount, OutPixelTypeArray, inputIsBIP) {
|
|
5035
|
-
if (depthCount < 2) {
|
|
5036
|
-
return pixels;
|
|
5037
|
-
}
|
|
5038
|
-
const swap = new OutPixelTypeArray(numPixels * depthCount);
|
|
5039
|
-
if (inputIsBIP) {
|
|
5040
|
-
for (let i = 0, j = 0; i < numPixels; i++) {
|
|
5041
|
-
for (let iDim = 0, temp = i; iDim < depthCount; iDim++, temp += numPixels) {
|
|
5042
|
-
swap[temp] = pixels[j++];
|
|
5043
|
-
}
|
|
5044
|
-
}
|
|
5045
|
-
} else {
|
|
5046
|
-
for (let i = 0, j = 0; i < numPixels; i++) {
|
|
5047
|
-
for (let iDim = 0, temp = i; iDim < depthCount; iDim++, temp += numPixels) {
|
|
5048
|
-
swap[j++] = pixels[temp];
|
|
5049
|
-
}
|
|
5050
|
-
}
|
|
5051
|
-
}
|
|
5052
|
-
return swap;
|
|
5053
|
-
}
|
|
5054
|
-
function decode2(input, options = {}) {
|
|
5055
|
-
var _a, _b;
|
|
5056
|
-
const inputOffset = (_a = options.inputOffset) !== null && _a !== void 0 ? _a : 0;
|
|
5057
|
-
const blob = input instanceof Uint8Array ? input.subarray(inputOffset) : new Uint8Array(input, inputOffset);
|
|
5058
|
-
const blobInfo = lercLib.getBlobInfo(blob);
|
|
5059
|
-
const { data, maskData } = lercLib.decode(blob, blobInfo);
|
|
5060
|
-
const { width, height, bandCount, dimCount, depthCount, dataType, maskCount, statistics } = blobInfo;
|
|
5061
|
-
const pixelTypeInfo = pixelTypeInfoMap[dataType];
|
|
5062
|
-
const data1 = new pixelTypeInfo.ctor(data.buffer);
|
|
5063
|
-
const pixels = [];
|
|
5064
|
-
const masks = [];
|
|
5065
|
-
const numPixels = width * height;
|
|
5066
|
-
const numElementsPerBand = numPixels * depthCount;
|
|
5067
|
-
const swap = (_b = options.returnInterleaved) !== null && _b !== void 0 ? _b : options.returnPixelInterleavedDims;
|
|
5068
|
-
for (let i = 0; i < bandCount; i++) {
|
|
5069
|
-
const band = data1.subarray(i * numElementsPerBand, (i + 1) * numElementsPerBand);
|
|
5070
|
-
if (swap) {
|
|
5071
|
-
pixels.push(band);
|
|
5072
|
-
} else {
|
|
5073
|
-
const bsq = swapDepthValuesOrder(band, numPixels, depthCount, pixelTypeInfo.ctor, true);
|
|
5074
|
-
pixels.push(bsq);
|
|
5075
|
-
}
|
|
5076
|
-
masks.push(maskData.subarray(i * numElementsPerBand, (i + 1) * numElementsPerBand));
|
|
5077
|
-
}
|
|
5078
|
-
const mask = maskCount === 0 ? null : maskCount === 1 ? masks[0] : new Uint8Array(numPixels);
|
|
5079
|
-
if (maskCount > 1) {
|
|
5080
|
-
mask.set(masks[0]);
|
|
5081
|
-
for (let i = 1; i < masks.length; i++) {
|
|
5082
|
-
const bandMask = masks[i];
|
|
5083
|
-
for (let j = 0; j < numPixels; j++) {
|
|
5084
|
-
mask[j] = mask[j] & bandMask[j];
|
|
5085
|
-
}
|
|
5086
|
-
}
|
|
5087
|
-
}
|
|
5088
|
-
const { noDataValue } = options;
|
|
5089
|
-
const applyNoDataValue = noDataValue != null && pixelTypeInfo.range[0] <= noDataValue && pixelTypeInfo.range[1] >= noDataValue;
|
|
5090
|
-
if (maskCount > 0 && applyNoDataValue) {
|
|
5091
|
-
for (let i = 0; i < bandCount; i++) {
|
|
5092
|
-
const band = pixels[i];
|
|
5093
|
-
const bandMask = masks[i] || mask;
|
|
5094
|
-
for (let j = 0; j < numPixels; j++) {
|
|
5095
|
-
if (bandMask[j] === 0) {
|
|
5096
|
-
band[j] = noDataValue;
|
|
5097
|
-
}
|
|
5098
|
-
}
|
|
5099
|
-
}
|
|
5100
|
-
}
|
|
5101
|
-
const bandMasks = maskCount === bandCount && bandCount > 1 ? masks : null;
|
|
5102
|
-
const { pixelType } = pixelTypeInfo;
|
|
5103
|
-
return {
|
|
5104
|
-
width,
|
|
5105
|
-
height,
|
|
5106
|
-
pixelType,
|
|
5107
|
-
statistics,
|
|
5108
|
-
pixels,
|
|
5109
|
-
mask,
|
|
5110
|
-
dimCount,
|
|
5111
|
-
depthCount,
|
|
5112
|
-
bandMasks
|
|
5113
|
-
};
|
|
5114
|
-
}
|
|
5115
|
-
function getBlobInfo(input, options = {}) {
|
|
5116
|
-
var _a;
|
|
5117
|
-
const inputOffset = (_a = options.inputOffset) !== null && _a !== void 0 ? _a : 0;
|
|
5118
|
-
const blob = input instanceof Uint8Array ? input.subarray(inputOffset) : new Uint8Array(input, inputOffset);
|
|
5119
|
-
return lercLib.getBlobInfo(blob);
|
|
5120
|
-
}
|
|
5121
|
-
function getBandCount(input, options = {}) {
|
|
5122
|
-
const info = getBlobInfo(input, options);
|
|
5123
|
-
return info.bandCount;
|
|
5124
|
-
}
|
|
5125
|
-
exports3.decode = decode2;
|
|
5126
|
-
exports3.getBandCount = getBandCount;
|
|
5127
|
-
exports3.getBlobInfo = getBlobInfo;
|
|
5128
|
-
exports3.isLoaded = isLoaded;
|
|
5129
|
-
exports3.load = load2;
|
|
5130
|
-
Object.defineProperty(exports3, "__esModule", { value: true });
|
|
5131
|
-
});
|
|
5132
|
-
}
|
|
5133
|
-
});
|
|
5134
|
-
|
|
5135
|
-
// src/lerc-loader.ts
|
|
5136
|
-
async function parseLERC(arrayBuffer, options) {
|
|
5137
|
-
await Lerc.load();
|
|
5138
|
-
const pixelBlock = Lerc.decode(arrayBuffer, options?.lerc);
|
|
5139
|
-
return pixelBlock;
|
|
5140
|
-
}
|
|
5141
|
-
var Lerc, VERSION8, LERCLoader;
|
|
5142
|
-
var init_lerc_loader = __esm({
|
|
5143
|
-
"src/lerc-loader.ts"() {
|
|
5144
|
-
Lerc = __toModule(require_LercDecode());
|
|
5145
|
-
VERSION8 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
5146
|
-
LERCLoader = {
|
|
5147
|
-
id: "lerc",
|
|
5148
|
-
name: "LERC",
|
|
5149
|
-
module: "wms",
|
|
5150
|
-
version: VERSION8,
|
|
5151
|
-
worker: false,
|
|
5152
|
-
extensions: ["lrc", "lerc", "lerc2", "lerc1"],
|
|
5153
|
-
mimeTypes: ["application/octet-stream"],
|
|
5154
|
-
options: {
|
|
5155
|
-
wms: {}
|
|
5156
|
-
},
|
|
5157
|
-
parse: async (arrayBuffer, options) => parseLERC(arrayBuffer, options)
|
|
5158
|
-
};
|
|
5159
|
-
}
|
|
5160
|
-
});
|
|
5161
|
-
|
|
5162
4312
|
// src/index.ts
|
|
5163
4313
|
var src_exports = {};
|
|
5164
4314
|
__export(src_exports, {
|
|
5165
|
-
|
|
4315
|
+
ImageService: () => ImageService,
|
|
4316
|
+
ImageSource: () => ImageSource,
|
|
5166
4317
|
WMSCapabilitiesLoader: () => WMSCapabilitiesLoader,
|
|
5167
4318
|
WMSErrorLoader: () => WMSErrorLoader,
|
|
5168
4319
|
WMSService: () => WMSService,
|
|
5169
|
-
|
|
4320
|
+
_ArcGISImageService: () => ArcGISImageService,
|
|
5170
4321
|
_GMLLoader: () => GMLLoader,
|
|
5171
|
-
_ImageSource: () => ImageSource,
|
|
5172
4322
|
_WFSCapabilitiesLoader: () => WFSCapabilitiesLoader,
|
|
5173
4323
|
_WMSFeatureInfoLoader: () => WMSFeatureInfoLoader,
|
|
5174
4324
|
_WMSLayerDescriptionLoader: () => WMSLayerDescriptionLoader,
|
|
5175
|
-
_WMTSCapabilitiesLoader: () => WMTSCapabilitiesLoader
|
|
4325
|
+
_WMTSCapabilitiesLoader: () => WMTSCapabilitiesLoader,
|
|
4326
|
+
createImageSource: () => createImageSource
|
|
5176
4327
|
});
|
|
5177
4328
|
var init_src4 = __esm({
|
|
5178
4329
|
"src/index.ts"() {
|
|
5179
4330
|
init_wms_error_loader();
|
|
5180
4331
|
init_wms_capabilities_loader();
|
|
5181
|
-
init_wms_service();
|
|
5182
4332
|
init_image_source();
|
|
5183
|
-
|
|
4333
|
+
init_create_image_source();
|
|
4334
|
+
init_image_service();
|
|
4335
|
+
init_wms_service();
|
|
4336
|
+
init_arcgis_image_service();
|
|
5184
4337
|
init_wms_feature_info_loader();
|
|
5185
4338
|
init_wms_layer_description_loader();
|
|
5186
4339
|
init_wmts_capabilities_loader();
|
|
5187
4340
|
init_wfs_capabilities_loader();
|
|
5188
4341
|
init_gml_loader();
|
|
5189
|
-
init_lerc_loader();
|
|
5190
4342
|
}
|
|
5191
4343
|
});
|
|
5192
4344
|
|
|
@@ -5194,19 +4346,3 @@ var init_src4 = __esm({
|
|
|
5194
4346
|
var moduleExports = (init_src4(), src_exports);
|
|
5195
4347
|
globalThis.loaders = globalThis.loaders || {};
|
|
5196
4348
|
module.exports = Object.assign(globalThis.loaders, moduleExports);
|
|
5197
|
-
/*! Lerc 4.0
|
|
5198
|
-
Copyright 2015 - 2022 Esri
|
|
5199
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5200
|
-
you may not use this file except in compliance with the License.
|
|
5201
|
-
You may obtain a copy of the License at
|
|
5202
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
5203
|
-
Unless required by applicable law or agreed to in writing, software
|
|
5204
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
5205
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5206
|
-
See the License for the specific language governing permissions and
|
|
5207
|
-
limitations under the License.
|
|
5208
|
-
A local copy of the license and additional notices are located with the
|
|
5209
|
-
source distribution at:
|
|
5210
|
-
http://github.com/Esri/lerc/
|
|
5211
|
-
Contributors: Thomas Maurer, Wenxue Ju
|
|
5212
|
-
*/
|