/*----------------------------------------------------------------------------*/ Bool IsWarnAtLine (void *vLine,Bool Hori,Bool zero) { NR_SimpLine* pLine = (NR_SimpLine*)vLine; if (Hori) { if (abs(pLine->Beg_Y-pLine->End_Y)>abs(pLine->Beg_X-pLine->End_X)) { #ifdef Almi if (!AM_Skip (FT_GetKeyOfRule (RU_FT_C_ContErr))) AM_Console ("Rlt-Error-Ignore : Переданная линия не является горизонтальной! Она игнорируется."); #endif return TRUE; } if (pLine->Beg_X>pLine->End_X) { #ifdef Almi if (!AM_Skip (FT_GetKeyOfRule (RU_FT_C_ContWarn))) AM_Console ("Rlt-Warning-Continue : Плохо описана горизонтальная линия!"); #endif return TRUE; } } else { if (abs(pLine->Beg_Y-pLine->End_Y)<abs(pLine->Beg_X-pLine->End_X)) { #ifdef Almi if (!AM_Skip (FT_GetKeyOfRule (RU_FT_C_ContErr))) AM_Console ("Rlt-Error-Ignore : Переданная линия не является вертикальной! Она игнорируется."); #endif return TRUE; } if (pLine->Beg_Y>pLine->End_Y) { #ifdef Almi if (!AM_Skip (FT_GetKeyOfRule (RU_FT_C_ContWarn))) AM_Console ("Rlt-Warning-Continue : Плохо описана вертикальная линия!"); #endif return TRUE; } } return FALSE; }
/*----------------------------------------------------------------------------*/ Bool IsWarnAtLine (void *vLns, Bool Hori) { LineInfo *pLns = (LineInfo *)vLns; if (Hori) { if (abs(pLns->A.y - pLns->B.y) > abs(pLns->A.x - pLns->B.x)) { #ifdef Almi if (!AM_Skip (FT_GetKeyOfRule (RU_FT_C_ContErr))) AM_Console ("Rlt-Error-Ignore : Переданная линия не является горизонтальной! Она игнорируется."); #endif return TRUE; } if (pLns->A.x > pLns->B.x) { #ifdef Almi if (!AM_Skip (FT_GetKeyOfRule (RU_FT_C_ContWarn))) AM_Console ("Rlt-Warning-Continue : Плохо описана горизонтальная линия!"); #endif return TRUE; } } else { if (abs(pLns->A.y - pLns->B.y) < abs(pLns->A.x - pLns->B.x)) { #ifdef Almi if (!AM_Skip (FT_GetKeyOfRule (RU_FT_C_ContErr))) AM_Console ("Rlt-Error-Ignore : Переданная линия не является вертикальной! Она игнорируется."); #endif return TRUE; } if (pLns->A.y > pLns->B.y) { #ifdef Almi if (!AM_Skip (FT_GetKeyOfRule (RU_FT_C_ContWarn))) AM_Console ("Rlt-Warning-Continue : Плохо описана вертикальная линия!"); #endif return TRUE; } } return FALSE; }
void New_MarkVerifiedLines(void *vLti, Handle hCPage, Rect16 *pRc, int *pWhatDo, int nComp, int *nZher, int *iZher, int MaxZher, Bool AbleShortVert) { int i, n, Lent, ret; LineInfo *pLns; LinesTotalInfo *pLti; AM_ZHERTVY ZherOfLine; uint32_t AntiFalse, AntiTrue, AntiPoin; Bool WasPointed, WasLongPointed; AntiFalse = 0xFFFFFFFF; AntiFalse ^= LI_IsFalse; AntiTrue = 0xFFFFFFFF; AntiTrue ^= LI_IsTrue; AntiPoin = 0xFFFFFFFF; AntiPoin ^= LI_Pointed; pLti = (LinesTotalInfo *) vLti; ChoiseQuasiLetters(pRc, pWhatDo, nComp); *nZher = 0; /***************** горизонтальная ******************************/ n = pLti->Hor.Cnt; pLns = pLti->Hor.Lns; for (i = 0; i < n; i++) { Lent = (int) PointDistance(pLns->A, pLns->B); /* определение отточий - обжалованию не подлежит *///пора переиграть /* if ( AM_Skip (AM_GetKeyOfRule (RU_VL_U_NoPointedLines))) { if ((pLns->SegCnt==1)&&(pLns->Quality==255)&&(pLns->Thickness==2)) { pLns->Flags |= LI_Pointed; pLns++; continue; } if ((pLns->SegCnt==2)&&(pLns->Quality>=240)&&(pLns->Thickness==1)) { pLns->Flags |= LI_Pointed; pLns->Flags |= LI_Doubt; pLns++; continue; } }*///Almi 13.09.01 /* верификация формальная (для всех) */ if (!AM_Skip(AM_GetKeyOfRule(RU_VL_U_NewFormalVerify))) FormalVerification(pLns, Lent); else OldFormalVerification(pLns, Lent); /* верификация по тифу (для коротких) */ ret = RV_EMPTY; if ((Lent > 60) && (Lent <= 350) && (AM_Skip(AM_GetKeyOfRule( RU_VL_U_NoInvestImage)))) ret = InvestShortLineWithRastr_rv_pne(hCPage, pLns); if (ret == RV_NEGATIVE) PutNewFlagOfLine(pLns, LI_IsFalse); if (ret == RV_POSITIVE) PutNewFlagOfLine(pLns, LI_IsTrue); /* верификация по коробкам (для длинных и не отифенных коротких) */ if (!AM_Skip(AM_GetKeyOfRule(RU_VL_U_AbleHoriZher))) { if (((Lent > 350) || (ret == RV_EMPTY)) && (AM_Skip( AM_GetKeyOfRule(RU_VL_U_NoInvestLongLines)))) InvestLongLineWithBoxes(pLns, pRc, pWhatDo, nComp, nZher, iZher, &ZherOfLine, MaxZher, TRUE, Lent); } pLns++; } //******** горизонтальные отточия проверим ********// pLns = pLti->Hor.Lns; WasPointed = FALSE; WasLongPointed = FALSE; for (i = 0; i < n; i++) { if (!(pLns[i].Flags & LI_Pointed)) continue; WasPointed = TRUE; if (abs(pLns[i].A.x() - pLns[i].B.x()) > 100) WasLongPointed = TRUE; } if (WasPointed & !WasLongPointed) { pLns = pLti->Hor.Lns; for (i = 0; i < n; i++) { if ((pLns[i].Flags & LI_Pointed)) pLns[i].Flags &= AntiPoin; } } /***************** вертикальная ******************************/ n = pLti->Ver.Cnt; pLns = pLti->Ver.Lns; for (i = 0; i < n; i++) { Lent = (int) PointDistance(pLns->A, pLns->B); if (!AM_Skip(AM_GetKeyOfRule(RU_VL_U_NewFormalVerify))) FormalVerification(pLns, Lent); else OldFormalVerification(pLns, Lent); if (AM_Skip(AM_GetKeyOfRule(RU_VL_U_NoInvestLongLines))) { if (Lent <= 100) if (pLns->Flags & LI_IsFalse) pLns->Flags &= AntiFalse; } if (AM_Skip(AM_GetKeyOfRule(RU_VL_U_NoInvestLongLines))) { if (AbleShortVert && (Lent >= 94)) InvestLongLineWithBoxes(pLns, pRc, pWhatDo, nComp, nZher, iZher, &ZherOfLine, MaxZher, FALSE, Lent); else if (pLns->Flags & LI_IsTrue) pLns->Flags &= AntiTrue; } pLns++; } }
void WriteResForLines(void *vLti) { int i, n, rot; int L_Bad, L_Doubt, L_Good; LineInfo *pLns; LinesTotalInfo *pLti; char str[256]; pLti = (LinesTotalInfo *) vLti; /***************** горизонтальная ******************************/ if (!AM_Skip(AM_GetKeyOfRule(RU_VL_D_WrResLine))) rot = AM_WriteRes_rv_fte(RU_VL_D_WrResLine, " <4 Н Гор.Линии\n"); n = pLti->Hor.Cnt; L_Bad = 0; L_Doubt = 0; L_Good = 0; pLns = pLti->Hor.Lns; for (i = 0; i < n; i++) { if (pLns->Flags & LI_IsFalse) { L_Bad++; sprintf(str, " <4 О 1 %c %4d %4d %4d %4d %4d\n", '-', pLns->A.x(), pLns->A.y(), pLns->B.x(), pLns->B.y(), pLns->Thickness); if (!AM_Skip(AM_GetKeyOfRule(RU_VL_D_WrResLine))) rot = AM_WriteRes_rv_fte(RU_VL_D_WrResLine, str); } else { if ((!(pLns->Flags & LI_IsTrue)) || (pLns->Flags & LI_NOTWHOLE) || (pLns->Flags & LI_COMPLEX)) { L_Doubt++; sprintf(str, " <4 О 1 %c %4d %4d %4d %4d %4d\n", '?', pLns->A.x(), pLns->A.y(), pLns->B.x(), pLns->B.y(), pLns->Thickness); if (!AM_Skip(AM_GetKeyOfRule(RU_VL_D_WrResLine))) rot = AM_WriteRes_rv_fte(RU_VL_D_WrResLine, str); } else { L_Good++; sprintf(str, " <4 О 1 %c %4d %4d %4d %4d %4d\n", '+', pLns->A.x(), pLns->A.y(), pLns->B.x(), pLns->B.y(), pLns->Thickness); if (!AM_Skip(AM_GetKeyOfRule(RU_VL_D_WrResLine))) rot = AM_WriteRes_rv_fte(RU_VL_D_WrResLine, str); } } pLns++; } sprintf(str, " <4 Р %4d %4d %4d\n", L_Good, L_Doubt, L_Bad); if (!AM_Skip(AM_GetKeyOfRule(RU_VL_D_WrResLine))) rot = AM_WriteRes_rv_fte(RU_VL_D_WrResLine, str); if (!AM_Skip(AM_GetKeyOfRule(RU_VL_D_WrResLine))) rot = AM_WriteRes_rv_fte(RU_VL_D_WrResLine, " <4 К Гор.Линии\n"); /***************** вериткальная ******************************/ if (!AM_Skip(AM_GetKeyOfRule(RU_VL_D_WrResLine))) rot = AM_WriteRes_rv_fte(RU_VL_D_WrResLine, " <4 Н Вер.Линии\n"); n = pLti->Ver.Cnt; L_Bad = 0; L_Doubt = 0; L_Good = 0; pLns = pLti->Ver.Lns; for (i = 0; i < n; i++) { if (pLns->Flags & LI_IsFalse) { L_Bad++; sprintf(str, " <4 О 1 %c %4d %4d %4d %4d %4d\n", '-', pLns->A.x(), pLns->A.y(), pLns->B.x(), pLns->B.y(), pLns->Thickness); if (!AM_Skip(AM_GetKeyOfRule(RU_VL_D_WrResLine))) rot = AM_WriteRes_rv_fte(RU_VL_D_WrResLine, str); } else { if ((!(pLns->Flags & LI_IsTrue)) || (pLns->Flags & LI_NOTWHOLE) || (pLns->Flags & LI_COMPLEX)) { L_Doubt++; sprintf(str, " <4 О 1 %c %4d %4d %4d %4d %4d\n", '?', pLns->A.x(), pLns->A.y(), pLns->B.x(), pLns->B.y(), pLns->Thickness); if (!AM_Skip(AM_GetKeyOfRule(RU_VL_D_WrResLine))) rot = AM_WriteRes_rv_fte(RU_VL_D_WrResLine, str); } else { L_Good++; sprintf(str, " <4 О 1 %c %4d %4d %4d %4d %4d\n", '+', pLns->A.x(), pLns->A.y(), pLns->B.x(), pLns->B.y(), pLns->Thickness); if (!AM_Skip(AM_GetKeyOfRule(RU_VL_D_WrResLine))) rot = AM_WriteRes_rv_fte(RU_VL_D_WrResLine, str); } } pLns++; } sprintf(str, " <4 Р %4d %4d %4d\n", L_Good, L_Doubt, L_Bad); if (!AM_Skip(AM_GetKeyOfRule(RU_VL_D_WrResLine))) rot = AM_WriteRes_rv_fte(RU_VL_D_WrResLine, str); if (!AM_Skip(AM_GetKeyOfRule(RU_VL_D_WrResLine))) rot = AM_WriteRes_rv_fte(RU_VL_D_WrResLine, " <4 К Вер.Линии\n"); }
/*---------------------------------------------------------------------------*/ Bool LoadPicts_rv (Handle hC, void *vB, char *pStr) { int SizeCurr, Deficit, nRc; uint32_t err32, nTeor, nReal; Bool ret; POLY_ Pict; Handle hBlockPictSpec; Handle hBlockPictPrev; UN_BUFF *pB; Rect16 *pCurr; pB = (UN_BUFF *)vB; nRc = 0; Deficit = 0; pCurr = (Rect16 *)pB->vCurr; SizeCurr = pB->SizeCurr; nTeor = sizeof (POLY_); hBlockPictPrev = NULL; while (1) { /* ключ к данным */ if (hBlockPictPrev==NULL) hBlockPictSpec = CPAGE_GetBlockFirst (hC, TYPE_IMAGE); else hBlockPictSpec = CPAGE_GetBlockNext (hC, hBlockPictPrev, TYPE_IMAGE); err32 = CPAGE_GetReturnCode (); if (hBlockPictSpec==NULL) break; if (err32!=0) { if (hBlockPictPrev==NULL) sprintf (pStr, "[GetBlockFirst]"); else sprintf (pStr, "[GetBlockNext]"); return FALSE; } /* собственно данные */ nReal = CPAGE_GetBlockData (hC, hBlockPictSpec, TYPE_IMAGE, (void *)(&Pict), nTeor); err32 = CPAGE_GetReturnCode (); if ((nReal!=nTeor)||(err32!=0)) { sprintf (pStr, "[GetBlockData]"); return FALSE; } hBlockPictPrev = hBlockPictSpec; if ((int)nTeor > SizeCurr) { Deficit++; continue; } nRc++; ret = MakeRectFromPict (pCurr, (void *)(&Pict)); #include "am_comm.h" #ifdef Almi #include "ft_rule.h" if (!ret) { if (!AM_Skip (FT_GetKeyOfRule (RU_FT_C_ContWarn))) AM_Console ("Не удалось осмыслить картинку!"); continue; } #endif pCurr++; SizeCurr -= sizeof (Rect16); } if (nRc==0) { sprintf (pStr, "Нет картинок"); return RV_EMPTY; } EndLastDataPart (vB, UN_DA_PictReal, UN_DT_Rect16, sizeof (Rect16), nRc); if (Deficit > 0) { sprintf (pStr, "Не хватило памяти под %d %s!", Deficit, "коробки картинок"); return RV_DOUBT; } return RV_TRUE; }