public Bitmap Draw(DprRdaData radarData, int nLayer, int valType) { int xCenter = 1200; int yCenter = 1200; switch (valType) { case 0: return(DrawRadarData(radarData.refData, refThreshold, refClrNum, nLayer, xCenter, yCenter)); case 1: return(DrawRadarData(radarData.velData, velThreshold, velClrNum, nLayer, xCenter, yCenter)); case 2: return(DrawRadarData(radarData.swData, swThreshold, swClrNum, nLayer, xCenter, yCenter)); case 3: return(DrawRadarData(radarData.zdrData, zdrThreshold, zdrClrNum, nLayer, xCenter, yCenter)); case 4: return(DrawRadarData(radarData.rhoData, rhoThreshold, rhoClrNum, nLayer, xCenter, yCenter)); case 5: return(DrawRadarData(radarData.phiData, phiThreshold, phiClrNum, nLayer, xCenter, yCenter)); case 6: return(DrawRadarData(radarData.kdpData, kdpThreshold, kdpClrNum, nLayer, xCenter, yCenter)); default: return(DrawRadarData(radarData.refData, refThreshold, refClrNum, nLayer, xCenter, yCenter)); } }
/// <summary> /// 打开数据文件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOpen_Click(object sender, EventArgs e) { OpenFileDialog openDlg = new OpenFileDialog(); openDlg.Filter = "DataFile(*.bin,*.bz2)|*.bin;*.bz2|All Files(*.*)|*.*"; openDlg.InitialDirectory = Application.StartupPath; openDlg.RestoreDirectory = true; if (openDlg.ShowDialog() == DialogResult.OK) { frmProgress frmpg = new frmProgress(); frmpg.SetText("数据解码中:"); frmpg.StartPosition = FormStartPosition.CenterParent; new Thread(new ThreadStart(delegate { try { while (true) { Thread.Sleep(50); if (frmpg.Visible) { break; } } //frmpg.strProgress = "数据解码中:"; mRadarData = mRadrReader.ReadData(@openDlg.FileName, frmpg); frmpg.nProgress = 85; frmpg.strProgress = "解码完成,绘制中:"; if (bmpMain != null) { bmpMain.Dispose(); } InitBmp(); bmpMain = draw.Draw(mRadarData, nLayer, 0); pbShow.Image = bmpMain; frmpg.nProgress = 95; Action <FlowLayoutPanel, int> actBar = draw.DrawColBar; frmpg.Invoke(actBar, new object[] { flpWp, 0 }); } catch (Exception ex) { } finally { frmpg.nProgress = 100; } })).Start(); frmpg.ShowDialog(); } }