123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Xml;
- using static OTSDataType.otsdataconst;
- namespace OTSDataType
- {
- public class COTSImgScanPrm : ISlo
- {
- private OTS_MEASURE_STOP_MODE m_nStopMode;
- private int m_nStopParamMeasTime;
- private int m_nStopParamFields;
- private int m_nStopParamParticles;
- private OTS_GET_IMAGE_MODE m_nSatrtImageMode;
- private OTS_THREE_TIES_OPTIONS m_nScanImageSpeed;
- private OTS_FIVE_TIES_OPTIONS m_nImagePixelSize;
- private OTS_MEASURE_FIELD_STOP_MODE m_nFieldStopMode;
- private int m_nFieldAreaPercentage;
- private int m_nFieldLargeParticles;
- private int m_nFieldLargeParticlesPercentage;
- private int m_nFieldSmallParticles;
- private int m_nFieldSmallParticlesPercentage;
-
- const OTS_MEASURE_STOP_MODE DEFUALT_MEASURE_STOP_MODE = OTS_MEASURE_STOP_MODE.CoverMode;
- // stop parameters
- const int DEFUALT_PARAM_FIELD = 500;
- const int DEFUALT_PARAM_TIME = 300;
- const int DEFUALT_PARAM_PARTICLE = 5000;
- // image mode
- const OTS_GET_IMAGE_MODE DEFAULT_IMAGEMODE = OTS_GET_IMAGE_MODE.FROM_CENTER;
- // scan speed
- const OTS_THREE_TIES_OPTIONS DEFAULE_SCAN_SPEED = OTS_THREE_TIES_OPTIONS.meddium;
- // image size
- const OTS_FIVE_TIES_OPTIONS DEFAULE_IMAGE_SIZE = OTS_FIVE_TIES_OPTIONS.TIE3;
- void Init()
- {
- m_nStopMode = DEFUALT_MEASURE_STOP_MODE; //测量终止方式
- m_nStopParamMeasTime = DEFUALT_PARAM_TIME; //测量时间
- m_nStopParamFields = DEFUALT_PARAM_FIELD; //帧图数
- m_nStopParamParticles = DEFUALT_PARAM_PARTICLE; //夹杂物数
- m_nSatrtImageMode = DEFAULT_IMAGEMODE; //取图方式
- m_nScanImageSpeed = DEFAULE_SCAN_SPEED;
- m_nImagePixelSize = DEFAULE_IMAGE_SIZE;
- m_nFieldStopMode = OTS_MEASURE_FIELD_STOP_MODE.ParticlesPercentage;
- m_nFieldAreaPercentage = 100;
- m_nFieldLargeParticles = 1000;
- m_nFieldLargeParticlesPercentage = 100;
- m_nFieldSmallParticles = 10000;
- m_nFieldSmallParticlesPercentage = 100;
- }
- public COTSImgScanPrm ()
- {
- // copy data over
- Init();
- }
- void Duplicate( COTSImgScanPrm a_oSource)
- {
- // copy data over
- m_nStopMode = a_oSource.m_nStopMode;
- m_nStopParamMeasTime = a_oSource.m_nStopParamMeasTime;
- m_nStopParamFields = a_oSource.m_nStopParamFields;
- m_nStopParamParticles = a_oSource.m_nStopParamParticles;
- m_nSatrtImageMode = a_oSource.m_nSatrtImageMode;
- m_nImagePixelSize = a_oSource.m_nImagePixelSize;
- m_nScanImageSpeed = a_oSource.m_nScanImageSpeed;
- m_nFieldStopMode = a_oSource.m_nFieldStopMode;
- m_nFieldAreaPercentage = a_oSource.m_nFieldAreaPercentage;
- m_nFieldLargeParticles = a_oSource.m_nFieldLargeParticles;
- m_nFieldLargeParticlesPercentage = a_oSource.m_nFieldLargeParticlesPercentage;
- m_nFieldSmallParticles = a_oSource.m_nFieldSmallParticles;
- m_nFieldSmallParticlesPercentage = a_oSource.m_nFieldSmallParticlesPercentage;
-
- }
- public COTSImgScanPrm ( COTSImgScanPrm a_oSource)
- {
-
- // copy data over
- Duplicate(a_oSource);
- }
- public bool Equals(COTSImgScanPrm a_oSource)
- {
- // return test result
- return((m_nStopMode == a_oSource.m_nStopMode) &&
- (m_nStopParamMeasTime == a_oSource.m_nStopParamMeasTime) &&
- (m_nStopParamFields == a_oSource.m_nStopParamFields) &&
- (m_nStopParamParticles == a_oSource.m_nStopParamParticles) &&
- (m_nSatrtImageMode == a_oSource.m_nSatrtImageMode) &&
- (m_nImagePixelSize == a_oSource.m_nImagePixelSize));
- }
- //测量终止方式
- public OTS_MEASURE_STOP_MODE GetStopMode() { return m_nStopMode; }
- public void SetStopMode(OTS_MEASURE_STOP_MODE a_nStopMode) { m_nStopMode = a_nStopMode; }
- //测量时间
- public int GetStopParamMeasTime() { return m_nStopParamMeasTime; }
- public void SetStopParamMeasTime(int a_nStopParamMeasTime) { m_nStopParamMeasTime = a_nStopParamMeasTime; }
- //帧图数
- public int GetStopParamFields() { return m_nStopParamFields; }
- public void SetStopParamFields(int a_nStopParamFields) { m_nStopParamFields = a_nStopParamFields; }
- //夹杂物数
- public int GetStopParamParticles() { return m_nStopParamParticles; }
- public void SetStopParamParticles(int a_nStopParamParticles) { m_nStopParamParticles = a_nStopParamParticles; }
- //测量帧终止方式
- //no longer consider the field stop mode ,for we can get the same result by regulate the min size of particle to filter the too small particles.
- public OTS_MEASURE_FIELD_STOP_MODE GetFieldStopMode() { return m_nFieldStopMode; }
- public void SetFieldStopMode(OTS_MEASURE_FIELD_STOP_MODE a_nFieldStopMode) { m_nFieldStopMode = a_nFieldStopMode; }
- //帧完成面积百分比
- public int GetFieldAreaPercentage() { return m_nFieldAreaPercentage; }
- public void SetFieldAreaPercentage(int a_nAreaPercentage) { m_nFieldAreaPercentage = a_nAreaPercentage; }
- //帧完成大颗粒数
- public int GetFieldLargeParticleNum() { return m_nFieldLargeParticles; }
- public void SetFieldLargeParticleNum(int a_nLargeParticles) { m_nFieldLargeParticles = a_nLargeParticles; }
- //帧完成大颗粒百分比
- public int GetFieldLargeParticlesPercentage() { return m_nFieldLargeParticlesPercentage; }
- public void SetFieldLargeParticlePercentage(int a_nLargeParticlesPercentage) { m_nFieldLargeParticlesPercentage = a_nLargeParticlesPercentage; }
- //帧完成小颗粒数
- public int GetFieldSmallParticleNum() { return m_nFieldSmallParticles; }
- public void SetFieldSmallParticleNum(int a_nSmallParticles) { m_nFieldSmallParticles = a_nSmallParticles; }
- //帧完成小颗粒数百分比
- public int GetFieldSmallParticlesPercentage() { return m_nFieldSmallParticlesPercentage; }
- public void SetFieldSmallParticlePercentage(int a_nSmallParticlesPercentage) { m_nFieldSmallParticlesPercentage = a_nSmallParticlesPercentage; }
- //取图方式
- public OTS_GET_IMAGE_MODE GetFieldStartMode() { return m_nSatrtImageMode; }
- public void SetStartImageMode(OTS_GET_IMAGE_MODE a_nSatrtImageMode) { m_nSatrtImageMode = a_nSatrtImageMode; }
- //扫描图尺寸
- public OTS_FIVE_TIES_OPTIONS GetImagePixelSize() { return m_nImagePixelSize; }
- public void SetImagePixelSize(OTS_FIVE_TIES_OPTIONS a_nImagePixelSize) { m_nImagePixelSize = a_nImagePixelSize; }
- //扫描图精度
- public OTS_THREE_TIES_OPTIONS GetScanImageSpeed() { return m_nScanImageSpeed; }
- public void SetScanImageSpeed(OTS_THREE_TIES_OPTIONS a_nScanImageSpeed) { m_nScanImageSpeed = a_nScanImageSpeed; }
-
- public override void Serialize(bool isStoring, XmlDocument classDoc, XmlNode rootNode)
- {
- xInt xnStopMode=new xInt();
- xInt xnStopParamMeasTime=new xInt();
- xInt xnStopParamFields = new xInt();
- xInt xnStopParamParticles = new xInt();
- xInt xnSatrtImageMode = new xInt();
- xInt xnScanImageSpeed = new xInt();
- xInt xnImagePixelSize = new xInt();
- xInt xnFieldStopMode = new xInt();
- xInt xnFieldAreaPercentage = new xInt();
- xInt xnFieldLargeParticles = new xInt();
- xInt xnFieldLargeParticlePercentage = new xInt();
- xInt xnFieldSmallParticles = new xInt();
- xInt xnFieldSmallParticlePercentage = new xInt();
-
- Slo slo=new Slo();
- slo.Register("StopMode", xnStopMode);
- slo.Register("StopParamMeasTime", xnStopParamMeasTime);
- slo.Register("StopParamFields", xnStopParamFields);
- slo.Register("StopParamParticles", xnStopParamParticles);
- slo.Register("SatrtImageMode", xnSatrtImageMode);
- slo.Register("ScanImageSpeed", xnScanImageSpeed);
- slo.Register("ImagePixelSize", xnImagePixelSize);
- slo.Register("FieldStopMode", xnFieldStopMode);
- slo.Register("FieldAreaPercentage", xnFieldAreaPercentage);
- slo.Register("FieldLargeParticles", xnFieldLargeParticles);
- slo.Register("FieldLargeParticlePercentage", xnFieldLargeParticlePercentage);
- slo.Register("FieldSmallParticles", xnFieldSmallParticles);
- slo.Register("FieldSmallParticlePercentage", xnFieldSmallParticlePercentage);
-
- if (isStoring)
- {
- xnStopMode.AssignValue((int)m_nStopMode);
- xnStopParamMeasTime.AssignValue((int) m_nStopParamMeasTime);
- xnStopParamFields.AssignValue((int)m_nStopParamFields);
- xnStopParamParticles.AssignValue((int)m_nStopParamParticles);
- xnSatrtImageMode.AssignValue((int)m_nSatrtImageMode);
- xnScanImageSpeed.AssignValue( (int)m_nScanImageSpeed);
- xnImagePixelSize.AssignValue( (int)m_nImagePixelSize);
- xnFieldStopMode.AssignValue((int)m_nFieldStopMode);
- xnFieldSmallParticles.AssignValue((int)m_nFieldSmallParticles);
- xnFieldSmallParticlePercentage .AssignValue((int)m_nFieldSmallParticlesPercentage);
-
- slo.Serialize(true, classDoc, rootNode);
- }
- else
- {
- slo.Serialize(false, classDoc, rootNode);
- m_nStopMode = (OTS_MEASURE_STOP_MODE)xnStopMode.value();
- m_nStopParamMeasTime = xnStopParamMeasTime.value();
- m_nStopParamFields = xnStopParamFields.value();
- m_nStopParamParticles = xnStopParamParticles.value();
- m_nSatrtImageMode = (OTS_GET_IMAGE_MODE)xnSatrtImageMode.value();
- m_nScanImageSpeed = (OTS_THREE_TIES_OPTIONS)xnScanImageSpeed.value();
- m_nImagePixelSize = (OTS_FIVE_TIES_OPTIONS)xnImagePixelSize.value();
- m_nFieldStopMode = (OTS_MEASURE_FIELD_STOP_MODE)xnFieldStopMode.value();
- m_nFieldAreaPercentage = xnFieldAreaPercentage.value();
- m_nFieldLargeParticles = xnFieldLargeParticles.value();
- m_nFieldLargeParticlesPercentage = xnFieldLargeParticlePercentage.value();
- m_nFieldSmallParticles = xnFieldSmallParticles.value();
- m_nFieldSmallParticlesPercentage = xnFieldSmallParticlePercentage.value();
-
- }
- }
-
- }
- }
|