1234567891011121314151617181920212223242526272829 |
- #pragma once
- namespace OTSDATA
- {
- class __declspec(dllexport) COTSRect
- {
- public:
- COTSRect();
- COTSRect(int left, int top, int right, int bottom);
- COTSRect(CPoint leftTop, CPoint bottomRight);
- BOOL operator==(const COTSRect&); // ==operator
- void SetRectData(int left, int top, int right, int bottom);
- bool PointInRect(CPoint p);
- bool IntersectOtherRect(COTSRect r);
- CPoint GetTopLeft() { return CPoint(m_left, m_top); }
- CPoint GetBottomRight() { return CPoint(m_right, m_bottom); }
- int GetWidth() { return (m_right - m_left); }
- int GetHeight() { return (m_top - m_bottom); }
- CPoint GetCenterPoint() { double w = GetWidth(); double h = GetHeight(); CPoint lt = GetTopLeft(); return CPoint(lt.x + w / 2, lt.y - h / 2); }
- virtual ~COTSRect(); // detractor
- private :
- int m_left;
- int m_top;
- int m_right;
- int m_bottom;
- };
- }
|