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

Add new overload of PointCloudColorHandler::getColor() #3187

Merged
merged 2 commits into from
Jun 23, 2019

Conversation

taketwo
Copy link
Member

@taketwo taketwo commented Jun 21, 2019

Add PointCloudColorHandler::getColor() that returns VTK data array and deprecate old getColor(vtkSmartPointer<vtkUnsignedCharArray>&) in its favor. Follow-up to the discussion in #3176.

In the process of implementing my propsal from #3176 I realized that we can not change the signature to use vtkSmartPointer<vtkUnsignedCharArray> since some of the handlers actually produce arrays of floats. However, the idea to always allocate data array inside getColor() and return it as a smart pointer was implementable, so here we go.

Note the two default implementations of getColor in the base that are provided for backwards compatibility. They use each other, which may seem like a circular reference, however in practice should not be a problem. The reason to implement them this way is to support two use-cases in downstream projects:

  1. Custom user-defined handlers. Such handlers certainly override the "old" getColor (because it was pure virtual, thus required to be overriden). Therefore the "new" getColor calls these implementations, and there is no circular reference.
  2. Usage of now-deprecated getColor in user code. In case it's a PCL color handler, the default implementation of "old" getColor will call the new getColor, which is overriden in every PCL color handler, so again no circular reference. In case it's a user color handler, according to item 1 it will again have its own override of the "old" getColor, so no circular references.

This commit adds a new parameter-less method getColor() that returns a
smart pointer to the data array with colors. The old getColor(scalars)
is deprecated in favor of the new method. All point cloud color handlers
in the library are updated to implement the new method.
@taketwo taketwo changed the title Get color Add new overload of PointCloudColorHandler::getColor() Jun 21, 2019
@SergioRAgostinho SergioRAgostinho added module: visualization changelog: deprecation Meta-information for changelog generation labels Jun 23, 2019
@SergioRAgostinho SergioRAgostinho merged commit 0d78358 into PointCloudLibrary:master Jun 23, 2019
@taketwo taketwo deleted the get-color branch June 23, 2019 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: deprecation Meta-information for changelog generation module: visualization
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants