Exemple #1
0
 private void ShowImage(HT10D_Info mHT10D_Info)
 {
     if (mHT10D_Info.AViewImage != null)
     {
         pictureBox1.Image = mHT10D_Info.AViewImage;
     }
     if (mHT10D_Info.BViewImage != null)
     {
         pictureBox1.Image = mHT10D_Info.BViewImage;
     }
 }
Exemple #2
0
        private void OpenFile(string fileName)
        {
            HT10D_Info       mHT10D_Info       = new HT10D_Info();
            HT10D_FileReader mHT10D_FileReader = new HT10D_FileReader();

            mHT10D_Info = mHT10D_FileReader.ReadFileSummary(fileName);


            ShowImage(mHT10D_Info);
            ShowAView(mHT10D_Info);
        }
Exemple #3
0
 private void GetAViewList(HT10D_Info mHT10D_Info, short[] data_list, int index)
 {
     short[] AView = new short[AViewLength];
     for (int i = 0; i < AViewLength / 2; i++)
     {
         short temp  = data_list[index + i + 1];
         byte  byte2 = (byte)temp;
         byte  byte1 = (byte)(temp >> 8);
         AView[i * 2]     = byte1;
         AView[i * 2 + 1] = byte2;
     }
     mHT10D_Info.AViewList.Add(AView);
 }
Exemple #4
0
 /// <summary>
 /// 显示波形
 /// </summary>
 /// <param name="mHT10D_Info"></param>
 private void ShowAView(HT10D_Info mHT10D_Info)
 {
     if (mHT10D_Info.AViewList != null)
     {
         ucAView.InitAView(mHT10D_Info);
         trackBar_AViewPoint.Value   = 0;
         trackBar_AViewPoint.Maximum = mHT10D_Info.AViewList.Count - 1;
         trackBar_AViewPoint.Enabled = true;
     }
     else
     {
         trackBar_AViewPoint.Enabled = false;
     }
 }
Exemple #5
0
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="ht10D_Info"></param>
        public void InitAView(HT10D_Info ht10D_Info)
        {
            this.mHT10D_Info = ht10D_Info;

            xRate = pictureBox.Width / (float)PicWidth;
            yRate = (pictureBox.Height - BOTTOM_VALUE) / (float)PicHeight;

            pictureBox.Image           = new Bitmap(pictureBox.Width, pictureBox.Height);
            pictureBox.BackgroundImage = new Bitmap(pictureBox.Width, pictureBox.Height);
            IfDrawBackImage            = true;

            mInitialized = true;
            //Invalidate();
            RefreshImage();
        }
Exemple #6
0
        public HT10D_Info ReadFileSummary(string filePath)
        {
            // 判断
            if (!File.Exists(filePath))
            {
                throw new FileNotFoundException(filePath);
            }

            HT10D_Info mHT10D_Info = new HT10D_Info();

            mHT10D_Info.FilePath = filePath;
            short[] data_list;
            int     fileLength = 0;

            using (FileStream fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read))
            {
                fileLength = (int)fileStream.Length;
                data_list  = new short[fileLength];
                int i = 0;
                using (BinaryReader firstdi = new BinaryReader(fileStream))
                {
                    try
                    {
                        while (true)
                        {
                            short firstData = ReadShort(firstdi);
                            data_list[i] = firstData;
                            i++;
                        }
                    }
                    catch (Exception e)
                    {
                        //throw;
                    }
                }
            }

            for (int index = 0; index < data_list.Length; index++)
            {
                xfActCode actCode = (xfActCode)data_list[index];
                short[]   temp    = new short[AViewLength];

                switch (actCode)
                {
                case xfActCode.HT_WeldNum:
                    mHT10D_Info.DamageInfo.WeldNum = GetUTF8String(data_list, index);
                    index += mHT10D_Info.DamageInfo.WeldNum.Length;
                    break;

                case xfActCode.HT_SwitchNum:
                    mHT10D_Info.DamageInfo.SwitchNum = GetUTF8String(data_list, index);
                    index += mHT10D_Info.DamageInfo.SwitchNum.Length;
                    break;

                case xfActCode.HT_RailNum:
                    mHT10D_Info.DamageInfo.RailNum = GetUTF8String(data_list, index);
                    index += mHT10D_Info.DamageInfo.RailNum.Length;
                    break;

                case xfActCode.HT_WeldType:
                    mHT10D_Info.DamageInfo.WeldType = data_list[index + 1];
                    index += 1;
                    break;

                case xfActCode.HT_WeldDesc:
                    mHT10D_Info.DamageInfo.WeldDesc = GetUTF8String(data_list, index);
                    index += mHT10D_Info.DamageInfo.WeldDesc.Length;
                    break;

                case xfActCode.HT_RailDesc:
                    mHT10D_Info.DamageInfo.RailDesc = GetUTF8String(data_list, index);
                    index += mHT10D_Info.DamageInfo.RailDesc.Length;
                    break;

                case xfActCode.HT_RailFactory:
                    mHT10D_Info.DamageInfo.RailFactory = GetUTF8String(data_list, index);
                    index += mHT10D_Info.DamageInfo.RailFactory.Length;
                    break;

                case xfActCode.HT_RailSteel:
                    mHT10D_Info.DamageInfo.RailSteel = GetUTF8String(data_list, index);
                    index += mHT10D_Info.DamageInfo.RailSteel.Length;
                    break;

                case xfActCode.HT_FurnaceNum:
                    mHT10D_Info.DamageInfo.FurnaceNum = GetUTF8String(data_list, index);
                    index += mHT10D_Info.DamageInfo.FurnaceNum.Length;
                    break;

                case xfActCode.HT_DamageType:
                    mHT10D_Info.DamageInfo.DamageType = data_list[index + 1];
                    index += 1;
                    break;

                case xfActCode.HT_DamageSize:
                    mHT10D_Info.DamageInfo.DamageSize = data_list[index + 1];
                    index += 1;
                    break;

                case xfActCode.HT_DamagePos:
                    mHT10D_Info.DamageInfo.DamagePos = data_list[index + 1];
                    index += 1;
                    break;

                case xfActCode.HT_DamageDesc:
                    mHT10D_Info.DamageInfo.DamageDesc = GetUTF8String(data_list, index);
                    index += mHT10D_Info.DamageInfo.DamageDesc.Length;
                    break;

                case xfActCode.HT_PosDesc:
                    mHT10D_Info.DamageInfo.PosDesc = GetUTF8String(data_list, index);
                    index += mHT10D_Info.DamageInfo.PosDesc.Length;
                    break;

                case xfActCode.HT_X:
                    mHT10D_Info.DamageInfo.HT_X = data_list[index + 1];
                    index += 1;
                    break;

                case xfActCode.HT_Y:
                    mHT10D_Info.DamageInfo.HT_Y = data_list[index + 1];
                    index += 1;
                    break;

                case xfActCode.HT_GainDelta:
                    mHT10D_Info.DamageInfo.GainDelta = data_list[index + 1];
                    index += 1;
                    break;

                case xfActCode.HT_TestRange:
                    mHT10D_Info.DamageInfo.TestRange = data_list[index + 1];
                    index += 1;
                    break;

                case xfActCode.HT_PulseShift:
                    mHT10D_Info.DamageInfo.PulseShift = data_list[index + 1];
                    index += 1;
                    break;

                case xfActCode.HT_Launch:
                    mHT10D_Info.DamageInfo.Launch = data_list[index + 1];
                    index += 1;
                    break;

                case xfActCode.HT_Receiving:
                    mHT10D_Info.DamageInfo.Receiving = data_list[index + 1];
                    index += 1;
                    break;

                case xfActCode.HT_Damping:
                    mHT10D_Info.DamageInfo.Damping = data_list[index + 1];
                    index += 1;
                    break;

                case xfActCode.HT_Intensity:
                    mHT10D_Info.DamageInfo.Intensity = data_list[index + 1];
                    index += 1;
                    break;

                case xfActCode.HT_PulseWidth:
                    mHT10D_Info.DamageInfo.PulseWidth = data_list[index + 1];
                    index += 1;
                    break;

                case xfActCode.HT_Suppress:
                    mHT10D_Info.DamageInfo.Suppress = data_list[index + 1];
                    index += 1;
                    break;

                case xfActCode.HT_Bandwidth:
                    mHT10D_Info.DamageInfo.Bandwidth = data_list[index + 1];
                    index += 1;
                    break;

                case xfActCode.HT_Detection:
                    mHT10D_Info.DamageInfo.Detection = data_list[index + 1];
                    index += 1;
                    break;

                case xfActCode.HT_WorkMode:
                    mHT10D_Info.DamageInfo.WorkMode = data_list[index + 1];
                    index += 1;
                    break;

                case xfActCode.HT_ProbeType:
                    mHT10D_Info.DamageInfo.ProbeType = data_list[index + 1];
                    index += 1;
                    break;

                case xfActCode.HT_RepeatFreq:
                    mHT10D_Info.DamageInfo.RepeatFreq = data_list[index + 1];
                    index += 1;
                    break;

                case xfActCode.HT_FrontDist:
                    mHT10D_Info.DamageInfo.FrontDist = data_list[index + 1];
                    index += 1;
                    break;

                case xfActCode.HT_ZeroDelay:
                    mHT10D_Info.DamageInfo.ZeroDelay = data_list[index + 1];
                    index += 1;
                    break;

                case xfActCode.HT_Crystal:
                    mHT10D_Info.DamageInfo.Crystal = data_list[index + 1];
                    index += 1;
                    break;

                case xfActCode.HT_ProbeFreq:
                    mHT10D_Info.DamageInfo.ProbeFreq = data_list[index + 1];
                    index += 1;
                    break;

                case xfActCode.HT_SoundVelocity:
                    mHT10D_Info.DamageInfo.SoundVelocity = data_list[index + 1];
                    index += 1;
                    break;

                case xfActCode.HT_Thickness:
                    mHT10D_Info.DamageInfo.Thickness = data_list[index + 1];
                    index += 1;
                    break;

                case xfActCode.HT_AmpMode:
                    mHT10D_Info.DamageInfo.AmpMode = data_list[index + 1];
                    index += 1;
                    break;

                case xfActCode.HT_WaveType:
                    mHT10D_Info.DamageInfo.WaveType = data_list[index + 1];
                    index += 1;
                    break;

                case xfActCode.HT_MeasureUnit:
                    mHT10D_Info.DamageInfo.MeasureUnit = data_list[index + 1];
                    index += 1;
                    break;

                case xfActCode.HT_SurfaceCompEn:
                    mHT10D_Info.DamageInfo.SurfaceCompEn = data_list[index + 1];
                    index += 1;
                    break;

                case xfActCode.HT_MeasureTrigger:
                    mHT10D_Info.DamageInfo.MeasureTrigger = data_list[index + 1];
                    index += 1;
                    break;

                case xfActCode.HT_Language:
                    mHT10D_Info.DamageInfo.Language = data_list[index + 1];
                    index += 1;
                    break;

                case xfActCode.HT_APicture:
                    mHT10D_Info.AViewImage = GetViewImage(data_list, index);
                    break;

                case xfActCode.HT_BPicture:
                    mHT10D_Info.BViewImage = GetViewImage(data_list, index);
                    break;

                case xfActCode.HT_ChanNum:
                    mHT10D_Info.DamageInfo.ChanNum = data_list[index + 1];
                    index += 1;
                    break;

                case xfActCode.HT_GateHand:
                    mHT10D_Info.DamageInfo.GateHand = data_list[index + 1];
                    break;

                case xfActCode.HT_GateWidth:
                    mHT10D_Info.DamageInfo.GateWidth = data_list[index + 1];
                    break;

                case xfActCode.HT_GateHight:
                    mHT10D_Info.DamageInfo.GateHeight = data_list[index + 1];
                    break;

                case xfActCode.AWAVE:
                    if (mHT10D_Info.AViewList == null)
                    {
                        mHT10D_Info.AViewList = new List <short[]>();
                    }
                    GetAViewList(mHT10D_Info, data_list, index);
                    index += AViewLength / 2;
                    break;

                default:
                    if ((int)actCode < -10000 && (int)actCode > -12000)
                    {
                        Console.WriteLine(actCode);
                    }
                    break;
                }
            }

            return(mHT10D_Info);
        }