현재는 절대좌표와 영상좌표의 구분이 안되어 있기 때문에 절대좌표가 있는 영상인 경우 이미지 매칭이 안되는 문제가 있다.
그래서 ILayer 인터페이스에 좌표변환 함수를 추가하였다.
일단 좌표에 대한 클래스를 새로 정의하였다.
1. DPOINT(Device Point) : 장치좌표, 화면좌표
2. IPOINT(Image Point) : 영상좌표
3. LPOINT(Logical Point) : 논리좌표, 절대좌표, 지리좌표
template <class _TX, int _T> union SPOINT2
{
struct { _TX x, y; };
_TX _m[2];
};typedef SPOINT2<int, 1> DPOINT2i; // 디바이스좌표
typedef SPOINT2<double, 1> DPOINT2d; // 디바이스좌표
typedef SPOINT2<double, 1> IPOINT2d; // 영상좌표
typedef SPOINT2<double, 2> LPOINT2d; // 논리좌표
template <class _TX, int _T> struct SMBR2
{
union
{
struct { _TX left,top; };
SPOINT2<_TX,_T> _LT;
};
union
{
struct { _TX right,bottom; };
SPOINT2<_TX,_T> _RB;
};
};typedef SMBR2<int, 1> DMBR2i; // 디바이스영역
typedef SMBR2<double, 1> DMBR2d; // 디바이스영역
typedef SMBR2<double, 1> IMBR2d; // 영상영역
typedef SMBR2<double, 2> LMBR2d; // 논리영역
다음은 좌표변환 함수이다.
DPtoIP, DPtoLP, IPtoDP, IPtoLP, LPtoIP, LPtoDP등의 함수가 추가되어야 한다.
virtual BOOL LPtoIP(const double _lpX, const double _lpY, double& _ipX, double& _ipY)=0; virtual BOOL IPtoDP(const double& _ipX, const double& _ipY,CPoint& _DP)=0; virtual BOOL DPtoIP(const CPoint& _DP, double& _ipX, double& _ipY)=0; virtual BOOL DPtoLP(const CPoint& _DP, double& _lpX, double& _lpY)=0;
Posted by chungki


