SDC C-Project CF Review 프로그램
LYW
2021-06-09 f143e5ece742a275d1e360c55e829d21e706b26d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
// ScanModel.h: interface for the CScanModel class.
//
//////////////////////////////////////////////////////////////////////
 
#if !defined(AFX_SCANMODEL_H__4496825C_3AC9_4CB6_885C_EFC54FB0C3F1__INCLUDED_)
#define AFX_SCANMODEL_H__4496825C_3AC9_4CB6_885C_EFC54FB0C3F1__INCLUDED_
 
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
 
 
#include "MosisHive.h"
#include "SystemRecipe.h"
#include "GlassRecipe.h"
 
 
 
#define FRAME_HEIGHT_TEMP 1024
 
class    CScanCellMosis
{
public:
    CPoint    LeftTop, RightTop;
    CPoint    LeftBottom, RightBottom;
    int        m_StartFrame, m_EndFrame;
    int        m_FrameHeight;
 
    double    a, bLeft, bRight;
 
public:
    CScanCellMosis()
    {
        ResetScanCell();
    }
 
    void SetCellData(int frameHeight, CPoint &lt, CPoint &lb, CPoint &rt, CPoint &rb)
    {
        m_FrameHeight= frameHeight;
        LeftTop= lt;
        LeftBottom= lb;
        RightTop= rt;
        RightBottom= rb;
 
        double dx= LeftBottom.x- LeftTop.x;
        double dy= LeftBottom.y- LeftTop.y;
 
        if(dx == 0)
        {
            a= 0;
            bLeft= LeftTop.x;
        }else
        {
            a= dx/dy;
            bLeft= -a*LeftTop.y+ LeftTop.x;
            bRight= -a*RightTop.y+ RightTop.x;
        }
 
        m_StartFrame= lt.y/frameHeight;
        m_EndFrame= lb.y/frameHeight;
    }
 
    void    ResetScanCell()
    {
        m_StartFrame= -1;// StartFrameÀº ¿µ¿ª °è»ê¿¡ Æ¯º°ÇÑ Àǹ̸¦ °®´Â´Ù. ±âÃÊ ÆÇ´Ü°ªÀ¸·Î »ç¿ë.
    }
 
    // ±Û¶ó½º Æ¿Æ®, Cell Start, End, Left, RightµîÀ» °í·ÁÇÒ¶§.. Start & End FrameÀ» °¡Á®°¡´Â °ÍÀ̠Ÿ´çÇϰڴÙ.
    // yÃàÀ¸·Î´Â Cell Top °ú Bottom »çÀÌ¿¡ Á¸ÀçÇÏÁö¸¸, Left & Right ¿µ¿ªÀÌ ÀÖ´Ù°¡ ¾ø¾îÁú ¼öµµ ÀÖ´Ù(ƿƮ ¿µÇâ)
    // Left, Right, Top, BottomµîÀÇ ¿µ¿ª ¿¬»êº¸´Ù Frame Index ¿¬»êÀÌ °¡º±Áö.
    BOOL    GetActiveScanRect(int iFrame, CRect &rectFrame, CRect &rectCal)
    {
        if(iFrame < m_StartFrame)    return FALSE;
        if(iFrame > m_EndFrame)    return FALSE;
 
        rectCal= rectFrame;
        rectCal.left= a*rectFrame.top+ bLeft;
        rectCal.right= a*rectFrame.top+ bRight;
 
        if(rectCal.left < rectFrame.left)
            rectCal.left= rectFrame.left;
        if(rectCal.right > rectFrame.right)
            rectCal.right= rectFrame.right;
        if(rectFrame.top < LeftTop.y)
            rectCal.top= LeftTop.y;
        if(rectFrame.bottom > LeftBottom.y)
            rectCal.bottom= LeftBottom.y;
        return TRUE;
    }
    void Test(CRect rect, int tilt)
    {
        LeftTop.x= rect.left;
        LeftTop.y= rect.top;
        RightTop.x= rect.right;
        RightTop.y= rect.top;
        LeftBottom.x= rect.left- tilt;
        LeftBottom.y= rect.bottom;
        RightBottom.x= rect.right- tilt;
        RightBottom.y= rect.bottom;
        SetCellData(FRAME_HEIGHT_TEMP, LeftTop, LeftBottom, RightTop, RightBottom);
    }
};
 
 
class CScanData2;
 
// ¸ðµ¨º° °Ë»ç ¹æ¹ý, ¿µ¿ª
class AFX_EXT_CLASS CScanModel : public CModelData
{
protected:
    CCellHive2        m_CellHive2;
 
public:
    BOOL            MakeScanModel(CGlassModel *pModel, CScanData2 &ScanData, int FrameWidth);
    void            SetGlassStart(int y);
    void            SetCellStart(int iy, int offset);
 
public:
    BOOL            SetScanCellCnt(int nx, int ny)            {return m_CellHive2.SetSize(nx, ny);}
    int                GetScanCellWidth()                        {return m_CellHive2.GetWidth();}
    int                GetScanCellHeight()                        {return m_CellHive2.GetHeight();}
    CCell            *GetScanCell(int x, int y)                {return m_CellHive2.GetData(x, y);}
 
};
typedef                CMosisHive1<CScanModel>        CScanModelHive;
 
 
 
 
 
#endif // !defined(AFX_SCANMODEL_H__4496825C_3AC9_4CB6_885C_EFC54FB0C3F1__INCLUDED_)