Ver código fonte

add missing file ST_MSTMsg.cs

gsp 1 ano atrás
pai
commit
51f7ce6f29

+ 274 - 0
OTSIncAMeasureApp/1-OTSMeasure/Measure/3-MeasureFlow/ST_MSTMsg.cs

@@ -0,0 +1,274 @@
+using OTSCLRINTERFACE;
+using OTSDataType;
+using OTSModelSharp;
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+
+using static OTSDataType.otsdataconst;
+
+namespace OTSMeasureApp._1_OTSMeasure.Measure._3_MeasureFlow
+{
+    public enum ENUM_MSG_TYPE
+    {
+        MTHREADSTATUS = 1001,
+        MSAMPLESTATUS = 1002,
+        MSAMPLERESULT = 1003
+    };
+
+
+    public enum MSAMPLE_RET
+    {
+        BSE_DATA = 0,
+        FIELD_DATA = 1,
+        START_MSR_FIELD = 2
+
+    };
+
+    public struct SMSR_COMPLETE_DATA
+    {
+        public OTS_MSR_THREAD_STATUS MsrStatus;
+        public string csMsrStartTime;
+        public int iMsrCompleteSampleCount;
+        public int iMsrCompleteFieldCount;
+        public int iParticleCount;
+        public TimeSpan MsrUsedTime;
+        public string csMsrEndTime;
+    };
+
+
+
+    public struct STMThreadStatus
+    {
+        public OTS_MSR_THREAD_STATUS iMsrStatu;        //OTS_MSR_THREAD_STATUS
+        public string csMsrStartTime;   //MSR_START_TIME
+        public string csMsrEndTime;     //MSR_END_TIME
+        public SMSR_COMPLETE_DATA SMsrCompleteData;
+    };
+    public struct STMSampleStatus
+    {
+        public OTS_MSR_SAMPLE_STATUS iMsrSampleStatu;    //OTS_MSR_SAMPLE_STATUS
+        public string cSampleName;
+        public string csSampleMsrStartTime;
+        public List<PointF> BCompleteFieldList;
+    };
+
+
+    public struct STMSampleResultData
+    {
+        public MSAMPLE_RET iRetDataType;                 //ENUM_MEASURE_SAMPLE_RESULT
+
+        public struct RBSEDATA
+        {
+            public int fieldId;
+            public System.Drawing.Point pos;
+            public int iBSEDataHeight;
+            public int iBSEDataWidth;
+            public byte[] lpBSEData;
+        };
+
+        public struct SAMPLEFIELDDATA
+        {
+            public System.Drawing.Point FieldPos;
+            public int iMeasureFieldCount;
+            public int iCompleteFieldCount;
+            public int iSParticleCount;     // Field particle count
+            public TimeSpan TUsedTime;
+        };
+
+        public struct StartToMsrField
+        {
+            public System.Drawing.Point FieldPos;
+        };
+
+        public RBSEDATA BSEData;
+        public SAMPLEFIELDDATA SFieldData;
+        public StartToMsrField SMsrField;
+    };
+
+    public class ST_MSTMsg
+    {
+        private COTSSample m_sample;
+        private CMsrThreadStatus m_msrStatus;
+        private CMsrSampleStatus m_sampleStatus;
+        private COTSFieldData m_curFld;
+        public ENUM_MSG_TYPE iMsgType;
+        public STMThreadStatus STMThreadStu;
+        public STMSampleStatus STMSampleStu;
+        public STMSampleResultData STMSampleRetData;
+        public ST_MSTMsg(CMsrThreadStatus measurestatus)
+        {
+            m_msrStatus = measurestatus;
+        }
+
+      
+
+        public ST_MSTMsg(COTSSample sample)
+        {
+            m_sample = sample;
+            m_sampleStatus = sample.GetMsrStatus();
+        }
+        public ST_MSTMsg(COTSSample sample,COTSFieldData curfld)
+        {
+            m_sample = sample;
+            m_sampleStatus = sample.GetMsrStatus();
+            m_curFld = curfld;
+        }
+        internal void InitThreadOverMsg()
+        {
+            iMsgType = ENUM_MSG_TYPE.MTHREADSTATUS;
+            STMThreadStu.iMsrStatu = m_msrStatus.GetStatus();
+            DateTime timeEnd = m_msrStatus.GetEndTime();
+            STMThreadStu.csMsrEndTime = timeEnd.ToString("yyyy-MM-dd HH:mm:ss");
+        }
+
+    
+        public void InitThreadStartMsg()
+        {
+
+            iMsgType = ENUM_MSG_TYPE.MTHREADSTATUS;
+           
+            DateTime timeStart = m_msrStatus.GetStartTime();
+            STMThreadStu.iMsrStatu = OTS_MSR_THREAD_STATUS.INPROCESS;
+            STMThreadStu.csMsrStartTime = timeStart.ToShortDateString();
+        }
+
+       
+
+      
+
+        internal void InitThreadPausedMsg()
+        {
+            this.iMsgType = ENUM_MSG_TYPE.MSAMPLESTATUS;
+           STMThreadStu.iMsrStatu = OTS_MSR_THREAD_STATUS.PAUSED;
+            STMSampleStu.iMsrSampleStatu = OTS_MSR_SAMPLE_STATUS.PAUSED;
+           STMThreadStu.csMsrEndTime = DateTime.Now.ToShortDateString();
+            STMThreadStu.iMsrStatu = OTS_MSR_THREAD_STATUS.PAUSED;
+        }
+
+        internal void InitThreadStoppedMsg()
+        {
+            iMsgType = ENUM_MSG_TYPE.MSAMPLESTATUS;
+            STMThreadStu.iMsrStatu = OTS_MSR_THREAD_STATUS.STOPPED;
+            STMSampleStu.iMsrSampleStatu = OTS_MSR_SAMPLE_STATUS.STOPPED;
+            STMThreadStu.csMsrEndTime = DateTime.Now.ToShortDateString();
+            STMThreadStu.iMsrStatu = OTS_MSR_THREAD_STATUS.STOPPED;
+        }
+
+        internal void InitThreadFailedMsg()
+        {
+            iMsgType = ENUM_MSG_TYPE.MSAMPLESTATUS;
+           STMSampleStu.iMsrSampleStatu = OTS_MSR_SAMPLE_STATUS.FAILED;
+        }
+
+        internal void InitThreadSucceedMsg()
+        {
+            iMsgType = ENUM_MSG_TYPE.MSAMPLESTATUS;
+            STMSampleStu.iMsrSampleStatu = OTS_MSR_SAMPLE_STATUS.SUCCESSED;
+        }
+
+       
+
+        internal void InitSampleStartMsg()
+        {
+            this.iMsgType = ENUM_MSG_TYPE.MSAMPLESTATUS;
+            this.STMSampleStu.iMsrSampleStatu = OTS_MSR_SAMPLE_STATUS.INPROCESS;
+            this.STMSampleStu.cSampleName = m_sample.GetName();
+            
+        }
+
+        internal void InitSamplePausedMsg()
+        {
+            this.iMsgType = ENUM_MSG_TYPE.MSAMPLESTATUS;
+            //this.STMThreadStu.iMsrStatu = m_sample.GetMsrStatus().GetStatus();
+            this.STMSampleStu.iMsrSampleStatu = OTS_MSR_SAMPLE_STATUS.PAUSED;
+            this.STMThreadStu.csMsrEndTime = DateTime.Now.ToShortDateString();
+        }
+        internal void InitSampleCompleteMsg()
+        {
+            this.iMsgType = ENUM_MSG_TYPE.MSAMPLESTATUS;
+            this.STMSampleStu.iMsrSampleStatu = OTS_MSR_SAMPLE_STATUS.SUCCESSED;
+            this.STMSampleStu.cSampleName = m_sample.GetName(); ;
+        }
+
+        internal void InitFieldStartMsg()
+        {
+            var poiFieldCentre = m_curFld.GetOTSPosition();
+            this.iMsgType = ENUM_MSG_TYPE.MSAMPLERESULT;
+            this.STMSampleRetData.iRetDataType = MSAMPLE_RET.START_MSR_FIELD;
+            this.STMSampleRetData.SMsrField.FieldPos = new Point((int)poiFieldCentre.X, (int)poiFieldCentre.Y);
+        }
+
+        internal void InitFieldBSEImageMsg()
+        {
+            var poiFieldCentre = m_curFld.GetOTSPosition();
+            var pBSEImg = m_curFld.GetBSEImage();
+            this.iMsgType = ENUM_MSG_TYPE.MSAMPLERESULT;
+            this.STMSampleRetData.iRetDataType = MSAMPLE_RET.BSE_DATA;
+            this.STMSampleRetData.BSEData.pos.X = (int)poiFieldCentre.X;
+            this.STMSampleRetData.BSEData.pos.Y = (int)poiFieldCentre.Y;
+            this.STMSampleRetData.BSEData.iBSEDataHeight = pBSEImg.GetHeight();
+            this.STMSampleRetData.BSEData.iBSEDataWidth = pBSEImg.GetWidth();
+            byte[] pImgData = pBSEImg.GetImageDataPtr();
+            this.STMSampleRetData.BSEData.lpBSEData = pImgData;
+        }
+
+        internal void InitFieldDataMsg()
+        {
+            var pStatus = m_sample.GetMsrStatus();
+           iMsgType = ENUM_MSG_TYPE.MSAMPLERESULT;
+           STMSampleRetData.iRetDataType = MSAMPLE_RET.FIELD_DATA;
+           STMSampleRetData.SFieldData.iCompleteFieldCount = pStatus.GetCompletedFields();
+           STMSampleRetData.SFieldData.iMeasureFieldCount = m_sample.GetFieldsData().Count;
+           STMSampleRetData.SFieldData.iSParticleCount = (int)m_curFld.GetListAnalysisParticles().Count;
+           STMSampleRetData.SFieldData.FieldPos.X = Convert.ToInt32(m_curFld.OTSPos.X);
+           STMSampleRetData.SFieldData.FieldPos.Y = Convert.ToInt32(m_curFld.OTSPos.Y);
+        }
+        internal void InitHolePreThreadInProcessMsg()
+        {
+            iMsgType = ENUM_MSG_TYPE.MTHREADSTATUS;
+            STMThreadStu.iMsrStatu = OTS_MSR_THREAD_STATUS.INPROCESS;
+        }
+
+        internal void InitHolePreThreadStoppedMsg()
+        {
+            iMsgType = ENUM_MSG_TYPE.MSAMPLESTATUS;
+            STMSampleStu.iMsrSampleStatu = OTS_MSR_SAMPLE_STATUS.STOPPED;
+        }
+
+        internal void InitHolePreThreadFailedMsg()
+        {
+            iMsgType = ENUM_MSG_TYPE.MSAMPLESTATUS;
+            STMSampleStu.iMsrSampleStatu = OTS_MSR_SAMPLE_STATUS.FAILED;
+
+        }
+
+        internal void InitHolePreThreadSucceedMsg()
+        {
+            iMsgType = ENUM_MSG_TYPE.MTHREADSTATUS;
+            STMSampleStu.iMsrSampleStatu = OTS_MSR_SAMPLE_STATUS.SUCCESSED;
+
+        }
+        internal void InitHolePreBSEDataMsg(CBSEImgClr pBSEIamge,Point poiFieldCenter)
+        {
+            var poiFieldCentre = poiFieldCenter;
+            var pBSEImg = pBSEIamge;
+            this.iMsgType = ENUM_MSG_TYPE.MSAMPLERESULT;
+            this.STMSampleRetData.iRetDataType = MSAMPLE_RET.BSE_DATA;
+            this.STMSampleRetData.BSEData.pos.X = (int)poiFieldCentre.X;
+            this.STMSampleRetData.BSEData.pos.Y = (int)poiFieldCentre.Y;
+            this.STMSampleRetData.BSEData.iBSEDataHeight = pBSEImg.GetHeight();
+            this.STMSampleRetData.BSEData.iBSEDataWidth = pBSEImg.GetWidth();
+            byte[] pImgData = pBSEImg.GetImageDataPtr();
+            this.STMSampleRetData.BSEData.lpBSEData = pImgData;
+        }
+
+        internal void InitHolePreSampleEndMsg()
+        {
+            iMsgType = ENUM_MSG_TYPE.MTHREADSTATUS;
+            STMThreadStu.iMsrStatu = OTS_MSR_THREAD_STATUS.COMPLETED;
+        }
+
+      
+    }
+}