Skip to content
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

Fix geometry creation in TypeScript #8941

Merged
merged 2 commits into from
Jun 10, 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
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- Fixed JSDoc and TypeScript type definitions for `EllipsoidTangentPlane.fromPoints`, which takes an array of `Cartesian3`, not a single instance. [#8928](https://github.com/CesiumGS/cesium/pull/8928)
- Fixed JSDoc and TypeScript type definitions for `EntityCollection.getById` and `CompositeEntityCollection.getById`, which can both return undefined. [#8928](https://github.com/CesiumGS/cesium/pull/8928)
- Fixed JSDoc and TypeScript type definitions for `Viewer` options parameter, which was incorrectly listed as required.
- Fixed TypeScript type definitions to allow the creation of `GeometryInstance` instances using `XXXGeometry` classes. [#8941](https://github.com/CesiumGS/cesium/pull/8941).
- Fixed a memory leak where some 3D Tiles requests were being unintentionally retained after the requests were cancelled. [#8843](https://github.com/CesiumGS/cesium/pull/8843)

### 1.70.0 - 2020-06-01
Expand Down
25 changes: 25 additions & 0 deletions Source/Core/GeometryFactory.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import DeveloperError from "../Core/DeveloperError.js";

/**
* Base class for all geometry creation utility classes that can be passed to {@link GeometryInstance}
* for asynchronous geometry creation.
*
* @constructor
* @class
* @abstract
*/
function GeometryFactory() {
DeveloperError.throwInstantiationError();
}

/**
* Returns a geometry.
*
* @param {GeometryFactory} geometryFactory A description of the circle.
* @returns {Geometry|undefined} The computed vertices and indices.
*/
GeometryFactory.createGeometry = function (geometryFactory) {
DeveloperError.throwInstantiationError();
};

export default GeometryFactory;
2 changes: 1 addition & 1 deletion Source/Core/GeometryInstance.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Matrix4 from "./Matrix4.js";
* @constructor
*
* @param {Object} options Object with the following properties:
* @param {Geometry} options.geometry The geometry to instance.
* @param {Geometry|GeometryFactory} options.geometry The geometry to instance.
* @param {Matrix4} [options.modelMatrix=Matrix4.IDENTITY] The model matrix that transforms to transform the geometry from model to world coordinates.
* @param {Object} [options.id] A user-defined object to return when the instance is picked with {@link Scene#pick} or get/set per-instance attributes with {@link Primitive#getGeometryInstanceAttributes}.
* @param {Object} [options.attributes] Per-instance attributes like a show or color attribute shown in the example below.
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/PlaneGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import VertexFormat from "./VertexFormat.js";
* @alias PlaneGeometry
* @constructor
*
* @param {Object} options Object with the following properties:
* @param {Object} [options] Object with the following properties:
* @param {VertexFormat} [options.vertexFormat=VertexFormat.DEFAULT] The vertex attributes to be computed.
*
* @example
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/SimplePolylineGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ var generateArcOptionsScratch = {
* Computes the geometric representation of a simple polyline, including its vertices, indices, and a bounding sphere.
*
* @param {SimplePolylineGeometry} simplePolylineGeometry A description of the polyline.
* @returns {Geometry} The computed vertices and indices.
* @returns {Geometry|undefined} The computed vertices and indices.
*/
SimplePolylineGeometry.createGeometry = function (simplePolylineGeometry) {
var positions = simplePolylineGeometry._positions;
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/SphereGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ SphereGeometry.unpack = function (array, startingIndex, result) {
* Computes the geometric representation of a sphere, including its vertices, indices, and a bounding sphere.
*
* @param {SphereGeometry} sphereGeometry A description of the sphere.
* @returns {Geometry} The computed vertices and indices.
* @returns {Geometry|undefined} The computed vertices and indices.
*/
SphereGeometry.createGeometry = function (sphereGeometry) {
return EllipsoidGeometry.createGeometry(sphereGeometry._ellipsoidGeometry);
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/SphereOutlineGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ SphereOutlineGeometry.unpack = function (array, startingIndex, result) {
* Computes the geometric representation of an outline of a sphere, including its vertices, indices, and a bounding sphere.
*
* @param {SphereOutlineGeometry} sphereGeometry A description of the sphere outline.
* @returns {Geometry} The computed vertices and indices.
* @returns {Geometry|undefined} The computed vertices and indices.
*/
SphereOutlineGeometry.createGeometry = function (sphereGeometry) {
return EllipsoidOutlineGeometry.createGeometry(
Expand Down
Loading