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

Point cloud editing: rewrite COPC when committing changes #60133

Merged
merged 5 commits into from
Jan 16, 2025

Conversation

wonder-sk
Copy link
Member

This PR extends work started in #59973 - it adds functionality to store changes to attributes of a point cloud to a COPC file.

There is a new class QgsCopcUpdate that:

  1. reads and existing COPC file
  2. writes a new COPC file with some chunks (nodes) with updated content

Writing of new COPC files is fast, because typically only a small amount of points are modified and so most of the chunks are copied as they were. There are also no changes to the hierarchy.

QgsPointCloudLayer::commitChanges() has been modified to use QgsCopcUpdate. A new file is created next to the original file. The original file is then renamed, and newly created file is renamed to effectively replace it. In the final step, the original file is removed.

@github-actions github-actions bot added this to the 3.42.0 milestone Jan 13, 2025
Copy link

github-actions bot commented Jan 13, 2025

🪟 Windows builds

Download Windows builds of this PR for testing.
Debug symbols for this build are available here.
(Built from commit 89e7d98)

🪟 Windows Qt6 builds

Download Windows Qt6 builds of this PR for testing.
(Built from commit 89e7d98)

Copy link
Contributor

@uclaros uclaros left a comment

Choose a reason for hiding this comment

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

Nicely done!

Just some tidying up comments.

Also a question: We mostly pass QgsPointCloudNodeId by const ref and name it n, while here it is mostly passed by val and named k. Should we stick with one or the other? With QgsPointCloudNodeId being practically 4 ints it doesn't really matter, right?

src/core/pointcloud/qgscopcpointcloudindex.cpp Outdated Show resolved Hide resolved
src/core/pointcloud/qgscopcupdate.cpp Outdated Show resolved Hide resolved
src/core/pointcloud/qgscopcupdate.cpp Outdated Show resolved Hide resolved
src/core/pointcloud/qgscopcupdate.cpp Outdated Show resolved Hide resolved
src/core/pointcloud/qgscopcupdate.cpp Outdated Show resolved Hide resolved
src/core/pointcloud/qgspointcloudlayereditutils.cpp Outdated Show resolved Hide resolved
src/core/pointcloud/qgspointcloudlayereditutils.cpp Outdated Show resolved Hide resolved
src/core/pointcloud/qgspointcloudlayereditutils.h Outdated Show resolved Hide resolved
src/core/pointcloud/qgspointcloudeditingindex.cpp Outdated Show resolved Hide resolved
@wonder-sk
Copy link
Member Author

Thanks for the review!

We mostly pass QgsPointCloudNodeId by const ref and name it n, while here it is mostly passed by val and named k.

yeah I have changed it now to const ref for consistency, and also renamed k (as for voxel Key) to n ...

@wonder-sk wonder-sk merged commit bd20473 into qgis:master Jan 16, 2025
31 checks passed
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.

2 participants