123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- #pragma once
- #include "Domain.h"
- #include "OTSImageScanParam.h"
- #include "SEMDataMsr.h"
- #include "OTSFieldData.h"
- namespace OTSIMGPROC {
-
- // 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(int scanfieldsize, CSize a_ResolutionSize); // constructor
- virtual ~CFieldMgr(); // destructor
- // initialization
- BOOL Init(CDomainPtr a_pMeasureArea,CSize a_ResolutionSize,int a_scanfieldsize, int a_FieldStartMode);
- // unmeasured field centre points list
- std::vector<CPoint> GetUnmeasuredFieldCentrePoints(std::vector<CPoint> a_listHaveMeasuredFieldCentrePoints);
- // reset
- BOOL Reset(CDomainPtr a_pMeasureArea,
- CSize a_ResolutionSize, int a_FieldStartMode,
- int a_scanFieldSize,
- 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() { auto m_listFieldCentrePoints = CalculateFieldCentrePoints1(); return m_listFieldCentrePoints; }
- BOOL GetFieldRectByIndex(int a_nIndex, CRect& a_rctField);
- int GetTotalFields() { auto m_listFieldCentrePoints = CalculateFieldCentrePoints1(); return (int)m_listFieldCentrePoints.size(); }
-
- //overlap
- int GetOverlap() { return m_Overlap; }
- void SetOverlap(int a_Overlap)
- {
- m_Overlap = a_Overlap;
- }
- // measure area
- CDomainPtr GetMeasureArea() { return m_pMeasureArea; }
- void SetMeasureArea(CDomainPtr a_pMeasureArea);
- // SEM data (measurement)
- int GetScanFieldSize() { return m_ScanFieldSize; }
- void SetScanFieldSize(int a_FieldSize)
- {
- m_ScanFieldSize = a_FieldSize;
- }
- COTSFieldDataPtr FindNeighborField(const COTSFieldDataList a_flds, COTSFieldDataPtr centerField, SORTING_DIRECTION a_direction);
- protected:
- // measure area
- CDomainPtr m_pMeasureArea;
-
- int m_Overlap;
- int m_ScanFieldSize;
- CSize m_ResolutionSize;
- int m_fieldStartMode;
- // calculate field centre points list
- std::vector<CPoint> CalculateFieldCentrePoints1();
- // 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 ,std::vector<CPoint> m_listHaveMeasuredFieldCentrePoints);
- // 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 FindRightMostFieldCentre(const std::vector<CPoint>& a_listFieldCentres, CPoint& a_poi);
- // find left far side field centre
- void FindLeftMostFieldCentre(const std::vector<CPoint>& a_listFieldCentres, CPoint& a_poi);
- // find top far side field centre
- void FindHeighestFieldCentre(const std::vector<CPoint>& a_listFieldCentres, CPoint& a_poi);
- // find below far side field centre
- void FindLowestFieldCentre(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;
- }
|