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

CallbackProperty no longer working for Polygon Entities #8135

Closed
rcologgi opened this issue Sep 4, 2019 · 2 comments
Closed

CallbackProperty no longer working for Polygon Entities #8135

rcologgi opened this issue Sep 4, 2019 · 2 comments

Comments

@rcologgi
Copy link

rcologgi commented Sep 4, 2019

  1. A concise explanation of the problem you're experiencing.
var dynamicPositions = new Cesium.CallbackProperty(function () {
 return positions;
}, false);

This used to be a valid input for a polygon entity hierarchy, but now since CesiumJs version 1.60 this no longer works. This approach follows what was (at some point at least) the suggested method from one of the Sandcastle examples to allow users to draw in the scene. This approach still works for at least polylines and billboards. Seems very likely the issue must be related to this update in the 1.60 release "Added support for polygon holes to CZML." The example below should clarify the problem.

  1. A minimal code example. If you've found a bug, this helps us reproduce and repair it.

Sandcastle

Switching to the commented out code provides a more helpful error report, but also fails. Changing "hierarchy: dynamicPositions" to just "hierarchy: positions" behaves normally, but of course if this example actually leveraged the callback in a meaningful way this would be undesirable.

  1. Context. Why do you need to do this? We might know a better way to accomplish your goal.

We're using position callback properties for dynamic editing.

  1. The Cesium version you're using, your operating system and browser.

Last working in Cesium 1.59.
Broken in Cesium 1.60 and 1.61.
(Ubuntu 19.04 + Chrome)

@shunter
Copy link
Contributor

shunter commented Sep 4, 2019

Here's the corrected version of your example:

Sandcastle

PolygonGraphics.hierarchy was always documented as a property of type PolygonHierarchy, meaning that any Property must produce a value of that type. That would include the CallbackProperty from your example:

var dynamicPositions = new Cesium.CallbackProperty(function() {
    return new Cesium.PolygonHierarchy(positions);
}, false);

Adapting a constant Cartesian array to a PolygonHierarchy was left for backwards compatibility, but using a Cartesian array was undocumented behavior since the hierarchy property was introduced.

@shunter shunter closed this as completed Sep 4, 2019
@TheMrCoder
Copy link

good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants