@reearth/core 0.0.6 → 0.0.7-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.js +8312 -8318
- package/dist/core.umd.cjs +75 -75
- package/dist/index.d.ts +183 -184
- package/package.json +1 -1
- package/src/Map/ClusteredLayers/index.tsx +2 -2
- package/src/Map/Layer/index.tsx +3 -3
- package/src/Map/Layers/index.tsx +2 -2
- package/src/Map/hooks.ts +0 -4
- package/src/Map/index.tsx +8 -5
- package/src/Map/types/index.ts +5 -182
- package/src/Map/types/viewerProperty.ts +216 -0
- package/src/Map/useTimelineManager.ts +2 -2
- package/src/Map/utils.ts +1 -43
- package/src/Visualizer/coreContext.tsx +1 -8
- package/src/Visualizer/hooks.ts +6 -75
- package/src/Visualizer/index.stories.tsx +4 -48
- package/src/Visualizer/index.tsx +8 -6
- package/src/Visualizer/useCoreAPI.ts +30 -0
- package/src/engines/Cesium/Feature/Ellipse/index.stories.tsx +1 -1
- package/src/engines/Cesium/Feature/Frustum/index.stories.tsx +1 -1
- package/src/engines/Cesium/Feature/Model/index.stories.tsx +1 -1
- package/src/engines/Cesium/Feature/Model/index.tsx +10 -9
- package/src/engines/Cesium/Feature/Polygon/index.stories.tsx +8 -6
- package/src/engines/Cesium/Feature/Raster/index.stories.tsx +2 -2
- package/src/engines/Cesium/Feature/Resource/index.stories.tsx +1 -1
- package/src/engines/Cesium/Feature/Tileset/hooks.ts +12 -11
- package/src/engines/Cesium/Feature/Tileset/index.stories.tsx +1 -1
- package/src/engines/Cesium/Feature/Tileset/index.tsx +4 -4
- package/src/engines/Cesium/Feature/index.tsx +5 -4
- package/src/engines/Cesium/Feature/utils.tsx +2 -2
- package/src/engines/Cesium/core/Globe.tsx +36 -68
- package/src/engines/Cesium/core/Imagery.test.ts +9 -9
- package/src/engines/Cesium/core/Imagery.tsx +17 -19
- package/src/engines/Cesium/core/Indicator/Indicator.tsx +8 -8
- package/src/engines/Cesium/hooks/useCamera.ts +144 -0
- package/src/engines/Cesium/{cameraLimiter.ts → hooks/useCameraLimiter.ts} +22 -45
- package/src/engines/Cesium/{useEngineRef.test.tsx → hooks/useEngineRef.test.tsx} +14 -10
- package/src/engines/Cesium/{useEngineRef.ts → hooks/useEngineRef.ts} +17 -17
- package/src/engines/Cesium/hooks/useExplicitRender.ts +65 -0
- package/src/engines/Cesium/hooks/useLayerDragDrop.ts +77 -0
- package/src/engines/Cesium/{VertexTerrainElevationMaterial.ts → hooks/useOverrideGlobeShader/VertexTerrainElevationMaterial.ts} +3 -2
- package/src/engines/Cesium/{useOverrideGlobeShader.ts → hooks/useOverrideGlobeShader/useOverrideGlobeShader.ts} +19 -16
- package/src/engines/Cesium/hooks/useViewerProperty.ts +90 -0
- package/src/engines/Cesium/hooks.ts +117 -353
- package/src/engines/Cesium/index.stories.tsx +1 -1
- package/src/engines/Cesium/index.tsx +48 -50
- package/src/engines/index.ts +1 -1
- /package/src/engines/Cesium/{JapanSeaLevelEllipsoid.ts → hooks/useOverrideGlobeShader/JapanSeaLevelEllipsoid.ts} +0 -0
- /package/src/engines/Cesium/{vertexTerrainElevationMaterial.glsl → hooks/useOverrideGlobeShader/vertexTerrainElevationMaterial.glsl} +0 -0
package/src/Map/index.tsx
CHANGED
|
@@ -8,7 +8,7 @@ import Sketch, { SketchProps } from "./Sketch";
|
|
|
8
8
|
import type { Engine, EngineProps } from "./types";
|
|
9
9
|
|
|
10
10
|
export * from "./types";
|
|
11
|
-
export { useGet, type WrappedRef, type Undefinable
|
|
11
|
+
export { useGet, type WrappedRef, type Undefinable } from "./utils";
|
|
12
12
|
|
|
13
13
|
export type {
|
|
14
14
|
NaiveLayer,
|
|
@@ -36,7 +36,12 @@ export type Props = {
|
|
|
36
36
|
engine?: string;
|
|
37
37
|
} & Omit<
|
|
38
38
|
LayersProps,
|
|
39
|
-
|
|
39
|
+
| "Feature"
|
|
40
|
+
| "clusterComponent"
|
|
41
|
+
| "selectionReason"
|
|
42
|
+
| "delegatedDataTypes"
|
|
43
|
+
| "selectedLayerId"
|
|
44
|
+
| "viewerProperty"
|
|
40
45
|
> &
|
|
41
46
|
Omit<EngineProps, "onLayerSelect" | "layerSelectionReason" | "selectedLayerId"> &
|
|
42
47
|
Omit<SketchProps, "layersRef" | "engineRef" | "SketchComponent"> & {
|
|
@@ -54,7 +59,6 @@ function MapFn(
|
|
|
54
59
|
layers,
|
|
55
60
|
overrides,
|
|
56
61
|
timelineManagerRef,
|
|
57
|
-
sceneProperty,
|
|
58
62
|
interactionMode,
|
|
59
63
|
selectedFeature,
|
|
60
64
|
cursor,
|
|
@@ -80,7 +84,6 @@ function MapFn(
|
|
|
80
84
|
handleEngineLayerSelect,
|
|
81
85
|
} = useHooks({
|
|
82
86
|
ref,
|
|
83
|
-
sceneProperty,
|
|
84
87
|
timelineManagerRef,
|
|
85
88
|
cursor,
|
|
86
89
|
onLayerSelect,
|
|
@@ -123,7 +126,7 @@ function MapFn(
|
|
|
123
126
|
clusterComponent={currentEngine?.clusterComponent}
|
|
124
127
|
delegatedDataTypes={currentEngine.delegatedDataTypes}
|
|
125
128
|
meta={props.meta}
|
|
126
|
-
|
|
129
|
+
viewerProperty={props.property}
|
|
127
130
|
requestingRenderMode={requestingRenderMode}
|
|
128
131
|
onLayerSelect={handleLayerSelect}
|
|
129
132
|
/>
|
package/src/Map/types/index.ts
CHANGED
|
@@ -22,7 +22,6 @@ import type {
|
|
|
22
22
|
Feature,
|
|
23
23
|
ComputedFeature,
|
|
24
24
|
CameraPosition,
|
|
25
|
-
LUT,
|
|
26
25
|
} from "../../mantle";
|
|
27
26
|
import type {
|
|
28
27
|
CameraOptions,
|
|
@@ -43,6 +42,8 @@ import { SketchComponentType } from "../Sketch";
|
|
|
43
42
|
import { SketchAppearance, SketchType } from "../Sketch/types";
|
|
44
43
|
import type { TimelineManagerRef } from "../useTimelineManager";
|
|
45
44
|
|
|
45
|
+
import type { SceneMode, ViewerProperty } from "./viewerProperty";
|
|
46
|
+
|
|
46
47
|
export type {
|
|
47
48
|
FeatureComponentProps,
|
|
48
49
|
FeatureComponentType,
|
|
@@ -72,6 +73,7 @@ export type {
|
|
|
72
73
|
ValueType,
|
|
73
74
|
} from "../../mantle";
|
|
74
75
|
export * from "./event";
|
|
76
|
+
export * from "./viewerProperty";
|
|
75
77
|
|
|
76
78
|
export type EngineRef = {
|
|
77
79
|
name: string;
|
|
@@ -202,7 +204,8 @@ export type EngineProps = {
|
|
|
202
204
|
style?: CSSProperties;
|
|
203
205
|
isEditable?: boolean;
|
|
204
206
|
isBuilt?: boolean;
|
|
205
|
-
property?:
|
|
207
|
+
property?: ViewerProperty;
|
|
208
|
+
time?: string | Date;
|
|
206
209
|
camera?: Camera;
|
|
207
210
|
cameraForceHorizontalRoll?: boolean;
|
|
208
211
|
small?: boolean;
|
|
@@ -339,186 +342,6 @@ export type MouseEventCallbacks = { [key in keyof MouseEvents]: MouseEvents[key]
|
|
|
339
342
|
export type TickEvent = (cb: TickEventCallback) => void;
|
|
340
343
|
export type TickEventCallback = (current: Date, clock: { start: Date; stop: Date }) => void;
|
|
341
344
|
|
|
342
|
-
export type SceneMode = "3d" | "2d" | "columbus";
|
|
343
|
-
export type IndicatorTypes = "default" | "crosshair" | "custom";
|
|
344
|
-
|
|
345
|
-
export type TerrainProperty = {
|
|
346
|
-
terrain?: boolean;
|
|
347
|
-
terrainType?: "cesium" | "arcgis" | "cesiumion"; // default: cesium
|
|
348
|
-
terrainExaggeration?: number; // default: 1
|
|
349
|
-
terrainExaggerationRelativeHeight?: number; // default: 0
|
|
350
|
-
depthTestAgainstTerrain?: boolean;
|
|
351
|
-
terrainCesiumIonAsset?: string;
|
|
352
|
-
terrainCesiumIonAccessToken?: string;
|
|
353
|
-
terrainCesiumIonUrl?: string;
|
|
354
|
-
terrainUrl?: string;
|
|
355
|
-
terrainNormal?: boolean;
|
|
356
|
-
// TODO: Add encode option
|
|
357
|
-
// Need to specify a tile from `tiles` option with `heatmap` option.
|
|
358
|
-
heatmapType?: "custom"; // TODO: Support Cesium's terrain heatmap as built-in: https://sandcastle.cesium.com/?src=Globe%20Materials.html
|
|
359
|
-
heatmapColorLUT?: LUT;
|
|
360
|
-
heatmapMinHeight?: number;
|
|
361
|
-
heatmapMaxHeight?: number;
|
|
362
|
-
heatmapLogarithmic?: boolean;
|
|
363
|
-
};
|
|
364
|
-
|
|
365
|
-
export type SceneProperty = {
|
|
366
|
-
main?: {
|
|
367
|
-
sceneMode?: SceneMode; // default: scene3d
|
|
368
|
-
ion?: string;
|
|
369
|
-
vr?: boolean;
|
|
370
|
-
};
|
|
371
|
-
tiles?: {
|
|
372
|
-
id: string;
|
|
373
|
-
tile_type?: string;
|
|
374
|
-
tile_url?: string;
|
|
375
|
-
tile_zoomLevel?: number[];
|
|
376
|
-
tile_zoomLevelForURL?: number[];
|
|
377
|
-
tile_opacity?: number;
|
|
378
|
-
heatmap?: boolean;
|
|
379
|
-
}[];
|
|
380
|
-
tileLabels?: {
|
|
381
|
-
id: string;
|
|
382
|
-
labelType: "japan_gsi_optimal_bvmap"; // | "other_map"
|
|
383
|
-
style: Record<string, any>; // Function isn't allowed
|
|
384
|
-
}[];
|
|
385
|
-
terrain?: {
|
|
386
|
-
terrain?: boolean;
|
|
387
|
-
terrainType?: "cesium" | "arcgis" | "cesiumion"; // default: cesium
|
|
388
|
-
terrainCesiumIonAsset?: string;
|
|
389
|
-
terrainCesiumIonAccessToken?: string;
|
|
390
|
-
terrainCesiumIonUrl?: string;
|
|
391
|
-
terrainExaggeration?: number; // default: 1
|
|
392
|
-
terrainExaggerationRelativeHeight?: number; // default: 0
|
|
393
|
-
depthTestAgainstTerrain?: boolean;
|
|
394
|
-
};
|
|
395
|
-
globeLighting?: {
|
|
396
|
-
globeLighting?: boolean;
|
|
397
|
-
};
|
|
398
|
-
globeShadow?: {
|
|
399
|
-
globeShadow?: boolean;
|
|
400
|
-
};
|
|
401
|
-
globeAtmosphere?: {
|
|
402
|
-
globeAtmosphere?: boolean;
|
|
403
|
-
globeAtmosphereIntensity?: number; // default: 10
|
|
404
|
-
};
|
|
405
|
-
skyBox?: {
|
|
406
|
-
skyBox?: boolean;
|
|
407
|
-
};
|
|
408
|
-
sun?: {
|
|
409
|
-
sun?: boolean;
|
|
410
|
-
};
|
|
411
|
-
moon?: {
|
|
412
|
-
moon?: boolean;
|
|
413
|
-
};
|
|
414
|
-
skyAtmosphere?: {
|
|
415
|
-
skyAtmosphere?: boolean;
|
|
416
|
-
skyAtmosphereIntensity?: number; // default: 50
|
|
417
|
-
};
|
|
418
|
-
camera?: {
|
|
419
|
-
camera?: Camera;
|
|
420
|
-
allowEnterGround?: boolean;
|
|
421
|
-
fov?: number;
|
|
422
|
-
};
|
|
423
|
-
render?: { showWireframe?: boolean };
|
|
424
|
-
} & LegacySceneProperty;
|
|
425
|
-
|
|
426
|
-
type LegacySceneProperty = {
|
|
427
|
-
default?: {
|
|
428
|
-
camera?: Camera;
|
|
429
|
-
allowEnterGround?: boolean;
|
|
430
|
-
skybox?: boolean;
|
|
431
|
-
bgcolor?: string;
|
|
432
|
-
ion?: string;
|
|
433
|
-
sceneMode?: SceneMode; // default: scene3d
|
|
434
|
-
vr?: boolean;
|
|
435
|
-
} & TerrainProperty; // compat
|
|
436
|
-
cameraLimiter?: {
|
|
437
|
-
cameraLimitterEnabled?: boolean;
|
|
438
|
-
cameraLimitterShowHelper?: boolean;
|
|
439
|
-
cameraLimitterTargetArea?: Camera;
|
|
440
|
-
cameraLimitterTargetWidth?: number;
|
|
441
|
-
cameraLimitterTargetLength?: number;
|
|
442
|
-
};
|
|
443
|
-
indicator?: {
|
|
444
|
-
indicator_type: IndicatorTypes;
|
|
445
|
-
indicator_image?: string;
|
|
446
|
-
indicator_image_scale?: number;
|
|
447
|
-
};
|
|
448
|
-
tiles?: {
|
|
449
|
-
id: string;
|
|
450
|
-
tile_type?: string;
|
|
451
|
-
tile_url?: string;
|
|
452
|
-
tile_zoomLevel?: number[];
|
|
453
|
-
tile_opacity?: number;
|
|
454
|
-
}[];
|
|
455
|
-
terrain?: TerrainProperty;
|
|
456
|
-
atmosphere?: {
|
|
457
|
-
enable_sun?: boolean;
|
|
458
|
-
enableMoon?: boolean;
|
|
459
|
-
enable_lighting?: boolean;
|
|
460
|
-
ground_atmosphere?: boolean;
|
|
461
|
-
sky_atmosphere?: boolean;
|
|
462
|
-
shadows?: boolean;
|
|
463
|
-
shadowResolution?: 1024 | 2048 | 4096;
|
|
464
|
-
softShadow?: boolean;
|
|
465
|
-
shadowDarkness?: number;
|
|
466
|
-
shadowMaximumDistance?: number;
|
|
467
|
-
fog?: boolean;
|
|
468
|
-
fog_density?: number;
|
|
469
|
-
hue_shift?: number;
|
|
470
|
-
brightness_shift?: number;
|
|
471
|
-
surturation_shift?: number;
|
|
472
|
-
skyboxBrightnessShift?: number;
|
|
473
|
-
skyboxSurturationShift?: number;
|
|
474
|
-
globeShadowDarkness?: number;
|
|
475
|
-
globeImageBasedLighting?: boolean;
|
|
476
|
-
globeBaseColor?: string;
|
|
477
|
-
};
|
|
478
|
-
timeline?: {
|
|
479
|
-
animation?: boolean;
|
|
480
|
-
visible?: boolean;
|
|
481
|
-
current?: string;
|
|
482
|
-
start?: string;
|
|
483
|
-
stop?: string;
|
|
484
|
-
stepType?: "rate" | "fixed";
|
|
485
|
-
multiplier?: number;
|
|
486
|
-
step?: number;
|
|
487
|
-
rangeType?: "unbounded" | "clamped" | "bounced";
|
|
488
|
-
};
|
|
489
|
-
googleAnalytics?: {
|
|
490
|
-
enableGA?: boolean;
|
|
491
|
-
trackingId?: string;
|
|
492
|
-
};
|
|
493
|
-
theme?: {
|
|
494
|
-
themeType?: "light" | "dark" | "forest" | "custom";
|
|
495
|
-
themeTextColor?: string;
|
|
496
|
-
themeSelectColor?: string;
|
|
497
|
-
themeBackgroundColor?: string;
|
|
498
|
-
};
|
|
499
|
-
ambientOcclusion?: {
|
|
500
|
-
enabled?: boolean;
|
|
501
|
-
quality?: "low" | "medium" | "high" | "extreme";
|
|
502
|
-
intensity?: number;
|
|
503
|
-
ambientOcclusionOnly?: boolean;
|
|
504
|
-
};
|
|
505
|
-
light?: {
|
|
506
|
-
lightType?: "sunLight" | "directionalLight";
|
|
507
|
-
lightDirectionX?: number;
|
|
508
|
-
lightDirectionY?: number;
|
|
509
|
-
lightDirectionZ?: number;
|
|
510
|
-
lightColor?: string;
|
|
511
|
-
lightIntensity?: number;
|
|
512
|
-
specularEnvironmentMaps?: string;
|
|
513
|
-
sphericalHarmonicCoefficients?: [x: number, y: number, z: number][];
|
|
514
|
-
imageBasedLightIntensity?: number;
|
|
515
|
-
};
|
|
516
|
-
render?: {
|
|
517
|
-
antialias?: "low" | "medium" | "high" | "extreme";
|
|
518
|
-
debugFramePerSecond?: boolean;
|
|
519
|
-
};
|
|
520
|
-
};
|
|
521
|
-
|
|
522
345
|
export type EngineComponent = ForwardRefExoticComponent<
|
|
523
346
|
PropsWithoutRef<EngineProps> & RefAttributes<EngineRef>
|
|
524
347
|
>;
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* ViewerProperty Interface
|
|
3
|
+
* ------------------------
|
|
4
|
+
* The ViewerProperty interface defines a collection of sub-properties that represent different aspects of the viewer component.
|
|
5
|
+
* Each sub-property encapsulates specific settings and configurations related to the viewer's behavior and appearance.
|
|
6
|
+
|
|
7
|
+
* GlobeProperty: Settings related to the globe visualization, such as base color, lighting, and atmosphere.
|
|
8
|
+
* TerrainProperty: Configuration options for terrain visualization, including terrain type, height map, and normal mapping.
|
|
9
|
+
* SceneProperty: Scene-specific settings, such as background color, scene mode, vertical exaggeration, and lighting.
|
|
10
|
+
* TilesProperty: Properties for managing tile layers, including URLs, opacity, zoom levels, and heatmap settings.
|
|
11
|
+
* TileLabelProperty: Properties for managing tile labels, such as label type and style.
|
|
12
|
+
* SkyProperty: Settings for sky visualization, including skybox, sun, moon, fog, and sky atmosphere.
|
|
13
|
+
* CameraProperty: Camera-related settings, such as camera position, limiter, and ground entry.
|
|
14
|
+
* RenderProperty: Rendering settings, such as antialiasing and ambient occlusion.
|
|
15
|
+
* IndicatorProperty: Properties for customizing the viewer's indicator, such as type and image.
|
|
16
|
+
* AssetsProperty: Asset-related settings, such as access tokens and URLs for external assets.
|
|
17
|
+
* DebugProperty: Debugging options, such as wireframe display and FPS counter.
|
|
18
|
+
|
|
19
|
+
* Guidelines for Adding New Properties
|
|
20
|
+
* ------------------------------------
|
|
21
|
+
* When adding new properties to the ViewerProperty interface, follow these steps to ensure consistency and maintainability:
|
|
22
|
+
* 1. Determine the Appropriate Category: Identify the aspect of the viewer your new property will affect and choose the most relevant existing sub-property type (e.g., GlobeProperty, TerrainProperty, SceneProperty, etc.). If your property does not fit into an existing category, consider creating a new sub-property type.
|
|
23
|
+
* 2. Define the New Property: Add your new property to the chosen sub-property type. Ensure that the property name is descriptive and the type is correctly specified. If your property requires complex structures, define new types as needed.
|
|
24
|
+
* 3. Maintain Optional Properties: To keep the interface flexible, add new properties as optional (?) unless they are strictly required.
|
|
25
|
+
* 4. Follow Naming Rules:
|
|
26
|
+
* - Use CamelCase for property names.
|
|
27
|
+
* - Keep property names descriptive but concise.
|
|
28
|
+
* - Maintain consistency with existing naming patterns.
|
|
29
|
+
* - Avoid abbreviations unless widely understood and standard.
|
|
30
|
+
* 5. Document the Property: Add comments or documentation to describe the purpose and usage of the new property. This will help other developers understand its function and how to use it.
|
|
31
|
+
* 6. Update Usage Examples: If applicable, update any example configurations or documentation to include the new property, demonstrating how it should be used.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
import type { LUT, Camera } from "../../mantle";
|
|
35
|
+
|
|
36
|
+
export type SceneMode = "3d" | "2d" | "columbus";
|
|
37
|
+
|
|
38
|
+
export type ViewerProperty = {
|
|
39
|
+
globe?: GlobeProperty;
|
|
40
|
+
terrain?: TerrainProperty;
|
|
41
|
+
scene?: SceneProperty;
|
|
42
|
+
tiles?: TileProperty[];
|
|
43
|
+
tileLabels?: TileLabelProperty[];
|
|
44
|
+
sky?: SkyProperty;
|
|
45
|
+
camera?: CameraProperty;
|
|
46
|
+
render?: RenderPeropty;
|
|
47
|
+
assets?: AssetsProperty; // anything related to specific assets and its access tokens
|
|
48
|
+
debug?: DebugProperty;
|
|
49
|
+
indicator?: IndicatorProperty; // consider remove this if not needed in the future
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export type GlobeProperty = {
|
|
53
|
+
baseColor?: string;
|
|
54
|
+
enableLighting?: boolean;
|
|
55
|
+
atmosphere?: GlobeAtmosphereProperty;
|
|
56
|
+
depthTestAgainstTerrain?: boolean;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export type GlobeAtmosphereProperty = {
|
|
60
|
+
enabled?: boolean;
|
|
61
|
+
lightIntensity?: number;
|
|
62
|
+
brightnessShift?: number;
|
|
63
|
+
hueShift?: number;
|
|
64
|
+
saturationShift?: number;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export type TerrainProperty = {
|
|
68
|
+
enabled?: boolean;
|
|
69
|
+
type?: "cesium" | "arcgis" | "cesiumion";
|
|
70
|
+
url?: string;
|
|
71
|
+
normal?: boolean;
|
|
72
|
+
heightMap?: HeightMapProperty;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export type HeightMapProperty = {
|
|
76
|
+
type?: "custom";
|
|
77
|
+
colorLUT?: LUT;
|
|
78
|
+
minHeight?: number;
|
|
79
|
+
maxHeight?: number;
|
|
80
|
+
logarithmic?: boolean;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export type SceneProperty = {
|
|
84
|
+
backgroundColor?: string;
|
|
85
|
+
mode?: SceneMode;
|
|
86
|
+
verticalExaggeration?: number;
|
|
87
|
+
verticalExaggerationRelativeHeight?: number;
|
|
88
|
+
vr?: boolean;
|
|
89
|
+
light?: LightProperty;
|
|
90
|
+
shadow?: ShadowProperty;
|
|
91
|
+
imageBasedLighting?: ImageBasedLighting;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export type LightProperty = {
|
|
95
|
+
type?: "sunLight" | "directionalLight";
|
|
96
|
+
direction?: [x: number, y: number, z: number];
|
|
97
|
+
color?: string;
|
|
98
|
+
intensity?: number;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export type ShadowProperty = {
|
|
102
|
+
enabled?: boolean;
|
|
103
|
+
darkness?: number;
|
|
104
|
+
shadowMap?: ShadowMapProperty;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export type ShadowMapProperty = {
|
|
108
|
+
size?: 1024 | 2048 | 4096;
|
|
109
|
+
softShadows?: boolean;
|
|
110
|
+
darkness?: number;
|
|
111
|
+
maximumDistance?: number;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export type ImageBasedLighting = {
|
|
115
|
+
enabled?: boolean;
|
|
116
|
+
intensity?: number;
|
|
117
|
+
specularEnvironmentMaps?: string;
|
|
118
|
+
sphericalHarmonicCoefficients?: [number, number, number][];
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export type TileProperty = {
|
|
122
|
+
id: string;
|
|
123
|
+
type?: string;
|
|
124
|
+
url?: string;
|
|
125
|
+
opacity?: number;
|
|
126
|
+
zoomLevel?: number[];
|
|
127
|
+
zoomLevelForURL?: number[];
|
|
128
|
+
heatmap?: boolean;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export type TileLabelProperty = {
|
|
132
|
+
id: string;
|
|
133
|
+
labelType: "japan_gsi_optimal_bvmap";
|
|
134
|
+
style: Record<string, any>;
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
export type SkyProperty = {
|
|
138
|
+
skyBox?: SkyBoxProperty;
|
|
139
|
+
sun?: SunProperty;
|
|
140
|
+
moon?: MoonProperty;
|
|
141
|
+
fog?: FogProperty;
|
|
142
|
+
skyAtmosphere?: SkyAtmosphereProperty;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
export type SkyBoxProperty = {
|
|
146
|
+
show?: boolean;
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export type SunProperty = {
|
|
150
|
+
show?: boolean;
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
export type MoonProperty = {
|
|
154
|
+
show?: boolean;
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
export type FogProperty = {
|
|
158
|
+
enabled?: boolean;
|
|
159
|
+
density?: number;
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
export type SkyAtmosphereProperty = {
|
|
163
|
+
show?: boolean;
|
|
164
|
+
lightIntensity?: number;
|
|
165
|
+
saturationShift?: number;
|
|
166
|
+
brightnessShift?: number;
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
export type CameraProperty = {
|
|
170
|
+
camera?: Camera;
|
|
171
|
+
allowEnterGround?: boolean;
|
|
172
|
+
limiter?: CameraLimiterProperty;
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
export type CameraLimiterProperty = {
|
|
176
|
+
enabled?: boolean;
|
|
177
|
+
targetArea?: Camera;
|
|
178
|
+
targetWidth?: number;
|
|
179
|
+
targetLength?: number;
|
|
180
|
+
showHelper?: boolean;
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
export type RenderPeropty = {
|
|
184
|
+
antialias?: "low" | "medium" | "high" | "extreme";
|
|
185
|
+
ambientOcclusion?: AmbientOcclusionProperty;
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
export type AmbientOcclusionProperty = {
|
|
189
|
+
enabled?: boolean;
|
|
190
|
+
quality?: "low" | "medium" | "high" | "extreme";
|
|
191
|
+
intensity?: number;
|
|
192
|
+
ambientOcclusionOnly?: boolean;
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
export type IndicatorProperty = {
|
|
196
|
+
type?: "default" | "crosshair" | "custom";
|
|
197
|
+
image?: string;
|
|
198
|
+
imageScale?: number;
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
export type AssetsProperty = {
|
|
202
|
+
cesium?: AssetsCesiumProperty;
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
export type AssetsCesiumProperty = {
|
|
206
|
+
terrian?: {
|
|
207
|
+
ionAccessToken?: string;
|
|
208
|
+
ionAsset?: string;
|
|
209
|
+
ionUrl?: string;
|
|
210
|
+
};
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
export type DebugProperty = {
|
|
214
|
+
showGlobeWireframe?: boolean;
|
|
215
|
+
showFramesPerSecond?: boolean;
|
|
216
|
+
};
|
|
@@ -62,12 +62,12 @@ export type TimelineCommit = (PlayCommand | PauseCommand | SetTimeCommand | SetO
|
|
|
62
62
|
|
|
63
63
|
export type TimelineCommitter = {
|
|
64
64
|
source:
|
|
65
|
-
| "overrideSceneProperty"
|
|
66
65
|
| "widgetContext"
|
|
67
66
|
| "pluginAPI"
|
|
68
67
|
| "featureResource"
|
|
69
68
|
| "storyTimelineBlock"
|
|
70
|
-
| "storyPage"
|
|
69
|
+
| "storyPage"
|
|
70
|
+
| "initialize";
|
|
71
71
|
id?: string;
|
|
72
72
|
};
|
|
73
73
|
|
package/src/Map/utils.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type RefObject, useCallback, useRef, useState, useMemo } from "react";
|
|
1
|
+
import { type RefObject, useCallback, useRef } from "react";
|
|
3
2
|
|
|
4
3
|
export function useGet<T>(value: T): () => T {
|
|
5
4
|
const ref = useRef<T>(value);
|
|
@@ -15,47 +14,6 @@ export function wrapRef<T>(ref: RefObject<T>, keys: FunctionKeys<T>): WrappedRef
|
|
|
15
14
|
) as WrappedRef<T>;
|
|
16
15
|
}
|
|
17
16
|
|
|
18
|
-
export function mergeProperty(a: any, b: any) {
|
|
19
|
-
const a2 = cloneDeep(a);
|
|
20
|
-
return mergeWith(
|
|
21
|
-
a2,
|
|
22
|
-
b,
|
|
23
|
-
(
|
|
24
|
-
s: any,
|
|
25
|
-
v: any,
|
|
26
|
-
_k: string | number | symbol,
|
|
27
|
-
_obj: any,
|
|
28
|
-
_src: any,
|
|
29
|
-
stack: { size: number },
|
|
30
|
-
) => (stack.size > 0 || Array.isArray(v) ? v ?? s : undefined),
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export function useOverriddenProperty<T extends {}>(
|
|
35
|
-
property: T | undefined,
|
|
36
|
-
): [T, (pluginId: string, property: T) => void] {
|
|
37
|
-
const [overriddenProperties, setOverrideProperty] = useState<{
|
|
38
|
-
[pluginId: string]: any;
|
|
39
|
-
}>({});
|
|
40
|
-
const { overriddenPropertyCommon, overriddenProperty } = useMemo(() => {
|
|
41
|
-
const { "": overriddenPropertyCommon, ...overriddenProperty } = overriddenProperties;
|
|
42
|
-
return { overriddenPropertyCommon, overriddenProperty };
|
|
43
|
-
}, [overriddenProperties]);
|
|
44
|
-
|
|
45
|
-
const overrideProperty = useCallback((pluginId: string, property: any) => {
|
|
46
|
-
setOverrideProperty(p => (property ? { ...p, [pluginId || ""]: property } : omit(p, pluginId)));
|
|
47
|
-
}, []);
|
|
48
|
-
|
|
49
|
-
const mergedProperty = useMemo(() => {
|
|
50
|
-
return [overriddenPropertyCommon, ...Object.values(overriddenProperty)].reduce(
|
|
51
|
-
(p, v) => mergeProperty(p, v),
|
|
52
|
-
property,
|
|
53
|
-
);
|
|
54
|
-
}, [property, overriddenPropertyCommon, overriddenProperty]);
|
|
55
|
-
|
|
56
|
-
return [mergedProperty, overrideProperty];
|
|
57
|
-
}
|
|
58
|
-
|
|
59
17
|
export type FunctionKeys<T> = {
|
|
60
18
|
[P in keyof T as T[P] extends (...args: any[]) => any ? P : never]: 1;
|
|
61
19
|
};
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { createContext } from "react";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
LayerEditEvent,
|
|
5
|
-
LayerSelectionReason,
|
|
6
|
-
LayerVisibilityEvent,
|
|
7
|
-
SceneProperty,
|
|
8
|
-
} from "../engines";
|
|
3
|
+
import { LayerEditEvent, LayerSelectionReason, LayerVisibilityEvent } from "../engines";
|
|
9
4
|
import { ComputedFeature, ComputedLayer } from "../mantle";
|
|
10
5
|
import {
|
|
11
6
|
LayerLoadEvent,
|
|
@@ -28,8 +23,6 @@ type CoreContext = {
|
|
|
28
23
|
};
|
|
29
24
|
selectedComputedFeature?: ComputedFeature | undefined;
|
|
30
25
|
viewport?: Viewport;
|
|
31
|
-
overriddenSceneProperty?: SceneProperty;
|
|
32
|
-
overrideSceneProperty?: (pluginId: string, property: SceneProperty) => void;
|
|
33
26
|
handleCameraForceHorizontalRollChange?: (enable?: boolean) => void;
|
|
34
27
|
handleInteractionModeChange?: (mode?: InteractionModeType | undefined) => void;
|
|
35
28
|
onSketchPluginFeatureCreate?: (cb: SketchEventCallback) => void;
|