From a9aeeb1a19e470ecf6cbf4ea086f3a7ffcbef4b3 Mon Sep 17 00:00:00 2001 From: mkumbobeaty Date: Sun, 22 Dec 2024 22:15:01 +0300 Subject: [PATCH] support clasication type in resource --- src/engines/Cesium/Feature/Resource/utils.ts | 31 +++++++++++++------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/src/engines/Cesium/Feature/Resource/utils.ts b/src/engines/Cesium/Feature/Resource/utils.ts index cc56fe7..ddeaba0 100644 --- a/src/engines/Cesium/Feature/Resource/utils.ts +++ b/src/engines/Cesium/Feature/Resource/utils.ts @@ -2,7 +2,7 @@ import { Entity, PointGraphics, BillboardGraphics, JulianDate } from "cesium"; import { EvalFeature } from "../../.."; import { AppearanceTypes, ComputedFeature, ComputedLayer, Feature } from "../../../../mantle"; -import { heightReference, shadowMode, toColor } from "../../common"; +import { heightReference, shadowMode, toColor, classificationType } from "../../common"; import { getMarkerCoordinates, getGeometryFromEntity } from "../../helpers/getGeometryFromEntity"; import { convertEntityDescription, convertEntityProperties } from "../../utils/utils"; import { attachTag, extractSimpleLayer, getTag, Tag } from "../utils"; @@ -33,7 +33,7 @@ type EntityAppearanceKey = AName extends " ? keyof Pick : keyof Pick; -type AppearancePropertyKeyType = "color" | "heightReference" | "shadows"; +type AppearancePropertyKeyType = "color" | "heightReference" | "shadows" | "classificationType"; export function attachProperties< AName extends SupportedAppearanceKey, @@ -87,6 +87,9 @@ export function attachProperties< break; case "heightReference": value = heightReference(value); + break; + case "classificationType": + value = classificationType(value); } if (value === (entity[propertyName] as any)[entityPropertyKey]) { @@ -160,10 +163,10 @@ export const attachStyle = ( name: "show", ...(computedFeature?.marker?.style ? { - override: - computedFeature?.marker?.style === "point" && - (computedFeature?.marker.show ?? true), - } + override: + computedFeature?.marker?.style === "point" && + (computedFeature?.marker.show ?? true), + } : {}), }, pixelSize: { @@ -199,10 +202,10 @@ export const attachStyle = ( name: "show", ...(computedFeature?.marker?.style ? { - override: - computedFeature?.marker?.style === "image" && - (computedFeature?.marker.show ?? true), - } + override: + computedFeature?.marker?.style === "image" && + (computedFeature?.marker.show ?? true), + } : {}), }, image: { @@ -295,6 +298,10 @@ export const attachStyle = ( clampToGround: { name: "clampToGround", }, + classificationType: { + name: "classificationType", + type: "classificationType", + }, }); } return [feature, computedFeature]; @@ -356,6 +363,10 @@ export const attachStyle = ( extrudedHeight: { name: "extrudedHeight", }, + classificationType: { + name: "classificationType", + type: "classificationType", + }, }); } return [feature, computedFeature];