@map-colonies/react-components 3.10.4 → 3.12.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 (53) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/dist/cesium-map/layers/3d.tileset.js +11 -7
  3. package/dist/cesium-map/layers/3d.tileset.with.update.d.ts +6 -0
  4. package/dist/cesium-map/layers/3d.tileset.with.update.js +115 -0
  5. package/dist/cesium-map/layers/imagery.layer.js +9 -5
  6. package/dist/cesium-map/layers-manager.d.ts +10 -2
  7. package/dist/cesium-map/layers-manager.js +19 -1
  8. package/dist/cesium-map/map-legend/MapLegend.css +135 -0
  9. package/dist/cesium-map/map-legend/MapLegend.d.ts +15 -0
  10. package/dist/cesium-map/map-legend/MapLegend.js +57 -0
  11. package/dist/cesium-map/map-legend/MapLegendList.d.ts +13 -0
  12. package/dist/cesium-map/map-legend/MapLegendList.js +43 -0
  13. package/dist/cesium-map/map-legend/MapLegendSidebar.d.ts +16 -0
  14. package/dist/cesium-map/map-legend/MapLegendSidebar.js +20 -0
  15. package/dist/cesium-map/map-legend/MapLegendToggle.d.ts +7 -0
  16. package/dist/cesium-map/map-legend/MapLegendToggle.js +20 -0
  17. package/dist/cesium-map/map-legend/index.d.ts +3 -0
  18. package/dist/cesium-map/map-legend/index.js +14 -0
  19. package/dist/cesium-map/map.css +6 -1
  20. package/dist/cesium-map/map.d.ts +16 -1
  21. package/dist/cesium-map/map.js +51 -21
  22. package/dist/cesium-map/settings/settings.css +5 -2
  23. package/dist/cesium-map/tools/terranian-height.tool.js +1 -0
  24. package/dist/file-picker/file-picker.css +2 -1
  25. package/package.json +3 -3
  26. package/src/lib/cesium-map/layers/3d.tileset.stories.tsx +60 -6
  27. package/src/lib/cesium-map/layers/3d.tileset.tsx +13 -9
  28. package/src/lib/cesium-map/layers/3d.tileset.with.update.tsx +120 -0
  29. package/src/lib/cesium-map/layers/imagery.layer.tsx +12 -7
  30. package/src/lib/cesium-map/layers-manager.ts +35 -2
  31. package/src/lib/cesium-map/map-legend/MapLegend.css +135 -0
  32. package/src/lib/cesium-map/map-legend/MapLegend.tsx +91 -0
  33. package/src/lib/cesium-map/map-legend/MapLegendList.tsx +46 -0
  34. package/src/lib/cesium-map/map-legend/MapLegendSidebar.tsx +55 -0
  35. package/src/lib/cesium-map/map-legend/MapLegendToggle.tsx +31 -0
  36. package/src/lib/cesium-map/map-legend/index.tsx +3 -0
  37. package/src/lib/cesium-map/map-legend/legends-sidebar.stories.tsx +201 -0
  38. package/src/lib/cesium-map/map.css +6 -1
  39. package/src/lib/cesium-map/map.tsx +86 -20
  40. package/src/lib/cesium-map/settings/settings.css +5 -2
  41. package/src/lib/cesium-map/terrain-providers/terrain-provider-heights-tool.stories.tsx +41 -26
  42. package/src/lib/cesium-map/terrain-providers/terrain-provider.stories.tsx +3 -1
  43. package/src/lib/cesium-map/tools/terranian-height.tool.tsx +4 -0
  44. package/src/lib/file-picker/file-picker.css +2 -1
  45. package/dist/cesium-map/layers/3d.tileset.update.d.ts +0 -1
  46. package/dist/cesium-map/layers/3d.tileset.update.js +0 -5
  47. package/src/lib/cesium-map/layers/3d.tileset.update.ts +0 -72
  48. package/storybook-static/mock/tileset_1/ll.b3dm +0 -0
  49. package/storybook-static/mock/tileset_1/lr.b3dm +0 -0
  50. package/storybook-static/mock/tileset_1/parent.b3dm +0 -0
  51. package/storybook-static/mock/tileset_1/tileset.json +0 -124
  52. package/storybook-static/mock/tileset_1/ul.b3dm +0 -0
  53. package/storybook-static/mock/tileset_1/ur.b3dm +0 -0
@@ -4,7 +4,9 @@ import React, {
4
4
  useEffect,
5
5
  useState,
6
6
  useRef,
7
+ useCallback,
7
8
  } from 'react';
9
+ import { createPortal } from 'react-dom';
8
10
  import { Viewer, CesiumComponentRef } from 'resium';
9
11
  import { ViewerProps } from 'resium/dist/types/src/Viewer/Viewer';
10
12
  import {
@@ -26,7 +28,8 @@ import { Proj } from '../utils/projections';
26
28
  import { CoordinatesTrackerTool } from './tools/coordinates-tracker.tool';
27
29
  import { ScaleTrackerTool } from './tools/scale-tracker.tool';
28
30
  import { CesiumSettings, IBaseMap, IBaseMaps } from './settings/settings';
29
- import LayerManager from './layers-manager';
31
+ import { IMapLegend, MapLegendSidebar, MapLegendToggle } from './map-legend';
32
+ import LayerManager, { LegendExtractor } from './layers-manager';
30
33
  import { CesiumSceneMode, CesiumSceneModeEnum } from './map.types';
31
34
 
32
35
  import './map.css';
@@ -80,6 +83,14 @@ export interface IContextMenuData {
80
83
  handleClose: () => void;
81
84
  }
82
85
 
86
+ interface ILegends {
87
+ legendsList?: IMapLegend[];
88
+ emptyText?: string;
89
+ title?: string;
90
+ actionsTexts?: { docText: string; imgText: string };
91
+ mapLegendsExtractor?: LegendExtractor;
92
+ }
93
+
83
94
  export interface CesiumMapProps extends ViewerProps {
84
95
  showMousePosition?: boolean;
85
96
  showScale?: boolean;
@@ -96,6 +107,9 @@ export interface CesiumMapProps extends ViewerProps {
96
107
  width: number;
97
108
  dynamicHeightIncrement?: number;
98
109
  };
110
+ legendSidebarTitle?: string;
111
+ noLegendsText?: string;
112
+ legends?: ILegends;
99
113
  }
100
114
 
101
115
  export const useCesiumMap = (): CesiumViewer => {
@@ -119,11 +133,15 @@ export const CesiumMap: React.FC<CesiumMapProps> = (props) => {
119
133
  const [sceneModes, setSceneModes] = useState<
120
134
  CesiumSceneModeEnum[] | undefined
121
135
  >();
136
+ const [legendsList, setLegendsList] = useState<IMapLegend[]>([]);
122
137
  const [baseMaps, setBaseMaps] = useState<IBaseMaps | undefined>();
123
138
  const [showImageryMenu, setShowImageryMenu] = useState<boolean>(false);
124
139
  const [imageryMenuPosition, setImageryMenuPosition] = useState<
125
140
  Record<string, unknown> | undefined
126
141
  >(undefined);
142
+ const [isLegendsSidebarOpen, setIsLegendsSidebarOpen] = useState<boolean>(
143
+ false
144
+ );
127
145
 
128
146
  const viewerProps = {
129
147
  fullscreenButton: true,
@@ -163,7 +181,7 @@ export const CesiumMap: React.FC<CesiumMapProps> = (props) => {
163
181
  useEffect(() => {
164
182
  if (ref.current) {
165
183
  const viewer = ref.current.cesiumElement as CesiumViewer;
166
- viewer.layersManager = new LayerManager(viewer);
184
+
167
185
  if (props.imageryContextMenu) {
168
186
  viewer.screenSpaceEventHandler.setInputAction(
169
187
  (evt: Record<string, unknown>) => {
@@ -179,6 +197,20 @@ export const CesiumMap: React.FC<CesiumMapProps> = (props) => {
179
197
  setMapViewRef(ref.current?.cesiumElement);
180
198
  }, [ref, props.imageryContextMenu]);
181
199
 
200
+ useEffect(() => {
201
+ if (mapViewRef) {
202
+ mapViewRef.layersManager = new LayerManager(
203
+ mapViewRef,
204
+ props.legends?.mapLegendsExtractor,
205
+ () => {
206
+ setLegendsList(
207
+ mapViewRef?.layersManager?.legendsList as IMapLegend[]
208
+ );
209
+ }
210
+ );
211
+ }
212
+ }, [mapViewRef]);
213
+
182
214
  useEffect(() => {
183
215
  setSceneModes(
184
216
  props.sceneModes ?? [
@@ -326,27 +358,61 @@ export const CesiumMap: React.FC<CesiumMapProps> = (props) => {
326
358
  }
327
359
  }, [props.zoom, props.center, mapViewRef]);
328
360
 
361
+ const bindCustomToolsToViewer = useCallback((): JSX.Element | undefined => {
362
+ return (
363
+ mapViewRef &&
364
+ createPortal(
365
+ <>
366
+ <Box className="sideToolsContainer">
367
+ <CesiumSettings
368
+ sceneModes={sceneModes as CesiumSceneModeEnum[]}
369
+ baseMaps={baseMaps}
370
+ locale={locale}
371
+ />
372
+ <MapLegendToggle
373
+ onClick={() => setIsLegendsSidebarOpen(!isLegendsSidebarOpen)}
374
+ />
375
+ </Box>
376
+ <Box className="toolsContainer">
377
+ {showMousePosition === true ? (
378
+ <CoordinatesTrackerTool
379
+ projection={projection}
380
+ ></CoordinatesTrackerTool>
381
+ ) : (
382
+ <></>
383
+ )}
384
+ {showScale === true ? <ScaleTrackerTool locale={locale} /> : <></>}
385
+ </Box>
386
+ </>,
387
+ document.querySelector('.cesium-viewer') as Element
388
+ )
389
+ );
390
+ }, [
391
+ baseMaps,
392
+ locale,
393
+ mapViewRef,
394
+ projection,
395
+ sceneModes,
396
+ showMousePosition,
397
+ showScale,
398
+ isLegendsSidebarOpen,
399
+ ]);
400
+
329
401
  return (
330
- <Viewer full ref={ref} {...viewerProps}>
402
+ <Viewer className="viewer" full ref={ref} {...viewerProps}>
331
403
  <MapViewProvider value={mapViewRef as CesiumViewer}>
404
+ <MapLegendSidebar
405
+ title={props.legends?.title}
406
+ isOpen={isLegendsSidebarOpen}
407
+ toggleSidebar={(): void =>
408
+ setIsLegendsSidebarOpen(!isLegendsSidebarOpen)
409
+ }
410
+ noLegendsText={props.legends?.emptyText}
411
+ legends={props.legends?.legendsList ?? legendsList}
412
+ actionsTexts={props.legends?.actionsTexts}
413
+ />
332
414
  {props.children}
333
- <Box className="sideToolsContainer">
334
- <CesiumSettings
335
- sceneModes={sceneModes as CesiumSceneModeEnum[]}
336
- baseMaps={baseMaps}
337
- locale={locale}
338
- />
339
- </Box>
340
- <Box className="toolsContainer">
341
- {showMousePosition === true ? (
342
- <CoordinatesTrackerTool
343
- projection={projection}
344
- ></CoordinatesTrackerTool>
345
- ) : (
346
- <></>
347
- )}
348
- {showScale === true ? <ScaleTrackerTool locale={locale} /> : <></>}
349
- </Box>
415
+ {bindCustomToolsToViewer()}
350
416
  {props.imageryContextMenu &&
351
417
  showImageryMenu &&
352
418
  imageryMenuPosition &&
@@ -3,7 +3,8 @@
3
3
  gap: 8px;
4
4
  }
5
5
 
6
- .settingsIconContainer {
6
+ .settingsIconContainer,
7
+ .mapLegendToggleContainer {
7
8
  fill: #fff;
8
9
  width: 40px;
9
10
  height: 40px;
@@ -12,7 +13,8 @@
12
13
  border-radius: 4px;
13
14
  }
14
15
 
15
- .settingsIconContainer:hover {
16
+ .settingsIconContainer:hover,
17
+ .mapLegendToggleContainer:hover {
16
18
  background: #48b;
17
19
  border-color: #aef;
18
20
  }
@@ -35,6 +37,7 @@
35
37
  .settingsDialogPortal .mdc-dialog__container {
36
38
  align-items: unset;
37
39
  }
40
+
38
41
  .settingsDialogPortal .mdc-dialog .mdc-dialog__surface {
39
42
  max-height: unset;
40
43
  }
@@ -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();
@@ -4,7 +4,8 @@ body[dir='rtl'] .chonky-fileListWrapper [class^='listContainer-'] {
4
4
 
5
5
  body[dir='rtl']
6
6
  .chonky-fileEntryClickableWrapper
7
- [class^='listFileEntryProperty-'] {
7
+ [class^='listFileEntryProperty-'],
8
+ body[dir='rtl'] .chonky-navbarContainer {
8
9
  direction: ltr !important;
9
10
  }
10
11
 
@@ -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+XRqIhwAj44Z5D9az20b2jGxITA4c91MiJKf5yBFaW9OaBpmZEiIE0ZAeHAtCPPJU2ppguiEI7j0LlYCdY92hcjxwt9iGZkkh0HpfzuiAJtRgRNpUg/GnX247D9oX3UcJQ3ePrEujhWQqQjEXqPPAoJnRD5ShUJpxmPtJF6CKEI2Qgqe0eCK8EIYmLmVzv5LnaLgpvNYxCJ8T6wOxVWTDImIuMx5bMHwbLUZNggUH3W26XTIPSxQpnBecfWHAJHNOH6vMZp1HzdvstWYh5E6aKHrbE6JSAVMWGw7FfQDztRASSEzhJjoO4HSimnaZb+Y5creJCFtpK3htAPqaOunapguJApZoWInAKLokMzAlRNo/tMTnFEhhYdOsNNp66i44WNRsWwmE6dOksASqGn0Tlbni/vI8ywDN3uTR/Z/xuMYF7UO62YSTxPaGSFWvC8e1XuHNZBiCX7NSG2y/oWkevCJWG9rk9PT3f2oZo+zFaSKIjSHKNxsFMuugVUHOJBZc37hwAj2IKEDltUAuwOzv/awJfxKJzOGfG+DYTSFwR6GQNtbw2pGTxb9743EBQpLwrUb6xqUW1E5kHPB987dZRJ4W9rteVD2bDoUqIzyTcyVSmcNaQzVoG+NcpCcy95KrfFVXOiCGeboLQo5VQ/jEJSQlHbl2oKV9lESxxpT2r6MtitbDPWy7NuMmKCkzDfrrmBrvXLtx0t0zR8KUSZAXNUZiLvQ3cEx8tafkqyY+4Uo8kGowqsWNf9VwCZ57XAsfka9RawxbXHlKdSa+NVEZkFW3Y1n6uj4p210tmE5D6Fjd3a2tSPbTUJZbG0ly6XI/+/0lEY4TOdmDL3a8jNeMhUyCA0OGorHR4nntIJ3r2jOxJtTim390y/V3yz7t1jHkdYafh6QE5HYjZj5DzTGjK5n18SehxPoOzhCmMuC82gyHWUELjCxDUBrM+ZsaMFbr/a7NTELiu72uj6KdRzkksq16E9tb3m3onSS0bOHOVvms6F1OYyEyLU0gQ6IthQrUkGQcIhKmVoJ62cdBLTRUDj0/He2v1vvBdEDG7lsDLNGLunKzLeOztpAb5GY6Bu+ArfLIhkeGkgyeHZtZtECJ204O8mSwvBJlhWLP4H
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,72 +0,0 @@
1
- /*
2
- 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
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
- }