terriajs
Version:
Geospatial data visualization platform.
203 lines (181 loc) • 6.33 kB
text/typescript
import { JsonObject } from "../../Core/Json";
import anyTrait from "../Decorators/anyTrait";
import objectArrayTrait from "../Decorators/objectArrayTrait";
import objectTrait from "../Decorators/objectTrait";
import primitiveArrayTrait from "../Decorators/primitiveArrayTrait";
import primitiveTrait from "../Decorators/primitiveTrait";
import mixTraits from "../mixTraits";
import ModelTraits from "../ModelTraits";
import CatalogMemberTraits from "./CatalogMemberTraits";
import ClippingPlanesTraits from "./ClippingPlanesTraits";
import HighlightColorTraits from "./HighlightColorTraits";
import LegendOwnerTraits from "./LegendOwnerTraits";
import MappableTraits from "./MappableTraits";
import OpacityTraits from "./OpacityTraits";
import PlaceEditorTraits from "./PlaceEditorTraits";
import ShadowTraits from "./ShadowTraits";
import SplitterTraits from "./SplitterTraits";
import TransformationTraits from "./TransformationTraits";
import UrlTraits from "./UrlTraits";
import FeaturePickingTraits from "./FeaturePickingTraits";
import CesiumIonTraits from "./CesiumIonTraits";
import LayerOrderingTraits from "./LayerOrderingTraits";
export class FilterTraits extends ModelTraits {
({
type: "string",
name: "Name",
description: "A name for the filter"
})
name?: string;
({
type: "string",
name: "property",
description: "The name of the feature property to filter"
})
property?: string;
({
type: "number",
name: "minimumValue",
description: "Minimum value of the property"
})
minimumValue?: number;
({
type: "number",
name: "minimumValue",
description: "Minimum value of the property"
})
maximumValue?: number;
({
type: "number",
name: "minimumShown",
description: "The lowest value the property can have if it is to be shown"
})
minimumShown?: number;
({
type: "number",
name: "minimumValue",
description: "The largest value the property can have if it is to be shown"
})
maximumShown?: number;
}
export class PointCloudShadingTraits extends ModelTraits {
({
type: "boolean",
name: "Attenuation",
description: "Perform point attenuation based on geometric error."
})
attenuation?: boolean;
({
type: "number",
name: "geometricErrorScale",
description: "Scale to be applied to each tile's geometric error."
})
geometricErrorScale?: number;
}
export class OptionsTraits extends ModelTraits {
({
type: "number",
name: "Maximum screen space error",
description:
"The maximum screen space error used to drive level of detail refinement."
})
maximumScreenSpaceError?: number;
({
type: "number",
name: "Maximum number of loaded tiles",
description: ""
})
maximumNumberOfLoadedTiles?: number;
({
type: PointCloudShadingTraits,
name: "Point cloud shading",
description: "Point cloud shading parameters"
})
pointCloudShading?: PointCloudShadingTraits;
({
type: "boolean",
name: "Show credits on screen",
description: "Whether to display the credits of this tileset on screen."
})
showCreditsOnScreen: boolean = false;
({
type: "boolean",
name: "Asynchronously load draped imageries",
description:
"When true, Cesium does not wait for the draped imagery layers to load before the tileset mesh is rendered. This means while the imagery is being loaded the original tile texture will be shown."
})
asynchronouslyLoadImagery: boolean = true;
}
export default class Cesium3DTilesTraits extends mixTraits(
HighlightColorTraits,
PlaceEditorTraits,
TransformationTraits,
FeaturePickingTraits,
MappableTraits,
UrlTraits,
CatalogMemberTraits,
ShadowTraits,
OpacityTraits,
LegendOwnerTraits,
ShadowTraits,
ClippingPlanesTraits,
SplitterTraits,
LayerOrderingTraits,
CesiumIonTraits
) {
({
type: OptionsTraits,
name: "options",
description:
"Additional options to pass to Cesium's Cesium3DTileset constructor."
})
options?: OptionsTraits;
({
name: "style",
description:
"The style to use, specified according to the [Cesium 3D Tiles Styling Language](https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification/Styling)."
})
style?: JsonObject;
({
type: FilterTraits,
idProperty: "name",
name: "filters",
description: "The filters to apply to this catalog item."
})
filters?: FilterTraits[];
({
name: "Color blend mode",
type: "string",
description:
"The color blend mode decides how per-feature color is blended with color defined in the tileset. Acceptable values are HIGHLIGHT, MIX & REPLACE as defined in the cesium documentation - https://cesium.com/docs/cesiumjs-ref-doc/Cesium3DTileColorBlendMode.html"
})
colorBlendMode = "MIX";
({
name: "Color blend amount",
type: "number",
description:
"When the colorBlendMode is MIX this value is used to interpolate between source color and feature color. A value of 0.0 results in the source color while a value of 1.0 results in the feature color, with any value in-between resulting in a mix of the source color and feature color."
})
colorBlendAmount = 0.5;
({
name: "Feature ID properties",
type: "string",
description:
"One or many properties of a feature that together identify it uniquely. This is useful for setting properties for individual features. eg: ['lat', 'lon'], ['buildingId'] etc."
})
featureIdProperties?: string[];
({
name: "lightColor",
type: "number",
description:
"The light color when shading models. When undefined the scene's light color is used instead. eg: [255, 255, 255]."
})
lightColor?: number[];
({
name: "Drape imagery",
type: "boolean",
description:
"When true allows draping imagery on top of this tileset. Imagery items appearing above this catalog item in the workbench will be draped on top of the tileset."
})
drapeImagery?: boolean = false;
}