package com.mvc.model.aihcxd;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 压力表服务侧识别的输入对象
 */
public class PgInModel {
    public int cishu;//测试使用的变量，代表目录中的第几张图片
    public String tsetBegin_time;//测试使用的变量，代表这一次运行的时间
    private static Logger PgLogger = LoggerFactory.getLogger(PgInModel.class);//输出日志log的类
    //
    private String imagePath;//输入图像路径
    private String outputPath;//图像输出路径
    //
    private int numNumbers;//水表数字个数，这里用成整数部分了
    private double numberUnit;//水表最后一个数字单位
    private String meterDiameter;//水表口径
    private double lastOkValue;//最近一次的可靠值

    private double RANGE_MIN;//最近一次的可靠值
    private double RANGE_MAX;//最近一次的可靠值
    private double SYS_CORRECT_VALUE;//最近一次的可靠值

    public String getLastOkValueStr() {
        return lastOkValueStr;
    }

    public void setLastOkValueStr(String lastOkValueStr) {
        this.lastOkValueStr = lastOkValueStr;
    }

    private String lastOkValueStr;//最近一次的可靠值,qjz
    private String lastOkValueTime;//最近一次可靠值的识别时间
    private boolean isUseConfig;//预测时是否用用户配置的 旋转角度、数字区域信息

    private int[][] lastDebugInfo;//AI调试信息，值域是 0-255

    private int meterFontStyle;//液晶屏中数字字体风格：0=段码式不发光（黑字); 1=未使用; 2=未使用；



    private int configRotateAngle;//用户配置的旋转角度
    private int[] configNumberRegion;//用户配置的数字区域坐标，4个值，[xmin,ymin,xmax,ymax]，即upleft,downright的中心点的四个坐标

    private int manualConfigLevel;//手动配置参数使用级别，0为低级，当识别不到且才查看是否有手动配置参数，有则使用；1为优先使用手动配置参数进行识别

    public String getImagePath() {
        return imagePath;
    }

    public void setImagePath(String imagePath) {
        this.imagePath = imagePath;
    }

    public String getOutputPath() {
        return outputPath;
    }

    public void setOutputPath(String outputPath) {
        this.outputPath = outputPath;
    }

    public int getNumNumbers() {
        return numNumbers;
    }

    public void setNumNumbers(int numNumbers) {
        this.numNumbers = numNumbers;
    }

    public double getNumberUnit() {
        return numberUnit;
    }

    public void setNumberUnit(double numberUnit) {
        this.numberUnit = numberUnit;
    }

    public String getMeterDiameter() {
        return meterDiameter;
    }

    public void setMeterDiameter(String meterDiameter) {
        this.meterDiameter = meterDiameter;
    }


    public double getLastOkValue() {
        return lastOkValue;
    }

    public void setLastOkValue(double lastOkValue) {
        this.lastOkValue = lastOkValue;
    }

    public String getLastOkValueTime() {
        return lastOkValueTime;
    }

    public void setLastOkValueTime(String lastOkValueTime) {
        this.lastOkValueTime = lastOkValueTime;
    }

    public boolean getIsUseConfig() {return isUseConfig;}

    public void setIsUseConfig(boolean useConfig) {
        this.isUseConfig = useConfig;
    }

    public int getConfigRotateAngle() {
        return configRotateAngle;
    }

    public int[] getConfigNumberRegion() {
        return configNumberRegion;
    }

    public void setConfigRotateAngle(int configRotateAngle) {
        this.configRotateAngle = configRotateAngle;
    }

    public void setConfigNumberRegion(int i, int param_value) {
        this.configNumberRegion[i] = param_value;
    }

    public int getLastDebugInfo(int i, int j) {return this.lastDebugInfo[i][j];}

    public void setLastDebugInfo(int[][] lastDebugInfo) {
        this.lastDebugInfo = lastDebugInfo;
    }

    public void setMeterFontStyle(int meterFontStyle) {
        this.meterFontStyle = meterFontStyle;
    }

    public int getMeterFontStyle() {
        return meterFontStyle;
    }

    public double getRANGE_MIN() {return RANGE_MIN;}

    public double getRANGE_MAX() {return RANGE_MAX;}

    public void setSYS_CORRECT_VALUE(double SYS_CORRECT_VALUE) {this.SYS_CORRECT_VALUE = SYS_CORRECT_VALUE;}

    public double getSYS_CORRECT_VALUE() {return SYS_CORRECT_VALUE;}

    public void setRANGE_MIN(double RANGE_MIN) {this.RANGE_MIN = RANGE_MIN;}

    public void setRANGE_MAX(double RANGE_MAX) {this.RANGE_MAX = RANGE_MAX;}
    public void setmanualConfigLevel(int manualConfigLevel) {this.manualConfigLevel = manualConfigLevel;}

    public int getmanualConfigLevel() {return manualConfigLevel;}

    public PgInModel() {
        this.imagePath = "";//输入图像路径
        this.outputPath= "";//图像输出路径
        this.numNumbers=0;//水表数字个数
        this.numberUnit=0.0;//水表最后一个数字单位
        this.meterDiameter="";//水表口径
        this.lastOkValue=0.0;//最近一次的可靠值
        this.lastOkValueStr="";//最近一次的可靠值,qjz
        this.lastOkValueTime="";//最近一次可靠值的识别时间
        this.configRotateAngle= 0;//用户配置的旋转角度
        this.configNumberRegion=new int[]{0, 0, 0, 0, 0, 0};//用户配置的数字区域坐标，4个值，[xmin,ymin,xmax,ymax]
        this.lastDebugInfo = new int[][]{{888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888}, {888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888}};
        this.meterFontStyle = 0;
        this.RANGE_MIN = 0;
        this.RANGE_MAX = 1;
        this.SYS_CORRECT_VALUE = 0;
        this.manualConfigLevel=0;
    }

    /**
     * 将结果输出到logger文件中
     */
    public void loggerPgInModel()
    {
        PgLogger.info("****压力表检测，本次输入信息如下*************************************");
        PgLogger.info("输入水表图像路径 : {}",this.imagePath);
        PgLogger.info("输出图像路径 : {}",this.outputPath);
        PgLogger.info("水表数字个数 : {}",this.numNumbers);
        PgLogger.info("水表最后一个数字的单位 : {}",this.numberUnit);
        PgLogger.info("水表口径 : {}",this.meterDiameter);
        PgLogger.info("最近一次可靠值 : {}",this.lastOkValue);
        PgLogger.info("最近一次可靠值检测时间 : {}",this.lastOkValueTime);
        PgLogger.info("用户配置的旋转角度和数字区域坐标生效吗 : {} ",this.getIsUseConfig());
        PgLogger.info("用户配置的旋转角度 : {} ",this.configRotateAngle);
        PgLogger.info("用户配置的数字区域坐标 : {},{},{},{},{},{}",this.configNumberRegion[0],this.configNumberRegion[1],this.configNumberRegion[2],this.configNumberRegion[3],this.configNumberRegion[4],this.configNumberRegion[5]);
        PgLogger.info("压力表最小值 : {} ",this.RANGE_MIN);
        PgLogger.info("压力表最大量程 : {} ",this.RANGE_MAX);
        PgLogger.info("压力表系统校正值 : {} ",this.SYS_CORRECT_VALUE);
        PgLogger.info("人工配置参数优先级 : {} ",this.manualConfigLevel);
        PgLogger.info("");
    }

    public String loggerPgInModel_toString()
    {
        StringBuffer return_string = new StringBuffer();

        return_string.append("\n****压力表检测，本次输入信息如下*************************************\n");
        return_string.append(String.format("输入图像路径 : %s\n",this.imagePath));
        return_string.append(String.format("输出图像路径 : %s\n",this.outputPath));
//        return_string.append(String.format("压力表数字个数 : %d\n",this.numNumbers));
        return_string.append(String.format("压力表读数精度 : %f\n",this.numberUnit));
//        return_string.append(String.format("水表口径 : %s\n",this.meterDiameter));
        return_string.append(String.format("量程最小值: %f\n",this.RANGE_MIN));
        return_string.append(String.format("量程最大值: %f\n",this.RANGE_MAX));
        return_string.append(String.format("用户配置的旋转角度和数字区域坐标生效吗 : %s\n",this.getIsUseConfig()));
        return_string.append(String.format("用户配置的旋转角度 :  %d\n",this.configRotateAngle));
        return_string.append(String.format("用户配置的数字区域坐标 : %d,%d,%d,%d,%d,%d\n",this.configNumberRegion[0],this.configNumberRegion[1],this.configNumberRegion[2],this.configNumberRegion[3],this.configNumberRegion[4],this.configNumberRegion[5]));

        return return_string.toString();
    }
}