123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391 |
- #pragma once
- #include <string>
- #include <vector>
- #include <windows.h>
- namespace OnLineCard{
- //旋转角 枚举各旋转角
- enum class ROTATION{
- ROTATION_0 = 1,
- ROTATION_90 = 2,
- ROTATION_180 = 4,
- ROTATION_270 = 8
- };
- //顶点位移 枚举各顶点信息在数组中的偏移位置
- enum class VERTEX_OFFSET{
- LEFT_TOP = 0,
- LEFT_BOTTOM = 1,
- RIGHT_TOP = 2,
- RIGHT_BOTTOM = 3,
- };
- //方向位移 枚举各方向信息在数组中的偏移位置
- enum class DIR_OFFSET{
- DIR_OFFSET_UP = 0,
- DIR_OFFSET_DOWN = 1,
- DIR_OFFSET_LEFT = 2,
- DIR_OFFSET_RIGHT = 3
- };
- //方向标记
- enum class DIR_FLAG{
- DIR_FLAG_UP = 1,
- DIR_FLAG_DOWN = 2,
- DIR_FLAG_LEFT = 4,
- DIR_FLAG_RIGHT = 8
- };
- //主观题类型
- enum class QUESTION_SCORE_TYPE{
- SINGLE_SCORE,
- MUTIL_SCORE,
- MUTIL_SCORE2,
- MUTIL_SCORE3,//附加必做题
- MUTIL_SCORE4,//打分模式
- };
- //客观题输出类型
- enum class OMR_OUT_TYPE{
- OMR_OUT_TYPE_SINGLE_NONSTRICT_ERROR,// 输出一个或*号,若解析中有0个、2个或2个以上涂点被填涂,输出*号
- OMR_OUT_TYPE_SINGLE_NONSTRICT,// 输出一个,若解析中有2个或2个以上涂点被填涂,则从中选出一个作为该组结果
- OMR_OUT_TYPE_SINGLE_STRICT,// 输出一个,若解析中有2个或2个以上涂点被填涂,则认为用户多选,输出多选字符
- OMR_OUT_TYPE_MUTIL_STRICT,//输出多选字符
- OMR_OUT_TYPE_MUTIL_STRICT_EX,//不定项选择
- };
- struct SCHEMA_RECT_FIELD{
- int centerx;
- int centery;
- int width;
- int height;
- };
- struct KEGUANTI_QUESTION_LOCATEPOINT_INDEX{
- int indexs[4];
- int &operator[](int index){
- return indexs[index];
- }
- };
- struct question_basic{
- std::string question_code;
- int question_index;
- };
- struct SCHEMA_ELEMENT_FIELD :SCHEMA_RECT_FIELD{
- int index;
- };
- struct SchemaLocatePoint :SCHEMA_ELEMENT_FIELD{//定位点
- };
- struct SchemaLocateArea :SCHEMA_ELEMENT_FIELD{//区域定位点
- };
- struct SchemaLoacteCross :SCHEMA_ELEMENT_FIELD{//交叉点定位
- };
- struct SchemaCode :SCHEMA_ELEMENT_FIELD{//条码、二维码
- int nQrOrBar;
- bool isXuanZhuan;
- std::string strContent;
- bool is_stu_id;
- };
- struct SchemaItem :SCHEMA_ELEMENT_FIELD{//填涂项
- //填涂项输出字符
- unsigned char OutChar;
- int keguanti_question_locate_point_index;
- };
- struct SchemaGroup :SCHEMA_ELEMENT_FIELD, question_basic{//填涂组
- //本组涂点涂点数量
- int itemCount;
- //记录本组涂点位置索引
- std::vector<int> itemIndex;
- //OMR 输出类型
- OMR_OUT_TYPE omr_out_type;
- };
- // 切割区域
- struct SchemaCutArea :SCHEMA_ELEMENT_FIELD{
- bool isfirst; //是否该题第一个区域
- std::string area_name; //裁切区域名称(当isfirst为真时有效)
- int iscut; //是否需要剪切
- int question_index;
- int marktype;
- };
- struct Pos
- {
- double x, y, w, h;
- Pos(double x = 0, double y = 0, double w = 0, double h = 0){ this->x = x; this->y = y; this->w = w; this->h = h; }
- };
- // 打分区域
- struct ScoreBox
- {
- int type; //类型 3: [2 ,4,5] 1: 1-16 2: 49/29(个位十位)
- int nCount; //题目个数 类型3专有
- std::vector<int> vctScore; //类型3专有
- int limit; //类型1 2 专有
- bool bPoint; //最后的格子是否代表0.5 true是 false 否
- bool bXuanZuoTi; //是否是选做题
- double maxsorce; //每个小题最大分值(没有小题就是0分)
- Pos pos;
- ScoreBox(){
- memset(&pos, 0, sizeof(Pos));
- type = 0; nCount = 1; limit = 0; bPoint = false; bXuanZuoTi = false;
- }
- };
- //题目分数
- struct SchemaQuestionScore :SCHEMA_ELEMENT_FIELD, question_basic{
- QUESTION_SCORE_TYPE type;
- struct Point{
- int x;
- int y;
- }lt, rt, lb, rb;
- //填涂框数量
- int count;
- int questionLocatePointIndex[4];
- int valid_option_count;
- // 附加题区域,暂定4个选项
- SchemaItem item[4];
- int countItemSelete; //要求选择个数
- int countNum; //选择总数
- int mintype;
- // 在线答题卡
- ScoreBox scoreBox;
- std::string question_code_all;
- std::string question_code_temp;
- };
- struct CLIP_RESULT{
- //在原试卷的位置
- //图像数据地址
- unsigned char* img_data;
- //图像数据大小
- unsigned long img_data_size;
- //编号
- int index;
- //区域名称
- char area_name[20];
- };
- struct RESULT_RECT{
- int x;
- int y;
- int width;
- int height;
- };
- struct RECT_GROUP_HEADER{
- int count;
- RESULT_RECT* rects;
- };
- //对象结果(基础结构体)
- struct OBJ_RESULT{
- unsigned int obj_id;//对象ID
- };
- //对象位置区域描述
- template<class T> struct OBJ_RECT{
- T centerx;
- T centery;
- T width;
- T height;
- double angle;
- };
- //定位点识别结果
- struct LOCATE_POINT_RESULT :OBJ_RESULT, OBJ_RECT<float>{
- };
- //二维码识别结果
- struct QR_RESULT :OBJ_RESULT, OBJ_RECT<float>{
- char * qr_str;
- int nQrOrBar;
- };
- struct SchemaPage{
- int subject;
- //模板页面/索引 第几页
- int index;
- //试卷id
- int qrFlag;
- bool is_same_exam_id;//从二维码识别得来的考试号
- bool is_front_page;
- bool is_use_qr_code;
- bool examid_by_qr_code; // 是否识别二维码
- //识别二维码情况(1识别成功,0:未进入,-1识别失败)
- char paper_id[64];
- //考号、学号、阅卷方式
- char student_code[64];
- bool is_stu_id;
- //模板类型
- int mode_type;
- //模板图像宽
- int width;
- //模板图像高
- int height;
- //存储模板定位点(目前存储最上最大的定位点)
- std::vector<SchemaLocatePoint> locatePoints;
- //定位点数量 (暂不用了)
- int locatePointCount;
- //存储题目定位点
- std::vector<SchemaLocatePoint> questionLocatePoints;
- //客观题题目定位点的索引
- std::vector<KEGUANTI_QUESTION_LOCATEPOINT_INDEX> keguantiQuestionLocatePointIndexs;
- //交叉点定位(无用)
- std::vector<SchemaLoacteCross> locateCrosses;
- //交叉点定位数量(无用)
- int locateCrossCount;
- //定位区定位(无用)
- std::vector<SchemaLocateArea> locateAreas;
- //定位区定位数量(无用)
- int locateAreaCount;
- //条码/二维码 位置
- std::vector<SchemaCode> codes;
- //条码/二维码 位置(数量)
- int codeCount;
- //学号分组
- std::vector<SchemaGroup> stuGroups;
- int stuGroupsCount;
- //学号选项
- std::vector<SchemaItem> stuItems;
- int stuItemCount;
- int schoolCardStatus;
- //学号定位点索引
- std::vector<KEGUANTI_QUESTION_LOCATEPOINT_INDEX> stuQuestionLocatePointIndex;
- //选择题选项组,一个题目一个组
- std::vector<SchemaGroup> groups;
- int groupCount;
- //选择题选项
- std::vector<SchemaItem> items;
- int itemCount;
- //切割区域
- std::vector<SchemaCutArea> cutAreas;
- int cutAreaCount;
- //黑度整体浮动系数(无用)
- int user_float_heidu;
- //黑度选中灵敏度(无用)
- int worthwhileBlk;
- //多个选项之间的间隔字符(无用)
- char option_spacer;
- //选择题没有选择时的输出字符(无用)
- char unselect_char;
- //两组选择题之间的间隔字符(无用)
- char group_spacer;
- //主观题、填空题位置
- std::vector<SchemaQuestionScore > question_score;
- int question_score_count;
- int hei_du_ling_min_du;
- //缺考参数
- //缺考定位点索引
- std::vector<KEGUANTI_QUESTION_LOCATEPOINT_INDEX> quekaoLocatePointIndex;
- bool isQuekao;
- SCHEMA_RECT_FIELD quekao;
- int quekaoItemCount;
- bool isZaiXianDaTiKa; //是否在线答题卡
- SchemaPage(){
- isZaiXianDaTiKa = false;
- }
- };
- enum class PaperDirection{
- DIR_H,
- DIR_V
- };
- struct Location
- {
- Pos pos;
- int type;
- };
- struct CutArea
- {
- Pos pos;
- int linkparm;
- };
- struct Opt
- {
- Pos pos;
- std::string optName;
- };
- typedef std::vector<std::vector<Opt>> fill_code;
- struct question
- {
- int type; // 题型
- int marktype;// 逻辑题型
- std::string answer; // 答案-选择题
- double score;
- int smallQtNo; //判断是否有小题和小题序号。-1没有小题,0-X表示小题序号
- std::string id;
- std::string all_id;
- std::vector<Opt> opt; // 选择题的选项位置等
- std::string direction;
- ScoreBox scoreBox; // 打分框
- CutArea cut; // 剪裁区域
- int selTotal;
- int selItem;
- string name;
- };
- struct PageTemplate
- {
- int pageNo;
- std::vector<Location> location; // 定位点位置
- Pos studentcode_bar; // 条形码位置
- fill_code studentcode_fill; // 填涂考号
- Pos absent; // 缺号标记
- Pos QrCode; // 二维码
- double w, h; // 宽高
- std::vector<question> vctQuestions;
- };
- enum item_type
- {
- type_absent,// 缺考标记
- type_tiaoxingma, // 条形码
- type_tiantukaohao, // 填涂考号
- type_qrbar,//二维码
- type_question_keguan,// 题目-单选题
- type_question_keguan_d,// 题目-多选题
- type_question_keguan_b,// 题目-不定项选择
- type_question_zhuguan,// 题目-主观题
- type_question_xuanzuo,// 题目-选做题
- type_dingweidian_range_top, //上定位点范围
- type_dingweidian_rang_buttom,// 下定位点范围
- type_dingweidian_w_max_rate,
- type_dingweidian_w_min_rate,
- type_dingweidian_h_max_rate,
- type_dingweidian_h_min_rate,
- };
- struct Item_Pos_offset_Info{
- item_type type;
- int x_offset, y_offset, w_offset, h_offset;
- int x_offset_score, y_offset_score, w_offset_score, h_offset_score;
- int x_offset_opt, y_offset_opt, w_offset_opt, h_offset_opt;
- std::string question_id;
- int link_param;
- std::map<int, Item_Pos_offset_Info> _child_info;// 选做题的选项
- Item_Pos_offset_Info(){
- x_offset = 0; y_offset = 0; w_offset = 0; h_offset = 0;
- x_offset_score = 0; y_offset_score = 0; w_offset_score = 0; h_offset_score = 0;
- x_offset_opt = 0; y_offset_opt = 0; w_offset_opt = 0; h_offset_opt = 0;
- link_param = -1;
- }
- };
- struct PaperTemplate
- {
- int totalPage; // 总页数
- bool useQrCode; // 是否使用二维码 使用:包含学生信息 不使用: 不包含学生信息
- int schoolCardStatus;
- std::map<int, PageTemplate> pages;
- int subject_id;
- bool config_offset;
- std::map<std::string, Item_Pos_offset_Info> _map_offset_info;
- bool open_save_debug_img;
- int dingweidian_range_top; //上定位点范围
- int dingweidian_rang_buttom;// 下定位点范围
- float dingweidian_w_max_rate;
- float dingweidian_w_min_rate;
- float dingweidian_h_max_rate;
- float dingweidian_h_min_rate;
- std::string _version;
- string exam_name;
- string subject_name;
- };
- } // end namespace OnLineCard
|