43 lines
1.5 KiB
C++
43 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#include "Types.h"
|
|
#include <map>
|
|
|
|
// 单个试纸规格配置
|
|
struct PaperConfig {
|
|
PaperSpatialType type; // 试纸类型
|
|
BlockItems blockItems; // 联数
|
|
BigLocatorType locatorType; // 大定位块类型
|
|
int itemsNum; // 反应色块数量
|
|
int slicesNum; // 最小分割单位数量
|
|
double firstPos; // 第一个色块位置倍数
|
|
double step; // 步长倍数
|
|
double distTimes; // 定位块中心距离/试纸高度
|
|
double whBigRatio; // 大定位块宽高比
|
|
|
|
PaperConfig() : type(PaperSpatialType::PST_UNKNOWN),
|
|
blockItems(BlockItems::BI_14),
|
|
locatorType(BigLocatorType::BLT_SHORT),
|
|
itemsNum(0), slicesNum(0), firstPos(0),
|
|
step(0), distTimes(0), whBigRatio(0) {}
|
|
};
|
|
|
|
// 试纸配置管理器
|
|
class PaperConfigManager {
|
|
public:
|
|
static PaperConfigManager& getInstance();
|
|
|
|
const PaperConfig* getConfig(PaperSpatialType type) const;
|
|
PaperSpatialType matchConfig(double distRatio, double areaRatio,
|
|
BigLocatorType locatorType) const;
|
|
|
|
private:
|
|
PaperConfigManager();
|
|
PaperConfigManager(const PaperConfigManager&) = delete;
|
|
PaperConfigManager& operator=(const PaperConfigManager&) = delete;
|
|
|
|
void initConfigs();
|
|
|
|
std::map<PaperSpatialType, PaperConfig> configs_;
|
|
};
|