| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196 | #pragma once#include "BSEImg.h"#include "stdafx.h"#include "SEMCommonConst.h"namespace OTSController{	using namespace OTSDATA;	const CString SIMULATION_IMAGE_FILEPATH = _T("Simulate");	const CString SIMULATION_IMAGE_FILENAME = _T("SimImage.bmp");	const CString SIMULATION_TIFFIMAGE_FILENAME = _T("SimImage.tif");	const CString SIMULATION_JPEGIMAGE_FILENAME = _T("SimImage.jpg");	const CString SIMULATION_PNGIMAGE_FILENAME = _T("SimImage.png");		/// <summary>	/// Interface of Image Acquisition Device	/// </summary>	class __declspec(dllexport) COTSScanBase	{	public:		enum DEFAULT_SCAN_PARAMETER		{			SCAN_MAX_X = 4096,			SCAN_MAX_Y = 3200,			SCAN_STEP_SIZE = 4,			SCAN_PIXEL_DWELL = 1,			SCAN_INTER_PIXEL_DWELL = 1,			SCAN_NUMBER_OF_READS = 1,			SCAN_IMATRIX = 4		};	public:		COTSScanBase();		~COTSScanBase();		/// instance termination		//virtual void FinishedInstance() = 0;		// get name		CString GetName()		{			CString strR = ScanController::GetName((int)GetType());			return strR;		}		virtual ScanController::SCANNER_ID GetType() = 0;		// initialization		virtual BOOL Init() = 0;		/// <summary>		/// Capture a backscatter image, and apply any post processing.		/// Note: The scanner interface seems to be heavily polluted by edax specific parameters		/// passed to this and many other functions. The edax scanner collects a frame based		/// on these parameters, other scanners (e.g. bruker,) rely on internal state set		/// via SetImageSize, SetDwellTime etc.		/// </summary>		virtual CBSEImgPtr AcquireBSEImage(int a_nMatrixIndex, int a_nReads, int a_nDwell) = 0;		// move beam to point		virtual BOOL MoveBeamTo(CPoint& a_beamPos) = 0;		// Set and Start Scan		//virtual BOOL SetAndStartScan(void) = 0;		// Set point Scan		virtual BOOL SetPointScan(int a_nMatrixIndex) = 0;		// Start Scan Table		virtual BOOL StartScanTable(int a_nMatrixIndex, unsigned int nP, int* pnx, int* pny) = 0;		/// set dwell time		virtual BOOL SetDwellTime(long a_nDwellTime) = 0;		// set Image Size		virtual BOOL SetImageSize(long a_nImageSize,long nHeight) = 0;		/// <summary>		/// Gets the size of the matrix.		/// </summary>		/// <param name="a_nMatrixIndex">Index of the matrix.</param>		/// <returns>the size of Matrix</returns>		virtual CSize GetMatrixSize(int a_nMatrixIndex) = 0;		/// <summary>		/// Sets the size of the scan field.		/// Note: only for simulation mode		/// </summary>		/// <param name="a_nWidth">The scan field width</param>		/// <param name="a_nHeight">The scan field height</param>		/// <returns>TRUE: successful</returns>		virtual BOOL SetScanFieldSize(const int a_nWidth, const int a_nHeight) = 0;		/// <summary>		/// Set the em position		/// Note: only for simulation mode		/// </summary>		/// <param name="a_nPosX">The EM position X</param>		/// <param name="a_nPosY">The EM position Y</param>		/// <returns>TRUE: successful</returns>		virtual BOOL SetEMPosition(const int a_nPosX, const int a_nPosY) = 0;		virtual long GetDwellTimeByIndex(const long a_nIndex) = 0;		virtual BOOL SetDwellTimeByIndex(const long a_nIndex) = 0;			/// <summary>		/// Determines whether this instance is bruker controller.		/// </summary>		/// <returns>TRUE: is bruker type</returns>		BOOL IsBruker();		CBSEImgPtr AcquireBSEImageFromBitmapFile();		CBSEImgPtr AcquireBSEImageFromTiffFile();		CBSEImgPtr AcquireBSEImageFromJpegFile();		CBSEImgPtr AcquireBSEImageFromPngFile();		CSize GetScanRange() { return m_szScanRange; }		void SetScanRange(CSize a_szScanRange) { m_szScanRange = a_szScanRange; }		int GetScanStepSize() { return m_nScanStepSize; }		void SetScanStepSize(int size) { m_nScanStepSize = size; }		int GetInterPixelDwell() { return m_nInterPixelDwell; }		void SetInterPixelDwell(int i) { m_nInterPixelDwell = i; }		int GetNumberOfReads() { return m_nNumberOfReads; }		void SetNumberOfReads(int i) { m_nNumberOfReads = i; }		double GetMagnification() { return m_dMag; }		void SetMagnification(double a_dMag) { m_dMag = a_dMag; }		int GetMaxSizeIndex();	public:		CSize   m_fieldSizes[7];		CSize	m_szScanRange;		DWORD	m_nFrameStoreSizeWords;		WORD*	m_pnFrameStore;		int		m_nScanStepSize;		int		m_nPixelDwell;		int		m_nInterPixelDwell;		int		m_nNumberOfReads;		int		m_nMatrix;		double  m_dMag;		// for simulation:		CBSEImgPtrVec m_simFieldList;		std::vector<CPoint> m_simFieldPos;		CRect m_simRect;		int m_nCurrentBSEPositionX;		int m_nCurrentBSEPositionY;		int m_nScanFieldSizeX;		int m_nScanFieldSizeY;		BOOL m_bIsSimuation;		// get company system data path		CString GetCompanySysDataPathName()		{			// get common data pathname string			CString strCommonDataPathName = GetOSCommonDataPathName();			if (strCommonDataPathName.IsEmpty())			{				// failed to get common data pathname string				LogErrorTrace(__FILE__, __LINE__, _T("GetOTSPackSysDataPathName: failed to common data pathname string."));				return _T("");			}			// company system data pathname			CString strCmpSysDataPath = strCommonDataPathName + STR_COMPANYNAME  + _T("\\");			// return company system data pathname 			return strCmpSysDataPath;		}		// get system common data folder pathname		// return "" if failed		CString GetOSCommonDataPathName()		{			 CString strPathName = _T(".\\");						return strPathName;		}		// check if the file exists or not		BOOL Exists(LPCTSTR a_sPath)		{			return ::PathFileExists(a_sPath) == TRUE;		}	};	typedef std::shared_ptr<COTSScanBase> COTSScanBasePtr;} // namespace Controller
 |