96 lines
2.6 KiB
C
96 lines
2.6 KiB
C
|
|
#ifndef IYRODANDBARPOSITIONSTATUS_H
|
|||
|
|
#define IYRODANDBARPOSITIONSTATUS_H
|
|||
|
|
|
|||
|
|
#include <string>
|
|||
|
|
#include <functional>
|
|||
|
|
#include <vector>
|
|||
|
|
#include <QImage>
|
|||
|
|
#include <QMetaType>
|
|||
|
|
|
|||
|
|
// 使用 AppCommon 提供的通用接口和类型
|
|||
|
|
#include "IVisionApplicationStatus.h"
|
|||
|
|
|
|||
|
|
// 棒材信息结构体
|
|||
|
|
struct RodInfo {
|
|||
|
|
// 棒材的中心点
|
|||
|
|
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;
|
|||
|
|
|
|||
|
|
// 默认构造函数
|
|||
|
|
RodInfo() = default;
|
|||
|
|
|
|||
|
|
// 拷贝构造函数和赋值运算符
|
|||
|
|
RodInfo(const RodInfo&) = default;
|
|||
|
|
RodInfo& operator=(const RodInfo&) = default;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
// 棒材位置结构体(继承自 PositionData 模板)
|
|||
|
|
struct RodPosition : public PositionData<double> {
|
|||
|
|
// 默认构造函数
|
|||
|
|
RodPosition() : PositionData<double>() {}
|
|||
|
|
|
|||
|
|
// 带参构造函数
|
|||
|
|
RodPosition(double _x, double _y, double _z, double _roll, double _pitch, double _yaw)
|
|||
|
|
: PositionData<double>(_x, _y, _z, _roll, _pitch, _yaw) {}
|
|||
|
|
|
|||
|
|
// 拷贝构造函数和赋值运算符
|
|||
|
|
RodPosition(const RodPosition&) = default;
|
|||
|
|
RodPosition& operator=(const RodPosition&) = default;
|
|||
|
|
|
|||
|
|
// 从 PositionData 拷贝构造
|
|||
|
|
RodPosition(const PositionData<double>& pos)
|
|||
|
|
: PositionData<double>(pos) {}
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
// 检测结果结构体(继承自 DetectionResultData 模板)
|
|||
|
|
struct DetectionResult : public DetectionResultData<RodPosition> {
|
|||
|
|
// 棒材信息列表
|
|||
|
|
std::vector<RodInfo> rodInfoList;
|
|||
|
|
|
|||
|
|
// 额外的结果信息
|
|||
|
|
bool success = true; // 是否成功
|
|||
|
|
QString message = "检测成功"; // 结果消息
|
|||
|
|
|
|||
|
|
// 默认构造函数
|
|||
|
|
DetectionResult() = default;
|
|||
|
|
|
|||
|
|
// 拷贝构造函数和赋值运算符
|
|||
|
|
DetectionResult(const DetectionResult&) = default;
|
|||
|
|
DetectionResult& operator=(const DetectionResult&) = default;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
// 状态回调接口(继承自 IVisionApplicationStatus 模板)
|
|||
|
|
class IYRodAndBarPositionStatus : public IVisionApplicationStatus<DetectionResult>
|
|||
|
|
{
|
|||
|
|
public:
|
|||
|
|
virtual ~IYRodAndBarPositionStatus() = default;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
// 声明Qt元类型,使这些结构体能够在信号槽中传递
|
|||
|
|
Q_DECLARE_METATYPE(RodInfo)
|
|||
|
|
Q_DECLARE_METATYPE(RodPosition)
|
|||
|
|
Q_DECLARE_METATYPE(DetectionResult)
|
|||
|
|
|
|||
|
|
#endif // IYRODANDBARPOSITIONSTATUS_H
|