123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- #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, int a_FieldStartMode);
- // unmeasured field centre points list
- std::vector<CPoint> GetUnmeasuredFieldCentrePoints(std::vector<CPoint> a_listHaveMeasuredFieldCentrePoints);
- // field centre points list
- std::vector<CPoint> GetFieldCentrePoints();
- BOOL IsThisPointInMeasureArea(CPoint a_position);
-
- int GetTotalFields();
-
- //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;
- }
- int GetEffectiveFieldWidth();
- int GetEffectiveFieldHeight();
-
- COTSFieldDataPtr FindNeighborField(const COTSFieldDataList a_flds, COTSFieldDataPtr centerField, SORTING_DIRECTION a_direction);
- bool FindNeighborField(const std::vector<CPoint> a_flds, CPoint a_centerField, CPoint& neighbor,SORTING_DIRECTION a_direction);
- protected:
- // measure area
- CDomainPtr m_pMeasureArea;
-
- int m_overlap=0;
- int m_ScanFieldSize;
- CSize m_ResolutionSize;
- int m_fieldStartMode;
- // calculate field centre points list
- std::vector<CPoint> CalculateFieldCentrePoints();
-
- // 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);
-
- // 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;
- }
|