109 lines
3.0 KiB
C++
109 lines
3.0 KiB
C++
#ifndef IYRODWELDSEAMSTATUS_H
|
||
#define IYRODWELDSEAMSTATUS_H
|
||
|
||
#include <string>
|
||
#include <functional>
|
||
#include <vector>
|
||
#include <QImage>
|
||
#include <QMetaType>
|
||
|
||
// 使用 AppCommon 提供的通用接口和类型
|
||
#include "IVisionApplicationStatus.h"
|
||
|
||
// 焊缝信息结构体
|
||
struct WeldSeamInfo {
|
||
// 焊点类型 (0=UNKNOWN, 1=POINT, 2=SEAM, 3=SEAM_GAP)
|
||
int weldType = 0;
|
||
|
||
// 焊缝的中心点
|
||
double centerX = 0.0;
|
||
double centerY = 0.0;
|
||
double centerZ = 0.0;
|
||
|
||
// 轴向方向
|
||
double axialDirX = 0.0;
|
||
double axialDirY = 0.0;
|
||
double axialDirZ = 0.0;
|
||
|
||
// 法向方向
|
||
double normalDirX = 0.0;
|
||
double normalDirY = 0.0;
|
||
double normalDirZ = 0.0;
|
||
|
||
// 起点
|
||
double startPtX = 0.0;
|
||
double startPtY = 0.0;
|
||
double startPtZ = 0.0;
|
||
|
||
// 终点
|
||
double endPtX = 0.0;
|
||
double endPtY = 0.0;
|
||
double endPtZ = 0.0;
|
||
|
||
// 3D点
|
||
struct Pt3D { double x = 0.0, y = 0.0, z = 0.0; };
|
||
|
||
// 焊缝中心线采样点
|
||
std::vector<Pt3D> centerPts;
|
||
// 焊缝边缘1采样点
|
||
std::vector<Pt3D> edgePts_0;
|
||
// 焊缝边缘2采样点
|
||
std::vector<Pt3D> edgePts_1;
|
||
|
||
// 默认构造函数
|
||
WeldSeamInfo() = default;
|
||
|
||
// 拷贝构造函数和赋值运算符
|
||
WeldSeamInfo(const WeldSeamInfo&) = default;
|
||
WeldSeamInfo& operator=(const WeldSeamInfo&) = default;
|
||
};
|
||
|
||
// 焊缝位置结构体(继承自 PositionData 模板)
|
||
struct WeldSeamPosition : public PositionData<double> {
|
||
// 默认构造函数
|
||
WeldSeamPosition() : PositionData<double>() {}
|
||
|
||
// 带参构造函数
|
||
WeldSeamPosition(double _x, double _y, double _z, double _roll, double _pitch, double _yaw)
|
||
: PositionData<double>(_x, _y, _z, _roll, _pitch, _yaw) {}
|
||
|
||
// 拷贝构造函数和赋值运算符
|
||
WeldSeamPosition(const WeldSeamPosition&) = default;
|
||
WeldSeamPosition& operator=(const WeldSeamPosition&) = default;
|
||
|
||
// 从 PositionData 拷贝构造
|
||
WeldSeamPosition(const PositionData<double>& pos)
|
||
: PositionData<double>(pos) {}
|
||
};
|
||
|
||
// 检测结果结构体(继承自 DetectionResultData 模板)
|
||
struct DetectionResult : public DetectionResultData<WeldSeamPosition> {
|
||
// 焊缝信息列表
|
||
std::vector<WeldSeamInfo> weldSeamInfoList;
|
||
|
||
// 额外的结果信息
|
||
bool success = true; // 是否成功
|
||
QString message = "检测成功"; // 结果消息
|
||
|
||
// 默认构造函数
|
||
DetectionResult() = default;
|
||
|
||
// 拷贝构造函数和赋值运算符
|
||
DetectionResult(const DetectionResult&) = default;
|
||
DetectionResult& operator=(const DetectionResult&) = default;
|
||
};
|
||
|
||
// 状态回调接口(继承自 IVisionApplicationStatus 模板)
|
||
class IYRodWeldSeamStatus : public IVisionApplicationStatus<DetectionResult>
|
||
{
|
||
public:
|
||
virtual ~IYRodWeldSeamStatus() = default;
|
||
};
|
||
|
||
// 声明Qt元类型,使这些结构体能够在信号槽中传递
|
||
Q_DECLARE_METATYPE(WeldSeamInfo)
|
||
Q_DECLARE_METATYPE(WeldSeamPosition)
|
||
Q_DECLARE_METATYPE(DetectionResult)
|
||
|
||
#endif // IYRODWELDSEAMSTATUS_H
|