SDC C-Project CF Review 프로그램
LYW
2021-07-08 e10b8c2a3f6ee6b639dbb49ff6635d0657531d1e
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
132
133
134
135
136
137
138
139
140
// GlassModel.h: interface for the CGlassModel class.
//
//////////////////////////////////////////////////////////////////////
 
#if !defined(AFX_GLASSMODEL_H__4BBC59B3_81D8_4E3E_A88A_46DB8EA97E64__INCLUDED_)
#define AFX_GLASSMODEL_H__4BBC59B3_81D8_4E3E_A88A_46DB8EA97E64__INCLUDED_
 
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
 
#include "MosisHive.h"
#include "ModelCoord.h"
#include "ModelData.h"
 
 
 
// Cell Rect + Cam Rect
// CRect = Cam Rect
// Original(Left, Right) => Original Cell(Left, Right)
// Glass ¿¡¼­ÀÇ CellÀÇ À§Ä¡¿Í Å©±â¸¦ Ç¥Çö.
// Scan CamÀÇ À¯È¿¿µ¿ª¿¡ Æ÷ÇԵǴ CellÀÇ À§Ä¡¿Í Å©±â Ç¥Çö.
// Scan Cam³»¿¡¼­ÀÇ ÁÂÇ¥ º¯È¯½Ã Original left¿Í rightÀÇ Á¤º¸¸¦ Originalº¯¼ö¿¡ ÀúÀå.
// Frame ³»¿¡¼­ÀÇ Cell·Îµµ Ç¥Çö °¡´É.
class CCell : public CRect
{
public:
    int        m_OriginalLeft;        // cellÀÇ ¿ÞÂÊ. Ä«¸Þ¶ó ³»¿¡¼­ÀÇ ¿ÞÂÊÀÌ ¾Æ´Ï´Ù.
    int        m_OriginalRight;    // cellÀÇ ¿À¸¥ÂÊ. Ä«¸Þ¶ó ³»¿¡¼­ÀÇ ¿ÞÂÊÀÌ ¾Æ´Ï´Ù.
public:
    void Change2PixelCoord(double xR, double yR)
    {
        left= (LONG) (left/xR);
        right= (LONG) (right/xR);// /= xR;
        top= (LONG) (top/yR);///= yR;
        bottom= (LONG) (bottom/yR);///= yR;
        m_OriginalLeft= (int)(m_OriginalLeft/xR);///= xR;
        m_OriginalRight= (int)(m_OriginalRight/xR);// /= xR;
    }
    BOOL Change2ScanRect(int camLeft, int camRight)
    {
        m_OriginalLeft= left;
        m_OriginalRight= right;
        
        return IntersectX(camLeft, camRight);
    }
    BOOL HasLeftEdge()
    {
        return m_OriginalLeft == left;
    }
    BOOL HasRightEdge()
    {
        return m_OriginalRight == right;
    }
    BOOL IsIntersectX(int xLeft, int xRight)
    {
        if(left >= xRight)
            return FALSE;
        if(right <= xLeft)
            return FALSE;
        return TRUE;
    }
    BOOL IsIntersectY(int yTop, int yBottom)
    {
        if(top >= yBottom)
            return FALSE;
        if(bottom <= yTop)
            return FALSE;
        return TRUE;
    }
    BOOL IntersectX(int xLeft, int xRight)
    {
        if(left >= xRight)
            return FALSE;
        if(right <= xLeft)
            return FALSE;
 
        if(left < xLeft)
            left= xLeft;
 
        if(right > xRight)
            right= xRight;
 
        return TRUE;
    }
    BOOL IntersectY(int yTop, int yBottom)
    {
        if(top >= yBottom)
            return FALSE;
        if(bottom <= yTop)
            return FALSE;
 
        if(top < yTop)
            top= yTop;
 
        if(bottom > yBottom)
            bottom= yBottom;
 
        return TRUE;
    }
    void OffsetX(int x)
    {
        left+= x;
        right+= x;
    }
    void OffsetY(int y)
    {
        top+= y;
        bottom+= y;
    }
};
typedef            CMosisHive2<CCell>        CCellHive2;
 
 
 
class AFX_EXT_CLASS CGlassModel        :    public CModelCoord, public CModelData
{
protected:
    CCellHive2        m_CellHive2;
 
public:
 
public:
    BOOL            SetGlassCellCnt(int nx, int ny)            {return m_CellHive2.SetSize(nx, ny);}
    int                GetGlassCellWidth()                        {return m_CellHive2.GetWidth();}
    int                GetGlassCellHeight()                    {return m_CellHive2.GetHeight();}
    CCell            *GetGlassCell(int x, int y)                {return m_CellHive2.GetData(x, y);}
public:
    BOOL            MakeGlassModel();
    void            Change2PixelCoord(double x, double y);
 
    BOOL            ReadGlassModel(CMosisPacket *pPacket);
    BOOL            WriteGlassModel(CMosisPacket *pPacket);
 
friend class CScanModel;
};
typedef            CMosisHive1<CGlassModel>        CGlassModelHive;
 
 
#endif // !defined(AFX_GLASSMODEL_H__4BBC59B3_81D8_4E3E_A88A_46DB8EA97E64__INCLUDED_)