Skip to content

Commit

Permalink
Enable Clang-Format on CI for ungrouped apps
Browse files Browse the repository at this point in the history
  • Loading branch information
Heiko Thiel authored and tin1254 committed Aug 10, 2021
1 parent cdde6f8 commit 2701de9
Show file tree
Hide file tree
Showing 24 changed files with 69 additions and 70 deletions.
2 changes: 1 addition & 1 deletion .dev/format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

format() {
# don't use a directory with whitespace
local whitelist="apps/3d_rec_framework apps/modeler 2d geometry ml octree simulation stereo tracking registration gpu/containers"
local whitelist="apps/3d_rec_framework apps/include apps/modeler apps/src 2d geometry ml octree simulation stereo tracking registration gpu/containers"

local PCL_DIR="${2}"
local formatter="${1}"
Expand Down
2 changes: 1 addition & 1 deletion apps/include/pcl/apps/impl/dominant_plane_segmentation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
*/

#include <pcl/filters/extract_indices.h> // for ExtractIndices
#include <pcl/memory.h> // for pcl::make_shared
#include <pcl/memory.h> // for pcl::make_shared

template <typename PointType>
void
Expand Down
1 change: 1 addition & 0 deletions apps/include/pcl/apps/nn_classification.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

#include <pcl/io/pcd_io.h>
#include <pcl/kdtree/kdtree_flann.h>

#include <cfloat> // for FLT_MAX

namespace pcl {
Expand Down
2 changes: 1 addition & 1 deletion apps/include/pcl/apps/openni_passthrough.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class OpenNIPassthrough : public QMainWindow {
protected:
void
refreshView();

pcl::visualization::PCLVisualizer::Ptr vis_;
pcl::OpenNIGrabber& grabber_;
std::string device_id_;
Expand Down
4 changes: 2 additions & 2 deletions apps/src/face_detection/filesystem_face_detection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ run(pcl::RFFaceDetectorTrainer& fdrf,

float rgb_m;
bool exists_m;
pcl::for_each_type<FieldListM>(pcl::CopyIfFieldExists<PointInT, float>(
(*scene_vis)[0], "rgb", exists_m, rgb_m));
pcl::for_each_type<FieldListM>(
pcl::CopyIfFieldExists<PointInT, float>((*scene_vis)[0], "rgb", exists_m, rgb_m));

std::cout << "Color exists:" << static_cast<int>(exists_m) << std::endl;
if (exists_m) {
Expand Down
7 changes: 2 additions & 5 deletions apps/src/grabcut_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,8 @@ GrabCutHelper::display(int display_type)
break;

case 1:
glDrawPixels(gmm_image_->width,
gmm_image_->height,
GL_RGB,
GL_FLOAT,
&((*gmm_image_)[0]));
glDrawPixels(
gmm_image_->width, gmm_image_->height, GL_RGB, GL_FLOAT, &((*gmm_image_)[0]));
break;

case 2:
Expand Down
20 changes: 10 additions & 10 deletions apps/src/manual_registration/manual_registration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,19 @@
* \author: Koen Buys - KU Leuven
*/

#include <ui_manual_registration.h>
#include <pcl/apps/manual_registration.h>
#include <pcl/io/pcd_io.h> // for loadPCDFile

#include <QApplication>
#include <QEvent>
#include <QMutexLocker>
#include <QObject>
#include <ui_manual_registration.h>

#include <vtkCamera.h>
#include <vtkGenericOpenGLRenderWindow.h>
#include <vtkRenderWindow.h>
#include <vtkRendererCollection.h>
#include <vtkGenericOpenGLRenderWindow.h>

using namespace pcl;

Expand All @@ -73,11 +73,12 @@ ManualRegistration::ManualRegistration()
auto renderer_src = vtkSmartPointer<vtkRenderer>::New();
auto renderWindow_src = vtkSmartPointer<vtkGenericOpenGLRenderWindow>::New();
renderWindow_src->AddRenderer(renderer_src);
vis_src_.reset(new pcl::visualization::PCLVisualizer(renderer_src, renderWindow_src, "", false));
vis_src_.reset(
new pcl::visualization::PCLVisualizer(renderer_src, renderWindow_src, "", false));
#else
vis_src_.reset(new pcl::visualization::PCLVisualizer("", false));
#endif // VTK_MAJOR_VERSION > 8
setRenderWindowCompat(*(ui_->qvtk_widget_src),*(vis_src_->getRenderWindow()));
setRenderWindowCompat(*(ui_->qvtk_widget_src), *(vis_src_->getRenderWindow()));
vis_src_->setupInteractor(getInteractorCompat(*(ui_->qvtk_widget_src)),
getRenderWindowCompat(*(ui_->qvtk_widget_src)));

Expand All @@ -92,23 +93,23 @@ ManualRegistration::ManualRegistration()
auto renderer_dst = vtkSmartPointer<vtkRenderer>::New();
auto renderWindow_dst = vtkSmartPointer<vtkGenericOpenGLRenderWindow>::New();
renderWindow_dst->AddRenderer(renderer_dst);
vis_dst_.reset(new pcl::visualization::PCLVisualizer(renderer_dst, renderWindow_dst, "", false));
vis_dst_.reset(
new pcl::visualization::PCLVisualizer(renderer_dst, renderWindow_dst, "", false));
#else
vis_dst_.reset(new pcl::visualization::PCLVisualizer("", false));
#endif // VTK_MAJOR_VERSION > 8
setRenderWindowCompat(*(ui_->qvtk_widget_dst), *(vis_dst_->getRenderWindow()));
vis_dst_->setupInteractor(getInteractorCompat(*(ui_->qvtk_widget_dst)),
getRenderWindowCompat(*(ui_->qvtk_widget_dst)));


vis_dst_->getInteractorStyle()->setKeyboardModifier(
pcl::visualization::INTERACTOR_KB_MOD_SHIFT);
pcl::visualization::INTERACTOR_KB_MOD_SHIFT);

vis_dst_->registerPointPickingCallback(&ManualRegistration::DstPointPickCallback,
*this);
// Render view
refreshView();

// Connect all buttons
connect(ui_->confirmSrcPointButton,
SIGNAL(clicked()),
Expand Down Expand Up @@ -176,8 +177,7 @@ ManualRegistration::confirmSrcPointPressed()
{
if (src_point_selected_) {
src_pc_.push_back(src_point_);
PCL_INFO("Selected %zu source points\n",
static_cast<std::size_t>(src_pc_.size()));
PCL_INFO("Selected %zu source points\n", static_cast<std::size_t>(src_pc_.size()));
src_point_selected_ = false;
src_pc_.width = src_pc_.size();
}
Expand Down
5 changes: 2 additions & 3 deletions apps/src/ni_agast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,8 @@ class AGASTDemo {

std::size_t j = 0;
for (std::size_t i = 0; i < keypoints->size(); ++i) {
const PointT& pt =
(*cloud)(static_cast<long unsigned int>((*keypoints)[i].u),
static_cast<long unsigned int>((*keypoints)[i].v));
const PointT& pt = (*cloud)(static_cast<long unsigned int>((*keypoints)[i].u),
static_cast<long unsigned int>((*keypoints)[i].v));
if (!std::isfinite(pt.x) || !std::isfinite(pt.y) || !std::isfinite(pt.z))
continue;

Expand Down
3 changes: 1 addition & 2 deletions apps/src/ni_brisk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,7 @@ class BRISKDemo {

std::size_t j = 0;
for (std::size_t i = 0; i < keypoints->size(); ++i) {
PointT pt =
bilinearInterpolation(cloud, (*keypoints)[i].x, (*keypoints)[i].y);
PointT pt = bilinearInterpolation(cloud, (*keypoints)[i].x, (*keypoints)[i].y);

keypoints3d[j].x = pt.x;
keypoints3d[j].y = pt.y;
Expand Down
3 changes: 2 additions & 1 deletion apps/src/openni_feature_persistence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ class OpenNIFeaturePersistence {
extract_indices_filter_.setIndices(feature_indices_);
extract_indices_filter_.filter(*feature_locations_);

PCL_INFO("Persistent feature locations %zu\n", static_cast<std::size_t>(feature_locations_->size()));
PCL_INFO("Persistent feature locations %zu\n",
static_cast<std::size_t>(feature_locations_->size()));

cloud_ = cloud;

Expand Down
2 changes: 1 addition & 1 deletion apps/src/openni_grab_frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class OpenNIGrabFrame {
{
FPS_CALC("I/O");
const std::string time = boost::posix_time::to_iso_string(
boost::posix_time::microsec_clock::local_time());
boost::posix_time::microsec_clock::local_time());
const std::string filepath = dir_name_ + '/' + file_name_ + '_' + time + ".pcd";

if (format_ & 1) {
Expand Down
1 change: 1 addition & 0 deletions apps/src/openni_klt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include <pcl/visualization/image_viewer.h>

#include <boost/date_time/posix_time/posix_time.hpp> // for to_iso_string, local_time

#include <mutex>

#define SHOW_FPS 1
Expand Down
2 changes: 1 addition & 1 deletion apps/src/openni_mls_smoothing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@
#include <pcl/console/parse.h>
#include <pcl/io/openni_camera/openni_driver.h>
#include <pcl/io/openni_grabber.h>
#include <pcl/search/kdtree.h> // for KdTree
#include <pcl/surface/mls.h>
#include <pcl/visualization/keyboard_event.h> // for KeyboardEvent
#include <pcl/visualization/pcl_visualizer.h> // for PCLVisualizer
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl/search/kdtree.h> // for KdTree

#include <mutex>

Expand Down
3 changes: 2 additions & 1 deletion apps/src/openni_octree_compression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,8 @@ main(int argc, char** argv)
if (bEnDecode) {
// ENCODING
std::ofstream compressedPCFile;
compressedPCFile.open(fileName.c_str(), std::ios::out | std::ios::trunc | std::ios::binary);
compressedPCFile.open(fileName.c_str(),
std::ios::out | std::ios::trunc | std::ios::binary);

if (!bShowInputCloud) {
EventHelper v(compressedPCFile, octreeCoder, field_name, min_v, max_v);
Expand Down
3 changes: 2 additions & 1 deletion apps/src/openni_organized_compression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,8 @@ main(int argc, char** argv)
if (bEnDecode) {
// ENCODING
std::ofstream compressedPCFile;
compressedPCFile.open(fileName.c_str(), std::ios::out | std::ios::trunc | std::ios::binary);
compressedPCFile.open(fileName.c_str(),
std::ios::out | std::ios::trunc | std::ios::binary);

if (!bShowInputCloud) {
EventHelper v(compressedPCFile,
Expand Down
19 changes: 10 additions & 9 deletions apps/src/openni_passthrough.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,17 @@
*
*/

#include <ui_openni_passthrough.h>

#include <pcl/apps/openni_passthrough.h>

#include <QApplication>
#include <QEvent>
#include <QMutexLocker>
#include <QObject>
#include <ui_openni_passthrough.h>

#include <vtkGenericOpenGLRenderWindow.h>
#include <vtkRenderWindow.h>
#include <vtkRendererCollection.h>
#include <vtkGenericOpenGLRenderWindow.h>

#include <thread>

Expand All @@ -64,7 +63,7 @@ OpenNIPassthrough::OpenNIPassthrough(pcl::OpenNIGrabber& grabber)
ui_->setupUi(this);

this->setWindowTitle("PCL OpenNI PassThrough Viewer");
//Create the QVTKWidget
// Create the QVTKWidget
#if VTK_MAJOR_VERSION > 8
auto renderer = vtkSmartPointer<vtkRenderer>::New();
auto renderWindow = vtkSmartPointer<vtkGenericOpenGLRenderWindow>::New();
Expand All @@ -73,11 +72,13 @@ OpenNIPassthrough::OpenNIPassthrough(pcl::OpenNIGrabber& grabber)
#else
vis_.reset(new pcl::visualization::PCLVisualizer("", false));
#endif // VTK_MAJOR_VERSION > 8
setRenderWindowCompat(*(ui_->qvtk_widget),*(vis_->getRenderWindow()));
vis_->setupInteractor(getInteractorCompat(*(ui_->qvtk_widget)), getRenderWindowCompat(*(ui_->qvtk_widget)));

vis_->getInteractorStyle()->setKeyboardModifier(pcl::visualization::INTERACTOR_KB_MOD_SHIFT);

setRenderWindowCompat(*(ui_->qvtk_widget), *(vis_->getRenderWindow()));
vis_->setupInteractor(getInteractorCompat(*(ui_->qvtk_widget)),
getRenderWindowCompat(*(ui_->qvtk_widget)));

vis_->getInteractorStyle()->setKeyboardModifier(
pcl::visualization::INTERACTOR_KB_MOD_SHIFT);

refreshView();

// Start the OpenNI data acquision
Expand Down
2 changes: 1 addition & 1 deletion apps/src/openni_tracking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ class OpenNISegmentTracking {
void
removeZeroPoints(const CloudConstPtr& cloud, Cloud& result)
{
for (const auto& point: *cloud) {
for (const auto& point : *cloud) {
if (!(std::abs(point.x) < 0.01 && std::abs(point.y) < 0.01 &&
std::abs(point.z) < 0.01) &&
!std::isnan(point.x) && !std::isnan(point.y) && !std::isnan(point.z))
Expand Down
14 changes: 7 additions & 7 deletions apps/src/organized_segmentation_demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
#include <QMutexLocker>
#include <QObject>

#include <vtkGenericOpenGLRenderWindow.h>
#include <vtkRenderWindow.h>
#include <vtkRendererCollection.h>
#include <vtkGenericOpenGLRenderWindow.h>

// #include <boost/filesystem.hpp> // for boost::filesystem::directory_iterator
#include <boost/signals2/connection.hpp> // for boost::signals2::connection
Expand Down Expand Up @@ -206,7 +206,7 @@ OrganizedSegmentationDemo::OrganizedSegmentationDemo(pcl::Grabber& grabber)
ui_->setupUi(this);

this->setWindowTitle("PCL Organized Connected Component Segmentation Demo");

#if VTK_MAJOR_VERSION > 8
auto renderer = vtkSmartPointer<vtkRenderer>::New();
auto renderWindow = vtkSmartPointer<vtkGenericOpenGLRenderWindow>::New();
Expand All @@ -215,14 +215,14 @@ OrganizedSegmentationDemo::OrganizedSegmentationDemo(pcl::Grabber& grabber)
#else
vis_.reset(new pcl::visualization::PCLVisualizer("", false));
#endif // VTK_MAJOR_VERSION > 8
setRenderWindowCompat(*(ui_->qvtk_widget),*(vis_->getRenderWindow()));
vis_->setupInteractor(getInteractorCompat(*(ui_->qvtk_widget)), getRenderWindowCompat(*(ui_->qvtk_widget)));

setRenderWindowCompat(*(ui_->qvtk_widget), *(vis_->getRenderWindow()));
vis_->setupInteractor(getInteractorCompat(*(ui_->qvtk_widget)),
getRenderWindowCompat(*(ui_->qvtk_widget)));

refreshView();

vis_->getInteractorStyle()->setKeyboardModifier(
pcl::visualization::INTERACTOR_KB_MOD_SHIFT);


std::function<void(const CloudConstPtr&)> f = [this](const CloudConstPtr& cloud) {
cloud_cb(cloud);
Expand Down
13 changes: 6 additions & 7 deletions apps/src/pcd_organized_multi_plane_segmentation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,12 @@ class PCDOrganizedMultiPlaneSegmentation {
"approx_plane_%02zu_%03zu",
static_cast<std::size_t>(i),
static_cast<std::size_t>(idx));
viewer.addLine(
(*approx_contour)[idx],
(*approx_contour)[(idx + 1) % approx_contour->size()],
0.5 * red[i],
0.5 * grn[i],
0.5 * blu[i],
name);
viewer.addLine((*approx_contour)[idx],
(*approx_contour)[(idx + 1) % approx_contour->size()],
0.5 * red[i],
0.5 * grn[i],
0.5 * blu[i],
name);
}
}
}
Expand Down
5 changes: 2 additions & 3 deletions apps/src/pcd_select_object_plane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,8 @@ class ObjectSelection {
exppd.setInputCloud(cloud);
exppd.setIndices(indices_but_the_plane);
exppd.setInputPlanarHull(plane_hull);
exppd.setViewPoint((*cloud)[picked_idx].x,
(*cloud)[picked_idx].y,
(*cloud)[picked_idx].z);
exppd.setViewPoint(
(*cloud)[picked_idx].x, (*cloud)[picked_idx].y, (*cloud)[picked_idx].z);
exppd.setHeightLimits(0.001, 0.5); // up to half a meter
exppd.segment(*points_above_plane);

Expand Down
15 changes: 8 additions & 7 deletions apps/src/pcd_video_player/pcd_video_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
*
*/

#include <ui_pcd_video_player.h>

#include <pcl/apps/pcd_video_player.h>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
Expand All @@ -49,11 +47,12 @@
#include <QMutexLocker>
#include <QObject>
#include <QRadioButton>
#include <ui_pcd_video_player.h>

#include <vtkCamera.h>
#include <vtkGenericOpenGLRenderWindow.h>
#include <vtkRenderWindow.h>
#include <vtkRendererCollection.h>
#include <vtkGenericOpenGLRenderWindow.h>

#include <fstream>
#include <iostream>
Expand Down Expand Up @@ -83,7 +82,7 @@ PCDVideoPlayer::PCDVideoPlayer()
// Setup the cloud pointer
cloud_.reset(new pcl::PointCloud<pcl::PointXYZRGBA>);

//Create the QVTKWidget
// Create the QVTKWidget
#if VTK_MAJOR_VERSION > 8
auto renderer = vtkSmartPointer<vtkRenderer>::New();
auto renderWindow = vtkSmartPointer<vtkGenericOpenGLRenderWindow>::New();
Expand All @@ -92,10 +91,12 @@ PCDVideoPlayer::PCDVideoPlayer()
#else
vis_.reset(new pcl::visualization::PCLVisualizer("", false));
#endif // VTK_MAJOR_VERSION > 8
setRenderWindowCompat(*(ui_->qvtk_widget),*(vis_->getRenderWindow()));
vis_->setupInteractor(getInteractorCompat(*(ui_->qvtk_widget)), getRenderWindowCompat(*(ui_->qvtk_widget)));
setRenderWindowCompat(*(ui_->qvtk_widget), *(vis_->getRenderWindow()));
vis_->setupInteractor(getInteractorCompat(*(ui_->qvtk_widget)),
getRenderWindowCompat(*(ui_->qvtk_widget)));

vis_->getInteractorStyle()->setKeyboardModifier(pcl::visualization::INTERACTOR_KB_MOD_SHIFT);
vis_->getInteractorStyle()->setKeyboardModifier(
pcl::visualization::INTERACTOR_KB_MOD_SHIFT);

refreshView();

Expand Down
Loading

0 comments on commit 2701de9

Please sign in to comment.