Skip to content

Several improvements to typings #8884

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
May 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 0 additions & 32 deletions .vscode/tasks.json

This file was deleted.

1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,3 +256,4 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu
- [SungHo Lim](https://github.com/SambaLim)
- [Michael Fink](https://github.com/vividos)
- [Jakub Vrana](https://github.com/vrana)
- [James Bromwell](https://github.com/thw0rted)
3 changes: 0 additions & 3 deletions Source/Core/Math.js
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,6 @@ CesiumMath.ONE_OVER_TWO_PI = 1.0 / (2.0 * Math.PI);
*
* @type {Number}
* @constant
* @default Math.PI / 180.0
*/
CesiumMath.RADIANS_PER_DEGREE = Math.PI / 180.0;

Expand All @@ -420,7 +419,6 @@ CesiumMath.RADIANS_PER_DEGREE = Math.PI / 180.0;
*
* @type {Number}
* @constant
* @default 180.0 / Math.PI
*/
CesiumMath.DEGREES_PER_RADIAN = 180.0 / Math.PI;

Expand All @@ -429,7 +427,6 @@ CesiumMath.DEGREES_PER_RADIAN = 180.0 / Math.PI;
*
* @type {Number}
* @constant
* @default {@link CesiumMath.RADIANS_PER_DEGREE} / 3600.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm okay with these changes, but it made me realize there's a bug with Math/CesiumMath in my PR, so thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not positive this would work even without the Math error, because I can't find anything saying that an expression (not a literal) for @default is supposed to be supported.

*/
CesiumMath.RADIANS_PER_ARCSECOND = CesiumMath.RADIANS_PER_DEGREE / 3600.0;

Expand Down
49 changes: 28 additions & 21 deletions Source/DataSources/BillboardGraphics.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,33 @@ import DeveloperError from "../Core/DeveloperError.js";
import Event from "../Core/Event.js";
import createPropertyDescriptor from "./createPropertyDescriptor.js";

/**
* @typedef {Object} BillboardGraphics.ConstructorOptions
*
* Initialization options for the BillboardGraphics constructor
*
* @property {Property | boolean} [show=true] A boolean Property specifying the visibility of the billboard.
* @property {Property | string | HTMLCanvasElement} [image] A Property specifying the Image, URI, or Canvas to use for the billboard.
* @property {Property | number} [scale=1.0] A numeric Property specifying the scale to apply to the image size.
* @property {Property | Cartesian2} [pixelOffset=Cartesian2.ZERO] A {@link Cartesian2} Property specifying the pixel offset.
* @property {Property | Cartesian3} [eyeOffset=Cartesian3.ZERO] A {@link Cartesian3} Property specifying the eye offset.
* @property {Property | HorizontalOrigin} [horizontalOrigin=HorizontalOrigin.CENTER] A Property specifying the {@link HorizontalOrigin}.
* @property {Property | VerticalOrigin} [verticalOrigin=VerticalOrigin.CENTER] A Property specifying the {@link VerticalOrigin}.
* @property {Property | HeightReference} [heightReference=HeightReference.NONE] A Property specifying what the height is relative to.
* @property {Property | Color} [color=Color.WHITE] A Property specifying the tint {@link Color} of the image.
* @property {Property | number} [rotation=0] A numeric Property specifying the rotation about the alignedAxis.
* @property {Property | Cartesian3} [alignedAxis=Cartesian3.ZERO] A {@link Cartesian3} Property specifying the unit vector axis of rotation.
* @property {Property | boolean} [sizeInMeters] A boolean Property specifying whether this billboard's size should be measured in meters.
* @property {Property | number} [width] A numeric Property specifying the width of the billboard in pixels, overriding the native size.
* @property {Property | number} [height] A numeric Property specifying the height of the billboard in pixels, overriding the native size.
* @property {Property | NearFarScalar} [scaleByDistance] A {@link NearFarScalar} Property used to scale the point based on distance from the camera.
* @property {Property | NearFarScalar} [translucencyByDistance] A {@link NearFarScalar} Property used to set translucency based on distance from the camera.
* @property {Property | NearFarScalar} [pixelOffsetScaleByDistance] A {@link NearFarScalar} Property used to set pixelOffset based on distance from the camera.
* @property {Property | BoundingRectangle} [imageSubRegion] A Property specifying a {@link BoundingRectangle} that defines a sub-region of the image to use for the billboard, rather than the entire image, measured in pixels from the bottom-left.
* @property {Property | DistanceDisplayCondition} [distanceDisplayCondition] A Property specifying at what distance from the camera that this billboard will be displayed.
* @property {Property | number} [disableDepthTestDistance] A Property specifying the distance from the camera at which to disable the depth test to.
*/

/**
* Describes a two dimensional icon located at the position of the containing {@link Entity}.
* <p>
Expand All @@ -16,27 +43,7 @@ import createPropertyDescriptor from "./createPropertyDescriptor.js";
* @alias BillboardGraphics
* @constructor
*
* @param {Object} [options] Object with the following properties:
* @param {Property} [options.show=true] A boolean Property specifying the visibility of the billboard.
* @param {Property} [options.image] A Property specifying the Image, URI, or Canvas to use for the billboard.
* @param {Property} [options.scale=1.0] A numeric Property specifying the scale to apply to the image size.
* @param {Property} [options.pixelOffset=Cartesian2.ZERO] A {@link Cartesian2} Property specifying the pixel offset.
* @param {Property} [options.eyeOffset=Cartesian3.ZERO] A {@link Cartesian3} Property specifying the eye offset.
* @param {Property} [options.horizontalOrigin=HorizontalOrigin.CENTER] A Property specifying the {@link HorizontalOrigin}.
* @param {Property} [options.verticalOrigin=VerticalOrigin.CENTER] A Property specifying the {@link VerticalOrigin}.
* @param {Property} [options.heightReference=HeightReference.NONE] A Property specifying what the height is relative to.
* @param {Property} [options.color=Color.WHITE] A Property specifying the tint {@link Color} of the image.
* @param {Property} [options.rotation=0] A numeric Property specifying the rotation about the alignedAxis.
* @param {Property} [options.alignedAxis=Cartesian3.ZERO] A {@link Cartesian3} Property specifying the unit vector axis of rotation.
* @param {Property} [options.sizeInMeters] A boolean Property specifying whether this billboard's size should be measured in meters.
* @param {Property} [options.width] A numeric Property specifying the width of the billboard in pixels, overriding the native size.
* @param {Property} [options.height] A numeric Property specifying the height of the billboard in pixels, overriding the native size.
* @param {Property} [options.scaleByDistance] A {@link NearFarScalar} Property used to scale the point based on distance from the camera.
* @param {Property} [options.translucencyByDistance] A {@link NearFarScalar} Property used to set translucency based on distance from the camera.
* @param {Property} [options.pixelOffsetScaleByDistance] A {@link NearFarScalar} Property used to set pixelOffset based on distance from the camera.
* @param {Property} [options.imageSubRegion] A Property specifying a {@link BoundingRectangle} that defines a sub-region of the image to use for the billboard, rather than the entire image, measured in pixels from the bottom-left.
* @param {Property} [options.distanceDisplayCondition] A Property specifying at what distance from the camera that this billboard will be displayed.
* @param {Property} [options.disableDepthTestDistance] A Property specifying the distance from the camera at which to disable the depth test to.
* @param {BillboardGraphics.ConstructorOptions} [options] Object describing initialization options
*
* @demo {@link https://sandcastle.cesium.com/index.html?src=Billboards.html|Cesium Sandcastle Billboard Demo}
*/
Expand Down
30 changes: 19 additions & 11 deletions Source/DataSources/BoxGraphics.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,31 @@ import Event from "../Core/Event.js";
import createMaterialPropertyDescriptor from "./createMaterialPropertyDescriptor.js";
import createPropertyDescriptor from "./createPropertyDescriptor.js";

/**
* @typedef {Object} BoxGraphics.ConstructorOptions
*
* Initialization options for the BoxGraphics constructor
*
* @property {Property | boolean} [show=true] A boolean Property specifying the visibility of the box.
* @property {Property | Cartesian3} [dimensions] A {@link Cartesian3} Property specifying the length, width, and height of the box.
* @property {Property | HeightReference} [heightReference=HeightReference.NONE] A Property specifying what the height from the entity position is relative to.
* @property {Property | boolean} [fill=true] A boolean Property specifying whether the box is filled with the provided material.
* @property {MaterialProperty | Color} [material=Color.WHITE] A Property specifying the material used to fill the box.
* @property {Property | boolean} [outline=false] A boolean Property specifying whether the box is outlined.
* @property {Property | Color} [outlineColor=Color.BLACK] A Property specifying the {@link Color} of the outline.
* @property {Property | number} [outlineWidth=1.0] A numeric Property specifying the width of the outline.
* @property {Property | ShadowMode} [shadows=ShadowMode.DISABLED] An enum Property specifying whether the box casts or receives shadows from light sources.
* @property {Property | DistanceDisplayCondition} [distanceDisplayCondition] A Property specifying at what distance from the camera that this box will be displayed.
*
*/

/**
* Describes a box. The center position and orientation are determined by the containing {@link Entity}.
*
* @alias BoxGraphics
* @constructor
*
* @param {Object} [options] Object with the following properties:
* @param {Property} [options.show=true] A boolean Property specifying the visibility of the box.
* @param {Property} [options.dimensions] A {@link Cartesian3} Property specifying the length, width, and height of the box.
* @param {Property} [options.heightReference=HeightReference.NONE] A Property specifying what the height from the entity position is relative to.
* @param {Property} [options.fill=true] A boolean Property specifying whether the box is filled with the provided material.
* @param {MaterialProperty} [options.material=Color.WHITE] A Property specifying the material used to fill the box.
* @param {Property} [options.outline=false] A boolean Property specifying whether the box is outlined.
* @param {Property} [options.outlineColor=Color.BLACK] A Property specifying the {@link Color} of the outline.
* @param {Property} [options.outlineWidth=1.0] A numeric Property specifying the width of the outline.
* @param {Property} [options.shadows=ShadowMode.DISABLED] An enum Property specifying whether the box casts or receives shadows from light sources.
* @param {Property} [options.distanceDisplayCondition] A Property specifying at what distance from the camera that this box will be displayed.
* @param {BoxGraphics.ConstructorOptions} [options] Object describing initialization options
*
* @demo {@link https://sandcastle.cesium.com/index.html?src=Box.html|Cesium Sandcastle Box Demo}
*/
Expand Down
15 changes: 11 additions & 4 deletions Source/DataSources/Cesium3DTilesetGraphics.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ import DeveloperError from "../Core/DeveloperError.js";
import Event from "../Core/Event.js";
import createPropertyDescriptor from "./createPropertyDescriptor.js";

/**
* @typedef {Object} Cesium3DTilesetGraphics.ConstructorOptions
*
* Initialization options for the Cesium3DTilesetGraphics constructor
*
* @property {Property | boolean} [show=true] A boolean Property specifying the visibility of the tileset.
* @property {Property | string | Resource} [uri] A string or Resource Property specifying the URI of the tileset.
* @property {Property | number} [maximumScreenSpaceError] A number or Property specifying the maximum screen space error used to drive level of detail refinement.
*/

/**
* A 3D Tiles tileset represented by an {@link Entity}.
* The tileset modelMatrix is determined by the containing Entity position and orientation
Expand All @@ -12,10 +22,7 @@ import createPropertyDescriptor from "./createPropertyDescriptor.js";
* @alias Cesium3DTilesetGraphics
* @constructor
*
* @param {Object} [options] Object with the following properties:
* @param {Property} [options.show=true] A boolean Property specifying the visibility of the tileset.
* @param {Property} [options.uri] A string or Resource Property specifying the URI of the tileset.
* @param {Property} [options.maximumScreenSpaceError] A number or Property specifying the maximum screen space error used to drive level of detail refinement.
* @param {Cesium3DTilesetGraphics.ConstructorOptions} [options] Object describing initialization options
*/
function Cesium3DTilesetGraphics(options) {
this._definitionChanged = new Event();
Expand Down
45 changes: 26 additions & 19 deletions Source/DataSources/CorridorGraphics.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,31 @@ import Event from "../Core/Event.js";
import createMaterialPropertyDescriptor from "./createMaterialPropertyDescriptor.js";
import createPropertyDescriptor from "./createPropertyDescriptor.js";

/**
* @typedef {Object} CorridorGraphics.ConstructorOptions
*
* Initialization options for the CorridorGraphics constructor
*
* @property {Property | boolean} [show=true] A boolean Property specifying the visibility of the corridor.
* @property {Property | Cartesian3} [positions] A Property specifying the array of {@link Cartesian3} positions that define the centerline of the corridor.
* @property {Property | number} [width] A numeric Property specifying the distance between the edges of the corridor.
* @property {Property | number} [height=0] A numeric Property specifying the altitude of the corridor relative to the ellipsoid surface.
* @property {Property | HeightReference} [heightReference=HeightReference.NONE] A Property specifying what the height is relative to.
* @property {Property | number} [extrudedHeight] A numeric Property specifying the altitude of the corridor's extruded face relative to the ellipsoid surface.
* @property {Property | HeightReference} [extrudedHeightReference=HeightReference.NONE] A Property specifying what the extrudedHeight is relative to.
* @property {Property | CornerType} [cornerType=CornerType.ROUNDED] A {@link CornerType} Property specifying the style of the corners.
* @property {Property | number} [granularity=Cesium.Math.RADIANS_PER_DEGREE] A numeric Property specifying the distance between each latitude and longitude.
* @property {Property | boolean} [fill=true] A boolean Property specifying whether the corridor is filled with the provided material.
* @property {MaterialProperty | Color} [material=Color.WHITE] A Property specifying the material used to fill the corridor.
* @property {Property | boolean} [outline=false] A boolean Property specifying whether the corridor is outlined.
* @property {Property | Color} [outlineColor=Color.BLACK] A Property specifying the {@link Color} of the outline.
* @property {Property | number} [outlineWidth=1.0] A numeric Property specifying the width of the outline.
* @property {Property | ShadowMode} [shadows=ShadowMode.DISABLED] An enum Property specifying whether the corridor casts or receives shadows from light sources.
* @property {Property | DistanceDisplayCondition} [distanceDisplayCondition] A Property specifying at what distance from the camera that this corridor will be displayed.
* @property {Property | ClassificationType} [classificationType=ClassificationType.BOTH] An enum Property specifying whether this corridor will classify terrain, 3D Tiles, or both when on the ground.
* @property {ConstantProperty | number} [zIndex] A Property specifying the zIndex of the corridor, used for ordering. Only has an effect if height and extrudedHeight are undefined, and if the corridor is static.
*/

/**
* Describes a corridor, which is a shape defined by a centerline and width that
* conforms to the curvature of the globe. It can be placed on the surface or at altitude
Expand All @@ -13,25 +38,7 @@ import createPropertyDescriptor from "./createPropertyDescriptor.js";
* @alias CorridorGraphics
* @constructor
*
* @param {Object} [options] Object with the following properties:
* @param {Property} [options.show=true] A boolean Property specifying the visibility of the corridor.
* @param {Property} [options.positions] A Property specifying the array of {@link Cartesian3} positions that define the centerline of the corridor.
* @param {Property} [options.width] A numeric Property specifying the distance between the edges of the corridor.
* @param {Property} [options.height=0] A numeric Property specifying the altitude of the corridor relative to the ellipsoid surface.
* @param {Property} [options.heightReference=HeightReference.NONE] A Property specifying what the height is relative to.
* @param {Property} [options.extrudedHeight] A numeric Property specifying the altitude of the corridor's extruded face relative to the ellipsoid surface.
* @param {Property} [options.extrudedHeightReference=HeightReference.NONE] A Property specifying what the extrudedHeight is relative to.
* @param {Property} [options.cornerType=CornerType.ROUNDED] A {@link CornerType} Property specifying the style of the corners.
* @param {Property} [options.granularity=Cesium.Math.RADIANS_PER_DEGREE] A numeric Property specifying the distance between each latitude and longitude.
* @param {Property} [options.fill=true] A boolean Property specifying whether the corridor is filled with the provided material.
* @param {MaterialProperty} [options.material=Color.WHITE] A Property specifying the material used to fill the corridor.
* @param {Property} [options.outline=false] A boolean Property specifying whether the corridor is outlined.
* @param {Property} [options.outlineColor=Color.BLACK] A Property specifying the {@link Color} of the outline.
* @param {Property} [options.outlineWidth=1.0] A numeric Property specifying the width of the outline.
* @param {Property} [options.shadows=ShadowMode.DISABLED] An enum Property specifying whether the corridor casts or receives shadows from light sources.
* @param {Property} [options.distanceDisplayCondition] A Property specifying at what distance from the camera that this corridor will be displayed.
* @param {Property} [options.classificationType=ClassificationType.BOTH] An enum Property specifying whether this corridor will classify terrain, 3D Tiles, or both when on the ground.
* @param {ConstantProperty} [options.zIndex] A Property specifying the zIndex of the corridor, used for ordering. Only has an effect if height and extrudedHeight are undefined, and if the corridor is static.
* @param {CorridorGraphics.ConstructorOptions} [options] Object describing initialization options
*
* @see Entity
* @demo {@link https://sandcastle.cesium.com/index.html?src=Corridor.html|Cesium Sandcastle Corridor Demo}
Expand Down
Loading