From 62df45cd09f5f28a08445c1592518e514e93f2cb Mon Sep 17 00:00:00 2001 From: Crocsx Date: Thu, 9 Jan 2020 06:10:26 +0900 Subject: [PATCH] [@types/cesium] Add some missing class and update to Cesium 1.65 (#41438) * Cesium type 1.65 * Update index.d.ts * Update tsconfig.json * Update index.d.ts * Update index.d.ts * version number --- types/cesium/index.d.ts | 257 ++++++++++++++++++++++++++-------------- 1 file changed, 170 insertions(+), 87 deletions(-) diff --git a/types/cesium/index.d.ts b/types/cesium/index.d.ts index abfecd0be6..f91d7c0ea5 100644 --- a/types/cesium/index.d.ts +++ b/types/cesium/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for cesium 1.59 +// Type definitions for cesium 1.65 // Project: http://cesiumjs.org // Definitions by: Aigars Zeiza // Harry Nicholls @@ -8,6 +8,7 @@ // Wing Ho // Joey Rafidi // Morgan Snyder +// Federico Giacomini // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 3.0 @@ -50,6 +51,34 @@ declare namespace Cesium { static intersect(box: AxisAlignedBoundingBox, plane: Cartesian4): Intersect; } + namespace PostProcessStageLibrary { + function createBlackAndWhiteStage(): PostProcessStage; + function createBlurStage(): PostProcessStageComposite; + function createBrightnessStage(): PostProcessStage; + function createEdgeDetectionStage(): PostProcessStage; + function createLensFlareStage(): PostProcessStageComposite; + function createNightVisionStage(): PostProcessStage; + function createSilhouetteStage(option: any): PostProcessStageComposite; + function isAmbientOcclusionSupported(scene: Scene): boolean; + function isDepthOfFieldSupported(scene: Scene): boolean; + function isEdgeDetectionSupported(scene: Scene): boolean; + function isSilhouetteSupported(scene: Scene): boolean; + } + + class PostProcessStageComposite { + constructor(stages: PostProcessStage[], inputPreviousStageTexture?: boolean, name?: string, uniforms?: object); + enabled: boolean; + select: any[]; + uniforms: object; + readonly inputPreviousStageTexture: boolean; + readonly length: number; + readonly name: string; + readonly ready: boolean; + get(index: number): PostProcessStage | PostProcessStageComposite; + isDestroyed(): boolean; + destroy(): void; + } + class BoundingRectangle { x: number; y: number; @@ -684,13 +713,33 @@ declare namespace Cesium { } class EllipsoidGeometry extends Packable { - constructor(options?: { radii?: Cartesian3; stackPartitions?: number; slicePartitions?: number; vertexFormat?: VertexFormat }); + constructor(options?: { + radii?: Cartesian3; + innerRadii?: Cartesian3; + minimumClock?: number; + maximumClock?: number; + minimumCone?: number; + maximumCone?: number; + stackPartitions?: number; + slicePartitions?: number; + vertexFormat?: VertexFormat; + }); static unpack(array: number[], startingIndex?: number, result?: EllipsoidGeometry): EllipsoidGeometry; static createGeometry(ellipsoidGeometry: EllipsoidGeometry): Geometry; } class EllipsoidOutlineGeometry extends Packable { - constructor(options?: { radii?: Cartesian3; stackPartitions?: number; slicePartitions?: number; subdivisions?: number }); + constructor(options?: { + radii?: Cartesian3; + innerRadii?: Cartesian3; + minimumClock?: number; + maximumClock?: number; + minimumCone?: number; + maximumCone?: number; + stackPartitions?: number; + slicePartitions?: number; + subdivisions?: number; + }); static unpack(array: number[], startingIndex?: number, result?: EllipsoidOutlineGeometry): EllipsoidOutlineGeometry; static createGeometry(ellipsoidGeometry: EllipsoidOutlineGeometry): Geometry; } @@ -780,7 +829,7 @@ declare namespace Cesium { modelMatrix: Matrix4; id: any; attributes: any; - constructor(options: { geometry: Geometry; modelMatrix?: Matrix4; id?: any; attributes?: any }); + constructor(options: { geometry: Geometry | PolygonGeometry; modelMatrix?: Matrix4; id?: any; attributes?: any }); } class GeometryInstanceAttribute { @@ -991,6 +1040,7 @@ declare namespace Cesium { static toArray(matrix: Matrix3, result?: number[]): number[]; static getElementIndex(row: number, column: number): number; static getColumn(matrix: Matrix3, index: number, result: Cartesian3): Cartesian3; + static getRotation(matrix: Matrix3, result: Matrix3): Matrix3; static setColumn(matrix: Matrix3, index: number, cartesian: Cartesian3, result: Cartesian3): Matrix3; static getRow(matrix: Matrix3, index: number, result: Cartesian3): Cartesian3; static setRow(matrix: Matrix3, index: number, cartesian: Cartesian3, result: Cartesian3): Matrix3; @@ -1080,7 +1130,7 @@ declare namespace Cesium { static equals(left?: Matrix4, right?: Matrix4): boolean; static equalsEpsilon(left: Matrix4, right: Matrix4, epsilon: number): boolean; static getTranslation(matrix: Matrix4, result: Cartesian3): Cartesian3; - static getRotation(matrix: Matrix4, result: Matrix3): Matrix3; + static getMatrix3(matrix: Matrix4, result: Matrix3): Matrix3; static inverse(matrix: Matrix4, result: Matrix4): Matrix4; static inverseTransformation(matrix: Matrix4, result: Matrix4): Matrix4; } @@ -1920,6 +1970,7 @@ declare namespace Cesium { clustering: EntityCluster; entities: EntityCollection; errorEvent: Event; + credit: Credit; isLoading: boolean; loadingEvent: Event; name: string; @@ -1951,6 +2002,7 @@ declare namespace Cesium { contains(dataSource: DataSource): boolean; indexOf(dataSource: DataSource): number; get(index: number): DataSource; + getByName(name: string): DataSource[]; isDestroyed(): boolean; destroy(): void; } @@ -3354,15 +3406,23 @@ declare namespace Cesium { fillColor: Color; outlineColor: Color; outlineWidth: number; - style: LabelStyle; - pixelOffset: Cartesian2; + definitionChanged: Event; + style: Property; + backgroundColor: Color; + backgroundPadding: Color; + disableDepthTestDistance: number; + distanceDisplayCondition: DistanceDisplayCondition; + heightReference: HeightReference; + totalScale: number; + horizontalOrigin: Property; + verticalOrigin: Property; + eyeOffset: Property; + pixelOffset: Property; + scale: Property; translucencyByDistance: NearFarScalar; pixelOffsetScaleByDistance: NearFarScalar; - eyeOffset: Cartesian3; - horizontalOrigin: HorizontalOrigin; - verticalOrigin: VerticalOrigin; - scale: number; id: any; + static enableRightToLeftDetection: boolean; computeScreenSpacePosition(scene: Scene, result?: Cartesian2): Cartesian2; equals(other: Label): boolean; isDestroyed(): boolean; @@ -3589,7 +3649,7 @@ declare namespace Cesium { far: number; readonly projectionMatrix: Matrix4; computeCullingVolume(position: Cartesian3, direction: Cartesian3, up: Cartesian3): CullingVolume; - getPixelDimensions(drawingBufferWidth: number, drawingBufferHeight: number, distance: number, result: Cartesian2): Cartesian2; + getPixelDimensions(drawingBufferWidth: number, drawingBufferHeight: number, distance: number, pixelRatio: number, result: Cartesian2): Cartesian2; } class OrthographicFrustum extends Frustum { @@ -3707,7 +3767,7 @@ declare namespace Cesium { readonly scissorRectangle: BoundingRectangle; selected: any[]; readonly textureScale: number; - readonly uniforms: object; + readonly uniforms: any; constructor(options?: { fragmentShader: string; uniforms?: object; @@ -3773,51 +3833,12 @@ 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; readonly length: number; constructor(options?: { show?: boolean; destroyPrimitives?: boolean }); - add(primitive: any): any; + add(primitive: any, index?: number): any; remove(primitive?: any): boolean; removeAll(): void; contains(primitive?: any): boolean; @@ -4186,7 +4207,13 @@ declare namespace Cesium { tooltip: string; iconUrl: string; creationCommand: Command; - constructor(options: { name: string; tooltip: string; iconUrl: string; creationFunction: ProviderViewModel.CreationFunction | Command }); + constructor(options: { + name: string; + tooltip: string; + iconUrl: string; + category?: string; + creationFunction: ProviderViewModel.CreationFunction | Command; + }); } namespace ProviderViewModel { @@ -4267,6 +4294,7 @@ declare namespace Cesium { readonly camera: Camera; clock: Clock; screenSpaceEventHandler: ScreenSpaceEventHandler; + useBrowserRecommendedResolution: boolean; targetFrameRate: number; useDefaultRenderLoop: boolean; resolutionScale: number; @@ -4575,6 +4603,7 @@ declare namespace Cesium { readonly screenSpaceEventHandler: ScreenSpaceEventHandler; targetFrameRate: number; useDefaultRenderLoop: boolean; + useBrowserRecommendedResolution: boolean; resolutionScale: number; allowDataSourcesToSuspendAnimation: boolean; trackedEntity: Entity; @@ -5027,12 +5056,6 @@ 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[]; @@ -5232,7 +5255,7 @@ declare namespace Cesium { MORPHING, COLUMBUS_VIEW, SCENE2D, - SCENE3D, + SCENE3D } namespace SceneMode { @@ -5272,39 +5295,49 @@ declare namespace Cesium { TOP, } - function createOpenStreetMapImageryProvider(options: { - url?: string, - fileExtension?: string, - rectangle?: Rectangle, - minimumLevel?: number, - maximumLevel?: number, - ellipsoid?: Ellipsoid, - credit?: Credit | string - }): UrlTemplateImageryProvider; + function when(promise: Promise, callback?: (e: any) => void): { + then: (e: any) => any; + always: (e: any, t: any) => any; + otherwise: (e: any) => any; + spread: (t: any) => any; + yield: (e: any) => any; + }; - function createTileMapServiceImageryProvider(options: { - url?: string, - fileExtension?: string, - credit?: Credit | string, - minimumLevel?: number, - maximumLevel?: number, - rectangle?: Rectangle, - tilingScheme?: TilingScheme, - ellipsoid?: Ellipsoid, - tileWidth?: number, - tileHeight?: number, - flipXY?: boolean - }): UrlTemplateImageryProvider; - - function createWorldImagery(options: { + function createWorldImagery(options?: { style?: any // IonWorldImageryStyle }): IonImageryProvider; - function createWorldTerrain(options: { + function createWorldTerrain(options?: { requestVertexNormals?: boolean, requestWaterMask?: boolean }): CesiumTerrainProvider; + class OpenStreetMapImageryProvider extends ImageryProvider { + constructor(options?: { + url?: string, + fileExtension?: string, + proxy?: any, + rectangle?: Rectangle, + minimumLevel?: number, + maximumLevel?: number, + credit?: Credit | string, + ellipsoid?: Ellipsoid, + }); + } + + class TileMapResourceImageryProvider extends ImageryProvider { + constructor(options?: { + url?: string, + fileExtension?: string, + proxy?: any, + rectangle?: Rectangle, + minimumLevel?: number, + maximumLevel?: number, + credit?: Credit | string, + ellipsoid?: Ellipsoid, + }); + } + class UrlTemplateImageryProvider extends ImageryProvider { url: string; pickFeaturesUrl: string; @@ -5414,11 +5447,61 @@ declare namespace Cesium { function defined(value: any): boolean; + function buildModuleUrl(value: string): string; + + class GroundPrimitive { + readonly allowPicking: boolean; + readonly asynchronous: boolean; + readonly compressVertices: boolean; + readonly interleave: boolean; + readonly ready: boolean; + readonly readyPromise: Promise; + readonly releaseGeometryInstances: boolean; + readonly vertexCacheOptimize: boolean; + + show: boolean; + appearance: Appearance; + classificationType: ClassificationType; + debugShowBoundingVolume: boolean; + debugShowShadowVolume: boolean; + geometryInstances: any[] | GeometryInstance; + + static initializeTerrainHeights(): Promise; + static isSupported(scene: Scene): boolean; + static supportsMaterials(scene: Scene): boolean; + + constructor(options: { + geometryInstances?: any[] | GeometryInstance, + appearance?: Appearance, + show?: boolean, + vertexCacheOptimize?: boolean, + interleave?: boolean, + compressVertices?: boolean, + releaseGeometryInstances?: boolean, + allowPicking?: boolean, + asynchronous?: boolean, + debugShowBoundingVolume?: boolean, + debugShowShadowVolume?: boolean, + classificationType?: ClassificationType + }); + + destroy(scene: Scene): void; + getGeometryInstanceAttributes(id: any): GeometryInstance; + isDestroyed(): boolean; + update(): void; + } + + enum ClassificationType { + BOTH, + CESIUM_3D_TILE, + TERRAIN + } + namespace buildModuleUrl { function setBaseUrl(value: string): undefined; } - enum WebGLConstants { + enum WebGLConstants { DEPTH_BUFFER_BIT, STENCIL_BUFFER_BIT, COLOR_BUFFER_BIT,