Skip to content

fix feature.setProperty() to create a new property if it doesn't already exist #10775

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 3 commits into from
Sep 9, 2022

Conversation

ptrgags
Copy link
Contributor

@ptrgags ptrgags commented Sep 9, 2022

Fixes #10773

This fixes the regression in setProperty() for unknown propertyId by:

  • Updating JsonMetadataTable to create a property if it doesn't exist
  • Updating PropertyTable to create a JsonMetadataTable if it doesn't exist, then using this._jsonMetadataTable.setProperty() to create the new property if it doesn't exist.

Other notes:

  • I updated the precedence order to put the JSON properties after the batch table hierarchy for consistency. Interestingly, the old Cesium3DTileBatchTable is inconsistent between getProperty and setProperty.

Sandcastle example -- the property will now be created at runtime, so the console will log This is a new property several times, instead of undefined like it does on main.

@cesium-concierge
Copy link

Thanks for the pull request @ptrgags!

  • ✔️ Signed CLA found.
  • CHANGES.md was not updated.
    • If this change updates the public API in any way, please add a bullet point to CHANGES.md.

Reviewers, don't forget to make sure that:

  • Cesium Viewer works.
  • Works in 2D/CV.

@ptrgags
Copy link
Contributor Author

ptrgags commented Sep 9, 2022

This is now ready for review. @sanjeetsuhag could you review when you get a chance?

Copy link
Contributor

@sanjeetsuhag sanjeetsuhag left a comment

Choose a reason for hiding this comment

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

Changes look good. Tested it with different tilesets and it seems to be the right fix. Thanks @ptrgags!

@sanjeetsuhag
Copy link
Contributor

sanjeetsuhag commented Sep 9, 2022

@ptrgags Could you add an entry for CHANGES.md?

@ptrgags
Copy link
Contributor Author

ptrgags commented Sep 9, 2022

@sanjeetsuhag my bad, I had updated the changelog locally but forgot to push 😅. Pushed it just now!

@sanjeetsuhag sanjeetsuhag merged commit 66185a0 into main Sep 9, 2022
@sanjeetsuhag sanjeetsuhag deleted the fix-set-property branch September 9, 2022 16:42
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

Successfully merging this pull request may close these issues.

setProperty() isn't creating properties if they don't exist
3 participants