#pragma once #include "XMLSerialization.h" namespace OTSDATA { // domain shape typedef enum class __declspec(dllexport) DOMAIN_SHAPE { INVALID = -1, MIN = 0, ROUND = 0, RECTANGLE = 1, POLYGON = 2, MAX = 2 } DOMAIN_SHAPE; __declspec(dllexport) const int DOMAIN_ITEM_NUMBER = 5; // CDomain command target class __declspec(dllexport) CDomain:public xmls::ISlo { public: // constructor CDomain(); // constructor CDomain(DOMAIN_SHAPE a_nShape, CRect a_rectRegion); // constructor CDomain(const CDomain&); // copy constructor CDomain(CDomain*); // copy constructor CDomain& operator=(const CDomain&); // =operator BOOL operator==(const CDomain&); // ==operator virtual ~CDomain(); // destructor // serialization //void Serialize(CArchive& ar); // validation check BOOL IsInvalid() const; // check if it is empty BOOL IsEmpty() { return m_rectDomain.IsRectEmpty(); } // check if this is a round domain BOOL IsRound() const { return m_nShape == DOMAIN_SHAPE::ROUND; } // check if this is a rectangle domain BOOL IsRect() const { return m_nShape == DOMAIN_SHAPE::RECTANGLE; } // domain center CPoint GetDomainCenter() const { return m_rectDomain.CenterPoint(); } void OffsetDomain(CPoint a_poiMove) { m_rectDomain += a_poiMove; } // diameter long GetDiameter() const { return m_rectDomain.Width(); } // rectangle CRect GetDomainRect() const { return m_rectDomain; } void SetDomainRect(const CRect& a_rect) { m_rectDomain = a_rect; } // sharp DOMAIN_SHAPE GetShape() const { return m_nShape; } void SetShape(const DOMAIN_SHAPE a_nShape) { m_nShape = a_nShape; } // PolygonPoint std::vector GetPolygonPoint() const { return m_PolygonPoint; } void SetPolygonPoint(const std::vector a_PolygonPoint); //void AddPolygonPoint(CPoint p) { m_PolygonPoint.push_back(p); } // check if have common area with the given domain BOOL IntersectDomain(const CDomain& a_oDomain); // check if the point in the domain BOOL PtInDomain(const CPoint& a_poiCheck) const; // check if the given domain is in the domain BOOL DomainInDomain(const CDomain& a_oDomain); virtual void Serialize(bool isStoring, tinyxml2::XMLDocument * classDoc, tinyxml2::XMLElement * rootNode); //virtual void Deserialize(Slo * classItem, tinyxml2::XMLDocument * classDoc, tinyxml2::XMLElement * rootNode); protected: // cleanup void Cleanup(); // initialization void Init(); // duplication void Duplicate(const CDomain& a_oSource); // sharp DOMAIN_SHAPE m_nShape; // area CRect m_rectDomain; std::vector m_PolygonPoint; }; typedef std::shared_ptr __declspec(dllexport) CDomainPtr; typedef std::vector __declspec(dllexport) CDomainsList; }