| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- #pragma once
- #include "Domain.h"
- #include "OTSImageScanParam.h"
- #include "SEMDataMsr.h"
- namespace OTSMODEL {
-
- // CFieldMgr command target
- typedef enum class __declspec(dllexport) SORTING_DIRECTION
- {
- LEFT = 1,
- DOWN = 2,
- RIGHT = 3,
- UP = 4
- }SORTING_DIRECTION;
- class __declspec(dllexport) CFieldMgr
- {
- public:
- CFieldMgr(); // constructor
- virtual ~CFieldMgr(); // destructor
- // initialization
- BOOL Init(CDomainPtr a_pMeasureArea,
- COTSImageScanParamPtr a_poImageScanParam,
- CSEMDataMsrPtr a_poSEMDataMsr,
- std::vector<CPoint>& a_listMeasuredFieldCentrePoints);
- // reset
- BOOL Reset(CDomainPtr a_pMeasureArea,
- COTSImageScanParamPtr a_poImageScanParam,
- CSEMDataMsrPtr a_poSEMDataMsr,
- std::vector<CPoint>& a_listMeasuredFieldCentrePoints);
- // calculate estimate total fields
- static long CalculateTotalFields(CDomainPtr a_poMeasureArea, double a_dScanFieldSizeX, CSize a_sizeResolution);
- // field centre points list
- std::vector<CPoint>& GetFieldCentrePoints() { return m_listFieldCentrePoints; }
- BOOL GetFieldRectByIndex(int a_nIndex, CRect& a_rctField);
- int GetTotalFields() { return (int)m_listFieldCentrePoints.size(); }
-
- void SetFieldCentrePoints(std::vector<CPoint> listPoint);
- // unmeasured field centre points list
- std::vector<CPoint>& GetUnmeasuredFieldCentrePoints() { return m_listUnmeasuredFieldCentrePoints; }
- BOOL UnmeasuredGetNextField(CRect& a_rectField);
- BOOL GetUnmeasuredRandemField(CRect& a_rectField);
- void SetUnmeasuredFieldCentrePoints(std::vector<CPoint> listPoint);
- // measured field centre points list
- std::vector<CPoint>& GetMeasuredFieldCentrePoints() { return m_listMeasuredFieldCentrePoints; }
- void GetMeasuredFieldCentrePoints(std::vector<CPoint>& a_listMeasuredFieldCentrePoints) { m_listMeasuredFieldCentrePoints = a_listMeasuredFieldCentrePoints; }
- void SetMeasuredFieldCentrePoints(std::vector<CPoint> listPoint);
- // measure area
- CDomainPtr GetMeasureArea() { return m_pMeasureArea; }
- void SetMeasureArea(CDomainPtr a_pMeasureArea);
- // image scan parameter
- COTSImageScanParamPtr GetImageScanParam() { return m_poImageScanParam; }
- void SetImageScanParam(COTSImageScanParamPtr a_poImageScanParam);
- // SEM data (measurement)
- CSEMDataMsrPtr GetSEMDataMsr() { return m_poSEMDataMsr; }
- void SetSEMDataMsr(CSEMDataMsrPtr a_poSEMDataMsr);
- protected:
- // field centre points list
- std::vector<CPoint> m_listFieldCentrePoints;
- // unmeasured field centre points list
- std::vector<CPoint> m_listUnmeasuredFieldCentrePoints;
- // measured field centre points list
- std::vector<CPoint> m_listMeasuredFieldCentrePoints;
- // measure area
- CDomainPtr m_pMeasureArea;
- // image scan parameter
- COTSImageScanParamPtr m_poImageScanParam;
- // SEM data (measurement)
- CSEMDataMsrPtr m_poSEMDataMsr;
- // calculate field centre points list
- BOOL CalculateFieldCentrePoints1(std::vector<CPoint>& a_listMeasuredFieldCentrePoints);
- // test if field is in or partly in the measure domain area
- BOOL IsInMeasureArea(CPoint a_poiField, CSize a_sizeImageSize);
- // test if field is in the measured field centre points list
- BOOL IsInMeasuredFieldList(CPoint a_poiField);
- // find the next field centre
- BOOL FindNeighborFieldCentre(const std::vector<CPoint>& a_listFieldCentres,
- double a_dScanFieldSizeX,
- double a_dScanFieldSizeY,
- CPoint a_poiCurrent,
- SORTING_DIRECTION& a_nDirection,
- CPoint& a_poiNeighbor);
- // find field centre closest to measure domain point
- BOOL FindFieldCentreClosestMeasureDomainCentre(const std::vector<CPoint>& a_listFieldCentres, CPoint a_poiMeasureDomain, CPoint& a_poi);
- // find right far side field centre
- void FindRightFieldCentre(const std::vector<CPoint>& a_listFieldCentres, CPoint& a_poi);
- // find left far side field centre
- void FindLeftFieldCentre(const std::vector<CPoint>& a_listFieldCentres, CPoint& a_poi);
- // find top far side field centre
- void FindTopFieldCentre(const std::vector<CPoint>& a_listFieldCentres, CPoint& a_poi);
- // find below far side field centre
- void FindBottomFieldCentre(const std::vector<CPoint>& a_listFieldCentres, CPoint& a_poi);
- // test if this is a neighbor point
- BOOL IsNeighborFieldCentre(CPoint a_poiFieldCentre,
- CPoint a_poiCurrent,
- double a_dScanFieldSizeX,
- double a_dScanFieldSizeY,
- SORTING_DIRECTION& a_nDirection);
- // get a random number in a given range
- int GetRangedRandNumber(int a_nRange_min, int a_nRange_max);
- // test if field is in or partly in the measure domain area
- BOOL IsInPolygonMeasureArea(CPoint a_poiField, CSize a_sizeImageSize, std::vector<CPoint> ptPolygon);
- BOOL PtInPolygon(CPoint p, const std::vector<CPoint> ptPolygon);
- };
- typedef std::shared_ptr<CFieldMgr> __declspec(dllexport) CFieldMgrPtr;
- }
|