Skip to content

Commit

Permalink
Merge pull request #63 from reearth/chore/czml-classification-type
Browse files Browse the repository at this point in the history
chore: Support classicationType in czml
  • Loading branch information
mkumbobeaty authored Dec 23, 2024
2 parents 637462e + a9aeeb1 commit 3daa56f
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions src/engines/Cesium/Feature/Resource/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -33,7 +33,7 @@ type EntityAppearanceKey<AName extends SupportedAppearanceKey> = AName extends "
? keyof Pick<Entity, "point" | "billboard" | "label">
: keyof Pick<Entity, CesiumEntityAppearanceKey>;

type AppearancePropertyKeyType = "color" | "heightReference" | "shadows";
type AppearancePropertyKeyType = "color" | "heightReference" | "shadows" | "classificationType";

export function attachProperties<
AName extends SupportedAppearanceKey,
Expand Down Expand Up @@ -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]) {
Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -295,6 +298,10 @@ export const attachStyle = (
clampToGround: {
name: "clampToGround",
},
classificationType: {
name: "classificationType",
type: "classificationType",
},
});
}
return [feature, computedFeature];
Expand Down Expand Up @@ -356,6 +363,10 @@ export const attachStyle = (
extrudedHeight: {
name: "extrudedHeight",
},
classificationType: {
name: "classificationType",
type: "classificationType",
},
});
}
return [feature, computedFeature];
Expand Down

0 comments on commit 3daa56f

Please sign in to comment.