@map-colonies/react-components 3.13.0 → 3.14.0

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.
Files changed (29) hide show
  1. package/CHANGELOG.md +43 -8
  2. package/dist/assets/img/transparent-tile.png +0 -0
  3. package/dist/cesium-map/helpers/customImageryProviders.d.ts +34 -0
  4. package/dist/cesium-map/helpers/customImageryProviders.js +106 -0
  5. package/dist/cesium-map/helpers/utils.d.ts +17 -0
  6. package/dist/cesium-map/helpers/utils.js +142 -0
  7. package/dist/cesium-map/layers/wms.layer.js +7 -1
  8. package/dist/cesium-map/layers/wmts.layer.js +7 -1
  9. package/dist/cesium-map/layers/xyz.layer.js +7 -1
  10. package/dist/cesium-map/layers-manager.d.ts +4 -0
  11. package/dist/cesium-map/layers-manager.js +169 -12
  12. package/dist/cesium-map/map.d.ts +4 -0
  13. package/dist/cesium-map/map.js +23 -2
  14. package/dist/cesium-map/tools/coordinates-tracker.tool.js +1 -5
  15. package/dist/cesium-map/tools/geojson/point.geojson.js +2 -6
  16. package/package.json +2 -2
  17. package/public/assets/img/transparent-tile.png +0 -0
  18. package/src/lib/cesium-map/helpers/customImageryProviders.ts +173 -0
  19. package/src/lib/cesium-map/helpers/utils.ts +135 -0
  20. package/src/lib/cesium-map/layers/optimized-tile-requests.stories.tsx +279 -0
  21. package/src/lib/cesium-map/layers/wms.layer.tsx +10 -4
  22. package/src/lib/cesium-map/layers/wmts.layer.tsx +9 -4
  23. package/src/lib/cesium-map/layers/xyz.layer.tsx +9 -4
  24. package/src/lib/cesium-map/layers-manager.ts +223 -19
  25. package/src/lib/cesium-map/map.tsx +21 -0
  26. package/src/lib/cesium-map/tools/coordinates-tracker.tool.tsx +6 -2
  27. package/src/lib/cesium-map/tools/geojson/point.geojson.ts +1 -1
  28. package/src/lib/date-range-picker/date-range-picker.spec.tsx +81 -81
  29. package/jest_html_reporters.html +0 -78
package/CHANGELOG.md CHANGED
@@ -3,26 +3,61 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- # [3.13.0](https://github.com/MapColonies/shared-components/compare/@map-colonies/react-components@3.12.3...@map-colonies/react-components@3.13.0) (2023-01-11)
7
-
8
-
9
- ### Features
10
-
11
- * add coords value in map context ([#135](https://github.com/MapColonies/shared-components/issues/135)) ([c056f44](https://github.com/MapColonies/shared-components/commit/c056f44ac230a0c956bd7a5d75b6dde0374b2405))
6
+ # [3.14.0](https://github.com/MapColonies/shared-components/compare/@map-colonies/react-components@3.13.1...@map-colonies/react-components@3.14.0) (2023-04-13)
12
7
 
13
8
 
9
+ ### Bug Fixes
14
10
 
11
+ * optimized tile requesting story and fixes ([e1cd86c](https://github.com/MapColonies/shared-components/commit/e1cd86c6fde563281d10774dd88291d6aad869c1))
12
+ * prettier ([51f1e50](https://github.com/MapColonies/shared-components/commit/51f1e503b9080d136e3b05776cd2a2d384091cac))
15
13
 
16
14
 
17
- ## [3.12.3](https://github.com/MapColonies/shared-components/compare/@map-colonies/react-components@3.12.2...@map-colonies/react-components@3.12.3) (2022-08-25)
15
+ ### Features
18
16
 
19
- **Note:** Version bump only for package @map-colonies/react-components
17
+ * attempting implementation for relevancy of layer to extent (not working) ([eae6e88](https://github.com/MapColonies/shared-components/commit/eae6e88085bc3b4a68bd898dab2b1226e233aad1))
18
+ * implementing tile requesting optimization ([c6daec6](https://github.com/MapColonies/shared-components/commit/c6daec6f3844f10e3520da2ee976b832a4eb531f))
19
+ * relevancy of layer to extent kind of works ([641930d](https://github.com/MapColonies/shared-components/commit/641930dd07ecb215370237bd7d4b7f6587885120))
20
+ * relevancy of layer to extent mostly working, needs fixes ([367e738](https://github.com/MapColonies/shared-components/commit/367e738c3bdb1dc57db17e3eb14cdf83114863cd))
21
+ * relevancy of layer to extent with hide logic ([4ed8a5f](https://github.com/MapColonies/shared-components/commit/4ed8a5f301081b59f49f39e30986f805d674b68b))
22
+ * start implementing optimized tile requesting story ([b5ffd06](https://github.com/MapColonies/shared-components/commit/b5ffd0685c1d201e28d2e34536094883737605d1))
23
+ * tile requesting optimizations works with config toggling ([2dddf48](https://github.com/MapColonies/shared-components/commit/2dddf481165e660a6b4d6934b1daa22eb25292d6))
20
24
 
21
25
 
22
26
 
23
27
 
24
28
 
25
29
 
30
+ ## [3.13.1](https://github.com/MapColonies/shared-components/compare/@map-colonies/react-components@3.13.0...@map-colonies/react-components@3.13.1) (2023-01-12)
31
+
32
+
33
+ ### Bug Fixes
34
+
35
+ * imports from cesium ([#136](https://github.com/MapColonies/shared-components/issues/136)) ([0b12f11](https://github.com/MapColonies/shared-components/commit/0b12f119275285682e13b2a83b75f34151b9553f))
36
+
37
+
38
+
39
+
40
+
41
+ # [3.13.0](https://github.com/MapColonies/shared-components/compare/@map-colonies/react-components@3.12.3...@map-colonies/react-components@3.13.0) (2023-01-11)
42
+
43
+
44
+ ### Features
45
+
46
+ * add coords value in map context ([#135](https://github.com/MapColonies/shared-components/issues/135)) ([c056f44](https://github.com/MapColonies/shared-components/commit/c056f44ac230a0c956bd7a5d75b6dde0374b2405))
47
+
48
+
49
+
50
+
51
+
52
+ ## [3.12.3](https://github.com/MapColonies/shared-components/compare/@map-colonies/react-components@3.12.2...@map-colonies/react-components@3.12.3) (2022-08-25)
53
+
54
+ **Note:** Version bump only for package @map-colonies/react-components
55
+
56
+
57
+
58
+
59
+
60
+
26
61
  ## [3.12.2](https://github.com/MapColonies/shared-components/compare/@map-colonies/react-components@3.12.1...@map-colonies/react-components@3.12.2) (2022-08-14)
27
62
 
28
63
  **Note:** Version bump only for package @map-colonies/react-components
@@ -0,0 +1,34 @@
1
+ import { Request, ImageryProvider, UrlTemplateImageryProvider, WebMapServiceImageryProvider, WebMapTileServiceImageryProvider } from 'cesium';
2
+ import { ICesiumImageryLayer } from '../layers-manager';
3
+ import { CesiumViewer } from '../map';
4
+ export interface CustomImageryProvider extends ImageryProvider {
5
+ readonly layerListInstance: ICesiumImageryLayer[];
6
+ tileTransparencyCheckedCounter: number;
7
+ mapViewer: CesiumViewer;
8
+ readonly maxTilesForTransparencyCheck: number;
9
+ }
10
+ export declare const HAS_TRANSPARENCY_META_PROP = "hasTransparency";
11
+ export declare class CustomUrlTemplateImageryProvider extends UrlTemplateImageryProvider {
12
+ readonly layerListInstance: ICesiumImageryLayer[];
13
+ readonly mapViewer: CesiumViewer;
14
+ readonly maxTilesForTransparencyCheck = 3;
15
+ tileTransparencyCheckedCounter: number;
16
+ constructor(opts: UrlTemplateImageryProvider.ConstructorOptions, mapViewer: CesiumViewer);
17
+ requestImage(x: number, y: number, level: number, request?: Request | undefined): Promise<HTMLImageElement | HTMLCanvasElement> | undefined;
18
+ }
19
+ export declare class CustomWebMapServiceImageryProvider extends WebMapServiceImageryProvider {
20
+ readonly layerListInstance: ICesiumImageryLayer[];
21
+ readonly mapViewer: CesiumViewer;
22
+ readonly maxTilesForTransparencyCheck = 3;
23
+ tileTransparencyCheckedCounter: number;
24
+ constructor(opts: WebMapServiceImageryProvider.ConstructorOptions, mapViewer: CesiumViewer);
25
+ requestImage(x: number, y: number, level: number, request?: Request | undefined): Promise<HTMLImageElement | HTMLCanvasElement> | undefined;
26
+ }
27
+ export declare class CustomWebMapTileServiceImageryProvider extends WebMapTileServiceImageryProvider {
28
+ readonly layerListInstance: ICesiumImageryLayer[];
29
+ readonly mapViewer: CesiumViewer;
30
+ readonly maxTilesForTransparencyCheck = 3;
31
+ tileTransparencyCheckedCounter: number;
32
+ constructor(opts: WebMapTileServiceImageryProvider.ConstructorOptions, mapViewer: CesiumViewer);
33
+ requestImage(x: number, y: number, level: number, request?: Request | undefined): Promise<HTMLImageElement | HTMLCanvasElement> | undefined;
34
+ }
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.CustomWebMapTileServiceImageryProvider = exports.CustomWebMapServiceImageryProvider = exports.CustomUrlTemplateImageryProvider = exports.HAS_TRANSPARENCY_META_PROP = void 0;
19
+ var cesium_1 = require("cesium");
20
+ var lodash_1 = require("lodash");
21
+ var utils_1 = require("./utils");
22
+ var NUMBER_OF_TILES_TO_CHECK = 3;
23
+ exports.HAS_TRANSPARENCY_META_PROP = 'hasTransparency';
24
+ function customCommonRequestImage(requestImageFn, x, y, level, request) {
25
+ var _this = this;
26
+ // custom Logic
27
+ setTimeout(function () {
28
+ var _a;
29
+ var requestedLayerMeta = (_a = _this.layerListInstance.find(
30
+ /* eslint-disable */
31
+ function (layer) {
32
+ return (layer._imageryProvider._resource._url ===
33
+ _this._resource._url);
34
+ }
35
+ /* eslint-enable */
36
+ )) === null || _a === void 0 ? void 0 : _a.meta;
37
+ var layerHasTransparency = lodash_1.get(requestedLayerMeta, exports.HAS_TRANSPARENCY_META_PROP) === true;
38
+ if (_this.tileTransparencyCheckedCounter < NUMBER_OF_TILES_TO_CHECK &&
39
+ !layerHasTransparency) {
40
+ void utils_1.imageHasTransparency(request === null || request === void 0 ? void 0 : request.url, _this).then(function (hasTransparency) {
41
+ var _a;
42
+ var _b;
43
+ (_b = _this.mapViewer.layersManager) === null || _b === void 0 ? void 0 : _b.addMetaToLayer((_a = {}, _a[exports.HAS_TRANSPARENCY_META_PROP] = hasTransparency, _a),
44
+ /* eslint-disable */
45
+ function (layer) {
46
+ return (layer._imageryProvider._resource._url ===
47
+ _this._resource._url);
48
+ }
49
+ /* eslint-enable */
50
+ );
51
+ });
52
+ }
53
+ }, 0);
54
+ return requestImageFn(x, y, level, request);
55
+ }
56
+ var CustomUrlTemplateImageryProvider = /** @class */ (function (_super) {
57
+ __extends(CustomUrlTemplateImageryProvider, _super);
58
+ function CustomUrlTemplateImageryProvider(opts, mapViewer) {
59
+ var _a;
60
+ var _this = _super.call(this, opts) || this;
61
+ _this.maxTilesForTransparencyCheck = NUMBER_OF_TILES_TO_CHECK;
62
+ _this.tileTransparencyCheckedCounter = 0;
63
+ _this.layerListInstance = (_a = mapViewer.layersManager) === null || _a === void 0 ? void 0 : _a.layerList;
64
+ _this.mapViewer = mapViewer;
65
+ return _this;
66
+ }
67
+ CustomUrlTemplateImageryProvider.prototype.requestImage = function (x, y, level, request) {
68
+ return customCommonRequestImage.call(this, _super.prototype.requestImage.bind(this), x, y, level, request);
69
+ };
70
+ return CustomUrlTemplateImageryProvider;
71
+ }(cesium_1.UrlTemplateImageryProvider));
72
+ exports.CustomUrlTemplateImageryProvider = CustomUrlTemplateImageryProvider;
73
+ var CustomWebMapServiceImageryProvider = /** @class */ (function (_super) {
74
+ __extends(CustomWebMapServiceImageryProvider, _super);
75
+ function CustomWebMapServiceImageryProvider(opts, mapViewer) {
76
+ var _a;
77
+ var _this = _super.call(this, opts) || this;
78
+ _this.maxTilesForTransparencyCheck = NUMBER_OF_TILES_TO_CHECK;
79
+ _this.tileTransparencyCheckedCounter = 0;
80
+ _this.layerListInstance = (_a = mapViewer.layersManager) === null || _a === void 0 ? void 0 : _a.layerList;
81
+ _this.mapViewer = mapViewer;
82
+ return _this;
83
+ }
84
+ CustomWebMapServiceImageryProvider.prototype.requestImage = function (x, y, level, request) {
85
+ return customCommonRequestImage.call(this, _super.prototype.requestImage.bind(this), x, y, level, request);
86
+ };
87
+ return CustomWebMapServiceImageryProvider;
88
+ }(cesium_1.WebMapServiceImageryProvider));
89
+ exports.CustomWebMapServiceImageryProvider = CustomWebMapServiceImageryProvider;
90
+ var CustomWebMapTileServiceImageryProvider = /** @class */ (function (_super) {
91
+ __extends(CustomWebMapTileServiceImageryProvider, _super);
92
+ function CustomWebMapTileServiceImageryProvider(opts, mapViewer) {
93
+ var _a;
94
+ var _this = _super.call(this, opts) || this;
95
+ _this.maxTilesForTransparencyCheck = NUMBER_OF_TILES_TO_CHECK;
96
+ _this.tileTransparencyCheckedCounter = 0;
97
+ _this.layerListInstance = (_a = mapViewer.layersManager) === null || _a === void 0 ? void 0 : _a.layerList;
98
+ _this.mapViewer = mapViewer;
99
+ return _this;
100
+ }
101
+ CustomWebMapTileServiceImageryProvider.prototype.requestImage = function (x, y, level, request) {
102
+ return customCommonRequestImage.call(this, _super.prototype.requestImage.bind(this), x, y, level, request);
103
+ };
104
+ return CustomWebMapTileServiceImageryProvider;
105
+ }(cesium_1.WebMapTileServiceImageryProvider));
106
+ exports.CustomWebMapTileServiceImageryProvider = CustomWebMapTileServiceImageryProvider;
@@ -0,0 +1,17 @@
1
+ import { Rectangle } from 'cesium';
2
+ import { CustomImageryProvider } from './customImageryProviders';
3
+ /**
4
+ * An async function to detect images with transparency.
5
+ * @param image The image to resolve. if value is `string (url)` it tries to fetch the image data first.
6
+ * Could also be `HTMLImageElement` or `ImageBitmap`
7
+ * @param context `optional` `CustomImageryProvider` context in which the function will automatically increase
8
+ * the `tileTransparencyCheckedCounter`. Sets to `maxTilesForTransparencyCheck` when layer detected as transparent.
9
+ * @returns
10
+ */
11
+ export declare const imageHasTransparency: (image: string | HTMLImageElement | ImageBitmap, context?: CustomImageryProvider | undefined) => Promise<boolean>;
12
+ /**
13
+ * Checks if `rect` is contained inside `anotherRect`
14
+ * @param rect
15
+ * @param anotherRect
16
+ */
17
+ export declare const cesiumRectangleContained: (rect: Rectangle, anotherRect: Rectangle) => boolean;
@@ -0,0 +1,142 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.cesiumRectangleContained = exports.imageHasTransparency = void 0;
40
+ var canvasElem = document.createElement('canvas');
41
+ var canvasCtx = canvasElem.getContext('2d');
42
+ /**
43
+ * @param image Image data to check
44
+ * @returns `true` if image data has at least one transparent pixel, `false` otherwise.
45
+ */
46
+ var imageDataHasTransparency = function (image) {
47
+ var _a;
48
+ var ALPHA_CHANNEL_OFFSET = 4; // [R,G,B,A, R,G,B,A] => FLAT ARRAY OF THIS SHAPE; (Uint8ClampedArray)
49
+ var OPAQUE_PIXEL_ALPHA_VALUE = 255;
50
+ var imgData = (_a = image === null || image === void 0 ? void 0 : image.data) !== null && _a !== void 0 ? _a : [];
51
+ // Iterate through alpha channels only.
52
+ for (var i = 3; i < (imgData === null || imgData === void 0 ? void 0 : imgData.length); i += ALPHA_CHANNEL_OFFSET) {
53
+ if (imgData[i] < OPAQUE_PIXEL_ALPHA_VALUE) {
54
+ // Transparent pixel found.
55
+ return true;
56
+ }
57
+ }
58
+ return false;
59
+ };
60
+ /**
61
+ * An async function to detect images with transparency.
62
+ * @param image The image to resolve. if value is `string (url)` it tries to fetch the image data first.
63
+ * Could also be `HTMLImageElement` or `ImageBitmap`
64
+ * @param context `optional` `CustomImageryProvider` context in which the function will automatically increase
65
+ * the `tileTransparencyCheckedCounter`. Sets to `maxTilesForTransparencyCheck` when layer detected as transparent.
66
+ * @returns
67
+ */
68
+ var imageHasTransparency = function (image, context) { return __awaiter(void 0, void 0, void 0, function () {
69
+ return __generator(this, function (_a) {
70
+ if (context) {
71
+ context.tileTransparencyCheckedCounter++;
72
+ }
73
+ return [2 /*return*/, new Promise(function (resolve, reject) {
74
+ try {
75
+ canvasCtx === null || canvasCtx === void 0 ? void 0 : canvasCtx.clearRect(0, 0, canvasElem.width, canvasElem.height);
76
+ var imageElement_1;
77
+ // Init Image instance.
78
+ if (image instanceof HTMLImageElement) {
79
+ imageElement_1 = image;
80
+ }
81
+ else if (image instanceof ImageBitmap) {
82
+ canvasElem.width = image.width;
83
+ canvasElem.height = image.height;
84
+ canvasCtx === null || canvasCtx === void 0 ? void 0 : canvasCtx.drawImage(image, 0, 0);
85
+ var canvasImg = canvasCtx === null || canvasCtx === void 0 ? void 0 : canvasCtx.getImageData(0, 0, canvasElem.width, canvasElem.height);
86
+ var hasTransparency = imageDataHasTransparency(canvasImg);
87
+ if (hasTransparency) {
88
+ if (context) {
89
+ context.tileTransparencyCheckedCounter =
90
+ context.maxTilesForTransparencyCheck;
91
+ }
92
+ }
93
+ resolve(hasTransparency);
94
+ return;
95
+ }
96
+ else {
97
+ imageElement_1 = new Image();
98
+ imageElement_1.crossOrigin = 'anonymous'; // Disable CORS errors on canvas image load.
99
+ imageElement_1.src = image;
100
+ }
101
+ imageElement_1.onload = function () {
102
+ // Image loaded, set canvas size to image size.
103
+ canvasElem.width = imageElement_1.width;
104
+ canvasElem.height = imageElement_1.height;
105
+ canvasCtx === null || canvasCtx === void 0 ? void 0 : canvasCtx.drawImage(imageElement_1, 0, 0);
106
+ var canvasImg = canvasCtx === null || canvasCtx === void 0 ? void 0 : canvasCtx.getImageData(0, 0, canvasElem.width, canvasElem.height);
107
+ var hasTransparency = imageDataHasTransparency(canvasImg);
108
+ if (hasTransparency) {
109
+ if (context) {
110
+ context.tileTransparencyCheckedCounter =
111
+ context.maxTilesForTransparencyCheck;
112
+ }
113
+ resolve(true);
114
+ }
115
+ else {
116
+ resolve(false);
117
+ }
118
+ };
119
+ }
120
+ catch (e) {
121
+ console.error('Could not determine image transparency. Error => ', e);
122
+ reject(e);
123
+ }
124
+ })];
125
+ });
126
+ }); };
127
+ exports.imageHasTransparency = imageHasTransparency;
128
+ /**
129
+ * Checks if `rect` is contained inside `anotherRect`
130
+ * @param rect
131
+ * @param anotherRect
132
+ */
133
+ var cesiumRectangleContained = function (rect, anotherRect) {
134
+ var west = rect.west, east = rect.east, north = rect.north, south = rect.south;
135
+ var anotherWest = anotherRect.west, anotherEast = anotherRect.east, anotherNorth = anotherRect.north, anotherSouth = anotherRect.south;
136
+ var isRectInsideAnother = west >= anotherWest &&
137
+ east <= anotherEast &&
138
+ north <= anotherNorth &&
139
+ south >= anotherSouth;
140
+ return isRectInsideAnother;
141
+ };
142
+ exports.cesiumRectangleContained = cesiumRectangleContained;
@@ -28,9 +28,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
28
28
  exports.CesiumWMSLayer = void 0;
29
29
  var react_1 = __importDefault(require("react"));
30
30
  var cesium_1 = require("cesium");
31
+ var customImageryProviders_1 = require("../helpers/customImageryProviders");
32
+ var map_1 = require("../map");
31
33
  var imagery_layer_1 = require("./imagery.layer");
32
34
  var CesiumWMSLayer = function (props) {
33
35
  var options = props.options, restProps = __rest(props, ["options"]);
34
- return (react_1.default.createElement(imagery_layer_1.CesiumImageryLayer, __assign({}, restProps, { imageryProvider: new cesium_1.WebMapServiceImageryProvider(options) })));
36
+ var mapViewer = map_1.useCesiumMap();
37
+ var providerInstance = mapViewer.shouldOptimizedTileRequests
38
+ ? new customImageryProviders_1.CustomWebMapServiceImageryProvider(options, mapViewer)
39
+ : new cesium_1.WebMapServiceImageryProvider(options);
40
+ return (react_1.default.createElement(imagery_layer_1.CesiumImageryLayer, __assign({}, restProps, { imageryProvider: providerInstance })));
35
41
  };
36
42
  exports.CesiumWMSLayer = CesiumWMSLayer;
@@ -28,9 +28,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
28
28
  exports.CesiumWMTSLayer = void 0;
29
29
  var react_1 = __importDefault(require("react"));
30
30
  var cesium_1 = require("cesium");
31
+ var customImageryProviders_1 = require("../helpers/customImageryProviders");
32
+ var map_1 = require("../map");
31
33
  var imagery_layer_1 = require("./imagery.layer");
32
34
  var CesiumWMTSLayer = function (props) {
33
35
  var options = props.options, restProps = __rest(props, ["options"]);
34
- return (react_1.default.createElement(imagery_layer_1.CesiumImageryLayer, __assign({}, restProps, { imageryProvider: new cesium_1.WebMapTileServiceImageryProvider(options) })));
36
+ var mapViewer = map_1.useCesiumMap();
37
+ var providerInstance = mapViewer.shouldOptimizedTileRequests
38
+ ? new customImageryProviders_1.CustomWebMapTileServiceImageryProvider(options, mapViewer)
39
+ : new cesium_1.WebMapTileServiceImageryProvider(options);
40
+ return (react_1.default.createElement(imagery_layer_1.CesiumImageryLayer, __assign({}, restProps, { imageryProvider: providerInstance })));
35
41
  };
36
42
  exports.CesiumWMTSLayer = CesiumWMTSLayer;
@@ -28,9 +28,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
28
28
  exports.CesiumXYZLayer = void 0;
29
29
  var react_1 = __importDefault(require("react"));
30
30
  var cesium_1 = require("cesium");
31
+ var customImageryProviders_1 = require("../helpers/customImageryProviders");
32
+ var map_1 = require("../map");
31
33
  var imagery_layer_1 = require("./imagery.layer");
32
34
  var CesiumXYZLayer = function (props) {
33
35
  var options = props.options, restProps = __rest(props, ["options"]);
34
- return (react_1.default.createElement(imagery_layer_1.CesiumImageryLayer, __assign({}, restProps, { imageryProvider: new cesium_1.UrlTemplateImageryProvider(options) })));
36
+ var mapViewer = map_1.useCesiumMap();
37
+ var providerInstance = mapViewer.shouldOptimizedTileRequests
38
+ ? new customImageryProviders_1.CustomUrlTemplateImageryProvider(options, mapViewer)
39
+ : new cesium_1.UrlTemplateImageryProvider(options);
40
+ return (react_1.default.createElement(imagery_layer_1.CesiumImageryLayer, __assign({}, restProps, { imageryProvider: providerInstance })));
35
41
  };
36
42
  exports.CesiumXYZLayer = CesiumXYZLayer;
@@ -47,9 +47,13 @@ declare class LayerManager {
47
47
  showAllNotBase(isShow: boolean): void;
48
48
  get(layerId: string): ICesiumImageryLayer | undefined;
49
49
  findLayerByPOI(x: number, y: number): ICesiumImageryLayer[] | undefined;
50
+ addTransparentImageryProvider(): void;
50
51
  private setLegends;
51
52
  private getBaseLayersCount;
52
53
  private findLayerById;
53
54
  private updateLayersOrder;
55
+ private hideNonRelevantLayers;
56
+ private markRelevantLayersForExtent;
57
+ get layerList(): ICesiumImageryLayer[];
54
58
  }
55
59
  export default LayerManager;