@reearth/core 0.0.7-alpha.21 → 0.0.7-alpha.23
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 +1627 -1610
- package/dist/core.umd.cjs +53 -53
- package/package.json +1 -1
- package/src/engines/Cesium/Feature/Resource/utils.ts +21 -10
- package/src/engines/Cesium/core/Imagery.tsx +9 -1
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@ import { Entity, PointGraphics, BillboardGraphics, JulianDate } from "cesium";
|
|
|
2
2
|
|
|
3
3
|
import { EvalFeature } from "../../..";
|
|
4
4
|
import { AppearanceTypes, ComputedFeature, ComputedLayer, Feature } from "../../../../mantle";
|
|
5
|
-
import { heightReference, shadowMode, toColor } from "../../common";
|
|
5
|
+
import { heightReference, shadowMode, toColor, classificationType } from "../../common";
|
|
6
6
|
import { getMarkerCoordinates, getGeometryFromEntity } from "../../helpers/getGeometryFromEntity";
|
|
7
7
|
import { convertEntityDescription, convertEntityProperties } from "../../utils/utils";
|
|
8
8
|
import { attachTag, extractSimpleLayer, getTag, Tag } from "../utils";
|
|
@@ -33,7 +33,7 @@ type EntityAppearanceKey<AName extends SupportedAppearanceKey> = AName extends "
|
|
|
33
33
|
? keyof Pick<Entity, "point" | "billboard" | "label">
|
|
34
34
|
: keyof Pick<Entity, CesiumEntityAppearanceKey>;
|
|
35
35
|
|
|
36
|
-
type AppearancePropertyKeyType = "color" | "heightReference" | "shadows";
|
|
36
|
+
type AppearancePropertyKeyType = "color" | "heightReference" | "shadows" | "classificationType";
|
|
37
37
|
|
|
38
38
|
export function attachProperties<
|
|
39
39
|
AName extends SupportedAppearanceKey,
|
|
@@ -87,6 +87,9 @@ export function attachProperties<
|
|
|
87
87
|
break;
|
|
88
88
|
case "heightReference":
|
|
89
89
|
value = heightReference(value);
|
|
90
|
+
break;
|
|
91
|
+
case "classificationType":
|
|
92
|
+
value = classificationType(value);
|
|
90
93
|
}
|
|
91
94
|
|
|
92
95
|
if (value === (entity[propertyName] as any)[entityPropertyKey]) {
|
|
@@ -160,10 +163,10 @@ export const attachStyle = (
|
|
|
160
163
|
name: "show",
|
|
161
164
|
...(computedFeature?.marker?.style
|
|
162
165
|
? {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
166
|
+
override:
|
|
167
|
+
computedFeature?.marker?.style === "point" &&
|
|
168
|
+
(computedFeature?.marker.show ?? true),
|
|
169
|
+
}
|
|
167
170
|
: {}),
|
|
168
171
|
},
|
|
169
172
|
pixelSize: {
|
|
@@ -199,10 +202,10 @@ export const attachStyle = (
|
|
|
199
202
|
name: "show",
|
|
200
203
|
...(computedFeature?.marker?.style
|
|
201
204
|
? {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
205
|
+
override:
|
|
206
|
+
computedFeature?.marker?.style === "image" &&
|
|
207
|
+
(computedFeature?.marker.show ?? true),
|
|
208
|
+
}
|
|
206
209
|
: {}),
|
|
207
210
|
},
|
|
208
211
|
image: {
|
|
@@ -295,6 +298,10 @@ export const attachStyle = (
|
|
|
295
298
|
clampToGround: {
|
|
296
299
|
name: "clampToGround",
|
|
297
300
|
},
|
|
301
|
+
classificationType: {
|
|
302
|
+
name: "classificationType",
|
|
303
|
+
type: "classificationType",
|
|
304
|
+
},
|
|
298
305
|
});
|
|
299
306
|
}
|
|
300
307
|
return [feature, computedFeature];
|
|
@@ -356,6 +363,10 @@ export const attachStyle = (
|
|
|
356
363
|
extrudedHeight: {
|
|
357
364
|
name: "extrudedHeight",
|
|
358
365
|
},
|
|
366
|
+
classificationType: {
|
|
367
|
+
name: "classificationType",
|
|
368
|
+
type: "classificationType",
|
|
369
|
+
},
|
|
359
370
|
});
|
|
360
371
|
}
|
|
361
372
|
return [feature, computedFeature];
|
|
@@ -113,6 +113,12 @@ export function useImageryProviders({
|
|
|
113
113
|
const tileKeys = tiles.map(t => t.id).join(",");
|
|
114
114
|
const prevTileKeys = useRef(tileKeys);
|
|
115
115
|
const prevProviders = useRef<Providers>({});
|
|
116
|
+
const zoomLevels = useMemo(() => tiles.map(t => {
|
|
117
|
+
if (t.id && t.zoomLevel) return { [t.id]: t.zoomLevel };
|
|
118
|
+
return
|
|
119
|
+
}),
|
|
120
|
+
[tiles]);
|
|
121
|
+
const prevZoomLevels = useRef(zoomLevels);
|
|
116
122
|
|
|
117
123
|
// Manage TileProviders so that TileProvider does not need to be recreated each time tiles are updated.
|
|
118
124
|
const { providers, updated } = useMemo(() => {
|
|
@@ -174,13 +180,15 @@ export function useImageryProviders({
|
|
|
174
180
|
!!added.length ||
|
|
175
181
|
!!isCesiumAccessTokenUpdated ||
|
|
176
182
|
!isEqual(prevTileKeys.current, tileKeys) ||
|
|
183
|
+
!isEqual(prevZoomLevels.current, zoomLevels) ||
|
|
177
184
|
rawProviders.some(p => p.tile && (p.prevType !== p.tile.type || p.prevUrl !== p.tile.url));
|
|
178
185
|
|
|
179
186
|
prevTileKeys.current = tileKeys;
|
|
187
|
+
prevZoomLevels.current = zoomLevels;
|
|
180
188
|
prevCesiumIonAccessToken.current = cesiumIonAccessToken;
|
|
181
189
|
|
|
182
190
|
return { providers, updated };
|
|
183
|
-
}, [cesiumIonAccessToken, tiles, tileKeys, newTile]);
|
|
191
|
+
}, [cesiumIonAccessToken, tiles, tileKeys, newTile, zoomLevels]);
|
|
184
192
|
|
|
185
193
|
prevProviders.current = providers;
|
|
186
194
|
return { providers, updated };
|