Radar Graph에 material check 항목 적용
This commit is contained in:
@@ -39,6 +39,7 @@ namespace friction
|
||||
|
||||
public Dictionary<string, CheckedMaterial> m_CheckedMaterial = new Dictionary<string, CheckedMaterial>();
|
||||
public string m_strCurMaterial = "";
|
||||
public bool m_bOnLoad = false;
|
||||
|
||||
private Config()
|
||||
{
|
||||
@@ -197,6 +198,9 @@ namespace friction
|
||||
|
||||
public void SetSpringChecked(List<string> CheckedItems)
|
||||
{
|
||||
if (m_bOnLoad == true)
|
||||
return;
|
||||
|
||||
m_CheckedMaterial[m_strCurMaterial].m_Springs = CheckedItems;
|
||||
}
|
||||
|
||||
@@ -207,6 +211,9 @@ namespace friction
|
||||
|
||||
public void SetTableChecked(List<string> CheckedItems)
|
||||
{
|
||||
if (m_bOnLoad == true)
|
||||
return;
|
||||
|
||||
m_CheckedMaterial[m_strCurMaterial].m_Tables = CheckedItems;
|
||||
}
|
||||
public List<string> GetTableChecked()
|
||||
|
||||
@@ -199,7 +199,6 @@ namespace friction
|
||||
catch{
|
||||
return new List<RADAR_CHART>();
|
||||
}
|
||||
|
||||
|
||||
var group = rows.GroupBy(r => r[Config.COLUMN_NAME.TABLE]);
|
||||
List<RADAR_CHART> result = rows
|
||||
|
||||
@@ -81,6 +81,7 @@ namespace friction
|
||||
public void OnTableCheckChanged(string strItem, bool bChecked)
|
||||
{
|
||||
m_CompatibilityPanel.TableCheckChanged(strItem, bChecked);
|
||||
m_RadarGraphPanel.UpdateGraph();
|
||||
}
|
||||
|
||||
|
||||
@@ -101,6 +102,8 @@ namespace friction
|
||||
m_DBFileName = strFile;
|
||||
}
|
||||
|
||||
Config.GetInstance().m_bOnLoad = true;
|
||||
|
||||
Cursor.Current = Cursors.WaitCursor;
|
||||
|
||||
m_DataHandler.LoadData(m_DBFileName);
|
||||
@@ -128,6 +131,8 @@ namespace friction
|
||||
|
||||
Config.OPTION.GetInstance().AddRecentFile(m_DBFileName);
|
||||
UpdateRecentFile();
|
||||
|
||||
Config.GetInstance().m_bOnLoad = false;
|
||||
LoadPref(Config.GetInstance().m_strCurMaterial);
|
||||
|
||||
Cursor.Current = Cursors.Default;
|
||||
|
||||
152
PanelMaterial.cs
152
PanelMaterial.cs
@@ -50,7 +50,10 @@ namespace friction
|
||||
lvTable.Items.Clear();
|
||||
lvTable.Items.Add("All");
|
||||
foreach (var x in TableList)
|
||||
lvTable.Items.Add(x);
|
||||
{
|
||||
ListViewItem item = lvTable.Items.Add(x);
|
||||
item.Checked = true;
|
||||
}
|
||||
|
||||
lvSpring.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
|
||||
lvTable.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
|
||||
@@ -71,65 +74,7 @@ namespace friction
|
||||
Theme.ResizeFullColumn(lvTable);
|
||||
}
|
||||
|
||||
public void LoadCheckedMaterial(string strPrefName)
|
||||
{
|
||||
Config.CheckedMaterial cm = Config.GetInstance().m_CheckedMaterial[strPrefName];
|
||||
|
||||
foreach(ListViewItem item in lvSpring.Items)
|
||||
{
|
||||
item.Checked = false;
|
||||
}
|
||||
|
||||
foreach(string strSpring in cm.m_Springs)
|
||||
{
|
||||
foreach (ListViewItem item in lvSpring.Items)
|
||||
{
|
||||
if(item.Text == strSpring)
|
||||
{
|
||||
item.Checked = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach (ListViewItem item in lvTable.Items)
|
||||
{
|
||||
item.Checked = false;
|
||||
}
|
||||
|
||||
foreach (string strTable in cm.m_Tables)
|
||||
{
|
||||
foreach (ListViewItem item in lvTable.Items)
|
||||
{
|
||||
if (item.Text == strTable)
|
||||
{
|
||||
item.Checked = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SaveCheckedMaterial(string strPrefName)
|
||||
{
|
||||
Config.CheckedMaterial cm = Config.GetInstance().m_CheckedMaterial[strPrefName];
|
||||
|
||||
cm.m_Springs.Clear();
|
||||
foreach (ListViewItem item in lvSpring.Items)
|
||||
{
|
||||
if (item.Checked == true)
|
||||
cm.m_Springs.Add(item.Text);
|
||||
}
|
||||
|
||||
cm.m_Tables.Clear();
|
||||
foreach (ListViewItem item in lvTable.Items)
|
||||
{
|
||||
if (item.Checked == true)
|
||||
cm.m_Tables.Add(item.Text);
|
||||
}
|
||||
}
|
||||
|
||||
#region select
|
||||
private void SelectSpring(int iIdx)
|
||||
{
|
||||
if (m_SelectedSpring != null)
|
||||
@@ -193,6 +138,74 @@ namespace friction
|
||||
if (lvTable.SelectedIndices.Count == 1)
|
||||
SelectTable(lvTable.SelectedIndices[0]);
|
||||
}
|
||||
#endregion select
|
||||
|
||||
#region check
|
||||
public void LoadCheckedMaterial(string strPrefName)
|
||||
{
|
||||
Config.CheckedMaterial cm = Config.GetInstance().m_CheckedMaterial[strPrefName];
|
||||
List<string> CheckedSprings = new List<string>();
|
||||
List<string> CheckedTables = new List<string>();
|
||||
|
||||
foreach (string s in cm.m_Springs)
|
||||
CheckedSprings.Add(s);
|
||||
foreach (string s in cm.m_Tables)
|
||||
CheckedTables.Add(s);
|
||||
|
||||
foreach (ListViewItem item in lvSpring.Items)
|
||||
{
|
||||
item.Checked = false;
|
||||
}
|
||||
|
||||
foreach (string strSpring in CheckedSprings)
|
||||
{
|
||||
foreach (ListViewItem item in lvSpring.Items)
|
||||
{
|
||||
if (item.Text == strSpring)
|
||||
{
|
||||
item.Checked = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach (ListViewItem item in lvTable.Items)
|
||||
{
|
||||
item.Checked = false;
|
||||
}
|
||||
|
||||
foreach (string strTable in CheckedTables)
|
||||
{
|
||||
foreach (ListViewItem item in lvTable.Items)
|
||||
{
|
||||
if (item.Text == strTable)
|
||||
{
|
||||
item.Checked = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SaveCheckedMaterial(string strPrefName)
|
||||
{
|
||||
Config.CheckedMaterial cm = Config.GetInstance().m_CheckedMaterial[strPrefName];
|
||||
|
||||
cm.m_Springs.Clear();
|
||||
foreach (ListViewItem item in lvSpring.Items)
|
||||
{
|
||||
if (item.Checked == true)
|
||||
cm.m_Springs.Add(item.Text);
|
||||
}
|
||||
|
||||
cm.m_Tables.Clear();
|
||||
foreach (ListViewItem item in lvTable.Items)
|
||||
{
|
||||
if (item.Checked == true)
|
||||
cm.m_Tables.Add(item.Text);
|
||||
}
|
||||
}
|
||||
|
||||
private void Listview_ItemChecked(object sender, ItemCheckedEventArgs e)
|
||||
{
|
||||
@@ -206,19 +219,20 @@ namespace friction
|
||||
CheckedItems.Add(item.Text);
|
||||
}
|
||||
|
||||
if(view == lvSpring)
|
||||
if (view == lvTable)
|
||||
Config.GetInstance().SetTableChecked(CheckedItems);
|
||||
else
|
||||
Config.GetInstance().SetSpringChecked(CheckedItems);
|
||||
|
||||
view.Sort();
|
||||
|
||||
|
||||
if (view == lvSpring)
|
||||
m_Owner.OnSpringCheckChanged(e.Item.Text, e.Item.Checked);
|
||||
else
|
||||
m_Owner.OnTableCheckChanged(e.Item.Text, e.Item.Checked);
|
||||
|
||||
//if (view == lvTable)
|
||||
// Config.GetInstance().SetTableChecked(CheckedItems);
|
||||
//else
|
||||
// Config.GetInstance().SetSpringChecked(CheckedItems);
|
||||
|
||||
|
||||
view.Sort();
|
||||
}
|
||||
#endregion check
|
||||
|
||||
|
||||
private class ListViewItemCheckboxComparer : IComparer<ListViewItem>, System.Collections.IComparer
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace friction
|
||||
DataHandler m_DataHandler = null;
|
||||
|
||||
string m_CurSpring = "";
|
||||
List<string> m_CheckedTable = null;
|
||||
bool m_bShowAlert = false;
|
||||
|
||||
Config.RANGE m_TempRange = Config.TEMP_ALL;
|
||||
@@ -101,7 +102,8 @@ namespace friction
|
||||
public void UpdateGraph()
|
||||
{
|
||||
string strSpring = m_DataHandler.GetCurSpring();
|
||||
if (m_CurSpring == strSpring)
|
||||
List<string> checkedTable = Config.GetInstance().GetTableChecked();
|
||||
if (strSpring == m_CurSpring && checkedTable == m_CheckedTable)
|
||||
return;
|
||||
|
||||
lbSpring.Text = "Material Spring: " + strSpring;
|
||||
@@ -118,6 +120,9 @@ namespace friction
|
||||
|
||||
foreach(var data in graphData)
|
||||
{
|
||||
if (checkedTable.Contains(data.m_strTable) == false)
|
||||
continue;
|
||||
|
||||
chart.Series["SeriesMax"].Points.AddXY(data.m_strTable, data.m_fMax);
|
||||
chart.Series["SeriesAvg"].Points.AddXY(data.m_strTable, data.m_fAvg);
|
||||
chart.Series["SeriesMin"].Points.AddXY(data.m_strTable, data.m_fMin);
|
||||
@@ -129,13 +134,13 @@ namespace friction
|
||||
|
||||
m_CurSpring = strSpring;
|
||||
|
||||
if (graphData.Count < 3)
|
||||
{
|
||||
if (Visible == true)
|
||||
MessageBox.Show(this, "데이터가 부족합니다");
|
||||
else
|
||||
m_bShowAlert = true;
|
||||
}
|
||||
//if (graphData.Count < 3)
|
||||
//{
|
||||
// if (Visible == true)
|
||||
// MessageBox.Show(this, "데이터가 부족합니다");
|
||||
// else
|
||||
// m_bShowAlert = true;
|
||||
//}
|
||||
}
|
||||
|
||||
public Bitmap CopyChart()
|
||||
|
||||
Reference in New Issue
Block a user