From 93ec437a0da64a0ec52f355d72f87114f985bbbf Mon Sep 17 00:00:00 2001 From: Joey Rafidi Date: Thu, 26 Dec 2019 12:17:45 -0500 Subject: [PATCH] Add types to Cesium for GroundPrimitive and fix missing properties (#41168) --- types/cesium/index.d.ts | 117 ++++++++++++++++++++++++++++++++++------ 1 file changed, 100 insertions(+), 17 deletions(-) diff --git a/types/cesium/index.d.ts b/types/cesium/index.d.ts index 6c996e064c..541ed00784 100644 --- a/types/cesium/index.d.ts +++ b/types/cesium/index.d.ts @@ -6,6 +6,8 @@ // Radek Goláň jr. // Emma Krantz // Wing Ho +// Joey Rafidi +// Morgan Snyder // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 3.0 @@ -2416,13 +2418,19 @@ declare namespace Cesium { } class PolygonGraphics { + arcType: Property; + classificationType: Property; + closeBottom: Property; + closeTop: Property; definitionChanged: Event; + distanceDisplayCondition: Property; show: Property; material: MaterialProperty | Color; - positions: Property; hierarchy: Property; height: Property; + heightReference: Property; extrudedHeight: Property; + extrudedHeightReference: Property; granularity: Property; stRotation: Property; fill: boolean; @@ -2430,19 +2438,30 @@ declare namespace Cesium { outlineColor: Color; outlineWidth: Property; perPositionHeight: Property; + shadows: Property; + zIndex: ConstantProperty; constructor(options?: { hierarchy?: Property; - height?: number; + height?: Property | number; + heightReference?: Property; extrudedHeight?: Property; - show?: Property; - fill?: boolean; + extrudedHeightReference?: Property; + show?: Property | boolean; + fill?: Property | boolean; material?: MaterialProperty | Color; - outline?: boolean; - outlineColor?: Color; - outlineWidth?: number; + outline?: Property | boolean; + outlineColor?: Property | Color; + outlineWidth?: Property | number; stRotation?: Property; granularity?: Property; - perPositionHeight?: Property + perPositionHeight?: Property; + closeTop?: boolean; + closeBottom?: boolean; + arcType?: Property | ArcType; + shadows?: Property | ShadowMode; + distanceDisplayCondition?: Property; + classificationType?: Property | ClassificationType; + zIndex: ConstantProperty | number; }); clone(result?: PolygonGraphics): PolygonGraphics; merge(source: PolygonGraphics): PolygonGraphics; @@ -2474,20 +2493,33 @@ declare namespace Cesium { } class PolylineGraphics { - definitionChanged: Event; + arcType: Property; + clampToGround: Property; + classificationType: Property; + readonly definitionChanged: Event; + depthFailMaterial: MaterialProperty; + distanceDisplayCondition: Property; + followSurface: Property; + granularity: Property; + shadows: Property; show: Property; material: MaterialProperty; positions: Property; - width: number; - followSurface: Property; - granularity: Property; + width: Property; + zIndex: ConstantProperty; constructor(options?: { - positions?: Cartesian3[]; - followSurface?: Property; - width?: number; - show?: Property; + positions?: Property | Cartesian3[]; + clampToGround?: Property | boolean; + width?: Property | number; + show?: Property | boolean; material?: MaterialProperty; - granularity?: Property + granularity?: Property; + arcType?: Property | ArcType; + depthFailMaterial?: MaterialProperty; + shadows?: Property | ShadowMode; + distanceDisplayCondition?: Property; + classificationType?: Property | ClassificationType; + zIndex?: Property | number; }); clone(result?: PolylineGraphics): PolylineGraphics; merge(source: PolylineGraphics): PolylineGraphics; @@ -3741,6 +3773,45 @@ declare namespace Cesium { update(): void; } + class GroundPrimitive { + readonly allowPicking: boolean; + appearance: Appearance; + readonly asynchronous: boolean; + classificationType: ClassificationType; + readonly compressVertices: boolean; + debugShowBoundingVolume: boolean; + debugShowShadowVolume: boolean; + depthFailAppearance: Appearance; + readonly geometryInstances: GeometryInstance[] | GeometryInstance | undefined; + readonly interleave: boolean; + readonly ready: boolean; + readonly readyPromise: Promise; + readonly releaseGeometryInstances: boolean; + show: boolean; + readonly vertexCacheOptimize: boolean; + constructor(options?: { + geometryInstances?: any[] | GeometryInstance; + appearance?: Appearance; + show?: boolean; + vertexCacheOptimize?: boolean; + interleave?: boolean; + compressVertices?: boolean; + releaseGeometryInstances?: boolean; + allowPicking?: boolean; + asynchronous?: boolean; + classificationType?: ClassificationType; + debugShowBoundingVolume?: boolean; + debugShowShadowVolume?: boolean; + }); + static initializeTerrainHeights(): Promise; + static isSupported(scene: Scene): boolean; + static supportsMaterials(scene: Scene): boolean; + destroy(): void; + getGeometryInstanceAttributes(id: any): any; + isDestroyed(): boolean; + update(): void; + } + class PrimitiveCollection { show: boolean; destroyPrimitives: boolean; @@ -4664,6 +4735,12 @@ declare namespace Cesium { type TaskProcessorWorkerFunction = (event: any) => void; } + enum ArcType { + NONE, + GEODESIC, + RHUMB + } + enum ClockRange { UNBOUNDED, CLAMPED, @@ -4950,6 +5027,12 @@ declare namespace Cesium { TRIANGLE_FAN, } + enum ClassificationType { + CESIUM_3D_TILE, + BOTH, + TERRAIN + } + namespace QuadraticRealPolynomial { function computeDiscriminant(a: number, b: number, c: number): number; function computeRealRoots(a: number, b: number, c: number): number[];