diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pc_source/source.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pc_source/source.h index e2a14ac7e48..8e475f6f4bc 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pc_source/source.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pc_source/source.h @@ -51,8 +51,7 @@ class Model { if (resolution <= 0) return assembled_; - typename std::map::iterator it = - voxelized_assembled_.find(resolution); + auto it = voxelized_assembled_.find(resolution); if (it == voxelized_assembled_.end()) { PointTPtr voxelized(new pcl::PointCloud); pcl::VoxelGrid grid_; diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_crh.hpp b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_crh.hpp index af7ab87d642..4dad194506e 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_crh.hpp +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_crh.hpp @@ -22,11 +22,7 @@ pcl::rec_3d_framework::GlobalNNCRHRecognizer::getP using mv_pair = std::pair; mv_pair pair_model_view = std::make_pair(model.id_, view_id); - std::map, - Eigen::aligned_allocator>>:: - iterator it = poses_cache_.find(pair_model_view); + auto it = poses_cache_.find(pair_model_view); if (it != poses_cache_.end()) { pose_matrix = it->second; diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_cvfh.hpp b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_cvfh.hpp index 6a583006cd7..08d17d7caaf 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_cvfh.hpp +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_cvfh.hpp @@ -22,11 +22,7 @@ pcl::rec_3d_framework::GlobalNNCVFHRecognizer::get using mv_pair = std::pair; mv_pair pair_model_view = std::make_pair(model.id_, view_id); - std::map, - Eigen::aligned_allocator>>:: - iterator it = poses_cache_.find(pair_model_view); + auto it = poses_cache_.find(pair_model_view); if (it != poses_cache_.end()) { pose_matrix = it->second; diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/local_recognizer.hpp b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/local_recognizer.hpp index 1bf8388f7fe..44e1277d3f8 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/local_recognizer.hpp +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/local_recognizer.hpp @@ -460,11 +460,7 @@ pcl::rec_3d_framework::LocalRecognitionPipeline::g using mv_pair = std::pair; mv_pair pair_model_view = std::make_pair(model.id_, view_id); - std::map, - Eigen::aligned_allocator>>:: - iterator it = poses_cache_.find(pair_model_view); + auto it = poses_cache_.find(pair_model_view); if (it != poses_cache_.end()) { pose_matrix = it->second; @@ -489,8 +485,7 @@ pcl::rec_3d_framework::LocalRecognitionPipeline:: if (use_cache_) { std::pair pair_model_view = std::make_pair(model.id_, view_id); - typename std::map, PointInTPtr>::iterator it = - keypoints_cache_.find(pair_model_view); + auto it = keypoints_cache_.find(pair_model_view); if (it != keypoints_cache_.end()) { keypoints_cloud = it->second; diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/local_recognizer.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/local_recognizer.h index 8aece90423d..ec35efd4f86 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/local_recognizer.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/local_recognizer.h @@ -195,7 +195,7 @@ class PCL_EXPORTS LocalRecognitionPipeline { } public: - LocalRecognitionPipeline() : search_model_("") + LocalRecognitionPipeline() { use_cache_ = false; threshold_accept_model_hypothesis_ = 0.2f; diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/tools/openni_frame_source.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/tools/openni_frame_source.h index 1fe6f4aacfb..b78cbea047b 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/tools/openni_frame_source.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/tools/openni_frame_source.h @@ -31,9 +31,9 @@ class PCL_EXPORTS OpenNIFrameSource { pcl::OpenNIGrabber grabber_; PointCloudPtr most_recent_frame_; - int frame_counter_; + int frame_counter_{0}; std::mutex mutex_; - bool active_; + bool active_{true}; }; } // namespace OpenNIFrameSource diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/utils/persistence_utils.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/utils/persistence_utils.h index 528a7daf4a8..fcaba10419f 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/utils/persistence_utils.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/utils/persistence_utils.h @@ -54,7 +54,7 @@ writeMatrixToFile(const std::string& file, Eigen::Matrix4f& matrix) for (std::size_t i = 0; i < 4; i++) { for (std::size_t j = 0; j < 4; j++) { out << matrix(i, j); - if (!(i == 3 && j == 3)) + if (i != 3 || j != 3) out << " "; } } diff --git a/apps/3d_rec_framework/src/tools/local_recognition_mian_dataset.cpp b/apps/3d_rec_framework/src/tools/local_recognition_mian_dataset.cpp index 220952347f4..f6ab05df515 100644 --- a/apps/3d_rec_framework/src/tools/local_recognition_mian_dataset.cpp +++ b/apps/3d_rec_framework/src/tools/local_recognition_mian_dataset.cpp @@ -102,7 +102,7 @@ recognizeAndVisualize( for (std::size_t i = 0; i < files.size(); i++) { std::cout << files[i] << std::endl; if (scene != -1) - if ((std::size_t)scene != i) + if (static_cast(scene) != i) continue; const std::string file = ply_files_dir.string() + files[i]; diff --git a/apps/3d_rec_framework/src/tools/openni_frame_source.cpp b/apps/3d_rec_framework/src/tools/openni_frame_source.cpp index 1d0645dd3a5..37a4d990077 100644 --- a/apps/3d_rec_framework/src/tools/openni_frame_source.cpp +++ b/apps/3d_rec_framework/src/tools/openni_frame_source.cpp @@ -4,8 +4,7 @@ namespace OpenNIFrameSource { -OpenNIFrameSource::OpenNIFrameSource(const std::string& device_id) -: grabber_(device_id), frame_counter_(0), active_(true) +OpenNIFrameSource::OpenNIFrameSource(const std::string& device_id) : grabber_(device_id) { std::function frame_cb = [this](const PointCloudConstPtr& cloud) { onNewFrame(cloud); }; diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/commands.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/commands.h index e47c399b2e2..9ef05cde3e8 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/commands.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/commands.h @@ -54,7 +54,7 @@ class CloudCommand : public QUndoCommand { public: CloudCommand(ConstItemList input_data, QUndoCommand* parent = nullptr); - ~CloudCommand(); + ~CloudCommand() override; virtual bool runCommand(AbstractTool* tool) = 0; @@ -112,8 +112,8 @@ class CloudCommand : public QUndoCommand { bool canUseTemplates(ConstItemList& input_data); - bool can_use_templates_; - int template_type_; + bool can_use_templates_{false}; + int template_type_{-1}; }; class ModifyItemCommand : public CloudCommand { diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/impl/cloud_item.hpp b/apps/cloud_composer/include/pcl/apps/cloud_composer/impl/cloud_item.hpp index 6c78b82d46f..8ee74eaf3c0 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/impl/cloud_item.hpp +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/impl/cloud_item.hpp @@ -68,7 +68,7 @@ pcl::cloud_composer::CloudItem::createCloudItemFromTemplate( { pcl::PCLPointCloud2::Ptr cloud_blob = pcl::make_shared(); toPCLPointCloud2(*cloud_ptr, *cloud_blob); - CloudItem* cloud_item = + auto* cloud_item = new CloudItem(name, cloud_blob, Eigen::Vector4f(), Eigen::Quaternionf(), false); cloud_item->setData(QVariant::fromValue(cloud_ptr), ItemDataRole::CLOUD_TEMPLATED); cloud_item->setPointType(); diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/impl/merge_selection.hpp b/apps/cloud_composer/include/pcl/apps/cloud_composer/impl/merge_selection.hpp index bb913d2581e..dbc139df5df 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/impl/merge_selection.hpp +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/impl/merge_selection.hpp @@ -74,9 +74,8 @@ pcl::cloud_composer::MergeSelection::performTemplatedAction( input_cloud_item->printNumPoints(); // If this cloud hasn't been completely selected if (!input_data.contains(input_cloud_item)) { - typename PointCloud::Ptr input_cloud = - input_cloud_item->data(ItemDataRole::CLOUD_TEMPLATED) - .value::Ptr>(); + auto input_cloud = input_cloud_item->data(ItemDataRole::CLOUD_TEMPLATED) + .value::Ptr>(); qDebug() << "Extracting " << selected_item_index_map_.value(input_cloud_item)->indices.size() << " points out of " << input_cloud->width; @@ -102,9 +101,8 @@ pcl::cloud_composer::MergeSelection::performTemplatedAction( } // Just concatenate for all fully selected clouds foreach (const CloudComposerItem* input_item, input_data) { - typename PointCloud::Ptr input_cloud = - input_item->data(ItemDataRole::CLOUD_TEMPLATED) - .value::Ptr>(); + auto input_cloud = input_item->data(ItemDataRole::CLOUD_TEMPLATED) + .value::Ptr>(); *merged_cloud += *input_cloud; } CloudItem* cloud_item = CloudItem::createCloudItemFromTemplate( diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/impl/transform_clouds.hpp b/apps/cloud_composer/include/pcl/apps/cloud_composer/impl/transform_clouds.hpp index 5fce284b5ab..5d16ae4eae2 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/impl/transform_clouds.hpp +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/impl/transform_clouds.hpp @@ -68,8 +68,7 @@ pcl::cloud_composer::TransformClouds::performTemplatedAction( foreach (const CloudComposerItem* input_item, input_data) { qDebug() << "Transforming cloud " << input_item->getId(); QVariant variant = input_item->data(ItemDataRole::CLOUD_TEMPLATED); - typename PointCloud::Ptr input_cloud = - variant.value::Ptr>(); + auto input_cloud = variant.value::Ptr>(); Eigen::Matrix4f transform; if (transform_map_.contains("AllSelectedClouds")) diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/items/cloud_composer_item.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/items/cloud_composer_item.h index 422f8e3d512..3a60dcc1d8b 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/items/cloud_composer_item.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/items/cloud_composer_item.h @@ -73,7 +73,7 @@ class CloudComposerItem : public QStandardItem { CloudComposerItem(const QString& name = "default item"); CloudComposerItem(const CloudComposerItem& to_copy); - ~CloudComposerItem(); + ~CloudComposerItem() override; inline int type() const override diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/items/cloud_item.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/items/cloud_item.h index 8e4a6a4b2f5..126e8ff2faa 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/items/cloud_item.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/items/cloud_item.h @@ -149,15 +149,15 @@ class CloudItem : public CloudComposerItem { Eigen::Vector4f origin_; Eigen::Quaternionf orientation_; - bool template_cloud_set_; + bool template_cloud_set_{false}; // Internal Storage of the templated type of this cloud - int point_type_; + int point_type_{PointTypeFlags::NONE}; bool checkIfFinite(); - bool is_sanitized_; + bool is_sanitized_{false}; // Helper functions which set the point_type_ based on the current point type template diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/point_selectors/manipulation_event.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/point_selectors/manipulation_event.h index af1f09e875a..883222cdfe6 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/point_selectors/manipulation_event.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/point_selectors/manipulation_event.h @@ -45,7 +45,7 @@ namespace cloud_composer { class ManipulationEvent { public: - ManipulationEvent() {} + ManipulationEvent() = default; void addManipulation(const QString& id, diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/project_model.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/project_model.h index 5394e2f1ec5..dd6c7094563 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/project_model.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/project_model.h @@ -66,7 +66,7 @@ class ProjectModel : public QStandardItemModel { public: ProjectModel(QObject* parent = nullptr); ProjectModel(const ProjectModel& to_copy); - ~ProjectModel(); + ~ProjectModel() override; ProjectModel(QString project_name, QObject* parent = nullptr); diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/tool_interface/abstract_tool.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/tool_interface/abstract_tool.h index 30bd06080c9..aac5565ef4c 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/tool_interface/abstract_tool.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/tool_interface/abstract_tool.h @@ -51,7 +51,7 @@ class AbstractTool : public QObject { public: AbstractTool(PropertiesModel* parameter_model, QObject* parent); - ~AbstractTool() { qDebug() << "Tool Destructed"; } + ~AbstractTool() override { qDebug() << "Tool Destructed"; } /** \brief Function called which does work in plugin * \param data input_data from the model - const for good reason diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/toolbox_model.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/toolbox_model.h index f109c8d93a9..377bf94ce7c 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/toolbox_model.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/toolbox_model.h @@ -114,7 +114,7 @@ public Q_SLOTS: QItemSelectionModel* selection_model_; QSet tool_items; - ProjectModel* project_model_; + ProjectModel* project_model_{nullptr}; }; } // namespace cloud_composer } // namespace pcl diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/euclidean_clustering.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/euclidean_clustering.h index c97be097638..cc886e279ca 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/euclidean_clustering.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/euclidean_clustering.h @@ -99,7 +99,7 @@ class EuclideanClusteringToolFactory : public QObject, public ToolFactory { inline QList getRequiredInputChildrenTypes() const override { - return QList(); + return {}; } }; diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/impl/organized_segmentation.hpp b/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/impl/organized_segmentation.hpp index a200e83c857..ed34dbbddeb 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/impl/organized_segmentation.hpp +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/impl/organized_segmentation.hpp @@ -66,8 +66,7 @@ pcl::cloud_composer::OrganizedSegmentationTool::performTemplatedAction( "item! (input list)"; return output; } - typename PointCloud::Ptr input_cloud = - variant.value::Ptr>(); + auto input_cloud = variant.value::Ptr>(); if (!input_cloud->isOrganized()) { qCritical() << "Organized Segmentation requires an organized cloud!"; return output; @@ -89,14 +88,12 @@ pcl::cloud_composer::OrganizedSegmentationTool::performTemplatedAction( input_item->getChildren(CloudComposerItem::NORMALS_ITEM); // Get the normals cloud, we just use the first normals that were found if there are // more than one - pcl::PointCloud::ConstPtr input_normals = - normals_list.value(0) - ->data(ItemDataRole::CLOUD_TEMPLATED) - .value::ConstPtr>(); + auto input_normals = normals_list.value(0) + ->data(ItemDataRole::CLOUD_TEMPLATED) + .value::ConstPtr>(); QVariant variant = input_item->data(ItemDataRole::CLOUD_TEMPLATED); - typename PointCloud::Ptr input_cloud = - variant.value::Ptr>(); + auto input_cloud = variant.value::Ptr>(); pcl::OrganizedMultiPlaneSegmentation mps; mps.setMinInliers(min_inliers); @@ -121,7 +118,7 @@ pcl::cloud_composer::OrganizedSegmentationTool::performTemplatedAction( auto plane_labels = pcl::make_shared>(); for (std::size_t i = 0; i < label_indices.size(); ++i) - if (label_indices[i].indices.size() > (std::size_t)min_plane_size) + if (label_indices[i].indices.size() > static_cast(min_plane_size)) plane_labels->insert(i); typename PointCloud::CloudVectorType clusters; @@ -143,7 +140,8 @@ pcl::cloud_composer::OrganizedSegmentationTool::performTemplatedAction( pcl::IndicesPtr extracted_indices(new pcl::Indices()); for (std::size_t i = 0; i < euclidean_label_indices.size(); i++) { - if (euclidean_label_indices[i].indices.size() >= (std::size_t)min_cluster_size) { + if (euclidean_label_indices[i].indices.size() >= + static_cast(min_cluster_size)) { typename PointCloud::Ptr cluster(new PointCloud); pcl::copyPointCloud(*input_cloud, euclidean_label_indices[i].indices, *cluster); qDebug() << "Found cluster with size " << cluster->width; @@ -158,7 +156,7 @@ pcl::cloud_composer::OrganizedSegmentationTool::performTemplatedAction( } for (std::size_t i = 0; i < label_indices.size(); i++) { - if (label_indices[i].indices.size() >= (std::size_t)min_plane_size) { + if (label_indices[i].indices.size() >= static_cast(min_plane_size)) { typename PointCloud::Ptr plane(new PointCloud); pcl::copyPointCloud(*input_cloud, label_indices[i].indices, *plane); qDebug() << "Found plane with size " << plane->width; diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/impl/supervoxels.hpp b/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/impl/supervoxels.hpp index 4222f215ec2..b401fd28751 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/impl/supervoxels.hpp +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/impl/supervoxels.hpp @@ -64,15 +64,13 @@ pcl::cloud_composer::SupervoxelsTool::performTemplatedAction( "item! (input list)"; return output; } - typename PointCloud::Ptr input_cloud = - variant.value::Ptr>(); + auto input_cloud = variant.value::Ptr>(); // TODO: Check if Voxelized } foreach (const CloudComposerItem* input_item, input_data) { QVariant variant = input_item->data(ItemDataRole::CLOUD_TEMPLATED); - typename PointCloud::Ptr input_cloud = - variant.value::Ptr>(); + auto input_cloud = variant.value::Ptr>(); float resolution = parameter_model_->getProperty("Resolution").toFloat(); qDebug() << "Octree resolution = " << resolution; diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/normal_estimation.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/normal_estimation.h index cd27fbee0cc..003095341b4 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/normal_estimation.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/normal_estimation.h @@ -99,7 +99,7 @@ class NormalEstimationToolFactory : public QObject, public ToolFactory { inline QList getRequiredInputChildrenTypes() const override { - return QList(); + return {}; } }; diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/sanitize_cloud.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/sanitize_cloud.h index 2a8e33ccc94..bb031c6c19d 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/sanitize_cloud.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/sanitize_cloud.h @@ -99,7 +99,7 @@ class SanitizeCloudToolFactory : public QObject, public ToolFactory { inline QList getRequiredInputChildrenTypes() const override { - return QList(); + return {}; } }; diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/statistical_outlier_removal.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/statistical_outlier_removal.h index 092edb0634f..a27a79dc986 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/statistical_outlier_removal.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/statistical_outlier_removal.h @@ -99,7 +99,7 @@ class StatisticalOutlierRemovalToolFactory : public QObject, public ToolFactory inline QList getRequiredInputChildrenTypes() const override { - return QList(); + return {}; } }; diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/voxel_grid_downsample.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/voxel_grid_downsample.h index 8672be64672..868b532a9d0 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/voxel_grid_downsample.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/voxel_grid_downsample.h @@ -99,7 +99,7 @@ class VoxelGridDownsampleToolFactory : public QObject, public ToolFactory { inline QList getRequiredInputChildrenTypes() const override { - return QList(); + return {}; } }; diff --git a/apps/cloud_composer/src/cloud_view.cpp b/apps/cloud_composer/src/cloud_view.cpp index 465c557a071..cd04e9dd152 100644 --- a/apps/cloud_composer/src/cloud_view.cpp +++ b/apps/cloud_composer/src/cloud_view.cpp @@ -105,7 +105,7 @@ void pcl::cloud_composer::CloudView::itemChanged (QStandardItem* changed_item) { qDebug () << "Item Changed - Redrawing!"; - CloudComposerItem* item = dynamic_cast (changed_item); + auto* item = dynamic_cast (changed_item); if (item) { item->paintView (vis_); @@ -127,7 +127,7 @@ pcl::cloud_composer::CloudView::rowsInserted (const QModelIndex& parent, int sta for (int row = start; row <= end; ++row) { QStandardItem* new_item = parent_item->child(row); - CloudComposerItem* item = dynamic_cast (new_item); + auto* item = dynamic_cast (new_item); if (item) item->paintView (vis_); @@ -155,7 +155,7 @@ pcl::cloud_composer::CloudView::rowsAboutToBeRemoved (const QModelIndex& parent, QStandardItem* item_to_remove = parent_item->child(row); if (item_to_remove) qDebug () << "Removing "<text (); - CloudComposerItem* item = dynamic_cast (item_to_remove); + auto* item = dynamic_cast (item_to_remove); if (item ) item->removeFromView (vis_); diff --git a/apps/cloud_composer/src/cloud_viewer.cpp b/apps/cloud_composer/src/cloud_viewer.cpp index 1479ef25847..430e403f03e 100644 --- a/apps/cloud_composer/src/cloud_viewer.cpp +++ b/apps/cloud_composer/src/cloud_viewer.cpp @@ -13,7 +13,7 @@ pcl::cloud_composer::CloudViewer::CloudViewer(QWidget* parent) : QTabWidget(pare void pcl::cloud_composer::CloudViewer::addModel(ProjectModel* new_model) { - CloudView* new_view = new CloudView(new_model); + auto* new_view = new CloudView(new_model); connect(new_model->getSelectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), new_view, diff --git a/apps/cloud_composer/src/commands.cpp b/apps/cloud_composer/src/commands.cpp index 03ff9c15659..684f707e733 100644 --- a/apps/cloud_composer/src/commands.cpp +++ b/apps/cloud_composer/src/commands.cpp @@ -5,10 +5,7 @@ pcl::cloud_composer::CloudCommand::CloudCommand( QList input_data, QUndoCommand* parent) -: QUndoCommand(parent) -, original_data_(std::move(input_data)) -, can_use_templates_(false) -, template_type_(-1) +: QUndoCommand(parent), original_data_(std::move(input_data)) {} pcl::cloud_composer::CloudCommand::~CloudCommand() @@ -53,7 +50,7 @@ pcl::cloud_composer::CloudCommand::canUseTemplates(ConstItemList& input_data) // Make sure all input items are clouds QList cloud_items; foreach (const CloudComposerItem* item, input_data) { - const CloudItem* cloud_item = dynamic_cast(item); + const auto* cloud_item = dynamic_cast(item); if (cloud_item) cloud_items.append(cloud_item); } @@ -501,7 +498,7 @@ pcl::cloud_composer::MergeCloudCommand::runCommand(AbstractTool* tool) original_data_, static_cast(template_type_)); else output_items = tool->performAction(original_data_); - MergeSelection* merge_selection = dynamic_cast(tool); + auto* merge_selection = dynamic_cast(tool); // If this is a merge selection we need to put the partially selected items into the // original data list too! We didn't send them before because merge selection already // knows about them (and needs to tree input list differently from selected items) diff --git a/apps/cloud_composer/src/items/cloud_composer_item.cpp b/apps/cloud_composer/src/items/cloud_composer_item.cpp index a87d5a2dba3..f5d17b266a5 100644 --- a/apps/cloud_composer/src/items/cloud_composer_item.cpp +++ b/apps/cloud_composer/src/items/cloud_composer_item.cpp @@ -24,7 +24,7 @@ pcl::cloud_composer::CloudComposerItem::~CloudComposerItem() pcl::cloud_composer::CloudComposerItem* pcl::cloud_composer::CloudComposerItem::clone() const { - CloudComposerItem* new_item = new CloudComposerItem(this->text()); + auto* new_item = new CloudComposerItem(this->text()); PropertiesModel* new_item_properties = new_item->getPropertiesModel(); new_item_properties->copyProperties(properties_); @@ -69,7 +69,7 @@ pcl::cloud_composer::CloudComposerItem::removeFromView( QMap pcl::cloud_composer::CloudComposerItem::getInspectorTabs() { - return QMap(); + return {}; } /* diff --git a/apps/cloud_composer/src/items/cloud_item.cpp b/apps/cloud_composer/src/items/cloud_item.cpp index d955fff374a..d090c697bd8 100644 --- a/apps/cloud_composer/src/items/cloud_item.cpp +++ b/apps/cloud_composer/src/items/cloud_item.cpp @@ -13,13 +13,10 @@ pcl::cloud_composer::CloudItem::CloudItem (QString name, const Eigen::Vector4f& origin, const Eigen::Quaternionf& orientation, bool make_templated_cloud) - : CloudComposerItem (std::move(name)) + : CloudComposerItem (name) , cloud_blob_ptr_ (cloud_ptr) , origin_ (origin) , orientation_ (orientation) - , template_cloud_set_ (false) - , point_type_ (PointTypeFlags::NONE) - , is_sanitized_ (false) { //Sanitize the cloud data using passthrough @@ -59,7 +56,7 @@ pcl::cloud_composer::CloudItem::clone () const { pcl::PCLPointCloud2::Ptr cloud_copy (new pcl::PCLPointCloud2 (*cloud_blob_ptr_)); //Vector4f and Quaternionf do deep copies using constructor - CloudItem* new_item = new CloudItem (this->text (), cloud_copy, origin_,orientation_); + auto* new_item = new CloudItem (this->text (), cloud_copy, origin_,orientation_); PropertiesModel* new_item_properties = new_item->getPropertiesModel (); new_item_properties->copyProperties (properties_); diff --git a/apps/cloud_composer/src/items/fpfh_item.cpp b/apps/cloud_composer/src/items/fpfh_item.cpp index 95b8c64c8d2..6fd5efee5fa 100644 --- a/apps/cloud_composer/src/items/fpfh_item.cpp +++ b/apps/cloud_composer/src/items/fpfh_item.cpp @@ -39,7 +39,7 @@ pcl::cloud_composer::FPFHItem::getInspectorTabs() plot_.reset(new pcl::visualization::PCLPlotter); qvtk_ = new PCLQVTKWidget(); hist_page_ = new QWidget(); - QGridLayout* mainLayout = new QGridLayout(hist_page_); + auto* mainLayout = new QGridLayout(hist_page_); mainLayout->addWidget(qvtk_, 0, 0); } diff --git a/apps/cloud_composer/src/items/normals_item.cpp b/apps/cloud_composer/src/items/normals_item.cpp index 02267ad7922..20035444a6d 100644 --- a/apps/cloud_composer/src/items/normals_item.cpp +++ b/apps/cloud_composer/src/items/normals_item.cpp @@ -4,7 +4,7 @@ #include pcl::cloud_composer::NormalsItem::NormalsItem (QString name, const pcl::PointCloud::Ptr& normals_ptr, double radius) - : CloudComposerItem (std::move(name)) + : CloudComposerItem (name) , normals_ptr_ (normals_ptr) { @@ -22,7 +22,7 @@ pcl::cloud_composer::NormalsItem::clone () const { pcl::PointCloud::Ptr normals_copy (new pcl::PointCloud (*normals_ptr_)); //Vector4f and Quaternionf do deep copies using copy constructor - NormalsItem* new_item = new NormalsItem (this->text (), normals_copy, 0); + auto* new_item = new NormalsItem (this->text (), normals_copy, 0); PropertiesModel* new_item_properties = new_item->getPropertiesModel (); new_item_properties->copyProperties (properties_); @@ -37,7 +37,7 @@ pcl::cloud_composer::NormalsItem::paintView (pcl::visualization::PCLVisualizer:: if (parent ()->type () == CLOUD_ITEM) { QVariant cloud_ptr = parent ()->data (ItemDataRole::CLOUD_BLOB); - pcl::PCLPointCloud2::ConstPtr cloud_blob = cloud_ptr.value (); + auto cloud_blob = cloud_ptr.value (); pcl::PointCloud::Ptr cloud (new pcl::PointCloud); pcl::fromPCLPointCloud2 (*cloud_blob, *cloud); double scale = properties_->getProperty ("Scale").toDouble (); diff --git a/apps/cloud_composer/src/merge_selection.cpp b/apps/cloud_composer/src/merge_selection.cpp index 9999d9c67dc..0db12df5ce7 100644 --- a/apps/cloud_composer/src/merge_selection.cpp +++ b/apps/cloud_composer/src/merge_selection.cpp @@ -18,7 +18,7 @@ pcl::cloud_composer::MergeSelection::performAction(ConstItemList input_data, PointTypeFlags::PointType type) { if (type != PointTypeFlags::NONE) { - switch ((std::uint8_t)type) { + switch (static_cast(type)) { case (PointTypeFlags::XYZ): return this->performTemplatedAction(input_data); case (PointTypeFlags::XYZ | PointTypeFlags::RGB): @@ -53,9 +53,8 @@ pcl::cloud_composer::MergeSelection::performAction(ConstItemList input_data, foreach (const CloudItem* input_cloud_item, selected_item_index_map_.keys()) { // If this cloud hasn't been completely selected if (!input_data.contains(input_cloud_item)) { - pcl::PCLPointCloud2::ConstPtr input_cloud = - input_cloud_item->data(ItemDataRole::CLOUD_BLOB) - .value(); + auto input_cloud = input_cloud_item->data(ItemDataRole::CLOUD_BLOB) + .value(); qDebug() << "Extracting " << selected_item_index_map_.value(input_cloud_item)->indices.size() << " points out of " << input_cloud->width; @@ -78,10 +77,10 @@ pcl::cloud_composer::MergeSelection::performAction(ConstItemList input_data, .value(); pose_found = true; } - CloudItem* new_cloud_item = new CloudItem(input_cloud_item->text(), - original_minus_indices, - source_origin, - source_orientation); + auto* new_cloud_item = new CloudItem(input_cloud_item->text(), + original_minus_indices, + source_origin, + source_orientation); output.append(new_cloud_item); pcl::PCLPointCloud2::Ptr temp_cloud = pcl::make_shared(); concatenate(*merged_cloud, *selected_points, *temp_cloud); @@ -92,16 +91,15 @@ pcl::cloud_composer::MergeSelection::performAction(ConstItemList input_data, } // Just concatenate for all fully selected clouds foreach (const CloudComposerItem* input_item, input_data) { - pcl::PCLPointCloud2::ConstPtr input_cloud = - input_item->data(ItemDataRole::CLOUD_BLOB) - .value(); + auto input_cloud = input_item->data(ItemDataRole::CLOUD_BLOB) + .value(); pcl::PCLPointCloud2::Ptr temp_cloud = pcl::make_shared(); concatenate(*merged_cloud, *input_cloud, *temp_cloud); merged_cloud = temp_cloud; } - CloudItem* cloud_item = new CloudItem( + auto* cloud_item = new CloudItem( "Cloud from Selection", merged_cloud, source_origin, source_orientation); output.append(cloud_item); diff --git a/apps/cloud_composer/src/point_selectors/click_trackball_interactor_style.cpp b/apps/cloud_composer/src/point_selectors/click_trackball_interactor_style.cpp index 96971e09ef2..1f6bea5245d 100644 --- a/apps/cloud_composer/src/point_selectors/click_trackball_interactor_style.cpp +++ b/apps/cloud_composer/src/point_selectors/click_trackball_interactor_style.cpp @@ -52,18 +52,16 @@ pcl::cloud_composer::ClickTrackballStyleInteractor::OnLeftButtonUp() selected_actor->GetMatrix(end_matrix_); // Find the id of the actor we manipulated - pcl::visualization::CloudActorMap::const_iterator end = actors_->end(); + auto end = actors_->end(); QString manipulated_id; - for (pcl::visualization::CloudActorMap::const_iterator itr = actors_->begin(); - itr != end; - ++itr) { + for (auto itr = actors_->begin(); itr != end; ++itr) { // qDebug () << "Id = "<first); if ((itr->second).actor == selected_actor) { manipulated_id = (QString::fromStdString(itr->first)); } } if (!manipulated_id.isEmpty()) { - ManipulationEvent* manip_event = new ManipulationEvent(); + auto* manip_event = new ManipulationEvent(); manip_event->addManipulation(manipulated_id, start_matrix_, end_matrix_); this->InvokeEvent(this->manipulation_complete_event_, manip_event); } @@ -85,18 +83,16 @@ pcl::cloud_composer::ClickTrackballStyleInteractor::OnRightButtonUp() selected_actor->GetMatrix(end_matrix_); // Find the id of the actor we manipulated - pcl::visualization::CloudActorMap::const_iterator end = actors_->end(); + auto end = actors_->end(); QString manipulated_id; - for (pcl::visualization::CloudActorMap::const_iterator itr = actors_->begin(); - itr != end; - ++itr) { + for (auto itr = actors_->begin(); itr != end; ++itr) { // qDebug () << "Id = "<first); if ((itr->second).actor == selected_actor) { manipulated_id = (QString::fromStdString(itr->first)); } } if (!manipulated_id.isEmpty()) { - ManipulationEvent* manip_event = new ManipulationEvent(); + auto* manip_event = new ManipulationEvent(); manip_event->addManipulation(manipulated_id, start_matrix_, end_matrix_); this->InvokeEvent(this->manipulation_complete_event_, manip_event); } 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 e1d87ac8ffb..c94a135cab5 100644 --- a/apps/cloud_composer/src/point_selectors/rectangular_frustum_selector.cpp +++ b/apps/cloud_composer/src/point_selectors/rectangular_frustum_selector.cpp @@ -39,7 +39,7 @@ pcl::cloud_composer::RectangularFrustumSelector::OnLeftButtonUp() vtkInteractorStyleRubberBandPick::OnLeftButtonUp(); vtkPlanes* frustum = - static_cast(this->GetInteractor()->GetPicker())->GetFrustum(); + dynamic_cast(this->GetInteractor()->GetPicker())->GetFrustum(); #if VTK_MAJOR_VERSION > 9 || (VTK_MAJOR_VERSION == 9 && VTK_MINOR_VERSION >= 4) vtkSmartPointer id_filter = vtkSmartPointer::New(); @@ -91,11 +91,11 @@ pcl::cloud_composer::RectangularFrustumSelector::OnLeftButtonUp() this->HighlightProp(nullptr); if (all_points->GetNumberOfPoints() > 0) { - SelectionEvent* selected = new SelectionEvent(all_points, - selected_actor, - selected_mapper, - id_selected_data_map, - this->CurrentRenderer); + auto* selected = new SelectionEvent(all_points, + selected_actor, + selected_mapper, + id_selected_data_map, + this->CurrentRenderer); this->InvokeEvent(this->selection_complete_event_, selected); } } diff --git a/apps/cloud_composer/src/point_selectors/selected_trackball_interactor_style.cpp b/apps/cloud_composer/src/point_selectors/selected_trackball_interactor_style.cpp index 16fef7815e7..0732f5969e8 100644 --- a/apps/cloud_composer/src/point_selectors/selected_trackball_interactor_style.cpp +++ b/apps/cloud_composer/src/point_selectors/selected_trackball_interactor_style.cpp @@ -31,7 +31,7 @@ pcl::cloud_composer::SelectedTrackballStyleInteractor::setSelectedActors() QModelIndexList selected_indexes = model_->getSelectionModel()->selectedIndexes(); foreach (QModelIndex index, selected_indexes) { QStandardItem* item = model_->itemFromIndex(index); - CloudItem* cloud_item = dynamic_cast(item); + auto* cloud_item = dynamic_cast(item); if (cloud_item) selected_cloud_ids.append(cloud_item->getId()); } @@ -71,7 +71,7 @@ pcl::cloud_composer::SelectedTrackballStyleInteractor::OnLeftButtonUp() vtkInteractorStyleTrackballActor::OnLeftButtonUp(); foreach (QString id, selected_actors_map_.keys()) { vtkLODActor* actor = selected_actors_map_.value(id); - ManipulationEvent* manip_event = new ManipulationEvent(); + auto* manip_event = new ManipulationEvent(); // Fetch the actor we manipulated vtkSmartPointer end_matrix = vtkSmartPointer::New(); actor->GetMatrix(end_matrix); @@ -86,7 +86,7 @@ pcl::cloud_composer::SelectedTrackballStyleInteractor::OnRightButtonUp() vtkInteractorStyleTrackballActor::OnRightButtonUp(); foreach (QString id, selected_actors_map_.keys()) { vtkLODActor* actor = selected_actors_map_.value(id); - ManipulationEvent* manip_event = new ManipulationEvent(); + auto* manip_event = new ManipulationEvent(); // Fetch the actor we manipulated vtkSmartPointer end_matrix = vtkSmartPointer::New(); actor->GetMatrix(end_matrix); diff --git a/apps/cloud_composer/src/project_model.cpp b/apps/cloud_composer/src/project_model.cpp index 39963959348..d20d96f85db 100644 --- a/apps/cloud_composer/src/project_model.cpp +++ b/apps/cloud_composer/src/project_model.cpp @@ -107,7 +107,7 @@ pcl::cloud_composer::ProjectModel::setPointSelection (const std::shared_ptr project_clouds; for (int i = 0; i < this->rowCount (); ++i) { - CloudItem* cloud_item = dynamic_cast (this->item (i)); + auto* cloud_item = dynamic_cast (this->item (i)); if ( cloud_item ) project_clouds.append ( cloud_item ); } @@ -137,7 +137,7 @@ pcl::cloud_composer::ProjectModel::manipulateClouds (const std::shared_ptr project_clouds; for (int i = 0; i < this->rowCount (); ++i) { - CloudItem* cloud_item = dynamic_cast (this->item (i)); + auto* cloud_item = dynamic_cast (this->item (i)); if ( cloud_item ) project_clouds.append ( cloud_item ); } @@ -146,7 +146,7 @@ pcl::cloud_composer::ProjectModel::manipulateClouds (const std::shared_ptr ids = transform_map.keys (); ConstItemList input_data; - TransformClouds* transform_tool = new TransformClouds (transform_map); + auto* transform_tool = new TransformClouds (transform_map); foreach (CloudItem* cloud_item, project_clouds) { if (ids.contains (cloud_item->getId ())) @@ -208,7 +208,7 @@ pcl::cloud_composer::ProjectModel::insertNewCloudFromFile () } short_filename += tr ("-%1").arg (k); } - CloudItem* new_item = new CloudItem (short_filename, cloud_blob, origin, orientation, true); + auto* new_item = new CloudItem (short_filename, cloud_blob, origin, orientation, true); insertNewCloudComposerItem (new_item, invisibleRootItem()); @@ -301,7 +301,7 @@ pcl::cloud_composer::ProjectModel::insertNewCloudFromRGBandDepth () { PointXYZRGB new_point; // std::uint8_t* p_i = &(cloud_blob->data[y * cloud_blob->row_step + x * cloud_blob->point_step]); - float depth = (float)(*depth_pixel) * scale; + float depth = static_cast(*depth_pixel) * scale; // qDebug () << "Depth = "<(x - centerX)) * depth * fl_const; + new_point.y = (static_cast(centerY - y)) * depth * fl_const; // vtk seems to start at the bottom left image corner new_point.z = depth; } @@ -362,7 +362,7 @@ pcl::cloud_composer::ProjectModel::saveSelectedCloudToFile () } QStandardItem* item = this->itemFromIndex (selected_indexes.value (0)); - CloudItem* cloud_to_save = dynamic_cast (item); + auto* cloud_to_save = dynamic_cast (item); if (!cloud_to_save ) { QMessageBox::warning (qobject_cast(this->parent ()), "Not a Cloud!", "Selected item is not a cloud, not saving!"); @@ -470,7 +470,7 @@ pcl::cloud_composer::ProjectModel::deleteSelectedItems () input_data.append (dynamic_cast (item)); } // qDebug () << "Input for command is "<setInputData (input_data); if (delete_command->runCommand (nullptr)) commandCompleted(delete_command); @@ -525,7 +525,7 @@ pcl::cloud_composer::ProjectModel::createNewCloudFromSelection () QMap selected_const_map; foreach ( CloudItem* item, selected_item_index_map_.keys ()) selected_const_map.insert (item, selected_item_index_map_.value (item)); - MergeSelection* merge_tool = new MergeSelection (selected_const_map); + auto* merge_tool = new MergeSelection (selected_const_map); //We don't call the enqueueToolAction function since that would abort if we only have a green selection //Move the tool object to the work queue thread diff --git a/apps/cloud_composer/src/properties_model.cpp b/apps/cloud_composer/src/properties_model.cpp index b9daf99d721..c5e3fcc5c29 100644 --- a/apps/cloud_composer/src/properties_model.cpp +++ b/apps/cloud_composer/src/properties_model.cpp @@ -58,11 +58,11 @@ pcl::cloud_composer::PropertiesModel::addProperty(const QString& prop_name, } QList new_row; - QStandardItem* new_property = new QStandardItem(prop_name); + auto* new_property = new QStandardItem(prop_name); new_property->setFlags(Qt::ItemIsSelectable); new_row.append(new_property); - QStandardItem* new_value = new QStandardItem(); + auto* new_value = new QStandardItem(); new_value->setFlags(flags); new_value->setData(value, Qt::EditRole); new_row.append(new_value); @@ -73,7 +73,7 @@ pcl::cloud_composer::PropertiesModel::addProperty(const QString& prop_name, void pcl::cloud_composer::PropertiesModel::addCategory(const QString& category_name) { - QStandardItem* new_category = new QStandardItem(category_name); + auto* new_category = new QStandardItem(category_name); appendRow(new_category); } @@ -86,7 +86,7 @@ pcl::cloud_composer::PropertiesModel::getProperty(const QString& prop_name) cons if (items.empty()) { qWarning() << "No property named " << prop_name << " found in " << parent_item_->text(); - return QVariant(); + return {}; } if (items.size() > 1) { qWarning() << "Multiple properties found with name " << prop_name << " in " diff --git a/apps/cloud_composer/src/signal_multiplexer.cpp b/apps/cloud_composer/src/signal_multiplexer.cpp index 16612f078d4..3f9191e93bd 100644 --- a/apps/cloud_composer/src/signal_multiplexer.cpp +++ b/apps/cloud_composer/src/signal_multiplexer.cpp @@ -111,7 +111,7 @@ pcl::cloud_composer::SignalMultiplexer::setCurrentObject(QObject* newObject) for (const auto& connection : connections) connect(connection); - ProjectModel* model = dynamic_cast(newObject); + auto* model = dynamic_cast(newObject); if (model) model->emitAllStateSignals(); diff --git a/apps/cloud_composer/src/tool_interface/abstract_tool.cpp b/apps/cloud_composer/src/tool_interface/abstract_tool.cpp index 21708ef50ca..6cb6632bbf0 100644 --- a/apps/cloud_composer/src/tool_interface/abstract_tool.cpp +++ b/apps/cloud_composer/src/tool_interface/abstract_tool.cpp @@ -17,5 +17,5 @@ pcl::cloud_composer::AbstractTool::performAction(QList PointTypeFlags::PointType) { qDebug() << "AbstractTool::performTemplatedAction"; - return QList(); + return {}; } diff --git a/apps/cloud_composer/src/toolbox_model.cpp b/apps/cloud_composer/src/toolbox_model.cpp index 8e3f70bd33e..3de7028ecdc 100644 --- a/apps/cloud_composer/src/toolbox_model.cpp +++ b/apps/cloud_composer/src/toolbox_model.cpp @@ -10,10 +10,7 @@ pcl::cloud_composer::ToolBoxModel::ToolBoxModel(QTreeView* tool_view, QTreeView* parameter_view_, QObject* parent) -: QStandardItemModel(parent) -, tool_view_(tool_view) -, parameter_view_(parameter_view_) -, project_model_(nullptr) +: QStandardItemModel(parent), tool_view_(tool_view), parameter_view_(parameter_view_) {} pcl::cloud_composer::ToolBoxModel::ToolBoxModel(const ToolBoxModel&) @@ -25,8 +22,7 @@ pcl::cloud_composer::ToolBoxModel::addTool(ToolFactory* tool_factory) { // qDebug () << "Icon name:"<< tool_factory->getIconName (); QIcon new_tool_icon = QIcon(tool_factory->getIconName()); - QStandardItem* new_tool_item = - new QStandardItem(new_tool_icon, tool_factory->getPluginName()); + auto* new_tool_item = new QStandardItem(new_tool_icon, tool_factory->getPluginName()); new_tool_item->setEditable(false); new_tool_item->setData(QVariant::fromValue(tool_factory), FACTORY); @@ -53,7 +49,7 @@ pcl::cloud_composer::ToolBoxModel::addToolGroup(const QString& tool_group_name) { QList matches_name = findItems(tool_group_name); if (matches_name.empty()) { - QStandardItem* new_group_item = new QStandardItem(tool_group_name); + auto* new_group_item = new QStandardItem(tool_group_name); appendRow(new_group_item); new_group_item->setSelectable(false); new_group_item->setEditable(false); @@ -117,8 +113,8 @@ pcl::cloud_composer::ToolBoxModel::toolAction() "Cannot execute action, no tool selected!"); return; } - ToolFactory* tool_factory = (current_index.data(FACTORY)).value(); - PropertiesModel* parameter_model = + auto* tool_factory = (current_index.data(FACTORY)).value(); + auto* parameter_model = (current_index.data(PARAMETER_MODEL)).value(); // AbstractTool* tool = tool_factory->createTool(parameter_model); @@ -166,7 +162,7 @@ pcl::cloud_composer::ToolBoxModel::updateEnabledTools( // Go through tools, removing from enabled list if they fail to pass tests while (enabled_itr.hasNext()) { QStandardItem* tool_item = enabled_itr.next(); - ToolFactory* tool_factory = (tool_item->data(FACTORY)).value(); + auto* tool_factory = (tool_item->data(FACTORY)).value(); CloudComposerItem::ItemType input_type = tool_factory->getInputItemType(); QList required_children_types = tool_factory->getRequiredInputChildrenTypes(); diff --git a/apps/cloud_composer/src/transform_clouds.cpp b/apps/cloud_composer/src/transform_clouds.cpp index cde2459a371..6f47f19b071 100644 --- a/apps/cloud_composer/src/transform_clouds.cpp +++ b/apps/cloud_composer/src/transform_clouds.cpp @@ -13,7 +13,7 @@ pcl::cloud_composer::TransformClouds::performAction(ConstItemList input_data, PointTypeFlags::PointType type) { if (type != PointTypeFlags::NONE) { - switch ((std::uint8_t)type) { + switch (static_cast(type)) { case (PointTypeFlags::XYZ): return this->performTemplatedAction(input_data); case (PointTypeFlags::XYZ | PointTypeFlags::RGB): diff --git a/apps/cloud_composer/src/work_queue.cpp b/apps/cloud_composer/src/work_queue.cpp index b8662619d0b..bf0c6305fa7 100644 --- a/apps/cloud_composer/src/work_queue.cpp +++ b/apps/cloud_composer/src/work_queue.cpp @@ -31,7 +31,7 @@ pcl::cloud_composer::WorkQueue::actionFinished(ActionPair finished_action) void pcl::cloud_composer::WorkQueue::checkQueue() { - if (work_queue_.length() > 0) { + if (!work_queue_.empty()) { ActionPair action_to_execute = work_queue_.dequeue(); if (action_to_execute.command->runCommand(action_to_execute.tool)) { // Success, send the command back to the main thread diff --git a/apps/cloud_composer/tools/euclidean_clustering.cpp b/apps/cloud_composer/tools/euclidean_clustering.cpp index 2413544ec90..5f53011cf01 100644 --- a/apps/cloud_composer/tools/euclidean_clustering.cpp +++ b/apps/cloud_composer/tools/euclidean_clustering.cpp @@ -30,16 +30,15 @@ pcl::cloud_composer::EuclideanClusteringTool::performAction(ConstItemList input_ input_item = input_data.value(0); if (input_item->type() == CloudComposerItem::CLOUD_ITEM) { - const CloudItem* cloud_item = dynamic_cast(input_item); + const auto* cloud_item = dynamic_cast(input_item); if (cloud_item->isSanitized()) { double cluster_tolerance = parameter_model_->getProperty("Cluster Tolerance").toDouble(); int min_cluster_size = parameter_model_->getProperty("Min Cluster Size").toInt(); int max_cluster_size = parameter_model_->getProperty("Max Cluster Size").toInt(); - pcl::PCLPointCloud2::ConstPtr input_cloud = - input_item->data(ItemDataRole::CLOUD_BLOB) - .value(); + auto input_cloud = input_item->data(ItemDataRole::CLOUD_BLOB) + .value(); // Get the cloud in template form pcl::PointCloud::Ptr cloud(new pcl::PointCloud); pcl::fromPCLPointCloud2(*input_cloud, *cloud); @@ -60,9 +59,9 @@ pcl::cloud_composer::EuclideanClusteringTool::performAction(ConstItemList input_ ec.extract(cluster_indices); ////////////////////////////////////////////////////////////////// // Get copies of the original origin and orientation - Eigen::Vector4f source_origin = + auto source_origin = input_item->data(ItemDataRole::ORIGIN).value(); - Eigen::Quaternionf source_orientation = + auto source_orientation = input_item->data(ItemDataRole::ORIENTATION).value(); // Vector to accumulate the extracted indices pcl::IndicesPtr extracted_indices(new pcl::Indices()); @@ -85,7 +84,7 @@ pcl::cloud_composer::EuclideanClusteringTool::performAction(ConstItemList input_ filter.filter(*cloud_filtered); qDebug() << "Cluster has " << cloud_filtered->width << " data points."; - CloudItem* cloud_item = + auto* cloud_item = new CloudItem(input_item->text() + tr("-Clstr %1").arg(cluster_count), cloud_filtered, source_origin, @@ -104,10 +103,10 @@ pcl::cloud_composer::EuclideanClusteringTool::performAction(ConstItemList input_ } qDebug() << "Cloud has " << remainder_cloud->width << " data points after clusters removed."; - CloudItem* cloud_item = new CloudItem(input_item->text() + " unclustered", - remainder_cloud, - source_origin, - source_orientation); + auto* cloud_item = new CloudItem(input_item->text() + " unclustered", + remainder_cloud, + source_origin, + source_orientation); output.push_front(cloud_item); } else @@ -125,7 +124,7 @@ pcl::cloud_composer::PropertiesModel* pcl::cloud_composer::EuclideanClusteringToolFactory::createToolParameterModel( QObject* parent) { - PropertiesModel* parameter_model = new PropertiesModel(parent); + auto* parameter_model = new PropertiesModel(parent); parameter_model->addProperty( "Cluster Tolerance", 0.02, Qt::ItemIsEditable | Qt::ItemIsEnabled); diff --git a/apps/cloud_composer/tools/fpfh_estimation.cpp b/apps/cloud_composer/tools/fpfh_estimation.cpp index 9366754584b..6eac73aeee9 100644 --- a/apps/cloud_composer/tools/fpfh_estimation.cpp +++ b/apps/cloud_composer/tools/fpfh_estimation.cpp @@ -99,7 +99,7 @@ pcl::cloud_composer::PropertiesModel* pcl::cloud_composer::FPFHEstimationToolFactory::createToolParameterModel( QObject* parent) { - PropertiesModel* parameter_model = new PropertiesModel(parent); + auto* parameter_model = new PropertiesModel(parent); parameter_model->addProperty("Radius", 0.03, Qt::ItemIsEditable | Qt::ItemIsEnabled); diff --git a/apps/cloud_composer/tools/normal_estimation.cpp b/apps/cloud_composer/tools/normal_estimation.cpp index ddef0a393ed..b8c963e1da5 100644 --- a/apps/cloud_composer/tools/normal_estimation.cpp +++ b/apps/cloud_composer/tools/normal_estimation.cpp @@ -30,9 +30,8 @@ pcl::cloud_composer::NormalEstimationTool::performAction(ConstItemList input_dat if (input_item->type() == CloudComposerItem::CLOUD_ITEM) { double radius = parameter_model_->getProperty("Radius").toDouble(); qDebug() << "Received Radius = " << radius; - pcl::PCLPointCloud2::ConstPtr input_cloud = - input_item->data(ItemDataRole::CLOUD_BLOB) - .value(); + auto input_cloud = input_item->data(ItemDataRole::CLOUD_BLOB) + .value(); qDebug() << "Got cloud size = " << input_cloud->width; //////////////// THE WORK - COMPUTING NORMALS /////////////////// pcl::PointCloud::Ptr cloud(new pcl::PointCloud); @@ -57,7 +56,7 @@ pcl::cloud_composer::NormalEstimationTool::performAction(ConstItemList input_dat // Compute the features ne.compute(*cloud_normals); ////////////////////////////////////////////////////////////////// - NormalsItem* normals_item = + auto* normals_item = new NormalsItem(tr("Normals r=%1").arg(radius), cloud_normals, radius); output.append(normals_item); qDebug() << "Calced normals"; @@ -74,7 +73,7 @@ pcl::cloud_composer::PropertiesModel* pcl::cloud_composer::NormalEstimationToolFactory::createToolParameterModel( QObject* parent) { - PropertiesModel* parameter_model = new PropertiesModel(parent); + auto* parameter_model = new PropertiesModel(parent); parameter_model->addProperty("Radius", 0.04, Qt::ItemIsEditable | Qt::ItemIsEnabled); diff --git a/apps/cloud_composer/tools/organized_segmentation.cpp b/apps/cloud_composer/tools/organized_segmentation.cpp index 73679e871d3..587e127a52a 100644 --- a/apps/cloud_composer/tools/organized_segmentation.cpp +++ b/apps/cloud_composer/tools/organized_segmentation.cpp @@ -18,7 +18,7 @@ pcl::cloud_composer::OrganizedSegmentationTool::performAction( ConstItemList input_data, PointTypeFlags::PointType type) { if (type != PointTypeFlags::NONE) { - switch ((std::uint8_t)type) { + switch (static_cast(type)) { case (PointTypeFlags::XYZ): return this->performTemplatedAction(input_data); case (PointTypeFlags::XYZ | PointTypeFlags::RGB): @@ -40,7 +40,7 @@ pcl::cloud_composer::PropertiesModel* pcl::cloud_composer::OrganizedSegmentationToolFactory::createToolParameterModel( QObject* parent) { - PropertiesModel* parameter_model = new PropertiesModel(parent); + auto* parameter_model = new PropertiesModel(parent); parameter_model->addProperty( "Min Inliers", 1000, Qt::ItemIsEditable | Qt::ItemIsEnabled); diff --git a/apps/cloud_composer/tools/sanitize_cloud.cpp b/apps/cloud_composer/tools/sanitize_cloud.cpp index 90d371954cd..ee34930c21e 100644 --- a/apps/cloud_composer/tools/sanitize_cloud.cpp +++ b/apps/cloud_composer/tools/sanitize_cloud.cpp @@ -24,9 +24,8 @@ pcl::cloud_composer::SanitizeCloudTool::performAction(ConstItemList input_data, input_item = input_data.value(0); if (input_item->type() == CloudComposerItem::CLOUD_ITEM) { - pcl::PCLPointCloud2::ConstPtr input_cloud = - input_item->data(ItemDataRole::CLOUD_BLOB) - .value(); + auto input_cloud = input_item->data(ItemDataRole::CLOUD_BLOB) + .value(); bool keep_organized = parameter_model_->getProperty("Keep Organized").toBool(); @@ -43,15 +42,15 @@ pcl::cloud_composer::SanitizeCloudTool::performAction(ConstItemList input_data, ////////////////////////////////////////////////////////////////// // Get copies of the original origin and orientation - Eigen::Vector4f source_origin = + auto source_origin = input_item->data(ItemDataRole::ORIGIN).value(); - Eigen::Quaternionf source_orientation = + auto source_orientation = input_item->data(ItemDataRole::ORIENTATION).value(); // Put the modified cloud into an item, stick in output - CloudItem* cloud_item = new CloudItem(input_item->text() + tr(" sanitized"), - cloud_filtered, - source_origin, - source_orientation); + auto* cloud_item = new CloudItem(input_item->text() + tr(" sanitized"), + cloud_filtered, + source_origin, + source_orientation); output.append(cloud_item); } @@ -66,7 +65,7 @@ pcl::cloud_composer::SanitizeCloudTool::performAction(ConstItemList input_data, pcl::cloud_composer::PropertiesModel* pcl::cloud_composer::SanitizeCloudToolFactory::createToolParameterModel(QObject* parent) { - PropertiesModel* parameter_model = new PropertiesModel(parent); + auto* parameter_model = new PropertiesModel(parent); parameter_model->addProperty( "Keep Organized", false, Qt::ItemIsEditable | Qt::ItemIsEnabled); diff --git a/apps/cloud_composer/tools/statistical_outlier_removal.cpp b/apps/cloud_composer/tools/statistical_outlier_removal.cpp index d67426016a9..fd064e9e5d5 100644 --- a/apps/cloud_composer/tools/statistical_outlier_removal.cpp +++ b/apps/cloud_composer/tools/statistical_outlier_removal.cpp @@ -32,9 +32,8 @@ pcl::cloud_composer::StatisticalOutlierRemovalTool::performAction( } if (input_item->type() == CloudComposerItem::CLOUD_ITEM) { - pcl::PCLPointCloud2::ConstPtr input_cloud = - input_item->data(ItemDataRole::CLOUD_BLOB) - .value(); + auto input_cloud = input_item->data(ItemDataRole::CLOUD_BLOB) + .value(); int mean_k = parameter_model_->getProperty("Mean K").toInt(); double std_dev_thresh = parameter_model_->getProperty("Std Dev Thresh").toDouble(); @@ -53,15 +52,15 @@ pcl::cloud_composer::StatisticalOutlierRemovalTool::performAction( ////////////////////////////////////////////////////////////////// // Get copies of the original origin and orientation - Eigen::Vector4f source_origin = + auto source_origin = input_item->data(ItemDataRole::ORIGIN).value(); - Eigen::Quaternionf source_orientation = + auto source_orientation = input_item->data(ItemDataRole::ORIENTATION).value(); // Put the modified cloud into an item, stick in output - CloudItem* cloud_item = new CloudItem(input_item->text() + tr(" sor filtered"), - cloud_filtered, - source_origin, - source_orientation); + auto* cloud_item = new CloudItem(input_item->text() + tr(" sor filtered"), + cloud_filtered, + source_origin, + source_orientation); output.append(cloud_item); } @@ -77,7 +76,7 @@ pcl::cloud_composer::PropertiesModel* pcl::cloud_composer::StatisticalOutlierRemovalToolFactory::createToolParameterModel( QObject* parent) { - PropertiesModel* parameter_model = new PropertiesModel(parent); + auto* parameter_model = new PropertiesModel(parent); parameter_model->addProperty("Mean K", 50, Qt::ItemIsEditable | Qt::ItemIsEnabled); parameter_model->addProperty( diff --git a/apps/cloud_composer/tools/supervoxels.cpp b/apps/cloud_composer/tools/supervoxels.cpp index 853a32e2555..10ea5ba46fe 100644 --- a/apps/cloud_composer/tools/supervoxels.cpp +++ b/apps/cloud_composer/tools/supervoxels.cpp @@ -18,7 +18,7 @@ pcl::cloud_composer::SupervoxelsTool::performAction(ConstItemList input_data, PointTypeFlags::PointType type) { if (type != PointTypeFlags::NONE) { - switch ((std::uint8_t)type) { + switch (static_cast(type)) { case (PointTypeFlags::XYZ | PointTypeFlags::RGB): return this->performTemplatedAction(input_data); case (PointTypeFlags::XYZ | PointTypeFlags::RGBA): @@ -44,7 +44,7 @@ pcl::cloud_composer::SupervoxelsTool::performTemplatedAction( pcl::cloud_composer::PropertiesModel* pcl::cloud_composer::SupervoxelsToolFactory::createToolParameterModel(QObject* parent) { - PropertiesModel* parameter_model = new PropertiesModel(parent); + auto* parameter_model = new PropertiesModel(parent); parameter_model->addProperty( "Resolution", 0.008, Qt::ItemIsEditable | Qt::ItemIsEnabled); diff --git a/apps/cloud_composer/tools/voxel_grid_downsample.cpp b/apps/cloud_composer/tools/voxel_grid_downsample.cpp index 3590c273d32..790fff9ce8b 100644 --- a/apps/cloud_composer/tools/voxel_grid_downsample.cpp +++ b/apps/cloud_composer/tools/voxel_grid_downsample.cpp @@ -31,15 +31,16 @@ pcl::cloud_composer::VoxelGridDownsampleTool::performAction(ConstItemList input_ double leaf_y = parameter_model_->getProperty("Leaf Size y").toDouble(); double leaf_z = parameter_model_->getProperty("Leaf Size z").toDouble(); - pcl::PCLPointCloud2::ConstPtr input_cloud = - input_item->data(ItemDataRole::CLOUD_BLOB) - .value(); + auto input_cloud = input_item->data(ItemDataRole::CLOUD_BLOB) + .value(); //////////////// THE WORK - FILTERING OUTLIERS /////////////////// // Create the filtering object pcl::VoxelGrid vox_grid; vox_grid.setInputCloud(input_cloud); - vox_grid.setLeafSize(float(leaf_x), float(leaf_y), float(leaf_z)); + vox_grid.setLeafSize(static_cast(leaf_x), + static_cast(leaf_y), + static_cast(leaf_z)); // Create output cloud pcl::PCLPointCloud2::Ptr cloud_filtered(new pcl::PCLPointCloud2); @@ -48,15 +49,15 @@ pcl::cloud_composer::VoxelGridDownsampleTool::performAction(ConstItemList input_ ////////////////////////////////////////////////////////////////// // Get copies of the original origin and orientation - Eigen::Vector4f source_origin = + auto source_origin = input_item->data(ItemDataRole::ORIGIN).value(); - Eigen::Quaternionf source_orientation = + auto source_orientation = input_item->data(ItemDataRole::ORIENTATION).value(); // Put the modified cloud into an item, stick in output - CloudItem* cloud_item = new CloudItem(input_item->text() + tr(" vox ds"), - cloud_filtered, - source_origin, - source_orientation); + auto* cloud_item = new CloudItem(input_item->text() + tr(" vox ds"), + cloud_filtered, + source_origin, + source_orientation); output.append(cloud_item); } @@ -72,7 +73,7 @@ pcl::cloud_composer::PropertiesModel* pcl::cloud_composer::VoxelGridDownsampleToolFactory::createToolParameterModel( QObject* parent) { - PropertiesModel* parameter_model = new PropertiesModel(parent); + auto* parameter_model = new PropertiesModel(parent); parameter_model->addProperty( "Leaf Size x", 0.01, Qt::ItemIsEditable | Qt::ItemIsEnabled); diff --git a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/icp.h b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/icp.h index 7496c578f0a..f7748dadf7e 100644 --- a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/icp.h +++ b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/icp.h @@ -224,16 +224,16 @@ class PCL_EXPORTS ICP { KdTreePtr kd_tree_; // Convergence - float epsilon_; // in cm^2 + float epsilon_{10e-6f}; // in cm^2 // Registration failure - unsigned int max_iterations_; - float min_overlap_; // [0 1] - float max_fitness_; // in cm^2 + unsigned int max_iterations_{50}; + float min_overlap_{.75f}; // [0 1] + float max_fitness_{.1f}; // in cm^2 // Correspondence rejection - float factor_; - float max_angle_; // in degrees + float factor_{9.f}; + float max_angle_{45.f}; // in degrees }; } // End namespace ihs } // End namespace pcl diff --git a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/impl/common_types.hpp b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/impl/common_types.hpp index 17900bf5347..650441f3335 100644 --- a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/impl/common_types.hpp +++ b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/impl/common_types.hpp @@ -78,7 +78,7 @@ struct PointIHS : public pcl::ihs::_PointIHS { this->directions = 0; } - inline PointIHS(const PointIHS& other) + inline PointIHS(const PointIHS& other) : _PointIHS(other) { this->x = other.x; this->y = other.y; diff --git a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/in_hand_scanner.h b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/in_hand_scanner.h index b3d2abcf9e3..34c1e4b84aa 100644 --- a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/in_hand_scanner.h +++ b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/in_hand_scanner.h @@ -272,16 +272,16 @@ public Q_SLOTS: VisualizationFPS visualization_fps_; /** \brief Switch between different branches of the scanning pipeline. */ - RunningMode running_mode_; + RunningMode running_mode_{RM_UNPROCESSED}; /** \brief The iteration of the scanning pipeline (grab - register - integrate). */ - unsigned int iteration_; + unsigned int iteration_{0}; /** \brief Used to get new data from the sensor. */ GrabberPtr grabber_; /** \brief This variable is true if the grabber is starting. */ - bool starting_grabber_; + bool starting_grabber_{false}; /** \brief Connection of the grabber signal with the data processing thread. */ boost::signals2::connection new_data_connection_; @@ -305,7 +305,7 @@ public Q_SLOTS: MeshPtr mesh_model_; /** \brief Prevent the application to crash while closing. */ - bool destructor_called_; + bool destructor_called_{false}; public: PCL_MAKE_ALIGNED_OPERATOR_NEW diff --git a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/input_data_processing.h b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/input_data_processing.h index 6c238fde75b..dcb8c3e06e3 100644 --- a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/input_data_processing.h +++ b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/input_data_processing.h @@ -350,25 +350,25 @@ class PCL_EXPORTS InputDataProcessing { NormalEstimationPtr normal_estimation_; - float x_min_; - float x_max_; - float y_min_; - float y_max_; - float z_min_; - float z_max_; + float x_min_{-15.f}; + float x_max_{15.f}; + float y_min_{-15.f}; + float y_max_{15.f}; + float z_min_{48.f}; + float z_max_{70.f}; - float h_min_; - float h_max_; - float s_min_; - float s_max_; - float v_min_; - float v_max_; + float h_min_{210.f}; + float h_max_{270.f}; + float s_min_{0.2f}; + float s_max_{1.f}; + float v_min_{0.2f}; + float v_max_{1.f}; - bool hsv_inverted_; - bool hsv_enabled_; + bool hsv_inverted_{false}; + bool hsv_enabled_{true}; - unsigned int size_dilate_; - unsigned int size_erode_; + unsigned int size_dilate_{3}; + unsigned int size_erode_{3}; }; } // End namespace ihs } // End namespace pcl diff --git a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/integration.h b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/integration.h index 4c7b37e6dbb..ce67a66bd61 100644 --- a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/integration.h +++ b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/integration.h @@ -229,25 +229,25 @@ class PCL_EXPORTS Integration { KdTreePtr kd_tree_; /** \brief Maximum squared distance below which points are averaged out. */ - float max_squared_distance_; + float max_squared_distance_{0.04f}; /** \brief Maximum angle between normals below which points are averaged out. In * degrees. */ - float max_angle_; + float max_angle_{45.f}; /** \brief Minimum weight above which points are added. */ - float min_weight_; + float min_weight_{.3f}; /** \brief Once a point reaches the maximum age it is decided if the point is removed * or kept in the mesh. */ - unsigned int max_age_; + unsigned int max_age_{30}; /** \brief A point is removed if it has not been observed from a minimum number of * directions. */ - unsigned int min_directions_; + unsigned int min_directions_{5}; }; } // End namespace ihs } // End namespace pcl diff --git a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/offline_integration.h b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/offline_integration.h index ed5b3490467..39136570d96 100644 --- a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/offline_integration.h +++ b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/offline_integration.h @@ -213,7 +213,7 @@ private Q_SLOTS: IntegrationPtr integration_; /** \brief Prevent the application to crash while closing. */ - bool destructor_called_; + bool destructor_called_{false}; public: PCL_MAKE_ALIGNED_OPERATOR_NEW diff --git a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/opengl_viewer.h b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/opengl_viewer.h index 4ce4e7ca95a..2c72cbdd025 100644 --- a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/opengl_viewer.h +++ b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/opengl_viewer.h @@ -302,7 +302,7 @@ public Q_SLOTS: /** \brief Please have a look at the documentation of calcFPS. */ class FPS { public: - FPS() : fps_(0.) {} + FPS() = default; inline double& value() @@ -327,7 +327,7 @@ public Q_SLOTS: ~FPS() = default; private: - double fps_; + double fps_{0.}; }; /** Measures the performance of the current thread (selected by passing the @@ -431,25 +431,25 @@ public Q_SLOTS: Colormap colormap_; /** \brief The visibility confidence is normalized with this value. */ - float vis_conf_norm_; + float vis_conf_norm_{1}; /** \brief Meshes stored for visualization. */ FaceVertexMeshMap drawn_meshes_; /** \brief How to draw the mesh. */ - MeshRepresentation mesh_representation_; + MeshRepresentation mesh_representation_{MR_POINTS}; /** \brief How to color the shapes. */ - Coloring coloring_; + Coloring coloring_{COL_RGB}; /** \brief A box is drawn if this value is true. */ - bool draw_box_; + bool draw_box_{false}; /** \brief Coefficients of the drawn box. */ BoxCoefficients box_coefficients_; /** \brief Scaling factor to convert from meters to the unit of the drawn files. */ - double scaling_factor_; + double scaling_factor_{1.}; /** \brief Rotation of the camera. */ Eigen::Quaterniond R_cam_; @@ -465,13 +465,13 @@ public Q_SLOTS: /** \brief Set to true right after the mouse got pressed and false if the mouse got * moved. */ - bool mouse_pressed_begin_; + bool mouse_pressed_begin_{false}; /** \brief Mouse x-position of the previous mouse move event. */ - int x_prev_; + int x_prev_{0}; /** \brief Mouse y-position of the previous mouse move event. */ - int y_prev_; + int y_prev_{0}; public: PCL_MAKE_ALIGNED_OPERATOR_NEW diff --git a/apps/in_hand_scanner/src/icp.cpp b/apps/in_hand_scanner/src/icp.cpp index cbd16668eaa..373f25a3f41 100644 --- a/apps/in_hand_scanner/src/icp.cpp +++ b/apps/in_hand_scanner/src/icp.cpp @@ -51,19 +51,7 @@ //////////////////////////////////////////////////////////////////////////////// -pcl::ihs::ICP::ICP() -: kd_tree_(new pcl::KdTreeFLANN()) -, - -epsilon_(10e-6f) -, max_iterations_(50) -, min_overlap_(.75f) -, max_fitness_(.1f) -, - -factor_(9.f) -, max_angle_(45.f) -{} +pcl::ihs::ICP::ICP() : kd_tree_(new pcl::KdTreeFLANN()) {} //////////////////////////////////////////////////////////////////////////////// @@ -232,8 +220,7 @@ pcl::ihs::ICP::findTransformation(const MeshConstPtr& mesh_model, cloud_model_corr.clear(); cloud_data_corr.clear(); sw.reset(); - for (CloudNormal::const_iterator it_d = cloud_data_selected->begin(); - it_d != cloud_data_selected->end(); + for (auto it_d = cloud_data_selected->begin(); it_d != cloud_data_selected->end(); ++it_d) { // Transform the data point pt_d = *it_d; @@ -248,7 +235,7 @@ pcl::ihs::ICP::findTransformation(const MeshConstPtr& mesh_model, // Check the distance threshold if (squared_distance[0] < squared_distance_threshold) { - if ((std::size_t)index[0] >= cloud_model_selected->size()) { + if (static_cast(index[0]) >= cloud_model_selected->size()) { std::cerr << "ERROR in icp.cpp: Segfault!\n"; std::cerr << " Trying to access index " << index[0] << " >= " << cloud_model_selected->size() << std::endl; @@ -462,8 +449,8 @@ pcl::ihs::ICP::minimizePointPlane(const CloudNormal& cloud_source, xyz_t.reserve(n); nor_t.reserve(n); - CloudNormal::const_iterator it_s = cloud_source.begin(); - CloudNormal::const_iterator it_t = cloud_target.begin(); + auto it_s = cloud_source.begin(); + auto it_t = cloud_target.begin(); float accum = 0.f; Eigen::Vector4f pt_s, pt_t; @@ -474,7 +461,7 @@ pcl::ihs::ICP::minimizePointPlane(const CloudNormal& cloud_source, xyz_s.push_back(pt_s); xyz_t.push_back(pt_t); - nor_t.push_back(it_t->getNormalVector4fMap()); + nor_t.emplace_back(it_t->getNormalVector4fMap()); // Calculate the radius (L2 norm) of the bounding sphere through both shapes and // accumulate the average @@ -502,9 +489,9 @@ pcl::ihs::ICP::minimizePointPlane(const CloudNormal& cloud_source, Eigen::Vector4f b_t = Eigen::Vector4f::Zero(); // top Eigen::Vector4f b_b = Eigen::Vector4f::Zero(); // bottom - Vec4Xf::const_iterator it_xyz_s = xyz_s.begin(); - Vec4Xf::const_iterator it_xyz_t = xyz_t.begin(); - Vec4Xf::const_iterator it_nor_t = nor_t.begin(); + auto it_xyz_s = xyz_s.begin(); + auto it_xyz_t = xyz_t.begin(); + auto it_nor_t = nor_t.begin(); Eigen::Vector4f cross; for (; it_xyz_s != xyz_s.end(); ++it_xyz_s, ++it_xyz_t, ++it_nor_t) { diff --git a/apps/in_hand_scanner/src/in_hand_scanner.cpp b/apps/in_hand_scanner/src/in_hand_scanner.cpp index 95d2744c610..3cfcf040125 100644 --- a/apps/in_hand_scanner/src/in_hand_scanner.cpp +++ b/apps/in_hand_scanner/src/in_hand_scanner.cpp @@ -62,16 +62,12 @@ pcl::ihs::InHandScanner::InHandScanner(Base* parent) : Base(parent) -, running_mode_(RM_UNPROCESSED) -, iteration_(0) -, starting_grabber_(false) , input_data_processing_(new InputDataProcessing()) , icp_(new ICP()) , transformation_(Eigen::Matrix4f::Identity()) , integration_(new Integration()) , mesh_processing_(new MeshProcessing()) , mesh_model_(new Mesh()) -, destructor_called_(false) { // http://doc.qt.digia.com/qt/qmetatype.html#qRegisterMetaType qRegisterMetaType("RunningMode"); diff --git a/apps/in_hand_scanner/src/input_data_processing.cpp b/apps/in_hand_scanner/src/input_data_processing.cpp index 748d7da5955..94f73dea0b2 100644 --- a/apps/in_hand_scanner/src/input_data_processing.cpp +++ b/apps/in_hand_scanner/src/input_data_processing.cpp @@ -46,22 +46,6 @@ pcl::ihs::InputDataProcessing::InputDataProcessing() : normal_estimation_(new NormalEstimation()) -, x_min_(-15.f) -, x_max_(15.f) -, y_min_(-15.f) -, y_max_(15.f) -, z_min_(48.f) -, z_max_(70.f) -, h_min_(210.f) -, h_max_(270.f) -, s_min_(0.2f) -, s_max_(1.f) -, v_min_(0.2f) -, v_max_(1.f) -, hsv_inverted_(false) -, hsv_enabled_(true) -, size_dilate_(3) -, size_erode_(3) { // Normal estimation normal_estimation_->setNormalEstimationMethod(NormalEstimation::AVERAGE_3D_GRADIENT); @@ -220,8 +204,8 @@ pcl::ihs::InputDataProcessing::calculateNormals(const CloudXYZRGBAConstPtr& clou cloud_out->height = cloud_in->height; cloud_out->is_dense = false; - CloudNormals::const_iterator it_n = cloud_normals->begin(); - CloudXYZRGBNormal::iterator it_out = cloud_out->begin(); + auto it_n = cloud_normals->begin(); + auto it_out = cloud_out->begin(); PointXYZRGBNormal invalid_pt; invalid_pt.x = invalid_pt.y = invalid_pt.z = std::numeric_limits::quiet_NaN(); diff --git a/apps/in_hand_scanner/src/integration.cpp b/apps/in_hand_scanner/src/integration.cpp index 3d7517ac145..fe21546b798 100644 --- a/apps/in_hand_scanner/src/integration.cpp +++ b/apps/in_hand_scanner/src/integration.cpp @@ -49,15 +49,7 @@ //////////////////////////////////////////////////////////////////////////////// -pcl::ihs::Integration::Integration() -: kd_tree_(new pcl::KdTreeFLANN()) -, max_squared_distance_(0.04f) -, // 0.2cm -max_angle_(45.f) -, min_weight_(.3f) -, max_age_(30) -, min_directions_(5) -{} +pcl::ihs::Integration::Integration() : kd_tree_(new pcl::KdTreeFLANN()) {} //////////////////////////////////////////////////////////////////////////////// @@ -506,7 +498,7 @@ pcl::ihs::Integration::addToMesh(const PointIHS& pt_0, // 2 - 1 // | | // 3 - 0 - const unsigned char is_finite = + const auto is_finite = static_cast((1 * !std::isnan(pt_0.x)) | (2 * !std::isnan(pt_1.x)) | (4 * !std::isnan(pt_2.x)) | (8 * !std::isnan(pt_3.x))); diff --git a/apps/in_hand_scanner/src/main_window.cpp b/apps/in_hand_scanner/src/main_window.cpp index d97e9c14bb9..c2d62ce20de 100644 --- a/apps/in_hand_scanner/src/main_window.cpp +++ b/apps/in_hand_scanner/src/main_window.cpp @@ -66,14 +66,14 @@ pcl::ihs::MainWindow::MainWindow(QWidget* parent) { ui_->setupUi(this); - QWidget* spacer = new QWidget(); + auto* spacer = new QWidget(); spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); ui_->toolBar->insertWidget(ui_->actionHelp, spacer); constexpr double max = std::numeric_limits::max(); // In hand scanner - QHBoxLayout* layout = new QHBoxLayout(ui_->placeholder_in_hand_scanner); + auto* layout = new QHBoxLayout(ui_->placeholder_in_hand_scanner); layout->addWidget(ihs_); // ui_->centralWidget->setLayout (layout); diff --git a/apps/in_hand_scanner/src/offline_integration.cpp b/apps/in_hand_scanner/src/offline_integration.cpp index 9de7bee7fb6..8bd9b01853f 100644 --- a/apps/in_hand_scanner/src/offline_integration.cpp +++ b/apps/in_hand_scanner/src/offline_integration.cpp @@ -64,7 +64,6 @@ pcl::ihs::OfflineIntegration::OfflineIntegration(Base* parent) , mesh_model_(new Mesh()) , normal_estimation_(new NormalEstimation()) , integration_(new Integration()) -, destructor_called_(false) { normal_estimation_->setNormalEstimationMethod(NormalEstimation::AVERAGE_3D_GRADIENT); normal_estimation_->setMaxDepthChangeFactor(0.02f); // in meters diff --git a/apps/in_hand_scanner/src/opengl_viewer.cpp b/apps/in_hand_scanner/src/opengl_viewer.cpp index 2002d50276a..b7ac03eb471 100644 --- a/apps/in_hand_scanner/src/opengl_viewer.cpp +++ b/apps/in_hand_scanner/src/opengl_viewer.cpp @@ -105,18 +105,9 @@ pcl::ihs::OpenGLViewer::OpenGLViewer(QWidget* parent) : QOpenGLWidget(parent) , timer_vis_(new QTimer(this)) , colormap_(Colormap::Constant(255)) -, vis_conf_norm_(1) -, mesh_representation_(MR_POINTS) -, coloring_(COL_RGB) -, draw_box_(false) -, scaling_factor_(1.) , R_cam_(1., 0., 0., 0.) , t_cam_(0., 0., 0.) , cam_pivot_(0., 0., 0.) -, cam_pivot_id_("") -, mouse_pressed_begin_(false) -, x_prev_(0) -, y_prev_(0) { // Timer: Defines the update rate for the visualization connect(timer_vis_.get(), SIGNAL(timeout()), this, SLOT(timerCallback())); @@ -660,7 +651,7 @@ pcl::ihs::OpenGLViewer::setVisibilityConfidenceNormalization(const float vis_con QSize pcl::ihs::OpenGLViewer::minimumSizeHint() const { - return (QSize(160, 120)); + return ({160, 120}); } //////////////////////////////////////////////////////////////////////////////// @@ -668,7 +659,7 @@ pcl::ihs::OpenGLViewer::minimumSizeHint() const QSize pcl::ihs::OpenGLViewer::sizeHint() const { - return (QSize(640, 480)); + return ({640, 480}); } //////////////////////////////////////////////////////////////////////////////// @@ -971,7 +962,7 @@ pcl::ihs::OpenGLViewer::drawMeshes() case COL_VISCONF: { for (std::size_t i = 0; i < mesh.vertices.size(); ++i) { const unsigned int n = pcl::ihs::countDirections(mesh.vertices[i].directions); - const unsigned int index = + const auto index = static_cast(static_cast(colormap_.cols()) * static_cast(n) / vis_conf_norm_); @@ -996,7 +987,7 @@ pcl::ihs::OpenGLViewer::drawMeshes() glDrawElements(GL_TRIANGLES, 3 * mesh.triangles.size(), GL_UNSIGNED_INT, - &mesh.triangles[0]); + mesh.triangles.data()); break; } } diff --git a/apps/include/pcl/apps/face_detection/openni_frame_source.h b/apps/include/pcl/apps/face_detection/openni_frame_source.h index 1fe6f4aacfb..b78cbea047b 100644 --- a/apps/include/pcl/apps/face_detection/openni_frame_source.h +++ b/apps/include/pcl/apps/face_detection/openni_frame_source.h @@ -31,9 +31,9 @@ class PCL_EXPORTS OpenNIFrameSource { pcl::OpenNIGrabber grabber_; PointCloudPtr most_recent_frame_; - int frame_counter_; + int frame_counter_{0}; std::mutex mutex_; - bool active_; + bool active_{true}; }; } // namespace OpenNIFrameSource diff --git a/apps/include/pcl/apps/impl/dominant_plane_segmentation.hpp b/apps/include/pcl/apps/impl/dominant_plane_segmentation.hpp index 119c9f3b9d2..51aa9bc50c0 100644 --- a/apps/include/pcl/apps/impl/dominant_plane_segmentation.hpp +++ b/apps/include/pcl/apps/impl/dominant_plane_segmentation.hpp @@ -313,8 +313,8 @@ pcl::apps::DominantPlaneSegmentation::compute_fast( { int wsize = wsize_; - for (int i = 0; i < int(binary_cloud->width); i++) { - for (int j = 0; j < int(binary_cloud->height); j++) { + for (int i = 0; i < static_cast(binary_cloud->width); i++) { + for (int j = 0; j < static_cast(binary_cloud->height); j++) { if (binary_cloud->at(i, j).intensity != 0) { // check neighboring pixels, first left and then top // be aware of margins @@ -473,8 +473,8 @@ pcl::apps::DominantPlaneSegmentation::compute_fast( { std::map::iterator it; - for (int i = 0; i < int(binary_cloud->width); i++) { - for (int j = 0; j < int(binary_cloud->height); j++) { + for (int i = 0; i < static_cast(binary_cloud->width); i++) { + for (int j = 0; j < static_cast(binary_cloud->height); j++) { if (binary_cloud->at(i, j).intensity != 0) { // check if this is a root label... it = connected_labels.find(binary_cloud->at(i, j).intensity); @@ -504,7 +504,7 @@ pcl::apps::DominantPlaneSegmentation::compute_fast( int k = 0; for (const auto& cluster : clusters_map) { - if (int(cluster.second.indices.size()) >= object_cluster_min_size_) { + if (static_cast(cluster.second.indices.size()) >= object_cluster_min_size_) { clusters[k] = CloudPtr(new Cloud()); pcl::copyPointCloud(*input_, cluster.second.indices, *clusters[k]); diff --git a/apps/include/pcl/apps/nn_classification.h b/apps/include/pcl/apps/nn_classification.h index d1dc06dad69..db548dbd9af 100644 --- a/apps/include/pcl/apps/nn_classification.h +++ b/apps/include/pcl/apps/nn_classification.h @@ -284,9 +284,7 @@ class NNClassification { std::make_shared, std::vector>>(); result->first.reserve(classes_.size()); result->second.reserve(classes_.size()); - for (std::vector::const_iterator it = sqr_distances->begin(); - it != sqr_distances->end(); - ++it) + for (auto it = sqr_distances->begin(); it != sqr_distances->end(); ++it) if (*it != std::numeric_limits::max()) { result->first.push_back(classes_[it - sqr_distances->begin()]); result->second.push_back(sqrt(*it)); @@ -322,9 +320,7 @@ class NNClassification { std::make_shared, std::vector>>(); result->first.reserve(classes_.size()); result->second.reserve(classes_.size()); - for (std::vector::const_iterator it = sqr_distances->begin(); - it != sqr_distances->end(); - ++it) + for (auto it = sqr_distances->begin(); it != sqr_distances->end(); ++it) if (*it != std::numeric_limits::max()) { result->first.push_back(classes_[it - sqr_distances->begin()]); // TODO leave it squared, and relate param to sigma... diff --git a/apps/include/pcl/apps/openni_passthrough.h b/apps/include/pcl/apps/openni_passthrough.h index 94087404a8e..afdb52d70cf 100644 --- a/apps/include/pcl/apps/openni_passthrough.h +++ b/apps/include/pcl/apps/openni_passthrough.h @@ -54,7 +54,7 @@ double now = pcl::getTime(); \ ++count; \ if (now - last >= 1.0) { \ - std::cout << "Average framerate(" << _WHAT_ << "): " \ + std::cout << "Average framerate(" << (_WHAT_) << "): " \ << double(count) / double(now - last) << " Hz" << std::endl; \ count = 0; \ last = now; \ diff --git a/apps/include/pcl/apps/organized_segmentation_demo.h b/apps/include/pcl/apps/organized_segmentation_demo.h index 5ba08a44670..5db6fa1abad 100644 --- a/apps/include/pcl/apps/organized_segmentation_demo.h +++ b/apps/include/pcl/apps/organized_segmentation_demo.h @@ -63,7 +63,7 @@ using PointT = pcl::PointXYZRGBA; double now = pcl::getTime(); \ ++count; \ if (now - last >= 1.0) { \ - std::cout << "Average framerate(" << _WHAT_ << "): " \ + std::cout << "Average framerate(" << (_WHAT_) << "): " \ << double(count) / double(now - last) << " Hz" << std::endl; \ count = 0; \ last = now; \ diff --git a/apps/include/pcl/apps/pcd_video_player.h b/apps/include/pcl/apps/pcd_video_player.h index b10c087079a..7d30fd9e266 100644 --- a/apps/include/pcl/apps/pcd_video_player.h +++ b/apps/include/pcl/apps/pcd_video_player.h @@ -61,7 +61,7 @@ double now = pcl::getTime(); \ ++count; \ if (now - last >= 1.0) { \ - std::cout << "Average framerate(" << _WHAT_ << "): " \ + std::cout << "Average framerate(" << (_WHAT_) << "): " \ << double(count) / double(now - last) << " Hz" << std::endl; \ count = 0; \ last = now; \ diff --git a/apps/include/pcl/apps/pcl_viewer_dialog.h b/apps/include/pcl/apps/pcl_viewer_dialog.h index 0a3cff7df22..5388c17b48a 100644 --- a/apps/include/pcl/apps/pcl_viewer_dialog.h +++ b/apps/include/pcl/apps/pcl_viewer_dialog.h @@ -20,7 +20,7 @@ class PCLViewerDialog : public QDialog { pcl::visualization::PCLVisualizer::Ptr vis_; public: - PCLViewerDialog(QWidget* parent = 0); + PCLViewerDialog(QWidget* parent = nullptr); void setPointClouds(CloudT::ConstPtr src_cloud, diff --git a/apps/include/pcl/apps/timer.h b/apps/include/pcl/apps/timer.h index 86e431f344a..d312fbe7ef4 100644 --- a/apps/include/pcl/apps/timer.h +++ b/apps/include/pcl/apps/timer.h @@ -51,7 +51,7 @@ double now = pcl::getTime(); \ ++count; \ if (now - last >= 1.0) { \ - std::cout << "Average framerate(" << _WHAT_ << "): " \ + std::cout << "Average framerate(" << (_WHAT_) << "): " \ << double(count) / double(now - last) << " Hz" << std::endl; \ count = 0; \ last = now; \ diff --git a/apps/modeler/include/pcl/apps/modeler/abstract_worker.h b/apps/modeler/include/pcl/apps/modeler/abstract_worker.h index bd73202d0f0..602335cf8f8 100755 --- a/apps/modeler/include/pcl/apps/modeler/abstract_worker.h +++ b/apps/modeler/include/pcl/apps/modeler/abstract_worker.h @@ -50,7 +50,7 @@ class AbstractWorker : public QObject { public: AbstractWorker(const QList& cloud_mesh_items, QWidget* parent = nullptr); - ~AbstractWorker(); + ~AbstractWorker() override; int exec(); diff --git a/apps/modeler/include/pcl/apps/modeler/channel_actor_item.h b/apps/modeler/include/pcl/apps/modeler/channel_actor_item.h index c82f362f704..e857883cb3c 100755 --- a/apps/modeler/include/pcl/apps/modeler/channel_actor_item.h +++ b/apps/modeler/include/pcl/apps/modeler/channel_actor_item.h @@ -59,7 +59,7 @@ class ChannelActorItem : public QTreeWidgetItem, public AbstractItem { const vtkSmartPointer& render_window, const vtkSmartPointer& actor, const std::string& channel_name); - ~ChannelActorItem(); + ~ChannelActorItem() override; void init(); diff --git a/apps/modeler/include/pcl/apps/modeler/icp_registration_worker.h b/apps/modeler/include/pcl/apps/modeler/icp_registration_worker.h index 3ae287f6a7f..e4f488f2f56 100755 --- a/apps/modeler/include/pcl/apps/modeler/icp_registration_worker.h +++ b/apps/modeler/include/pcl/apps/modeler/icp_registration_worker.h @@ -74,10 +74,10 @@ class ICPRegistrationWorker : public AbstractWorker { double y_min_, y_max_; double z_min_, z_max_; - DoubleParameter* max_correspondence_distance_; - IntParameter* max_iterations_; - DoubleParameter* transformation_epsilon_; - DoubleParameter* euclidean_fitness_epsilon_; + DoubleParameter* max_correspondence_distance_{nullptr}; + IntParameter* max_iterations_{nullptr}; + DoubleParameter* transformation_epsilon_{nullptr}; + DoubleParameter* euclidean_fitness_epsilon_{nullptr}; }; } // namespace modeler diff --git a/apps/modeler/include/pcl/apps/modeler/normal_estimation_worker.h b/apps/modeler/include/pcl/apps/modeler/normal_estimation_worker.h index de9fa97f60c..be3b6452463 100755 --- a/apps/modeler/include/pcl/apps/modeler/normal_estimation_worker.h +++ b/apps/modeler/include/pcl/apps/modeler/normal_estimation_worker.h @@ -47,7 +47,7 @@ class NormalEstimationWorker : public AbstractWorker { public: NormalEstimationWorker(const QList& cloud_mesh_items, QWidget* parent = nullptr); - ~NormalEstimationWorker(); + ~NormalEstimationWorker() override; protected: std::string @@ -70,7 +70,7 @@ class NormalEstimationWorker : public AbstractWorker { double y_min_, y_max_; double z_min_, z_max_; - DoubleParameter* search_radius_; + DoubleParameter* search_radius_{nullptr}; }; } // namespace modeler diff --git a/apps/modeler/include/pcl/apps/modeler/normals_actor_item.h b/apps/modeler/include/pcl/apps/modeler/normals_actor_item.h index e974a9d6cad..b5968892105 100755 --- a/apps/modeler/include/pcl/apps/modeler/normals_actor_item.h +++ b/apps/modeler/include/pcl/apps/modeler/normals_actor_item.h @@ -76,8 +76,8 @@ class NormalsActorItem : public ChannelActorItem { setProperties() override; private: - double level_; - double scale_; + double level_{10}; + double scale_{0.1}; }; } // namespace modeler diff --git a/apps/modeler/include/pcl/apps/modeler/parameter_dialog.h b/apps/modeler/include/pcl/apps/modeler/parameter_dialog.h index 6ebb15549e3..26edc33e94b 100755 --- a/apps/modeler/include/pcl/apps/modeler/parameter_dialog.h +++ b/apps/modeler/include/pcl/apps/modeler/parameter_dialog.h @@ -73,7 +73,7 @@ class ParameterDialog : public QDialog { protected: std::map name_parameter_map_; - ParameterModel* parameter_model_; + ParameterModel* parameter_model_{nullptr}; protected Q_SLOTS: void diff --git a/apps/modeler/include/pcl/apps/modeler/poisson_worker.h b/apps/modeler/include/pcl/apps/modeler/poisson_worker.h index d48d1b9610a..baf46d833bb 100755 --- a/apps/modeler/include/pcl/apps/modeler/poisson_worker.h +++ b/apps/modeler/include/pcl/apps/modeler/poisson_worker.h @@ -48,7 +48,7 @@ class PoissonReconstructionWorker : public AbstractWorker { public: PoissonReconstructionWorker(const QList& cloud_mesh_items, QWidget* parent = nullptr); - ~PoissonReconstructionWorker(); + ~PoissonReconstructionWorker() override; protected: std::string @@ -68,12 +68,12 @@ class PoissonReconstructionWorker : public AbstractWorker { processImpl(CloudMeshItem* cloud_mesh_item) override; private: - IntParameter* depth_; - IntParameter* solver_divide_; - IntParameter* iso_divide_; - IntParameter* degree_; - DoubleParameter* scale_; - DoubleParameter* samples_per_node_; + IntParameter* depth_{nullptr}; + IntParameter* solver_divide_{nullptr}; + IntParameter* iso_divide_{nullptr}; + IntParameter* degree_{nullptr}; + DoubleParameter* scale_{nullptr}; + DoubleParameter* samples_per_node_{nullptr}; }; } // namespace modeler diff --git a/apps/modeler/include/pcl/apps/modeler/render_window_item.h b/apps/modeler/include/pcl/apps/modeler/render_window_item.h index bafdaa66177..35463a6a60a 100755 --- a/apps/modeler/include/pcl/apps/modeler/render_window_item.h +++ b/apps/modeler/include/pcl/apps/modeler/render_window_item.h @@ -52,7 +52,7 @@ class BoolParameter; class RenderWindowItem : public QTreeWidgetItem, public AbstractItem { public: RenderWindowItem(QTreeWidget* parent); - ~RenderWindowItem(); + ~RenderWindowItem() override; inline RenderWindow* getRenderWindow() diff --git a/apps/modeler/include/pcl/apps/modeler/statistical_outlier_removal_worker.h b/apps/modeler/include/pcl/apps/modeler/statistical_outlier_removal_worker.h index 56d272033b7..d45c22781da 100755 --- a/apps/modeler/include/pcl/apps/modeler/statistical_outlier_removal_worker.h +++ b/apps/modeler/include/pcl/apps/modeler/statistical_outlier_removal_worker.h @@ -48,7 +48,7 @@ class StatisticalOutlierRemovalWorker : public AbstractWorker { public: StatisticalOutlierRemovalWorker(const QList& cloud_mesh_items, QWidget* parent = nullptr); - ~StatisticalOutlierRemovalWorker(); + ~StatisticalOutlierRemovalWorker() override; protected: std::string @@ -67,8 +67,8 @@ class StatisticalOutlierRemovalWorker : public AbstractWorker { processImpl(CloudMeshItem* cloud_mesh_item) override; private: - IntParameter* mean_k_; - DoubleParameter* stddev_mul_thresh_; + IntParameter* mean_k_{nullptr}; + DoubleParameter* stddev_mul_thresh_{nullptr}; }; } // namespace modeler diff --git a/apps/modeler/include/pcl/apps/modeler/thread_controller.h b/apps/modeler/include/pcl/apps/modeler/thread_controller.h index df98cbe36f4..efbcae6b2d4 100755 --- a/apps/modeler/include/pcl/apps/modeler/thread_controller.h +++ b/apps/modeler/include/pcl/apps/modeler/thread_controller.h @@ -49,7 +49,7 @@ class ThreadController : public QObject { public: ThreadController(); - ~ThreadController(); + ~ThreadController() override; bool runWorker(AbstractWorker* worker); diff --git a/apps/modeler/include/pcl/apps/modeler/voxel_grid_downsample_worker.h b/apps/modeler/include/pcl/apps/modeler/voxel_grid_downsample_worker.h index c68cbb13e56..f0a9310b5f9 100755 --- a/apps/modeler/include/pcl/apps/modeler/voxel_grid_downsample_worker.h +++ b/apps/modeler/include/pcl/apps/modeler/voxel_grid_downsample_worker.h @@ -47,7 +47,7 @@ class VoxelGridDownampleWorker : public AbstractWorker { public: VoxelGridDownampleWorker(const QList& cloud_mesh_items, QWidget* parent = nullptr); - ~VoxelGridDownampleWorker(); + ~VoxelGridDownampleWorker() override; protected: std::string @@ -70,9 +70,9 @@ class VoxelGridDownampleWorker : public AbstractWorker { double y_min_, y_max_; double z_min_, z_max_; - DoubleParameter* leaf_size_x_; - DoubleParameter* leaf_size_y_; - DoubleParameter* leaf_size_z_; + DoubleParameter* leaf_size_x_{nullptr}; + DoubleParameter* leaf_size_y_{nullptr}; + DoubleParameter* leaf_size_z_{nullptr}; }; } // namespace modeler diff --git a/apps/modeler/src/abstract_item.cpp b/apps/modeler/src/abstract_item.cpp index e3d337f4515..1837725d86e 100755 --- a/apps/modeler/src/abstract_item.cpp +++ b/apps/modeler/src/abstract_item.cpp @@ -39,7 +39,7 @@ #include ////////////////////////////////////////////////////////////////////////////////////////////// -pcl::modeler::AbstractItem::AbstractItem() {} +pcl::modeler::AbstractItem::AbstractItem() = default; ////////////////////////////////////////////////////////////////////////////////////////////// void diff --git a/apps/modeler/src/cloud_mesh.cpp b/apps/modeler/src/cloud_mesh.cpp index 5d350b8047a..215c09952af 100755 --- a/apps/modeler/src/cloud_mesh.cpp +++ b/apps/modeler/src/cloud_mesh.cpp @@ -155,7 +155,7 @@ pcl::modeler::CloudMesh::updateVtkPoints() if (vtk_points_->GetData() == nullptr) vtk_points_->SetData(vtkSmartPointer::New()); - vtkFloatArray* data = dynamic_cast(vtk_points_->GetData()); + auto* data = dynamic_cast(vtk_points_->GetData()); data->SetNumberOfComponents(3); // If the dataset has no invalid values, just copy all of them @@ -225,8 +225,12 @@ pcl::modeler::CloudMesh::transform( rx *= M_PI / 180; ry *= M_PI / 180; rz *= M_PI / 180; - Eigen::Affine3f affine_transform = pcl::getTransformation( - float(tx), float(ty), float(tz), float(rx), float(ry), float(rz)); + Eigen::Affine3f affine_transform = pcl::getTransformation(static_cast(tx), + static_cast(ty), + static_cast(tz), + static_cast(rx), + static_cast(ry), + static_cast(rz)); CloudMesh::PointCloud transform_cloud = mean_cloud; pcl::transformPointCloudWithNormals( mean_cloud, transform_cloud, affine_transform.matrix()); diff --git a/apps/modeler/src/cloud_mesh_item.cpp b/apps/modeler/src/cloud_mesh_item.cpp index 1ac45a5b322..a3802bad375 100755 --- a/apps/modeler/src/cloud_mesh_item.cpp +++ b/apps/modeler/src/cloud_mesh_item.cpp @@ -152,7 +152,7 @@ pcl::modeler::CloudMeshItem::prepareContextMenu(QMenu* menu) const void pcl::modeler::CloudMeshItem::createChannels() { - RenderWindowItem* render_window_item = dynamic_cast(parent()); + auto* render_window_item = dynamic_cast(parent()); vtkRenderWindow* win = getRenderWindowCompat(*(render_window_item->getRenderWindow())); @@ -161,7 +161,7 @@ pcl::modeler::CloudMeshItem::createChannels() addChild(new SurfaceActorItem(this, cloud_mesh_, win)); for (int i = 0, i_end = childCount(); i < i_end; ++i) { - ChannelActorItem* child_item = dynamic_cast(child(i)); + auto* child_item = dynamic_cast(child(i)); child_item->init(); } @@ -177,11 +177,11 @@ pcl::modeler::CloudMeshItem::updateChannels() cloud_mesh_->updateVtkPolygons(); for (int i = 0, i_end = childCount(); i < i_end; ++i) { - ChannelActorItem* child_item = dynamic_cast(child(i)); + auto* child_item = dynamic_cast(child(i)); child_item->update(); } - RenderWindowItem* render_window_item = dynamic_cast(parent()); + auto* render_window_item = dynamic_cast(parent()); render_window_item->getRenderWindow()->updateAxes(); } @@ -236,9 +236,9 @@ pcl::modeler::CloudMeshItem::setProperties() void pcl::modeler::CloudMeshItem::updateRenderWindow() { - RenderWindowItem* render_window_item = dynamic_cast(parent()); + auto* render_window_item = dynamic_cast(parent()); for (int i = 0, i_end = childCount(); i < i_end; ++i) { - ChannelActorItem* child_item = dynamic_cast(child(i)); + auto* child_item = dynamic_cast(child(i)); child_item->switchRenderWindow( getRenderWindowCompat(*render_window_item->getRenderWindow())); } diff --git a/apps/modeler/src/icp_registration_worker.cpp b/apps/modeler/src/icp_registration_worker.cpp index 2210d18cda3..7f353ae1a20 100755 --- a/apps/modeler/src/icp_registration_worker.cpp +++ b/apps/modeler/src/icp_registration_worker.cpp @@ -55,10 +55,6 @@ pcl::modeler::ICPRegistrationWorker::ICPRegistrationWorker( , y_max_(std::numeric_limits::min()) , z_min_(std::numeric_limits::max()) , z_max_(std::numeric_limits::min()) -, max_correspondence_distance_(nullptr) -, max_iterations_(nullptr) -, transformation_epsilon_(nullptr) -, euclidean_fitness_epsilon_(nullptr) {} ////////////////////////////////////////////////////////////////////////////////////////////// @@ -70,14 +66,14 @@ pcl::modeler::ICPRegistrationWorker::initParameters(CloudMeshItem* cloud_mesh_it Eigen::Vector4f min_pt, max_pt; pcl::getMinMax3D(*(cloud_mesh_item->getCloudMesh()->getCloud()), min_pt, max_pt); - x_min_ = std::min(double(min_pt.x()), x_min_); - x_max_ = std::max(double(max_pt.x()), x_max_); + x_min_ = std::min(static_cast(min_pt.x()), x_min_); + x_max_ = std::max(static_cast(max_pt.x()), x_max_); - y_min_ = std::min(double(min_pt.y()), y_min_); - y_max_ = std::max(double(max_pt.y()), y_max_); + y_min_ = std::min(static_cast(min_pt.y()), y_min_); + y_max_ = std::max(static_cast(max_pt.y()), y_max_); - z_min_ = std::min(double(min_pt.z()), z_min_); - z_max_ = std::max(double(max_pt.z()), z_max_); + z_min_ = std::min(static_cast(min_pt.z()), z_min_); + z_max_ = std::max(static_cast(max_pt.z()), z_max_); } ////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/apps/modeler/src/main_window.cpp b/apps/modeler/src/main_window.cpp index 85381af7313..fc58ca8a2ba 100755 --- a/apps/modeler/src/main_window.cpp +++ b/apps/modeler/src/main_window.cpp @@ -282,7 +282,8 @@ pcl::modeler::MainWindow::updateRecentActions( } recent_items.removeDuplicates(); - int recent_number = std::min(int(MAX_RECENT_NUMBER), recent_items.size()); + int recent_number = + std::min(static_cast(MAX_RECENT_NUMBER), recent_items.size()); for (int i = 0; i < recent_number; ++i) { QString text = tr("%1 %2").arg(i + 1).arg(recent_items[i]); recent_actions[i]->setText(text); diff --git a/apps/modeler/src/normal_estimation_worker.cpp b/apps/modeler/src/normal_estimation_worker.cpp index 08f577858a3..88611909e72 100755 --- a/apps/modeler/src/normal_estimation_worker.cpp +++ b/apps/modeler/src/normal_estimation_worker.cpp @@ -55,7 +55,6 @@ pcl::modeler::NormalEstimationWorker::NormalEstimationWorker( , y_max_(std::numeric_limits::min()) , z_min_(std::numeric_limits::max()) , z_max_(std::numeric_limits::min()) -, search_radius_(nullptr) {} ////////////////////////////////////////////////////////////////////////////////////////////// @@ -71,14 +70,14 @@ pcl::modeler::NormalEstimationWorker::initParameters(CloudMeshItem* cloud_mesh_i Eigen::Vector4f min_pt, max_pt; pcl::getMinMax3D(*(cloud_mesh_item->getCloudMesh()->getCloud()), min_pt, max_pt); - x_min_ = std::min(double(min_pt.x()), x_min_); - x_max_ = std::max(double(max_pt.x()), x_max_); + x_min_ = std::min(static_cast(min_pt.x()), x_min_); + x_max_ = std::max(static_cast(max_pt.x()), x_max_); - y_min_ = std::min(double(min_pt.y()), y_min_); - y_max_ = std::max(double(max_pt.y()), y_max_); + y_min_ = std::min(static_cast(min_pt.y()), y_min_); + y_max_ = std::max(static_cast(max_pt.y()), y_max_); - z_min_ = std::min(double(min_pt.z()), z_min_); - z_max_ = std::max(double(max_pt.z()), z_max_); + z_min_ = std::min(static_cast(min_pt.z()), z_min_); + z_max_ = std::max(static_cast(max_pt.z()), z_max_); } ////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/apps/modeler/src/normals_actor_item.cpp b/apps/modeler/src/normals_actor_item.cpp index a594127dfc2..08d97025d13 100644 --- a/apps/modeler/src/normals_actor_item.cpp +++ b/apps/modeler/src/normals_actor_item.cpp @@ -51,8 +51,6 @@ pcl::modeler::NormalsActorItem::NormalsActorItem( const vtkSmartPointer& render_window) : ChannelActorItem( parent, cloud_mesh, render_window, vtkSmartPointer::New(), "Normals") -, level_(10) -, scale_(0.1) {} ////////////////////////////////////////////////////////////////////////////////////////////// @@ -70,11 +68,11 @@ pcl::modeler::NormalsActorItem::createNormalLines() if (points->GetData() == nullptr) points->SetData(vtkSmartPointer::New()); - vtkFloatArray* data = dynamic_cast(points->GetData()); + auto* data = dynamic_cast(points->GetData()); data->SetNumberOfComponents(3); if (cloud->is_dense) { - vtkIdType nr_normals = static_cast((cloud->size() - 1) / level_ + 1); + auto nr_normals = static_cast((cloud->size() - 1) / level_ + 1); data->SetNumberOfValues(2 * 3 * nr_normals); for (vtkIdType i = 0, j = 0; j < nr_normals; j++, i = static_cast(j * level_)) { @@ -82,9 +80,9 @@ pcl::modeler::NormalsActorItem::createNormalLines() data->SetValue(2 * j * 3 + 0, p.x); data->SetValue(2 * j * 3 + 1, p.y); data->SetValue(2 * j * 3 + 2, p.z); - data->SetValue(2 * j * 3 + 3, float(p.x + p.normal_x * scale_)); - data->SetValue(2 * j * 3 + 4, float(p.y + p.normal_y * scale_)); - data->SetValue(2 * j * 3 + 5, float(p.z + p.normal_z * scale_)); + data->SetValue(2 * j * 3 + 3, static_cast(p.x + p.normal_x * scale_)); + data->SetValue(2 * j * 3 + 4, static_cast(p.y + p.normal_y * scale_)); + data->SetValue(2 * j * 3 + 5, static_cast(p.z + p.normal_z * scale_)); lines->InsertNextCell(2); lines->InsertCellPoint(2 * j); @@ -95,7 +93,7 @@ pcl::modeler::NormalsActorItem::createNormalLines() pcl::IndicesPtr indices(new pcl::Indices()); pcl::removeNaNFromPointCloud(*cloud, *indices); - vtkIdType nr_normals = static_cast((indices->size() - 1) / level_ + 1); + auto nr_normals = static_cast((indices->size() - 1) / level_ + 1); data->SetNumberOfValues(2 * 3 * nr_normals); for (vtkIdType i = 0, j = 0; j < nr_normals; j++, i = static_cast(j * level_)) { @@ -103,9 +101,9 @@ pcl::modeler::NormalsActorItem::createNormalLines() data->SetValue(2 * j * 3 + 0, p.x); data->SetValue(2 * j * 3 + 1, p.y); data->SetValue(2 * j * 3 + 2, p.z); - data->SetValue(2 * j * 3 + 3, float(p.x + p.normal_x * scale_)); - data->SetValue(2 * j * 3 + 4, float(p.y + p.normal_y * scale_)); - data->SetValue(2 * j * 3 + 5, float(p.z + p.normal_z * scale_)); + data->SetValue(2 * j * 3 + 3, static_cast(p.x + p.normal_x * scale_)); + data->SetValue(2 * j * 3 + 4, static_cast(p.y + p.normal_y * scale_)); + data->SetValue(2 * j * 3 + 5, static_cast(p.z + p.normal_z * scale_)); lines->InsertNextCell(2); lines->InsertCellPoint(2 * j); diff --git a/apps/modeler/src/parameter.cpp b/apps/modeler/src/parameter.cpp index c7117d6d570..033fe2575c8 100755 --- a/apps/modeler/src/parameter.cpp +++ b/apps/modeler/src/parameter.cpp @@ -67,7 +67,7 @@ pcl::modeler::IntParameter::valueTip() QWidget* pcl::modeler::IntParameter::createEditor(QWidget* parent) { - QSpinBox* editor = new QSpinBox(parent); + auto* editor = new QSpinBox(parent); editor->setMinimum(low_); editor->setMaximum(high_); editor->setSingleStep(step_); @@ -79,7 +79,7 @@ pcl::modeler::IntParameter::createEditor(QWidget* parent) void pcl::modeler::IntParameter::setEditorData(QWidget* editor) { - QSpinBox* spinBox = static_cast(editor); + auto* spinBox = dynamic_cast(editor); spinBox->setAlignment(Qt::AlignHCenter); int value = int(*this); @@ -90,7 +90,7 @@ pcl::modeler::IntParameter::setEditorData(QWidget* editor) void pcl::modeler::IntParameter::getEditorData(QWidget* editor) { - QSpinBox* spinBox = static_cast(editor); + auto* spinBox = dynamic_cast(editor); int value = spinBox->text().toInt(); current_value_ = value; } @@ -116,7 +116,7 @@ pcl::modeler::BoolParameter::valueTip() QWidget* pcl::modeler::BoolParameter::createEditor(QWidget* parent) { - QCheckBox* editor = new QCheckBox(parent); + auto* editor = new QCheckBox(parent); return editor; } @@ -125,7 +125,7 @@ pcl::modeler::BoolParameter::createEditor(QWidget* parent) void pcl::modeler::BoolParameter::setEditorData(QWidget* editor) { - QCheckBox* checkBox = static_cast(editor); + auto* checkBox = dynamic_cast(editor); bool value = bool(*this); checkBox->setCheckState(value ? (Qt::Checked) : (Qt::Unchecked)); @@ -135,7 +135,7 @@ pcl::modeler::BoolParameter::setEditorData(QWidget* editor) void pcl::modeler::BoolParameter::getEditorData(QWidget* editor) { - QCheckBox* checkBox = static_cast(editor); + auto* checkBox = dynamic_cast(editor); bool value = (checkBox->checkState() == Qt::Checked); current_value_ = value; } @@ -161,7 +161,7 @@ pcl::modeler::DoubleParameter::valueTip() QWidget* pcl::modeler::DoubleParameter::createEditor(QWidget* parent) { - QDoubleSpinBox* editor = new QDoubleSpinBox(parent); + auto* editor = new QDoubleSpinBox(parent); editor->setMinimum(low_); editor->setMaximum(high_); editor->setSingleStep(step_); @@ -174,7 +174,7 @@ pcl::modeler::DoubleParameter::createEditor(QWidget* parent) void pcl::modeler::DoubleParameter::setEditorData(QWidget* editor) { - QDoubleSpinBox* spinBox = static_cast(editor); + auto* spinBox = dynamic_cast(editor); spinBox->setAlignment(Qt::AlignHCenter); double value = double(*this); @@ -185,7 +185,7 @@ pcl::modeler::DoubleParameter::setEditorData(QWidget* editor) void pcl::modeler::DoubleParameter::getEditorData(QWidget* editor) { - QDoubleSpinBox* spinBox = static_cast(editor); + auto* spinBox = dynamic_cast(editor); double value = spinBox->text().toDouble(); current_value_ = value; } @@ -211,7 +211,7 @@ pcl::modeler::ColorParameter::valueTip() QWidget* pcl::modeler::ColorParameter::createEditor(QWidget* parent) { - QColorDialog* editor = new QColorDialog(parent); + auto* editor = new QColorDialog(parent); return editor; } @@ -220,7 +220,7 @@ pcl::modeler::ColorParameter::createEditor(QWidget* parent) void pcl::modeler::ColorParameter::setEditorData(QWidget* editor) { - QColorDialog* color_dialog = static_cast(editor); + auto* color_dialog = dynamic_cast(editor); QColor value = QColor(*this); color_dialog->setCurrentColor(value); @@ -230,7 +230,7 @@ pcl::modeler::ColorParameter::setEditorData(QWidget* editor) void pcl::modeler::ColorParameter::getEditorData(QWidget* editor) { - QColorDialog* color_dialog = static_cast(editor); + auto* color_dialog = dynamic_cast(editor); QColor value = color_dialog->currentColor(); current_value_ = value; diff --git a/apps/modeler/src/parameter_dialog.cpp b/apps/modeler/src/parameter_dialog.cpp index dfa6c2156c5..73a930bc555 100755 --- a/apps/modeler/src/parameter_dialog.cpp +++ b/apps/modeler/src/parameter_dialog.cpp @@ -62,7 +62,7 @@ pcl::modeler::ParameterDialog::addParameter(pcl::modeler::Parameter* parameter) ////////////////////////////////////////////////////////////////////////////////////////////// pcl::modeler::ParameterDialog::ParameterDialog(const std::string& title, QWidget* parent) -: QDialog(parent), parameter_model_(nullptr) +: QDialog(parent) { setModal(false); setWindowTitle(QString(title.c_str()) + " Parameters"); @@ -72,7 +72,8 @@ pcl::modeler::ParameterDialog::ParameterDialog(const std::string& title, int pcl::modeler::ParameterDialog::exec() { - pcl::modeler::ParameterModel parameterModel(int(name_parameter_map_.size()), 2, this); + pcl::modeler::ParameterModel parameterModel( + static_cast(name_parameter_map_.size()), 2, this); parameter_model_ = ¶meterModel; QStringList headerLabels; @@ -85,10 +86,12 @@ pcl::modeler::ParameterDialog::exec() std::size_t currentRow = 0; for (const auto& name_parameter : name_parameter_map_) { - QModelIndex name = parameterModel.index(int(currentRow), 0, QModelIndex()); + QModelIndex name = + parameterModel.index(static_cast(currentRow), 0, QModelIndex()); parameterModel.setData(name, QVariant(name_parameter.first.c_str())); - QModelIndex value = parameterModel.index(int(currentRow), 1, QModelIndex()); + QModelIndex value = + parameterModel.index(static_cast(currentRow), 1, QModelIndex()); std::pair model_data = name_parameter.second->toModelData(); parameterModel.setData(value, model_data.first, model_data.second); @@ -109,9 +112,9 @@ pcl::modeler::ParameterDialog::exec() tableView.columnWidth(0) + tableView.columnWidth(1) + frameSize().width(); setMinimumWidth(totlen); - QPushButton* pushButtonReset = new QPushButton("Reset", this); - QPushButton* pushButtonApply = new QPushButton("Apply", this); - QPushButton* pushButtonCancel = new QPushButton("Cancel", this); + auto* pushButtonReset = new QPushButton("Reset", this); + auto* pushButtonApply = new QPushButton("Apply", this); + auto* pushButtonCancel = new QPushButton("Cancel", this); connect(pushButtonReset, SIGNAL(clicked()), this, SLOT(reset())); connect(pushButtonApply, SIGNAL(clicked()), this, SLOT(accept())); @@ -137,7 +140,8 @@ pcl::modeler::ParameterDialog::reset() for (auto& name_parameter : name_parameter_map_) { name_parameter.second->reset(); - QModelIndex value = parameter_model_->index(int(currentRow), 1, QModelIndex()); + QModelIndex value = + parameter_model_->index(static_cast(currentRow), 1, QModelIndex()); std::pair model_data = name_parameter.second->toModelData(); parameter_model_->setData(value, model_data.first, model_data.second); @@ -149,10 +153,10 @@ pcl::modeler::ParameterDialog::reset() pcl::modeler::Parameter* pcl::modeler::ParameterDelegate::getCurrentParameter(const QModelIndex& index) const { - std::map::iterator currentParameter = parameter_map_.begin(); + auto currentParameter = parameter_map_.begin(); std::size_t currentRow = 0; - while (currentRow < (std::size_t)index.row() && + while (currentRow < static_cast(index.row()) && currentParameter != parameter_map_.end()) { ++currentParameter; ++currentRow; diff --git a/apps/modeler/src/points_actor_item.cpp b/apps/modeler/src/points_actor_item.cpp index 96711887ba4..141dd6ec08e 100755 --- a/apps/modeler/src/points_actor_item.cpp +++ b/apps/modeler/src/points_actor_item.cpp @@ -83,7 +83,7 @@ pcl::modeler::PointsActorItem::initImpl() actor->SetMapper(mapper); actor->SetNumberOfCloudPoints( - int(std::max(1, poly_data_->GetNumberOfPoints() / 10))); + static_cast(std::max(1, poly_data_->GetNumberOfPoints() / 10))); actor->GetProperty()->SetInterpolationToFlat(); } diff --git a/apps/modeler/src/poisson_worker.cpp b/apps/modeler/src/poisson_worker.cpp index 49b2e750497..7b434fbcc90 100755 --- a/apps/modeler/src/poisson_worker.cpp +++ b/apps/modeler/src/poisson_worker.cpp @@ -46,12 +46,6 @@ pcl::modeler::PoissonReconstructionWorker::PoissonReconstructionWorker( const QList& cloud_mesh_items, QWidget* parent) : AbstractWorker(cloud_mesh_items, parent) -, depth_(nullptr) -, solver_divide_(nullptr) -, iso_divide_(nullptr) -, degree_(nullptr) -, scale_(nullptr) -, samples_per_node_(nullptr) {} ////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/apps/modeler/src/render_window.cpp b/apps/modeler/src/render_window.cpp index b63629b6ba1..888a113081f 100755 --- a/apps/modeler/src/render_window.cpp +++ b/apps/modeler/src/render_window.cpp @@ -65,7 +65,7 @@ pcl::modeler::RenderWindow::RenderWindow(RenderWindowItem* render_window_item, ////////////////////////////////////////////////////////////////////////////////////////////// pcl::modeler::RenderWindow::~RenderWindow() { - DockWidget* dock_widget = dynamic_cast(parent()); + auto* dock_widget = dynamic_cast(parent()); if (dock_widget != nullptr) { MainWindow::getInstance().removeDockWidget(dock_widget); dock_widget->deleteLater(); @@ -112,7 +112,7 @@ pcl::modeler::RenderWindow::focusInEvent(QFocusEvent* event) void pcl::modeler::RenderWindow::setActive(bool flag) { - DockWidget* dock_widget = dynamic_cast(parent()); + auto* dock_widget = dynamic_cast(parent()); if (dock_widget != nullptr) dock_widget->setFocusBasedStyle(flag); } @@ -121,7 +121,7 @@ pcl::modeler::RenderWindow::setActive(bool flag) void pcl::modeler::RenderWindow::setTitle(const QString& title) { - DockWidget* dock_widget = dynamic_cast(parent()); + auto* dock_widget = dynamic_cast(parent()); if (dock_widget != nullptr) dock_widget->setWindowTitle(title); } diff --git a/apps/modeler/src/render_window_item.cpp b/apps/modeler/src/render_window_item.cpp index 0b24410b341..70f8fc3c1b8 100755 --- a/apps/modeler/src/render_window_item.cpp +++ b/apps/modeler/src/render_window_item.cpp @@ -59,7 +59,7 @@ pcl::modeler::RenderWindowItem::~RenderWindowItem() { render_window_->deleteLate bool pcl::modeler::RenderWindowItem::openPointCloud(const QString& filename) { - CloudMeshItem* cloud_mesh_item = new CloudMeshItem(this, filename.toStdString()); + auto* cloud_mesh_item = new CloudMeshItem(this, filename.toStdString()); addChild(cloud_mesh_item); if (!cloud_mesh_item->open()) { @@ -77,7 +77,7 @@ pcl::modeler::RenderWindowItem::openPointCloud(const QString& filename) pcl::modeler::CloudMeshItem* pcl::modeler::RenderWindowItem::addPointCloud(CloudMesh::PointCloudPtr cloud) { - CloudMeshItem* cloud_mesh_item = new CloudMeshItem(this, std::move(cloud)); + auto* cloud_mesh_item = new CloudMeshItem(this, std::move(cloud)); addChild(cloud_mesh_item); treeWidget()->setCurrentItem(cloud_mesh_item); diff --git a/apps/modeler/src/scene_tree.cpp b/apps/modeler/src/scene_tree.cpp index 69919d50418..b5aebfbb7d4 100755 --- a/apps/modeler/src/scene_tree.cpp +++ b/apps/modeler/src/scene_tree.cpp @@ -103,7 +103,7 @@ pcl::modeler::SceneTree::selectedRenderWindowItems() const void pcl::modeler::SceneTree::contextMenuEvent(QContextMenuEvent* event) { - AbstractItem* item = dynamic_cast(currentItem()); + auto* item = dynamic_cast(currentItem()); item->showContextMenu(&(event->globalPos())); } @@ -111,7 +111,7 @@ pcl::modeler::SceneTree::contextMenuEvent(QContextMenuEvent* event) void pcl::modeler::SceneTree::slotOnItemDoubleClicked(QTreeWidgetItem* item) { - AbstractItem* abstract_item = dynamic_cast(item); + auto* abstract_item = dynamic_cast(item); abstract_item->showPropertyEditor(); } @@ -285,7 +285,7 @@ pcl::modeler::SceneTree::slotICPRegistration() AbstractWorker* worker = new ICPRegistrationWorker( result, selected_cloud_mesh_items, &MainWindow::getInstance()); - ThreadController* thread_controller = new ThreadController(); + auto* thread_controller = new ThreadController(); QList selected_render_window_items = selectedRenderWindowItems(); for (auto& selected_render_window_item : selected_render_window_items) { @@ -307,7 +307,7 @@ pcl::modeler::SceneTree::slotVoxelGridDownsampleFilter() QList selected_cloud_mesh_items = selectedTypeItems(); AbstractWorker* worker = new VoxelGridDownampleWorker(selected_cloud_mesh_items, &MainWindow::getInstance()); - ThreadController* thread_controller = new ThreadController(); + auto* thread_controller = new ThreadController(); connect(worker, SIGNAL(dataUpdated(CloudMeshItem*)), thread_controller, @@ -322,7 +322,7 @@ pcl::modeler::SceneTree::slotStatisticalOutlierRemovalFilter() QList selected_cloud_mesh_items = selectedTypeItems(); AbstractWorker* worker = new StatisticalOutlierRemovalWorker( selected_cloud_mesh_items, &MainWindow::getInstance()); - ThreadController* thread_controller = new ThreadController(); + auto* thread_controller = new ThreadController(); connect(worker, SIGNAL(dataUpdated(CloudMeshItem*)), thread_controller, @@ -337,7 +337,7 @@ pcl::modeler::SceneTree::slotEstimateNormal() QList selected_cloud_mesh_items = selectedTypeItems(); AbstractWorker* worker = new NormalEstimationWorker(selected_cloud_mesh_items, &MainWindow::getInstance()); - ThreadController* thread_controller = new ThreadController(); + auto* thread_controller = new ThreadController(); connect(worker, SIGNAL(dataUpdated(CloudMeshItem*)), thread_controller, @@ -352,7 +352,7 @@ pcl::modeler::SceneTree::slotPoissonReconstruction() QList selected_cloud_mesh_items = selectedTypeItems(); AbstractWorker* worker = new PoissonReconstructionWorker(selected_cloud_mesh_items, &MainWindow::getInstance()); - ThreadController* thread_controller = new ThreadController(); + auto* thread_controller = new ThreadController(); connect(worker, SIGNAL(dataUpdated(CloudMeshItem*)), thread_controller, @@ -398,8 +398,7 @@ void pcl::modeler::SceneTree::slotUpdateOnInsertOrRemove() { for (int i = 0, i_end = topLevelItemCount(); i < i_end; ++i) { - RenderWindowItem* render_window_item = - dynamic_cast(topLevelItem(i)); + auto* render_window_item = dynamic_cast(topLevelItem(i)); if (render_window_item == nullptr) continue; diff --git a/apps/modeler/src/statistical_outlier_removal_worker.cpp b/apps/modeler/src/statistical_outlier_removal_worker.cpp index 2d8272427f3..8839edba121 100755 --- a/apps/modeler/src/statistical_outlier_removal_worker.cpp +++ b/apps/modeler/src/statistical_outlier_removal_worker.cpp @@ -45,8 +45,6 @@ pcl::modeler::StatisticalOutlierRemovalWorker::StatisticalOutlierRemovalWorker( const QList& cloud_mesh_items, QWidget* parent) : AbstractWorker(cloud_mesh_items, parent) -, mean_k_(nullptr) -, stddev_mul_thresh_(nullptr) {} ////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/apps/modeler/src/surface_actor_item.cpp b/apps/modeler/src/surface_actor_item.cpp index aa5aa233587..0c4442b5a3a 100755 --- a/apps/modeler/src/surface_actor_item.cpp +++ b/apps/modeler/src/surface_actor_item.cpp @@ -80,7 +80,7 @@ pcl::modeler::SurfaceActorItem::initImpl() actor->SetMapper(mapper); actor->SetNumberOfCloudPoints( - int(std::max(1, poly_data_->GetNumberOfPoints() / 10))); + static_cast(std::max(1, poly_data_->GetNumberOfPoints() / 10))); actor->GetProperty()->SetInterpolationToFlat(); actor->GetProperty()->SetRepresentationToSurface(); diff --git a/apps/modeler/src/thread_controller.cpp b/apps/modeler/src/thread_controller.cpp index 9d391b2df59..88cfbc44054 100755 --- a/apps/modeler/src/thread_controller.cpp +++ b/apps/modeler/src/thread_controller.cpp @@ -43,7 +43,7 @@ #include ////////////////////////////////////////////////////////////////////////////////////////////// -pcl::modeler::ThreadController::ThreadController() {} +pcl::modeler::ThreadController::ThreadController() = default; ////////////////////////////////////////////////////////////////////////////////////////////// pcl::modeler::ThreadController::~ThreadController() @@ -62,7 +62,7 @@ pcl::modeler::ThreadController::runWorker(AbstractWorker* worker) return false; } - QThread* thread = new QThread; + auto* thread = new QThread; connect(this, SIGNAL(prepared()), worker, SLOT(process())); diff --git a/apps/modeler/src/voxel_grid_downsample_worker.cpp b/apps/modeler/src/voxel_grid_downsample_worker.cpp index cf3ea73fb2a..7faf8597570 100755 --- a/apps/modeler/src/voxel_grid_downsample_worker.cpp +++ b/apps/modeler/src/voxel_grid_downsample_worker.cpp @@ -52,9 +52,6 @@ pcl::modeler::VoxelGridDownampleWorker::VoxelGridDownampleWorker( , y_max_(std::numeric_limits::min()) , z_min_(std::numeric_limits::max()) , z_max_(std::numeric_limits::min()) -, leaf_size_x_(nullptr) -, leaf_size_y_(nullptr) -, leaf_size_z_(nullptr) {} ////////////////////////////////////////////////////////////////////////////////////////////// @@ -72,14 +69,14 @@ pcl::modeler::VoxelGridDownampleWorker::initParameters(CloudMeshItem* cloud_mesh Eigen::Vector4f min_pt, max_pt; pcl::getMinMax3D(*(cloud_mesh_item->getCloudMesh()->getCloud()), min_pt, max_pt); - x_min_ = std::min(double(min_pt.x()), x_min_); - x_max_ = std::max(double(max_pt.x()), x_max_); + x_min_ = std::min(static_cast(min_pt.x()), x_min_); + x_max_ = std::max(static_cast(max_pt.x()), x_max_); - y_min_ = std::min(double(min_pt.y()), y_min_); - y_max_ = std::max(double(max_pt.y()), y_max_); + y_min_ = std::min(static_cast(min_pt.y()), y_min_); + y_max_ = std::max(static_cast(max_pt.y()), y_max_); - z_min_ = std::min(double(min_pt.z()), z_min_); - z_max_ = std::max(double(max_pt.z()), z_max_); + z_min_ = std::min(static_cast(min_pt.z()), z_min_); + z_max_ = std::max(static_cast(max_pt.z()), z_max_); } ////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/cloudEditorWidget.h b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/cloudEditorWidget.h index 30ba56ebe04..b800089b654 100644 --- a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/cloudEditorWidget.h +++ b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/cloudEditorWidget.h @@ -268,10 +268,10 @@ public Q_SLOTS: CloudPtr cloud_ptr_; /// The display size, in pixels, of the cloud points - unsigned int point_size_; + unsigned int point_size_{2u}; /// The display size, in pixels, of the selected cloud points - unsigned int selected_point_size_; + unsigned int selected_point_size_{4u}; /// The transformation tool being used. Either a cloud transform tool or /// a selection transform tool is activated at a time. @@ -287,26 +287,26 @@ public Q_SLOTS: CommandQueuePtr command_queue_ptr_; /// The camera field of view - double cam_fov_; + double cam_fov_{60.0}; /// The camera aspect ratio - double cam_aspect_; + double cam_aspect_{1.0}; /// The camera near clipping plane - double cam_near_; + double cam_near_{0.0001}; /// The camera far clipping plane - double cam_far_; + double cam_far_{100.0}; /// @brief Initialize the texture used for rendering the cloud void initTexture(); /// The current scheme used for coloring the whole cloud - ColorScheme color_scheme_; + ColorScheme color_scheme_{COLOR_BY_PURE}; /// A flag indicates whether the cloud is initially colored or not. - bool is_colored_; + bool is_colored_{false}; using KeyMapFunc = std::function; diff --git a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/cloudTransformTool.h b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/cloudTransformTool.h index 33cdad5475a..c3bed348626 100644 --- a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/cloudTransformTool.h +++ b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/cloudTransformTool.h @@ -125,7 +125,7 @@ class CloudTransformTool : public ToolInterface { TrackBall trackball_; /// last recorded mouse positions - int x_, y_; + int x_{0}, y_{0}; /// scaling factor used to control the speed which the display scales the /// point cloud diff --git a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/command.h b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/command.h index 5b7f3af36df..a4fb100b4aa 100644 --- a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/command.h +++ b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/command.h @@ -60,7 +60,7 @@ class Command { /// @brief The default constructor. /// @details Derived commands are assumed to have undo by default. Each /// is free to override this. - Command() : has_undo_(true) {} + Command() = default; /// @brief Returns true if the command has an undo function. inline bool @@ -78,7 +78,7 @@ class Command { undo() = 0; /// @brief a flag indicates whether the command has an undo function. - bool has_undo_; + bool has_undo_{true}; private: /// @brief Copy Constructor - object is non-copyable diff --git a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/denoiseParameterForm.h b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/denoiseParameterForm.h index aa6e9eef1ce..72864b988c8 100644 --- a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/denoiseParameterForm.h +++ b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/denoiseParameterForm.h @@ -103,5 +103,5 @@ private Q_SLOTS: /// The standard deviation multiplier threshold float std_dev_thresh_; /// The flag indicating whether the OK button was pressed - bool ok_; + bool ok_{false}; }; diff --git a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/statistics.h b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/statistics.h index 91d2cf7d7cc..1303a24665a 100644 --- a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/statistics.h +++ b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/statistics.h @@ -66,12 +66,8 @@ class Statistics { Statistics(const Statistics&) { assert(false); } /// @brief Equal Operator - virtual Statistics& - operator=(const Statistics&) - { - assert(false); - return *this; - } + Statistics& + operator=(const Statistics&); /// @brief Returns the statistics in string. virtual std::string diff --git a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/trackball.h b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/trackball.h index 88b861ca759..e06cbc5ca14 100644 --- a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/trackball.h +++ b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/trackball.h @@ -73,7 +73,7 @@ class TrackBall { boost::math::quaternion quat_; /// the original mouse screen coordinates converted to a 3d point - float origin_x_, origin_y_, origin_z_; + float origin_x_{0}, origin_y_{0}, origin_z_{0}; /// the radius of the trackball squared float radius_sqr_; diff --git a/apps/point_cloud_editor/src/cloud.cpp b/apps/point_cloud_editor/src/cloud.cpp index 41f87f87170..1e1aa63bb13 100644 --- a/apps/point_cloud_editor/src/cloud.cpp +++ b/apps/point_cloud_editor/src/cloud.cpp @@ -300,7 +300,7 @@ Cloud::draw (bool disable_highlight) const // draw the selected points glDrawElements(GL_POINTS, selection_ptr->size(), GL_UNSIGNED_INT, - &(partitioned_indices_[0])); + partitioned_indices_.data()); } } glPopMatrix(); diff --git a/apps/point_cloud_editor/src/cloudEditorWidget.cpp b/apps/point_cloud_editor/src/cloudEditorWidget.cpp index e442aada8b4..e3f4d225d51 100644 --- a/apps/point_cloud_editor/src/cloudEditorWidget.cpp +++ b/apps/point_cloud_editor/src/cloudEditorWidget.cpp @@ -73,10 +73,7 @@ #include CloudEditorWidget::CloudEditorWidget (QWidget *parent) - : QOpenGLWidget(parent), - point_size_(2.0f), selected_point_size_(4.0f), - cam_fov_(60.0), cam_aspect_(1.0), cam_near_(0.0001), cam_far_(100.0), - color_scheme_(COLOR_BY_PURE), is_colored_(false) + : QOpenGLWidget(parent) { setFocusPolicy(Qt::StrongFocus); command_queue_ptr_ = CommandQueuePtr(new CommandQueue()); @@ -91,7 +88,7 @@ void CloudEditorWidget::loadFile(const std::string &filename) { std::string ext = filename.substr(filename.find_last_of('.')+1); - FileLoadMap::iterator it = cloud_load_func_map_.find(ext); + auto it = cloud_load_func_map_.find(ext); if (it != cloud_load_func_map_.end()) (it->second)(this, filename); else @@ -328,8 +325,8 @@ CloudEditorWidget::undo () void CloudEditorWidget::increasePointSize () { - ((MainWindow*) parentWidget()) -> increaseSpinBoxValue(); - point_size_ = ((MainWindow*) parentWidget()) -> getSpinBoxValue(); + (dynamic_cast( parentWidget())) -> increaseSpinBoxValue(); + point_size_ = (dynamic_cast( parentWidget())) -> getSpinBoxValue(); if (!cloud_ptr_) return; cloud_ptr_->setPointSize(point_size_); @@ -339,8 +336,8 @@ CloudEditorWidget::increasePointSize () void CloudEditorWidget::decreasePointSize () { - ((MainWindow*) parentWidget()) -> decreaseSpinBoxValue(); - point_size_ = ((MainWindow*) parentWidget()) -> getSpinBoxValue(); + (dynamic_cast( parentWidget())) -> decreaseSpinBoxValue(); + point_size_ = (dynamic_cast( parentWidget())) -> getSpinBoxValue(); if (!cloud_ptr_) return; cloud_ptr_->setPointSize(point_size_); @@ -350,9 +347,9 @@ CloudEditorWidget::decreasePointSize () void CloudEditorWidget::increaseSelectedPointSize () { - ((MainWindow*) parentWidget()) -> increaseSelectedSpinBoxValue(); + (dynamic_cast( parentWidget())) -> increaseSelectedSpinBoxValue(); selected_point_size_ = - ((MainWindow*) parentWidget()) -> getSelectedSpinBoxValue(); + (dynamic_cast( parentWidget())) -> getSelectedSpinBoxValue(); if (!cloud_ptr_) return; cloud_ptr_->setHighlightPointSize(selected_point_size_); @@ -362,9 +359,9 @@ CloudEditorWidget::increaseSelectedPointSize () void CloudEditorWidget::decreaseSelectedPointSize () { - ((MainWindow*) parentWidget()) -> decreaseSelectedSpinBoxValue(); + (dynamic_cast( parentWidget())) -> decreaseSelectedSpinBoxValue(); selected_point_size_ = - ((MainWindow*) parentWidget()) -> getSelectedSpinBoxValue(); + (dynamic_cast( parentWidget())) -> getSelectedSpinBoxValue(); if (!cloud_ptr_) return; cloud_ptr_->setHighlightPointSize(selected_point_size_); @@ -480,7 +477,7 @@ CloudEditorWidget::resizeGL (int width, int height) height = static_cast(height*ratio); glViewport(0, 0, width, height); viewport_ = {0, 0, width, height}; - cam_aspect_ = double(width) / double(height); + cam_aspect_ = static_cast(width) / static_cast(height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(cam_fov_, cam_aspect_, cam_near_, cam_far_); @@ -535,7 +532,7 @@ void CloudEditorWidget::keyPressEvent (QKeyEvent *event) { int key = event->key() + static_cast(event->modifiers()); - std::map::iterator it = key_map_.find(key); + auto it = key_map_.find(key); if (it != key_map_.end()) { (it->second)(this); @@ -620,23 +617,23 @@ CloudEditorWidget::initKeyMap () key_map_[Qt::Key_3] = &CloudEditorWidget::colorByY; key_map_[Qt::Key_4] = &CloudEditorWidget::colorByZ; key_map_[Qt::Key_5] = &CloudEditorWidget::colorByRGB; - key_map_[Qt::Key_C + (int) Qt::ControlModifier] = &CloudEditorWidget::copy; - key_map_[Qt::Key_X + (int) Qt::ControlModifier] = &CloudEditorWidget::cut; - key_map_[Qt::Key_V + (int) Qt::ControlModifier] = &CloudEditorWidget::paste; + key_map_[Qt::Key_C + static_cast(Qt::ControlModifier)] = &CloudEditorWidget::copy; + key_map_[Qt::Key_X + static_cast(Qt::ControlModifier)] = &CloudEditorWidget::cut; + key_map_[Qt::Key_V + static_cast(Qt::ControlModifier)] = &CloudEditorWidget::paste; key_map_[Qt::Key_S] = &CloudEditorWidget::select2D; key_map_[Qt::Key_E] = &CloudEditorWidget::select1D; key_map_[Qt::Key_T] = &CloudEditorWidget::transform; key_map_[Qt::Key_V] = &CloudEditorWidget::view; key_map_[Qt::Key_Delete] = &CloudEditorWidget::remove; - key_map_[Qt::Key_Z + (int) Qt::ControlModifier] = &CloudEditorWidget::undo; + key_map_[Qt::Key_Z + static_cast(Qt::ControlModifier)] = &CloudEditorWidget::undo; key_map_[Qt::Key_Equal] = &CloudEditorWidget::increasePointSize; key_map_[Qt::Key_Plus] = &CloudEditorWidget::increasePointSize; key_map_[Qt::Key_Minus] = &CloudEditorWidget::decreasePointSize; - key_map_[Qt::Key_Equal + (int) Qt::ControlModifier] = + key_map_[Qt::Key_Equal + static_cast(Qt::ControlModifier)] = &CloudEditorWidget::increaseSelectedPointSize; - key_map_[Qt::Key_Plus + (int) Qt::ControlModifier] = + key_map_[Qt::Key_Plus + static_cast(Qt::ControlModifier)] = &CloudEditorWidget::increaseSelectedPointSize; - key_map_[Qt::Key_Minus + (int) Qt::ControlModifier] = + key_map_[Qt::Key_Minus + static_cast(Qt::ControlModifier)] = &CloudEditorWidget::decreaseSelectedPointSize; key_map_[Qt::Key_Escape] = &CloudEditorWidget::cancelSelect; } diff --git a/apps/point_cloud_editor/src/cloudTransformTool.cpp b/apps/point_cloud_editor/src/cloudTransformTool.cpp index 4a875de5e94..5f2ddba1110 100644 --- a/apps/point_cloud_editor/src/cloudTransformTool.cpp +++ b/apps/point_cloud_editor/src/cloudTransformTool.cpp @@ -46,7 +46,7 @@ const float CloudTransformTool::DEFAULT_TRANSLATE_FACTOR_ = 0.001f; CloudTransformTool::CloudTransformTool (CloudPtr cloud_ptr) - : cloud_ptr_(std::move(cloud_ptr)), x_(0), y_(0), scale_factor_(DEFAULT_SCALE_FACTOR_), + : cloud_ptr_(std::move(cloud_ptr)), scale_factor_(DEFAULT_SCALE_FACTOR_), translate_factor_(DEFAULT_TRANSLATE_FACTOR_) { setIdentity(transform_matrix_); @@ -99,15 +99,15 @@ CloudTransformTool::getTranslateMatrix (int dx, int dy, float* matrix) { setIdentity(matrix); float scale = 1.0f / cloud_ptr_-> getScalingFactor(); - matrix[12] = float(dx) * translate_factor_ * scale; - matrix[13] = float(-dy) * translate_factor_ * scale; + matrix[12] = static_cast(dx) * translate_factor_ * scale; + matrix[13] = static_cast(-dy) * translate_factor_ * scale; } void CloudTransformTool::getZTranslateMatrix (int dy, float* matrix) { setIdentity(matrix); - matrix[14] = float(dy) * translate_factor_ / cloud_ptr_-> getScalingFactor(); + matrix[14] = static_cast(dy) * translate_factor_ / cloud_ptr_-> getScalingFactor(); } void diff --git a/apps/point_cloud_editor/src/denoiseParameterForm.cpp b/apps/point_cloud_editor/src/denoiseParameterForm.cpp index 13681dfdf33..5655af5697f 100644 --- a/apps/point_cloud_editor/src/denoiseParameterForm.cpp +++ b/apps/point_cloud_editor/src/denoiseParameterForm.cpp @@ -40,7 +40,7 @@ #include -DenoiseParameterForm::DenoiseParameterForm () : ok_(false) +DenoiseParameterForm::DenoiseParameterForm () { mean_K_line_ = new QLineEdit; std_dev_mul_thresh_line_ = new QLineEdit; diff --git a/apps/point_cloud_editor/src/select1DTool.cpp b/apps/point_cloud_editor/src/select1DTool.cpp index b60d7ee3509..8a02a54b3ab 100644 --- a/apps/point_cloud_editor/src/select1DTool.cpp +++ b/apps/point_cloud_editor/src/select1DTool.cpp @@ -74,7 +74,7 @@ Select1DTool::end (int x, int y, BitMask modifiers, BitMask buttons) GLint viewport[4]; glGetIntegerv(GL_VIEWPORT, viewport); IncIndex inc(1);// start the indexing from 1, since the clear color is 0 - unsigned int *index_arr = new unsigned int[cloud_ptr_->size()]; + auto *index_arr = new unsigned int[cloud_ptr_->size()]; std::generate_n(index_arr, cloud_ptr_->size(), inc); glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT); diff --git a/apps/point_cloud_editor/src/selection.cpp b/apps/point_cloud_editor/src/selection.cpp index ac4aa1032ae..1acace33c32 100644 --- a/apps/point_cloud_editor/src/selection.cpp +++ b/apps/point_cloud_editor/src/selection.cpp @@ -95,7 +95,7 @@ Selection::isSelected (unsigned int index) const { if (index >= cloud_ptr_->size()) return (false); - iterator it = selected_indices_.find(index); + auto it = selected_indices_.find(index); if (it != selected_indices_.end()) return (true); return (false); diff --git a/apps/point_cloud_editor/src/selectionTransformTool.cpp b/apps/point_cloud_editor/src/selectionTransformTool.cpp index 16698d4bc6f..df87cc8dee9 100644 --- a/apps/point_cloud_editor/src/selectionTransformTool.cpp +++ b/apps/point_cloud_editor/src/selectionTransformTool.cpp @@ -91,8 +91,8 @@ SelectionTransformTool::update (int x, int y, BitMask, BitMask buttons) // selection motion is not applied directly (waits for end) // as such we can not update x and y immediately float scale = 1.0f / cloud_ptr_->getScalingFactor(); - cloud_ptr_->setSelectionTranslation ((float) dx * translate_factor_ * scale, - (float) -dy * translate_factor_ * scale, + cloud_ptr_->setSelectionTranslation (static_cast(dx) * translate_factor_ * scale, + static_cast(-dy) * translate_factor_ * scale, 0.0f); return; } @@ -103,7 +103,7 @@ SelectionTransformTool::update (int x, int y, BitMask, BitMask buttons) float scale = 1.0f / cloud_ptr_->getScalingFactor(); cloud_ptr_->setSelectionTranslation (0.0f, 0.0f, - (float) dy * translate_factor_ * scale); + static_cast(dy) * translate_factor_ * scale); return; } float transform[MATRIX_SIZE]; @@ -134,15 +134,15 @@ SelectionTransformTool::end (int x, int y, BitMask modifiers, BitMask buttons) if (modifiers_ & CTRL) { std::shared_ptr c(new TransformCommand(selection_ptr_, - cloud_ptr_, transform_matrix_, (float) dx * translate_factor_ * scale, - (float) -dy * translate_factor_ * scale, 0.0f)); + cloud_ptr_, transform_matrix_, static_cast(dx) * translate_factor_ * scale, + static_cast(-dy) * translate_factor_ * scale, 0.0f)); command_queue_ptr_->execute(c); } else if (modifiers_ & ALT) { std::shared_ptr c(new TransformCommand(selection_ptr_, cloud_ptr_, transform_matrix_, 0.0f, 0.0f, - (float) dy * translate_factor_ * scale)); + static_cast(dy) * translate_factor_ * scale)); command_queue_ptr_->execute(c); } else @@ -193,7 +193,7 @@ SelectionTransformTool::findSelectionCenter () return; float min_xyz[XYZ_SIZE] = {0.0f}; float max_xyz[XYZ_SIZE] = {0.0f}; - Selection::const_iterator it = selection_ptr_->begin(); + auto it = selection_ptr_->begin(); Point3D point_3d = cloud_ptr_->getObjectSpacePoint (*it); float *pt = &(point_3d.data[X]); std::copy(pt, pt + XYZ_SIZE, max_xyz); diff --git a/apps/point_cloud_editor/src/statisticsDialog.cpp b/apps/point_cloud_editor/src/statisticsDialog.cpp index 5d5edfe31ee..2cf6018b0a4 100644 --- a/apps/point_cloud_editor/src/statisticsDialog.cpp +++ b/apps/point_cloud_editor/src/statisticsDialog.cpp @@ -47,7 +47,7 @@ StatisticsDialog::StatisticsDialog(QWidget *) connect(button_box_, SIGNAL(accepted()), this, SLOT(accept())); stat_label_ = new QLabel(tr("")); - QVBoxLayout *main_layout_ = new QVBoxLayout; + auto *main_layout_ = new QVBoxLayout; main_layout_ -> addWidget(stat_label_); main_layout_ -> addWidget(button_box_); setLayout(main_layout_); diff --git a/apps/point_cloud_editor/src/trackball.cpp b/apps/point_cloud_editor/src/trackball.cpp index f95f7b085c8..49ddce00dd0 100644 --- a/apps/point_cloud_editor/src/trackball.cpp +++ b/apps/point_cloud_editor/src/trackball.cpp @@ -42,7 +42,7 @@ #include #include -TrackBall::TrackBall() : quat_(1.0f), origin_x_(0), origin_y_(0), origin_z_(0) +TrackBall::TrackBall() : quat_(1.0f) { radius_sqr_ = (TRACKBALL_RADIUS_SCALE * static_cast(WINDOW_WIDTH)) * (TRACKBALL_RADIUS_SCALE * static_cast(WINDOW_WIDTH)); diff --git a/apps/src/convolve.cpp b/apps/src/convolve.cpp index b236e609677..a20448d7ba4 100644 --- a/apps/src/convolve.cpp +++ b/apps/src/convolve.cpp @@ -73,8 +73,8 @@ main(int argc, char** argv) Eigen::ArrayXf gaussian_kernel(5); gaussian_kernel << 1.f / 16, 1.f / 4, 3.f / 8, 1.f / 4, 1.f / 16; pcl::console::print_info("convolution kernel:"); - for (Eigen::Index i = 0; i < gaussian_kernel.size(); ++i) - pcl::console::print_info(" %f", gaussian_kernel[i]); + for (float i : gaussian_kernel) + pcl::console::print_info(" %f", i); pcl::console::print_info("\n"); if (argc < 3) { diff --git a/apps/src/dinast_grabber_example.cpp b/apps/src/dinast_grabber_example.cpp index 4dc29b317b6..cf9ce4aab96 100644 --- a/apps/src/dinast_grabber_example.cpp +++ b/apps/src/dinast_grabber_example.cpp @@ -61,8 +61,8 @@ class DinastProcessor { static double last = pcl::getTime(); if (++count == 30) { double now = pcl::getTime(); - std::cout << "Average framerate: " << double(count) / double(now - last) << " Hz" - << std::endl; + std::cout << "Average framerate: " << static_cast(count) / (now - last) + << " Hz" << std::endl; count = 0; last = now; } diff --git a/apps/src/face_detection/openni_frame_source.cpp b/apps/src/face_detection/openni_frame_source.cpp index 10c3df3fdde..310cb50900b 100644 --- a/apps/src/face_detection/openni_frame_source.cpp +++ b/apps/src/face_detection/openni_frame_source.cpp @@ -3,8 +3,7 @@ namespace OpenNIFrameSource { -OpenNIFrameSource::OpenNIFrameSource(const std::string& device_id) -: grabber_(device_id), frame_counter_(0), active_(true) +OpenNIFrameSource::OpenNIFrameSource(const std::string& device_id) : grabber_(device_id) { std::function frame_cb = [this](const PointCloudConstPtr& cloud) { onNewFrame(cloud); }; diff --git a/apps/src/feature_matching.cpp b/apps/src/feature_matching.cpp index 394ae3eef0d..077eace391c 100644 --- a/apps/src/feature_matching.cpp +++ b/apps/src/feature_matching.cpp @@ -140,9 +140,9 @@ class ICCVTutorial { pcl::CorrespondencesPtr correspondences_; Eigen::Matrix4f initial_transformation_matrix_; Eigen::Matrix4f transformation_matrix_; - bool show_source2target_; - bool show_target2source_; - bool show_correspondences; + bool show_source2target_{false}; + bool show_target2source_{false}; + bool show_correspondences{false}; }; template @@ -166,9 +166,6 @@ ICCVTutorial::ICCVTutorial( , source_features_(new pcl::PointCloud) , target_features_(new pcl::PointCloud) , correspondences_(new pcl::Correspondences) -, show_source2target_(false) -, show_target2source_(false) -, show_correspondences(false) { visualizer_.registerKeyboardCallback( &ICCVTutorial::keyboard_callback, *this, nullptr); @@ -342,7 +339,7 @@ ICCVTutorial::filterCorrespondences() std::vector> correspondences; for (std::size_t cIdx = 0; cIdx < source2target_.size(); ++cIdx) if (target2source_[source2target_[cIdx]] == static_cast(cIdx)) - correspondences.push_back(std::make_pair(cIdx, source2target_[cIdx])); + correspondences.emplace_back(cIdx, source2target_[cIdx]); correspondences_->resize(correspondences.size()); for (std::size_t cIdx = 0; cIdx < correspondences.size(); ++cIdx) { @@ -593,16 +590,14 @@ main(int argc, char** argv) pcl::Keypoint::Ptr keypoint_detector; if (keypoint_type == 1) { - pcl::SIFTKeypoint* sift3D = - new pcl::SIFTKeypoint; + auto* sift3D = new pcl::SIFTKeypoint; sift3D->setScales(0.01f, 3, 2); sift3D->setMinimumContrast(0.0); keypoint_detector.reset(sift3D); } else { - pcl::HarrisKeypoint3D* harris3D = - new pcl::HarrisKeypoint3D( - pcl::HarrisKeypoint3D::HARRIS); + auto* harris3D = new pcl::HarrisKeypoint3D( + pcl::HarrisKeypoint3D::HARRIS); harris3D->setNonMaxSupression(true); harris3D->setRadius(0.01f); harris3D->setRadiusSearch(0.01f); @@ -644,8 +639,7 @@ main(int argc, char** argv) pcl::PCLSurfaceBase::Ptr surface_reconstruction; if (surface_type == 1) { - pcl::GreedyProjectionTriangulation* gp3 = - new pcl::GreedyProjectionTriangulation; + auto* gp3 = new pcl::GreedyProjectionTriangulation; // Set the maximum distance between connected points (maximum edge length) gp3->setSearchRadius(0.025); @@ -687,7 +681,7 @@ main(int argc, char** argv) } break; case 2: { - pcl::SHOTColorEstimationOMP* shot = + auto* shot = new pcl::SHOTColorEstimationOMP; shot->setRadiusSearch(0.04); pcl::Feature::Ptr feature_extractor(shot); diff --git a/apps/src/grabcut_2d.cpp b/apps/src/grabcut_2d.cpp index 02b3faec5f8..fed4cc82449 100644 --- a/apps/src/grabcut_2d.cpp +++ b/apps/src/grabcut_2d.cpp @@ -232,12 +232,12 @@ GrabCutHelper::display(int display_type) { switch (display_type) { case 0: - glDrawPixels(image_->width, image_->height, GL_RGB, GL_FLOAT, &((*image_)[0])); + glDrawPixels(image_->width, image_->height, GL_RGB, GL_FLOAT, *image_.data()); break; case 1: glDrawPixels( - gmm_image_->width, gmm_image_->height, GL_RGB, GL_FLOAT, &((*gmm_image_)[0])); + gmm_image_->width, gmm_image_->height, GL_RGB, GL_FLOAT, *gmm_image_.data()); break; case 2: @@ -245,7 +245,7 @@ GrabCutHelper::display(int display_type) n_links_image_->height, GL_LUMINANCE, GL_FLOAT, - &((*n_links_image_)[0])); + *n_links_image_.data()); break; case 3: @@ -253,7 +253,7 @@ GrabCutHelper::display(int display_type) t_links_image_->height, GL_RGB, GL_FLOAT, - &((*t_links_image_)[0])); + *t_links_image_.data()); break; default: @@ -270,7 +270,7 @@ GrabCutHelper::overlayAlpha() alpha_image_->height, GL_ALPHA, GL_FLOAT, - &((*alpha_image_)[0])); + *alpha_image_.data()); } /* GUI interface */ @@ -297,7 +297,7 @@ display() display_image->height, GL_RGB, GL_FLOAT, - &((*display_image)[0])); + *display_image.data()); else grabcut.display(display_type); diff --git a/apps/src/manual_registration/manual_registration.cpp b/apps/src/manual_registration/manual_registration.cpp index b7cf5d8a009..16e9e3923fd 100644 --- a/apps/src/manual_registration/manual_registration.cpp +++ b/apps/src/manual_registration/manual_registration.cpp @@ -297,7 +297,7 @@ ManualRegistration::orthoChanged(int state) void ManualRegistration::applyTransformPressed() { - PCLViewerDialog* diag = new PCLViewerDialog(this); + auto* diag = new PCLViewerDialog(this); diag->setModal(true); diag->setGeometry(this->x(), this->y(), this->width(), this->height()); diag->setPointClouds(cloud_src_, cloud_dst_, Eigen::Affine3f(transform_)); diff --git a/apps/src/ni_agast.cpp b/apps/src/ni_agast.cpp index 6793e490d0a..9595e5bf557 100644 --- a/apps/src/ni_agast.cpp +++ b/apps/src/ni_agast.cpp @@ -67,9 +67,6 @@ class AGASTDemo { : cloud_viewer_("AGAST 2D Keypoints -- PointCloud") , grabber_(grabber) , image_viewer_("AGAST 2D Keypoints -- Image") - , bmax_(255) - , threshold_(30) - , detector_type_(0) {} ///////////////////////////////////////////////////////////////////////// @@ -129,7 +126,7 @@ class AGASTDemo { void keyboard_callback(const pcl::visualization::KeyboardEvent& event, void* cookie) { - AGASTDemo* obj = static_cast(cookie); + auto* obj = static_cast(cookie); if (event.getKeyCode()) { std::stringstream ss; @@ -289,8 +286,8 @@ class AGASTDemo { if (keypoints && !keypoints->empty()) { image_viewer_.removeLayer(getStrBool(keypts)); for (std::size_t i = 0; i < keypoints->size(); ++i) { - int u = int((*keypoints)[i].u); - int v = int((*keypoints)[i].v); + int u = static_cast((*keypoints)[i].u); + int v = static_cast((*keypoints)[i].v); image_viewer_.markPoint(u, v, visualization::red_color, @@ -330,9 +327,9 @@ class AGASTDemo { PointCloud::Ptr keypoints_; - double bmax_; - double threshold_; - int detector_type_; + double bmax_{255}; + double threshold_{30}; + int detector_type_{0}; private: boost::signals2::connection cloud_connection; diff --git a/apps/src/ni_brisk.cpp b/apps/src/ni_brisk.cpp index 274cdf5a8d6..2ad4645b8c8 100644 --- a/apps/src/ni_brisk.cpp +++ b/apps/src/ni_brisk.cpp @@ -107,8 +107,8 @@ class BRISKDemo { inline PointT bilinearInterpolation(const CloudConstPtr& cloud, float x, float y) { - int u = int(x); - int v = int(y); + int u = static_cast(x); + int v = static_cast(y); PointT pt; pt.x = pt.y = pt.z = 0; @@ -118,7 +118,7 @@ class BRISKDemo { const PointT& p3 = (*cloud)(u, v + 1); const PointT& p4 = (*cloud)(u + 1, v + 1); - float fx = x - float(u), fy = y - float(v); + float fx = x - static_cast(u), fy = y - static_cast(v); float fx1 = 1.0f - fx, fy1 = 1.0f - fy; float w1 = fx1 * fy1, w2 = fx * fy1, w3 = fx1 * fy, w4 = fx * fy; @@ -236,8 +236,8 @@ class BRISKDemo { image_viewer_.removeLayer(getStrBool(keypts)); for (std::size_t i = 0; i < keypoints->size(); ++i) { - int u = int((*keypoints)[i].x); - int v = int((*keypoints)[i].y); + int u = static_cast((*keypoints)[i].x); + int v = static_cast((*keypoints)[i].y); image_viewer_.markPoint(u, v, visualization::red_color, diff --git a/apps/src/ni_linemod.cpp b/apps/src/ni_linemod.cpp index 52452ec0bd6..a5532c8008c 100644 --- a/apps/src/ni_linemod.cpp +++ b/apps/src/ni_linemod.cpp @@ -77,10 +77,7 @@ class NILinemod { bool added; NILinemod(Grabber& grabber) - : cloud_viewer_("PointCloud") - , grabber_(grabber) - , image_viewer_("Image") - , first_frame_(true) + : cloud_viewer_("PointCloud"), grabber_(grabber), image_viewer_("Image") { added = false; @@ -566,7 +563,7 @@ class NILinemod { private: boost::signals2::connection cloud_connection, image_connection; - bool first_frame_; + bool first_frame_{true}; // Segmentation pcl::Indices indices_fullset_; diff --git a/apps/src/ni_susan.cpp b/apps/src/ni_susan.cpp index d67eb2568a7..b644f48cada 100644 --- a/apps/src/ni_susan.cpp +++ b/apps/src/ni_susan.cpp @@ -144,8 +144,9 @@ class SUSANDemo { if (keypoints && !keypoints->empty()) { image_viewer_.removeLayer(getStrBool(keypts)); for (std::size_t i = 0; i < keypoints->size(); ++i) { - int u = int((*keypoints)[i].label % cloud->width); - int v = cloud->height - int((*keypoints)[i].label / cloud->width); + int u = static_cast((*keypoints)[i].label % cloud->width); + int v = + cloud->height - static_cast((*keypoints)[i].label / cloud->width); image_viewer_.markPoint(u, v, visualization::red_color, diff --git a/apps/src/openni_3d_concave_hull.cpp b/apps/src/openni_3d_concave_hull.cpp index d4c0309704a..1e4642ee8a1 100644 --- a/apps/src/openni_3d_concave_hull.cpp +++ b/apps/src/openni_3d_concave_hull.cpp @@ -57,7 +57,7 @@ using namespace std::chrono_literals; static double last = pcl::getTime(); \ if (++count == 100) { \ double now = pcl::getTime(); \ - std::cout << "Average framerate(" << _WHAT_ << "): " \ + std::cout << "Average framerate(" << (_WHAT_) << "): " \ << double(count) / double(now - last) << " Hz" << std::endl; \ count = 0; \ last = now; \ @@ -204,7 +204,7 @@ main(int argc, char** argv) return 1; } - std::string device_id = ""; + std::string device_id; if (pcl::console::parse_argument(argc, argv, "-device_id", device_id) == -1 && argc > 1 && argv[1][0] != '-') device_id = argv[1]; diff --git a/apps/src/openni_3d_convex_hull.cpp b/apps/src/openni_3d_convex_hull.cpp index 674ea43ead0..c976c4354c2 100644 --- a/apps/src/openni_3d_convex_hull.cpp +++ b/apps/src/openni_3d_convex_hull.cpp @@ -57,7 +57,7 @@ using namespace pcl::visualization; static double last = pcl::getTime(); \ if (++count == 100) { \ double now = pcl::getTime(); \ - std::cout << "Average framerate(" << _WHAT_ << "): " \ + std::cout << "Average framerate(" << (_WHAT_) << "): " \ << double(count) / double(now - last) << " Hz" << std::endl; \ count = 0; \ last = now; \ @@ -202,7 +202,7 @@ main(int argc, char** argv) return 1; } - std::string device_id = ""; + std::string device_id; if (pcl::console::parse_argument(argc, argv, "-device_id", device_id) == -1 && argc > 1 && argv[1][0] != '-') device_id = argv[1]; diff --git a/apps/src/openni_boundary_estimation.cpp b/apps/src/openni_boundary_estimation.cpp index 4b343c1faa4..7c911b33b22 100644 --- a/apps/src/openni_boundary_estimation.cpp +++ b/apps/src/openni_boundary_estimation.cpp @@ -64,7 +64,7 @@ using ColorHandlerConstPtr = ColorHandler::ConstPtr; double now = pcl::getTime(); \ ++count; \ if (now - last >= 1.0) { \ - std::cout << "Average framerate(" << _WHAT_ << "): " \ + std::cout << "Average framerate(" << (_WHAT_) << "): " \ << double(count) / double(now - last) << " Hz" << std::endl; \ count = 0; \ last = now; \ @@ -220,7 +220,7 @@ main(int argc, char** argv) return 1; } - std::string device_id = ""; + std::string device_id; if (pcl::console::parse_argument(argc, argv, "-device_id", device_id) == -1 && argc > 1 && argv[1][0] != '-') device_id = argv[1]; diff --git a/apps/src/openni_fast_mesh.cpp b/apps/src/openni_fast_mesh.cpp index e3701033940..828e7f0626a 100644 --- a/apps/src/openni_fast_mesh.cpp +++ b/apps/src/openni_fast_mesh.cpp @@ -56,7 +56,7 @@ using namespace std::chrono_literals; static double last = pcl::getTime(); \ if (++count == 100) { \ double now = pcl::getTime(); \ - std::cout << "Average framerate(" << _WHAT_ << "): " \ + std::cout << "Average framerate(" << (_WHAT_) << "): " \ << double(count) / double(now - last) << " Hz" << std::endl; \ count = 0; \ last = now; \ @@ -190,7 +190,7 @@ main(int argc, char** argv) return 1; } - std::string device_id = ""; + std::string device_id; if (pcl::console::parse_argument(argc, argv, "-device_id", device_id) == -1 && argc > 1 && argv[1][0] != '-') device_id = argv[1]; diff --git a/apps/src/openni_feature_persistence.cpp b/apps/src/openni_feature_persistence.cpp index 83412d7e970..4eb6926f1ed 100644 --- a/apps/src/openni_feature_persistence.cpp +++ b/apps/src/openni_feature_persistence.cpp @@ -62,7 +62,7 @@ using namespace std::chrono_literals; double now = pcl::getTime(); \ ++count; \ if (now - last >= 1.0) { \ - std::cout << "Average framerate(" << _WHAT_ << "): " \ + std::cout << "Average framerate(" << (_WHAT_) << "): " \ << double(count) / double(now - last) << " Hz" << std::endl; \ count = 0; \ last = now; \ @@ -285,7 +285,7 @@ main(int argc, char** argv) return 1; } - std::string device_id = ""; + std::string device_id; float subsampling_leaf_size = default_subsampling_leaf_size; double normal_search_radius = default_normal_search_radius; std::vector scales_vector_double = default_scales_vector; @@ -300,7 +300,7 @@ main(int argc, char** argv) argc, argv, "-normal_search_radius", normal_search_radius); pcl::console::parse_multiple_arguments(argc, argv, "-scales", scales_vector_double); for (std::size_t i = 0; i < scales_vector_double.size(); ++i) - scales_vector[i] = float(scales_vector_double[i]); + scales_vector[i] = static_cast(scales_vector_double[i]); pcl::console::parse_argument(argc, argv, "-persistence_alpha", alpha); ///////////////////////////////////////////////////////////////////// diff --git a/apps/src/openni_ii_normal_estimation.cpp b/apps/src/openni_ii_normal_estimation.cpp index 942447f35b2..d0f6fd516d2 100644 --- a/apps/src/openni_ii_normal_estimation.cpp +++ b/apps/src/openni_ii_normal_estimation.cpp @@ -55,7 +55,7 @@ using namespace std::chrono_literals; double now = pcl::getTime(); \ ++count; \ if (now - last >= 1.0) { \ - std::cout << "Average framerate(" << _WHAT_ << "): " \ + std::cout << "Average framerate(" << (_WHAT_) << "): " \ << double(count) / double(now - last) << " Hz" << std::endl; \ count = 0; \ last = now; \ @@ -229,7 +229,7 @@ main(int argc, char** argv) return 1; } - std::string device_id = ""; + std::string device_id; if (pcl::console::parse_argument(argc, argv, "-device_id", device_id) == -1 && argc > 1 && argv[1][0] != '-') device_id = argv[1]; diff --git a/apps/src/openni_klt.cpp b/apps/src/openni_klt.cpp index 504d40dd665..89e69d8073f 100644 --- a/apps/src/openni_klt.cpp +++ b/apps/src/openni_klt.cpp @@ -56,7 +56,7 @@ double now = pcl::getTime(); \ ++count; \ if (now - last >= 1.0) { \ - std::cout << "Average framerate(" << _WHAT_ << "): " \ + std::cout << "Average framerate(" << (_WHAT_) << "): " \ << double(count) / double(now - last) << " Hz" << std::endl; \ count = 0; \ last = now; \ @@ -111,9 +111,7 @@ class OpenNIViewer { using Cloud = pcl::PointCloud; using CloudConstPtr = typename Cloud::ConstPtr; - OpenNIViewer(pcl::Grabber& grabber) - : grabber_(grabber), rgb_data_(nullptr), rgb_data_size_(0), counter_(0) - {} + OpenNIViewer(pcl::Grabber& grabber) : grabber_(grabber) {} void detect_keypoints(const CloudConstPtr& cloud) @@ -288,13 +286,13 @@ class OpenNIViewer { CloudConstPtr cloud_; openni_wrapper::Image::Ptr image_; - unsigned char* rgb_data_; - unsigned rgb_data_size_; + unsigned char* rgb_data_{nullptr}; + unsigned rgb_data_size_{0}; typename pcl::tracking::PyramidalKLTTracker::Ptr tracker_; pcl::PointCloud::ConstPtr keypoints_; pcl::PointIndicesConstPtr points_; pcl::shared_ptr> points_status_; - int counter_; + int counter_{0}; }; // Create the PCLVisualizer object diff --git a/apps/src/openni_mls_smoothing.cpp b/apps/src/openni_mls_smoothing.cpp index 641c341c745..3f96c705268 100644 --- a/apps/src/openni_mls_smoothing.cpp +++ b/apps/src/openni_mls_smoothing.cpp @@ -54,7 +54,7 @@ double now = pcl::getTime(); \ ++count; \ if (now - last >= 1.0) { \ - std::cout << "Average framerate(" << _WHAT_ << "): " \ + std::cout << "Average framerate(" << (_WHAT_) << "): " \ << double(count) / double(now - last) << " Hz" << std::endl; \ count = 0; \ last = now; \ @@ -221,7 +221,7 @@ main(int argc, char** argv) return 1; } - std::string device_id = ""; + std::string device_id; double search_radius = default_search_radius; double sqr_gauss_param = default_sqr_gauss_param; bool sqr_gauss_param_set = true; diff --git a/apps/src/openni_mobile_server.cpp b/apps/src/openni_mobile_server.cpp index aee1892abf6..d93e6cd5ad1 100644 --- a/apps/src/openni_mobile_server.cpp +++ b/apps/src/openni_mobile_server.cpp @@ -238,7 +238,7 @@ main(int argc, char** argv) return 1; } - std::string device_id = ""; + std::string device_id; int port = 11111; float leaf_x = 0.01f, leaf_y = 0.01f, leaf_z = 0.01f; diff --git a/apps/src/openni_octree_compression.cpp b/apps/src/openni_octree_compression.cpp index 4592cbd3407..e8e2c0a8540 100644 --- a/apps/src/openni_octree_compression.cpp +++ b/apps/src/openni_octree_compression.cpp @@ -108,7 +108,7 @@ char usage[] = "\n" double now = pcl::getTime(); \ ++count; \ if (now - last >= 1.0) { \ - std::cout << "Average framerate(" << _WHAT_ << "): " \ + std::cout << "Average framerate(" << (_WHAT_) << "): " \ << double(count) / double(now - last) << " Hz" << std::endl; \ count = 0; \ last = now; \ @@ -351,7 +351,7 @@ main(int argc, char** argv) // apply profile settings pointResolution = selectedProfile.pointResolution; - octreeResolution = float(selectedProfile.octreeResolution); + octreeResolution = static_cast(selectedProfile.octreeResolution); doVoxelGridDownDownSampling = selectedProfile.doVoxelGridDownSampling; iFrameRate = selectedProfile.iFrameRate; doColorEncoding = selectedProfile.doColorEncoding; diff --git a/apps/src/openni_organized_compression.cpp b/apps/src/openni_organized_compression.cpp index f68314f4bf7..75593da9b2f 100644 --- a/apps/src/openni_organized_compression.cpp +++ b/apps/src/openni_organized_compression.cpp @@ -92,7 +92,7 @@ char usage[] = "\n" double now = pcl::getTime(); \ ++count; \ if (now - last >= 1.0) { \ - std::cout << "Average framerate(" << _WHAT_ << "): " \ + std::cout << "Average framerate(" << (_WHAT_) << "): " \ << double(count) / double(now - last) << " Hz" << std::endl; \ count = 0; \ last = now; \ @@ -226,14 +226,14 @@ struct EventHelper { depth_image->fillDepthImageRaw( width, height, - &disparity_data[0], + disparity_data.data(), static_cast(width * sizeof(std::uint16_t))); if (image->getEncoding() != openni_wrapper::Image::RGB) { rgb_data.resize(width * height * 3); image->fillRGB(width, height, - &rgb_data[0], + rgb_data.data(), static_cast(width * sizeof(std::uint8_t) * 3)); } diff --git a/apps/src/openni_organized_edge_detection.cpp b/apps/src/openni_organized_edge_detection.cpp index 0042f36ffcb..5b8b3c5e04f 100644 --- a/apps/src/openni_organized_edge_detection.cpp +++ b/apps/src/openni_organized_edge_detection.cpp @@ -222,7 +222,7 @@ class OpenNIOrganizedEdgeDetection { ne.setInputCloud(cloud_.makeShared()); ne.compute(*normal_cloud); double normal_end = pcl::getTime(); - std::cout << "Normal Estimation took " << double(normal_end - normal_start) + std::cout << "Normal Estimation took " << (normal_end - normal_start) << std::endl; oed.setInputNormals(normal_cloud); @@ -234,12 +234,12 @@ class OpenNIOrganizedEdgeDetection { oed.compute(labels, label_indices); double oed_end = pcl::getTime(); - std::cout << "Edge Detection took " << double(oed_end - oed_start) << std::endl; - std::cout << "Frame took " << double(oed_end - normal_start) << std::endl; + std::cout << "Edge Detection took " << (oed_end - oed_start) << std::endl; + std::cout << "Frame took " << (oed_end - normal_start) << std::endl; // Make gray point cloud for (auto& point : cloud_.points) { - std::uint8_t gray = std::uint8_t((point.r + point.g + point.b) / 3); + auto gray = static_cast((point.r + point.g + point.b) / 3); point.r = point.g = point.b = gray; } @@ -325,7 +325,7 @@ main(int argc, char** argv) return 1; } - std::string device_id = ""; + std::string device_id; if (pcl::console::parse_argument(argc, argv, "-device_id", device_id) == -1 && argc > 1 && argv[1][0] != '-') device_id = argv[1]; diff --git a/apps/src/openni_organized_multi_plane_segmentation.cpp b/apps/src/openni_organized_multi_plane_segmentation.cpp index a587a7e2154..2a1b3a58590 100644 --- a/apps/src/openni_organized_multi_plane_segmentation.cpp +++ b/apps/src/openni_organized_multi_plane_segmentation.cpp @@ -144,7 +144,7 @@ class OpenNIOrganizedMultiPlaneSegmentation { ne.setInputCloud(prev_cloud); ne.compute(*normal_cloud); double normal_end = pcl::getTime(); - std::cout << "Normal Estimation took " << double(normal_end - normal_start) + std::cout << "Normal Estimation took " << (normal_end - normal_start) << std::endl; double plane_extract_start = pcl::getTime(); @@ -153,9 +153,8 @@ class OpenNIOrganizedMultiPlaneSegmentation { mps.segmentAndRefine(regions); double plane_extract_end = pcl::getTime(); std::cout << "Plane extraction took " - << double(plane_extract_end - plane_extract_start) << std::endl; - std::cout << "Frame took " << double(plane_extract_end - normal_start) - << std::endl; + << (plane_extract_end - plane_extract_start) << std::endl; + std::cout << "Frame took " << (plane_extract_end - normal_start) << std::endl; pcl::PointCloud::Ptr cluster(new pcl::PointCloud); diff --git a/apps/src/openni_planar_convex_hull.cpp b/apps/src/openni_planar_convex_hull.cpp index d42481a2caa..ae3ae70a285 100644 --- a/apps/src/openni_planar_convex_hull.cpp +++ b/apps/src/openni_planar_convex_hull.cpp @@ -192,7 +192,7 @@ main(int argc, char** argv) return 1; } - std::string device_id = ""; + std::string device_id; double threshold = 0.05; if (pcl::console::parse_argument(argc, argv, "-device_id", device_id) == -1 && diff --git a/apps/src/openni_planar_segmentation.cpp b/apps/src/openni_planar_segmentation.cpp index d06d4fde3b0..a4920b9709b 100644 --- a/apps/src/openni_planar_segmentation.cpp +++ b/apps/src/openni_planar_segmentation.cpp @@ -185,7 +185,7 @@ main(int argc, char** argv) return 1; } - std::string device_id = ""; + std::string device_id; double threshold = 0.05; if (pcl::console::parse_argument(argc, argv, "-device_id", device_id) == -1 && diff --git a/apps/src/openni_shift_to_depth_conversion.cpp b/apps/src/openni_shift_to_depth_conversion.cpp index 7de78e4f2eb..00a842b8b2d 100644 --- a/apps/src/openni_shift_to_depth_conversion.cpp +++ b/apps/src/openni_shift_to_depth_conversion.cpp @@ -81,13 +81,13 @@ class SimpleOpenNIViewer { depth_image->fillDepthImageRaw( width, height, - &raw_shift_data[0], + raw_shift_data.data(), static_cast(width * sizeof(std::uint16_t))); // convert raw shift data to raw depth data raw_depth_data.resize(width * height); grabber_.convertShiftToDepth( - &raw_shift_data[0], &raw_depth_data[0], raw_shift_data.size()); + raw_shift_data.data(), raw_depth_data.data(), raw_shift_data.size()); // check for color data if (image->getEncoding() != openni_wrapper::Image::RGB) { @@ -95,7 +95,7 @@ class SimpleOpenNIViewer { rgb_data.resize(width * height * 3); image->fillRGB(width, height, - &rgb_data[0], + rgb_data.data(), static_cast(width * sizeof(std::uint8_t) * 3)); } diff --git a/apps/src/openni_tracking.cpp b/apps/src/openni_tracking.cpp index 174f889a19c..c212e1b3c90 100644 --- a/apps/src/openni_tracking.cpp +++ b/apps/src/openni_tracking.cpp @@ -82,7 +82,7 @@ double end_time = pcl::getTime(); \ static unsigned count = 0; \ if (++count == 10) { \ - std::cout << "Average framerate(" << _WHAT_ << "): " \ + std::cout << "Average framerate(" << (_WHAT_) << "): " \ << double(count) / double(duration) << " Hz" << std::endl; \ count = 0; \ duration = 0.0; \ @@ -120,11 +120,7 @@ class OpenNISegmentTracking { bool visualize_particles, bool use_fixed) : viewer_("PCL OpenNI Tracking Viewer") - , device_id_(device_id) - , new_cloud_(false) - , ne_(thread_nr) - , counter_(0) - , use_convex_hull_(use_convex_hull) + , device_id_(device_id) ne_(thread_nr) use_convex_hull_(use_convex_hull) , visualize_non_downsample_(visualize_non_downsample) , visualize_particles_(visualize_particles) , downsampling_grid_size_(downsampling_grid_size) @@ -339,7 +335,9 @@ class OpenNISegmentTracking { FPS_CALC_BEGIN; double start = pcl::getTime(); pcl::VoxelGrid grid; - grid.setLeafSize(float(leaf_size), float(leaf_size), float(leaf_size)); + grid.setLeafSize(static_cast(leaf_size), + static_cast(leaf_size), + static_cast(leaf_size)); grid.setInputCloud(cloud); grid.filter(result); double end = pcl::getTime(); @@ -549,11 +547,12 @@ class OpenNISegmentTracking { double segment_distance = c[0] * c[0] + c[1] * c[1]; for (std::size_t i = 1; i < cluster_indices.size(); i++) { temp_cloud.reset(new Cloud); - extractSegmentCluster(target_cloud, cluster_indices, int(i), *temp_cloud); + extractSegmentCluster( + target_cloud, cluster_indices, static_cast(i), *temp_cloud); pcl::compute3DCentroid(*temp_cloud, c); double distance = c[0] * c[0] + c[1] * c[1]; if (distance < segment_distance) { - segment_index = int(i); + segment_index = static_cast(i); segment_distance = distance; } } @@ -630,10 +629,10 @@ class OpenNISegmentTracking { std::string device_id_; std::mutex mtx_; - bool new_cloud_; + bool new_cloud_{false}; pcl::NormalEstimationOMP ne_; // to store threadpool ParticleFilter::Ptr tracker_; - int counter_; + int counter_{0}; bool use_convex_hull_; bool visualize_non_downsample_; bool visualize_particles_; @@ -669,7 +668,7 @@ main(int argc, char** argv) return 1; } - std::string device_id = ""; + std::string device_id; bool use_convex_hull = true; bool visualize_non_downsample = false; bool visualize_particles = true; diff --git a/apps/src/openni_uniform_sampling.cpp b/apps/src/openni_uniform_sampling.cpp index 6167cdacb3c..a3f45fcc7c1 100644 --- a/apps/src/openni_uniform_sampling.cpp +++ b/apps/src/openni_uniform_sampling.cpp @@ -55,7 +55,7 @@ using namespace std::chrono_literals; double now = pcl::getTime(); \ ++count; \ if (now - last >= 1.0) { \ - std::cout << "Average framerate(" << _WHAT_ << "): " \ + std::cout << "Average framerate(" << (_WHAT_) << "): " \ << double(count) / double(now - last) << " Hz" << std::endl; \ count = 0; \ last = now; \ @@ -188,7 +188,7 @@ main(int argc, char** argv) return 1; } - std::string device_id = ""; + std::string device_id; float leaf_res = 0.05f; if (pcl::console::parse_argument(argc, argv, "-device_id", device_id) == -1 && diff --git a/apps/src/openni_voxel_grid.cpp b/apps/src/openni_voxel_grid.cpp index 27749cbe325..cbac0039c6c 100644 --- a/apps/src/openni_voxel_grid.cpp +++ b/apps/src/openni_voxel_grid.cpp @@ -52,7 +52,7 @@ double now = pcl::getTime(); \ ++count; \ if (now - last >= 1.0) { \ - std::cout << "Average framerate(" << _WHAT_ << "): " \ + std::cout << "Average framerate(" << (_WHAT_) << "): " \ << double(count) / double(now - last) << " Hz" << std::endl; \ count = 0; \ last = now; \ @@ -187,7 +187,7 @@ main(int argc, char** argv) return 1; } - std::string device_id = ""; + std::string device_id; float min_v = 0.0f, max_v = 5.0f; std::string field_name = "z"; float leaf_x = 0.01f, leaf_y = 0.01f, leaf_z = 0.01f; diff --git a/apps/src/organized_segmentation_demo.cpp b/apps/src/organized_segmentation_demo.cpp index cbf81a72728..f08bd3f275a 100644 --- a/apps/src/organized_segmentation_demo.cpp +++ b/apps/src/organized_segmentation_demo.cpp @@ -35,11 +35,11 @@ displayPlanarRegions( pcl::PointXYZ pt2 = pcl::PointXYZ(centroid[0] + (0.5f * model[0]), centroid[1] + (0.5f * model[1]), centroid[2] + (0.5f * model[2])); - sprintf(name, "normal_%d", unsigned(i)); + sprintf(name, "normal_%d", static_cast(i)); viewer->addArrow(pt2, pt1, 1.0, 0, 0, false, name); contour->points = regions[i].getContour(); - sprintf(name, "plane_%02d", int(i)); + sprintf(name, "plane_%02d", static_cast(i)); pcl::visualization::PointCloudColorHandlerCustom color( contour, red[i % 6], grn[i % 6], blu[i % 6]); if (!viewer->updatePointCloud(contour, color, name)) @@ -59,7 +59,7 @@ displayEuclideanClusters(const pcl::PointCloud::CloudVectorType& cluster unsigned char blu[6] = {0, 0, 255, 0, 255, 255}; for (std::size_t i = 0; i < clusters.size(); i++) { - sprintf(name, "cluster_%d", int(i)); + sprintf(name, "cluster_%d", static_cast(i)); pcl::PointCloud::ConstPtr cluster_cloud( new pcl::PointCloud(clusters[i])); pcl::visualization::PointCloudColorHandlerCustom color0( @@ -126,15 +126,15 @@ removePreviousDataFromScreen(std::size_t prev_models_size, { char name[1024]; for (std::size_t i = 0; i < prev_models_size; i++) { - sprintf(name, "normal_%d", unsigned(i)); + sprintf(name, "normal_%d", static_cast(i)); viewer->removeShape(name); - sprintf(name, "plane_%02d", int(i)); + sprintf(name, "plane_%02d", static_cast(i)); viewer->removePointCloud(name); } for (std::size_t i = 0; i < prev_clusters_size; i++) { - sprintf(name, "cluster_%d", int(i)); + sprintf(name, "cluster_%d", static_cast(i)); viewer->removePointCloud(name); } } @@ -173,7 +173,7 @@ comparePointToRegion(PointT& pt, pt_vec[0] = pt.x; pt_vec[1] = pt.y; pt_vec[2] = pt.z; - Eigen::Vector3f projected(pt_vec - mc * float(ptp_dist)); + Eigen::Vector3f projected(pt_vec - mc * static_cast(ptp_dist)); PointT projected_pt; projected_pt.x = projected[0]; projected_pt.y = projected[1]; @@ -370,7 +370,7 @@ OrganizedSegmentationDemo::cloud_cb(const CloudConstPtr& cloud) mps.segment(regions); } double mps_end = pcl::getTime(); - std::cout << "MPS+Refine took: " << double(mps_end - mps_start) << std::endl; + std::cout << "MPS+Refine took: " << (mps_end - mps_start) << std::endl; // Segment Objects pcl::PointCloud::CloudVectorType clusters; diff --git a/apps/src/pcd_organized_edge_detection.cpp b/apps/src/pcd_organized_edge_detection.cpp index e1eb6f9af11..37a38b82d72 100644 --- a/apps/src/pcd_organized_edge_detection.cpp +++ b/apps/src/pcd_organized_edge_detection.cpp @@ -204,7 +204,7 @@ compute(const pcl::PCLPointCloud2::ConstPtr& input, // Make gray point clouds for (auto& point : cloud->points) { - std::uint8_t gray = std::uint8_t((point.r + point.g + point.b) / 3); + auto gray = static_cast((point.r + point.g + point.b) / 3); point.r = point.g = point.b = gray; } diff --git a/apps/src/pcd_organized_multi_plane_segmentation.cpp b/apps/src/pcd_organized_multi_plane_segmentation.cpp index 82d4507034d..1f20c205a3f 100644 --- a/apps/src/pcd_organized_multi_plane_segmentation.cpp +++ b/apps/src/pcd_organized_multi_plane_segmentation.cpp @@ -50,19 +50,14 @@ class PCDOrganizedMultiPlaneSegmentation { pcl::visualization::PCLVisualizer viewer; typename pcl::PointCloud::ConstPtr cloud; bool refine_; - float threshold_; - bool depth_dependent_; - bool polygon_refinement_; + float threshold_{0.02f}; + bool depth_dependent_{true}; + bool polygon_refinement_{false}; public: PCDOrganizedMultiPlaneSegmentation(typename pcl::PointCloud::ConstPtr cloud_, bool refine) - : viewer("Viewer") - , cloud(cloud_) - , refine_(refine) - , threshold_(0.02f) - , depth_dependent_(true) - , polygon_refinement_(false) + : viewer("Viewer"), cloud(cloud_), refine_(refine) { viewer.setBackgroundColor(0, 0, 0); viewer.addCoordinateSystem(1.0, "global"); @@ -143,8 +138,7 @@ class PCDOrganizedMultiPlaneSegmentation { ne.setInputCloud(cloud); ne.compute(*normal_cloud); double normal_end = pcl::getTime(); - std::cout << "Normal Estimation took " << double(normal_end - normal_start) - << std::endl; + std::cout << "Normal Estimation took " << (normal_end - normal_start) << std::endl; double plane_extract_start = pcl::getTime(); mps.setInputNormals(normal_cloud); @@ -154,10 +148,9 @@ class PCDOrganizedMultiPlaneSegmentation { else mps.segment(regions); double plane_extract_end = pcl::getTime(); - std::cout << "Plane extraction took " - << double(plane_extract_end - plane_extract_start) + std::cout << "Plane extraction took " << (plane_extract_end - plane_extract_start) << " with planar regions found: " << regions.size() << std::endl; - std::cout << "Frame took " << double(plane_extract_end - normal_start) << std::endl; + std::cout << "Frame took " << (plane_extract_end - normal_start) << std::endl; typename pcl::PointCloud::Ptr cluster(new pcl::PointCloud); diff --git a/apps/src/pcd_select_object_plane.cpp b/apps/src/pcd_select_object_plane.cpp index b7914d72668..c0584037b6b 100644 --- a/apps/src/pcd_select_object_plane.cpp +++ b/apps/src/pcd_select_object_plane.cpp @@ -70,8 +70,7 @@ using namespace std::chrono_literals; template class ObjectSelection { public: - ObjectSelection() - : plane_comparator_(new EdgeAwarePlaneComparator), rgb_data_() + ObjectSelection() : plane_comparator_(new EdgeAwarePlaneComparator) { // Set the parameters for planar segmentation plane_comparator_->setDistanceThreshold(0.01f, false); @@ -650,7 +649,7 @@ class ObjectSelection { // Segmentation typename EdgeAwarePlaneComparator::Ptr plane_comparator_; PointIndices::Ptr plane_indices_; - unsigned char* rgb_data_; + unsigned char* rgb_data_{}; std::vector distance_map_; // Results diff --git a/apps/src/pcd_video_player/pcd_video_player.cpp b/apps/src/pcd_video_player/pcd_video_player.cpp index 66c3d4fa104..f7402765f88 100644 --- a/apps/src/pcd_video_player/pcd_video_player.cpp +++ b/apps/src/pcd_video_player/pcd_video_player.cpp @@ -224,8 +224,8 @@ PCDVideoPlayer::selectFilesButtonPressed() return; } - for (int i = 0; i < qt_pcd_files.size(); i++) { - pcd_files_.push_back(qt_pcd_files.at(i).toStdString()); + for (const auto& qt_pcd_file : qt_pcd_files) { + pcd_files_.push_back(qt_pcd_file.toStdString()); } current_frame_ = 0; diff --git a/apps/src/ppf_object_recognition.cpp b/apps/src/ppf_object_recognition.cpp index 9889d0c6a5e..4be5cb54f36 100644 --- a/apps/src/ppf_object_recognition.cpp +++ b/apps/src/ppf_object_recognition.cpp @@ -114,7 +114,7 @@ main(int argc, char** argv) ppf_estimator.compute(*cloud_model_ppf); PPFHashMapSearch::Ptr hashmap_search( - new PPFHashMapSearch(12.0f / 180.0f * float(M_PI), 0.05f)); + new PPFHashMapSearch(12.0f / 180.0f * static_cast(M_PI), 0.05f)); hashmap_search->setInputFeatureCloud(cloud_model_ppf); hashmap_search_vector.push_back(hashmap_search); } @@ -130,7 +130,8 @@ main(int argc, char** argv) // set parameters for the PPF registration procedure ppf_registration.setSceneReferencePointSamplingRate(10); ppf_registration.setPositionClusteringThreshold(0.2f); - ppf_registration.setRotationClusteringThreshold(30.0f / 180.0f * float(M_PI)); + ppf_registration.setRotationClusteringThreshold(30.0f / 180.0f * + static_cast(M_PI)); ppf_registration.setSearchMethod(hashmap_search_vector[model_i]); ppf_registration.setInputSource(cloud_models_with_normals[model_i]); ppf_registration.setInputTarget(cloud_scene_input); diff --git a/apps/src/pyramid_surface_matching.cpp b/apps/src/pyramid_surface_matching.cpp index 5fd5f8bc4cb..310c740b850 100644 --- a/apps/src/pyramid_surface_matching.cpp +++ b/apps/src/pyramid_surface_matching.cpp @@ -85,10 +85,11 @@ main(int argc, char** argv) PCL_INFO("Finished calculating the features ...\n"); std::vector> dim_range_input, dim_range_target; for (std::size_t i = 0; i < 3; ++i) - dim_range_input.emplace_back(float(-M_PI), float(M_PI)); + dim_range_input.emplace_back(static_cast(-M_PI), static_cast(M_PI)); dim_range_input.emplace_back(0.0f, 1.0f); for (std::size_t i = 0; i < 3; ++i) - dim_range_target.emplace_back(float(-M_PI) * 10.0f, float(M_PI) * 10.0f); + dim_range_target.emplace_back(static_cast(-M_PI) * 10.0f, + static_cast(M_PI) * 10.0f); dim_range_target.emplace_back(0.0f, 50.0f); PyramidFeatureHistogram::Ptr pyramid_a( diff --git a/apps/src/render_views_tesselated_sphere.cpp b/apps/src/render_views_tesselated_sphere.cpp index 9f6ba71ef8c..1d9c2536a26 100644 --- a/apps/src/render_views_tesselated_sphere.cpp +++ b/apps/src/render_views_tesselated_sphere.cpp @@ -122,8 +122,9 @@ pcl::apps::RenderViewsTesselatedSphere::generateViews() sphere->GetPoint(ptIds_com[1], p2_com); sphere->GetPoint(ptIds_com[2], p3_com); vtkTriangle::TriangleCenter(p1_com, p2_com, p3_com, center); - cam_positions[i] = - Eigen::Vector3f(float(center[0]), float(center[1]), float(center[2])); + cam_positions[i] = Eigen::Vector3f(static_cast(center[0]), + static_cast(center[1]), + static_cast(center[2])); i++; } } @@ -132,8 +133,9 @@ pcl::apps::RenderViewsTesselatedSphere::generateViews() for (vtkIdType i = 0; i < sphere->GetNumberOfPoints(); i++) { double cam_pos[3]; sphere->GetPoint(i, cam_pos); - cam_positions[i] = - Eigen::Vector3f(float(cam_pos[0]), float(cam_pos[1]), float(cam_pos[2])); + cam_positions[i] = Eigen::Vector3f(static_cast(cam_pos[0]), + static_cast(cam_pos[1]), + static_cast(cam_pos[2])); } } @@ -275,7 +277,7 @@ pcl::apps::RenderViewsTesselatedSphere::generateViews() for (int x = 0; x < 4; x++) for (int y = 0; y < 4; y++) backToRealScale_eigen(x, y) = - float(backToRealScale->GetMatrix()->GetElement(x, y)); + static_cast(backToRealScale->GetMatrix()->GetElement(x, y)); pcl::PointCloud::Ptr cloud(new pcl::PointCloud); cloud->points.resize(resolution_ * resolution_); @@ -380,12 +382,12 @@ pcl::apps::RenderViewsTesselatedSphere::generateViews() ids = vtkIdTypeArray::SafeDownCast(hdw_selection->GetNode(0)->GetSelectionList()); double visible_area = 0; for (vtkIdType sel_id = 0; sel_id < (ids->GetNumberOfTuples()); sel_id++) { - int id_mesh = int(ids->GetValue(sel_id)); + int id_mesh = static_cast(ids->GetValue(sel_id)); if (id_mesh >= polydata->GetNumberOfPolys()) continue; vtkCell* cell = polydata->GetCell(id_mesh); - vtkTriangle* triangle = dynamic_cast(cell); + auto* triangle = dynamic_cast(cell); double p0[3]; double p1[3]; double p2[3]; @@ -396,7 +398,7 @@ pcl::apps::RenderViewsTesselatedSphere::generateViews() visible_area += area; } - entropies_.push_back(float(visible_area / totalArea)); + entropies_.push_back(static_cast(visible_area / totalArea)); } // transform cloud to give camera coordinates instead of world coordinates! @@ -406,7 +408,7 @@ pcl::apps::RenderViewsTesselatedSphere::generateViews() for (int x = 0; x < 4; x++) for (int y = 0; y < 4; y++) - trans_view(x, y) = float(view_transform->GetElement(x, y)); + trans_view(x, y) = static_cast(view_transform->GetElement(x, y)); // NOTE: vtk view coordinate system is different than the standard camera // coordinates (z forward, y down, x right) thus, the flipping in y and z @@ -445,7 +447,8 @@ pcl::apps::RenderViewsTesselatedSphere::generateViews() for (int x = 0; x < 4; x++) for (int y = 0; y < 4; y++) - pose_view(x, y) = float(transOCtoCC->GetMatrix()->GetElement(x, y)); + pose_view(x, y) = + static_cast(transOCtoCC->GetMatrix()->GetElement(x, y)); poses_.push_back(pose_view); } diff --git a/apps/src/stereo_ground_segmentation.cpp b/apps/src/stereo_ground_segmentation.cpp index 576705de5d6..f2eaa0d9aa3 100755 --- a/apps/src/stereo_ground_segmentation.cpp +++ b/apps/src/stereo_ground_segmentation.cpp @@ -265,16 +265,15 @@ class HRCSSegmentation { for (const auto& region_index : region_indices) { if (region_index.indices.size() > 1000) { - for (std::size_t j = 0; j < region_index.indices.size(); j++) { - pcl::PointXYZ ground_pt((*cloud)[region_index.indices[j]].x, - (*cloud)[region_index.indices[j]].y, - (*cloud)[region_index.indices[j]].z); + for (int index : region_index.indices) { + pcl::PointXYZ ground_pt( + (*cloud)[index].x, (*cloud)[index].y, (*cloud)[index].z); ground_cloud->points.push_back(ground_pt); - (*ground_image)[region_index.indices[j]].g = static_cast( - ((*cloud)[region_index.indices[j]].g + 255) / 2); - (*label_image)[region_index.indices[j]].r = 0; - (*label_image)[region_index.indices[j]].g = 255; - (*label_image)[region_index.indices[j]].b = 0; + (*ground_image)[index].g = + static_cast(((*cloud)[index].g + 255) / 2); + (*label_image)[index].r = 0; + (*label_image)[index].g = 255; + (*label_image)[index].b = 0; } // Compute plane info @@ -346,21 +345,19 @@ class HRCSSegmentation { pcl::PointCloud extended_ground_cloud; for (const auto& region_index : region_indices) { if (region_index.indices.size() > 1000) { - for (std::size_t j = 0; j < region_index.indices.size(); j++) { + for (int index : region_index.indices) { // Check to see if it has already been labeled - if ((*ground_image)[region_index.indices[j]].g == - (*ground_image)[region_index.indices[j]].b) { - pcl::PointXYZ ground_pt((*cloud)[region_index.indices[j]].x, - (*cloud)[region_index.indices[j]].y, - (*cloud)[region_index.indices[j]].z); + if ((*ground_image)[index].g == (*ground_image)[index].b) { + pcl::PointXYZ ground_pt( + (*cloud)[index].x, (*cloud)[index].y, (*cloud)[index].z); ground_cloud->points.push_back(ground_pt); - (*ground_image)[region_index.indices[j]].r = static_cast( - ((*cloud)[region_index.indices[j]].r + 255) / 2); - (*ground_image)[region_index.indices[j]].g = static_cast( - ((*cloud)[region_index.indices[j]].g + 255) / 2); - (*label_image)[region_index.indices[j]].r = 128; - (*label_image)[region_index.indices[j]].g = 128; - (*label_image)[region_index.indices[j]].b = 0; + (*ground_image)[index].r = + static_cast(((*cloud)[index].r + 255) / 2); + (*ground_image)[index].g = + static_cast(((*cloud)[index].g + 255) / 2); + (*label_image)[index].r = 128; + (*label_image)[index].g = 128; + (*label_image)[index].b = 0; } } } @@ -425,11 +422,11 @@ class HRCSSegmentation { if ((ptp_dist > 0.5) && (ptp_dist < 3.0)) { - for (std::size_t j = 0; j < euclidean_label_index.indices.size(); j++) { - (*ground_image)[euclidean_label_index.indices[j]].r = 255; - (*label_image)[euclidean_label_index.indices[j]].r = 255; - (*label_image)[euclidean_label_index.indices[j]].g = 0; - (*label_image)[euclidean_label_index.indices[j]].b = 0; + for (int index : euclidean_label_index.indices) { + (*ground_image)[index].r = 255; + (*label_image)[index].r = 255; + (*label_image)[index].g = 0; + (*label_image)[index].b = 0; } } } diff --git a/geometry/include/pcl/geometry/impl/polygon_operations.hpp b/geometry/include/pcl/geometry/impl/polygon_operations.hpp index 585ba6ae93f..de12bad1955 100644 --- a/geometry/include/pcl/geometry/impl/polygon_operations.hpp +++ b/geometry/include/pcl/geometry/impl/polygon_operations.hpp @@ -218,7 +218,7 @@ pcl::approximatePolygon2D(const typename pcl::PointCloud::VectorType& po covariance.coeffRef(2) = covariance.coeff(1); - float norm = 1.0f / float(num_points); + float norm = 1.0f / static_cast(num_points); centroid *= norm; covariance *= norm; covariance.coeffRef(0) -= centroid[0] * centroid[0]; @@ -235,7 +235,7 @@ pcl::approximatePolygon2D(const typename pcl::PointCloud::VectorType& po direction[1] = polygon[result[nIdx]].y - polygon[result[rIdx]].y; direction.normalize(); - if (std::abs(direction.dot(normal)) > float(M_SQRT1_2)) { + if (std::abs(direction.dot(normal)) > static_cast(M_SQRT1_2)) { std::swap(normal[0], normal[1]); normal[0] = -normal[0]; } @@ -289,9 +289,7 @@ pcl::approximatePolygon2D(const typename pcl::PointCloud::VectorType& po } else { // we have a new polygon in results, but inverted (clockwise <-> counter-clockwise) - for (std::vector::reverse_iterator it = result.rbegin(); - it != result.rend(); - ++it) + for (auto it = result.rbegin(); it != result.rend(); ++it) approx_polygon.push_back(polygon[*it]); } } diff --git a/keypoints/include/pcl/keypoints/harris_2d.h b/keypoints/include/pcl/keypoints/harris_2d.h index 5305d4f0eaf..3e5b109373c 100644 --- a/keypoints/include/pcl/keypoints/harris_2d.h +++ b/keypoints/include/pcl/keypoints/harris_2d.h @@ -77,15 +77,14 @@ namespace pcl */ HarrisKeypoint2D (ResponseMethod method = HARRIS, int window_width = 3, int window_height = 3, int min_distance = 5, float threshold = 0.0) : threshold_ (threshold) - , refine_ (false) - , nonmax_ (true) - , method_ (method) - , threads_ (0) - , response_ (new pcl::PointCloud ()) + , + method_ (method) + , + response_ (new pcl::PointCloud ()) , window_width_ (window_width) , window_height_ (window_height) - , skipped_pixels_ (0) - , min_distance_ (min_distance) + , + min_distance_ (min_distance) { name_ = "HarrisKeypoint2D"; } @@ -156,13 +155,13 @@ namespace pcl /// threshold for non maxima suppression float threshold_; /// corner refinement - bool refine_; + bool refine_{false}; /// non maximas suppression - bool nonmax_; + bool nonmax_{true}; /// cornerness computation method ResponseMethod method_; /// number of threads to be used - unsigned int threads_; + unsigned int threads_{0}; private: Eigen::MatrixXf derivatives_rows_; @@ -184,7 +183,7 @@ namespace pcl /// half window height int half_window_height_; /// number of pixels to skip within search window - int skipped_pixels_; + int skipped_pixels_{0}; /// minimum distance between two keypoints int min_distance_; /// intensity field accessor diff --git a/keypoints/include/pcl/keypoints/impl/harris_2d.hpp b/keypoints/include/pcl/keypoints/impl/harris_2d.hpp index fa8da44a169..0c9905f8da9 100644 --- a/keypoints/include/pcl/keypoints/impl/harris_2d.hpp +++ b/keypoints/include/pcl/keypoints/impl/harris_2d.hpp @@ -43,6 +43,8 @@ #include +#include + namespace pcl { @@ -472,7 +474,7 @@ HarrisKeypoint2D::responseTomasi (PointCloudOut { computeSecondMomentMatrix (index, covar); // min egenvalue - out_point.intensity = ((covar[0] + covar[2] - sqrt((covar[0] - covar[2])*(covar[0] - covar[2]) + 4 * covar[1] * covar[1])) /2.0f); + out_point.intensity = ((covar[0] + covar[2] - std::sqrt((covar[0] - covar[2])*(covar[0] - covar[2]) + 4 * covar[1] * covar[1])) /2.0f); } } diff --git a/recognition/include/pcl/recognition/crh_alignment.h b/recognition/include/pcl/recognition/crh_alignment.h index a8853e6f57d..3cec516a434 100644 --- a/recognition/include/pcl/recognition/crh_alignment.h +++ b/recognition/include/pcl/recognition/crh_alignment.h @@ -170,7 +170,7 @@ namespace pcl translation2 (2, 3) = centroid_input_[2] - centr[2]; Eigen::Matrix4f resultHom (translation2 * rollHomMatrix); - transforms_.push_back(resultHom.inverse()); + transforms_.emplace_back(resultHom.inverse()); } } @@ -194,7 +194,7 @@ namespace pcl int peak_distance = 5; int cutoff = nbins_ - 1; - kiss_fft_cpx * multAB = new kiss_fft_cpx[nr_bins_after_padding]; + auto * multAB = new kiss_fft_cpx[nr_bins_after_padding]; for (int i = 0; i < nr_bins_after_padding; i++) multAB[i].r = multAB[i].i = 0.f; @@ -221,7 +221,7 @@ namespace pcl multAB[nbins_ - 1].r = input_ftt_negate[0].histogram[nbins_ - 1] * target_ftt[0].histogram[nbins_ - 1]; kiss_fft_cfg mycfg = kiss_fft_alloc (nr_bins_after_padding, 1, nullptr, nullptr); - kiss_fft_cpx * invAB = new kiss_fft_cpx[nr_bins_after_padding]; + auto * invAB = new kiss_fft_cpx[nr_bins_after_padding]; kiss_fft (mycfg, multAB, invAB); std::vector < std::pair > scored_peaks (nr_bins_after_padding); diff --git a/segmentation/include/pcl/segmentation/euclidean_cluster_comparator.h b/segmentation/include/pcl/segmentation/euclidean_cluster_comparator.h index 67592875996..e3b0892d507 100644 --- a/segmentation/include/pcl/segmentation/euclidean_cluster_comparator.h +++ b/segmentation/include/pcl/segmentation/euclidean_cluster_comparator.h @@ -155,11 +155,11 @@ namespace pcl const std::uint32_t &label1 = (*labels_)[idx1].label; const std::uint32_t &label2 = (*labels_)[idx2].label; - const std::set::const_iterator it1 = exclude_labels_->find (label1); + const auto it1 = exclude_labels_->find (label1); if (it1 == exclude_labels_->end ()) return false; - const std::set::const_iterator it2 = exclude_labels_->find (label2); + const auto it2 = exclude_labels_->find (label2); if (it2 == exclude_labels_->end ()) return false; } diff --git a/tracking/include/pcl/tracking/hsv_color_coherence.h b/tracking/include/pcl/tracking/hsv_color_coherence.h index 5d444db9407..c0ca4cb062e 100644 --- a/tracking/include/pcl/tracking/hsv_color_coherence.h +++ b/tracking/include/pcl/tracking/hsv_color_coherence.h @@ -20,13 +20,7 @@ class HSVColorCoherence : public PointCoherence { /** \brief initialize the weights of the computation. weight_, h_weight_, s_weight_ * default to 1.0 and v_weight_ defaults to 0.0. */ - HSVColorCoherence() - : PointCoherence() - , weight_(1.0) - , h_weight_(1.0) - , s_weight_(1.0) - , v_weight_(0.0) - {} + HSVColorCoherence() : PointCoherence() {} /** \brief set the weight of coherence * \param[in] weight the weight of coherence. @@ -101,16 +95,16 @@ class HSVColorCoherence : public PointCoherence { computeCoherence(PointInT& source, PointInT& target) override; /** \brief the weight of coherence (w) */ - double weight_; + double weight_{1.0}; /** \brief the hue weight (w_h) */ - double h_weight_; + double h_weight_{1.0}; /** \brief the saturation weight (w_s) */ - double s_weight_; + double s_weight_{1.0}; /** \brief the value weight (w_v) */ - double v_weight_; + double v_weight_{0.0}; }; } // namespace tracking } // namespace pcl diff --git a/tracking/include/pcl/tracking/impl/pyramidal_klt.hpp b/tracking/include/pcl/tracking/impl/pyramidal_klt.hpp index 29d0fc9b6f8..105e03832d4 100644 --- a/tracking/include/pcl/tracking/impl/pyramidal_klt.hpp +++ b/tracking/include/pcl/tracking/impl/pyramidal_klt.hpp @@ -196,7 +196,7 @@ PyramidalKLTTracker::derivatives(const FloatImage& src, ++trow0; float* trow1 = row1; ++trow1; - const float* src_ptr = &(src[0]); + const float* src_ptr = src.data(); for (int y = 0; y < height; y++) { const float* srow0 = src_ptr + (y > 0 ? y - 1 : height > 1 ? 1 : 0) * width; @@ -486,9 +486,9 @@ PyramidalKLTTracker::spatialGradient( covariance.setZero(); for (int y = 0; y < track_height_; y++) { - const float* img_ptr = &(img[0]) + (y + location[1]) * step + location[0]; - const float* grad_x_ptr = &(grad_x[0]) + (y + location[1]) * step + location[0]; - const float* grad_y_ptr = &(grad_y[0]) + (y + location[1]) * step + location[0]; + const float* img_ptr = img.data() + (y + location[1]) * step + location[0]; + const float* grad_x_ptr = grad_x.data() + (y + location[1]) * step + location[0]; + const float* grad_y_ptr = grad_y.data() + (y + location[1]) * step + location[0]; float* win_ptr = win.data() + y * win.cols(); float* grad_x_win_ptr = grad_x_win.data() + y * grad_x_win.cols(); @@ -527,7 +527,7 @@ PyramidalKLTTracker::mismatchVector( const int step = next.width; b.setZero(); for (int y = 0; y < track_height_; y++) { - const float* next_ptr = &(next[0]) + (y + location[1]) * step + location[0]; + const float* next_ptr = next.data() + (y + location[1]) * step + location[0]; const float* prev_ptr = prev.data() + y * prev.cols(); const float* prev_grad_x_ptr = prev_grad_x.data() + y * prev_grad_x.cols(); const float* prev_grad_y_ptr = prev_grad_y.data() + y * prev_grad_y.cols(); @@ -587,9 +587,9 @@ PyramidalKLTTracker::track( iprev_point[1] = std::floor(prev_pt[1]); if (iprev_point[0] < -track_width_ || - (std::uint32_t)iprev_point[0] >= grad_x.width || + static_cast(iprev_point[0]) >= grad_x.width || iprev_point[1] < -track_height_ || - (std::uint32_t)iprev_point[1] >= grad_y.height) { + static_cast(iprev_point[1]) >= grad_y.height) { if (level == 0) status[ptidx] = -1; continue; @@ -633,8 +633,10 @@ PyramidalKLTTracker::track( for (unsigned int j = 0; j < max_iterations_; j++) { Eigen::Array2i inext_pt = next_pt.floor().cast(); - if (inext_pt[0] < -track_width_ || (std::uint32_t)inext_pt[0] >= next.width || - inext_pt[1] < -track_height_ || (std::uint32_t)inext_pt[1] >= next.height) { + if (inext_pt[0] < -track_width_ || + static_cast(inext_pt[0]) >= next.width || + inext_pt[1] < -track_height_ || + static_cast(inext_pt[1]) >= next.height) { if (level == 0) status[ptidx] = -1; break; @@ -679,9 +681,9 @@ PyramidalKLTTracker::track( inext_point[1] = std::floor(next_point[1]); if (inext_point[0] < -track_width_ || - (std::uint32_t)inext_point[0] >= next.width || + static_cast(inext_point[0]) >= next.width || inext_point[1] < -track_height_ || - (std::uint32_t)inext_point[1] >= next.height) { + static_cast(inext_point[1]) >= next.height) { status[ptidx] = -1; continue; } diff --git a/tracking/include/pcl/tracking/pyramidal_klt.h b/tracking/include/pcl/tracking/pyramidal_klt.h index d5b44908355..bd651e30f92 100644 --- a/tracking/include/pcl/tracking/pyramidal_klt.h +++ b/tracking/include/pcl/tracking/pyramidal_klt.h @@ -85,8 +85,6 @@ class PyramidalKLTTracker : public Tracker { , nb_levels_(nb_levels) , track_width_(tracking_window_width) , track_height_(tracking_window_height) - , threads_(0) - , initialized_(false) { tracker_name_ = "PyramidalKLTTracker"; accuracy_ = 0.1; @@ -418,11 +416,11 @@ class PyramidalKLTTracker : public Tracker { float epsilon_; float max_residue_; /** \brief number of hardware threads */ - unsigned int threads_; + unsigned int threads_{0}; /** \brief intensity accessor */ IntensityT intensity_; /** \brief is the tracker initialized ? */ - bool initialized_; + bool initialized_{false}; /** \brief compute transformation from successfully tracked points */ pcl::TransformationFromCorrespondences transformation_computer_; /** \brief computed transformation between tracked points */