GrabBag/Tools/CloudView/Inc/CloudViewMainWindow.h
2026-01-16 01:04:43 +08:00

168 lines
3.5 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef CLOUD_VIEW_MAIN_WINDOW_H
#define CLOUD_VIEW_MAIN_WINDOW_H
#include <QMainWindow>
#include <QWidget>
#include <QPushButton>
#include <QLabel>
#include <QListWidget>
#include <QGroupBox>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QSplitter>
#include <QFileDialog>
#include <QMessageBox>
#include <QStatusBar>
#include <QLineEdit>
#include <QRadioButton>
#include <memory>
#include "PointCloudGLWidget.h"
#include "PointCloudConverter.h"
/**
* @brief 点云查看器主窗口
* 左侧显示点云,右侧为操作区域
*/
class CloudViewMainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit CloudViewMainWindow(QWidget* parent = nullptr);
~CloudViewMainWindow() override;
private slots:
/**
* @brief 打开文件
*/
void onOpenFile();
/**
* @brief 清除所有点云
*/
void onClearAll();
/**
* @brief 重置视图
*/
void onResetView();
/**
* @brief 清除选中的点
*/
void onClearSelectedPoints();
/**
* @brief 清除选线
*/
void onClearLinePoints();
/**
* @brief 处理点选中事件
*/
void onPointSelected(const SelectedPointInfo& point);
/**
* @brief 处理两点选中事件(测距)
*/
void onTwoPointsSelected(const SelectedPointInfo& p1, const SelectedPointInfo& p2, float distance);
/**
* @brief 处理线选中事件
*/
void onLineSelected(const SelectedLineInfo& line);
/**
* @brief 通过输入线号选择线
*/
void onSelectLineByNumber();
/**
* @brief 选线模式切换(纵向/横向)
*/
void onLineSelectModeChanged(bool checked);
private:
/**
* @brief 初始化界面
*/
void setupUI();
/**
* @brief 创建左侧点云显示区域
*/
QWidget* createViewerArea();
/**
* @brief 创建右侧操作区域
*/
QWidget* createControlPanel();
/**
* @brief 创建文件操作组
*/
QGroupBox* createFileGroup();
/**
* @brief 创建选点测距组
*/
QGroupBox* createMeasureGroup();
/**
* @brief 创建选线拟合组
*/
QGroupBox* createLineGroup();
/**
* @brief 创建点云列表组
*/
QGroupBox* createCloudListGroup();
/**
* @brief 更新选点信息显示
*/
void updateSelectedPointsDisplay();
// 点云显示控件
PointCloudGLWidget* m_glWidget;
// 点云转换器
std::unique_ptr<PointCloudConverter> m_converter;
// 文件操作控件
QPushButton* m_btnOpenFile;
QPushButton* m_btnClearAll;
QPushButton* m_btnResetView;
// 选点测距控件
QPushButton* m_btnClearPoints;
QLabel* m_lblPoint1;
QLabel* m_lblPoint2;
QLabel* m_lblDistance;
// 选线拟合控件
QPushButton* m_btnClearLine;
QLineEdit* m_lineNumberInput;
QPushButton* m_btnSelectByNumber;
QRadioButton* m_rbVertical;
QRadioButton* m_rbHorizontal;
QLabel* m_lblLineIndex;
QLabel* m_lblLinePointCount;
// 点云列表
QListWidget* m_cloudList;
// 已加载的点云数量
int m_cloudCount;
// 当前点云的线信息(用于旋转)
int m_currentLineNum;
int m_currentLinePtNum;
// 原始完整点云数据包含0,0,0点用于旋转
PointCloudXYZ m_originalCloud;
};
#endif // CLOUD_VIEW_MAIN_WINDOW_H