Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compilation warnings when using VTK [version >= 8.2] #3637

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 25 additions & 26 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -377,25 +377,26 @@ endif()
option(WITH_VTK "Build VTK-Visualizations" TRUE)
if(WITH_VTK AND NOT ANDROID)
set(PCL_VTK_COMPONENTS
vtkChartsCore
vtkCommonCore
vtkCommonDataModel
vtkCommonExecutionModel
vtkFiltersCore
vtkFiltersExtraction
vtkFiltersModeling
vtkImagingCore
vtkImagingSources
vtkInteractionStyle
vtkInteractionWidgets
vtkIOCore
vtkIOGeometry
vtkIOImage
vtkIOLegacy
vtkIOPLY
vtkRenderingAnnotation
vtkRenderingLOD
vtkViewsContext2D
ChartsCore
CommonCore
CommonDataModel
CommonExecutionModel
FiltersCore
FiltersExtraction
FiltersGeometry
FiltersModeling
ImagingCore
ImagingSources
InteractionStyle
InteractionWidgets
IOCore
IOGeometry
IOImage
IOLegacy
IOPLY
RenderingAnnotation
RenderingLOD
ViewsContext2D
)
find_package(VTK COMPONENTS ${PCL_VTK_COMPONENTS})
if(VTK_FOUND AND ("${VTK_VERSION}" VERSION_LESS 6.2))
Expand All @@ -405,16 +406,14 @@ if(WITH_VTK AND NOT ANDROID)

if(VTK_FOUND)
if(NOT DEFINED VTK_RENDERING_BACKEND)
# On old VTK versions this variable does not exist. In this case it is
# safe to assume OpenGL backend
set(VTK_RENDERING_BACKEND "OpenGL")
# In this case it is safe to assume OpenGL backend
set(VTK_RENDERING_BACKEND "OpenGL2")
endif()
list(APPEND PCL_VTK_COMPONENTS vtkRenderingContext${VTK_RENDERING_BACKEND})

list(APPEND PCL_VTK_COMPONENTS RenderingContext${VTK_RENDERING_BACKEND})
if(WITH_QT)
if(";${VTK_MODULES_ENABLED};" MATCHES ";vtkGUISupportQt;" AND ";${VTK_MODULES_ENABLED};" MATCHES ";vtkRenderingQt;")
if(";${VTK_AVAILABLE_COMPONENTS};" MATCHES ";GUISupportQt;" AND ";${VTK_AVAILABLE_COMPONENTS};" MATCHES ";RenderingQt;")
set(QVTK_FOUND ON)
list(APPEND PCL_VTK_COMPONENTS vtkRenderingQt vtkGUISupportQt)
list(APPEND PCL_VTK_COMPONENTS RenderingQt GUISupportQt)
else()
unset(QVTK_FOUND)
endif()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ namespace pcl
ProjectModel*
getModel () const { return model_; }

QVTKWidget*
QVTKOpenGLNativeWidget*
getQVTK() const {return qvtk_; }

pcl::visualization::PCLVisualizer::Ptr
Expand Down Expand Up @@ -141,7 +141,7 @@ namespace pcl

pcl::visualization::PCLVisualizer::Ptr vis_;
ProjectModel* model_;
QVTKWidget* qvtk_;
QVTKOpenGLNativeWidget* qvtk_;
vtkSmartPointer<InteractorStyleSwitch> style_switch_;

vtkSmartPointer<vtkOrientationMarkerWidget> axes_widget_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#include <pcl/apps/cloud_composer/items/cloud_composer_item.h>
#include <pcl/visualization/pcl_plotter.h>

class QVTKWidget;
class QVTKOpenGLNativeWidget;

namespace pcl
{
Expand Down Expand Up @@ -74,7 +74,7 @@ namespace pcl
pcl::PointCloud<pcl::FPFHSignature33>::Ptr fpfh_ptr_;
double radius_;
pcl::visualization::PCLPlotter::Ptr plot_;
QVTKWidget *qvtk_;
QVTKOpenGLNativeWidget *qvtk_;
QWidget *hist_page_;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#include <pcl/visualization/common/ren_win_interact_map.h>
#include <pcl/visualization/pcl_visualizer.h>

class QVTKWidget;
class QVTKOpenGLNativeWidget;

namespace pcl
{
Expand Down Expand Up @@ -93,7 +93,7 @@ namespace pcl
initializeInteractorStyles (pcl::visualization::PCLVisualizer::Ptr vis, ProjectModel* model);

inline void
setQVTKWidget (QVTKWidget* qvtk) { qvtk_ = qvtk; }
setQVTKWidget (QVTKOpenGLNativeWidget* qvtk) { qvtk_ = qvtk; }

void
setCurrentInteractorStyle (interactor_styles::INTERACTOR_STYLES interactor_style);
Expand Down Expand Up @@ -134,7 +134,7 @@ namespace pcl
vtkSmartPointer<vtkPointPicker> point_picker_;

/** \brief Internal pointer to QVTKWidget that this Switch works with */
QVTKWidget* qvtk_;
QVTKOpenGLNativeWidget* qvtk_;
/** \brief Internal pointer to PCLVisualizer that this Switch works with */
pcl::visualization::PCLVisualizer::Ptr vis_;
private:
Expand Down
23 changes: 12 additions & 11 deletions apps/cloud_composer/src/cloud_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@

#include <QDebug>

#include <QVTKWidget.h>
#include <QVTKOpenGLNativeWidget.h>

pcl::cloud_composer::CloudView::CloudView (QWidget* parent)
: QWidget (parent)
{
vis_.reset (new pcl::visualization::PCLVisualizer ("", false));
vis_->getInteractorStyle ()->setKeyboardModifier (pcl::visualization::INTERACTOR_KB_MOD_SHIFT);
//Create the QVTKWidget
qvtk_ = new QVTKWidget (this);
qvtk_->SetRenderWindow (vis_->getRenderWindow ());
qvtk_ = new QVTKOpenGLNativeWidget (this);
qvtk_->setRenderWindow (vis_->getRenderWindow());
initializeInteractorSwitch ();
vis_->setupInteractor (qvtk_->GetInteractor (), qvtk_->GetRenderWindow (), style_switch_);
vis_->setupInteractor (qvtk_->interactor (), qvtk_->renderWindow (), style_switch_);

QGridLayout *mainLayout = new QGridLayout (this);
mainLayout-> addWidget (qvtk_,0,0);
Expand All @@ -31,10 +31,10 @@ pcl::cloud_composer::CloudView::CloudView (ProjectModel* model, QWidget* parent)
vis_.reset (new pcl::visualization::PCLVisualizer ("", false));
// vis_->getInteractorStyle ()->setKeyboardModifier (pcl::visualization::INTERACTOR_KB_MOD_SHIFT);
//Create the QVTKWidget
qvtk_ = new QVTKWidget (this);
qvtk_->SetRenderWindow (vis_->getRenderWindow ());
qvtk_ = new QVTKOpenGLNativeWidget (this);
qvtk_->setRenderWindow (vis_->getRenderWindow ());
initializeInteractorSwitch ();
vis_->setupInteractor (qvtk_->GetInteractor (), qvtk_->GetRenderWindow (), style_switch_);
vis_->setupInteractor (qvtk_->interactor (), qvtk_->renderWindow (), style_switch_);
setModel(model);

QGridLayout *mainLayout = new QGridLayout (this);
Expand All @@ -59,7 +59,7 @@ pcl::cloud_composer::CloudView::setModel (ProjectModel* new_model)
qvtk_->show();
qvtk_->update ();

// vis_->addOrientationMarkerWidgetAxes (qvtk_->GetInteractor ());
// vis_->addOrientationMarkerWidgetAxes (qvtk_->interactor ());
}

void
Expand Down Expand Up @@ -206,7 +206,8 @@ pcl::cloud_composer::CloudView::setAxisVisibility (bool visible)
if (visible)
{
qDebug () << "Adding coordinate system!";
vis_->addOrientationMarkerWidgetAxes ( qvtk_->GetInteractor() );
vis_->addOrientationMarkerWidgetAxes ( qvtk_->interactor() );

}
else
{
Expand All @@ -226,7 +227,7 @@ pcl::cloud_composer::CloudView::addOrientationMarkerWidgetAxes ()
axes_widget_ = vtkSmartPointer<vtkOrientationMarkerWidget>::New ();
axes_widget_->SetOutlineColor ( 0.9300, 0.5700, 0.1300 );
axes_widget_->SetOrientationMarker( axes );
axes_widget_->SetInteractor( qvtk_->GetInteractor () );
axes_widget_->SetInteractor( qvtk_->interactor () );
axes_widget_->SetViewport( 0.0, 0.0, 0.4, 0.4 );
axes_widget_->SetEnabled( 1 );
axes_widget_->InteractiveOn();
Expand Down Expand Up @@ -257,7 +258,7 @@ pcl::cloud_composer::CloudView::initializeInteractorSwitch ()
{
style_switch_ = vtkSmartPointer<InteractorStyleSwitch>::New();
style_switch_->initializeInteractorStyles (vis_, model_);
style_switch_->SetInteractor (qvtk_->GetInteractor ());
style_switch_->SetInteractor (qvtk_->interactor ());
style_switch_->setCurrentInteractorStyle (interactor_styles::PCL_VISUALIZER);

//Connect the events!
Expand Down
8 changes: 4 additions & 4 deletions apps/cloud_composer/src/items/fpfh_item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include <QGridLayout>

#include <QVTKWidget.h>
#include <QVTKOpenGLNativeWidget.h>

pcl::cloud_composer::FPFHItem::FPFHItem (QString name, const pcl::PointCloud<pcl::FPFHSignature33>::Ptr& fpfh_ptr, double radius)
: CloudComposerItem (std::move(name))
Expand Down Expand Up @@ -40,7 +40,7 @@ pcl::cloud_composer::FPFHItem::getInspectorTabs ()
if (!plot_)
{
plot_.reset (new pcl::visualization::PCLPlotter);
qvtk_ = new QVTKWidget ();
qvtk_ = new QVTKOpenGLNativeWidget ();
hist_page_ = new QWidget ();
QGridLayout *mainLayout = new QGridLayout (hist_page_);
mainLayout-> addWidget (qvtk_,0,0);
Expand All @@ -49,8 +49,8 @@ pcl::cloud_composer::FPFHItem::getInspectorTabs ()
//Plot the histogram
plot_->addFeatureHistogram (*fpfh_ptr_, fpfh_ptr_->width, data(ItemDataRole::ITEM_ID).toString().toStdString ());
//Set the render window of the QVTK widget, update
plot_->setViewInteractor (vtkSmartPointer<vtkRenderWindowInteractor> (qvtk_->GetInteractor ()));
qvtk_->SetRenderWindow (plot_->getRenderWindow ());
plot_->setViewInteractor (vtkSmartPointer<vtkRenderWindowInteractor> (qvtk_->interactor ()));
qvtk_->setRenderWindow (plot_->getRenderWindow ());
qvtk_->show ();
qvtk_->update ();

Expand Down
1 change: 1 addition & 0 deletions apps/include/pcl/apps/render_views_tesselated_sphere.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include <vtkSmartPointer.h>
#include <vtkPolyData.h>
#include <vtkIdTypeArray.h>

#include <functional>

Expand Down
4 changes: 2 additions & 2 deletions apps/modeler/include/pcl/apps/modeler/render_window.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

#include <vtkSmartPointer.h>

#include <QVTKWidget.h>
#include <QVTKOpenGLNativeWidget.h>

class vtkCubeAxesActor;

Expand All @@ -48,7 +48,7 @@ namespace pcl
{
class RenderWindowItem;

class RenderWindow : public QVTKWidget
class RenderWindow : public QVTKOpenGLNativeWidget
{
public:
RenderWindow(RenderWindowItem* render_window_item, QWidget *parent = nullptr, Qt::WindowFlags flags = nullptr);
Expand Down
8 changes: 4 additions & 4 deletions apps/modeler/src/cloud_mesh_item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ void
pcl::modeler::CloudMeshItem::createChannels()
{
RenderWindowItem* render_window_item = dynamic_cast<RenderWindowItem*>(parent());
addChild(new PointsActorItem(this, cloud_mesh_, render_window_item->getRenderWindow()->GetRenderWindow()));
addChild(new NormalsActorItem(this, cloud_mesh_, render_window_item->getRenderWindow()->GetRenderWindow()));
addChild(new SurfaceActorItem(this, cloud_mesh_, render_window_item->getRenderWindow()->GetRenderWindow()));
addChild(new PointsActorItem(this, cloud_mesh_, render_window_item->getRenderWindow()->renderWindow()));
addChild(new NormalsActorItem(this, cloud_mesh_, render_window_item->getRenderWindow()->renderWindow()));
addChild(new SurfaceActorItem(this, cloud_mesh_, render_window_item->getRenderWindow()->renderWindow()));
for (int i = 0, i_end = childCount(); i < i_end; ++ i)
{
ChannelActorItem* child_item = dynamic_cast<ChannelActorItem*>(child(i));
Expand Down Expand Up @@ -241,7 +241,7 @@ pcl::modeler::CloudMeshItem::updateRenderWindow()
for (int i = 0, i_end = childCount(); i < i_end; ++ i)
{
ChannelActorItem* child_item = dynamic_cast<ChannelActorItem*>(child(i));
child_item->switchRenderWindow(render_window_item->getRenderWindow()->GetRenderWindow());
child_item->switchRenderWindow(render_window_item->getRenderWindow()->renderWindow());
}

render_window_item->getRenderWindow()->updateAxes();
Expand Down
24 changes: 12 additions & 12 deletions apps/modeler/src/render_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

//////////////////////////////////////////////////////////////////////////////////////////////
pcl::modeler::RenderWindow::RenderWindow(RenderWindowItem* render_window_item, QWidget *parent, Qt::WindowFlags flags)
: QVTKWidget(parent, flags),
: QVTKOpenGLNativeWidget(parent, flags),
axes_(vtkSmartPointer<vtkCubeAxesActor>::New()),
render_window_item_(render_window_item)
{
Expand All @@ -77,7 +77,7 @@ pcl::modeler::RenderWindow::~RenderWindow()
void
pcl::modeler::RenderWindow::initRenderer()
{
vtkSmartPointer<vtkRenderWindow> win = GetRenderWindow();
vtkSmartPointer<vtkRenderWindow> win = renderWindow();
vtkSmartPointer<vtkRenderer> renderer = vtkSmartPointer<vtkRenderer>::New();
win->AddRenderer(renderer);

Expand Down Expand Up @@ -107,7 +107,7 @@ pcl::modeler::RenderWindow::focusInEvent(QFocusEvent * event)
{
dynamic_cast<SceneTree*>(render_window_item_->treeWidget())->selectRenderWindowItem(render_window_item_);

QVTKWidget::focusInEvent(event);
QVTKOpenGLNativeWidget::focusInEvent(event);
}

//////////////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -136,31 +136,31 @@ pcl::modeler::RenderWindow::setTitle(const QString& title)
void
pcl::modeler::RenderWindow::render()
{
GetRenderWindow()->Render();
renderWindow()->Render();
}

//////////////////////////////////////////////////////////////////////////////////////////////
void
pcl::modeler::RenderWindow::resetCamera()
{
double bounds[6];
GetRenderWindow()->GetRenderers()->GetFirstRenderer()->ComputeVisiblePropBounds(bounds);
GetRenderWindow()->GetRenderers()->GetFirstRenderer()->ResetCamera(bounds);
renderWindow()->GetRenderers()->GetFirstRenderer()->ComputeVisiblePropBounds(bounds);
renderWindow()->GetRenderers()->GetFirstRenderer()->ResetCamera(bounds);
render();
}

//////////////////////////////////////////////////////////////////////////////////////////////
void
pcl::modeler::RenderWindow::getBackground(double& r, double& g, double& b)
{
GetRenderWindow()->GetRenderers()->GetFirstRenderer()->GetBackground(r, g, b);
renderWindow()->GetRenderers()->GetFirstRenderer()->GetBackground(r, g, b);
}

//////////////////////////////////////////////////////////////////////////////////////////////
void
pcl::modeler::RenderWindow::setBackground(double r, double g, double b)
{
GetRenderWindow()->GetRenderers()->GetFirstRenderer()->SetBackground(r, g, b);
renderWindow()->GetRenderers()->GetFirstRenderer()->SetBackground(r, g, b);
}


Expand All @@ -170,7 +170,7 @@ pcl::modeler::RenderWindow::updateAxes()
{
vtkBoundingBox bb;

vtkActorCollection* actors = GetRenderWindow()->GetRenderers()->GetFirstRenderer()->GetActors();
vtkActorCollection* actors = renderWindow()->GetRenderers()->GetFirstRenderer()->GetActors();

actors->InitTraversal();
for (int i = 0, i_end = actors->GetNumberOfItems(); i < i_end; ++ i)
Expand All @@ -187,17 +187,17 @@ pcl::modeler::RenderWindow::updateAxes()
double bounds[6];
bb.GetBounds(bounds);
axes_->SetBounds(bounds);
axes_->SetCamera(GetRenderWindow()->GetRenderers()->GetFirstRenderer()->GetActiveCamera());
axes_->SetCamera(renderWindow()->GetRenderers()->GetFirstRenderer()->GetActiveCamera());
}

//////////////////////////////////////////////////////////////////////////////////////////////
void
pcl::modeler::RenderWindow::setShowAxes(bool flag)
{
if (flag)
GetRenderWindow()->GetRenderers()->GetFirstRenderer()->AddActor(axes_);
renderWindow()->GetRenderers()->GetFirstRenderer()->AddActor(axes_);
else
GetRenderWindow()->GetRenderers()->GetFirstRenderer()->RemoveActor(axes_);
renderWindow()->GetRenderers()->GetFirstRenderer()->RemoveActor(axes_);

return;
}
8 changes: 4 additions & 4 deletions apps/src/manual_registration/manual_registration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,17 @@ ManualRegistration::ManualRegistration ()

// Set up the source window
vis_src_.reset (new pcl::visualization::PCLVisualizer ("", false));
ui_->qvtk_widget_src->SetRenderWindow (vis_src_->getRenderWindow ());
vis_src_->setupInteractor (ui_->qvtk_widget_src->GetInteractor (), ui_->qvtk_widget_src->GetRenderWindow ());
ui_->qvtk_widget_src->setRenderWindow (vis_src_->getRenderWindow());
vis_src_->setupInteractor (ui_->qvtk_widget_src->interactor (), ui_->qvtk_widget_src->renderWindow ());
vis_src_->getInteractorStyle ()->setKeyboardModifier (pcl::visualization::INTERACTOR_KB_MOD_SHIFT);
ui_->qvtk_widget_src->update ();

vis_src_->registerPointPickingCallback (&ManualRegistration::SourcePointPickCallback, *this);

// Set up the destination window
vis_dst_.reset (new pcl::visualization::PCLVisualizer ("", false));
ui_->qvtk_widget_dst->SetRenderWindow (vis_dst_->getRenderWindow ());
vis_dst_->setupInteractor (ui_->qvtk_widget_dst->GetInteractor (), ui_->qvtk_widget_dst->GetRenderWindow ());
ui_->qvtk_widget_dst->setRenderWindow (vis_dst_->getRenderWindow());
vis_dst_->setupInteractor (ui_->qvtk_widget_dst->interactor (), ui_->qvtk_widget_dst->renderWindow ());
vis_dst_->getInteractorStyle ()->setKeyboardModifier (pcl::visualization::INTERACTOR_KB_MOD_SHIFT);
ui_->qvtk_widget_dst->update ();

Expand Down
Loading