GrabBag/App/BeltTearing/BeltTearingConfig/Inc/IVrBeltTearingConfig.h

144 lines
3.6 KiB
C++

#ifndef IVRBELTTEARINGCONFIG_H
#define IVRBELTTEARINGCONFIG_H
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
/**
* @brief 项目类型枚举
*/
enum class BeltTearingProjectType
{
BeltTearing = 0, // 皮带撕裂检测
BeltMonitoring = 1, // 皮带监控
};
/**
* @brief 服务器信息结构
*/
struct ServerInfo
{
std::string name; // 服务器名称
std::string ip; // 服务器IP地址
int port; // 服务器端口
};
/**
* @brief 皮带撕裂检测参数 - 简化版本
*/
struct BeltTearingParam
{
double scanXScale = 1.0; // 3D扫描仪X方向标尺
double scanYScale = 1.0; // 3D扫描仪Y方向标尺
double differnceBinTh = 1.0; // 一层次分割阈值调整
double tearingMinLen = 5.0; // 最小撕裂长度
double tearingMinGap = 2.0; // 撕裂间距阈值
// 特征提取参数
double sameGapTh = 2.0; // 相同gap阈值
int gapChkWin = 5; // gap检查窗口
};
/**
* @brief 监控参数
*/
struct MonitoringParam
{
int checkInterval = 1000; // 检查间隔(毫秒)
double alertThreshold = 3.0; // 报警阈值
};
/**
* @brief 调试参数
*/
struct DebugParam
{
bool enableDebug = false; // 是否开启调试模式
bool saveDebugImage = false; // 是否保存调试图像
bool printDetailLog = false; // 是否打印详细日志
std::string debugOutputPath = ""; // 调试输出路径
};
/**
* @brief 算法参数配置结构
*/
struct BeltTearingAlgorithmParams
{
BeltTearingParam beltTearingParam; // 皮带撕裂检测参数
MonitoringParam monitoringParam; // 监控参数
};
/**
* @brief 配置加载结果
*/
struct BeltTearingConfigResult
{
std::vector<ServerInfo> servers; // 服务器列表
BeltTearingAlgorithmParams algorithmParams; // 算法参数
DebugParam debugParam; // 调试参数
BeltTearingProjectType projectType; // 项目类型
int serverPort = 5900; // 服务端端口
};
/**
* @brief 配置改变通知接口
*/
class IVrBeltTearingConfigChangeNotify
{
public:
virtual ~IVrBeltTearingConfigChangeNotify() {}
/**
* @brief 配置数据改变通知
* @param configResult 新的配置数据
*/
virtual void OnConfigChanged(const BeltTearingConfigResult& configResult) = 0;
};
/**
* @brief BeltTearingConfig接口类
*/
class IVrBeltTearingConfig
{
public:
/**
* @brief 虚析构函数
*/
virtual ~IVrBeltTearingConfig() = default;
/**
* @brief 创建实例
* @return 实例
*/
static bool CreateInstance(IVrBeltTearingConfig** ppVrConfig);
/**
* @brief 加载配置文件
* @param filePath 配置文件路径
* @return 加载的配置结果
*/
virtual BeltTearingConfigResult LoadConfig(const std::string& filePath) = 0;
/**
* @brief 保存配置文件
* @param filePath 配置文件路径
* @param configResult 配置结果
* @return 是否保存成功
*/
virtual bool SaveConfig(const std::string& filePath, BeltTearingConfigResult& configResult) = 0;
/**
* @brief 设置配置改变通知回调
* @param notify 通知接口指针
*/
virtual void SetConfigChangeNotify(IVrBeltTearingConfigChangeNotify* notify) = 0;
};
#endif // IVRBELTTEARINGCONFIG_H