diff --git a/2d/CMakeLists.txt b/2d/CMakeLists.txt index 1d5b31904e3..967a3008510 100644 --- a/2d/CMakeLists.txt +++ b/2d/CMakeLists.txt @@ -38,7 +38,7 @@ if(build) include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include" ${VTK_INCLUDE_DIRECTORIES}) PCL_ADD_LIBRARY("${LIB_NAME}" "${SUBSYS_NAME}" ${srcs} ${incs} ${impl_incs}) link_directories(${VTK_LINK_DIRECTORIES}) - target_link_libraries("${LIB_NAME}" ${VTK_IO_TARGET_LINK_LIBRARIES} pcl_io) + target_link_libraries("${LIB_NAME}" ${VTK_LIBRARIES} pcl_io) PCL_MAKE_PKGCONFIG("${LIB_NAME}" "${SUBSYS_NAME}" "${SUBSYS_DESC}" "${SUBSYS_DEPS}" "" "" "" "") #Install include files diff --git a/CMakeLists.txt b/CMakeLists.txt index ef3d926bbc5..302d1fa2cb6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -352,12 +352,18 @@ option(WITH_VTK "Build VTK-Visualizations" TRUE) if(WITH_VTK AND NOT ANDROID) find_package(VTK) if(VTK_FOUND) + message(STATUS "VTK_MAJOR_VERSION ${VTK_MAJOR_VERSION}") if (PCL_SHARED_LIBS OR (NOT (PCL_SHARED_LIBS) AND NOT (VTK_BUILD_SHARED_LIBS))) set(VTK_FOUND TRUE) find_package (QVTK) - message(STATUS "VTK found (include: ${VTK_INCLUDE_DIRS}, lib: ${VTK_LIBRARY_DIRS})") - link_directories(${VTK_LIBRARY_DIRS}) + if (${VTK_MAJOR_VERSION} VERSION_LESS "6.0") + message(STATUS "VTK found (include: ${VTK_INCLUDE_DIRS}, lib: ${VTK_LIBRARY_DIRS})") + link_directories(${VTK_LIBRARY_DIRS}) + else(${VTK_MAJOR_VERSION} VERSION_LESS "6.0") + include (${VTK_USE_FILE}) + message(STATUS "VTK found (include: ${VTK_INCLUDE_DIRS}, lib: ${VTK_LIBRARIES}") + endif (${VTK_MAJOR_VERSION} VERSION_LESS "6.0") set(HAVE_VTK ON) else () set(VTK_FOUND OFF) diff --git a/PCLConfig.cmake.in b/PCLConfig.cmake.in index d0cf8497c87..efbaeefce92 100644 --- a/PCLConfig.cmake.in +++ b/PCLConfig.cmake.in @@ -306,7 +306,7 @@ macro(find_VTK) if(NOT ANDROID) find_package(VTK ${QUIET_}) if (VTK_FOUND) - set(VTK_LIBRARIES vtkCommon vtkRendering vtkHybrid vtkCharts) + set(VTK_LIBRARIES "@VTK_LIBRARIES@") endif(VTK_FOUND) endif() endmacro(find_VTK) @@ -465,9 +465,9 @@ macro(find_external_library _component _lib _is_optional) if(${LIB}_LIBRARIES) list(APPEND PCL_${COMPONENT}_LIBRARIES "${${LIB}_LIBRARIES}") endif(${LIB}_LIBRARIES) - if(${LIB}_DEFINITIONS) + if(${LIB}_DEFINITIONS AND NOT ${LIB} STREQUAL "VTK") list(APPEND PCL_${COMPONENT}_DEFINITIONS ${${LIB}_DEFINITIONS}) - endif(${LIB}_DEFINITIONS) + endif(${LIB}_DEFINITIONS AND NOT ${LIB} STREQUAL "VTK") else(${LIB}_FOUND) if("${_is_optional}" STREQUAL "OPTIONAL") add_definitions("-DDISABLE_${LIB}") 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/CMakeLists.txt b/apps/CMakeLists.txt index 08dc85fd3b4..bd2becdec99 100644 --- a/apps/CMakeLists.txt +++ b/apps/CMakeLists.txt @@ -77,10 +77,10 @@ if(build) target_link_libraries(pcl_pcd_organized_edge_detection pcl_common pcl_io pcl_features pcl_visualization) PCL_ADD_EXECUTABLE(pcl_face_trainer "${SUBSYS_NAME}" src/face_detection/face_trainer.cpp) - target_link_libraries(pcl_face_trainer pcl_features pcl_recognition pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_sample_consensus pcl_surface pcl_keypoints pcl_ml pcl_search pcl_kdtree vtkRendering vtkIO) + target_link_libraries(pcl_face_trainer pcl_features pcl_recognition pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_sample_consensus pcl_surface pcl_keypoints pcl_ml pcl_search pcl_kdtree ${VTK_LIBRARIES}) PCL_ADD_EXECUTABLE_OPT_BUNDLE(pcl_fs_face_detector "${SUBSYS_NAME}" src/face_detection//filesystem_face_detection.cpp) - target_link_libraries(pcl_fs_face_detector pcl_features pcl_recognition pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_sample_consensus pcl_surface pcl_keypoints pcl_ml pcl_search pcl_kdtree vtkRendering vtkIO) + target_link_libraries(pcl_fs_face_detector pcl_features pcl_recognition pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_sample_consensus pcl_surface pcl_keypoints pcl_ml pcl_search pcl_kdtree ${VTK_LIBRARIES}) PCL_ADD_EXECUTABLE(pcl_stereo_ground_segmentation "${SUBSYS_NAME}" src/stereo_ground_segmentation.cpp) target_link_libraries(pcl_stereo_ground_segmentation pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_features pcl_stereo) @@ -142,37 +142,37 @@ if(build) target_link_libraries(pcl_openni_organized_edge_detection pcl_common pcl_io pcl_features pcl_visualization) PCL_ADD_EXECUTABLE_OPT_BUNDLE(pcl_openni_face_detector "${SUBSYS_NAME}" src/face_detection//openni_face_detection.cpp src/face_detection//openni_frame_source.cpp) - target_link_libraries(pcl_openni_face_detector pcl_features pcl_recognition pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_sample_consensus pcl_surface pcl_keypoints pcl_ml pcl_search pcl_kdtree vtkRendering vtkIO) + target_link_libraries(pcl_openni_face_detector pcl_features pcl_recognition pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_sample_consensus pcl_surface pcl_keypoints pcl_ml pcl_search pcl_kdtree ${VTK_LIBRARIES}) if (QT4_FOUND AND VTK_USE_QVTK) # OpenNI Passthrough application demo QT4_WRAP_UI(openni_passthrough_ui src/openni_passthrough.ui) QT4_WRAP_CPP(openni_passthrough_moc include/pcl/apps/openni_passthrough.h OPTIONS -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED -DBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) PCL_ADD_EXECUTABLE(pcl_openni_passthrough "${SUBSYS_NAME}" ${openni_passthrough_ui} ${openni_passthrough_moc} src/openni_passthrough.cpp) - target_link_libraries(pcl_openni_passthrough pcl_common pcl_io pcl_filters pcl_visualization QVTK ${QT_LIBRARIES}) + target_link_libraries(pcl_openni_passthrough pcl_common pcl_io pcl_filters pcl_visualization ${QVTK_LIBRARY} ${QT_LIBRARIES}) # OpenNI Organized Connected Component application demo QT4_WRAP_UI(organized_segmentation_demo_ui src/organized_segmentation_demo.ui) QT4_WRAP_CPP(organized_segmentation_demo_moc include/pcl/apps/organized_segmentation_demo.h OPTIONS -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED -DBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) PCL_ADD_EXECUTABLE_OPT_BUNDLE(pcl_organized_segmentation_demo "${SUBSYS_NAME}" ${organized_segmentation_demo_ui} ${organized_segmentation_demo_moc} src/organized_segmentation_demo.cpp) - target_link_libraries(pcl_organized_segmentation_demo pcl_common pcl_io pcl_visualization pcl_segmentation pcl_features pcl_surface QVTK ${QT_LIBRARIES}) + target_link_libraries(pcl_organized_segmentation_demo pcl_common pcl_io pcl_visualization pcl_segmentation pcl_features pcl_surface ${QVTK_LIBRARY} ${QT_LIBRARIES}) # Manual registration demo QT4_WRAP_UI(manual_registration_ui src/manual_registration/manual_registration.ui) QT4_WRAP_CPP(manual_registration_moc include/pcl/apps/manual_registration.h OPTIONS -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED -DBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) PCL_ADD_EXECUTABLE_OPT_BUNDLE(pcl_manual_registration "${SUBSYS_NAME}" ${manual_registration_ui} ${manual_registration_moc} src/manual_registration/manual_registration.cpp) - target_link_libraries(pcl_manual_registration pcl_common pcl_io pcl_visualization pcl_segmentation pcl_features pcl_surface QVTK ${QT_LIBRARIES}) + target_link_libraries(pcl_manual_registration pcl_common pcl_io pcl_visualization pcl_segmentation pcl_features pcl_surface ${QVTK_LIBRARY} ${QT_LIBRARIES}) QT4_WRAP_UI(pcd_video_player_ui src/pcd_video_player/pcd_video_player.ui) QT4_WRAP_CPP(pcd_video_player_moc include/pcl/apps/pcd_video_player.h OPTIONS -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED -DBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) PCL_ADD_EXECUTABLE_OPT_BUNDLE(pcl_pcd_video_player "${SUBSYS_NAME}" ${pcd_video_player_ui} ${pcd_video_player_moc} src/pcd_video_player/pcd_video_player.cpp) - target_link_libraries(pcl_pcd_video_player pcl_common pcl_io pcl_visualization pcl_segmentation pcl_features pcl_surface QVTK ${QT_LIBRARIES}) + target_link_libraries(pcl_pcd_video_player pcl_common pcl_io pcl_visualization pcl_segmentation pcl_features pcl_surface ${QVTK_LIBRARY} ${QT_LIBRARIES}) # Database processing (integration) demo # QT4_WRAP_UI(db_proc_ui src/db_proc/db_proc.ui) # QT4_WRAP_CPP(db_proc_moc include/pcl/apps/db_proc.h OPTIONS -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED) # PCL_ADD_EXECUTABLE_OPT_BUNDLE(pcl_db_proc "${SUBSYS_NAME}" ${db_proc_ui} ${db_proc_moc} src/db_proc/db_proc.cpp) -# target_link_libraries(pcl_db_proc pcl_common pcl_io pcl_visualization pcl_segmentation pcl_features pcl_surface QVTK ${QT_LIBRARIES}) +# target_link_libraries(pcl_db_proc pcl_common pcl_io pcl_visualization pcl_segmentation pcl_features pcl_surface ${QVTK_LIBRARY} ${QT_LIBRARIES}) endif () diff --git a/apps/cloud_composer/CMakeLists.txt b/apps/cloud_composer/CMakeLists.txt index c27e47d1f82..d4449752487 100644 --- a/apps/cloud_composer/CMakeLists.txt +++ b/apps/cloud_composer/CMakeLists.txt @@ -120,7 +120,7 @@ if(build) set(EXE_NAME "pcl_${SUBSUBSYS_NAME}") PCL_ADD_EXECUTABLE("${EXE_NAME}" "${SUBSUBSYS_NAME}" ${cloud_composer_ui} ${cloud_composer_moc} ${srcs} ${resource_srcs} ${item_srcs} ${selector_srcs} ${impl_incs}) - target_link_libraries("${EXE_NAME}" pcl_common pcl_io pcl_visualization pcl_filters QVTK ${QT_LIBRARIES}) + target_link_libraries("${EXE_NAME}" pcl_common pcl_io pcl_visualization pcl_filters ${QVTK_LIBRARY} ${QT_LIBRARIES}) # Install include files PCL_ADD_INCLUDES("${SUBSUBSYS_NAME}" "${SUBSUBSYS_NAME}" ${incs} ${item_incs} ${selector_incs}) 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/CMakeLists.txt b/apps/modeler/CMakeLists.txt index 0fb809ac0b6..7181cd46897 100644 --- a/apps/modeler/CMakeLists.txt +++ b/apps/modeler/CMakeLists.txt @@ -109,7 +109,7 @@ if(build) # Generate executable set(EXE_NAME "pcl_${SUBSUBSYS_NAME}") PCL_ADD_EXECUTABLE("${EXE_NAME}" "${SUBSUBSYS_NAME}" ${ui_srcs} ${moc_srcs} ${resource_srcs} ${srcs} ${incs} ${impl_incs}) - target_link_libraries("${EXE_NAME}" pcl_common pcl_io pcl_kdtree pcl_filters pcl_visualization pcl_segmentation pcl_surface pcl_features pcl_sample_consensus pcl_search QVTK ${QT_LIBRARIES}) + target_link_libraries("${EXE_NAME}" pcl_common pcl_io pcl_kdtree pcl_filters pcl_visualization pcl_segmentation pcl_surface pcl_features pcl_sample_consensus pcl_search ${QVTK_LIBRARY} ${QT_LIBRARIES}) # Put the ui in the windows project file IF("${CMAKE_BUILD_TOOL}" MATCHES "msdev") 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/cmake/Modules/FindQVTK.cmake b/cmake/Modules/FindQVTK.cmake index 18ae5767a38..a6de52d0662 100644 --- a/cmake/Modules/FindQVTK.cmake +++ b/cmake/Modules/FindQVTK.cmake @@ -7,17 +7,26 @@ # QVTK_LIBRARY - QVTK library. # if QVTK_FOUND then QVTK_INCLUDE_DIR is appended to VTK_INCLUDE_DIRS and # QVTK_LIBRARY is appended to QVTK_LIBRARY_DIR - -find_library (QVTK_LIBRARY QVTK HINTS ${VTK_DIR} ${VTK_DIR}/bin) -find_path (QVTK_INCLUDE_DIR QVTKWidget.h HINT ${VTK_INCLUDE_DIRS}) -find_package_handle_standard_args(QVTK DEFAULT_MSG - QVTK_LIBRARY QVTK_INCLUDE_DIR) - -if(NOT QVTK_FOUND) - set (VTK_USE_QVTK OFF) -else(NOT QVTK_FOUND) - get_filename_component (QVTK_LIBRARY_DIR ${QVTK_LIBRARY} PATH) - set (VTK_LIBRARY_DIRS ${VTK_LIBRARY_DIRS} ${QVTK_LIBRARY_DIR}) - set (VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS} ${QVTK_INCLUDE_DIR}) - set (VTK_USE_QVTK ON) -endif(NOT QVTK_FOUND) +if (${VTK_MAJOR_VERSION} VERSION_LESS "6.0") + find_library (QVTK_LIBRARY QVTK HINTS ${VTK_DIR} ${VTK_DIR}/bin) + find_path (QVTK_INCLUDE_DIR QVTKWidget.h HINT ${VTK_INCLUDE_DIRS}) + find_package_handle_standard_args(QVTK DEFAULT_MSG + QVTK_LIBRARY QVTK_INCLUDE_DIR) + if(NOT QVTK_FOUND) + set (VTK_USE_QVTK OFF) + else(NOT QVTK_FOUND) + get_filename_component (QVTK_LIBRARY_DIR ${QVTK_LIBRARY} PATH) + set (VTK_LIBRARY_DIRS ${VTK_LIBRARY_DIRS} ${QVTK_LIBRARY_DIR}) + set (VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS} ${QVTK_INCLUDE_DIR}) + set (VTK_USE_QVTK ON) + endif(NOT QVTK_FOUND) +else (${VTK_MAJOR_VERSION} VERSION_LESS "6.0") + list (FIND VTK_MODULES_ENABLED vtkGUISupportQt GUI_SUUPORT_QT_FOUND) + list (FIND VTK_MODULES_ENABLED vtkRenderingQt RENDERING_QT_FOUND) + if (GUI_SUUPORT_QT_FOUND AND RENDERING_QT_FOUND) + set (VTK_USE_QVTK ON) + set (QVTK_LIBRARY vtkRenderingQt vtkGUISupportQt) + else (GUI_SUUPORT_QT_FOUND AND RENDERING_QT_FOUND) + unset(QVTK_FOUND) + endif (GUI_SUUPORT_QT_FOUND AND RENDERING_QT_FOUND) +endif (${VTK_MAJOR_VERSION} VERSION_LESS "6.0") diff --git a/io/CMakeLists.txt b/io/CMakeLists.txt index f66080c3ed1..d6e0e8dff23 100644 --- a/io/CMakeLists.txt +++ b/io/CMakeLists.txt @@ -293,7 +293,7 @@ if(build) add_definitions(${VTK_DEFINES}) PCL_ADD_LIBRARY("${LIB_NAME}" "${SUBSYS_NAME}" ${srcs} ${incs} ${compression_incs} ${impl_incs} ${OPENNI_INCLUDES} ${OPENNI2_INCLUDES}) link_directories(${VTK_LINK_DIRECTORIES}) - target_link_libraries("${LIB_NAME}" pcl_common pcl_io_ply ${VTK_IO_TARGET_LINK_LIBRARIES} ${VTK_COMMON_TARGET_LINK_LIBRARIES}) + target_link_libraries("${LIB_NAME}" pcl_common pcl_io_ply ${VTK_LIBRARIES} ) if(PNG_FOUND) target_link_libraries("${LIB_NAME}" "${PNG_LIBRARY}") endif(PNG_FOUND) 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/CMakeLists.txt b/surface/CMakeLists.txt index 89cc5c67e3a..dec7d123d2e 100644 --- a/surface/CMakeLists.txt +++ b/surface/CMakeLists.txt @@ -44,7 +44,12 @@ if(build) src/vtk_smoothing/vtk_mesh_quadric_decimation.cpp src/vtk_smoothing/vtk_mesh_smoothing_laplacian.cpp src/vtk_smoothing/vtk_mesh_smoothing_windowed_sinc.cpp) - set(VTK_SMOOTHING_TARGET_LINK_LIBRARIES vtkCommon vtkWidgets vtkGraphics) + + if("${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}" VERSION_LESS "6.0") + set(VTK_SMOOTHING_TARGET_LINK_LIBRARIES vtkCommon vtkWidgets vtkGraphics) + else("${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}" VERSION_LESS "6.0") + set(VTK_SMOOTHING_TARGET_LINK_LIBRARIES vtkCommonCore vtkCommonDataModel vtkCommonExecutionModel vtkFiltersModeling) + endif("${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}" VERSION_LESS "6.0") endif() SET(BUILD_surface_on_nurbs 0 CACHE BOOL "Fitting NURBS to point-clouds using openNURBS" ) @@ -154,7 +159,7 @@ if(build) include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include" ${VTK_INCLUDE_DIRS} "${CMAKE_CURRENT_SOURCE_DIR}") link_directories(${VTK_LIBRARY_DIRS}) PCL_ADD_LIBRARY("${LIB_NAME}" "${SUBSYS_NAME}" ${srcs} ${incs} ${impl_incs} ${VTK_SMOOTHING_INCLUDES} ${POISSON_INCLUDES} ${OPENNURBS_INCLUDES} ${ON_NURBS_INCLUDES}) - target_link_libraries("${LIB_NAME}" pcl_common pcl_search pcl_kdtree pcl_octree ${VTK_SMOOTHING_TARGET_LINK_LIBRARIES} ${ON_NURBS_LIBRARIES}) + target_link_libraries("${LIB_NAME}" pcl_common pcl_search pcl_kdtree pcl_octree ${VTK_LIBRARIES} ${ON_NURBS_LIBRARIES}) if(QHULL_FOUND) target_link_libraries("${LIB_NAME}" ${QHULL_LIBRARIES}) endif(QHULL_FOUND) 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/test/outofcore/test_outofcore.cpp b/test/outofcore/test_outofcore.cpp index ab7d6bf2fd6..06693ae9114 100644 --- a/test/outofcore/test_outofcore.cpp +++ b/test/outofcore/test_outofcore.cpp @@ -55,8 +55,6 @@ using namespace std; #include #include -using namespace pcl; - #include #include @@ -523,7 +521,7 @@ TEST_F (OutofcoreTest, Outofcore_PointcloudConstructor) const Eigen::Vector3d max (1024, 1024, 1024); //create a point cloud - PointCloud::Ptr test_cloud (new PointCloud ()); + pcl::PointCloud::Ptr test_cloud (new pcl::PointCloud ()); test_cloud->width = numPts; test_cloud->height = 1; @@ -557,7 +555,7 @@ TEST_F (OutofcoreTest, Outofcore_PointsOnBoundaries) const Eigen::Vector3d min (-1,-1,-1); const Eigen::Vector3d max (1,1,1); - PointCloud::Ptr cloud (new PointCloud ()); + pcl::PointCloud::Ptr cloud (new pcl::PointCloud ()); cloud->width = 8; cloud->height =1; cloud->reserve (8); @@ -604,8 +602,8 @@ TEST_F (OutofcoreTest, Outofcore_MultiplePointClouds) const Eigen::Vector3d max (1024,1024,1024); //create a point cloud - PointCloud::Ptr test_cloud (new PointCloud ()); - PointCloud::Ptr second_cloud (new PointCloud ()); + pcl::PointCloud::Ptr test_cloud (new pcl::PointCloud ()); + pcl::PointCloud::Ptr second_cloud (new pcl::PointCloud ()); test_cloud->width = numPts; test_cloud->height = 1; @@ -667,8 +665,8 @@ TEST_F (OutofcoreTest, Outofcore_PointCloudInput_LOD) const Eigen::Vector3d max (1024,1024,1024); //create a point cloud - PointCloud::Ptr test_cloud (new PointCloud ()); - PointCloud::Ptr second_cloud (new PointCloud ()); + pcl::PointCloud::Ptr test_cloud (new pcl::PointCloud ()); + pcl::PointCloud::Ptr second_cloud (new pcl::PointCloud ()); test_cloud->width = numPts; test_cloud->height = 1; @@ -716,7 +714,7 @@ TEST_F (OutofcoreTest, PointCloud2_Constructors) const boost::uint64_t depth = 2; //create a point cloud - PointCloud::Ptr test_cloud (new PointCloud ()); + pcl::PointCloud::Ptr test_cloud (new pcl::PointCloud ()); test_cloud->width = numPts; test_cloud->height = 1; @@ -763,7 +761,7 @@ TEST_F (OutofcoreTest, PointCloud2_Insertion) pcl::PCLPointCloud2::Ptr input_cloud (new pcl::PCLPointCloud2 ()); - toPCLPointCloud2 (point_cloud, *input_cloud); + pcl::toPCLPointCloud2 (point_cloud, *input_cloud); ASSERT_EQ (point_cloud.width*point_cloud.height, input_cloud->width*input_cloud->height); octree_disk octreeA (min, max, smallest_voxel_dim, filename_otreeA, "ECEF"); @@ -785,8 +783,8 @@ TEST_F (OutofcoreTest, PointCloud2_MultiplePointCloud) const Eigen::Vector3d max (100.1, 100.1, 100.1); //create a point cloud - PointCloud::Ptr first_cloud (new PointCloud ()); - PointCloud::Ptr second_cloud (new PointCloud ()); + pcl::PointCloud::Ptr first_cloud (new pcl::PointCloud ()); + pcl::PointCloud::Ptr second_cloud (new pcl::PointCloud ()); first_cloud->width = numPts; first_cloud->height = 1; @@ -818,8 +816,8 @@ TEST_F (OutofcoreTest, PointCloud2_MultiplePointCloud) pcl::PCLPointCloud2::Ptr first_cloud_ptr (new pcl::PCLPointCloud2 ()); pcl::PCLPointCloud2::Ptr second_cloud_ptr (new pcl::PCLPointCloud2 ()); - toPCLPointCloud2 (*first_cloud, *first_cloud_ptr); - toPCLPointCloud2 (*second_cloud, *second_cloud_ptr); + pcl::toPCLPointCloud2 (*first_cloud, *first_cloud_ptr); + pcl::toPCLPointCloud2 (*second_cloud, *second_cloud_ptr); //Create an outofcore tree which just concatenates the two clouds into a single PCD in the root node. Check that the number of points is correct. octree_disk shallow_outofcore (0/*depth*/, min, max, filename_otreeB, "ECEF"); @@ -847,7 +845,7 @@ TEST_F (OutofcoreTest, PointCloud2_QueryBoundingBox) const boost::uint64_t depth = 2; //create a point cloud - PointCloud::Ptr test_cloud (new PointCloud ()); + pcl::PointCloud::Ptr test_cloud (new pcl::PointCloud ()); test_cloud->width = numPts; test_cloud->height = 1; @@ -899,7 +897,7 @@ TEST_F (OutofcoreTest, PointCloud2_Query) const boost::uint64_t depth = 2; //create a point cloud - PointCloud::Ptr test_cloud (new PointCloud ()); + pcl::PointCloud::Ptr test_cloud (new pcl::PointCloud ()); test_cloud->width = numPts; test_cloud->height = 1; diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 11db215102f..78c2c552826 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -235,13 +235,13 @@ if (build) target_link_libraries(pcl_octree_viewer pcl_common pcl_io pcl_octree pcl_visualization pcl_kdtree pcl_filters) PCL_ADD_EXECUTABLE(pcl_mesh2pcd "${SUBSYS_NAME}" mesh2pcd.cpp) - target_link_libraries(pcl_mesh2pcd pcl_common pcl_io pcl_visualization pcl_filters vtkCommon) + target_link_libraries(pcl_mesh2pcd pcl_common pcl_io pcl_visualization pcl_filters ${VTK_LIBRARIES}) PCL_ADD_EXECUTABLE(pcl_mesh_sampling "${SUBSYS_NAME}" mesh_sampling.cpp) - target_link_libraries(pcl_mesh_sampling pcl_common pcl_io pcl_visualization pcl_filters vtkCommon) + target_link_libraries(pcl_mesh_sampling pcl_common pcl_io pcl_visualization pcl_filters ${VTK_LIBRARIES}) PCL_ADD_EXECUTABLE(pcl_virtual_scanner "${SUBSYS_NAME}" virtual_scanner.cpp) - target_link_libraries(pcl_virtual_scanner pcl_common pcl_io pcl_filters pcl_visualization vtkCommon vtkGraphics) + target_link_libraries(pcl_virtual_scanner pcl_common pcl_io pcl_filters pcl_visualization ${VTK_LIBRARIES}) PCL_ADD_EXECUTABLE (pcl_voxel_grid_occlusion_estimation "${SUBSYS_NAME}" voxel_grid_occlusion_estimation.cpp) target_link_libraries (pcl_voxel_grid_occlusion_estimation pcl_common pcl_io pcl_filters pcl_visualization) 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/CMakeLists.txt b/visualization/CMakeLists.txt index 65bb3b6ab0e..f9f876a6ab0 100644 --- a/visualization/CMakeLists.txt +++ b/visualization/CMakeLists.txt @@ -149,7 +149,7 @@ if(build) if("${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}" VERSION_LESS "5.6") target_link_libraries("${LIB_NAME}" pcl_common pcl_io pcl_kdtree vtkCommon vtkWidgets vtkHybrid vtkFiltering vtkRendering ${OPENGL_LIBRARIES}) else() - target_link_libraries("${LIB_NAME}" pcl_common pcl_io pcl_kdtree vtkCommon vtkWidgets vtkHybrid vtkCharts vtkFiltering vtkRendering ${OPENGL_LIBRARIES}) + target_link_libraries("${LIB_NAME}" pcl_common pcl_io pcl_kdtree ${VTK_LIBRARIES} ${OPENGL_LIBRARIES}) endif() set(EXT_DEPS "") 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 {