From a810a5b1189d95a4d02c81fbf54e595fd174d687 Mon Sep 17 00:00:00 2001 From: mjjo53 Date: Sun, 20 Aug 2017 20:18:16 +0900 Subject: [PATCH] =?UTF-8?q?table,=20spring=20=EC=A0=84=EC=B2=B4=20?= =?UTF-8?q?=EC=84=A0=ED=83=9D/=ED=95=B4=EC=A0=9C=20Potential=20S-Slip=20Ri?= =?UTF-8?q?sk=20->=20Potential=20Stick-Slip=20Risk=20Radar=20Graph=20Popup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PanelAnalysis.Designer.cs | 12 +++--- PanelMaterial.cs | 20 ++++++++- PanelRadarGraph.Designer.cs | 82 ++++++++++++++++++++++++++++++------- PanelRadarGraph.cs | 62 ++++++++++++++++++++-------- 4 files changed, 135 insertions(+), 41 deletions(-) diff --git a/PanelAnalysis.Designer.cs b/PanelAnalysis.Designer.cs index ce3f80a..9a0e727 100644 --- a/PanelAnalysis.Designer.cs +++ b/PanelAnalysis.Designer.cs @@ -135,9 +135,9 @@ this.lbInfo12.ForeColor = System.Drawing.Color.Black; this.lbInfo12.Location = new System.Drawing.Point(280, 12); this.lbInfo12.Name = "lbInfo12"; - this.lbInfo12.Size = new System.Drawing.Size(154, 12); + this.lbInfo12.Size = new System.Drawing.Size(154, 24); this.lbInfo12.TabIndex = 2; - this.lbInfo12.Text = "Potential S-Slip Risk"; + this.lbInfo12.Text = "Potential Stick-Slip Risk"; // // lbInfo13 // @@ -146,7 +146,7 @@ this.lbInfo13.Dock = System.Windows.Forms.DockStyle.Fill; this.lbInfo13.Font = new System.Drawing.Font("Gulim", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); this.lbInfo13.ForeColor = System.Drawing.Color.Black; - this.lbInfo13.Location = new System.Drawing.Point(280, 24); + this.lbInfo13.Location = new System.Drawing.Point(280, 36); this.lbInfo13.Name = "lbInfo13"; this.lbInfo13.Size = new System.Drawing.Size(154, 12); this.lbInfo13.TabIndex = 2; @@ -174,7 +174,7 @@ this.lbInfo22.ForeColor = System.Drawing.Color.Black; this.lbInfo22.Location = new System.Drawing.Point(717, 12); this.lbInfo22.Name = "lbInfo22"; - this.lbInfo22.Size = new System.Drawing.Size(154, 12); + this.lbInfo22.Size = new System.Drawing.Size(154, 24); this.lbInfo22.TabIndex = 2; this.lbInfo22.Text = "Potential Dependancy"; // @@ -185,7 +185,7 @@ this.lbInfo23.Dock = System.Windows.Forms.DockStyle.Fill; this.lbInfo23.Font = new System.Drawing.Font("Gulim", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); this.lbInfo23.ForeColor = System.Drawing.Color.Black; - this.lbInfo23.Location = new System.Drawing.Point(717, 24); + this.lbInfo23.Location = new System.Drawing.Point(717, 36); this.lbInfo23.Name = "lbInfo23"; this.lbInfo23.Size = new System.Drawing.Size(154, 12); this.lbInfo23.TabIndex = 2; @@ -198,7 +198,7 @@ this.lbInfo24.Dock = System.Windows.Forms.DockStyle.Fill; this.lbInfo24.Font = new System.Drawing.Font("Gulim", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); this.lbInfo24.ForeColor = System.Drawing.Color.Black; - this.lbInfo24.Location = new System.Drawing.Point(717, 36); + this.lbInfo24.Location = new System.Drawing.Point(717, 48); this.lbInfo24.Name = "lbInfo24"; this.lbInfo24.Size = new System.Drawing.Size(154, 12); this.lbInfo24.TabIndex = 2; diff --git a/PanelMaterial.cs b/PanelMaterial.cs index eb108bc..54860cd 100644 --- a/PanelMaterial.cs +++ b/PanelMaterial.cs @@ -44,6 +44,7 @@ namespace friction var TableList = data.GetTableList(); lvSpring.Items.Clear(); + lvSpring.Items.Add("All"); foreach (var x in SpringList) { ListViewItem item = lvSpring.Items.Add(x); @@ -80,6 +81,13 @@ namespace friction #region select private void SelectSpring(int iIdx) { + if(iIdx == 0 && lvSpring.Items[iIdx].Text == "All") + { + if(m_SelectedSpring == null) + SelectSpring(1); + return; + } + if (m_SelectedSpring != null) { m_SelectedSpring.Font = lvSpring.Font; @@ -233,8 +241,16 @@ namespace friction private void Listview_ItemChecked(object sender, ItemCheckedEventArgs e) { ListView view = (ListView)sender; - if (view == lvTable && e.Item.Text == "All") - e.Item.Checked = true; + if (e.Item.Text == "All") + { + foreach(ListViewItem item in view.Items) + { + if(item != null && item.Text != "All") + item.Checked = e.Item.Checked; + } + + return; + } List UncheckedItems = new List(); foreach (ListViewItem item in view.Items) diff --git a/PanelRadarGraph.Designer.cs b/PanelRadarGraph.Designer.cs index 6770d01..6800a96 100644 --- a/PanelRadarGraph.Designer.cs +++ b/PanelRadarGraph.Designer.cs @@ -41,6 +41,8 @@ this.lbSpring = new System.Windows.Forms.Label(); this.panel1 = new System.Windows.Forms.Panel(); this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.panel2 = new System.Windows.Forms.Panel(); + this.panelPopup = new System.Windows.Forms.Panel(); this.rbLowTemp = new System.Windows.Forms.RadioButton(); this.rbHighHigh = new System.Windows.Forms.RadioButton(); this.rbHighLow = new System.Windows.Forms.RadioButton(); @@ -48,17 +50,18 @@ this.rbNormalLow = new System.Windows.Forms.RadioButton(); this.rbAll = new System.Windows.Forms.RadioButton(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.label1 = new System.Windows.Forms.Label(); + this.btnClose = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.chart)).BeginInit(); this.panel1.SuspendLayout(); this.groupBox1.SuspendLayout(); + this.panel2.SuspendLayout(); + this.panelPopup.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout(); this.SuspendLayout(); // // chart // - this.chart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); chartArea1.Area3DStyle.Enable3D = true; chartArea1.AxisX.MajorGrid.Enabled = false; chartArea1.AxisX.MajorTickMark.LineWidth = 0; @@ -66,9 +69,10 @@ chartArea1.BackImageTransparentColor = System.Drawing.Color.Black; chartArea1.Name = "ChartArea1"; this.chart.ChartAreas.Add(chartArea1); + this.chart.Dock = System.Windows.Forms.DockStyle.Fill; legend1.Name = "Legend1"; this.chart.Legends.Add(legend1); - this.chart.Location = new System.Drawing.Point(3, 83); + this.chart.Location = new System.Drawing.Point(0, 0); this.chart.Name = "chart"; series1.ChartArea = "ChartArea1"; series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Radar; @@ -115,7 +119,7 @@ this.chart.Series.Add(series4); this.chart.Series.Add(series5); this.chart.Series.Add(series6); - this.chart.Size = new System.Drawing.Size(809, 573); + this.chart.Size = new System.Drawing.Size(1068, 823); this.chart.TabIndex = 0; this.chart.Text = "chart"; this.chart.MouseClick += new System.Windows.Forms.MouseEventHandler(this.chart_MouseClick); @@ -135,24 +139,47 @@ this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; this.panel1.Location = new System.Drawing.Point(3, 3); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(809, 19); + this.panel1.Size = new System.Drawing.Size(1068, 19); this.panel1.TabIndex = 2; // // groupBox1 // this.groupBox1.BackColor = System.Drawing.Color.Transparent; - this.groupBox1.Controls.Add(this.rbLowTemp); - this.groupBox1.Controls.Add(this.rbHighHigh); - this.groupBox1.Controls.Add(this.rbHighLow); - this.groupBox1.Controls.Add(this.rbNormalHigh); - this.groupBox1.Controls.Add(this.rbNormalLow); this.groupBox1.Controls.Add(this.rbAll); + this.groupBox1.Controls.Add(this.rbNormalLow); + this.groupBox1.Controls.Add(this.rbNormalHigh); + this.groupBox1.Controls.Add(this.rbHighLow); + this.groupBox1.Controls.Add(this.rbHighHigh); + this.groupBox1.Controls.Add(this.rbLowTemp); this.groupBox1.Location = new System.Drawing.Point(3, 28); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(623, 49); this.groupBox1.TabIndex = 3; this.groupBox1.TabStop = false; // + // panel2 + // + this.panel2.Controls.Add(this.panelPopup); + this.panel2.Controls.Add(this.chart); + this.panel2.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel2.Location = new System.Drawing.Point(3, 83); + this.panel2.Name = "panel2"; + this.panel2.Size = new System.Drawing.Size(1068, 823); + this.panel2.TabIndex = 5; + // + // panelPopup + // + this.panelPopup.Controls.Add(this.btnClose); + this.panelPopup.Controls.Add(this.label1); + this.panelPopup.Location = new System.Drawing.Point(198, 201); + this.panelPopup.Name = "panelPopup"; + this.panelPopup.Size = new System.Drawing.Size(200, 100); + this.panelPopup.TabIndex = 1; + this.panelPopup.Visible = false; + this.panelPopup.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelPopup_MouseDown); + this.panelPopup.MouseMove += new System.Windows.Forms.MouseEventHandler(this.panelPopup_MouseMove); + this.panelPopup.MouseUp += new System.Windows.Forms.MouseEventHandler(this.panelPopup_MouseUp); + // // rbLowTemp // this.rbLowTemp.Appearance = System.Windows.Forms.Appearance.Button; @@ -233,7 +260,7 @@ this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel1.Controls.Add(this.panel1, 0, 0); this.tableLayoutPanel1.Controls.Add(this.groupBox1, 0, 1); - this.tableLayoutPanel1.Controls.Add(this.chart, 0, 2); + this.tableLayoutPanel1.Controls.Add(this.panel2, 0, 2); this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; @@ -241,14 +268,33 @@ this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 55F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(815, 659); + this.tableLayoutPanel1.Size = new System.Drawing.Size(1074, 909); this.tableLayoutPanel1.TabIndex = 4; // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(39, 41); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(117, 12); + this.label1.TabIndex = 0; + this.label1.Text = "데이터가 부족합니다"; + // + // btnClose + // + this.btnClose.Location = new System.Drawing.Point(122, 74); + this.btnClose.Name = "btnClose"; + this.btnClose.Size = new System.Drawing.Size(75, 23); + this.btnClose.TabIndex = 1; + this.btnClose.Text = "Close"; + this.btnClose.UseVisualStyleBackColor = true; + this.btnClose.Click += new System.EventHandler(this.btnClose_Click); + // // PanelRadarGraph // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(815, 659); + this.ClientSize = new System.Drawing.Size(1074, 909); this.ControlBox = false; this.Controls.Add(this.tableLayoutPanel1); this.DockAreas = ((WeifenLuo.WinFormsUI.Docking.DockAreas)(((((WeifenLuo.WinFormsUI.Docking.DockAreas.DockLeft | WeifenLuo.WinFormsUI.Docking.DockAreas.DockRight) @@ -261,12 +307,14 @@ this.ShowHint = WeifenLuo.WinFormsUI.Docking.DockState.Document; this.TabText = "Radar Graph"; this.Text = "Radar Graph"; - this.VisibleChanged += new System.EventHandler(this.PanelRadarGraph_VisibleChanged); this.Enter += new System.EventHandler(this.PanelRadarGraph_Enter); ((System.ComponentModel.ISupportInitialize)(this.chart)).EndInit(); this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); this.groupBox1.ResumeLayout(false); + this.panel2.ResumeLayout(false); + this.panelPopup.ResumeLayout(false); + this.panelPopup.PerformLayout(); this.tableLayoutPanel1.ResumeLayout(false); this.ResumeLayout(false); @@ -285,5 +333,9 @@ private System.Windows.Forms.RadioButton rbNormalLow; private System.Windows.Forms.RadioButton rbAll; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private System.Windows.Forms.Panel panel2; + private System.Windows.Forms.Panel panelPopup; + private System.Windows.Forms.Button btnClose; + private System.Windows.Forms.Label label1; } } \ No newline at end of file diff --git a/PanelRadarGraph.cs b/PanelRadarGraph.cs index 76507e5..ed51162 100644 --- a/PanelRadarGraph.cs +++ b/PanelRadarGraph.cs @@ -21,11 +21,13 @@ namespace friction string m_CurSpring = ""; List m_UncheckedTable = null; - bool m_bShowAlert = false; Config.RANGE m_TempRange = Config.TEMP_ALL; Config.RANGE m_HumidRange = Config.HUMID_ALL; + bool m_bPopupDrag = false; + Point m_DragPos; + public PanelRadarGraph(MainForm owner, DataHandler data) { InitializeComponent(); @@ -40,7 +42,7 @@ namespace friction Theme.Apply(rbHighLow); Theme.Apply(rbHighHigh); Theme.Apply(rbLowTemp); - + Theme.Apply(btnClose); chart.ChartAreas[0].AxisY.Maximum = 10; @@ -101,6 +103,8 @@ namespace friction public void UpdateGraph() { + panelPopup.Visible = false; + string strSpring = m_DataHandler.GetCurSpring(); List uncheckedTable = Config.GetInstance().GetTableUnchecked(); if (strSpring == m_CurSpring && uncheckedTable == m_UncheckedTable) @@ -118,6 +122,8 @@ namespace friction List xValues = new List(); List yValues = new List(); + int iTableCnt = 0; + foreach(var data in graphData) { if (uncheckedTable.Contains(data.m_strTable) == true) @@ -130,17 +136,19 @@ namespace friction chart.Series["SeriesHigh"].Points.AddXY(data.m_strTable, (int)Config.ANALYSIS.RISK.HIGH); chart.Series["SeriesPotential"].Points.AddXY(data.m_strTable, (int)Config.ANALYSIS.RISK.POTENTIAL); chart.Series["SeriesNo"].Points.AddXY(data.m_strTable, (int)Config.ANALYSIS.RISK.NO); + + iTableCnt++; } m_CurSpring = strSpring; - //if (graphData.Count < 3) - //{ - // if (Visible == true) - // MessageBox.Show(this, "데이터가 부족합니다"); - // else - // m_bShowAlert = true; - //} + if (iTableCnt < 3) + { + panelPopup.Left = (panel2.Width - panelPopup.Width) / 2; + panelPopup.Top = (panel2.Height - panelPopup.Height) / 2; + + panelPopup.Visible = true; + } } public Bitmap CopyChart() @@ -162,15 +170,6 @@ namespace friction } } - private void PanelRadarGraph_VisibleChanged(object sender, EventArgs e) - { - if(m_bShowAlert == true) - { - MessageBox.Show(this, "데이터가 부족합니다"); - m_bShowAlert = false; - } - } - private void rbAll_CheckedChanged(object sender, EventArgs e) { if(sender.GetType() == typeof(RadioButton)) @@ -219,5 +218,32 @@ namespace friction { m_Owner.OnRadarGraphActivated(); } + + private void btnClose_Click(object sender, EventArgs e) + { + panelPopup.Visible = false; + } + + private void panelPopup_MouseDown(object sender, MouseEventArgs e) + { + m_bPopupDrag = true; + m_DragPos = e.Location; + panelPopup.Capture = true; + } + + private void panelPopup_MouseUp(object sender, MouseEventArgs e) + { + m_bPopupDrag = false; + panelPopup.Capture = false; + } + + private void panelPopup_MouseMove(object sender, MouseEventArgs e) + { + if (m_bPopupDrag == true) + { + panelPopup.Left = e.X + panelPopup.Left - m_DragPos.X; + panelPopup.Top = e.Y + panelPopup.Top - m_DragPos.Y; + } + } } }