50 lines
1.5 KiB
C++
50 lines
1.5 KiB
C++
#ifndef ICLOUDSHOW_H
|
||
#define ICLOUDSHOW_H
|
||
|
||
#include "CloudShow_global.h"
|
||
|
||
#include <pcl/point_types.h>
|
||
#include <pcl/point_cloud.h>
|
||
|
||
#include <memory>
|
||
#include <string>
|
||
|
||
class CLOUDSHOW_EXPORT ICloudShow
|
||
{
|
||
public:
|
||
using PointCloudPtr = pcl::PointCloud<pcl::PointXYZI>::ConstPtr;
|
||
|
||
virtual ~ICloudShow() = default;
|
||
|
||
/// 工厂方法
|
||
static std::unique_ptr<ICloudShow> Create();
|
||
|
||
/// 单次显示:弹出窗口,按 intensity 着色,阻塞直到关闭窗口
|
||
virtual int Show(PointCloudPtr cloud, const std::string& windowName = "PointCloud") = 0;
|
||
|
||
/// 连续显示:非阻塞启动后台渲染线程
|
||
virtual int Start(const std::string& windowName = "PointCloud") = 0;
|
||
|
||
/// 更新当前窗口中的点云(连续模式,替换而非叠加)
|
||
virtual int UpdateCloud(PointCloudPtr cloud) = 0;
|
||
|
||
/// 停止连续显示
|
||
virtual int Stop() = 0;
|
||
|
||
/// 消费待更新点云并驱动一次渲染事件(必须与 Start 同线程调用)
|
||
virtual int SpinOnce(int ms = 1) = 0;
|
||
|
||
/// 是否正在连续显示
|
||
virtual bool IsRunning() const = 0;
|
||
|
||
/// 键盘状态查询(PCL 窗口回调设置,主线程轮询)
|
||
virtual bool IsQuitRequested() const = 0;
|
||
virtual bool IsSaveRequested() const = 0;
|
||
virtual void ClearSaveRequest() = 0;
|
||
|
||
/// 保存为 TXT(兼容 LaserDataLoader::DebugSaveLaser 格式)
|
||
virtual int SaveToTxt(const std::string& fileName, PointCloudPtr cloud) = 0;
|
||
};
|
||
|
||
#endif // ICLOUDSHOW_H
|