diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pc_source/mesh_source.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pc_source/mesh_source.h index c71deb64a19..3af9d17cdbe 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pc_source/mesh_source.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pc_source/mesh_source.h @@ -192,7 +192,6 @@ namespace pcl filter_scale->Update (); vtkSmartPointer mapper = filter_scale->GetOutput (); - mapper->Update (); //generate views pcl::apps::RenderViewsTesselatedSphere render_views; diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/utils/vtk_model_sampling.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/utils/vtk_model_sampling.h index f957cd52272..5860d12cfad 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/utils/vtk_model_sampling.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/utils/vtk_model_sampling.h @@ -137,7 +137,6 @@ namespace pcl } vtkSmartPointer poly = mapper->GetInput (); - poly->Update (); uniform_sampling (poly, n_samples, cloud_out); diff --git a/apps/cloud_composer/src/point_selectors/rectangular_frustum_selector.cpp b/apps/cloud_composer/src/point_selectors/rectangular_frustum_selector.cpp index 52909b2d397..ad86a060afd 100644 --- a/apps/cloud_composer/src/point_selectors/rectangular_frustum_selector.cpp +++ b/apps/cloud_composer/src/point_selectors/rectangular_frustum_selector.cpp @@ -54,18 +54,24 @@ pcl::cloud_composer::RectangularFrustumSelector::OnLeftButtonUp () vtkMapper* mapper = act->actor->GetMapper (); vtkDataSet* data = mapper->GetInput (); vtkPolyData* poly_data = vtkPolyData::SafeDownCast (data); +#if VTK_MAJOR_VERSION > 5 + id_filter->SetInputData (poly_data); +#else id_filter->SetInput (poly_data); +#endif //extract_geometry->SetInput (poly_data); vtkSmartPointer selected = vtkSmartPointer::New (); glyph_filter->SetOutput (selected); glyph_filter->Update (); +#if VTK_MAJOR_VERSION < 6 selected->SetSource (0); +#endif if (selected->GetNumberOfPoints() > 0) { qDebug () << "Selected " << selected->GetNumberOfPoints () << " points."; id_selected_data_map.insert ( QString::fromStdString ((*it).first), selected); - #if VTK_MAJOR_VERSION <= 5 + #if VTK_MAJOR_VERSION < 6 append->AddInput (selected); #else // VTK 6 append->AddInputData (selected); @@ -77,9 +83,12 @@ pcl::cloud_composer::RectangularFrustumSelector::OnLeftButtonUp () append->Update (); vtkSmartPointer all_points = append->GetOutput (); qDebug () << "Allpoints = " <GetNumberOfPoints (); - - selected_mapper->SetInput (all_points); +#if VTK_MAJOR_VERSION < 6 + selected_mapper->SetInput (all_points); +#else + selected_mapper->SetInputData (all_points); +#endif selected_mapper->ScalarVisibilityOff (); vtkIdTypeArray* ids = vtkIdTypeArray::SafeDownCast (all_points->GetPointData ()->GetArray ("OriginalIds")); diff --git a/apps/modeler/src/normals_actor_item.cpp b/apps/modeler/src/normals_actor_item.cpp index bb443f5b16f..fc8bd54126b 100755 --- a/apps/modeler/src/normals_actor_item.cpp +++ b/apps/modeler/src/normals_actor_item.cpp @@ -137,7 +137,11 @@ pcl::modeler::NormalsActorItem::initImpl() createNormalLines(); vtkSmartPointer mapper = vtkSmartPointer::New(); +#if VTK_MAJOR_VERSION < 6 mapper->SetInput(poly_data_); +#else + mapper->SetInputData (poly_data_); +#endif vtkSmartPointer scalars; cloud_mesh_->getColorScalarsFromField(scalars, color_scheme_); @@ -166,8 +170,6 @@ pcl::modeler::NormalsActorItem::updateImpl() scalars->GetRange(minmax); actor_->GetMapper()->SetScalarRange(minmax); - poly_data_->Update(); - return; } diff --git a/apps/modeler/src/points_actor_item.cpp b/apps/modeler/src/points_actor_item.cpp index 2c2474ac38b..fbd94669b25 100755 --- a/apps/modeler/src/points_actor_item.cpp +++ b/apps/modeler/src/points_actor_item.cpp @@ -64,13 +64,12 @@ void pcl::modeler::PointsActorItem::initImpl() { poly_data_->SetPoints(cloud_mesh_->getVtkPoints()); - poly_data_->Update(); vtkSmartPointer vertex_glyph_filter = vtkSmartPointer::New(); -#if VTK_MAJOR_VERSION <= 5 +#if VTK_MAJOR_VERSION < 6 vertex_glyph_filter->AddInput(poly_data_); #else - vertex_glyph_filter->AddInputData(polydata); + vertex_glyph_filter->AddInputData (poly_data_); #endif vertex_glyph_filter->Update(); @@ -109,8 +108,6 @@ pcl::modeler::PointsActorItem::updateImpl() scalars->GetRange(minmax); actor_->GetMapper()->SetScalarRange(minmax); - poly_data_->Update(); - return; } diff --git a/apps/modeler/src/surface_actor_item.cpp b/apps/modeler/src/surface_actor_item.cpp index cf7b0a5dc9a..6a8a9252868 100755 --- a/apps/modeler/src/surface_actor_item.cpp +++ b/apps/modeler/src/surface_actor_item.cpp @@ -69,10 +69,13 @@ pcl::modeler::SurfaceActorItem::initImpl() vtkSmartPointer scalars; cloud_mesh_->getColorScalarsFromField(scalars, color_scheme_); poly_data_->GetPointData ()->SetScalars (scalars); - poly_data_->Update(); vtkSmartPointer mapper = vtkSmartPointer::New(); +#if VTK_MAJOR_VERSION < 6 mapper->SetInput(poly_data_); +#else + mapper->SetInputData (poly_data_); +#endif double minmax[2]; scalars->GetRange(minmax); @@ -108,8 +111,6 @@ pcl::modeler::SurfaceActorItem::updateImpl() scalars->GetRange(minmax); actor_->GetMapper()->SetScalarRange(minmax); - poly_data_->Update(); - return; } diff --git a/apps/src/render_views_tesselated_sphere.cpp b/apps/src/render_views_tesselated_sphere.cpp index 513fb52606b..48e7dfe8ab5 100644 --- a/apps/src/render_views_tesselated_sphere.cpp +++ b/apps/src/render_views_tesselated_sphere.cpp @@ -61,7 +61,11 @@ pcl::apps::RenderViewsTesselatedSphere::generateViews() { vtkSmartPointer trans_filter_center = vtkSmartPointer::New (); trans_filter_center->SetTransform (trans_center); +#if VTK_MAJOR_VERSION < 6 trans_filter_center->SetInput (polydata_); +#else + trans_filter_center->SetInputData (polydata_); +#endif trans_filter_center->Update (); vtkSmartPointer mapper = vtkSmartPointer::New (); @@ -116,7 +120,6 @@ pcl::apps::RenderViewsTesselatedSphere::generateViews() { // Get camera positions vtkPolyData *sphere = subdivide->GetOutput (); - sphere->Update (); std::vector cam_positions; if (!use_vertices_) diff --git a/io/include/pcl/io/impl/vtk_lib_io.hpp b/io/include/pcl/io/impl/vtk_lib_io.hpp index fcd52f956b7..695e3464303 100644 --- a/io/include/pcl/io/impl/vtk_lib_io.hpp +++ b/io/include/pcl/io/impl/vtk_lib_io.hpp @@ -51,6 +51,7 @@ #ifdef __GNUC__ #pragma GCC system_header #endif +#include #include #include #include @@ -377,7 +378,7 @@ pcl::io::pointCloudTovtkPolyData (const pcl::PointCloud& cloud, vtkPolyD // Add 0D topology to every point vtkSmartPointer vertex_glyph_filter = vtkSmartPointer::New (); - #if VTK_MAJOR_VERSION <= 5 + #if VTK_MAJOR_VERSION < 6 vertex_glyph_filter->AddInputConnection (temp_polydata->GetProducerPort ()); #else vertex_glyph_filter->SetInputData (temp_polydata); diff --git a/io/include/pcl/io/vtk_lib_io.h b/io/include/pcl/io/vtk_lib_io.h index 275a151ce9b..f5cbd23c1c5 100644 --- a/io/include/pcl/io/vtk_lib_io.h +++ b/io/include/pcl/io/vtk_lib_io.h @@ -54,6 +54,7 @@ #ifdef __GNUC__ #pragma GCC system_header #endif +#include #include #include #include diff --git a/io/src/vtk_lib_io.cpp b/io/src/vtk_lib_io.cpp index dc4b1c8cef8..257138b6ac9 100644 --- a/io/src/vtk_lib_io.cpp +++ b/io/src/vtk_lib_io.cpp @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -178,7 +179,11 @@ pcl::io::savePolygonFileVTK (const std::string &file_name, const pcl::PolygonMes pcl::io::mesh2vtk (mesh, poly_data); vtkSmartPointer poly_writer = vtkSmartPointer::New (); +#if VTK_MAJOR_VERSION < 6 poly_writer->SetInput (poly_data); +#else + poly_writer->SetInputData (poly_data); +#endif poly_writer->SetFileName (file_name.c_str ()); poly_writer->Write (); @@ -194,7 +199,11 @@ pcl::io::savePolygonFilePLY (const std::string &file_name, const pcl::PolygonMes pcl::io::mesh2vtk (mesh, poly_data); vtkSmartPointer poly_writer = vtkSmartPointer::New (); +#if VTK_MAJOR_VERSION < 6 poly_writer->SetInput (poly_data); +#else + poly_writer->SetInputData (poly_data); +#endif poly_writer->SetFileName (file_name.c_str ()); poly_writer->SetArrayName ("Colors"); poly_writer->Write (); @@ -209,9 +218,12 @@ pcl::io::savePolygonFileSTL (const std::string &file_name, const pcl::PolygonMes vtkSmartPointer poly_data = vtkSmartPointer::New (); pcl::io::mesh2vtk (mesh, poly_data); - poly_data->Update (); vtkSmartPointer poly_writer = vtkSmartPointer::New (); +#if VTK_MAJOR_VERSION < 6 poly_writer->SetInput (poly_data); +#else + poly_writer->SetInputData (poly_data); +#endif poly_writer->SetFileName (file_name.c_str ()); poly_writer->Write (); @@ -483,9 +495,13 @@ pcl::io::saveRangeImagePlanarFilePNG ( { vtkSmartPointer image = vtkSmartPointer::New(); image->SetDimensions(range_image.width, range_image.height, 1); +#if VTK_MAJOR_VERSION < 6 image->SetNumberOfScalarComponents(1); image->SetScalarTypeToFloat(); image->AllocateScalars(); +#else + image->AllocateScalars (VTK_FLOAT, 1); +#endif int* dims = image->GetDimensions(); @@ -504,7 +520,11 @@ pcl::io::saveRangeImagePlanarFilePNG ( vtkSmartPointer shiftScaleFilter = vtkSmartPointer::New(); shiftScaleFilter->SetOutputScalarTypeToUnsignedChar(); +#if VTK_MAJOR_VERSION < 6 shiftScaleFilter->SetInputConnection(image->GetProducerPort()); +#else + shiftScaleFilter->SetInputData (image); +#endif shiftScaleFilter->SetShift(-1.0f * image->GetScalarRange()[0]); // brings the lower bound to 0 shiftScaleFilter->SetScale(newRange/oldRange); shiftScaleFilter->Update(); diff --git a/outofcore/include/pcl/outofcore/visualization/axes.h b/outofcore/include/pcl/outofcore/visualization/axes.h index 24c09eab271..e4c2bf76f53 100644 --- a/outofcore/include/pcl/outofcore/visualization/axes.h +++ b/outofcore/include/pcl/outofcore/visualization/axes.h @@ -9,6 +9,7 @@ #include "object.h" // VTK +#include #include #include #include @@ -31,6 +32,7 @@ class Axes : public Object axes_ = vtkSmartPointer::New (); axes_->SetOrigin (0, 0, 0); axes_->SetScaleFactor (size); + axes_->Update (); vtkSmartPointer axes_colors = vtkSmartPointer::New (); axes_colors->Allocate (6); @@ -42,17 +44,24 @@ class Axes : public Object axes_colors->InsertNextValue (1.0); vtkSmartPointer axes_data = axes_->GetOutput (); - axes_data->Update (); axes_data->GetPointData ()->SetScalars (axes_colors); vtkSmartPointer axes_tubes = vtkSmartPointer::New (); +#if VTK_MAJOR_VERSION < 6 axes_tubes->SetInput (axes_data); +#else + axes_tubes->SetInputData (axes_data); +#endif axes_tubes->SetRadius (axes_->GetScaleFactor () / 100.0); axes_tubes->SetNumberOfSides (6); vtkSmartPointer axes_mapper = vtkSmartPointer::New (); axes_mapper->SetScalarModeToUsePointData (); +#if VTK_MAJOR_VERSION < 6 axes_mapper->SetInput (axes_tubes->GetOutput ()); +#else + axes_mapper->SetInputData (axes_tubes->GetOutput ()); +#endif axes_actor_ = vtkSmartPointer::New (); axes_actor_->GetProperty ()->SetLighting (false); diff --git a/outofcore/src/visualization/camera.cpp b/outofcore/src/visualization/camera.cpp index 951a445748a..6f89e667307 100644 --- a/outofcore/src/visualization/camera.cpp +++ b/outofcore/src/visualization/camera.cpp @@ -98,7 +98,7 @@ Camera::computeFrustum () // // vtkSmartPointer hull_mapper = static_cast (hull_actor_->GetMapper ()); // -//#if VTK_MAJOR_VERSION <= 5 +//#if VTK_MAJOR_VERSION < 6 // hull_mapper->SetInput (hullData); //#else // hull_mapper->SetInputData(hullData); diff --git a/outofcore/src/visualization/grid.cpp b/outofcore/src/visualization/grid.cpp index c48f9aad6a3..b19cbe326be 100644 --- a/outofcore/src/visualization/grid.cpp +++ b/outofcore/src/visualization/grid.cpp @@ -3,6 +3,7 @@ #include // VTK +#include #include #include #include @@ -36,7 +37,7 @@ Grid::Grid (std::string name, int size/*=10*/, double spacing/*=1.0*/) : grid_->SetYCoordinates (y_array); grid_->SetZCoordinates (xz_array); -#if VTK_MAJOR_VERSION <= 5 +#if VTK_MAJOR_VERSION < 6 grid_mapper->SetInputConnection (grid_->GetProducerPort ()); #else grid_mapper->SetInputData(grid_); diff --git a/outofcore/src/visualization/outofcore_cloud.cpp b/outofcore/src/visualization/outofcore_cloud.cpp index 356f5934f10..d712c835b5c 100644 --- a/outofcore/src/visualization/outofcore_cloud.cpp +++ b/outofcore/src/visualization/outofcore_cloud.cpp @@ -24,6 +24,7 @@ #include // VTK +#include #include #include #include @@ -159,10 +160,18 @@ OutofcoreCloud::updateVoxelData () double y = voxel_centers[i].y; double z = voxel_centers[i].z; +#if VTK_MAJOR_VERSION < 6 voxel_data->AddInput (getVtkCube (x - s, x + s, y - s, y + s, z - s, z + s)); +#else + voxel_data->AddInputData (getVtkCube (x - s, x + s, y - s, y + s, z - s, z + s)); +#endif } +#if VTK_MAJOR_VERSION < 6 voxel_mapper->SetInput (voxel_data->GetOutput ()); +#else + voxel_mapper->SetInputData (voxel_data->GetOutput ()); +#endif voxel_actor_->SetMapper (voxel_mapper); voxel_actor_->GetProperty ()->SetRepresentationToWireframe (); diff --git a/surface/src/vtk_smoothing/vtk_mesh_quadric_decimation.cpp b/surface/src/vtk_smoothing/vtk_mesh_quadric_decimation.cpp index 9485106a168..a10e68abd05 100644 --- a/surface/src/vtk_smoothing/vtk_mesh_quadric_decimation.cpp +++ b/surface/src/vtk_smoothing/vtk_mesh_quadric_decimation.cpp @@ -39,6 +39,7 @@ #include #include +#include #include ////////////////////////////////////////////////////////////////////////////////////////////// @@ -59,7 +60,11 @@ pcl::MeshQuadricDecimationVTK::performProcessing (pcl::PolygonMesh &output) // Apply the VTK algorithm vtkSmartPointer vtk_quadric_decimation_filter = vtkSmartPointer::New(); vtk_quadric_decimation_filter->SetTargetReduction (target_reduction_factor_); +#if VTK_MAJOR_VERSION < 6 vtk_quadric_decimation_filter->SetInput (vtk_polygons_); +#else + vtk_quadric_decimation_filter->SetInputData (vtk_polygons_); +#endif vtk_quadric_decimation_filter->Update (); vtk_polygons_ = vtk_quadric_decimation_filter->GetOutput (); diff --git a/surface/src/vtk_smoothing/vtk_mesh_smoothing_laplacian.cpp b/surface/src/vtk_smoothing/vtk_mesh_smoothing_laplacian.cpp index ac6ced468f9..1134006554a 100644 --- a/surface/src/vtk_smoothing/vtk_mesh_smoothing_laplacian.cpp +++ b/surface/src/vtk_smoothing/vtk_mesh_smoothing_laplacian.cpp @@ -39,6 +39,7 @@ #include #include +#include #include @@ -51,7 +52,11 @@ pcl::MeshSmoothingLaplacianVTK::performProcessing (pcl::PolygonMesh &output) // Apply the VTK algorithm vtkSmartPointer vtk_smoother = vtkSmoothPolyDataFilter::New (); +#if VTK_MAJOR_VERSION < 6 vtk_smoother->SetInput (vtk_polygons_); +#else + vtk_smoother->SetInputData (vtk_polygons_); +#endif vtk_smoother->SetNumberOfIterations (num_iter_); if (convergence_ != 0.0f) vtk_smoother->SetConvergence (convergence_); diff --git a/surface/src/vtk_smoothing/vtk_mesh_smoothing_windowed_sinc.cpp b/surface/src/vtk_smoothing/vtk_mesh_smoothing_windowed_sinc.cpp index d01f155d6e2..67873674263 100644 --- a/surface/src/vtk_smoothing/vtk_mesh_smoothing_windowed_sinc.cpp +++ b/surface/src/vtk_smoothing/vtk_mesh_smoothing_windowed_sinc.cpp @@ -39,6 +39,7 @@ #include #include +#include #include @@ -51,7 +52,11 @@ pcl::MeshSmoothingWindowedSincVTK::performProcessing (pcl::PolygonMesh &output) // Apply the VTK algorithm vtkSmartPointer vtk_smoother = vtkWindowedSincPolyDataFilter::New (); +#if VTK_MAJOR_VERSION < 6 vtk_smoother->SetInput (vtk_polygons_); +#else + vtk_smoother->SetInputData (vtk_polygons_); +#endif vtk_smoother->SetNumberOfIterations (num_iter_); vtk_smoother->SetPassBand (pass_band_); vtk_smoother->SetNormalizeCoordinates (normalize_coordinates_); diff --git a/surface/src/vtk_smoothing/vtk_mesh_subdivision.cpp b/surface/src/vtk_smoothing/vtk_mesh_subdivision.cpp index d6309e3fa28..7debf28bba2 100644 --- a/surface/src/vtk_smoothing/vtk_mesh_subdivision.cpp +++ b/surface/src/vtk_smoothing/vtk_mesh_subdivision.cpp @@ -39,6 +39,7 @@ #include #include +#include #include #include #include @@ -78,7 +79,11 @@ pcl::MeshSubdivisionVTK::performProcessing (pcl::PolygonMesh &output) break; } +#if VTK_MAJOR_VERSION < 6 vtk_subdivision_filter->SetInput (vtk_polygons_); +#else + vtk_subdivision_filter->SetInputData (vtk_polygons_); +#endif vtk_subdivision_filter->Update (); vtk_polygons_ = vtk_subdivision_filter->GetOutput (); diff --git a/surface/src/vtk_smoothing/vtk_utils.cpp b/surface/src/vtk_smoothing/vtk_utils.cpp index 9a4e7dc6382..7c47a797dc2 100644 --- a/surface/src/vtk_smoothing/vtk_utils.cpp +++ b/surface/src/vtk_smoothing/vtk_utils.cpp @@ -41,6 +41,7 @@ #include #include +#include #include #include #include @@ -63,7 +64,11 @@ pcl::VTKUtils::convertToVTK (const pcl::PolygonMesh &triangles, vtkSmartPointer< mesh2vtk (triangles, vtk_polygons); vtkSmartPointer vtk_triangles = vtkTriangleFilter::New (); +#if VTK_MAJOR_VERSION < 6 vtk_triangles->SetInput (vtk_polygons); +#else + vtk_triangles->SetInputData (vtk_polygons); +#endif vtk_triangles->Update(); triangles_out_vtk = vtk_triangles->GetOutput (); diff --git a/tools/mesh2pcd.cpp b/tools/mesh2pcd.cpp index 0ef0f889236..7401a1c798d 100644 --- a/tools/mesh2pcd.cpp +++ b/tools/mesh2pcd.cpp @@ -111,15 +111,15 @@ main (int argc, char **argv) { vtkSmartPointer readerQuery = vtkSmartPointer::New (); readerQuery->SetFileName (argv[ply_file_indices[0]]); + readerQuery->Update (); polydata1 = readerQuery->GetOutput (); - polydata1->Update (); } else if (obj_file_indices.size () == 1) { vtkSmartPointer readerQuery = vtkSmartPointer::New (); readerQuery->SetFileName (argv[obj_file_indices[0]]); + readerQuery->Update (); polydata1 = readerQuery->GetOutput (); - polydata1->Update (); } bool INTER_VIS = false; diff --git a/tools/mesh_sampling.cpp b/tools/mesh_sampling.cpp index d25760e55c9..ec3a1098171 100644 --- a/tools/mesh_sampling.cpp +++ b/tools/mesh_sampling.cpp @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -196,20 +197,23 @@ main (int argc, char **argv) { vtkSmartPointer readerQuery = vtkSmartPointer::New (); readerQuery->SetFileName (argv[obj_file_indices[0]]); + readerQuery->Update (); polydata1 = readerQuery->GetOutput (); - polydata1->Update (); } //make sure that the polygons are triangles! vtkSmartPointer triangleFilter = vtkSmartPointer::New (); +#if VTK_MAJOR_VERSION < 6 triangleFilter->SetInput (polydata1); +#else + triangleFilter->SetInputData (polydata1); +#endif triangleFilter->Update (); vtkSmartPointer triangleMapper = vtkSmartPointer::New (); triangleMapper->SetInputConnection (triangleFilter->GetOutputPort ()); triangleMapper->Update(); polydata1 = triangleMapper->GetInput(); - polydata1->Update (); bool INTER_VIS = false; bool VIS = true; diff --git a/tools/obj2vtk.cpp b/tools/obj2vtk.cpp index 8afe1b1cada..4af484aac16 100644 --- a/tools/obj2vtk.cpp +++ b/tools/obj2vtk.cpp @@ -76,12 +76,16 @@ main (int argc, char** argv) vtkSmartPointer polydata; vtkSmartPointer reader = vtkSmartPointer::New (); reader->SetFileName (argv[obj_file_indices[0]]); + reader->Update (); polydata = reader->GetOutput (); - polydata->Update (); // Convert to VTK and save vtkSmartPointer writer = vtkSmartPointer::New (); +#if VTK_MAJOR_VERSION < 6 writer->SetInput (polydata); +#else + writer->SetInputData (polydata); +#endif writer->SetFileName (argv[vtk_file_indices[0]]); writer->Write (); } diff --git a/tools/obj_rec_ransac_accepted_hypotheses.cpp b/tools/obj_rec_ransac_accepted_hypotheses.cpp index fb33949013a..b1bf3ddb423 100644 --- a/tools/obj_rec_ransac_accepted_hypotheses.cpp +++ b/tools/obj_rec_ransac_accepted_hypotheses.cpp @@ -49,6 +49,7 @@ #include #include #include +#include #include #include #include @@ -323,13 +324,21 @@ update (CallbackParameters* params) // Setup the transformator vtkSmartPointer vtk_transformator = vtkSmartPointer::New (); vtk_transformator->SetTransform (vtk_transform); +#if VTK_MAJOR_VERSION < 6 vtk_transformator->SetInput (vtk_model); +#else + vtk_transformator->SetInputData (vtk_model); +#endif vtk_transformator->Update (); // Visualize vtkSmartPointer vtk_actor = vtkSmartPointer::New(); vtkSmartPointer vtk_mapper = vtkSmartPointer::New (); +#if VTK_MAJOR_VERSION < 6 vtk_mapper->SetInput(vtk_transformator->GetOutput ()); +#else + vtk_mapper->SetInputData (vtk_transformator->GetOutput ()); +#endif vtk_actor->SetMapper(vtk_mapper); // Set the appearance & add to the renderer vtk_actor->GetProperty ()->SetColor (0.6, 0.7, 0.9); diff --git a/tools/obj_rec_ransac_model_opps.cpp b/tools/obj_rec_ransac_model_opps.cpp index d056b18a0c1..c77cac7ee0d 100644 --- a/tools/obj_rec_ransac_model_opps.cpp +++ b/tools/obj_rec_ransac_model_opps.cpp @@ -48,6 +48,7 @@ #include #include #include +#include #include #include #include @@ -215,7 +216,11 @@ void showModelOpps (PCLVisualizer& viz, const ModelLibrary::HashTable& hash_tabl // Save the normals vtk_opps->GetPointData ()->SetNormals (vtk_normals); // Setup the hedge hog object +#if VTK_MAJOR_VERSION < 6 vtk_hedge_hog->SetInput (vtk_opps); +#else + vtk_hedge_hog->SetInputData (vtk_opps); +#endif vtk_hedge_hog->SetVectorModeToUseNormal (); vtk_hedge_hog->SetScaleFactor (0.5f*pair_width); vtk_hedge_hog->Update (); diff --git a/tools/obj_rec_ransac_orr_octree.cpp b/tools/obj_rec_ransac_orr_octree.cpp index 1256f0fc880..a52afb08b18 100644 --- a/tools/obj_rec_ransac_orr_octree.cpp +++ b/tools/obj_rec_ransac_orr_octree.cpp @@ -54,6 +54,7 @@ #include #include #include +#include #include #include #include @@ -304,7 +305,11 @@ void node_to_cube (ORROctree::Node* node, vtkAppendPolyData* additive_octree) cube->SetBounds (b[0], b[1], b[2], b[3], b[4], b[5]); cube->Update (); +#if VTK_MAJOR_VERSION < 6 additive_octree->AddInput (cube->GetOutput ()); +#else + additive_octree->AddInputData (cube->GetOutput ()); +#endif } //=============================================================================================================================== @@ -363,7 +368,11 @@ void show_octree (ORROctree* octree, PCLVisualizer& viz, bool show_full_leaves_o vtkRenderer *renderer = viz.getRenderWindow ()->GetRenderers ()->GetFirstRenderer (); vtkSmartPointer octree_actor = vtkSmartPointer::New(); vtkSmartPointer mapper = vtkSmartPointer::New (); +#if VTK_MAJOR_VERSION < 6 mapper->SetInput(vtk_octree); +#else + mapper->SetInputData (vtk_octree); +#endif octree_actor->SetMapper(mapper); // Set the appearance & add to the renderer diff --git a/tools/obj_rec_ransac_orr_octree_zprojection.cpp b/tools/obj_rec_ransac_orr_octree_zprojection.cpp index 868d97dea37..1090a38eb92 100644 --- a/tools/obj_rec_ransac_orr_octree_zprojection.cpp +++ b/tools/obj_rec_ransac_orr_octree_zprojection.cpp @@ -54,6 +54,7 @@ #include #include #include +#include #include #include #include @@ -206,7 +207,11 @@ void show_octree (ORROctree* octree, PCLVisualizer& viz) vtkRenderer *renderer = viz.getRenderWindow ()->GetRenderers ()->GetFirstRenderer (); vtkSmartPointer octree_actor = vtkSmartPointer::New(); vtkSmartPointer mapper = vtkSmartPointer::New (); +#if VTK_MAJOR_VERSION < 6 mapper->SetInput(vtk_octree); +#else + mapper->SetInputData (vtk_octree); +#endif octree_actor->SetMapper(mapper); // Set the appearance & add to the renderer @@ -250,9 +255,17 @@ void show_octree_zproj (ORROctreeZProjection* zproj, PCLVisualizer& viz) vtkRenderer *renderer = viz.getRenderWindow ()->GetRenderers ()->GetFirstRenderer (); vtkSmartPointer upper_actor = vtkSmartPointer::New(), lower_actor = vtkSmartPointer::New(); vtkSmartPointer upper_mapper = vtkSmartPointer::New (), lower_mapper = vtkSmartPointer::New (); +#if VTK_MAJOR_VERSION < 6 upper_mapper->SetInput(upper_bound->GetOutput ()); +#else + upper_mapper->SetInputData (upper_bound->GetOutput ()); +#endif upper_actor->SetMapper(upper_mapper); +#if VTK_MAJOR_VERSION < 6 lower_mapper->SetInput(lower_bound->GetOutput ()); +#else + lower_mapper->SetInputData (lower_bound->GetOutput ()); +#endif lower_actor->SetMapper(lower_mapper); // Set the appearance & add to the renderer @@ -272,7 +285,11 @@ void node_to_cube (ORROctree::Node* node, vtkAppendPolyData* additive_octree) cube->SetBounds (b[0], b[1], b[2], b[3], b[4], b[5]); cube->Update (); +#if VTK_MAJOR_VERSION < 6 additive_octree->AddInput (cube->GetOutput ()); +#else + additive_octree->AddInputData (cube->GetOutput ()); +#endif } //=============================================================================================================================== @@ -284,7 +301,11 @@ void rectangle_to_vtk (float x1, float x2, float y1, float y2, float z, vtkAppen cube->SetBounds (x1, x2, y1, y2, z, z); cube->Update (); +#if VTK_MAJOR_VERSION < 6 additive_rectangle->AddInput (cube->GetOutput ()); +#else + additive_rectangle->AddInputData (cube->GetOutput ()); +#endif } //=============================================================================================================================== diff --git a/tools/obj_rec_ransac_result.cpp b/tools/obj_rec_ransac_result.cpp index 4b916282408..b7b7721004c 100644 --- a/tools/obj_rec_ransac_result.cpp +++ b/tools/obj_rec_ransac_result.cpp @@ -49,6 +49,7 @@ #include #include #include +#include #include #include #include @@ -281,13 +282,21 @@ update (CallbackParameters* params) // Setup the transformator vtkSmartPointer vtk_transformator = vtkSmartPointer::New (); vtk_transformator->SetTransform (vtk_transform); +#if VTK_MAJOR_VERSION < 6 vtk_transformator->SetInput (vtk_model); +#else + vtk_transformator->SetInputData (vtk_model); +#endif vtk_transformator->Update (); // Visualize vtkSmartPointer vtk_actor = vtkSmartPointer::New(); vtkSmartPointer vtk_mapper = vtkSmartPointer::New (); +#if VTK_MAJOR_VERSION < 6 vtk_mapper->SetInput(vtk_transformator->GetOutput ()); +#else + vtk_mapper->SetInputData (vtk_transformator->GetOutput ()); +#endif vtk_actor->SetMapper(vtk_mapper); // Set the appearance & add to the renderer vtk_actor->GetProperty ()->SetColor (0.6, 0.7, 0.9); diff --git a/tools/obj_rec_ransac_scene_opps.cpp b/tools/obj_rec_ransac_scene_opps.cpp index 7330104340c..bb94e8c171c 100644 --- a/tools/obj_rec_ransac_scene_opps.cpp +++ b/tools/obj_rec_ransac_scene_opps.cpp @@ -49,6 +49,7 @@ #include #include #include +#include #include #include #include @@ -173,7 +174,11 @@ void update (CallbackParameters* params) vtkSmartPointer vtk_hh = vtkSmartPointer::New (); vtk_hh->SetVectorModeToUseNormal (); vtk_hh->SetScaleFactor (0.5f*params->objrec_.getPairWidth ()); +#if VTK_MAJOR_VERSION < 6 vtk_hh->SetInput (vtk_opps); +#else + vtk_hh->SetInputData (vtk_opps); +#endif vtk_hh->Update (); // The lines diff --git a/tools/octree_viewer.cpp b/tools/octree_viewer.cpp index 63c1287110d..37d2e98ccf3 100644 --- a/tools/octree_viewer.cpp +++ b/tools/octree_viewer.cpp @@ -294,13 +294,21 @@ class OctreeViewer double y = displayCloud->points[i].y; double z = displayCloud->points[i].z; +#if VTK_MAJOR_VERSION < 6 treeWireframe->AddInput(GetCuboid(x - s, x + s, y - s, y + s, z - s, z + s)); +#else + treeWireframe->AddInputData (GetCuboid (x - s, x + s, y - s, y + s, z - s, z + s)); +#endif } vtkSmartPointer treeActor = vtkSmartPointer::New(); vtkSmartPointer mapper = vtkSmartPointer::New(); +#if VTK_MAJOR_VERSION < 6 mapper->SetInput(treeWireframe->GetOutput()); +#else + mapper->SetInputData (treeWireframe->GetOutput ()); +#endif treeActor->SetMapper(mapper); treeActor->GetProperty()->SetColor(1.0, 1.0, 1.0); diff --git a/tools/ply2vtk.cpp b/tools/ply2vtk.cpp index fcfb0603241..b61aecfe2b6 100644 --- a/tools/ply2vtk.cpp +++ b/tools/ply2vtk.cpp @@ -76,13 +76,17 @@ main (int argc, char** argv) vtkSmartPointer polydata; vtkSmartPointer reader = vtkSmartPointer::New (); reader->SetFileName (argv[ply_file_indices[0]]); + reader->Update (); polydata = reader->GetOutput (); - polydata->Update (); print_info ("Loaded %s with %lu points/vertices.\n", argv[ply_file_indices[0]], polydata->GetNumberOfPoints ()); // Convert to VTK and save vtkSmartPointer writer = vtkSmartPointer::New (); +#if VTK_MAJOR_VERSION < 6 writer->SetInput (polydata); +#else + writer->SetInputData (polydata); +#endif writer->SetFileName (argv[vtk_file_indices[0]]); writer->SetFileTypeToBinary (); writer->Write (); diff --git a/tools/png2pcd.cpp b/tools/png2pcd.cpp index 1d373617123..5d9595998fd 100644 --- a/tools/png2pcd.cpp +++ b/tools/png2pcd.cpp @@ -165,8 +165,8 @@ main (int argc, char** argv) vtkSmartPointer color_image_data; vtkSmartPointer color_reader = vtkSmartPointer::New (); color_reader->SetFileName (argv[png_file_indices[0]]); + color_reader->Update (); color_image_data = color_reader->GetOutput (); - color_image_data->Update (); int components = color_image_data->GetNumberOfScalarComponents (); int dimensions[3]; @@ -183,8 +183,8 @@ main (int argc, char** argv) { depth_reader = vtkSmartPointer::New (); depth_reader->SetFileName (argv[png_file_indices[1]]); + depth_reader->Update (); depth_image_data = depth_reader->GetOutput (); - depth_image_data->Update (); if (depth_reader->GetNumberOfScalarComponents () != 1) { diff --git a/tools/tiff2pcd.cpp b/tools/tiff2pcd.cpp index 58cf1fdd5f0..a22584850f7 100644 --- a/tools/tiff2pcd.cpp +++ b/tools/tiff2pcd.cpp @@ -342,8 +342,8 @@ int main(int argc, char ** argv) if(ret == 2 || ret == 3) { reader->SetFileName (tiff_rgb_files[i].c_str()); + reader->Update (); rgb_data = reader->GetOutput (); - rgb_data->Update (); std::string rgb_filename = tiff_rgb_paths[i].filename().string(); std::string rgb_time = rgb_filename.substr(6,22); @@ -380,8 +380,8 @@ int main(int argc, char ** argv) if(read == 2 || read == 3) { depth_reader->SetFileName (tiff_depth_files[j].c_str()); + depth_reader->Update (); depth_data = depth_reader->GetOutput (); - depth_data->Update (); processAndSave(depth_data, rgb_data, depth_time, focal_length, format, color, depth, use_output_path, output_path_); } diff --git a/tools/virtual_scanner.cpp b/tools/virtual_scanner.cpp index 3ff5f2f4a5c..5dfcf797739 100644 --- a/tools/virtual_scanner.cpp +++ b/tools/virtual_scanner.cpp @@ -218,10 +218,10 @@ main (int argc, char** argv) vtkSmartPointer subdivide = vtkSmartPointer::New (); subdivide->SetNumberOfSubdivisions (subdiv_level); subdivide->SetInputConnection (icosa->GetOutputPort ()); + subdivide->Update (); // Get camera positions vtkPolyData *sphere = subdivide->GetOutput (); - sphere->Update (); if (!single_view) PCL_INFO ("Created %ld camera position points.\n", sphere->GetNumberOfPoints ()); diff --git a/tools/voxel_grid_occlusion_estimation.cpp b/tools/voxel_grid_occlusion_estimation.cpp index 12ebc5e290a..5f03abd79c7 100644 --- a/tools/voxel_grid_occlusion_estimation.cpp +++ b/tools/voxel_grid_occlusion_estimation.cpp @@ -99,13 +99,23 @@ getVoxelActors (pcl::PointCloud& voxelCenters, double y = voxelCenters.points[i].y; double z = voxelCenters.points[i].z; +#if VTK_MAJOR_VERSION < 6 treeWireframe->AddInput (getCuboid (x - s, x + s, y - s, y + s, z - s, z + s)); +#else + treeWireframe->AddInputData (getCuboid (x - s, x + s, y - s, y + s, z - s, z + s)); +#endif + } vtkSmartPointer < vtkLODActor > treeActor = vtkSmartPointer::New (); vtkSmartPointer < vtkDataSetMapper > mapper = vtkSmartPointer::New (); +#if VTK_MAJOR_VERSION < 6 mapper->SetInput (treeWireframe->GetOutput ()); +#else + mapper->SetInputData (treeWireframe->GetOutput ()); +#endif + treeActor->SetMapper (mapper); treeActor->GetProperty ()->SetRepresentationToWireframe (); @@ -119,12 +129,20 @@ displayBoundingBox (Eigen::Vector3f& min_b, Eigen::Vector3f& max_b, vtkSmartPointer coll) { vtkSmartPointer < vtkAppendPolyData > treeWireframe = vtkSmartPointer::New (); +#if VTK_MAJOR_VERSION < 6 treeWireframe->AddInput (getCuboid (min_b[0], max_b[0], min_b[1], max_b[1], min_b[2], max_b[2])); +#else + treeWireframe->AddInputData (getCuboid (min_b[0], max_b[0], min_b[1], max_b[1], min_b[2], max_b[2])); +#endif vtkSmartPointer < vtkActor > treeActor = vtkSmartPointer::New (); vtkSmartPointer < vtkDataSetMapper > mapper = vtkSmartPointer::New (); +#if VTK_MAJOR_VERSION < 6 mapper->SetInput (treeWireframe->GetOutput ()); +#else + mapper->SetInputData (treeWireframe->GetOutput ()); +#endif treeActor->SetMapper (mapper); treeActor->GetProperty ()->SetRepresentationToWireframe (); diff --git a/tools/vtk2pcd.cpp b/tools/vtk2pcd.cpp index 487542d97bf..298861c6db3 100644 --- a/tools/vtk2pcd.cpp +++ b/tools/vtk2pcd.cpp @@ -107,7 +107,11 @@ main (int argc, char** argv) if (copy_normals) { vtkSmartPointer ng = vtkSmartPointer::New (); +#if VTK_MAJOR_VERSION < 6 ng->SetInput (polydata); +#else + ng->SetInputData (polydata); +#endif ng->ComputePointNormalsOn (); ng->ComputeCellNormalsOff (); ng->Update (); diff --git a/tools/vtk2ply.cpp b/tools/vtk2ply.cpp index 68f5cb691d1..da842e200a7 100644 --- a/tools/vtk2ply.cpp +++ b/tools/vtk2ply.cpp @@ -76,13 +76,17 @@ main (int argc, char** argv) vtkSmartPointer polydata; vtkSmartPointer reader = vtkSmartPointer::New (); reader->SetFileName (argv[vtk_file_indices[0]]); + reader->Update (); polydata = reader->GetOutput (); - polydata->Update (); print_info ("Loaded %s with %lu points/vertices.\n", argv[vtk_file_indices[0]], polydata->GetNumberOfPoints ()); // Convert to PLY and save vtkSmartPointer writer = vtkSmartPointer::New (); +#if VTK_MAJOR_VERSION < 6 writer->SetInput (polydata); +#else + writer->SetInputData (polydata); +#endif writer->SetArrayName ("Colors"); writer->SetFileTypeToASCII (); writer->SetFileName (argv[ply_file_indices[0]]); diff --git a/visualization/include/pcl/visualization/common/impl/shapes.hpp b/visualization/include/pcl/visualization/common/impl/shapes.hpp index b733f6f06dc..8622eabe662 100644 --- a/visualization/include/pcl/visualization/common/impl/shapes.hpp +++ b/visualization/include/pcl/visualization/common/impl/shapes.hpp @@ -67,7 +67,6 @@ pcl::visualization::createPolygon (const typename pcl::PointCloud::Const poly_grid->Allocate (1, 1); poly_grid->InsertNextCell (polygon->GetCellType (), polygon->GetPointIds ()); poly_grid->SetPoints (poly_points); - poly_grid->Update (); return (poly_grid); } @@ -104,7 +103,6 @@ pcl::visualization::createPolygon (const pcl::PlanarPolygon &planar_poly poly_grid->Allocate (1, 1); poly_grid->InsertNextCell (polygon->GetCellType (), polygon->GetPointIds ()); poly_grid->SetPoints (poly_points); - poly_grid->Update (); return (poly_grid); } diff --git a/visualization/include/pcl/visualization/image_viewer.h b/visualization/include/pcl/visualization/image_viewer.h index 8d81ebb6385..21b060d6c32 100644 --- a/visualization/include/pcl/visualization/image_viewer.h +++ b/visualization/include/pcl/visualization/image_viewer.h @@ -51,6 +51,7 @@ #include +#include #include class vtkImageSlice; @@ -1012,7 +1013,7 @@ namespace pcl /** \brief The renderer. */ vtkSmartPointer ren_; -#if ((VTK_MAJOR_VERSION == 5) && (VTK_MINOR_VERSION >= 10)) +#if !((VTK_MAJOR_VERSION == 5) && (VTK_MINOR_VERSION <= 10)) /** \brief Global prop. This is the actual "actor". */ vtkSmartPointer slice_; #endif diff --git a/visualization/include/pcl/visualization/impl/image_viewer.hpp b/visualization/include/pcl/visualization/impl/image_viewer.hpp index 62b67c16879..5f2ed77f205 100644 --- a/visualization/include/pcl/visualization/impl/image_viewer.hpp +++ b/visualization/include/pcl/visualization/impl/image_viewer.hpp @@ -39,6 +39,7 @@ #ifndef PCL_VISUALIZATION_IMAGE_VISUALIZER_HPP_ #define PCL_VISUALIZATION_IMAGE_VISUALIZER_HPP_ +#include #include #include #include @@ -435,9 +436,13 @@ pcl::visualization::ImageViewer::showCorrespondences ( vtkSmartPointer image = vtkSmartPointer::New (); image->SetDimensions (source_img.width + target_img.width, std::max (source_img.height, target_img.height), 1); +#if VTK_MAJOR_VERSION < 6 image->SetScalarTypeToUnsignedChar (); image->SetNumberOfScalarComponents (3); image->AllocateScalars (); +#else + image->AllocateScalars (VTK_UNSIGNED_CHAR, 3); +#endif image->GetPointData ()->GetScalars ()->SetVoidArray (data, data_size_, 1); vtkSmartPointer image_item = vtkSmartPointer::New (); #if ((VTK_MAJOR_VERSION == 5) && (VTK_MINOR_VERSION <= 10)) diff --git a/visualization/include/pcl/visualization/impl/pcl_visualizer.hpp b/visualization/include/pcl/visualization/impl/pcl_visualizer.hpp index 560fe6714b3..219e865f5db 100644 --- a/visualization/include/pcl/visualization/impl/pcl_visualizer.hpp +++ b/visualization/include/pcl/visualization/impl/pcl_visualizer.hpp @@ -38,6 +38,7 @@ #ifndef PCL_PCL_VISUALIZER_IMPL_H_ #define PCL_PCL_VISUALIZER_IMPL_H_ +#include #include #include #include @@ -322,13 +323,25 @@ pcl::visualization::PCLVisualizer::addPolygon ( vtkSmartPointer all_data = vtkSmartPointer::New (); // Add old data +#if VTK_MAJOR_VERSION < 6 all_data->AddInput (reinterpret_cast ((vtkActor::SafeDownCast (am_it->second))->GetMapper ())->GetInput ()); - +#else + all_data->AddInputData (reinterpret_cast ((vtkActor::SafeDownCast (am_it->second))->GetMapper ())->GetInput ()); +#endif + // Add new data vtkSmartPointer surface_filter = vtkSmartPointer::New (); - surface_filter->SetInput (vtkUnstructuredGrid::SafeDownCast (data)); +#if VTK_MAJOR_VERSION < 6 + surface_filter->AddInput (vtkUnstructuredGrid::SafeDownCast (data)); +#else + surface_filter->AddInputData (vtkUnstructuredGrid::SafeDownCast (data)); +#endif vtkSmartPointer poly_data = surface_filter->GetOutput (); +#if VTK_MAJOR_VERSION < 6 all_data->AddInput (poly_data); +#else + all_data->AddInputData (poly_data); +#endif // Create an Actor vtkSmartPointer actor; @@ -376,13 +389,25 @@ pcl::visualization::PCLVisualizer::addPolygon ( vtkSmartPointer all_data = vtkSmartPointer::New (); // Add old data +#if VTK_MAJOR_VERSION < 6 all_data->AddInput (reinterpret_cast ((vtkActor::SafeDownCast (am_it->second))->GetMapper ())->GetInput ()); +#else + all_data->AddInputData (reinterpret_cast ((vtkActor::SafeDownCast (am_it->second))->GetMapper ())->GetInput ()); +#endif // Add new data vtkSmartPointer surface_filter = vtkSmartPointer::New (); +#if VTK_MAJOR_VERSION < 6 surface_filter->SetInput (vtkUnstructuredGrid::SafeDownCast (data)); +#else + surface_filter->SetInputData (vtkUnstructuredGrid::SafeDownCast (data)); +#endif vtkSmartPointer poly_data = surface_filter->GetOutput (); +#if VTK_MAJOR_VERSION < 6 all_data->AddInput (poly_data); +#else + all_data->AddInputData (poly_data); +#endif // Create an Actor vtkSmartPointer actor; @@ -613,7 +638,11 @@ pcl::visualization::PCLVisualizer::updateSphere (const PointT ¢er, double ra ////////////////////////////////////////////////////////////////////////// // Get the actor pointer vtkLODActor* actor = vtkLODActor::SafeDownCast (am_it->second); +#if VTK_MAJOR_VERSION < 6 vtkAlgorithm *algo = actor->GetMapper ()->GetInput ()->GetProducerPort ()->GetProducer (); +#else + vtkAlgorithm *algo = actor->GetMapper ()->GetInputAlgorithm (); +#endif vtkSphereSource *src = vtkSphereSource::SafeDownCast (algo); src->SetCenter (double (center.x), double (center.y), double (center.z)); @@ -796,7 +825,11 @@ pcl::visualization::PCLVisualizer::addPointCloudNormals ( polyData->SetLines (lines); vtkSmartPointer mapper = vtkSmartPointer::New (); +#if VTK_MAJOR_VERSION < 6 mapper->SetInput (polyData); +#else + mapper->SetInputData (polyData); +#endif mapper->SetColorModeToMapScalars(); mapper->SetScalarModeToUsePointData(); @@ -871,7 +904,11 @@ pcl::visualization::PCLVisualizer::addPointCloudIntensityGradients ( polyData->SetLines(lines); vtkSmartPointer mapper = vtkSmartPointer::New (); +#if VTK_MAJOR_VERSION < 6 mapper->SetInput (polyData); +#else + mapper->SetInputData (polyData); +#endif mapper->SetColorModeToMapScalars(); mapper->SetScalarModeToUsePointData(); @@ -970,7 +1007,6 @@ pcl::visualization::PCLVisualizer::addCorrespondences ( line_data->SetLines (line_cells); line_data->GetPointData ()->SetTCoords (line_tcoords); line_data->GetCellData ()->SetScalars (line_colors); - line_data->Update (); // Create an Actor vtkSmartPointer actor; @@ -1075,7 +1111,6 @@ pcl::visualization::PCLVisualizer::addCorrespondences ( line_data->SetLines (line_cells); line_data->GetPointData ()->SetTCoords (line_tcoords); line_data->GetCellData ()->SetScalars (line_colors); - line_data->Update (); // Create an Actor vtkSmartPointer actor; @@ -1178,10 +1213,13 @@ pcl::visualization::PCLVisualizer::updateCorrespondences ( line_data->SetLines (line_cells); line_data->GetPointData ()->SetTCoords (line_tcoords); line_data->GetCellData ()->SetScalars (line_colors); - line_data->Update (); // Update the mapper +#if VTK_MAJOR_VERSION < 6 reinterpret_cast(actor->GetMapper ())->SetInput (line_data); +#else + reinterpret_cast (actor->GetMapper ())->SetInputData (line_data); +#endif return (true); } @@ -1213,7 +1251,6 @@ pcl::visualization::PCLVisualizer::fromHandlersToScreen ( // Convert the PointCloud to VTK PolyData convertPointCloudToVTKPolyData (geometry_handler, polydata, initcells); // use the given geometry handler - polydata->Update (); // Get the colors from the handler bool has_colors = false; @@ -1277,7 +1314,6 @@ pcl::visualization::PCLVisualizer::fromHandlersToScreen ( // Convert the PointCloud to VTK PolyData convertPointCloudToVTKPolyData (geometry_handler, polydata, initcells); // use the given geometry handler - polydata->Update (); // Get the colors from the handler bool has_colors = false; @@ -1342,7 +1378,6 @@ pcl::visualization::PCLVisualizer::fromHandlersToScreen ( // Convert the PointCloud to VTK PolyData convertPointCloudToVTKPolyData (geometry_handler, polydata, initcells); // use the given geometry handler - polydata->Update (); // Get the colors from the handler bool has_colors = false; @@ -1394,12 +1429,10 @@ pcl::visualization::PCLVisualizer::updatePointCloud (const typename pcl::PointCl vtkSmartPointer polydata = reinterpret_cast(am_it->second.actor->GetMapper ())->GetInput (); // Convert the PointCloud to VTK PolyData convertPointCloudToVTKPolyData (cloud, polydata, am_it->second.cells); - polydata->Update (); // Set scalars to blank, since there is no way we can update them here. vtkSmartPointer scalars; polydata->GetPointData ()->SetScalars (scalars); - polydata->Update (); double minmax[2]; minmax[0] = std::numeric_limits::min (); minmax[1] = std::numeric_limits::max (); @@ -1407,7 +1440,11 @@ pcl::visualization::PCLVisualizer::updatePointCloud (const typename pcl::PointCl am_it->second.actor->GetMapper ()->SetScalarRange (minmax); // Update the mapper +#if VTK_MAJOR_VERSION < 6 reinterpret_cast(am_it->second.actor->GetMapper ())->SetInput (polydata); +#else + reinterpret_cast (am_it->second.actor->GetMapper ())->SetInputData (polydata); +#endif return (true); } @@ -1432,7 +1469,6 @@ pcl::visualization::PCLVisualizer::updatePointCloud (const typename pcl::PointCl // Set scalars to blank, since there is no way we can update them here. vtkSmartPointer scalars; polydata->GetPointData ()->SetScalars (scalars); - polydata->Update (); double minmax[2]; minmax[0] = std::numeric_limits::min (); minmax[1] = std::numeric_limits::max (); @@ -1440,7 +1476,11 @@ pcl::visualization::PCLVisualizer::updatePointCloud (const typename pcl::PointCl am_it->second.actor->GetMapper ()->SetScalarRange (minmax); // Update the mapper +#if VTK_MAJOR_VERSION < 6 reinterpret_cast(am_it->second.actor->GetMapper ())->SetInput (polydata); +#else + reinterpret_cast (am_it->second.actor->GetMapper ())->SetInputData (polydata); +#endif return (true); } @@ -1507,13 +1547,16 @@ pcl::visualization::PCLVisualizer::updatePointCloud (const typename pcl::PointCl scalars->GetRange (minmax); // Update the data polydata->GetPointData ()->SetScalars (scalars); - polydata->Update (); am_it->second.actor->GetMapper ()->ImmediateModeRenderingOff (); am_it->second.actor->GetMapper ()->SetScalarRange (minmax); // Update the mapper +#if VTK_MAJOR_VERSION < 6 reinterpret_cast(am_it->second.actor->GetMapper ())->SetInput (polydata); +#else + reinterpret_cast (am_it->second.actor->GetMapper ())->SetInputData (polydata); +#endif return (true); } @@ -1668,7 +1711,6 @@ pcl::visualization::PCLVisualizer::addPolygonMesh ( poly_grid->Allocate (1, 1); poly_grid->InsertNextCell (polygon->GetCellType (), polygon->GetPointIds ()); poly_grid->SetPoints (points); - poly_grid->Update (); if (colors) poly_grid->GetPointData ()->SetScalars (colors); @@ -1813,7 +1855,6 @@ pcl::visualization::PCLVisualizer::updatePolygonMesh ( cells->Squeeze (); // Set the the vertices polydata->SetPolys (cells); - polydata->Update (); return (true); } diff --git a/visualization/include/pcl/visualization/interactor.h b/visualization/include/pcl/visualization/interactor.h index 676b7502680..64a49523ced 100644 --- a/visualization/include/pcl/visualization/interactor.h +++ b/visualization/include/pcl/visualization/interactor.h @@ -45,10 +45,10 @@ # include #else #include -#if defined VTK_USE_CARBON -# include -#elif defined VTK_USE_COCOA +#if (VTK_MAJOR_VERSION <= 5 && defined VTK_USE_COCOA) || defined __APPLE__ # include +#elif VTK_MAJOR_VERSION <= 5 && defined VTK_USE_CARBON +# include #else // Stupid X.h defines Complex, Bool, Success globally (!) # include @@ -66,10 +66,10 @@ namespace pcl /** \brief The PCLVisualizer interactor */ #ifdef _WIN32 class PCL_EXPORTS PCLVisualizerInteractor : public vtkWin32RenderWindowInteractor -#elif defined VTK_USE_CARBON - class PCLVisualizerInteractor : public vtkCarbonRenderWindowInteractor -#elif defined VTK_USE_COCOA +#elif (VTK_MAJOR_VERSION <= 5 && defined VTK_USE_COCOA) || defined __APPLE__ class PCLVisualizerInteractor : public vtkCocoaRenderWindowInteractor +#elif VTK_MAJOR_VERSION <= 5 && defined VTK_USE_CARBON + class PCLVisualizerInteractor : public vtkCarbonRenderWindowInteractor #else class PCLVisualizerInteractor : public vtkXRenderWindowInteractor #endif diff --git a/visualization/include/pcl/visualization/pcl_painter2D.h b/visualization/include/pcl/visualization/pcl_painter2D.h index 6752aa90049..acafad4811f 100644 --- a/visualization/include/pcl/visualization/pcl_painter2D.h +++ b/visualization/include/pcl/visualization/pcl_painter2D.h @@ -204,7 +204,7 @@ namespace pcl /** \brief Constructor of the class */ PCLPainter2D (char const * name = "PCLPainter2D"); - vtkTypeRevisionMacro (PCLPainter2D, vtkContextItem); + vtkTypeMacro (PCLPainter2D, vtkContextItem); /** \brief Paint event for the chart, called whenever the chart needs to be drawn * \param[in] painter Name of the window diff --git a/visualization/src/common/io.cpp b/visualization/src/common/io.cpp index 5f1cf6d867a..6339a127725 100644 --- a/visualization/src/common/io.cpp +++ b/visualization/src/common/io.cpp @@ -36,6 +36,7 @@ * */ +#include #include #include #include @@ -89,7 +90,11 @@ pcl::visualization::savePointData (vtkPolyData* data, const std::string &out_fil // Clean the data (no duplicates!) vtkSmartPointer cleaner = vtkSmartPointer::New (); cleaner->SetTolerance (0.0); +#if VTK_MAJOR_VERSION < 6 cleaner->SetInput (data); +#else + cleaner->SetInputData (data); +#endif cleaner->ConvertLinesToPointsOff (); cleaner->ConvertPolysToLinesOff (); cleaner->ConvertStripsToPolysOff (); diff --git a/visualization/src/histogram_visualizer.cpp b/visualization/src/histogram_visualizer.cpp index 777a3954cf2..94f4cc7a6be 100644 --- a/visualization/src/histogram_visualizer.cpp +++ b/visualization/src/histogram_visualizer.cpp @@ -46,6 +46,7 @@ #include #include +#include #include #include #include @@ -260,7 +261,12 @@ pcl::visualization::PCLHistogramVisualizer::reCreateActor ( const vtkSmartPointer &xy_array, RenWinInteract* renwinupd, const int hsize) { renwinupd->ren_->RemoveActor2D (renwinupd->xy_plot_); +#if VTK_MAJOR_VERSION < 6 renwinupd->xy_plot_->RemoveAllInputs (); +#else + renwinupd->xy_plot_->RemoveAllDataSetInputConnections (); +#endif + double min_max[2]; xy_array->GetRange (min_max, 1); diff --git a/visualization/src/image_viewer.cpp b/visualization/src/image_viewer.cpp index 38651bdcb81..760b5161651 100644 --- a/visualization/src/image_viewer.cpp +++ b/visualization/src/image_viewer.cpp @@ -36,11 +36,17 @@ * */ +#include #include #include #include #include +#if VTK_MAJOR_VERSION >= 6 +#include +#include +#endif + #include #include #include @@ -117,7 +123,11 @@ pcl::visualization::ImageViewer::ImageViewer (const std::string& window_title) vtkSmartPointer empty_image = vtkSmartPointer::New (); vtkSmartPointer map = vtkSmartPointer::New (); +#if VTK_MAJOR_VERSION < 6 map->SetInput (empty_image); +#else + map->SetInputData (empty_image); +#endif slice_->SetMapper (map); ren_->AddViewProp (slice_); interactor_->SetInteractorStyle (interactor_style_); @@ -180,9 +190,13 @@ pcl::visualization::ImageViewer::addRGBImage ( vtkSmartPointer image = vtkSmartPointer::New (); image->SetExtent (0, width - 1, 0, height - 1, 0, 0); +#if VTK_MAJOR_VERSION < 6 image->SetScalarTypeToUnsignedChar (); image->SetNumberOfScalarComponents (3); image->AllocateScalars (); +#else + image->AllocateScalars (VTK_UNSIGNED_CHAR, 3); +#endif image->GetPointData ()->GetScalars ()->SetVoidArray (data, 3 * width * height, 1); #if ((VTK_MAJOR_VERSION == 5) && (VTK_MINOR_VERSION <= 10)) // Now create filter and set previously created transformation @@ -193,9 +207,12 @@ pcl::visualization::ImageViewer::addRGBImage ( # else image_viewer_->SetInputConnection (algo_->GetOutputPort ()); # endif -#else +#elif VTK_MAJOR_VERSION < 6 image_viewer_->SetInputData (image); interactor_style_->adjustCamera (image, ren_); +#else + algo_->SetInputData (image); + algo_->Update (); #endif } @@ -231,9 +248,13 @@ pcl::visualization::ImageViewer::addMonoImage ( vtkSmartPointer image = vtkSmartPointer::New (); image->SetExtent (0, width - 1, 0, height - 1, 0, 0); +#if VTK_MAJOR_VERSION < 6 image->SetScalarTypeToUnsignedChar (); image->SetNumberOfScalarComponents (1); image->AllocateScalars (); +#else + image->AllocateScalars (VTK_UNSIGNED_CHAR, 1); +#endif image->GetPointData ()->GetScalars ()->SetVoidArray (data, width * height, 1); #if ((VTK_MAJOR_VERSION == 5) && (VTK_MINOR_VERSION <= 10)) @@ -245,9 +266,12 @@ pcl::visualization::ImageViewer::addMonoImage ( # else image_viewer_->SetInputConnection (algo_->GetOutputPort ()); # endif -#else +#elif VTK_MAJOR_VERSION < 6 image_viewer_->SetInputData (image); interactor_style_->adjustCamera (image, ren_); +#else + algo_->SetInputData (image); + algo_->Update (); #endif } @@ -598,7 +622,11 @@ pcl::visualization::ImageViewer::createLayer ( rect->set (0, 0, static_cast (width), static_cast (height)); l.actor->GetScene ()->AddItem (rect); } +#if VTK_MAJOR_VERSION < 6 image_viewer_->GetRenderer ()->AddActor (l.actor); +#else + ren_->AddActor (l.actor); +#endif // Add another element layer_map_.push_back (l); @@ -634,7 +662,11 @@ pcl::visualization::ImageViewer::removeLayer (const std::string &layer_id) PCL_DEBUG ("[pcl::visualization::ImageViewer::removeLayer] No layer with ID='%s' found.\n", layer_id.c_str ()); return; } +#if VTK_MAJOR_VERSION < 6 image_viewer_->GetRenderer ()->RemoveActor (am_it->actor); +#else + ren_->RemoveActor (am_it->actor); +#endif layer_map_.erase (am_it); } @@ -1139,9 +1171,9 @@ void pcl::visualization::ImageViewer::setWindowTitle (const std::string& name) { #if ((VTK_MAJOR_VERSION == 5) && (VTK_MINOR_VERSION >= 10)) - win_->SetWindowName (name.c_str ()); -#else image_viewer_->GetRenderWindow ()->SetWindowName (name.c_str ()); +#else + win_->SetWindowName (name.c_str ()); #endif } @@ -1150,9 +1182,9 @@ void pcl::visualization::ImageViewer::setPosition (int x, int y) { #if ((VTK_MAJOR_VERSION == 5) && (VTK_MINOR_VERSION >= 10)) - win_->SetPosition (x, y); -#else image_viewer_->GetRenderWindow ()->SetPosition (x, y); +#else + win_->SetPosition (x, y); #endif } @@ -1161,9 +1193,9 @@ int* pcl::visualization::ImageViewer::getSize () { #if ((VTK_MAJOR_VERSION == 5) && (VTK_MINOR_VERSION >= 10)) - return (win_->GetSize ()); -#else return (image_viewer_->GetRenderWindow ()->GetSize ()); +#else + return (win_->GetSize ()); #endif } @@ -1172,9 +1204,10 @@ void pcl::visualization::ImageViewer::setSize (int xw, int yw) { #if ((VTK_MAJOR_VERSION == 5) && (VTK_MINOR_VERSION >= 10)) - win_->SetSize (xw, yw); -#else image_viewer_->GetRenderWindow ()->SetSize (xw, yw); +#else + win_->SetSize (xw, yw); + #endif } diff --git a/visualization/src/interactor_style.cpp b/visualization/src/interactor_style.cpp index 24855a7e16e..ad2fe197a54 100644 --- a/visualization/src/interactor_style.cpp +++ b/visualization/src/interactor_style.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -357,7 +358,11 @@ pcl::visualization::PCLVisualizerInteractorStyle::OnKeyDown () else { vtkPolyDataMapper* mapper = static_cast(act->actor->GetMapper ()); +#if VTK_MAJOR_VERSION < 6 mapper->SetInput (data); +#else + mapper->SetInputData (data); +#endif // Modify the actor act->actor->SetMapper (mapper); } @@ -386,7 +391,6 @@ pcl::visualization::PCLVisualizerInteractorStyle::OnKeyDown () // Update the data vtkPolyData *data = static_cast(act->actor->GetMapper ()->GetInput ()); data->GetPointData ()->SetScalars (scalars); - data->Update (); // Modify the mapper if (use_vbos_) { @@ -402,7 +406,11 @@ pcl::visualization::PCLVisualizerInteractorStyle::OnKeyDown () vtkPolyDataMapper* mapper = static_cast(act->actor->GetMapper ()); mapper->SetScalarRange (minmax); mapper->SetScalarModeToUsePointData (); +#if VTK_MAJOR_VERSION < 6 mapper->SetInput (data); +#else + mapper->SetInputData (data); +#endif // Modify the actor act->actor->SetMapper (mapper); } diff --git a/visualization/src/pcl_painter2D.cpp b/visualization/src/pcl_painter2D.cpp index 868931db869..4d47290d84b 100644 --- a/visualization/src/pcl_painter2D.cpp +++ b/visualization/src/pcl_painter2D.cpp @@ -38,8 +38,6 @@ #include -vtkCxxRevisionMacro (pcl::visualization::PCLPainter2D, "$Revision: 1.2 $"); - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// pcl::visualization::PCLPainter2D::PCLPainter2D(char const * name) { diff --git a/visualization/src/pcl_plotter.cpp b/visualization/src/pcl_plotter.cpp index 52323e2c1f1..92e4f5e35c5 100644 --- a/visualization/src/pcl_plotter.cpp +++ b/visualization/src/pcl_plotter.cpp @@ -36,6 +36,7 @@ * */ +#include #include #include #include @@ -123,7 +124,11 @@ pcl::visualization::PCLPlotter::addPlotData ( //adding to chart //vtkPlot *line = chart_->AddPlot(vtkChart::LINE); vtkPlot *line = chart_->AddPlot (type); +#if VTK_MAJOR_VERSION < 6 line->SetInput (table, 0, 1); +#else + line->SetInputData (table, 0, 1); +#endif line->SetWidth (1); if (color == NULL) //color automatically based on the ColorScheme diff --git a/visualization/src/pcl_visualizer.cpp b/visualization/src/pcl_visualizer.cpp index 742649ca1e2..02a9c9a84f4 100644 --- a/visualization/src/pcl_visualizer.cpp +++ b/visualization/src/pcl_visualizer.cpp @@ -38,6 +38,7 @@ #include #include +#include #include #include #include @@ -535,6 +536,7 @@ pcl::visualization::PCLVisualizer::addCoordinateSystem (double scale, const std: vtkSmartPointer axes = vtkSmartPointer::New (); axes->SetOrigin (0, 0, 0); axes->SetScaleFactor (scale); + axes->Update (); vtkSmartPointer axes_colors = vtkSmartPointer::New (); axes_colors->Allocate (6); @@ -546,17 +548,24 @@ pcl::visualization::PCLVisualizer::addCoordinateSystem (double scale, const std: axes_colors->InsertNextValue (1.0); vtkSmartPointer axes_data = axes->GetOutput (); - axes_data->Update (); axes_data->GetPointData ()->SetScalars (axes_colors); vtkSmartPointer axes_tubes = vtkSmartPointer::New (); +#if VTK_MAJOR_VERSION < 6 axes_tubes->SetInput (axes_data); +#else + axes_tubes->SetInputData (axes_data); +#endif axes_tubes->SetRadius (axes->GetScaleFactor () / 50.0); axes_tubes->SetNumberOfSides (6); vtkSmartPointer axes_mapper = vtkSmartPointer::New (); axes_mapper->SetScalarModeToUsePointData (); +#if VTK_MAJOR_VERSION < 6 axes_mapper->SetInput (axes_tubes->GetOutput ()); +#else + axes_mapper->SetInputConnection (axes_tubes->GetOutputPort ()); +#endif vtkSmartPointer axes_actor = vtkSmartPointer::New (); axes_actor->SetMapper (axes_mapper); @@ -574,6 +583,7 @@ pcl::visualization::PCLVisualizer::addCoordinateSystem (double scale, float x, f vtkSmartPointer axes = vtkSmartPointer::New (); axes->SetOrigin (0, 0, 0); axes->SetScaleFactor (scale); + axes->Update (); vtkSmartPointer axes_colors = vtkSmartPointer::New (); axes_colors->Allocate (6); @@ -585,17 +595,24 @@ pcl::visualization::PCLVisualizer::addCoordinateSystem (double scale, float x, f axes_colors->InsertNextValue (1.0); vtkSmartPointer axes_data = axes->GetOutput (); - axes_data->Update (); axes_data->GetPointData ()->SetScalars (axes_colors); vtkSmartPointer axes_tubes = vtkSmartPointer::New (); +#if VTK_MAJOR_VERSION < 6 axes_tubes->SetInput (axes_data); +#else + axes_tubes->SetInputData (axes_data); +#endif axes_tubes->SetRadius (axes->GetScaleFactor () / 50.0); axes_tubes->SetNumberOfSides (6); vtkSmartPointer axes_mapper = vtkSmartPointer::New (); axes_mapper->SetScalarModeToUsePointData (); +#if VTK_MAJOR_VERSION < 6 axes_mapper->SetInput (axes_tubes->GetOutput ()); +#else + axes_mapper->SetInputConnection (axes_tubes->GetOutputPort ()); +#endif vtkSmartPointer axes_actor = vtkSmartPointer::New (); axes_actor->SetMapper (axes_mapper); @@ -644,6 +661,7 @@ pcl::visualization::PCLVisualizer::addCoordinateSystem (double scale, const Eige vtkSmartPointer axes = vtkSmartPointer::New (); axes->SetOrigin (0, 0, 0); axes->SetScaleFactor (scale); + axes->Update (); vtkSmartPointer axes_colors = vtkSmartPointer::New (); axes_colors->Allocate (6); @@ -655,17 +673,24 @@ pcl::visualization::PCLVisualizer::addCoordinateSystem (double scale, const Eige axes_colors->InsertNextValue (1.0); vtkSmartPointer axes_data = axes->GetOutput (); - axes_data->Update (); axes_data->GetPointData ()->SetScalars (axes_colors); vtkSmartPointer axes_tubes = vtkSmartPointer::New (); +#if VTK_MAJOR_VERSION < 6 axes_tubes->SetInput (axes_data); +#else + axes_tubes->SetInputData (axes_data); +#endif axes_tubes->SetRadius (axes->GetScaleFactor () / 50.0); axes_tubes->SetNumberOfSides (6); vtkSmartPointer axes_mapper = vtkSmartPointer::New (); axes_mapper->SetScalarModeToUsePointData (); +#if VTK_MAJOR_VERSION < 6 axes_mapper->SetInput (axes_tubes->GetOutput ()); +#else + axes_mapper->SetInputConnection (axes_tubes->GetOutputPort ()); +#endif vtkSmartPointer axes_actor = vtkSmartPointer::New (); axes_actor->SetMapper (axes_mapper); @@ -873,7 +898,11 @@ pcl::visualization::PCLVisualizer::addPointCloudPrincipalCurvatures (const pcl:: line_1->SetPoint1 (cloud->points[i].x, cloud->points[i].y, cloud->points[i].z); line_1->SetPoint2 (p.x, p.y, p.z); line_1->Update (); +#if VTK_MAJOR_VERSION < 6 polydata_1->AddInput (line_1->GetOutput ()); +#else + polydata_1->AddInputData (line_1->GetOutput ()); +#endif line_1_colors->InsertNextTupleValue (green); } polydata_1->Update (); @@ -900,7 +929,12 @@ pcl::visualization::PCLVisualizer::addPointCloudPrincipalCurvatures (const pcl:: line_2->SetPoint1 (cloud->points[i].x, cloud->points[i].y, cloud->points[i].z); line_2->SetPoint2 (p.x, p.y, p.z); line_2->Update (); +#if VTK_MAJOR_VERSION < 6 polydata_2->AddInput (line_2->GetOutput ()); +#else + polydata_2->AddInputData (line_2->GetOutput ()); +#endif + line_2_colors->InsertNextTupleValue (blue); } polydata_2->Update (); @@ -909,8 +943,13 @@ pcl::visualization::PCLVisualizer::addPointCloudPrincipalCurvatures (const pcl:: // Assemble the two sets of lines vtkSmartPointer alldata = vtkSmartPointer::New (); +#if VTK_MAJOR_VERSION < 6 alldata->AddInput (line_1_data); alldata->AddInput (line_2_data); +#else + alldata->AddInputData (line_1_data); + alldata->AddInputData (line_2_data); +#endif // Create an Actor vtkSmartPointer actor; @@ -1124,7 +1163,11 @@ pcl::visualization::PCLVisualizer::createActorFromVTKDataSet (const vtkSmartPoin else { vtkSmartPointer mapper = vtkSmartPointer::New (); +#if VTK_MAJOR_VERSION < 6 mapper->SetInput (data); +#else + mapper->SetInputData (data); +#endif if (use_scalars) { @@ -1198,7 +1241,11 @@ pcl::visualization::PCLVisualizer::createActorFromVTKDataSet (const vtkSmartPoin else { vtkSmartPointer mapper = vtkSmartPointer::New (); +#if VTK_MAJOR_VERSION < 6 mapper->SetInput (data); +#else + mapper->SetInputData (data); +#endif if (use_scalars) { @@ -1576,9 +1623,13 @@ pcl::visualization::PCLVisualizer::setShapeRenderingProperties ( { PCL_INFO ("[pcl::visualization::PCLVisualizer::setShapeRenderingProperties] Normals do not exist in the dataset, but Gouraud shading was requested. Estimating normals...\n"); vtkSmartPointer normals = vtkSmartPointer::New (); +#if VTK_MAJOR_VERSION < 6 normals->SetInput (actor->GetMapper ()->GetInput ()); - normals->Update (); vtkDataSetMapper::SafeDownCast (actor->GetMapper ())->SetInput (normals->GetOutput ()); +#else + normals->SetInputConnection (actor->GetMapper ()->GetInputAlgorithm ()->GetOutputPort ()); + vtkDataSetMapper::SafeDownCast (actor->GetMapper ())->SetInputConnection (normals->GetOutputPort ()); +#endif } actor->GetProperty ()->SetInterpolationToGouraud (); break; @@ -1589,9 +1640,13 @@ pcl::visualization::PCLVisualizer::setShapeRenderingProperties ( { PCL_INFO ("[pcl::visualization::PCLVisualizer::setShapeRenderingProperties] Normals do not exist in the dataset, but Phong shading was requested. Estimating normals...\n"); vtkSmartPointer normals = vtkSmartPointer::New (); +#if VTK_MAJOR_VERSION < 6 normals->SetInput (actor->GetMapper ()->GetInput ()); - normals->Update (); vtkDataSetMapper::SafeDownCast (actor->GetMapper ())->SetInput (normals->GetOutput ()); +#else + normals->SetInputConnection (actor->GetMapper ()->GetInputAlgorithm ()->GetOutputPort ()); + vtkDataSetMapper::SafeDownCast (actor->GetMapper ())->SetInputConnection (normals->GetOutputPort ()); +#endif } actor->GetProperty ()->SetInterpolationToPhong (); break; @@ -2329,7 +2384,11 @@ pcl::visualization::PCLVisualizer::addModelFromPolyData ( vtkSmartPointer trans_filter = vtkSmartPointer::New (); trans_filter->SetTransform (transform); +#if VTK_MAJOR_VERSION < 6 trans_filter->SetInput (polydata); +#else + trans_filter->SetInputData (polydata); +#endif trans_filter->Update(); // Create an Actor @@ -2803,7 +2862,6 @@ pcl::visualization::PCLVisualizer::updateColorHandlerIndex (const std::string &i // Update the data vtkPolyData *data = static_cast(am_it->second.actor->GetMapper ()->GetInput ()); data->GetPointData ()->SetScalars (scalars); - data->Update (); // Modify the mapper if (use_vbos_) { @@ -2823,7 +2881,11 @@ pcl::visualization::PCLVisualizer::updateColorHandlerIndex (const std::string &i vtkPolyDataMapper* mapper = static_cast(am_it->second.actor->GetMapper ()); mapper->SetScalarRange (minmax); mapper->SetScalarModeToUsePointData (); +#if VTK_MAJOR_VERSION < 6 mapper->SetInput (data); +#else + mapper->SetInputData (data); +#endif // Modify the actor am_it->second.actor->SetMapper (mapper); am_it->second.actor->Modified (); @@ -2928,7 +2990,6 @@ pcl::visualization::PCLVisualizer::addPolygonMesh (const pcl::PolygonMesh &poly_ poly_grid->Allocate (1, 1); poly_grid->InsertNextCell (polygon->GetCellType (), polygon->GetPointIds ()); poly_grid->SetPoints (poly_points); - poly_grid->Update (); createActorFromVTKDataSet (poly_grid, actor); actor->GetProperty ()->SetRepresentationToWireframe (); @@ -3053,7 +3114,6 @@ pcl::visualization::PCLVisualizer::updatePolygonMesh ( cells->Squeeze (); // Set the the vertices polydata->SetStrips (cells); - polydata->Update (); return (true); } @@ -3108,7 +3168,11 @@ pcl::visualization::PCLVisualizer::addPolylineFromPolygonMesh ( // Setup actor and mapper vtkSmartPointer < vtkPolyDataMapper > mapper = vtkSmartPointer::New (); +#if VTK_MAJOR_VERSION < 6 mapper->SetInput (polyData); +#else + mapper->SetInputData (polyData); +#endif vtkSmartPointer < vtkActor > actor = vtkSmartPointer::New (); actor->SetMapper (mapper); @@ -3244,7 +3308,11 @@ pcl::visualization::PCLVisualizer::addTextureMesh (const pcl::TextureMesh &mesh, polydata->GetPointData()->SetScalars(colors); vtkSmartPointer mapper = vtkSmartPointer::New (); - mapper->SetInput (polydata); +#if VTK_MAJOR_VERSION < 6 + mapper->SetInput (polydata); +#else + mapper->SetInputData (polydata); +#endif vtkSmartPointer actor = vtkSmartPointer::New (); vtkOpenGLHardwareSupport* hardware = vtkOpenGLRenderWindow::SafeDownCast (win_)->GetHardwareSupport (); @@ -3466,7 +3534,11 @@ pcl::visualization::PCLVisualizer::renderViewTesselatedSphere ( vtkSmartPointer trans_filter_center = vtkSmartPointer::New (); trans_filter_center->SetTransform (trans_center); +#if VTK_MAJOR_VERSION < 6 trans_filter_center->SetInput (polydata); +#else + trans_filter_center->SetInputData (polydata); +#endif trans_filter_center->Update (); vtkSmartPointer mapper = vtkSmartPointer::New (); @@ -3518,10 +3590,10 @@ pcl::visualization::PCLVisualizer::renderViewTesselatedSphere ( vtkSmartPointer subdivide = vtkSmartPointer::New (); subdivide->SetNumberOfSubdivisions (tesselation_level); subdivide->SetInputConnection (ico->GetOutputPort ()); + subdivide->Update (); // Get camera positions vtkPolyData *sphere = subdivide->GetOutput (); - sphere->Update (); std::vector cam_positions; if (!use_vertices) @@ -3960,7 +4032,6 @@ pcl::visualization::PCLVisualizer::fromHandlersToScreen ( // Convert the PointCloud to VTK PolyData convertPointCloudToVTKPolyData (geometry_handler, polydata, initcells); // use the given geometry handler - polydata->Update (); // Get the colors from the handler bool has_colors = false; diff --git a/visualization/src/point_picking_event.cpp b/visualization/src/point_picking_event.cpp index 6d6df965cf4..475ea0fbbd1 100644 --- a/visualization/src/point_picking_event.cpp +++ b/visualization/src/point_picking_event.cpp @@ -38,6 +38,7 @@ #include #include +#include #include #include #include @@ -192,7 +193,7 @@ pcl::visualization::PointPickingCallback::performAreaPick (vtkRenderWindowIntera vtkSmartPointer extract_geometry = vtkSmartPointer::New (); extract_geometry->SetImplicitFunction (frustum); -#if VTK_MAJOR_VERSION <= 5 +#if VTK_MAJOR_VERSION < 6 extract_geometry->SetInput (picker->GetDataSet ()); #else extract_geometry->SetInputData (picker->GetDataSet ()); diff --git a/visualization/src/vtk/vtkVertexBufferObject.cxx b/visualization/src/vtk/vtkVertexBufferObject.cxx index 9a4c9b0059a..3209f2e122f 100644 --- a/visualization/src/vtk/vtkVertexBufferObject.cxx +++ b/visualization/src/vtk/vtkVertexBufferObject.cxx @@ -276,7 +276,6 @@ void vtkVertexBufferObject::CreateBuffer() { GLuint ioBuf; vtkgl::GenBuffers(1, &ioBuf); - vtkGraphicErrorMacro(this->Context, "after GenBuffers"); this->Handle = ioBuf; } } diff --git a/visualization/src/vtk/vtkVertexBufferObjectMapper.cxx b/visualization/src/vtk/vtkVertexBufferObjectMapper.cxx index 876b5e8c9c3..af3a7d30b59 100644 --- a/visualization/src/vtk/vtkVertexBufferObjectMapper.cxx +++ b/visualization/src/vtk/vtkVertexBufferObjectMapper.cxx @@ -18,6 +18,7 @@ #include "pcl/visualization/vtk/vtkVertexBufferObject.h" #include "pcl/visualization/vtk/vtkVertexBufferObjectMapper.h" +#include "vtkVersion.h" #include "vtkCellData.h" #include "vtkExecutive.h" #include "vtkInformation.h" @@ -146,7 +147,11 @@ void vtkVertexBufferObjectMapper::SetInput(vtkPolyData *input) // std::cout << "SetInput" << endl; if(input) { +#if VTK_MAJOR_VERSION < 6 this->SetInputConnection(0, input->GetProducerPort()); +#else + this->SetInputDataObject (0, input); +#endif } else { @@ -162,7 +167,11 @@ void vtkVertexBufferObjectMapper::SetInput(vtkDataSet *input) // std::cout << "SetInput" << endl; if(input) { +#if VTK_MAJOR_VERSION < 6 this->SetInputConnection(0, input->GetProducerPort()); +#else + this->SetInputDataObject (0, input); +#endif } else {