From 1be0d520515362143c897dde4ebaf4a77339f2a4 Mon Sep 17 00:00:00 2001 From: matlabbe Date: Thu, 9 Feb 2017 19:25:35 -0500 Subject: [PATCH] Fixed compilation error with PCL < 1.7.2 (disabled graph frustums option) --- guilib/src/CloudViewer.cpp | 15 +++++++++++++++ guilib/src/PreferencesDialog.cpp | 7 ++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/guilib/src/CloudViewer.cpp b/guilib/src/CloudViewer.cpp index 7fac9fea..83047efa 100644 --- a/guilib/src/CloudViewer.cpp +++ b/guilib/src/CloudViewer.cpp @@ -1247,6 +1247,10 @@ void CloudViewer::addOrUpdateFrustum( return; } +#if PCL_VERSION_COMPARE(<, 1, 7, 2) + this->removeFrustum(id); +#endif + if(!transform.isNull()) { if(_frustums.find(id)==_frustums.end()) @@ -1267,7 +1271,12 @@ void CloudViewer::addOrUpdateFrustum( c = color; } Transform opticalRotInv(0, -1, 0, 0, 0, 0, -1, 0, 1, 0, 0, 0); + +#if PCL_VERSION_COMPARE(<, 1, 7, 2) + Eigen::Affine3f t = (transform*localTransform*opticalRotInv).toEigen3f(); +#else Eigen::Affine3f t = (localTransform*opticalRotInv).toEigen3f(); +#endif for(int i=0; iaddPolylineFromPolygonMesh(mesh, id); _visualizer->setShapeRenderingProperties(pcl::visualization::PCL_VISUALIZER_COLOR, c.redF(), c.greenF(), c.blueF(), id); } +#if PCL_VERSION_COMPARE(>=, 1, 7, 2) if(!this->updateFrustumPose(id, transform)) { UERROR("Failed updating pose of frustum %s!?", id.c_str()); } +#endif } else { @@ -1303,6 +1314,7 @@ bool CloudViewer::updateFrustumPose( const std::string & id, const Transform & pose) { +#if PCL_VERSION_COMPARE(>=, 1, 7, 2) QMap::iterator iter=_frustums.find(id); if(iter != _frustums.end() && !pose.isNull()) { @@ -1335,6 +1347,9 @@ bool CloudViewer::updateFrustumPose( return true; } +#else + UERROR("updateFrustumPose() cannot be used with PCL<1.7.2. Use addOrUpdateFrustum() instead."); +#endif return false; } diff --git a/guilib/src/PreferencesDialog.cpp b/guilib/src/PreferencesDialog.cpp index 375986c0..6db9ed11 100644 --- a/guilib/src/PreferencesDialog.cpp +++ b/guilib/src/PreferencesDialog.cpp @@ -259,6 +259,11 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) : _ui->openni2_exposure->setEnabled(CameraOpenNI2::exposureGainAvailable()); _ui->openni2_gain->setEnabled(CameraOpenNI2::exposureGainAvailable()); +#if PCL_VERSION_COMPARE(<, 1, 7, 2) + _ui->checkBox_showFrustums->setEnabled(false); + _ui->checkBox_showFrustums->setChecked(false); +#endif + // in case we change the ui, we should not forget to change stuff related to this parameter UASSERT(_ui->odom_registration->count() == 4); @@ -3978,7 +3983,7 @@ bool PreferencesDialog::isGraphsShown() const } bool PreferencesDialog::isFrustumsShown() const { - return _ui->checkBox_showFrustums->isChecked(); + return _ui->checkBox_showFrustums->isEnabled() && _ui->checkBox_showFrustums->isChecked(); } bool PreferencesDialog::isLabelsShown() const {