@reearth/core 0.0.7-alpha.12 → 0.0.7-alpha.14

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 CHANGED
@@ -20,7 +20,7 @@ var zm = (t, n, o, s) => ({
20
20
  import * as React from "react";
21
21
  import React__default, { useRef, useCallback, useState, useEffect, useMemo, useImperativeHandle, useContext as useContext$1, useReducer, useDebugValue, createContext, useLayoutEffect, forwardRef, Component as Component$1, isValidElement, createElement, memo as memo$1, Suspense, useInsertionEffect, Fragment, useId } from "react";
22
22
  import * as Cesium$1 from "cesium";
23
- import { Color as Color$3, Math as Math$1, ScreenSpaceEventType, ScreenSpaceEventHandler, BillboardCollection, BillboardGraphics as BillboardGraphics$1, BoxGraphics as BoxGraphics$1, Cesium3DTileset, Cesium3DTilesetGraphics as Cesium3DTilesetGraphics$1, CesiumWidget, ClassificationPrimitive as ClassificationPrimitive$1, CloudCollection, CorridorGraphics as CorridorGraphics$1, CustomDataSource, CylinderGraphics as CylinderGraphics$1, CzmlDataSource, EllipseGraphics as EllipseGraphics$1, EllipsoidGraphics as EllipsoidGraphics$1, Entity as Entity$2, Fog, GeoJsonDataSource, GroundPolylinePrimitive as GroundPolylinePrimitive$1, GroundPrimitive as GroundPrimitive$1, ImageryLayer, KmlDataSource, LabelCollection, LabelGraphics as LabelGraphics$1, Model as Model$1, ModelGraphics as ModelGraphics$1, Moon, ParticleSystem, PathGraphics as PathGraphics$1, PlaneGraphics as PlaneGraphics$1, PointGraphics as PointGraphics$1, PointPrimitiveCollection, PolygonGraphics as PolygonGraphics$1, PolylineCollection, PolylineGraphics as PolylineGraphics$1, PolylineVolumeGraphics as PolylineVolumeGraphics$1, PostProcessStage, PostProcessStageLibrary, PostProcessStageComposite, Primitive as Primitive$1, RectangleGraphics as RectangleGraphics$1, Sun, TimeDynamicPointCloud, Viewer, WallGraphics as WallGraphics$1, SceneMode as SceneMode$2, Event as Event$2, EntityCluster, HorizontalOrigin as HorizontalOrigin$2, VerticalOrigin as VerticalOrigin$2, Cartesian3 as Cartesian3$1, ClockRange, JulianDate as JulianDate$1, ClockStep, CameraEventType, KeyboardEventModifier, Cartesian2 as Cartesian2$1, Ray as Ray$1, Cartographic as Cartographic$1, BoundingSphere as BoundingSphere$1, HeadingPitchRange, Matrix4 as Matrix4$1, PerspectiveFrustum, IntersectionTests as IntersectionTests$1, OrthographicOffCenterFrustum as OrthographicOffCenterFrustum$1, Cesium3DTileColorBlendMode, ShadowMode as ShadowMode$2, Quaternion as Quaternion$1, Matrix3 as Matrix3$1, EllipsoidTerrainProvider, sampleTerrainMostDetailed, Plane as Plane$1, ColorBlendMode, HeightReference as HeightReference$2, ClassificationType as ClassificationType$2, CesiumTerrainProvider, IonResource, ArcGISTiledElevationTerrainProvider, IonImageryProvider, IonWorldImageryStyle, OpenStreetMapImageryProvider, ArcGisMapServerImageryProvider, UrlTemplateImageryProvider, DiscardEmptyTileImagePolicy as DiscardEmptyTileImagePolicy$1, TextureMagnificationFilter as TextureMagnificationFilter$2, TextureMinificationFilter as TextureMinificationFilter$2, SceneTransforms as SceneTransforms$1, WebMercatorTilingScheme as WebMercatorTilingScheme$1, Cesium3DTileFeature, Cesium3DTilePointFeature, PropertyBag as PropertyBag$1, TimeIntervalCollection, TimeInterval, Iso8601, DistanceDisplayCondition, CallbackProperty as CallbackProperty$1, ColorMaterialProperty as ColorMaterialProperty$1, ArcType as ArcType$2, ImageryLayerFeatureInfo, HeadingPitchRoll as HeadingPitchRoll$1, Transforms as Transforms$1, Axis, TranslationRotationScale as TranslationRotationScale$1, PolylineDashMaterialProperty as PolylineDashMaterialProperty$1, PerInstanceColorAppearance as PerInstanceColorAppearance$1, Material as Material$1, VertexFormat as VertexFormat$1, GeometryAttribute as GeometryAttribute$1, ComponentDatatype as ComponentDatatype$2, FrustumGeometry, GeometryInstance as GeometryInstance$1, Rectangle as Rectangle$1, PolygonGeometry, EllipsoidSurfaceAppearance, Intersect as Intersect$2, CustomShader, CustomShaderMode, LightingModel, CustomShaderTranslucencyMode, ImageBasedLighting, EasingFunction, PolygonHierarchy as PolygonHierarchy$1, Credit, WindingOrder as WindingOrder$2, TileMapServiceImageryProvider, WebMapServiceImageryProvider, ClippingPlane, ClippingPlaneCollection, Cesium3DTileStyle, defaultValue as defaultValue$2, Resource as Resource$2, GoogleMaps, Camera, EllipsoidGeodesic as EllipsoidGeodesic$1, PerspectiveOffCenterFrustum, BoundingRectangle as BoundingRectangle$1, Ellipsoid as Ellipsoid$2, SunLight, DirectionalLight, Ion, PostProcessStageSampleMode } from "cesium";
23
+ import { Color as Color$3, Math as Math$1, ScreenSpaceEventType, ScreenSpaceEventHandler, BillboardCollection, BillboardGraphics as BillboardGraphics$1, BoxGraphics as BoxGraphics$1, Cesium3DTileset, Cesium3DTilesetGraphics as Cesium3DTilesetGraphics$1, CesiumWidget, ClassificationPrimitive as ClassificationPrimitive$1, CloudCollection, CorridorGraphics as CorridorGraphics$1, CustomDataSource, CylinderGraphics as CylinderGraphics$1, CzmlDataSource, EllipseGraphics as EllipseGraphics$1, EllipsoidGraphics as EllipsoidGraphics$1, Entity as Entity$2, Fog, GeoJsonDataSource, GroundPolylinePrimitive as GroundPolylinePrimitive$1, GroundPrimitive as GroundPrimitive$1, ImageryLayer, KmlDataSource, LabelCollection, LabelGraphics as LabelGraphics$1, Model as Model$1, ModelGraphics as ModelGraphics$1, Moon, ParticleSystem, PathGraphics as PathGraphics$1, PlaneGraphics as PlaneGraphics$1, PointGraphics as PointGraphics$1, PointPrimitiveCollection, PolygonGraphics as PolygonGraphics$1, PolylineCollection, PolylineGraphics as PolylineGraphics$1, PolylineVolumeGraphics as PolylineVolumeGraphics$1, PostProcessStage, PostProcessStageLibrary, PostProcessStageComposite, Primitive as Primitive$1, RectangleGraphics as RectangleGraphics$1, Sun, TimeDynamicPointCloud, Viewer, WallGraphics as WallGraphics$1, SceneMode as SceneMode$2, Event as Event$2, EntityCluster, HorizontalOrigin as HorizontalOrigin$2, VerticalOrigin as VerticalOrigin$2, Cartesian3 as Cartesian3$1, ClockRange, JulianDate as JulianDate$1, ClockStep, CameraEventType, KeyboardEventModifier, Cartesian2 as Cartesian2$1, Ray as Ray$1, Cartographic as Cartographic$1, BoundingSphere as BoundingSphere$1, HeadingPitchRange, Matrix4 as Matrix4$1, PerspectiveFrustum, IntersectionTests as IntersectionTests$1, OrthographicOffCenterFrustum as OrthographicOffCenterFrustum$1, Cesium3DTileColorBlendMode, ShadowMode as ShadowMode$2, Quaternion as Quaternion$1, Matrix3 as Matrix3$1, EllipsoidTerrainProvider, sampleTerrainMostDetailed, Plane as Plane$1, ColorBlendMode, HeightReference as HeightReference$2, ClassificationType as ClassificationType$2, CesiumTerrainProvider, IonResource, ArcGISTiledElevationTerrainProvider, IonImageryProvider, IonWorldImageryStyle, OpenStreetMapImageryProvider, ArcGisMapServerImageryProvider, UrlTemplateImageryProvider, DiscardEmptyTileImagePolicy as DiscardEmptyTileImagePolicy$1, TextureMagnificationFilter as TextureMagnificationFilter$2, TextureMinificationFilter as TextureMinificationFilter$2, SceneTransforms as SceneTransforms$1, DistanceDisplayCondition, WebMercatorTilingScheme as WebMercatorTilingScheme$1, Cesium3DTileFeature, Cesium3DTilePointFeature, PropertyBag as PropertyBag$1, TimeIntervalCollection, TimeInterval, Iso8601, CallbackProperty as CallbackProperty$1, ColorMaterialProperty as ColorMaterialProperty$1, ArcType as ArcType$2, ImageryLayerFeatureInfo, HeadingPitchRoll as HeadingPitchRoll$1, Transforms as Transforms$1, Axis, TranslationRotationScale as TranslationRotationScale$1, PolylineDashMaterialProperty as PolylineDashMaterialProperty$1, PerInstanceColorAppearance as PerInstanceColorAppearance$1, Material as Material$1, VertexFormat as VertexFormat$1, GeometryAttribute as GeometryAttribute$1, ComponentDatatype as ComponentDatatype$2, FrustumGeometry, GeometryInstance as GeometryInstance$1, Rectangle as Rectangle$1, PolygonGeometry, EllipsoidSurfaceAppearance, Intersect as Intersect$2, CustomShader, CustomShaderMode, LightingModel, CustomShaderTranslucencyMode, ImageBasedLighting, EasingFunction, PolygonHierarchy as PolygonHierarchy$1, Credit, WindingOrder as WindingOrder$2, TileMapServiceImageryProvider, WebMapServiceImageryProvider, ClippingPlane, ClippingPlaneCollection, Cesium3DTileStyle, defaultValue as defaultValue$2, Resource as Resource$2, GoogleMaps, Camera, EllipsoidGeodesic as EllipsoidGeodesic$1, PerspectiveOffCenterFrustum, BoundingRectangle as BoundingRectangle$1, Ellipsoid as Ellipsoid$2, SunLight, DirectionalLight, Ion, PostProcessStageSampleMode } from "cesium";
24
24
  import "react-dom";
25
25
  var commonjsGlobal = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
26
26
  function getDefaultExportFromCjs(t) {
@@ -1067,11 +1067,6 @@ const useImage = (t) => {
1067
1067
  s(n.current);
1068
1068
  }, c.src = t, n.current = c;
1069
1069
  }, [t]), o;
1070
- }, useCanvas = (t) => {
1071
- const n = useMemo(() => document.createElement("canvas"), []), [o, s] = useState("");
1072
- return useEffect(() => {
1073
- t(n), s(n.toDataURL());
1074
- }, [n, t]), o;
1075
1070
  };
1076
1071
  function useFirstMountState() {
1077
1072
  var t = useRef(!0);
@@ -22696,9 +22691,10 @@ const rangeTypes = {
22696
22691
  modifier: KeyboardEventModifier.SHIFT
22697
22692
  }
22698
22693
  ]
22699
- }, layerIdField = "__reearth_layer_id", defaultImageSize = 50, drawIcon = (t, n, o, s, c = "none", d = !1, h = "rgba(0, 0, 0, 0.7)", p = 3, y = 0, E = 0) => {
22700
- const L = t.getContext("2d");
22701
- !n || !L || (L.save(), t.width = o + p, t.height = s + p, L.shadowBlur = p, L.shadowOffsetX = y, L.shadowOffsetY = E, L.globalCompositeOperation = "source-over", L.clearRect(0, 0, t.width, t.height), L.drawImage(n, (t.width - o) / 2, (t.height - s) / 2, o, s), c === "circle" ? (L.fillStyle = "black", L.globalCompositeOperation = "destination-in", L.arc(o / 2, s / 2, Math.min(o, s) / 2, 0, 2 * Math.PI), L.fill(), d && (L.shadowColor = h, L.globalCompositeOperation = "destination-over", L.fillStyle = "black", L.arc(o / 2, s / 2, Math.min(o, s) / 2, 0, 2 * Math.PI), L.fill())) : d && (L.shadowColor = h, L.globalCompositeOperation = "destination-over", L.fillStyle = "black", L.rect((t.width - o) / 2, (t.height - s) / 2, o, s), L.fill()), L.restore());
22694
+ }, layerIdField = "__reearth_layer_id", defaultImageSize = 50, drawIcon = (t, n, o, s = "none", c = !1, d = "rgba(0, 0, 0, 0.7)", h = 3, p = 0, y = 0) => {
22695
+ const E = document.createElement("canvas"), L = E.getContext("2d");
22696
+ if (!(!t || !L))
22697
+ return L.save(), E.width = n + h, E.height = o + h, L.shadowBlur = h, L.shadowOffsetX = p, L.shadowOffsetY = y, L.globalCompositeOperation = "source-over", L.clearRect(0, 0, E.width, E.height), L.drawImage(t, (E.width - n) / 2, (E.height - o) / 2, n, o), s === "circle" ? (L.fillStyle = "black", L.globalCompositeOperation = "destination-in", L.arc(n / 2, o / 2, Math.min(n, o) / 2, 0, 2 * Math.PI), L.fill(), c && (L.shadowColor = d, L.globalCompositeOperation = "destination-over", L.fillStyle = "black", L.arc(n / 2, o / 2, Math.min(n, o) / 2, 0, 2 * Math.PI), L.fill())) : c && (L.shadowColor = d, L.globalCompositeOperation = "destination-over", L.fillStyle = "black", L.rect((E.width - n) / 2, (E.height - o) / 2, n, o), L.fill()), L.restore(), E.toDataURL();
22702
22698
  }, useIcon = ({
22703
22699
  image: t,
22704
22700
  imageSize: n,
@@ -22709,11 +22705,11 @@ const rangeTypes = {
22709
22705
  shadowOffsetX: h,
22710
22706
  shadowOffsetY: p
22711
22707
  }) => {
22712
- const y = useImage(t), E = y ? typeof n == "number" ? Math.floor(y.width * n) : Math.min(defaultImageSize, y.width) : 0, L = y ? Math.floor(typeof n == "number" ? y.height * n : E / y.width * y.height) : 0, F = useCallback(
22713
- (z) => drawIcon(z, y, E, L, o, s, c, d, h, p),
22708
+ const y = useImage(t), E = y ? typeof n == "number" ? Math.floor(y.width * n) : Math.min(defaultImageSize, y.width) : 0, L = y ? Math.floor(typeof n == "number" ? y.height * n : E / y.width * y.height) : 0;
22709
+ return [useMemo(
22710
+ () => drawIcon(y, E, L, o, s, c, d, h, p),
22714
22711
  [o, L, y, s, d, c, h, p, E]
22715
- );
22716
- return [useCanvas(F), E, L];
22712
+ ) ?? "", E, L];
22717
22713
  }, ho$1 = (t) => ({
22718
22714
  left: HorizontalOrigin$2.LEFT,
22719
22715
  center: HorizontalOrigin$2.CENTER,
@@ -62319,84 +62315,87 @@ const JapanGSIOptimalBVmapLabelImagery = memo$1(
62319
62315
  descendants: o,
62320
62316
  height: s = 50,
62321
62317
  style: c = defaultStyle,
62322
- labelCollection: d
62318
+ labelCollection: d,
62319
+ near: h,
62320
+ far: p
62323
62321
  }) => {
62324
- const h = $e$1(), p = suspend(
62322
+ const y = $e$1(), E = suspend(
62325
62323
  async () => await t.tileCache.get(getTileCoords(n, 16)),
62326
62324
  [JapanGSIOptimalBVmapLabelImagery, n.key]
62327
- ), y = useMemo(
62325
+ ), L = useMemo(
62328
62326
  () => t.tilingScheme.tileXYToRectangle(n.x, n.y, n.level),
62329
62327
  [t, n]
62330
- ), E = useMemo(
62328
+ ), F = useMemo(
62331
62329
  () => o == null ? void 0 : o.map(
62332
- (W) => t.tilingScheme.tileXYToRectangle(
62333
- W.x,
62334
- W.y,
62335
- W.level
62330
+ (lt) => t.tilingScheme.tileXYToRectangle(
62331
+ lt.x,
62332
+ lt.y,
62333
+ lt.level
62336
62334
  )
62337
62335
  ),
62338
62336
  [t, o]
62339
- ), L = useMemo(() => {
62340
- const W = p.get("Anno");
62341
- return W == null ? [] : W.filter(
62342
- (nt) => typeof nt.props.vt_code == "number" && // Look for annotations with 3-digits code only.
62337
+ ), N = useMemo(() => {
62338
+ const lt = E.get("Anno");
62339
+ return lt == null ? [] : lt.filter(
62340
+ (Ee) => typeof Ee.props.vt_code == "number" && // Look for annotations with 3-digits code only.
62343
62341
  // https://maps.gsi.go.jp/help/pdf/vector/optbv_featurecodes.pdf
62344
- `${nt.props.vt_code}`.length === 3 && typeof nt.props.vt_text == "string" && (nt.props.vt_arrng == null || typeof nt.props.vt_arrng == "number") && (nt.props.vt_arrngagl == null || typeof nt.props.vt_arrngagl == "number") && // `vt_flag17` property determines the visibility of features inside
62342
+ `${Ee.props.vt_code}`.length === 3 && typeof Ee.props.vt_text == "string" && (Ee.props.vt_arrng == null || typeof Ee.props.vt_arrng == "number") && (Ee.props.vt_arrngagl == null || typeof Ee.props.vt_arrngagl == "number") && // `vt_flag17` property determines the visibility of features inside
62345
62343
  // tiles at level 16.
62346
62344
  // https://maps.gsi.go.jp/help/pdf/vector/optbv_attribute.pdf
62347
- (n.level < 16 || n.level === 16 && nt.props.vt_flag17 !== 2 || n.level === 17 && nt.props.vr_flag17 !== 0)
62345
+ (n.level < 16 || n.level === 16 && Ee.props.vt_flag17 !== 2 || n.level === 17 && Ee.props.vr_flag17 !== 0)
62348
62346
  );
62349
- }, [p, n]), F = useRef(), N = h == null ? void 0 : h.scene, z = useCallback(() => {
62350
- const W = F.current;
62351
- W != null && (W.forEach(([nt, lt]) => {
62352
- var yt;
62353
- const Ee = getPosition(
62347
+ }, [E, n]), z = useRef(), oe = y == null ? void 0 : y.scene, W = useCallback(() => {
62348
+ const lt = z.current;
62349
+ lt != null && (lt.forEach(([Ee, yt]) => {
62350
+ var zi;
62351
+ const pi = getPosition(
62354
62352
  n,
62355
- nt,
62356
- y,
62357
- E,
62353
+ Ee,
62354
+ L,
62355
+ F,
62358
62356
  t.tileCache.tileSize,
62359
62357
  s,
62360
- (yt = N == null ? void 0 : N.globe) == null ? void 0 : yt.ellipsoid,
62358
+ (zi = oe == null ? void 0 : oe.globe) == null ? void 0 : zi.ellipsoid,
62361
62359
  positionScratch$1
62362
62360
  );
62363
- Ee != null ? (lt.position = Ee, lt.show = !0) : lt.show = !1;
62364
- }), N == null || N.requestRender());
62365
- }, [t, n, s, y, E, N]), oe = useRef(z);
62366
- return oe.current = z, useEffect(() => {
62367
- if (!N || !d)
62361
+ pi != null ? (yt.position = pi, yt.show = !0) : yt.show = !1;
62362
+ }), oe == null || oe.requestRender());
62363
+ }, [t, n, s, L, F, oe]), nt = useRef(W);
62364
+ return nt.current = W, useEffect(() => {
62365
+ if (!oe || !d)
62368
62366
  return;
62369
- const W = [], nt = L.map((Ee) => {
62370
- const yt = resolveStyle(Ee.props.vt_code, c);
62371
- if (yt == null)
62367
+ const lt = [], Ee = N.map((pi) => {
62368
+ const zi = resolveStyle(pi.props.vt_code, c);
62369
+ if (zi == null)
62372
62370
  return;
62373
- const pi = Ee.props.vt_text;
62374
- if (W.includes(pi))
62371
+ const ha = pi.props.vt_text;
62372
+ if (lt.includes(ha))
62375
62373
  return;
62376
- W.push(pi);
62377
- const zi = {
62378
- text: pi,
62374
+ lt.push(ha);
62375
+ const ba = {
62376
+ text: ha,
62379
62377
  style: LabelStyle$1.FILL_AND_OUTLINE,
62380
62378
  horizontalOrigin: HorizontalOrigin$1.CENTER,
62381
62379
  verticalOrigin: VerticalOrigin$1.BOTTOM,
62382
62380
  heightReference: HeightReference$1.CLAMP_TO_GROUND,
62381
+ distanceDisplayCondition: h || p ? new DistanceDisplayCondition(h, p) : void 0,
62383
62382
  disableDepthTestDistance: 1 / 0,
62384
- ...yt
62383
+ ...zi
62385
62384
  };
62386
- return [Ee, d.add(zi)];
62385
+ return [pi, d.add(ba)];
62387
62386
  }).filter(isNotNullish);
62388
- F.current = nt, oe.current();
62389
- const lt = () => {
62390
- d.isDestroyed() || nt.forEach(([, Ee]) => {
62391
- d.remove(Ee);
62392
- }), N.isDestroyed() || N == null || N.postRender.removeEventListener(lt);
62387
+ z.current = Ee, nt.current();
62388
+ const yt = () => {
62389
+ d.isDestroyed() || Ee.forEach(([, pi]) => {
62390
+ d.remove(pi);
62391
+ }), oe.isDestroyed() || oe == null || oe.postRender.removeEventListener(yt);
62393
62392
  };
62394
62393
  return () => {
62395
- F.current = void 0, N.isDestroyed() || N == null || N.postRender.addEventListener(lt);
62394
+ z.current = void 0, oe.isDestroyed() || oe == null || oe.postRender.addEventListener(yt);
62396
62395
  };
62397
- }, [c, L, N, d]), useEffect(() => {
62398
- z();
62399
- }, [z]), null;
62396
+ }, [c, N, oe, d, h, p]), useEffect(() => {
62397
+ W();
62398
+ }, [W]), null;
62400
62399
  }
62401
62400
  );
62402
62401
  JapanGSIOptimalBVmapLabelImagery.displayName = "JapanGSIOptimalBVmapLabelImagery";
@@ -62501,54 +62500,60 @@ function getImageriesToRender(t, n) {
62501
62500
  isEqualKeys(y, p.children) || (p.children = y), isEqualKeys(E, p.descendants) || (p.descendants = E);
62502
62501
  }), d.filter((p) => p.children != null && p.children.length < 4);
62503
62502
  }
62504
- const LabelImageryCollection = ({ imageryProvider: t, imageriesAtom: n, style: o, labelCollection: s }) => {
62505
- const c = useAtomValue(n);
62506
- return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: c.map((d) => /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
62503
+ const LabelImageryCollection = ({ imageryProvider: t, imageriesAtom: n, style: o, labelCollection: s, near: c, far: d }) => {
62504
+ const h = useAtomValue(n);
62505
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: h.map((p) => /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
62507
62506
  JapanGSIOptimalBVmapLabelImagery,
62508
62507
  {
62509
62508
  imageryProvider: t,
62510
- imagery: d,
62511
- descendants: d.descendants,
62509
+ imagery: p,
62510
+ descendants: p.descendants,
62512
62511
  style: o,
62513
- labelCollection: s
62514
- }
62515
- ) }, d.key)) });
62516
- }, JapanGSIOptimalBVmapVectorMapLabel = ({ style: t }) => {
62517
- const [n, o] = useState(), s = useCallback((F) => {
62518
- var N;
62519
- o(
62520
- ((N = F == null ? void 0 : F.cesiumElement) == null ? void 0 : N.imageryProvider) instanceof JapanGSIOptimalBVmapLabelImageryProvider ? F.cesiumElement.imageryProvider : void 0
62512
+ labelCollection: s,
62513
+ near: c,
62514
+ far: d
62515
+ }
62516
+ ) }, p.key)) });
62517
+ }, JapanGSIOptimalBVmapVectorMapLabel = ({
62518
+ style: t,
62519
+ near: n,
62520
+ far: o
62521
+ }) => {
62522
+ const [s, c] = useState(), d = useCallback((z) => {
62523
+ var oe;
62524
+ c(
62525
+ ((oe = z == null ? void 0 : z.cesiumElement) == null ? void 0 : oe.imageryProvider) instanceof JapanGSIOptimalBVmapLabelImageryProvider ? z.cesiumElement.imageryProvider : void 0
62521
62526
  );
62522
- }, []), c = useMemo(() => {
62523
- const F = atom([]);
62527
+ }, []), h = useMemo(() => {
62528
+ const z = atom([]);
62524
62529
  return atom(
62525
- (N) => N(F),
62526
- (N, z, oe) => {
62527
- const W = N(F), nt = typeof oe == "function" ? oe(W) : oe;
62528
- W.length !== nt.length && xorBy(W, nt, "key").length > 0 && z(F, nt);
62530
+ (oe) => oe(z),
62531
+ (oe, W, nt) => {
62532
+ const lt = oe(z), Ee = typeof nt == "function" ? nt(lt) : nt;
62533
+ lt.length !== Ee.length && xorBy(lt, Ee, "key").length > 0 && W(z, Ee);
62529
62534
  }
62530
62535
  );
62531
- }, []), d = useSetAtom(c);
62532
- usePreRender((F) => {
62533
- if (n == null)
62536
+ }, []), p = useSetAtom(h);
62537
+ usePreRender((z) => {
62538
+ if (s == null)
62534
62539
  return;
62535
- const N = getImageriesToRender(F, n);
62536
- d(N);
62540
+ const oe = getImageriesToRender(z, s);
62541
+ p(oe);
62537
62542
  });
62538
- const { labelCollection: h, scene: p } = $e$1(), y = useRef(!1), E = useMemo(() => h ?? (p ? new LabelCollection({ scene: p }) : void 0), [p, h]);
62543
+ const { labelCollection: y, scene: E } = $e$1(), L = useRef(!1), F = useMemo(() => y ?? (E ? new LabelCollection({ scene: E }) : void 0), [E, y]);
62539
62544
  useEffect(() => {
62540
- !h && p && !y.current && (p.primitives.add(E), y.current = !0);
62541
- }, [h, E, p]);
62542
- const L = useRef(0);
62543
- return usePreRender((F) => {
62544
- E && L.current !== E._labelsToUpdate.length && (F.requestRender(), L.current = E._labelsToUpdate.length);
62545
+ !y && E && !L.current && (E.primitives.add(F), L.current = !0);
62546
+ }, [y, F, E]);
62547
+ const N = useRef(0);
62548
+ return usePreRender((z) => {
62549
+ F && N.current !== F._labelsToUpdate.length && (z.requestRender(), N.current = F._labelsToUpdate.length);
62545
62550
  }), useEffect(() => () => {
62546
- p != null && p.isDestroyed() || p == null || p.requestRender();
62547
- }, [p]), /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
62551
+ E != null && E.isDestroyed() || E == null || E.requestRender();
62552
+ }, [E]), /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
62548
62553
  /* @__PURE__ */ jsxRuntimeExports.jsx(
62549
62554
  LabelImageryLayer,
62550
62555
  {
62551
- ref: s,
62556
+ ref: d,
62552
62557
  url: "https://cyberjapandata.gsi.go.jp/xyz/optimal_bvmap-v1/{z}/{x}/{y}.pbf",
62553
62558
  tileWidth: 1024,
62554
62559
  tileHeight: 1024,
@@ -62557,13 +62562,15 @@ const LabelImageryCollection = ({ imageryProvider: t, imageriesAtom: n, style: o
62557
62562
  maximumDataLevel: 16
62558
62563
  }
62559
62564
  ),
62560
- n != null && /* @__PURE__ */ jsxRuntimeExports.jsx(
62565
+ s != null && /* @__PURE__ */ jsxRuntimeExports.jsx(
62561
62566
  LabelImageryCollection,
62562
62567
  {
62563
- imageryProvider: n,
62564
- imageriesAtom: c,
62568
+ imageryProvider: s,
62569
+ imageriesAtom: h,
62565
62570
  style: t,
62566
- labelCollection: E
62571
+ labelCollection: F,
62572
+ near: n,
62573
+ far: o
62567
62574
  }
62568
62575
  )
62569
62576
  ] });
@@ -62573,7 +62580,15 @@ const LabelImageryCollection = ({ imageryProvider: t, imageriesAtom: n, style: o
62573
62580
  return null;
62574
62581
  switch (n.labelType) {
62575
62582
  case "japan_gsi_optimal_bvmap":
62576
- return /* @__PURE__ */ jsxRuntimeExports.jsx(JapanGSIOptimalBVmapVectorMapLabel, { style: n.style }, n.id);
62583
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
62584
+ JapanGSIOptimalBVmapVectorMapLabel,
62585
+ {
62586
+ style: n.style,
62587
+ near: n.near,
62588
+ far: n.far
62589
+ },
62590
+ n.id
62591
+ );
62577
62592
  default:
62578
62593
  return null;
62579
62594
  }
@@ -86056,7 +86071,7 @@ function Error$1({ error: t, resetErrorBoundary: n }) {
86056
86071
  /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("button", { style: { color: "#fff" }, onClick: n, children: "Retry" }) })
86057
86072
  ] });
86058
86073
  }
86059
- const version = "0.0.7-alpha.12", useCoreAPI = ({ viewerProperty: t }) => {
86074
+ const version = "0.0.7-alpha.14", useCoreAPI = ({ viewerProperty: t }) => {
86060
86075
  const n = useRef(t);
86061
86076
  n.current = t;
86062
86077
  const o = useMemo(