/**
 * 车厢划分管理引擎
 * */

#ifndef TRAINPARATIONMGR_H
#define TRAINPARATIONMGR_H

#include "AppCommon.h"
#include "MyYaml.h"
#include "myutils.h"
#include "EngineBase.h"
#include "EngineFactory.h"

class TrainParationMgr : public ai_matrix::EngineBase
{
public:
    TrainParationMgr();
    ~TrainParationMgr();

    APP_ERROR Init() override;
    APP_ERROR DeInit() override;
    APP_ERROR Process() override;

private:
    //参数初始化
    void InitParam();
    std::vector<PartionInfo> lstPartInfo;           //当前车次车厢划分结果
    int nFrameRate;                                 //相机帧率
    std::string strResultPath_;
    int nTailPixOffset;

    std::string strPort0_;
    std::string strPort1_;
    ai_matrix::DataSourceConfig mainCfg_;   //主摄像头配置信息

    int getTailPixOffset();                                         //计算尾部车钩在图片的x坐标(预测的计算值非实际值)
    int getCouplerOffsetPosition(float fspeed, int nframeindex);    //计算车钩在图片的x坐标(预测的计算值非实际值)
    int getCouplerOffsetPix(float fspeed, int noffsetPix);
    int getOffsetFrame(float fspeed, int width, int nFrameRate);

};

ENGINE_REGIST(TrainParationMgr)

#endif
