From ec9be64a7052f09f27c65699e229e127929392d1 Mon Sep 17 00:00:00 2001 From: Masashi Katsumata Date: Sun, 8 Nov 2026 00:17:20 -0800 Subject: [PATCH] Put ground images and circles in their own ground zIndex bands - Circles shared the polygons' band (3000), so the one added later was on top. Bands now come from overlayStackZ (js-sdk-core): ground image 1000, polygon 2000, circle 3000, polyline 4000. - The ground image rectangle had height 0, which made it an ordinary primitive drawn over every ground primitive, i.e. over the polygons. It is ground geometry in the ground-image band now. - Marker tiles stay an imagery layer (Cesium draws imagery under every ground primitive), but are kept above the app's rasters. Needs the js-sdk-core release with overlayStackZ. --- src/circle/CesiumCircleOverlayRenderer.ts | 6 ++-- .../CesiumGroundImageOverlayRenderer.ts | 6 +++- src/polygon/CesiumPolygonOverlayRenderer.ts | 6 ++-- src/polyline/CesiumPolylineOverlayRenderer.ts | 4 +-- .../CesiumRasterLayerOverlayRenderer.ts | 4 ++- src/zOrder.ts | 28 ++++++++++++------- 6 files changed, 34 insertions(+), 20 deletions(-) diff --git a/src/circle/CesiumCircleOverlayRenderer.ts b/src/circle/CesiumCircleOverlayRenderer.ts index 0568984..c2bf0ac 100644 --- a/src/circle/CesiumCircleOverlayRenderer.ts +++ b/src/circle/CesiumCircleOverlayRenderer.ts @@ -12,7 +12,7 @@ import { CesiumMapViewHolder } from '../CesiumMapViewHolder'; import { toCesiumColor } from '../color'; import { toCartesian3 } from '../helpers'; import { cesiumEntityId } from '../entityId'; -import { CIRCLE_Z_BASE } from '../zOrder'; +import { groundZIndex } from '../zOrder'; export class CesiumCircleOverlayRenderer implements CircleOverlayRenderer { constructor(readonly holder: CesiumMapViewHolder) {} @@ -29,7 +29,7 @@ export class CesiumCircleOverlayRenderer implements CircleOverlayRenderer { constructor(readonly holder: CesiumMapViewHolder) { } @@ -30,7 +31,10 @@ export class CesiumGroundImageOverlayRenderer implements GroundImageOverlayRende // transparent pixels; `color`'s alpha only scales the overall opacity, not // the per-pixel alpha, so both are needed. material: new ImageMaterialProperty({ image: state.imageUrl, color: Color.WHITE.withAlpha(state.opacity), transparent: true }), - height: 0, + // Ground geometry (no height) so Cesium orders it by zIndex with the polygons, circles and + // polylines: under them, in the ground-image band. With `height: 0` it was an ordinary + // primitive drawn after every ground primitive, i.e. over the polygons. + zIndex: groundZIndex('groundImage', 0), }); } } diff --git a/src/polygon/CesiumPolygonOverlayRenderer.ts b/src/polygon/CesiumPolygonOverlayRenderer.ts index 8ef4446..51596fa 100644 --- a/src/polygon/CesiumPolygonOverlayRenderer.ts +++ b/src/polygon/CesiumPolygonOverlayRenderer.ts @@ -4,7 +4,7 @@ import { CesiumMapViewHolder } from '../CesiumMapViewHolder'; import { toCesiumColor } from '../color'; import { pointsToDegrees } from '../helpers'; import { cesiumEntityId } from '../entityId'; -import { POLYGON_Z_BASE } from '../zOrder'; +import { groundZIndex } from '../zOrder'; // Same segment length react-for-arcgis uses for polygons: coarser than // polylines so world-scale rings don't densify into huge geometries. @@ -60,7 +60,7 @@ export class CesiumPolygonOverlayRenderer implements PolygonOverlayRenderer 0 ? new PolylineGraphics({ @@ -73,7 +73,7 @@ export class CesiumPolygonOverlayRenderer implements PolygonOverlayRenderer { constructor(readonly holder: CesiumMapViewHolder) {} @@ -33,7 +33,7 @@ export class CesiumPolylineOverlayRenderer implements PolylineOverlayRenderer