public void GraphDraw() { DataPlotter.DataSeries pSeries1; DataPlotter.DataSeries pSeries2; DataPlotter.DataSeries pSeries3; plotter1.ColorGrid = Color.LightGray; plotter1.XRangeStart = 0; plotter1.XRangeEnd = 6400; plotter1.XGrid = 1000; plotter1.YRangeStart = 0; plotter1.YRangeEnd = 1; plotter1.YGrid = 0.2; plotter1.Series.Clear(); plotter2.ColorGrid = Color.LightGray; plotter2.XRangeStart = 0; plotter2.XRangeEnd = 6400; plotter2.XGrid = 1000; plotter2.YRangeStart = 0; plotter2.YRangeEnd = 1; plotter2.YGrid = 0.2; plotter2.Series.Clear(); plotter3.ColorGrid = Color.LightGray; plotter3.XRangeStart = 0; plotter3.XRangeEnd = 6400; plotter3.XGrid = 1000; plotter3.YRangeStart = 0; plotter3.YRangeEnd = 60; plotter3.YGrid = 10; plotter3.Series.Clear(); bool DataExist = false; MPEData MPEData1; MD_DB MD_DB1 = new MD_DB(); int dGraph_ID = 0; for(int i = 0 ; i < strID.Length ; i++) { dGraph_ID = MD_DB1.IsGraphExist(bIsSingle,Measured,Incidence,FreqBand,1,int.Parse(strID[i])); if(dGraph_ID != -1) { MPEData1 = new MPEData(); if(MPEData1.DBLoad(bIsSingle,dGraph_ID) == true) { DataExist = true; pSeries1 = new DataPlotter.DataSeries(); pSeries1.Name = "Data " + i.ToString(); int dR = (30 * i * 1000) % 256; int dG = (20 * i * 200) % 256; int dB = (10 * i * 10) % 256; pSeries1.Color = Color.FromArgb(dR,dG,dB); // switch(i) // { // case 0 : // pSeries1.Color = Color.Blue ; // break; // case 1 : // pSeries1.Color = Color.Red ; // break; // case 2 : // pSeries1.Color = Color.Yellow ; // break; // case 3 : // pSeries1.Color = Color.Green ; // break; // } pSeries1.XData = MPEData1.Frequency.GetData(); pSeries1.YData = MPEData1.MAbsorption.GetData(); plotter1.YLabel = "Absorption Coefficient for Rigid Backing"; plotter1.XLabel = "Frequency [Hz]"; if(DataExist == true) { plotter1.Series.Add(pSeries1); } } } } //plotter1.AutoRange(); plotter1.Refresh(); for(int i = 0 ; i < strID.Length ; i++) { dGraph_ID = MD_DB1.IsGraphExist(bIsSingle,Measured,Incidence,FreqBand,2,int.Parse(strID[i])); if(dGraph_ID != -1) { MPEData1 = new MPEData(); if(MPEData1.DBLoad(bIsSingle,dGraph_ID) == true) { DataExist = true; pSeries2 = new DataPlotter.DataSeries(); pSeries2.Name = "Data " + i.ToString(); pSeries2.XData = MPEData1.Frequency.GetData(); pSeries2.YData = MPEData1.MAbsorption.GetData(); int dR = (30 * i * 1000) % 256; int dG = (20 * i * 200) % 256; int dB = (10 * i * 10) % 256; pSeries2.Color = Color.FromArgb(dR,dG,dB); // switch(i) // { // case 0 : // pSeries2.Color = Color.Blue ; // break; // case 1 : // pSeries2.Color = Color.Red ; // break; // case 2 : // pSeries2.Color = Color.Yellow ; // break; // case 3 : // pSeries2.Color = Color.Green ; // break; // } if(DataExist == true) { plotter2.Series.Add(pSeries2); } plotter2.YLabel = "Absotpyion Coefficient for Anechoic termiation"; plotter2.XLabel = "Frequency [Hz]"; } } //plotter2.AutoRange(); plotter2.Refresh(); } for(int i = 0 ; i < strID.Length ; i++) { dGraph_ID = MD_DB1.IsGraphExist(bIsSingle,Measured,Incidence,FreqBand,3,int.Parse(strID[i])); if(dGraph_ID != -1) { MPEData1 = new MPEData(); if(MPEData1.DBLoad(bIsSingle,dGraph_ID) == true) { DataExist = true; pSeries3 = new DataPlotter.DataSeries(); pSeries3.Name = "Data " + i.ToString(); int dR = (30 * i * 1000) % 256; int dG = (20 * i * 200) % 256; int dB = (10 * i * 10) % 256; pSeries3.Color = Color.FromArgb(dR,dG,dB); // switch(i) // { // case 0 : // pSeries3.Color = Color.Blue ; // break; // case 1 : // pSeries3.Color = Color.Red ; // break; // case 2 : // pSeries3.Color = Color.Yellow ; // break; // case 3 : // pSeries3.Color = Color.Green ; // break; // } pSeries3.XData = MPEData1.Frequency.GetData(); pSeries3.YData = MPEData1.MAbsorption.GetData(); plotter3.YLabel = "Transmission Loss [dB]"; plotter3.XLabel = "Frequency [Hz]"; if(DataExist == true) { plotter3.Series.Add(pSeries3); } } } } //plotter3.AutoRange(); plotter3.Refresh(); }
/// <summary> /// ��ȸ �Լ� /// </summary> /// <param name="Category"></param> /// <param name="IncidenceCondition"></param> /// <param name="MaterialType"></param> /// <param name="Option"></param> /// <param name="Frequency">1,Narrow band 2,Octave 3,1/3 Octav</param> public void Search(string Category,string IncidenceCondition,string MaterialType,string Option,string Frequency, clsAbsorptionCoefficient_Find clsAbsorptionCoefficient_RB,clsAbsorptionCoefficient_Find clsAbsorptionCoefficient_AT, clsAbsorptionCoefficient_Find clsAbsorptionCoefficient_TL,clsParameters clsParameters1,clsMultiLayer_Find clsMultiLayer_Find1,string strVendor, string strProducing,string strDate,int dMeasured) { string strIDs = ""; bool bFlag = false; string strSID_Temp = ""; MD_DB MD_DB1 = new MD_DB(); switch(Option) { case "Absorption coefficient-rigid backing": dsSearchResult = MD_DB1.Search(Category,IncidenceCondition,MaterialType,Frequency,clsAbsorptionCoefficient_RB.strName,strVendor,strProducing,strDate,dMeasured); strIDs = AbsorptionCoefficient_RigidBackingCheck(dsSearchResult,clsAbsorptionCoefficient_RB); break; case "Absorption coefficient-anechoic termination": dsSearchResult = MD_DB1.Search(Category,IncidenceCondition,MaterialType,Frequency,clsAbsorptionCoefficient_AT.strName,strVendor,strProducing,strDate,dMeasured); strIDs = AbsorptionCoefficient_AnechoicTerminationCheck(dsSearchResult,clsAbsorptionCoefficient_AT); break; case "Transmission Loss": dsSearchResult = MD_DB1.Search(Category,IncidenceCondition,MaterialType,Frequency,clsAbsorptionCoefficient_TL.strName,strVendor,strProducing,strDate,dMeasured); strIDs = TransmissionLossCheck(dsSearchResult,clsAbsorptionCoefficient_TL); break; case "Parameters": dsSearchResult = MD_DB1.Search_Parameter(Category,IncidenceCondition,MaterialType,"0",clsParameters1.strName,strVendor,strProducing,strDate,dMeasured); strIDs = ParametersCheck(dsSearchResult,clsParameters1); bFlag = true; break; case "MultiLayer": dsSearchResult = MD_DB1.Search("Multi",IncidenceCondition,MaterialType,Frequency,"",strVendor,strProducing,strDate,dMeasured); Category = "Multi"; strIDs = MultiLayerCheck(dsSearchResult,clsMultiLayer_Find1.strName,clsMultiLayer_Find1.strTotalThick); bFlag = true; break; case "Select": dsSearchResult = MD_DB1.Search(Category,IncidenceCondition,MaterialType,"0","",strVendor,strProducing,strDate,dMeasured); bFlag = true; break; } if(bFlag == false) { dsSearchResult = MD_DB1.Search_IDs(Category,strIDs); } strSingle_Multi = Category; lstSearchResultList.Items.Clear(); if(dsSearchResult != null) { if(Category != "Single") { MultiListSetting(); } else { SearchResultList_Init(); MeterialTypeChange(this.strMeterialTypeChange); } for(int i = 0 ; i < dsSearchResult.Tables[0].Rows.Count ; i++) { ListViewItem item = new ListViewItem(); if(Category == "Single") { if(strSID_Temp != dsSearchResult.Tables[0].Rows[i]["SID"].ToString()) { strSID_Temp = dsSearchResult.Tables[0].Rows[i]["SID"].ToString(); item.SubItems[0].Text = dsSearchResult.Tables[0].Rows[i]["SID"].ToString(); item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["Name"].ToString()); item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["Thick"].ToString()); item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["FlowRes"].ToString()); item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["LossFactor"].ToString()); item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["BulkDens"].ToString()); item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["Ymodulus"].ToString()); item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["PoissionR"].ToString()); item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["ThermalCL"].ToString()); item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["ViscousCL"].ToString()); item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["Prosity"].ToString()); item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["Sfactor"].ToString()); item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["EmP1"].ToString()); item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["PRatioP1"].ToString()); item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["DensityP1"].ToString()); item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["EmP2"].ToString()); item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["HP2"].ToString()); item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["HP2"].ToString()); item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["HP1"].ToString()); item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["PRatioP2"].ToString()); item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["MID"].ToString()); lstSearchResultList.Items.Add(item); } bIsSingle = true; } else { item.SubItems[0].Text = dsSearchResult.Tables[0].Rows[i]["LID"].ToString(); item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["MultiLayer.Name"].ToString()); item.SubItems.Add(dsSearchResult.Tables[0].Rows[i]["TotalThick"].ToString()); bIsSingle = false; lstSearchResultList.Items.Add(item); } //strSearchResult_Selected_ID = item.SubItems[0].Text; } } if(dsSearchResult == null || dsSearchResult.Tables[0].Rows.Count == 0) { MessageBox.Show("�˻� ����� �����ϴ�"); } //pnlGraphOption.Enabled = false; }
private string MultiLayerCheck(DataSet ds,string strName,string strTotalThick) { string strIDs = ""; MD_DB MD_DB1 = new MD_DB(); for(int i = 0 ; i < ds.Tables[0].Rows.Count ; i++) { bool bResult = true; if(strName != null) { if(ds.Tables[0].Rows[i]["MultiLayer.Name"].ToString() != strName) { bResult = false; } } if(strTotalThick != null) { if(ds.Tables[0].Rows[i]["TotalThick"].ToString() != strTotalThick) { bResult = false; } } if(bResult == true) // ���ǿ� �����ϸ�ID �� �߰��Ѵ� { strIDs = strIDs + ds.Tables[0].Rows[i][0].ToString() + ","; } } if(strIDs != "") { strIDs = strIDs.Substring(0,strIDs.Length - 1); } return strIDs; }
private void lstSearchResultList_DoubleClick(object sender, System.EventArgs e) { pnlGraphOption.Enabled = true; pnlGraphOption2.Enabled = true; // Ŭ���� �ο��� ������ MPALayer1 Ŭ������ �����ϴ� ��ƾ �߰� // // if(bIsSingle == true) // { strSearchResult_Selected_ID = lstSearchResultList.SelectedItems[0].Text; strSelectedName = lstSearchResultList.SelectedItems[0].SubItems[1].Text; // } // else // { // //strID = lstSearchResultList.SelectedItems[20].Text; // } if(((frmMD_Main)this.ParentForm).bIsSearchPopup == false) { IsGraphExist(); if(bIsSingle == true) { clsParameter clsParameter1 = new clsParameter(); clsParameter1.str_ID = lstSearchResultList.SelectedItems[0].Text; clsParameter1.strName = lstSearchResultList.SelectedItems[0].SubItems[1].Text; clsParameter1.strThickness = lstSearchResultList.SelectedItems[0].SubItems[2].Text; clsParameter1.strBulkDensity = lstSearchResultList.SelectedItems[0].SubItems[3].Text; clsParameter1.strLossFactor = lstSearchResultList.SelectedItems[0].SubItems[4].Text; clsParameter1.strFlowResistivity = lstSearchResultList.SelectedItems[0].SubItems[5].Text; clsParameter1.strYoungsModulus = lstSearchResultList.SelectedItems[0].SubItems[6].Text; clsParameter1.strPoissionsRatio = lstSearchResultList.SelectedItems[0].SubItems[7].Text; clsParameter1.strThermalCharLength = lstSearchResultList.SelectedItems[0].SubItems[8].Text; clsParameter1.strViscousCharLength = lstSearchResultList.SelectedItems[0].SubItems[9].Text; clsParameter1.strProsity = lstSearchResultList.SelectedItems[0].SubItems[10].Text; clsParameter1.strStructureFactor = lstSearchResultList.SelectedItems[0].SubItems[11].Text; clsParameter1.strM_ID = lstSearchResultList.SelectedItems[0].SubItems[20].Text; MD_DB MD_DB1 = new MD_DB(); DataSet dsSingle = MD_DB1.GetSingleMaterial(clsParameter1.str_ID); clsParameter1.strVendor = dsSingle.Tables[0].Rows[0]["Vendor"].ToString(); clsParameter1.strProducing = dsSingle.Tables[0].Rows[0]["Producing"].ToString(); clsParameter1.strRemark = dsSingle.Tables[0].Rows[0]["Remark"].ToString(); dgSingleMaterial_View dgSingleMaterial_View1 = new dgSingleMaterial_View(); dgSingleMaterial_View1.clsParameter1 = clsParameter1; dgSingleMaterial_View1.IsCreate(false); dgSingleMaterial_View1.ShowDialog(); lstSearchResultList.SelectedItems[0].SubItems[2].Text = clsParameter1.strThickness; lstSearchResultList.SelectedItems[0].SubItems[3].Text = clsParameter1.strBulkDensity; lstSearchResultList.SelectedItems[0].SubItems[4].Text = clsParameter1.strLossFactor; lstSearchResultList.SelectedItems[0].SubItems[5].Text = clsParameter1.strFlowResistivity; lstSearchResultList.SelectedItems[0].SubItems[6].Text = clsParameter1.strYoungsModulus; lstSearchResultList.SelectedItems[0].SubItems[7].Text = clsParameter1.strPoissionsRatio; lstSearchResultList.SelectedItems[0].SubItems[8].Text = clsParameter1.strThermalCharLength; lstSearchResultList.SelectedItems[0].SubItems[9].Text = clsParameter1.strViscousCharLength; lstSearchResultList.SelectedItems[0].SubItems[10].Text = clsParameter1.strProsity; lstSearchResultList.SelectedItems[0].SubItems[11].Text = clsParameter1.strStructureFactor; lstSearchResultList.SelectedItems[0].SubItems[20].Text = clsParameter1.strM_ID; } else { MultiMaterial_View MultiMaterial_View1 = new MultiMaterial_View(); MultiMaterial_View1.strMID = strSearchResult_Selected_ID; MultiMaterial_View1.strName = lstSearchResultList.SelectedItems[0].SubItems[1].Text; MultiMaterial_View1.strTotalThick = lstSearchResultList.SelectedItems[0].SubItems[2].Text; MultiMaterial_View1.ShowDialog(); } } MyListClickedEvent("ListClicked",strSearchResult_Selected_ID,bIsSingle); }
private void IsGraphExist() { //int dID = int.Parse(lstSearchResultList.SelectedItems[0].Text); int dID = int.Parse(strSearchResult_Selected_ID); MD_DB MD_DB1 = new MD_DB(); dGraph_ID = MD_DB1.IsGraphExist(bIsSingle,GetMeasured(),GetIncidence(),GetFreqBand(),GetGraphType(),dID); if(dGraph_ID >= 0) { //btnView.Enabled = true; btnAdd.Enabled = false; } else { //btnView.Enabled = false; btnAdd.Enabled = true; } }
// private void NullGraph() // { // object [] ar = new object[3]; // // DataTable table = new DataTable(); // // table.Columns.Add("GroupName",typeof(int)); // table.Columns.Add("my_X",typeof(int)); // table.Columns.Add("my_Y",typeof(int)); // // DataRow row = table.NewRow(); // ar[0] = "1"; // ar[1] = 0; // ar[2] = 0; // row.ItemArray = ar; // table.Rows.Add(row); // // ultraChart1.DataSource = table; // ultraChart1.ScatterChart.IconSize = Infragistics.UltraChart.Shared.Styles.SymbolIconSize.Small; // ultraChart1.ScatterChart.ConnectWithLines = true; // } public void GraphDraw() { DataPlotter.DataSeries pSeries1; //plotter1.ColorBg = Color.LightYellow; plotter1.ColorGrid = Color.LightGray; //plotter1.XLogBase = 0; plotter1.XRangeStart = -100; plotter1.XRangeEnd = 1000; plotter1.XGrid = 100; //plotter1.YLogBase = 0; plotter1.YRangeStart = 0; plotter1.YRangeEnd = 1; plotter1.YGrid = 2; plotter1.Series.Clear(); if(pSeries_Search != null) { plotter1.Series.Add(pSeries_Search); } bool DataExist = false; MPEData MPEData1; MD_DB MD_DB1 = new MD_DB(); for(int i = 0 ; i < lstSearchResultList.SelectedIndices.Count ; i++) { dGraph_ID = MD_DB1.IsGraphExist(bIsSingle,GetMeasured(),GetIncidence(),GetFreqBand(),GetGraphType(),int.Parse(lstSearchResultList.SelectedItems[i].Text)); if(dGraph_ID != -1) { MPEData1 = new MPEData(); if(MPEData1.DBLoad(bIsSingle,dGraph_ID) == true) { #region ���� // object [] ar = new object[3]; // // DataTable table = new DataTable(); // // table.Columns.Add("GroupName",typeof(int)); // table.Columns.Add("my_X",typeof(double)); // table.Columns.Add("my_Y",typeof(double)); // for(int i = 0 ; i < MPEData1.Frequency.GetCount() ; i++) // { // DataRow row = table.NewRow(); // ar[0] = i.ToString(); // ar[1] = MPEData1.Frequency.GetData(i).ToString(); // ar[2] = MPEData1.MAbsorption.GetData(i).ToString(); // row.ItemArray = ar; // table.Rows.Add(row); // // DataExist = true; // } #endregion DataExist = true; pSeries1 = new DataPlotter.DataSeries(); pSeries1.Name = "Data " + i.ToString(); int dR = (30 * i * 1000) % 256; int dG = (20 * i * 200) % 256; int dB = (10 * i * 10) % 256; pSeries1.Color = Color.FromArgb(dR,dG,dB); // switch(i) // { // case 0 : // pSeries1.Color = Color.Blue ; // break; // case 1 : // pSeries1.Color = Color.Red ; // break; // case 2 : // pSeries1.Color = Color.Yellow ; // break; // case 3 : // pSeries1.Color = Color.Green ; // break; // } pSeries1.XData = MPEData1.Frequency.GetData(); pSeries1.YData = MPEData1.MAbsorption.GetData(); if(DataExist == true) { #region ���� // ultraChart1.DataSource = table; // ultraChart1.ScatterChart.IconSize = Infragistics.UltraChart.Shared.Styles.SymbolIconSize.Small; // ultraChart1.ScatterChart.ConnectWithLines = true; #endregion if(pSeries1.XData.Length == pSeries1.YData.Length) { plotter1.Series.Add(pSeries1); } //plotter1.IsOctave_ = true; } } } } switch(GetGraphType()) { case 1 : plotter1.YLabel = "Absorption Coefficient for Rigid Backing"; plotter1.XLabel = "Frequency [Hz]"; break; case 2 : plotter1.YLabel = "Absotpyion Coefficient for Anechoic termiation"; plotter1.XLabel = "Frequency [Hz]"; break; case 3 : plotter1.YLabel = "Transmission Loss [dB]"; plotter1.XLabel = "Frequency [Hz]"; break; } plotter1.AutoRange(); plotter1.Refresh(); }