From 65ef3f96f126e9b5b8268d0ea3001f22d5071f9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20B=C5=82a=C5=BCejewicz=20=28Peter=20Blazejewicz=29?= Date: Wed, 25 Mar 2020 01:34:56 +0100 Subject: [PATCH] feat(cesium): version bump to 1.67 (#42977) * feat(cesium): version bump to 1.67 - `Cesium3DTilesetGraphics` - `Color.lerp` - `skipLevelOfDetail` default value braking change documented - `isArray` deprecated - no changes for ParticleSystem as Particle api is not part of type definitions yet https://github.com/CesiumGS/cesium/blob/master/CHANGES.md#1670---2020-03-02 /cc @jrafidi Thanks! * Fix PR comments: - missing test added - `show` property /cc @jrafidi Thanks! --- types/cesium/index.d.ts | 69 ++++++++++++++++++++++++- types/cesium/test/cesium-global.test.ts | 21 ++++++++ types/cesium/test/cesium-module.test.ts | 21 ++++++++ 3 files changed, 110 insertions(+), 1 deletion(-) diff --git a/types/cesium/index.d.ts b/types/cesium/index.d.ts index 3559930f97..922dc75b62 100644 --- a/types/cesium/index.d.ts +++ b/types/cesium/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for cesium 1.66 +// Type definitions for cesium 1.67 // Project: http://cesiumjs.org // Definitions by: Aigars Zeiza // Harry Nicholls @@ -426,6 +426,56 @@ declare namespace Cesium { constructor(options: { url: string; proxy?: Proxy; requestVertexNormals?: boolean; requestWaterMask?: boolean; ellipsoid?: Ellipsoid; credit?: Credit | string }); } + /** + * A 3D Tiles tileset represented by an Entity. + * The tileset modelMatrix is determined by the containing Entity position and orientation or is left unset if position is undefined. + */ + class Cesium3DTilesetGraphics { + constructor(options?: Cesium3DTilesetGraphicsOptions); + /** + * Duplicates this instance. + */ + clone(result?: Cesium3DTilesetGraphics): Cesium3DTilesetGraphics; + /** + * Assigns each unassigned property on this object to the value of the same property on the provided source object. + */ + merge(source: Cesium3DTilesetGraphics): void; + /** + * Gets the event that is raised whenever a property or sub-property is changed or modified. + */ + readonly definitionChanged: Event; + /** + * Gets or sets the maximum screen space error used to drive level of detail refinement. + * @default true + */ + maximumScreenSpaceError: Property; + /** + * Gets or sets the boolean Property specifying the visibility of the model. + * @default true + */ + show: Property; + /** + * Gets or sets the string Property specifying the URI of the glTF asset. + */ + uri: Property; + } + + interface Cesium3DTilesetGraphicsOptions { + /** + * A boolean Property specifying the visibility of the tilese + * @default true + */ + show?: boolean | Property; + /** + * A string or Resource Property specifying the URI of the tileset. + */ + uri?: string | Property; + /** + * A number or Property specifying the maximum screen space error used to drive level of detail refinement. + */ + maximumScreenSpaceError?: number | Property; + } + class CircleGeometry extends Packable { constructor(options: { center: Cartesian3; @@ -650,6 +700,10 @@ declare namespace Cesium { maximumAlpha?: number }, result?: Color): Color; static fromRgba(rgba: number): Color; + /** + * Computes the linear interpolation or extrapolation at t between the provided colors. + */ + static lerp(start: Color, end: Color, t: number, result: Color): Color; static mod(left: Color, right: Color, result?: Color): Color; static multiply(left: Color, right: Color, result?: Color): Color; static multiplyByScalar(color: Color, scalar: number, result?: Color): Color; @@ -3824,6 +3878,11 @@ declare namespace Cesium { progressiveResolutionHeightFraction: number; shadow: ShadowMode; show: boolean; + /** + * Optimization option. + * Determines if level of detail skipping should be applied during the traversal. + * @default false + */ skipLevelOfDetail: boolean; skipLevels: number; skipScreenSpaceErrorFactor: number; @@ -3859,6 +3918,11 @@ declare namespace Cesium { foveatedMinimumScreenSpaceErrorRelaxation?: number; foveatedInterpolationCallback?: Cesium3DTileset; foveatedTimeDelay?: number; + /** + * Optimization option. + * Determines if level of detail skipping should be applied during the traversal. + * @default false + */ skipLevelOfDetail?: boolean; baseScreenSpaceError?: number; skipScreenSpaceErrorFactor?: number; @@ -5406,6 +5470,9 @@ declare namespace Cesium { function getImagePixels(image: HTMLImageElement): number[]; + /** + * @deprecated use Array.isArray + */ function isArray(value: any): boolean; function isLeapYear(year: number): boolean; diff --git a/types/cesium/test/cesium-global.test.ts b/types/cesium/test/cesium-global.test.ts index 2954f8a30a..5e9f0cb2b2 100644 --- a/types/cesium/test/cesium-global.test.ts +++ b/types/cesium/test/cesium-global.test.ts @@ -76,3 +76,24 @@ const label = new Cesium.LabelGraphics({ viewer.scene.globe.tileLoadProgressEvent.addEventListener((progress: number) => progress); viewer.scene.globe.terrainProviderChanged.addEventListener((provider: Cesium.TerrainProvider) => provider); + +// Cesium3DTileset +const tileset = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({ + url: 'http://localhost:8002/tilesets/Seattle/tileset.json', + skipLevelOfDetail: true, + baseScreenSpaceError: 1024, + skipScreenSpaceErrorFactor: 16, + skipLevels: 1, + immediatelyLoadDesiredLevelOfDetail: false, + loadSiblings: false, + cullWithChildrenBounds: true +})); + +// Cesium3DTilesetGraphics +const options = { + uri: '0', + show: false, + maximumScreenSpaceError: 2 +}; + + const tilesetModel = new Cesium.Cesium3DTilesetGraphics(options); diff --git a/types/cesium/test/cesium-module.test.ts b/types/cesium/test/cesium-module.test.ts index 36a4b25450..2216cfae63 100644 --- a/types/cesium/test/cesium-module.test.ts +++ b/types/cesium/test/cesium-module.test.ts @@ -78,3 +78,24 @@ const label = new Cesium.LabelGraphics({ viewer.scene.globe.tileLoadProgressEvent.addEventListener((progress: number) => progress); viewer.scene.globe.terrainProviderChanged.addEventListener((provider: Cesium.TerrainProvider) => provider); + +// Cesium3DTileset +const tileset = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({ + url: 'http://localhost:8002/tilesets/Seattle/tileset.json', + skipLevelOfDetail: true, + baseScreenSpaceError: 1024, + skipScreenSpaceErrorFactor: 16, + skipLevels: 1, + immediatelyLoadDesiredLevelOfDetail: false, + loadSiblings: false, + cullWithChildrenBounds: true +})); + +// Cesium3DTilesetGraphics +const options = { + uri: '0', + show: false, + maximumScreenSpaceError: 2 +}; + + const tilesetModel = new Cesium.Cesium3DTilesetGraphics(options);