Skip to content

Commit

Permalink
Start of migrating cloud_composer to VTK 9 support.
Browse files Browse the repository at this point in the history
  • Loading branch information
larshg committed Jul 10, 2020
1 parent 54f34a6 commit c3a8fb6
Show file tree
Hide file tree
Showing 15 changed files with 106 additions and 11 deletions.
29 changes: 27 additions & 2 deletions apps/cloud_composer/include/pcl/apps/cloud_composer/cloud_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,18 @@
#include <pcl/visualization/pcl_visualizer.h>
#include <pcl/apps/cloud_composer/point_selectors/interactor_style_switch.h>

#include <vtkSmartPointer.h>
#include <vtkOrientationMarkerWidget.h>
#include <vtkAxesActor.h>
#include <vtkVersion.h>

#if VTK_MAJOR_VERSION > 8
#include <QVTKOpenGLNativeWidget.h>
#else
#include <QVTKWidget.h>
#endif


class QItemSelection;
class QStandardItem;

Expand All @@ -70,8 +82,15 @@ namespace pcl
ProjectModel*
getModel () const { return model_; }

QVTKWidget*
getQVTK() const {return qvtk_; }

#if VTK_MAJOR_VERSION > 8
QVTKOpenGLNativeWidget*
getQVTKOpenGLNativeWidget() const { return qvtk_; }
#else
QVTKWidget*
getQVTK() const { return qvtk_; }
#endif


pcl::visualization::PCLVisualizer::Ptr
getPCLVisualizer () const { return vis_; }
Expand Down Expand Up @@ -141,7 +160,13 @@ namespace pcl

pcl::visualization::PCLVisualizer::Ptr vis_;
ProjectModel* model_;

#if VTK_MAJOR_VERSION > 8
QVTKOpenGLNativeWidget* qvtk_;
#else
QVTKWidget* qvtk_;
#endif

vtkSmartPointer<InteractorStyleSwitch> style_switch_;

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

#include <vtkVersion.h>

#if VTK_MAJOR_VERSION > 8
#include <QVTKOpenGLNativeWidget.h>
#else
#include <QVTKWidget.h>
#endif

class QVTKWidget;

namespace pcl
Expand Down Expand Up @@ -74,7 +82,11 @@ namespace pcl
pcl::PointCloud<pcl::FPFHSignature33>::Ptr fpfh_ptr_;
double radius_;
pcl::visualization::PCLPlotter::Ptr plot_;
#if VTK_MAJOR_VERSION > 8
QVTKOpenGLNativeWidget* qvtk_;
#else
QVTKWidget *qvtk_;
#endif
QWidget *hist_page_;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@

#include <pcl/apps/cloud_composer/point_selectors/interactor_style_switch.h>

#include <vtkInteractorStyleTrackballActor.h>

namespace pcl
{
namespace cloud_composer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,19 @@

#include <QMap>

#include <pcl/visualization/vtk.h>
#include <pcl/visualization/interactor_style.h>
#include <pcl/visualization/common/actor_map.h>
#include <pcl/visualization/common/ren_win_interact_map.h>
#include <pcl/visualization/pcl_visualizer.h>

#include <vtkSmartPointer.h>
#include <vtkAreaPicker.h>
#include <vtkPointPicker.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkCommand.h>
#include <vtkRendererCollection.h>
#include <vtkInteractorStyle.h>

class QVTKWidget;

namespace pcl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@

#pragma once

#include <pcl/visualization/vtk.h>
#include <pcl/apps/cloud_composer/items/cloud_item.h>

namespace pcl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@

#include <pcl/apps/cloud_composer/point_selectors/interactor_style_switch.h>

#include <vtkSmartPointer.h>
#include <vtkRendererCollection.h>
#include <vtkInteractorStyleRubberBandpick.h>

namespace pcl
{
namespace cloud_composer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@

#include <pcl/apps/cloud_composer/point_selectors/interactor_style_switch.h>

#include <vtkInteractorStyleTrackballActor.h>
#include <vtkSmartPointer.h>
#include <vtkMatrix4x4.h>

namespace pcl
{
namespace cloud_composer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,14 @@

#pragma once

#include <pcl/visualization/vtk.h>
#include <pcl/apps/cloud_composer/items/cloud_item.h>

#include <vtkSmartPointer.h>
#include <vtkPolyData.h>
#include <vtkActor.h>
#include <vtkDataSetMapper.h>
#include <vtkRenderer.h>

namespace pcl
{
namespace cloud_composer
Expand Down
19 changes: 15 additions & 4 deletions apps/cloud_composer/src/cloud_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,20 @@

#include <QDebug>

#include <QVTKWidget.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);

#if VTK_MAJOR_VERSION > 8
qvtk_ = new QVTKOpenGLNativeWidget(this);
#else
qvtk_ = new QVTKWidget(this);
#endif

qvtk_->SetRenderWindow (vis_->getRenderWindow ());
initializeInteractorSwitch ();
vis_->setupInteractor (qvtk_->GetInteractor (), qvtk_->GetRenderWindow (), style_switch_);
Expand All @@ -30,8 +35,14 @@ pcl::cloud_composer::CloudView::CloudView (ProjectModel* model, QWidget* parent)
model_ = model;
vis_.reset (new pcl::visualization::PCLVisualizer ("", false));
// vis_->getInteractorStyle ()->setKeyboardModifier (pcl::visualization::INTERACTOR_KB_MOD_SHIFT);
//Create the QVTKWidget
qvtk_ = new QVTKWidget (this);

//Create the QVTKWidget
#if VTK_MAJOR_VERSION > 8
qvtk_ = new QVTKOpenGLNativeWidget(this);
#else
qvtk_ = new QVTKWidget(this);
#endif

qvtk_->SetRenderWindow (vis_->getRenderWindow ());
initializeInteractorSwitch ();
vis_->setupInteractor (qvtk_->GetInteractor (), qvtk_->GetRenderWindow (), style_switch_);
Expand Down
6 changes: 4 additions & 2 deletions apps/cloud_composer/src/items/fpfh_item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

#include <QGridLayout>

#include <QVTKWidget.h>

pcl::cloud_composer::FPFHItem::FPFHItem (QString name, const pcl::PointCloud<pcl::FPFHSignature33>::Ptr& fpfh_ptr, double radius)
: CloudComposerItem (std::move(name))
, fpfh_ptr_ (fpfh_ptr)
Expand Down Expand Up @@ -40,7 +38,11 @@ pcl::cloud_composer::FPFHItem::getInspectorTabs ()
if (!plot_)
{
plot_.reset (new pcl::visualization::PCLPlotter);
#if VTK_MAJOR_VERSION > 8
qvtk_ = new QVTKOpenGLNativeWidget();
#else
qvtk_ = new QVTKWidget ();
#endif
hist_page_ = new QWidget ();
QGridLayout *mainLayout = new QGridLayout (hist_page_);
mainLayout-> addWidget (qvtk_,0,0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include <QDebug>

#include <vtkTransform.h>

namespace pcl
{
namespace cloud_composer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

#include <QDebug>

#include <vtkCallbackCommand.h>

namespace pcl
{
namespace cloud_composer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@

#include <QDebug>

#include <vtkSmartPointer.h>
#include <vtkIdFilter.h>
#include <vtkExtractGeometry.h>
#include <vtkVertexGlyphFilter.h>
#include <vtkPlanes.h>
#include <vtkAreaPicker.h>

namespace pcl
{
namespace cloud_composer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@
#include <QDebug>
#include <QItemSelectionModel>

#include <vtkSmartPointer.h>
#include <vtkMatrix4x4.h>
#include <vtkLODActor.h>
#include <vtkInteractorStyleTrackballActor.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkTransform.h>


namespace pcl
{
namespace cloud_composer
Expand Down
5 changes: 5 additions & 0 deletions apps/cloud_composer/src/project_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
#include <QMessageBox>
#include <QThread>

#include <vtkSmartPointer.h>
#include <vtkImageData.h>
#include <vtkImageReader2Factory.h>
#include <vtkImageReader2.h>

pcl::cloud_composer::ProjectModel::ProjectModel (QObject* parent)
: QStandardItemModel (parent)
{
Expand Down

0 comments on commit c3a8fb6

Please sign in to comment.