#pragma once #include #include namespace schema{ templatestruct SCHEMA_RECT_FIELD{ T centerx; T centery; T width; T height; }; struct SCHEMA_ELEMENT_FIELD :SCHEMA_RECT_FIELD{ int nID; }; struct SCHEMA_LOCATE_POINT :SCHEMA_ELEMENT_FIELD{//定位点 }; struct SCHEMA_LOCATE_AREA :SCHEMA_ELEMENT_FIELD{//区域定位点 }; enum SCHEMA_CROSS_SIGN_FLAG{ //表示向上的边 SCHEMA_CROSS_SIGN_UP = 1, //表示向下的边 SCHEMA_CROSS_SIGN_DOWN = 2, //表示向左的边 SCHEMA_CROSS_SIGN_LEFT = 4, //表示向右的边 SCHEMA_CROSS_SIGN_RIGHT = 8, }; struct SCHEMA_LOACTE_CROSS :SCHEMA_ELEMENT_FIELD{//交叉点定位 //交叉点的边的标记 int sign; //交叉点的旋转角度 double angle; }; enum DIRECTION{ Horizontal, Vertical, DIR_UNKNOWN, }; struct SCHEMA_CODE :SCHEMA_ELEMENT_FIELD{//条码、二维码 DIRECTION bDirection; }; struct SCHEMA_ITEM :SCHEMA_ELEMENT_FIELD{//填涂项 //填涂项输出字符 char OutChar[64]; int nGroupID; int nMatrixID; int keguanti_question_locate_point_index; }; enum OUT_TYPE_FLAG{ OTF_SINGLE = 1, OTF_MUTIL = 1 << 1, OTF_STRICT = 1 << 3, OTF_NONSTRICT = 1 << 4, OTF_NONSTRICT_ERROR = 1 << 5, }; //客观题输出类型 enum OMR_OUT_TYPE{ // 输出一个或*号,若解析中有0个、2个或2个以上涂点被填涂,输出*号 OMR_OUT_TYPE_SINGLE_NONSTRICT_ERROR = OTF_SINGLE | OTF_NONSTRICT_ERROR, // 输出一个,若解析中有2个或2个以上涂点被填涂,则从中选出一个作为该组结果 OMR_OUT_TYPE_SINGLE_NONSTRICT = OTF_SINGLE | OTF_NONSTRICT, // 输出一个,若解析中有2个或2个以上涂点被填涂,则认为用户多选,输出多选字符 OMR_OUT_TYPE_SINGLE_STRICT = OTF_SINGLE | OTF_STRICT, // 输出多选字符 OMR_OUT_TYPE_MUTIL_STRICT = OTF_MUTIL | OTF_STRICT, }; enum QUESTION_TYPE_FLAG{ QTF_DANXUANTI, //多选 QTF_DUOXUANTI, //判断题 QTF_PANDUANTI, //填空题 QTF_ZHUGUANTI, QTF_TIANKONGTI, QTF_BIZUOTI, QTF_QUESTION_TYPE_MASK = 0xff, QTF_XUANZUOTI = 1 << 8, }; enum QuestionType{ //单选 DANXUANTI = QTF_DANXUANTI, //多选 DUOXUANTI = QTF_DUOXUANTI, //判断题 PANDUANTI = QTF_PANDUANTI, //主观题 ZHUGUANTI = QTF_ZHUGUANTI, //填空题 TIANKONGTI = QTF_TIANKONGTI, // 必做题 BIZUOTI = QTF_BIZUOTI, XUANZUO_DANXUANTI = QTF_DANXUANTI | QTF_XUANZUOTI, //多选 XUANZUO_DUOXUANTI = QTF_DUOXUANTI | QTF_XUANZUOTI, //判断题 XUANZUO_PANDUANTI = QTF_PANDUANTI | QTF_XUANZUOTI, //主观题 XUANZUO_ZHUGUANTI = QTF_ZHUGUANTI | QTF_XUANZUOTI, //填空题 XUANZUO_TIANKONGTI = QTF_TIANKONGTI | QTF_XUANZUOTI, }; struct SCHEMA_QUESTION{ int nID; char question_code[128]; char question_code_new[128]; float newqt; std::string tigan; std::string answers; std::string answerA; std::string answerB; std::string jiexi; std::string zhishidian; std::string xiaowen; std::string maxQuestionNO; int xiaofennum; char courseCode[10]; float score; float halfScore; bool doubleEvl; float holdValue; QuestionType questionType; int nMarkUnit; char openOption[12]; int qtLevelOne; int qtLevelTwo; int qtPostLevelOne; int qtPostLevelTwo; int showMarkTypeIndex; int postMarkTypeID; int showSubjectTypeIndex; int postSubjectTypeID; int groupid; }; struct SCHEMA_GROUP :SCHEMA_ELEMENT_FIELD{//填涂组 //本组涂点涂点数量 int itemCount; int nMatrixID; //OMR 输出类型 OMR_OUT_TYPE omr_out_type; }; struct SCHEMA_CLIP :SCHEMA_ELEMENT_FIELD{//切割区域 //裁切区域名称(当isfirst为真时有效) char area_name[128]; int markUnit; //该区域对应的切块的第几块(从1开始) bool issplit; int markUnitPart; QuestionType question_type; int question_ids[50]; int question_count; char area_name_by_questionNo[128]; char area_name_by_questionNoNew[128]; int xuanzutiArea;//是否为选做题作答区域 0--不是 1--是 }; struct KEGUANTI_LOCATEPOINT_INDEX{ int indexs[4]; int &operator[](int index){ return indexs[index]; } }; struct SCHEMA_MATRIX :SCHEMA_ELEMENT_FIELD{ int nRows; int nCols; float optionWidth; float optionHeight; DIRECTION direction; char outputchars[256]; char outputcharsnew[256]; }; struct SCHEMA_MATRIX_KEGUANTI :SCHEMA_MATRIX{ int question_ids[50]; int question_count; int group_size[50]; int group_count; QuestionType question_type; }; struct SCHEMA_MATRIX_TIANTUKAOHAO :SCHEMA_MATRIX{ }; struct SCHEMA_MATRIX_QUEKAOBIAOJI :SCHEMA_MATRIX{ }; struct SCHEMA_MATRIX_ABJUANBIAOJI :SCHEMA_MATRIX{ }; struct SCHEMA_MATRIX_XUANZUOTI :SCHEMA_MATRIX{ int xuantishu; int err_handler_type; }; template struct ARRAY{ int offset; int count; }; struct SCHEMA_PAGE{ int nID; double angle; int index; int width; int height; std::vector locatePoints; //客观题题目定位点的索引 std::vector keguantiMatrix; std::vector tiantukaohao; std::vector quekaobiaoji; std::vector abjuanbjiaoji; std::vector xuanzuoti; std::vector matrixs; std::vector matrixsTianTuKaoHao; std::vector matrixsKeGuanTi; std::vector matrixsXuanZuoTi; std::vector locateCrosses; std::vector locateAreas; std::vector codes; std::vector clips; std::vector clips2; }; struct SCHEMA_VERSION{ unsigned short majorNum; unsigned short minorNum; char company[256]; SCHEMA_VERSION(){ majorNum = 0; minorNum = 0; company[0] = 0; } SCHEMA_VERSION(unsigned short majorNum, unsigned short minorNum, const char * company){ this->majorNum = majorNum; this->minorNum = minorNum; strcpy_s(this->company, company); } bool operator==(const SCHEMA_VERSION & version1){ return version1.majorNum == majorNum&&version1.minorNum == minorNum; } bool operator!=(const SCHEMA_VERSION & version1){ return version1.majorNum != majorNum || version1.minorNum != minorNum; } }; #define SCHEMA_MAJOR_NUM 0 #define SCHEMA_MINOR_NUM 11 #define SCHEMA_COMPANY "知心慧学" #define CURRENT_SCHEMA_VERSTION SCHEMA_VERSION(SCHEMA_MAJOR_NUM,SCHEMA_MINOR_NUM,SCHEMA_COMPANY) enum{ SCH_LOAD_SUCCESS, //格式错误 SCH_LOAD_ERR_MISSINGFORMAT, //版本不正确 SCH_LOAD_ERR_VERSIONCHANGE, //状态不正确 SCH_LOAD_ERR_ZHUANGTAIBUZHENGQUE, }; struct SCHEMA{ int nNextObjID; std::vector questions; std::vector pages; int state; float totalScore; DIRECTION lastKeGuanTiDirection; std::string course_code; std::string lastQuestionCourseCode; //std::string strTiMuTotal; SCHEMA(){ lastKeGuanTiDirection = DIR_UNKNOWN; state = 0; totalScore = 0; nNextObjID = 10000000; } int NextObjID(){ return nNextObjID++; } }; }