Skip to content

Fix GeometryInstance JSDoc to correctly document GeometryFactory usage#13411

Open
gy1016 wants to merge 2 commits intoCesiumGS:mainfrom
gy1016:fix/geometryinstance-docs
Open

Fix GeometryInstance JSDoc to correctly document GeometryFactory usage#13411
gy1016 wants to merge 2 commits intoCesiumGS:mainfrom
gy1016:fix/geometryinstance-docs

Conversation

@gy1016
Copy link
Copy Markdown

@gy1016 gy1016 commented Apr 16, 2026

Fixes #12826

Problem

The previous documentation incorrectly stated that options.geometry could be either a Geometry or GeometryFactory. However, passing an already-constructed Geometry object (the result of calling createGeometry()) causes the error:

DeveloperError: Must define either _workerName or _workerPath for asynchronous geometry

This is confusing for users who read the docs but don't realize they're supposed to pass a factory (like BoxGeometry.fromDimensions()), not a ready-made geometry.

Fix

  1. Changed @param type from Geometry|GeometryFactory to GeometryFactory
  2. Added explanation that users should pass a GeometryFactory (like BoxGeometry, RectangleOutlineGeometry) and NOT the result of createGeometry() (which returns a Geometry)
  3. Changed the internal @type from Geometry to GeometryFactory

Checklist

lambyyg added 2 commits April 16, 2026 14:20
Fixes CesiumGS#13361

When a label has empty text, Label.getScreenSpaceBoundingBox
previously returned Infinity/-Infinity values (since the glyph
loop did not execute, leaving x=Infinity, maxX=0), which
corrupted the bounding rectangle calculations in the clustering
algorithm and caused all clustering to break.

Changes:
- Label.getScreenSpaceBoundingBox now returns a zero-size
  bounding box at the screen position for empty text labels,
  instead of garbage Infinity values
- EntityCluster.getScreenSpacePositions skips labels with
  empty text since they have no visual content to cluster
- EntityCluster.getBoundingBox skips the label bounding box
  union for associated labels with empty text
- Added tests for both the Label and EntityCluster changes
Fixes CesiumGS#12826

The previous documentation incorrectly stated that options.geometry could be
either a Geometry or GeometryFactory. However, passing an
already-constructed Geometry object causes the error:
  'DeveloperError: Must define either _workerName or _workerPath
   for asynchronous geometry'

This fix:
- Changes @param type from 'Geometry|GeometryFactory' to 'GeometryFactory'
- Adds explanation that users should pass a GeometryFactory (like BoxGeometry,
  RectangleOutlineGeometry) and NOT the result of createGeometry()
- Changes the internal @type from 'Geometry' to 'GeometryFactory'
@github-actions
Copy link
Copy Markdown
Contributor

Thank you for the pull request, @gy1016! Welcome to the Cesium community!

In order for us to review your PR, please complete the following steps:

Review Pull Request Guidelines to make sure your PR gets accepted quickly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DeveloperError: Must define either _workerName or _workerPath for asynchronous geometry.

2 participants