#pragma once
#include <QAction>
#include <QCloseEvent>
#include <QColor>
#include <QComboBox>
#include <QDateTime>
#include <QDebug>
#include <QDesktopWidget>
#include <QFileDialog>
#include <QFontComboBox>
#include <QImage>
#include <QLabel>
#include <QMainWindow>
#include <QMenu>
#include <QMenuBar>
#include <QMessageBox>
#include <QProgressDialog>
#include <QRect>
#include <QSettings>
#include <QSpinBox>
#include <QString>
#include <QStringList>
#include <QTextCharFormat>
#include <QTime>
#include <QToolBar>
#include <QToolButton>
#include <QListWidgetItem>

#include <QApplication>
#include <QDateTime> //添加QDateTime头文件
#include <QMovie>
#include <QPixmap>
#include <QSplashScreen>
#include <QTextCodec>
#include <QtWidgets/QComboBox>

// Point Cloud Library
#include <QColorDialog>
#include <iostream>
#include <pcl/common/common.h>
#include <pcl/console/time.h> // TicToc
#include <pcl/console/time.h>
#include <pcl/filters/convolution_3d.h>
#include <pcl/filters/filter.h>
#include <pcl/filters/radius_outlier_removal.h>
#include <pcl/filters/statistical_outlier_removal.h>
#include <pcl/io/pcd_io.h>
#include <pcl/io/ply_io.h>
#include <pcl/kdtree/kdtree_flann.h>
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl/visualization/cloud_viewer.h>
#include <pcl/visualization/pcl_visualizer.h>

#include <boost/random.hpp> //随机数
#include <boost/thread/thread.hpp>
#include <iostream>
#include <pcl/console/time.h> // TicToc
#include <pcl/features/normal_3d.h>
#include <pcl/filters/bilateral.h>
#include <pcl/filters/extract_indices.h>
#include <pcl/filters/fast_bilateral.h>
#include <pcl/filters/fast_bilateral_omp.h>
#include <pcl/filters/passthrough.h>
#include <pcl/filters/voxel_grid.h>
#include <pcl/io/pcd_io.h>
#include <pcl/io/ply_io.h>
#include <pcl/kdtree/kdtree.h>
#include <pcl/kdtree/kdtree_flann.h>
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl/registration/ia_fpcs.h>  // 4PCS算法
#include <pcl/registration/ia_kfpcs.h> //K4PCS算法头文件
#include <pcl/registration/icp.h>
#include <pcl/registration/registration.h>
#include <pcl/search/flann_search.h>
#include <pcl/surface/concave_hull.h>
#include <pcl/surface/gp3.h> //贪婪投影三角化算法类定义的头文件
#include <pcl/surface/marching_cubes_hoppe.h> //移动立方体
#include <pcl/surface/marching_cubes_rbf.h>
#include <pcl/surface/mls.h>     //MLS
#include <pcl/surface/poisson.h> //泊松重建
#include <pcl/visualization/cloud_viewer.h>
#include <pcl/visualization/pcl_visualizer.h>
#include <string>
#include <vector>
#include <vtkOutputWindow.h>

#include <pcl/console/time.h>                   // TicToc
#include <pcl/filters/approximate_voxel_grid.h> // 体素滤波
#include <pcl/filters/voxel_grid.h>             // 体素滤波
#include <vtkOutputWindow.h>

#include <boost/thread/thread.hpp>
#include <pcl/ModelCoefficients.h>
#include <pcl/filters/extract_indices.h>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/sample_consensus/method_types.h> //随机参数估计方法
#include <pcl/sample_consensus/model_types.h>  //模型定义
#include <pcl/segmentation/sac_segmentation.h> //RANSAC分割
#include <pcl/visualization/pcl_visualizer.h>
#include <sstream>
#include <stdlib.h> //rand()头文件
#include <vtkMassProperties.h>
#include <vtkPLYReader.h>
#include <vtkSmartPointer.h>
#include <vtkTriangleFilter.h>

#include <Eigen/Core>
#include <iostream>
#include <pcl/common/common.h>
#include <pcl/common/transforms.h>
#include <pcl/features/moment_of_inertia_estimation.h>
#include <pcl/filters/voxel_grid.h>
#include <pcl/io/io.h>
#include <pcl/io/pcd_io.h>
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl/visualization/cloud_viewer.h>
#include <pcl/visualization/pcl_visualizer.h>
#include <string>
#include <string>
#include <vector>
#include <vtkAutoInit.h>
//可视化相关头文件
#include <vtkActor.h>
#include <vtkAutoInit.h>
#include <vtkInteractorStyleTrackballCamera.h>
#include <vtkPolyDataMapper.h>
#include <vtkProperty.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkRenderer.h>
// Boost
#include <boost/math/special_functions/round.hpp>

// Visualization Toolkit (VTK)
#include <vtkRenderWindow.h>
#include "BasePCL.h"
#include "PointCloudAlg.h"

// 工具窗口
#include  "ui_BilateralFilterWindows.h"
#include  "ui_MedianFilterWindows.h"

#include  "ui_RadiusOutlierRemovalWindows.h"
#include  "ui_StatisticalOutlierRemovalWindows.h"

#include  "ui_DialogTriangulationSurfaceMesh.h"
#include  "ui_PoissonReSurfaceWindows.h"
 

/////////////////////////////////////////////////////////////////////////////////////
// 公用方法
///////////////////////////////////////////////////////////////////////////////////
class ToolBaseFunClass:public QDialog
{
	Q_OBJECT // 每个子类必须使用这个宏
public:
	QLineEdit* lineEdit_savePath; 
	QComboBox* comboBox_clouldName;
	QPushButton* FileOpenpushButton;
	bool isok=false; // 是否执行
	bool saveOk = false;
public:
	ToolBaseFunClass(QWidget* parent = nullptr);
	~ToolBaseFunClass();
	int setComboBox(QComboBox* comboBox_clouldName);
	int setLineEdit(QLineEdit* lineEdit_savePath);
	int setPushButton(QPushButton* FileOpenpushButton);
	int bandingComboxAndPoint(QStringList itemvalues);
	QString getComboxSelect();
	bool isOK();
public slots:
	virtual void SaveFileButton();
	virtual void OKpushButton();
	virtual void CannelpushButton();
};


//////////////////////////////////////////////////////////////////////////////////////////
// 参数窗口
/////////////////////////////////////////////////////////////////////////////////////////

class BilateralFilterWindows : public ToolBaseFunClass
{
	Q_OBJECT // 每个子类必须使用这个宏
public:
	QString TaskXmlPath;
 
public:
	QString name;
public:
	BilateralFilterWindows(QWidget* parent = nullptr);
	~BilateralFilterWindows();

	// 执行操作
	QString ExcuteCmd(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr pointcloudPtr);

private:
	Ui::BilateralFilterWindowsDialog ui;
};




class MedianFilterWindows :  public ToolBaseFunClass
{
	Q_OBJECT // 每个子类必须使用这个宏
public:
	QString TaskXmlPath;
 
public:
	QString name;
public:
	MedianFilterWindows(QWidget* parent = nullptr);
	~MedianFilterWindows();
 
private:
	Ui::MedianFilterWindowsDialog ui;
};



class RadiusOutlierRemovalWindows :   public ToolBaseFunClass
{
	Q_OBJECT // 每个子类必须使用这个宏
public:
	QString TaskXmlPath;
 
public:
	QString name;
public:
	RadiusOutlierRemovalWindows(QWidget* parent = nullptr);
	~RadiusOutlierRemovalWindows();
 
private:
	Ui::RadiusOutlierRemovalWindowsDialog ui;
};


class StatisticalOutlierRemovalWindows :  public ToolBaseFunClass
{
	Q_OBJECT // 每个子类必须使用这个宏
public:
	QString TaskXmlPath;
 
public:
	QString name;
public:
	StatisticalOutlierRemovalWindows(QWidget* parent = nullptr);
	~StatisticalOutlierRemovalWindows();
 
private:
	Ui::StatisticalOutlierRemovalWindowsDialog ui;
};



class DialogTriangulationSurfaceMesh :   public ToolBaseFunClass
{
	Q_OBJECT // 每个子类必须使用这个宏
public:
	QString TaskXmlPath;
 
public:
	QString name;
public:
	DialogTriangulationSurfaceMesh(QWidget* parent = nullptr);
	~DialogTriangulationSurfaceMesh();
	// 执行操作
	QString ExcuteCmd(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr pointcloudPtr);
private:
	Ui::DialogTriangulationSurfaceMeshDialog ui;
public slots:
	void SaveFileSTLButton();
};



class PoissonReSurfaceWindows :  public ToolBaseFunClass
{
	Q_OBJECT // 每个子类必须使用这个宏
public:
	QString TaskXmlPath;
 
public:
	QString name;
public:
	PoissonReSurfaceWindows(QWidget* parent = nullptr);
	~PoissonReSurfaceWindows();
 
private:
	Ui::PoissonReSurfaceWindowsDialog ui;
};

