diff --git a/CHANGES.md b/CHANGES.md index 8b54d63ec..daa6de330 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,16 @@ # Changelog + +## v 2.20.0 + +* Changes + * Convert all image WMS sources regardless of their load functions + * Allow to force a specific tileLoadFunction using the olcs\_tileLoadFunction property + * Test with OL 9.1 + +* Breaking changes + * Rename all 'olcs.xx' properties to 'olcs\_xx' and document them in PROPERTIES.md + ## v 2.19.3 * Changes diff --git a/PROPERTIES.md b/PROPERTIES.md index 3c05e3baf..5d5eeab22 100644 --- a/PROPERTIES.md +++ b/PROPERTIES.md @@ -1,13 +1,13 @@ -# OLCEsium Properties +# OLCEsium Properties -## olcs_extruded_height +## olcs_extruded_height Value: number The distance in meters between the polygon's extruded face and the ellipsoid surface. Check buildings example for usage in context. ## olcs_shadows Value: boolean -Enables shadow casting in 3D. Can be either applied to the entire feature set or by feature individually. +Enables shadow casting in 3D. Can be either applied to the entire feature set or by feature individually. In order for it to work, [shadowMap](https://cesium.com/learn/cesiumjs/ref-doc/Scene.html?classFilter=scene#shadowMap) needs to be enabled in the Cesium scene. To use the sun as light source, enable [enableLighting](https://cesium.com/learn/cesiumjs/ref-doc/Globe.html#enableLighting) on the Globe. Check buildings example for usage in context. @@ -33,5 +33,26 @@ Value: number Allows you to set a minimum zoom level for rendering 3D tiles in the Cesium view. This property helps to control the level of detail displayed in the 3D view based on the current zoom level. Check mvt example for usage in context. +## olcs_tileLoadFunction (ImageWMS sources) +Value: https://openlayers.org/en/latest/apidoc/module-ol_Tile.html#~LoadFunction +Allows to use a custom function, for example when converting a WMS image source to a tiled one. +## olcs_projection +Value: https://openlayers.org/en/latest/apidoc/module-ol_proj_Projection-Projection.html +Allows to use an alternative projection in CesiumJS. See the customProj example. +## olcs_polygon_kind +Value: "rectangle" +Allows to use the Cesium Rectangle geometry instead of a polygon geometry. See the vector example. + +## olcs_3d_geometry (OL vector source) +Value: https://openlayers.org/en/latest/apidoc/module-ol_geom_Geometry-Geometry.html +Allows to use an alternative geometry in CesiumJS. + +## olcs_proxy +Value: https://cesium.com/learn/cesiumjs/ref-doc/Proxy.html +Allows to add authentication information to requests sent by CesiumJS or manipulate request. + +## olcs_extent +Value: An array of numbers representing an extent: [minx, miny, maxx, maxy] +Allows to restrict a tiled imagery layer to a rectangle. This avoid sending useless requests. diff --git a/examples/customProj.js b/examples/customProj.js index a4f08df29..623be1042 100644 --- a/examples/customProj.js +++ b/examples/customProj.js @@ -18,7 +18,7 @@ const customProjSource = new olSourceImageWMS({ url: 'https://wms.geo.admin.ch/' }); -customProjSource.set('olcs.projection', getProjection('EPSG:3857')); +customProjSource.set('olcs_projection', getProjection('EPSG:3857')); Cesium.Ion.defaultAccessToken = OLCS_ION_TOKEN; const ol2d = new olMap({ diff --git a/examples/vectors.js b/examples/vectors.js index 879f72139..a8bd8165a 100644 --- a/examples/vectors.js +++ b/examples/vectors.js @@ -246,7 +246,7 @@ const cartographicRectangleStyle = new olStyleStyle({ }); const cartographicRectangleGeometry = new olGeomPolygon([[[-5e6, 11e6], [4e6, 11e6], [4e6, 10.5e6], [-5e6, 10.5e6], [-5e6, 11e6]]]); -cartographicRectangleGeometry.set('olcs.polygon_kind', 'rectangle'); +cartographicRectangleGeometry.set('olcs_polygon_kind', 'rectangle'); const cartographicRectangle = new olFeature({ geometry: cartographicRectangleGeometry }); @@ -263,7 +263,7 @@ const cartographicRectangleGeometry2 = new olGeomMultiPolygon([ [-5e6, 11e6, 1e6], [-5e6, 11.5e6, 1e6] ]] ]); -cartographicRectangleGeometry2.set('olcs.polygon_kind', 'rectangle'); +cartographicRectangleGeometry2.set('olcs_polygon_kind', 'rectangle'); const cartographicRectangle2 = new olFeature({ geometry: cartographicRectangleGeometry2 }); diff --git a/package-lock.json b/package-lock.json index 0992fafbd..f9f410495 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,30 +1,30 @@ { "name": "olcs", - "version": "2.19.2", + "version": "2.20.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "olcs", - "version": "2.19.2", + "version": "2.20.0", "license": "BSD-2-Clause", "devDependencies": { - "@babel/parser": "7.24.0", + "@babel/parser": "7.24.4", "@mapbox/geojsonhint": "3.3.0", "@swc-node/register": "1.9.0", - "@typescript-eslint/eslint-plugin": "7.2.0", - "@typescript-eslint/parser": "7.2.0", + "@typescript-eslint/eslint-plugin": "7.7.1", + "@typescript-eslint/parser": "7.7.1", "cesium": "1.115.0", "eslint": "8.57.0", "eslint-config-openlayers": "12.0.0", "eslint-import-resolver-typescript": "3.6.1", "eslint-plugin-import": "2.29.1", - "ol": "9.0.0", + "ol": "9.1.0", "parcel": "2.12.0", - "proj4": "2.10.0", + "proj4": "2.11.0", "recast": "0.23.6", - "typedoc": "0.25.12", - "typescript": "5.4.2" + "typedoc": "0.25.13", + "typescript": "5.4.5" }, "peerDependencies": { "cesium": ">= 1.90.0", @@ -149,9 +149,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.24.0", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.24.0.tgz", - "integrity": "sha512-QuP/FxEAzMSjXygs8v4N9dvdXzEHN4W1oF3PxuWAtPo08UdM17u89RDMgjLn/mlc56iM0HlLmVkO/wgR+rDgHg==", + "version": "7.24.4", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.24.4.tgz", + "integrity": "sha512-zTvEBcghmeBma9QIGunWevvBAp4/Qu9Bdq+2k0Ot4fVMD6v3dsC9WOcRSKk7tRRyBM/53yKMJko9xOatGQAwSg==", "dev": true, "bin": { "parser": "bin/babel-parser.js" @@ -2479,25 +2479,25 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.2.0.tgz", - "integrity": "sha512-mdekAHOqS9UjlmyF/LSs6AIEvfceV749GFxoBAjwAv0nkevfKHWQFDMcBZWUiIC5ft6ePWivXoS36aKQ0Cy3sw==", + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.7.1.tgz", + "integrity": "sha512-KwfdWXJBOviaBVhxO3p5TJiLpNuh2iyXyjmWN0f1nU87pwyvfS0EmjC6ukQVYVFJd/K1+0NWGPDXiyEyQorn0Q==", "dev": true, "dependencies": { - "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "7.2.0", - "@typescript-eslint/type-utils": "7.2.0", - "@typescript-eslint/utils": "7.2.0", - "@typescript-eslint/visitor-keys": "7.2.0", + "@eslint-community/regexpp": "^4.10.0", + "@typescript-eslint/scope-manager": "7.7.1", + "@typescript-eslint/type-utils": "7.7.1", + "@typescript-eslint/utils": "7.7.1", + "@typescript-eslint/visitor-keys": "7.7.1", "debug": "^4.3.4", "graphemer": "^1.4.0", - "ignore": "^5.2.4", + "ignore": "^5.3.1", "natural-compare": "^1.4.0", - "semver": "^7.5.4", - "ts-api-utils": "^1.0.1" + "semver": "^7.6.0", + "ts-api-utils": "^1.3.0" }, "engines": { - "node": "^16.0.0 || >=18.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { "type": "opencollective", @@ -2514,19 +2514,19 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.2.0.tgz", - "integrity": "sha512-5FKsVcHTk6TafQKQbuIVkXq58Fnbkd2wDL4LB7AURN7RUOu1utVP+G8+6u3ZhEroW3DF6hyo3ZEXxgKgp4KeCg==", + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.7.1.tgz", + "integrity": "sha512-vmPzBOOtz48F6JAGVS/kZYk4EkXao6iGrD838sp1w3NQQC0W8ry/q641KU4PrG7AKNAf56NOcR8GOpH8l9FPCw==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "7.2.0", - "@typescript-eslint/types": "7.2.0", - "@typescript-eslint/typescript-estree": "7.2.0", - "@typescript-eslint/visitor-keys": "7.2.0", + "@typescript-eslint/scope-manager": "7.7.1", + "@typescript-eslint/types": "7.7.1", + "@typescript-eslint/typescript-estree": "7.7.1", + "@typescript-eslint/visitor-keys": "7.7.1", "debug": "^4.3.4" }, "engines": { - "node": "^16.0.0 || >=18.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { "type": "opencollective", @@ -2542,16 +2542,16 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.2.0.tgz", - "integrity": "sha512-Qh976RbQM/fYtjx9hs4XkayYujB/aPwglw2choHmf3zBjB4qOywWSdt9+KLRdHubGcoSwBnXUH2sR3hkyaERRg==", + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.7.1.tgz", + "integrity": "sha512-PytBif2SF+9SpEUKynYn5g1RHFddJUcyynGpztX3l/ik7KmZEv19WCMhUBkHXPU9es/VWGD3/zg3wg90+Dh2rA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.2.0", - "@typescript-eslint/visitor-keys": "7.2.0" + "@typescript-eslint/types": "7.7.1", + "@typescript-eslint/visitor-keys": "7.7.1" }, "engines": { - "node": "^16.0.0 || >=18.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { "type": "opencollective", @@ -2559,18 +2559,18 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.2.0.tgz", - "integrity": "sha512-xHi51adBHo9O9330J8GQYQwrKBqbIPJGZZVQTHHmy200hvkLZFWJIFtAG/7IYTWUyun6DE6w5InDReePJYJlJA==", + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.7.1.tgz", + "integrity": "sha512-ZksJLW3WF7o75zaBPScdW1Gbkwhd/lyeXGf1kQCxJaOeITscoSl0MjynVvCzuV5boUz/3fOI06Lz8La55mu29Q==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "7.2.0", - "@typescript-eslint/utils": "7.2.0", + "@typescript-eslint/typescript-estree": "7.7.1", + "@typescript-eslint/utils": "7.7.1", "debug": "^4.3.4", - "ts-api-utils": "^1.0.1" + "ts-api-utils": "^1.3.0" }, "engines": { - "node": "^16.0.0 || >=18.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { "type": "opencollective", @@ -2586,12 +2586,12 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.2.0.tgz", - "integrity": "sha512-XFtUHPI/abFhm4cbCDc5Ykc8npOKBSJePY3a3s+lwumt7XWJuzP5cZcfZ610MIPHjQjNsOLlYK8ASPaNG8UiyA==", + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.7.1.tgz", + "integrity": "sha512-AmPmnGW1ZLTpWa+/2omPrPfR7BcbUU4oha5VIbSbS1a1Tv966bklvLNXxp3mrbc+P2j4MNOTfDffNsk4o0c6/w==", "dev": true, "engines": { - "node": "^16.0.0 || >=18.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { "type": "opencollective", @@ -2599,22 +2599,22 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.2.0.tgz", - "integrity": "sha512-cyxS5WQQCoBwSakpMrvMXuMDEbhOo9bNHHrNcEWis6XHx6KF518tkF1wBvKIn/tpq5ZpUYK7Bdklu8qY0MsFIA==", + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.7.1.tgz", + "integrity": "sha512-CXe0JHCXru8Fa36dteXqmH2YxngKJjkQLjxzoj6LYwzZ7qZvgsLSc+eqItCrqIop8Vl2UKoAi0StVWu97FQZIQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.2.0", - "@typescript-eslint/visitor-keys": "7.2.0", + "@typescript-eslint/types": "7.7.1", + "@typescript-eslint/visitor-keys": "7.7.1", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", - "minimatch": "9.0.3", - "semver": "^7.5.4", - "ts-api-utils": "^1.0.1" + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "ts-api-utils": "^1.3.0" }, "engines": { - "node": "^16.0.0 || >=18.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { "type": "opencollective", @@ -2627,21 +2627,21 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.2.0.tgz", - "integrity": "sha512-YfHpnMAGb1Eekpm3XRK8hcMwGLGsnT6L+7b2XyRv6ouDuJU1tZir1GS2i0+VXRatMwSI1/UfcyPe53ADkU+IuA==", + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.7.1.tgz", + "integrity": "sha512-QUvBxPEaBXf41ZBbaidKICgVL8Hin0p6prQDu6bbetWo39BKbWJxRsErOzMNT1rXvTll+J7ChrbmMCXM9rsvOQ==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", - "@types/json-schema": "^7.0.12", - "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "7.2.0", - "@typescript-eslint/types": "7.2.0", - "@typescript-eslint/typescript-estree": "7.2.0", - "semver": "^7.5.4" + "@types/json-schema": "^7.0.15", + "@types/semver": "^7.5.8", + "@typescript-eslint/scope-manager": "7.7.1", + "@typescript-eslint/types": "7.7.1", + "@typescript-eslint/typescript-estree": "7.7.1", + "semver": "^7.6.0" }, "engines": { - "node": "^16.0.0 || >=18.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { "type": "opencollective", @@ -2652,16 +2652,16 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.2.0.tgz", - "integrity": "sha512-c6EIQRHhcpl6+tO8EMR+kjkkV+ugUNXOmeASA1rlzkd8EPIriavpWoiEz1HR/VLhbVIdhqnV6E7JZm00cBDx2A==", + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.7.1.tgz", + "integrity": "sha512-gBL3Eq25uADw1LQ9kVpf3hRM+DWzs0uZknHYK3hq4jcTPqVCClHGDnB6UUUV2SFeBeA4KWHWbbLqmbGcZ4FYbw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.2.0", - "eslint-visitor-keys": "^3.4.1" + "@typescript-eslint/types": "7.7.1", + "eslint-visitor-keys": "^3.4.3" }, "engines": { - "node": "^16.0.0 || >=18.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { "type": "opencollective", @@ -5587,9 +5587,9 @@ } }, "node_modules/minimatch": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", - "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "version": "9.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.4.tgz", + "integrity": "sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==", "dev": true, "dependencies": { "brace-expansion": "^2.0.1" @@ -5859,9 +5859,9 @@ } }, "node_modules/ol": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/ol/-/ol-9.0.0.tgz", - "integrity": "sha512-+nYHZYbHrRUTDJ8ryxXPdDoAiaT6Zea02cocmGqsJXs4Oac1fYC9EbTIU2Y7803QcmG3u2MR88RxbksBvK+ZfQ==", + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/ol/-/ol-9.1.0.tgz", + "integrity": "sha512-nDrkJ2tzZNpo/wzN/PpHV5zdxbnXZaFktoMaD2cFLEc6gCwlgLY21Yd8wnt/4FjaVYwLBnbN9USXSwIBGcyksQ==", "dev": true, "dependencies": { "color-rgba": "^3.0.0", @@ -6174,9 +6174,9 @@ "dev": true }, "node_modules/proj4": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/proj4/-/proj4-2.10.0.tgz", - "integrity": "sha512-0eyB8h1PDoWxucnq88/EZqt7UZlvjhcfbXCcINpE7hqRN0iRPWE/4mXINGulNa/FAvK+Ie7F+l2OxH/0uKV36A==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/proj4/-/proj4-2.11.0.tgz", + "integrity": "sha512-SasuTkAx8HnWQHfIyhkdUNJorSJqINHAN3EyMWYiQRVorftz9DHz650YraFgczwgtHOxqnfuDxSNv3C8MUnHeg==", "dev": true, "dependencies": { "mgrs": "1.0.0", @@ -7062,9 +7062,9 @@ "dev": true }, "node_modules/typedoc": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.25.12.tgz", - "integrity": "sha512-F+qhkK2VoTweDXd1c42GS/By2DvI2uDF4/EpG424dTexSHdtCH52C6IcAvMA6jR3DzAWZjHpUOW+E02kyPNUNw==", + "version": "0.25.13", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.25.13.tgz", + "integrity": "sha512-pQqiwiJ+Z4pigfOnnysObszLiU3mVLWAExSPf+Mu06G/qsc3wzbuM56SZQvONhHLncLUhYzOVkjFFpFfL5AzhQ==", "dev": true, "dependencies": { "lunr": "^2.3.9", @@ -7083,9 +7083,9 @@ } }, "node_modules/typescript": { - "version": "5.4.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.2.tgz", - "integrity": "sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ==", + "version": "5.4.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", + "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", "dev": true, "bin": { "tsc": "bin/tsc", diff --git a/package.json b/package.json index 4ebbc62f2..9505d4397 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "olcs", - "version": "2.19.2", + "version": "2.20.0", "description": "OpenLayers Cesium integration and plugin library", "scripts": { "test": "node --enable-source-maps --import @swc-node/register/esm-register --test src/olcs/*.test.ts", @@ -76,21 +76,21 @@ "ol": "7 || 8 || 9" }, "devDependencies": { - "@babel/parser": "7.24.0", + "@babel/parser": "7.24.4", "@mapbox/geojsonhint": "3.3.0", "@swc-node/register": "1.9.0", - "@typescript-eslint/eslint-plugin": "7.2.0", - "@typescript-eslint/parser": "7.2.0", + "@typescript-eslint/eslint-plugin": "7.7.1", + "@typescript-eslint/parser": "7.7.1", "cesium": "1.115.0", "eslint": "8.57.0", "eslint-config-openlayers": "12.0.0", "eslint-import-resolver-typescript": "3.6.1", "eslint-plugin-import": "2.29.1", - "ol": "9.0.0", + "ol": "9.1.0", "parcel": "2.12.0", - "proj4": "2.10.0", + "proj4": "2.11.0", "recast": "0.23.6", - "typedoc": "0.25.12", - "typescript": "5.4.2" + "typedoc": "0.25.13", + "typescript": "5.4.5" } } diff --git a/src/olcs/FeatureConverter.ts b/src/olcs/FeatureConverter.ts index 4635703d5..16dbca25c 100644 --- a/src/olcs/FeatureConverter.ts +++ b/src/olcs/FeatureConverter.ts @@ -472,7 +472,7 @@ export default class FeatureConverter { let fillGeometry, outlineGeometry; let outlinePrimitive: GroundPolylinePrimitive; if ((olGeometry.getCoordinates()[0].length == 5) && - (feature.get('olcs.polygon_kind') === 'rectangle')) { + (feature.get('olcs_polygon_kind') === 'rectangle')) { // Create a rectangle according to the longitude and latitude curves const coordinates = olGeometry.getCoordinates()[0]; // Extract the West, South, East, North coordinates @@ -1033,7 +1033,7 @@ export default class FeatureConverter { return opt_geom; } - const geom3d: OLGeometry = feature.get('olcs.3d_geometry'); + const geom3d: OLGeometry = feature.get('olcs_3d_geometry'); if (geom3d && geom3d instanceof OLGeometry) { return geom3d; } diff --git a/src/olcs/core.ts b/src/olcs/core.ts index 09ab4972e..bdf904699 100644 --- a/src/olcs/core.ts +++ b/src/olcs/core.ts @@ -7,7 +7,7 @@ import olSourceImageWMS from 'ol/source/ImageWMS.js'; import olSourceTileImage from 'ol/source/TileImage.js'; import olSourceTileWMS from 'ol/source/TileWMS.js'; import olSourceVectorTile from 'ol/source/VectorTile.js'; -import {defaultImageLoadFunction} from 'ol/source/Image.js'; +import type ImageTile from 'ol/ImageTile.js'; import olcsCoreOLImageryProvider from './core/OLImageryProvider'; import {getSourceProjection} from './util'; import MVTImageryProvider from './MVTImageryProvider'; @@ -357,18 +357,25 @@ export function sourceToImageryProvider( } let provider = null; // Convert ImageWMS to TileWMS - if (source instanceof olSourceImageWMS && source.getUrl() && - source.getImageLoadFunction() === defaultImageLoadFunction) { + if (source instanceof olSourceImageWMS && source.getUrl()) { const sourceProps = { - 'olcs.proxy': source.get('olcs.proxy'), - 'olcs.extent': source.get('olcs.extent'), - 'olcs.projection': source.get('olcs.projection'), + 'olcs_proxy': source.get('olcs_proxy'), + 'olcs_extent': source.get('olcs_extent'), + 'olcs_projection': source.get('olcs_projection'), 'olcs.imagesource': source }; + const imageLoadFunction = source.getImageLoadFunction(); + const tileLoadFunction = source.get('olcs_tileLoadFunction') || function tileLoadFunction(tile: ImageTile, src: string) { + // An imageLoadFunction takes an ImageWrapperm which has a getImage method. + // A tile also has a getImage method. + // We incorrectly passe a tile as an ImageWrapper and hopes for the best. + imageLoadFunction(tile as any, src); + }; source = new olSourceTileWMS({ url: source.getUrl(), attributions: source.getAttributions(), projection: source.getProjection(), + tileLoadFunction, params: source.getParams() }); source.setProperties(sourceProps); @@ -475,7 +482,7 @@ export function tileLayerToImageryLayer(olMap: Map, olLayer: BaseLayer, viewProj const layerOptions: {rectangle?: Rectangle} = {}; - const forcedExtent = (olLayer.get('olcs.extent')); + const forcedExtent = (olLayer.get('olcs_extent')); const ext = forcedExtent || olLayer.getExtent(); if (ext) { layerOptions.rectangle = extentToRectangle(ext, viewProj); diff --git a/src/olcs/core/OLImageryProvider.ts b/src/olcs/core/OLImageryProvider.ts index 8e95630cc..34e7f51df 100644 --- a/src/olcs/core/OLImageryProvider.ts +++ b/src/olcs/core/OLImageryProvider.ts @@ -196,7 +196,7 @@ export default class OLImageryProvider implements ImageryProvider /* should not this.shouldRequestNextLevel = false; - const proxy = this.source_.get('olcs.proxy'); + const proxy = this.source_.get('olcs_proxy'); if (proxy) { if (typeof proxy === 'function') { // Duck typing a proxy diff --git a/src/olcs/util.ts b/src/olcs/util.ts index 69e3fc01b..ad39772be 100644 --- a/src/olcs/util.ts +++ b/src/olcs/util.ts @@ -41,7 +41,7 @@ export function imageRenderingValue() { * @return The projection of the source. */ export function getSourceProjection(source: Source): Projection { - return source.get('olcs.projection') as Projection || source.getProjection(); + return source.get('olcs_projection') as Projection || source.getProjection(); }