@map-colonies/react-components 3.10.5 → 3.11.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,40 @@
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.11.0](https://github.com/MapColonies/shared-components/compare/@map-colonies/react-components@3.10.5...@map-colonies/react-components@3.11.0) (2022-05-02)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * 3d story ([ee59db0](https://github.com/MapColonies/shared-components/commit/ee59db00f627b709368f830a3c7cf30dc2cf0525))
12
+ * 3d with update ([86fd98b](https://github.com/MapColonies/shared-components/commit/86fd98b59d137f3bfddc351a98cefcef7b6fc19a))
13
+ * 3d with update ([c554c57](https://github.com/MapColonies/shared-components/commit/c554c57ba85c68e3a5e53c128714d86733db10d0))
14
+ * bounding volume minimum height ([87e0e81](https://github.com/MapColonies/shared-components/commit/87e0e8114f088a4997723f91760f80250e67f629))
15
+ * build errors ([57bc0fa](https://github.com/MapColonies/shared-components/commit/57bc0fac22aebf865112d3c26d1bf46ee57d4dad))
16
+ * fix ([6999626](https://github.com/MapColonies/shared-components/commit/69996260b96379813b051104204568b190d46eaa))
17
+ * fix ([d958564](https://github.com/MapColonies/shared-components/commit/d958564cf178e7258fcdf2c21a1915b0e442c52c))
18
+ * fix ([db76412](https://github.com/MapColonies/shared-components/commit/db7641201cde062e360131a73081867b4db854ba))
19
+ * fix ([16c4499](https://github.com/MapColonies/shared-components/commit/16c4499a33c1c5d0bd34cd33958d5381e05ac3b6))
20
+ * linting ([ca5f578](https://github.com/MapColonies/shared-components/commit/ca5f578f0e2f3422213e4f7e4cfa1abdd05576b8))
21
+ * prettier ([f516da2](https://github.com/MapColonies/shared-components/commit/f516da2ce8f1b59d18ace5cafe6e12642046e19a))
22
+ * prettier ([226ca71](https://github.com/MapColonies/shared-components/commit/226ca71c110abf50c89a36125c33f3e66cf195dc))
23
+ * prettier ([6b1c751](https://github.com/MapColonies/shared-components/commit/6b1c7511355e35b199a5b127668df93e9c393c3b))
24
+ * prettier ([c4e6c13](https://github.com/MapColonies/shared-components/commit/c4e6c13ebc77774b8764f582f710777e316b586b))
25
+ * prettier ([a6613d7](https://github.com/MapColonies/shared-components/commit/a6613d7292aa8eb0b00f83d0885e61dfa4860ca0))
26
+ * revert ([44c6a9b](https://github.com/MapColonies/shared-components/commit/44c6a9b6a34f2f8a6281f26c90ddfe3583832100))
27
+ * story ([c348df4](https://github.com/MapColonies/shared-components/commit/c348df4cdf771483e5e5ade78bac3e734dd4965d))
28
+ * unused ([bf696fe](https://github.com/MapColonies/shared-components/commit/bf696fe20b7e20223ef9f05962d9eecbb2760d06))
29
+ * zoom to ([e78def4](https://github.com/MapColonies/shared-components/commit/e78def47940ab569691677ee71f6ac41a4c3f1bd))
30
+
31
+
32
+ ### Features
33
+
34
+ * update tileset ([17ed73c](https://github.com/MapColonies/shared-components/commit/17ed73c43ba41ad54e70e6c17d152eeb38887009))
35
+
36
+
37
+
38
+
39
+
6
40
  ## [3.10.5](https://github.com/MapColonies/shared-components/compare/@map-colonies/react-components@3.10.4...@map-colonies/react-components@3.10.5) (2022-03-29)
7
41
 
8
42
 
@@ -15,22 +15,26 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.Cesium3DTileset = void 0;
18
- var cesium_1 = require("cesium");
19
18
  var react_1 = __importDefault(require("react"));
19
+ var cesium_1 = require("cesium");
20
20
  var resium_1 = require("resium");
21
21
  var map_1 = require("../map");
22
+ var GROUND_LEVEL = 0.0;
22
23
  var Cesium3DTileset = function (props) {
23
24
  var mapViewer = map_1.useCesiumMap();
24
25
  return (react_1.default.createElement(resium_1.Cesium3DTileset, __assign({}, props, { onReady: function (tileset) {
25
- var _a;
26
+ var _a, _b;
26
27
  (_a = props.onReady) === null || _a === void 0 ? void 0 : _a.call(props, tileset);
27
- if (props.isZoomTo) {
28
+ if (props.isZoomTo === true) {
28
29
  void mapViewer.zoomTo(tileset);
29
30
  }
30
- if (props.heightFromGround) {
31
- var cartographic = cesium_1.Cartographic.fromCartesian(tileset.boundingSphere.center);
32
- var surface = cesium_1.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, 0.0);
33
- var offset = cesium_1.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, props.heightFromGround);
31
+ var scene = mapViewer.scene;
32
+ scene.globe.depthTestAgainstTerrain = true;
33
+ var cartographic = cesium_1.Cartographic.fromCartesian(tileset.boundingSphere.center);
34
+ var heightFromGround = (_b = props.heightFromGround) !== null && _b !== void 0 ? _b : GROUND_LEVEL;
35
+ if (heightFromGround) {
36
+ var surface = cesium_1.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, cartographic.height);
37
+ var offset = cesium_1.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, cartographic.height + heightFromGround);
34
38
  var translation = cesium_1.Cartesian3.subtract(offset, surface, new cesium_1.Cartesian3());
35
39
  tileset.modelMatrix = cesium_1.Matrix4.fromTranslation(translation);
36
40
  }
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ export interface Cesium3DTilesetWithUpdateProps {
3
+ url: string;
4
+ withUpdate?: boolean;
5
+ }
6
+ export declare const Cesium3DTilesetWithUpdate: React.FC<Cesium3DTilesetWithUpdateProps>;
@@ -0,0 +1,115 @@
1
+ "use strict";
2
+ /* eslint-disable @typescript-eslint/ban-ts-comment */
3
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
4
+ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
5
+ /* eslint-disable @typescript-eslint/no-unnecessary-condition */
6
+ /*
7
+ https://sandcastle.cesium.com/index.html?#c=fVZtTxs5EP4re3xho0YOkOv1jgC6ElIuiAQKKaWQqnJ2nayL187Z3qCk4r/f+GXf8nKWot3YzzOeGT8z6wWWQRd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bl2oKV9lESxxpT2r6MtitbDPWy7NuMmKCkzDfrrmBrvXLtx0t0zR8KUSZAXNUZiLvQ3cEx8tafkqyY+4Uo8kGowqsWNf9VwCZ57XAsfka9RawxbXHlKdSa+NVEZkFW3Y1n6uj4p210tmE5D6Fjd3a2tSPbTUJZbG0ly6XI/+/0lEY4TOdmDL3a8jNeMhUyCA0OGorHR4nntIJ3r2jOxJtTim390y/V3yz7t1jHkdYafh6QE5HYjZj5DzTGjK5n18SehxPoOzhCmMuC82gyHWUELjCxDUBrM+ZsaMFbr/a7NTELiu72uj6KdRzkksq16E9tb3m3onSS0bOHOVvms6F1OYyEyLU0gQ6IthQrUkGQcIhKmVoJ62cdBLTRUDj0/He2v1vvBdEDG7lsDLNGLunKzLeOztpAb5GY6Bu+ArfLIhkeGkgyeHZtZtECJ204O8mSwvBJlhWLP4H
8
+ */
9
+ var __assign = (this && this.__assign) || function () {
10
+ __assign = Object.assign || function(t) {
11
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
12
+ s = arguments[i];
13
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
14
+ t[p] = s[p];
15
+ }
16
+ return t;
17
+ };
18
+ return __assign.apply(this, arguments);
19
+ };
20
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
23
+ }) : (function(o, m, k, k2) {
24
+ if (k2 === undefined) k2 = k;
25
+ o[k2] = m[k];
26
+ }));
27
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
28
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
29
+ }) : function(o, v) {
30
+ o["default"] = v;
31
+ });
32
+ var __importStar = (this && this.__importStar) || function (mod) {
33
+ if (mod && mod.__esModule) return mod;
34
+ var result = {};
35
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
36
+ __setModuleDefault(result, mod);
37
+ return result;
38
+ };
39
+ Object.defineProperty(exports, "__esModule", { value: true });
40
+ exports.Cesium3DTilesetWithUpdate = void 0;
41
+ var react_1 = __importStar(require("react"));
42
+ var cesium_1 = require("cesium");
43
+ var map_1 = require("../map");
44
+ var Cesium3DTilesetWithUpdate = function (_a) {
45
+ var url = _a.url, withUpdate = _a.withUpdate;
46
+ var mapViewer = map_1.useCesiumMap();
47
+ var scene = mapViewer.scene;
48
+ var cesium3DTileset = react_1.useState(new cesium_1.Cesium3DTileset({
49
+ url: url,
50
+ }))[0];
51
+ var tileset = react_1.useState(scene.primitives.add(cesium3DTileset))[0];
52
+ react_1.useEffect(function () {
53
+ scene.globe.depthTestAgainstTerrain = true;
54
+ void mapViewer.zoomTo(tileset);
55
+ if (withUpdate === true) {
56
+ updateTileset(tileset);
57
+ }
58
+ // eslint-disable-next-line react-hooks/exhaustive-deps
59
+ }, []);
60
+ var updateContent = function (model, boundingVolume) {
61
+ var _a;
62
+ var height = boundingVolume.minimumHeight
63
+ ? boundingVolume.minimumHeight
64
+ : boundingVolume.center.z - boundingVolume.radius;
65
+ // @ts-ignore
66
+ var center = (_a = model._rtcCenter) !== null && _a !== void 0 ? _a : boundingVolume.center;
67
+ var normal = scene.globe.ellipsoid.geodeticSurfaceNormal(center, new cesium_1.Cartesian3());
68
+ var offset = cesium_1.Cartesian3.multiplyByScalar(normal, height, new cesium_1.Cartesian3());
69
+ var carto = cesium_1.Cartographic.fromCartesian(center);
70
+ void new Promise(function (resolve, reject) {
71
+ // @ts-ignore
72
+ if (scene.terrainProvider._ready !== true) {
73
+ var result = __assign({}, carto);
74
+ result.height = 0;
75
+ resolve(result);
76
+ }
77
+ else {
78
+ void cesium_1.sampleTerrainMostDetailed(scene.terrainProvider, [carto]).then(function (results) {
79
+ var result = results[0];
80
+ if (!cesium_1.defined(result)) {
81
+ resolve(carto);
82
+ }
83
+ resolve(result);
84
+ });
85
+ }
86
+ }).then(function (result) {
87
+ var resultCartesian = cesium_1.Cartographic.toCartesian(result);
88
+ var position = cesium_1.Cartesian3.subtract(resultCartesian, offset, new cesium_1.Cartesian3());
89
+ // @ts-ignore
90
+ model._rtcCenter = cesium_1.Cartesian3.clone(position, model._rtcCenter);
91
+ });
92
+ };
93
+ var updateTile = function (tile) {
94
+ if (tile.content !== undefined) {
95
+ // @ts-ignore
96
+ updateContent(tile.content, tile.boundingVolume.boundingVolume);
97
+ }
98
+ else {
99
+ var listener_1 = tileset.tileLoad.addEventListener(function (t) {
100
+ if (t === tile) {
101
+ updateContent(t.content, t.boundingVolume.boundingVolume);
102
+ listener_1();
103
+ }
104
+ });
105
+ }
106
+ tile.children.forEach(function (child) { return updateTile(child); });
107
+ };
108
+ var updateTileset = function (tileset) {
109
+ void tileset.readyPromise.then(function () {
110
+ updateTile(tileset.root);
111
+ });
112
+ };
113
+ return react_1.default.createElement(react_1.default.Fragment, null);
114
+ };
115
+ exports.Cesium3DTilesetWithUpdate = Cesium3DTilesetWithUpdate;
@@ -44,6 +44,7 @@ var TerrainianHeightTool = function (props) {
44
44
  console.log('Loaded CSV content:\n', text);
45
45
  void cesium_1.sampleTerrainMostDetailed(mapViewer.terrainProvider, parsed.map(function (item) { return item.cartographic; })).then(function (updatedPositions) {
46
46
  console.log(updatedPositions);
47
+ updatedPositions = updatedPositions.slice(0, updatedPositions.length - 1); // UNIX brake line
47
48
  mapViewer.scene.globe.depthTestAgainstTerrain = true;
48
49
  mapViewer.entities.suspendEvents();
49
50
  mapViewer.entities.removeAll();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@map-colonies/react-components",
3
- "version": "3.10.5",
3
+ "version": "3.11.0",
4
4
  "module": "dist/index.js",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -93,7 +93,7 @@
93
93
  "jest-enzyme": "^7.1.2",
94
94
  "react-test-renderer": "^16.13.1"
95
95
  },
96
- "gitHead": "3c0fc22a8e42017e804bdc95c10d797eb898b7cb",
96
+ "gitHead": "52e983d1180b9fc19719b68e4bbc8745cf5d4581",
97
97
  "jest": {
98
98
  "coverageReporters": [
99
99
  "text",
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
+ import { ArcGISTiledElevationTerrainProvider } from 'cesium';
2
3
  import { Story, Meta } from '@storybook/react/types-6-0';
3
4
  import { action } from '@storybook/addon-actions';
4
5
  import { CesiumMap } from '../map';
6
+ import { LayerType } from '../layers-manager';
5
7
  import { Cesium3DTileset } from './3d.tileset';
6
8
 
7
9
  export default {
@@ -18,12 +20,43 @@ const mapDivStyle = {
18
20
  position: 'absolute' as const,
19
21
  };
20
22
 
23
+ const BASE_MAPS = {
24
+ maps: [
25
+ {
26
+ id: '1st',
27
+ title: '1st Map Title',
28
+ isCurrent: true,
29
+ thumbnail:
30
+ 'https://nsw.digitaltwin.terria.io/build/efa2f6c408eb790753a9b5fb2f3dc678.png',
31
+ baseRasteLayers: [
32
+ {
33
+ id: 'GOOGLE_TERRAIN',
34
+ type: 'XYZ_LAYER' as LayerType,
35
+ opacity: 1,
36
+ zIndex: 0,
37
+ options: {
38
+ url: 'https://mt1.google.com/vt/lyrs=s&x={x}&y={y}&z={z}',
39
+ layers: '',
40
+ credit: 'GOOGLE',
41
+ },
42
+ },
43
+ ],
44
+ baseVectorLayers: [],
45
+ },
46
+ ],
47
+ };
48
+
49
+ const ArcGisProvider = new ArcGISTiledElevationTerrainProvider({
50
+ url:
51
+ 'https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer',
52
+ });
53
+
21
54
  export const Cesium3DTilesetLayer: Story = (args: unknown) => (
22
55
  <div style={mapDivStyle}>
23
56
  <CesiumMap {...args}>
24
57
  <Cesium3DTileset
25
58
  isZoomTo={true}
26
- url="/mock/tileset/tileset.json"
59
+ url="/mock/tileset_1/tileset.json"
27
60
  onAllTilesLoad={action('onAllTilesLoad')}
28
61
  onInitialTilesLoad={action('onInitialTilesLoad')}
29
62
  onTileFailed={action('onTileFailed')}
@@ -39,6 +72,9 @@ export const Cesium3DTilesetLayer: Story = (args: unknown) => (
39
72
  );
40
73
 
41
74
  Cesium3DTilesetLayer.argTypes = {
75
+ baseMaps: {
76
+ defaultValue: BASE_MAPS,
77
+ },
42
78
  zoom: {
43
79
  defaultValue: 3,
44
80
  control: {
@@ -49,13 +85,17 @@ Cesium3DTilesetLayer.argTypes = {
49
85
  },
50
86
  };
51
87
 
52
- export const Cesium3DTilesetOnHeightLayer: Story = (args: unknown) => (
88
+ Cesium3DTilesetLayer.storyName = '3D Layer';
89
+
90
+ export const Cesium3DTilesetWithHeightCorrectionLayer: Story = (
91
+ args: unknown
92
+ ) => (
53
93
  <div style={mapDivStyle}>
54
94
  <CesiumMap {...args}>
55
95
  <Cesium3DTileset
56
96
  isZoomTo={false}
57
- heightFromGround={-170}
58
- url="/mock/tileset/tileset.json"
97
+ heightFromGround={-10}
98
+ url="/mock/tileset_1/tileset.json"
59
99
  onAllTilesLoad={action('onAllTilesLoad')}
60
100
  onInitialTilesLoad={action('onInitialTilesLoad')}
61
101
  onTileFailed={action('onTileFailed')}
@@ -70,9 +110,12 @@ export const Cesium3DTilesetOnHeightLayer: Story = (args: unknown) => (
70
110
  </div>
71
111
  );
72
112
 
73
- Cesium3DTilesetOnHeightLayer.argTypes = {
113
+ Cesium3DTilesetWithHeightCorrectionLayer.argTypes = {
114
+ baseMaps: {
115
+ defaultValue: BASE_MAPS,
116
+ },
74
117
  zoom: {
75
- defaultValue: 18,
118
+ defaultValue: 17,
76
119
  control: {
77
120
  type: 'range',
78
121
  min: 0,
@@ -84,6 +127,9 @@ Cesium3DTilesetOnHeightLayer.argTypes = {
84
127
  },
85
128
  };
86
129
 
130
+ Cesium3DTilesetWithHeightCorrectionLayer.storyName =
131
+ '3D with Height Correction Layer';
132
+
87
133
  export const CesiumSolar3DTilesetLayer: Story = (args: unknown) => (
88
134
  <div style={mapDivStyle}>
89
135
  <CesiumMap {...args}>
@@ -96,6 +142,12 @@ export const CesiumSolar3DTilesetLayer: Story = (args: unknown) => (
96
142
  );
97
143
 
98
144
  CesiumSolar3DTilesetLayer.argTypes = {
145
+ baseMaps: {
146
+ defaultValue: BASE_MAPS,
147
+ },
148
+ terrainProvider: {
149
+ defaultValue: ArcGisProvider,
150
+ },
99
151
  center: {
100
152
  defaultValue: [34.811, 31.908],
101
153
  },
@@ -108,3 +160,5 @@ CesiumSolar3DTilesetLayer.argTypes = {
108
160
  },
109
161
  },
110
162
  };
163
+
164
+ CesiumSolar3DTilesetLayer.storyName = 'Solar 3D Layer with Terrain Provider';
@@ -1,10 +1,11 @@
1
- import { Cartesian3, Cartographic, Matrix4 } from 'cesium';
2
1
  import React from 'react';
3
-
2
+ import { Cartesian3, Cartographic, Matrix4 } from 'cesium';
4
3
  import { Cesium3DTileset as Resium3DTileset } from 'resium';
5
4
  import { Cesium3DTilesetProps } from 'resium/dist/types/src/Cesium3DTileset/Cesium3DTileset';
6
5
  import { CesiumViewer, useCesiumMap } from '../map';
7
6
 
7
+ const GROUND_LEVEL = 0.0;
8
+
8
9
  export interface RCesium3DTilesetProps extends Cesium3DTilesetProps {
9
10
  isZoomTo?: boolean;
10
11
  heightFromGround?: number;
@@ -17,22 +18,25 @@ export const Cesium3DTileset: React.FC<RCesium3DTilesetProps> = (props) => {
17
18
  {...props}
18
19
  onReady={(tileset): void => {
19
20
  props.onReady?.(tileset);
20
- if (props.isZoomTo) {
21
+ if (props.isZoomTo === true) {
21
22
  void mapViewer.zoomTo(tileset);
22
23
  }
23
- if (props.heightFromGround) {
24
- const cartographic = Cartographic.fromCartesian(
25
- tileset.boundingSphere.center
26
- );
24
+ const scene = mapViewer.scene;
25
+ scene.globe.depthTestAgainstTerrain = true;
26
+ const cartographic = Cartographic.fromCartesian(
27
+ tileset.boundingSphere.center
28
+ );
29
+ const heightFromGround = props.heightFromGround ?? GROUND_LEVEL;
30
+ if (heightFromGround) {
27
31
  const surface = Cartesian3.fromRadians(
28
32
  cartographic.longitude,
29
33
  cartographic.latitude,
30
- 0.0
34
+ cartographic.height
31
35
  );
32
36
  const offset = Cartesian3.fromRadians(
33
37
  cartographic.longitude,
34
38
  cartographic.latitude,
35
- props.heightFromGround
39
+ cartographic.height + heightFromGround
36
40
  );
37
41
  const translation = Cartesian3.subtract(
38
42
  offset,
@@ -0,0 +1,120 @@
1
+ /* eslint-disable @typescript-eslint/ban-ts-comment */
2
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
3
+ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
4
+ /* eslint-disable @typescript-eslint/no-unnecessary-condition */
5
+ /*
6
+ https://sandcastle.cesium.com/index.html?#c=fVZtTxs5EP4re3xho0YOkOv1jgC6ElIuiAQKKaWQqnJ2nayL187Z3qCk4r/f+GXf8nKWot3YzzOeGT8z6wWWQRdLTRTFvB2cBl14y1JUznXGfMxbreBSYq798tV9gKOIKBVoESxFJgMqeICVIlqNuTfRFxzFZIozpj9a8Ei8EA5b7JPlVTK5jOgNvep/WfUPh7Sv+vzufdTt/9F/mT8+dK/+QgD6N758MSA6GJ3/HB712gN60H66fHq5Ht0l39K+vvnaWw27h/RmFP+8ueitBqvB+8FqRq+7V/MnMDa8+Kz6KUtieB+MPv8+/Am/i8HBoH2AztvdD0NBlu2n28do+uHHp8fz3rdXKiN91J6qLyS64/eHR5+YHv65b3OwgFRFNrQRkRJTfivFgsZEllmLJMGafBWSxR4TNjqOSRijcyVovEnm5DU30NuBsmacoQUlr+u0BzsX7jv3uoJr4BK53wx+jXkAY4IVucZLIm9p9ALs42CKmSJNt6rXXDreHueYv+XRqIhwAj44Z5D9az20b2jGxITA4c91MiJKf5yBFaW9OaBpmZEiIE0ZAeHAtCPPJU2ppguiEI7j0LlYCdY92hcjxwt9iGZkkh0HpfzuiAJtRgRNpUg/GnX247D9oX3UcJQ3ePrEujhWQqQjEXqPPAoJnRD5ShUJpxmPtJF6CKEI2Qgqe0eCK8EIYmLmVzv5LnaLgpvNYxCJ8T6wOxVWTDImIuMx5bMHwbLUZNggUH3W26XTIPSxQpnBecfWHAJHNOH6vMZp1HzdvstWYh5E6aKHrbE6JSAVMWGw7FfQDztRASSEzhJjoO4HSimnaZb+Y5creJCFtpK3htAPqaOunapguJApZoWInAKLokMzAlRNo/tMTnFEhhYdOsNNp66i44WNRsWwmE6dOksASqGn0Tlbni/vI8ywDN3uTR/Z/xuMYF7UO62YSTxPaGSFWvC8e1XuHNZBiCX7NSG2y/oWkevCJWG9rk9PT3f2oZo+zFaSKIjSHKNxsFMuugVUHOJBZc37hwAj2IKEDltUAuwOzv/awJfxKJzOGfG+DYTSFwR6GQNtbw2pGTxb9743EBQpLwrUb6xqUW1E5kHPB987dZRJ4W9rteVD2bDoUqIzyTcyVSmcNaQzVoG+NcpCcy95KrfFVXOiCGeboLQo5VQ/jEJSQlHbl2oKV9lESxxpT2r6MtitbDPWy7NuMmKCkzDfrrmBrvXLtx0t0zR8KUSZAXNUZiLvQ3cEx8tafkqyY+4Uo8kGowqsWNf9VwCZ57XAsfka9RawxbXHlKdSa+NVEZkFW3Y1n6uj4p210tmE5D6Fjd3a2tSPbTUJZbG0ly6XI/+/0lEY4TOdmDL3a8jNeMhUyCA0OGorHR4nntIJ3r2jOxJtTim390y/V3yz7t1jHkdYafh6QE5HYjZj5DzTGjK5n18SehxPoOzhCmMuC82gyHWUELjCxDUBrM+ZsaMFbr/a7NTELiu72uj6KdRzkksq16E9tb3m3onSS0bOHOVvms6F1OYyEyLU0gQ6IthQrUkGQcIhKmVoJ62cdBLTRUDj0/He2v1vvBdEDG7lsDLNGLunKzLeOztpAb5GY6Bu+ArfLIhkeGkgyeHZtZtECJ204O8mSwvBJlhWLP4H
7
+ */
8
+
9
+ import React, { useEffect, useState } from 'react';
10
+ import {
11
+ Cesium3DTileset,
12
+ Cesium3DTile,
13
+ Cartographic,
14
+ Cartesian3,
15
+ defined,
16
+ sampleTerrainMostDetailed,
17
+ Cesium3DTileContent,
18
+ } from 'cesium';
19
+ import { CesiumViewer, useCesiumMap } from '../map';
20
+
21
+ export interface Cesium3DTilesetWithUpdateProps {
22
+ url: string;
23
+ withUpdate?: boolean;
24
+ }
25
+
26
+ export const Cesium3DTilesetWithUpdate: React.FC<Cesium3DTilesetWithUpdateProps> = ({
27
+ url,
28
+ withUpdate,
29
+ }) => {
30
+ const mapViewer: CesiumViewer = useCesiumMap();
31
+ const scene = mapViewer.scene;
32
+ const [cesium3DTileset] = useState<Cesium3DTileset>(
33
+ new Cesium3DTileset({
34
+ url: url,
35
+ })
36
+ );
37
+ const [tileset] = useState<Cesium3DTileset>(
38
+ scene.primitives.add(cesium3DTileset)
39
+ );
40
+
41
+ useEffect(() => {
42
+ scene.globe.depthTestAgainstTerrain = true;
43
+ void mapViewer.zoomTo(tileset);
44
+ if (withUpdate === true) {
45
+ updateTileset(tileset);
46
+ }
47
+ // eslint-disable-next-line react-hooks/exhaustive-deps
48
+ }, []);
49
+
50
+ const updateContent = (
51
+ model: Cesium3DTileContent,
52
+ boundingVolume: any
53
+ ): void => {
54
+ const height = boundingVolume.minimumHeight
55
+ ? boundingVolume.minimumHeight
56
+ : boundingVolume.center.z - boundingVolume.radius;
57
+ // @ts-ignore
58
+ const center = model._rtcCenter ?? boundingVolume.center;
59
+ const normal = scene.globe.ellipsoid.geodeticSurfaceNormal(
60
+ center,
61
+ new Cartesian3()
62
+ );
63
+ const offset = Cartesian3.multiplyByScalar(
64
+ normal,
65
+ height,
66
+ new Cartesian3()
67
+ );
68
+ const carto = Cartographic.fromCartesian(center);
69
+ void new Promise((resolve, reject) => {
70
+ // @ts-ignore
71
+ if (scene.terrainProvider._ready !== true) {
72
+ const result = { ...carto };
73
+ result.height = 0;
74
+ resolve(result);
75
+ } else {
76
+ void sampleTerrainMostDetailed(scene.terrainProvider, [carto]).then(
77
+ (results) => {
78
+ const result = results[0];
79
+ if (!defined(result)) {
80
+ resolve(carto);
81
+ }
82
+ resolve(result);
83
+ }
84
+ );
85
+ }
86
+ }).then((result) => {
87
+ const resultCartesian = Cartographic.toCartesian(result as Cartographic);
88
+ const position = Cartesian3.subtract(
89
+ resultCartesian,
90
+ offset,
91
+ new Cartesian3()
92
+ );
93
+ // @ts-ignore
94
+ model._rtcCenter = Cartesian3.clone(position, model._rtcCenter);
95
+ });
96
+ };
97
+
98
+ const updateTile = (tile: Cesium3DTile): void => {
99
+ if (tile.content !== undefined) {
100
+ // @ts-ignore
101
+ updateContent(tile.content, tile.boundingVolume.boundingVolume);
102
+ } else {
103
+ const listener = tileset.tileLoad.addEventListener((t) => {
104
+ if (t === tile) {
105
+ updateContent(t.content, t.boundingVolume.boundingVolume);
106
+ listener();
107
+ }
108
+ });
109
+ }
110
+ tile.children.forEach((child) => updateTile(child));
111
+ };
112
+
113
+ const updateTileset = (tileset: Cesium3DTileset): void => {
114
+ void tileset.readyPromise.then(() => {
115
+ updateTile(tileset.root);
116
+ });
117
+ };
118
+
119
+ return <></>;
120
+ };
@@ -1,17 +1,18 @@
1
+ /* eslint-disable @typescript-eslint/naming-convention */
1
2
  import React, { useState } from 'react';
2
3
  import {
3
4
  ArcGISTiledElevationTerrainProvider,
4
5
  EllipsoidTerrainProvider,
5
- TerrainProvider,
6
6
  CesiumTerrainProvider,
7
7
  Resource,
8
+ TerrainProvider,
8
9
  } from 'cesium';
9
10
  import { Story, Meta } from '@storybook/react/types-6-0';
10
- import { CesiumMap, useCesiumMap } from '../map';
11
+ import { CesiumMap, CesiumViewer, useCesiumMap } from '../map';
11
12
  import { CesiumSceneMode } from '../map.types';
12
- import { Cesium3DTileset } from '../layers';
13
13
  import { InspectorTool } from '../tools/inspector.tool';
14
14
  import { TerrainianHeightTool } from '../tools/terranian-height.tool';
15
+ import { Cesium3DTileset } from '../layers';
15
16
  import { LayerType } from '../layers-manager';
16
17
 
17
18
  export default {
@@ -56,19 +57,41 @@ const BASE_MAPS = {
56
57
 
57
58
  const EllipsoidProvider = new EllipsoidTerrainProvider({});
58
59
 
59
- // eslint-disable-next-line @typescript-eslint/naming-convention
60
- const MCCesiumProviderMercator = new CesiumTerrainProvider({
61
- url: new Resource({
62
- url: 'http://localhost:3000/terrain_mercator_crop',
63
- }),
64
- });
60
+ //#region TILER MATERIALS
61
+ // const TTCesiumProviderSrtm30 = new CesiumTerrainProvider({
62
+ // url: new Resource({
63
+ // url: 'http://localhost:8002/srtm30',
64
+ // }),
65
+ // });
66
+ // const TTCesiumProviderSrtm100 = new CesiumTerrainProvider({
67
+ // url: new Resource({
68
+ // url: 'http://localhost:8002/srtm100',
69
+ // }),
70
+ // });
71
+ // const TTCesiumProviderMergedDescending = new CesiumTerrainProvider({
72
+ // url: new Resource({
73
+ // url: 'http://localhost:8002/mergedDescending',
74
+ // }),
75
+ // });
76
+ //#endregion
65
77
 
66
- // eslint-disable-next-line @typescript-eslint/naming-convention
67
- const MCCesiumProviderW84 = new CesiumTerrainProvider({
68
- url: new Resource({
69
- url: 'http://localhost:3000/terrain_w84_geo_crop',
70
- }),
71
- });
78
+ //#region CTBD MATERIALS
79
+ // const CTBDCesiumProviderSrtm30 = new CesiumTerrainProvider({
80
+ // url: new Resource({
81
+ // url: 'http://localhost:3000/srtm30',
82
+ // }),
83
+ // });
84
+ // const CTBDCesiumProviderSrtm100 = new CesiumTerrainProvider({
85
+ // url: new Resource({
86
+ // url: 'http://localhost:3000/srtm100',
87
+ // }),
88
+ // });
89
+ // const CTBDCesiumProviderMergedAscending = new CesiumTerrainProvider({
90
+ // url: new Resource({
91
+ // url: 'http://localhost:3000/mergedAscending',
92
+ // }),
93
+ // });
94
+ //#endregion
72
95
 
73
96
  const ArcGisProvider = new ArcGISTiledElevationTerrainProvider({
74
97
  url:
@@ -80,14 +103,6 @@ const terrainProviderListQmesh = [
80
103
  id: 'NONE',
81
104
  value: EllipsoidProvider,
82
105
  },
83
- {
84
- id: 'MC Mercator - Cesium Terrain Provider',
85
- value: MCCesiumProviderMercator,
86
- },
87
- {
88
- id: 'MC W84 - Cesium Terrain Provider',
89
- value: MCCesiumProviderW84,
90
- },
91
106
  {
92
107
  id: 'Arc Gis Terrain Provider',
93
108
  value: ArcGisProvider,
@@ -106,7 +121,7 @@ interface ITerrainProviderSelectorProps {
106
121
  const TerrainProviderSelector: React.FC<ITerrainProviderSelectorProps> = ({
107
122
  terrainProviderList,
108
123
  }) => {
109
- const mapViewer = useCesiumMap();
124
+ const mapViewer: CesiumViewer = useCesiumMap();
110
125
 
111
126
  return (
112
127
  <>
@@ -129,7 +144,7 @@ const TerrainProviderSelector: React.FC<ITerrainProviderSelectorProps> = ({
129
144
  };
130
145
 
131
146
  export const QuantizedMeshHeightsTool: Story = () => {
132
- const [center] = useState<[number, number]>([-122, 43]);
147
+ const [center] = useState<[number, number]>([34.817, 31.911]);
133
148
  return (
134
149
  <div style={mapDivStyle}>
135
150
  <CesiumMap
@@ -140,8 +155,8 @@ export const QuantizedMeshHeightsTool: Story = () => {
140
155
  baseMaps={BASE_MAPS}
141
156
  >
142
157
  <Cesium3DTileset
143
- isZoomTo={true}
144
158
  url="https://3d.ofek-air.com/3d/Jeru_Old_City_Cesium/ACT/Jeru_Old_City_Cesium_ACT.json"
159
+ isZoomTo={true}
145
160
  />
146
161
  <TerrainProviderSelector
147
162
  terrainProviderList={terrainProviderListQmesh}
@@ -14,6 +14,7 @@ import { CesiumMap, useCesiumMap } from '../map';
14
14
  import { CesiumSceneMode } from '../map.types';
15
15
  import { Cesium3DTileset } from '../layers';
16
16
  import { LayerType } from '../layers-manager';
17
+ import { InspectorTool } from '../tools/inspector.tool';
17
18
  import QuantizedMeshTerrainProvider from './custom/quantized-mesh-terrain-provider';
18
19
 
19
20
  export default {
@@ -122,8 +123,8 @@ interface ITerrainProviderSelectorProps {
122
123
  const TerrainProviderSelector: React.FC<ITerrainProviderSelectorProps> = ({
123
124
  terrainProviderList,
124
125
  }) => {
125
- const mapViewer = useCesiumMap();
126
126
  const [depthTest, setDepthTest] = useState<boolean>(false);
127
+ const mapViewer = useCesiumMap();
127
128
 
128
129
  const scene = mapViewer.scene;
129
130
 
@@ -178,6 +179,7 @@ export const QuantizedMeshProviders: Story = () => {
178
179
  url="/mock/tileset_2/L16_31023/L16_31023.json"
179
180
  />
180
181
  <TerrainProviderSelector terrainProviderList={terrainProviderList} />
182
+ <InspectorTool />
181
183
  </CesiumMap>
182
184
  </div>
183
185
  );
@@ -69,6 +69,10 @@ export const TerrainianHeightTool: React.FC<TerrainianHeightProps> = (
69
69
  ).then(
70
70
  (updatedPositions) => {
71
71
  console.log(updatedPositions);
72
+ updatedPositions = updatedPositions.slice(
73
+ 0,
74
+ updatedPositions.length - 1
75
+ ); // UNIX brake line
72
76
 
73
77
  mapViewer.scene.globe.depthTestAgainstTerrain = true;
74
78
  mapViewer.entities.suspendEvents();
@@ -1 +0,0 @@
1
- export {};
@@ -1,5 +0,0 @@
1
- "use strict";
2
- /*
3
- https://sandcastle.cesium.com/index.html?#c=fVZtTxs5EP4re3xho0YOkOv1jgC6ElIuiAQKKaWQqnJ2nayL187Z3qCk4r/f+GXf8nKWot3YzzOeGT8z6wWWQRdLTRTFvB2cBl14y1JUznXGfMxbreBSYq798tV9gKOIKBVoESxFJgMqeICVIlqNuTfRFxzFZIozpj9a8Ei8EA5b7JPlVTK5jOgNvep/WfUPh7Sv+vzufdTt/9F/mT8+dK/+QgD6N758MSA6GJ3/HB712gN60H66fHq5Ht0l39K+vvnaWw27h/RmFP+8ueitBqvB+8FqRq+7V/MnMDa8+Kz6KUtieB+MPv8+/Am/i8HBoH2AztvdD0NBlu2n28do+uHHp8fz3rdXKiN91J6qLyS64/eHR5+YHv65b3OwgFRFNrQRkRJTfivFgsZEllmLJMGafBWSxR4TNjqOSRijcyVovEnm5DU30NuBsmacoQUlr+u0BzsX7jv3uoJr4BK53wx+jXkAY4IVucZLIm9p9ALs42CKmSJNt6rXXDreHueYv+XRqIhwAj44Z5D9az20b2jGxITA4c91MiJKf5yBFaW9OaBpmZEiIE0ZAeHAtCPPJU2ppguiEI7j0LlYCdY92hcjxwt9iGZkkh0HpfzuiAJtRg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Ntbw2pGTxb9743EBQpLwrUb6xqUW1E5kHPB987dZRJ4W9rteVD2bDoUqIzyTcyVSmcNaQzVoG+NcpCcy95KrfFVXOiCGeboLQo5VQ/jEJSQlHbl2oKV9lESxxpT2r6MtitbDPWy7NuMmKCkzDfrrmBrvXLtx0t0zR8KUSZAXNUZiLvQ3cEx8tafkqyY+4Uo8kGowqsWNf9VwCZ57XAsfka9RawxbXHlKdSa+NVEZkFW3Y1n6uj4p210tmE5D6Fjd3a2tSPbTUJZbG0ly6XI/+/0lEY4TOdmDL3a8jNeMhUyCA0OGorHR4nntIJ3r2jOxJtTim390y/V3yz7t1jHkdYafh6QE5HYjZj5DzTGjK5n18SehxPoOzhCmMuC82gyHWUELjCxDUBrM+ZsaMFbr/a7NTELiu72uj6KdRzkksq16E9tb3m3onSS0bOHOVvms6F1OYyEyLU0gQ6IthQrUkGQcIhKmVoJ62cdBLTRUDj0/He2v1vvBdEDG7lsDLNGLunKzLeOztpAb5GY6Bu+ArfLIhkeGkgyeHZtZtECJ204O8mSwvBJlhWLP4H
3
- */
4
-
5
- /*
6
- import {
7
- Cesium3DTileset,
8
- Cesium3DTile,
9
- Cartographic,
10
- Cartesian3,
11
- defined,
12
- sampleTerrainMostDetailed,
13
- } from 'cesium';
14
-
15
- const updateTile = (tile: Cesium3DTile): void => {
16
- const boundingVolume = tile.boundingVolume;
17
- if (defined(tile.contentBoundingVolume)) {
18
- boundingVolume = tile.contentBoundingVolume;
19
- }
20
- const content = tile.content;
21
- const model = content._model;
22
- const height = boundingVolume.minimumHeight;
23
- const center = model._rtcCenter;
24
- const normal = scene.globe.ellipsoid.geodeticSurfaceNormal(center, new Cartesian3());
25
- const offset = Cartesian3.multiplyByScalar(normal, height, new Cartesian3());
26
- const carto = Cartographic.fromCartesian(center);
27
- const promise = when.defer();
28
- if (scene.terrainProvider === ellipsoidTerrainProvider) {
29
- const result = carto;
30
- result.height = 0;
31
- promise.resolve(result);
32
- } else {
33
- promise = sampleTerrainMostDetailed(scene.terrainProvider, [carto]).then((results) => {
34
- const result = results[0];
35
- if (!defined(result)) {
36
- return carto;
37
- }
38
- return result;
39
- });
40
- }
41
- promise.then((result) => {
42
- result = Cartographic.toCartesian(result);
43
- const position = Cartesian3.subtract(result, offset, new Cartesian3());
44
- model._rtcCenter = Cartesian3.clone(position, model._rtcCenter);
45
- });
46
- };
47
-
48
- const updateTileset = (root: Cesium3DTile): void => {
49
- if (root.contentReady) {
50
- updateTile(root);
51
- } else {
52
- const listener = (tileset as Cesium3DTileset).tileLoad.addEventListener(
53
- (tile: Cesium3DTile) => {
54
- if (tile === root) {
55
- updateTile(tile);
56
- listener();
57
- }
58
- }
59
- );
60
- }
61
- const children = root.children;
62
- const length = children.length;
63
- for (let i = 0; i < length; ++i) {
64
- updateTileset(children[i]);
65
- }
66
- };
67
-
68
- export const update = (tileset: Cesium3DTileset): void => {
69
- updateTileset(tileset.root);
70
- };
71
- */
72
- export {};
@@ -1,124 +0,0 @@
1
- {
2
- "asset": {
3
- "version": "1.0",
4
- "tilesetVersion": "1.2.3"
5
- },
6
- "extras": {
7
- "name": "Sample Tileset"
8
- },
9
- "properties": {
10
- "id": {
11
- "minimum": 0,
12
- "maximum": 9
13
- },
14
- "Longitude": {
15
- "minimum": -1.3197192952275933,
16
- "maximum": -1.319644104024109
17
- },
18
- "Latitude": {
19
- "minimum": 0.698848878034009,
20
- "maximum": 0.6989046192460953
21
- },
22
- "Height": {
23
- "minimum": 6.161747192963958,
24
- "maximum": 85.41026367992163
25
- }
26
- },
27
- "geometricError": 240,
28
- "root": {
29
- "boundingVolume": {
30
- "region": [
31
- -1.3197209591796106,
32
- 0.6988424218,
33
- -1.3196390408203893,
34
- 0.6989055782,
35
- 0,
36
- 88
37
- ]
38
- },
39
- "geometricError": 70,
40
- "refine": "ADD",
41
- "content": {
42
- "uri": "parent.b3dm",
43
- "boundingVolume": {
44
- "region": [
45
- -1.3197004795898053,
46
- 0.6988582109,
47
- -1.3196595204101946,
48
- 0.6988897891,
49
- 0,
50
- 88
51
- ]
52
- }
53
- },
54
- "children": [
55
- {
56
- "boundingVolume": {
57
- "region": [
58
- -1.3197209591796106,
59
- 0.6988424218,
60
- -1.31968,
61
- 0.698874,
62
- 0,
63
- 20
64
- ]
65
- },
66
- "geometricError": 0,
67
- "content": {
68
- "uri": "ll.b3dm"
69
- }
70
- },
71
- {
72
- "boundingVolume": {
73
- "region": [
74
- -1.31968,
75
- 0.6988424218,
76
- -1.3196390408203893,
77
- 0.698874,
78
- 0,
79
- 20
80
- ]
81
- },
82
- "geometricError": 0,
83
- "content": {
84
- "uri": "lr.b3dm"
85
- },
86
- "extras": {
87
- "id": "Special Tile"
88
- }
89
- },
90
- {
91
- "boundingVolume": {
92
- "region": [
93
- -1.31968,
94
- 0.698874,
95
- -1.3196390408203893,
96
- 0.6989055782,
97
- 0,
98
- 20
99
- ]
100
- },
101
- "geometricError": 0,
102
- "content": {
103
- "uri": "ur.b3dm"
104
- }
105
- },
106
- {
107
- "boundingVolume": {
108
- "region": [
109
- -1.3197209591796106,
110
- 0.698874,
111
- -1.31968,
112
- 0.6989055782,
113
- 0,
114
- 20
115
- ]
116
- },
117
- "geometricError": 0,
118
- "content": {
119
- "uri": "ul.b3dm"
120
- }
121
- }
122
- ]
123
- }
124
- }