import { WallGraphics as CesiumWallGraphics } from "cesium"; import { createCesiumComponent, EventkeyMap, Merge, PickCesiumProps } from "../core"; /* @summary `WallGraphics` is a wall visualization for the entity. */ /* @scope WallGraphics can be mounted only inside[Entity](/components/Entity) components, and can not be mounted more than once for each entity. */ export type Target = Merge; export type WallGraphicsCesiumProps = PickCesiumProps; export type WallGraphicsCesiumEvents = { onDefinitionChange?: () => void; }; export type WallGraphicsProps = WallGraphicsCesiumProps & WallGraphicsCesiumEvents; const cesiumProps = [ "positions", "maximumHeights", "minimumHeights", "show", "fill", "material", "outline", "outlineColor", "outlineWidth", "granularity", "shadows", "distanceDisplayCondition", ] as const; export const cesiumEventProps: EventkeyMap = { onDefinitionChange: "definitionChanged", }; const WallGraphics = createCesiumComponent({ name: "WallGraphics", create(context, props) { if (!context.entity) return; const element = new CesiumWallGraphics(props); context.entity.wall = element; return element; }, destroy(_element, context) { if (context.entity) { context.entity.wall = undefined; } }, cesiumProps, cesiumEventProps, }); export default WallGraphics;