Deal with WritePointer#3747
Deal with WritePointer#3747jiapei100 wants to merge 3 commits intoPointCloudLibrary:masterfrom jiapei100:master
Conversation
Which comment are you following?
Yeah, we haven't looked at upgrading our dependencies yet.
The change needs to be compatible with older VTK versions too. Using macros or somehow encapsulating the modifications inside one or 2 functions (to limit the use of macros) would be the best approach. PS: Did you test the changes on VTK 9? |
|
1. Yeah...
2. And, I'm updating the 2nd file now: visualization/include/pcl/visualization/pcl_visualizer.h 3. Finally, I believe the following function in file interator_style.h is wrong as well? /** \brief Set render window. */
void
setRenderWindow (const vtkSmartPointer<vtkRenderWindow> &win)
{
win_ = win;
}How to carry out vtkSmartPointer assignment? |
There was a problem hiding this comment.
I think the most pressing feedback is, delete all commented code you added.
In terms of the solution you provided, it looks flexible for VTK versions 6.0 up to the current nightly build.
Edit: The nightly build appears to provide an AllocateEstimate and AllocateExact methods which might emulate better the original behavior.
I need to actually dig down and come up with an MVCE to test this solution.
| // Create polys from polyMesh.polygons | ||
| vtkSmartPointer<vtkCellArray> cell_array = vtkSmartPointer<vtkCellArray>::New (); | ||
| vtkIdType *cell = cell_array->WritePointer (vertices.size (), vertices.size () * (max_size_of_polygon + 1)); | ||
| // vtkIdType *cell = cell_array->WritePointer (vertices.size (), vertices.size () * (max_size_of_polygon + 1)); |
There was a problem hiding this comment.
Delete all commented code you've introduced. Deleting those lines is perfectly ok. Apply this logic to the rest of the changes you did in this file.
Do you see the code from lines 1690-1693? Since max_size_of_polygon is no longer used, that section is also no longer required.
| // Update the cells | ||
| cells = vtkSmartPointer<vtkCellArray>::New (); | ||
| vtkIdType *cell = cells->WritePointer (verts.size (), verts.size () * (max_size_of_polygon + 1)); | ||
| //vtkIdType *cell = cells->WritePointer (verts.size (), verts.size () * (max_size_of_polygon + 1)); |
There was a problem hiding this comment.
Same comment as before for lines 1869-1872
| #include <pcl/visualization/interactor_style.h> | ||
|
|
||
| // VTK includes | ||
| class vtkSmartPointerBase; |
There was a problem hiding this comment.
This declaration is not used in this header. What made you add it?
| class vtkSmartPointer; | ||
| class vtkPolyData; | ||
| class vtkTextActor; | ||
| class vtkRenderWindow; |
There was a problem hiding this comment.
This declaration is used in this header. I'm surprised the CI is not complaining 😕
|
Marking this as stale due to 30 days of inactivity. Commenting or adding a new commit to the pull request will revert this. |
|
Superseded by #4262. |
WritePointer is NOT in VTK 9.0.0 ....
I'm NOT sure if my way to replace this WritePointer is correct or not, it's just following a comment ...