浏览代码

修改测量谱峰图

cxs 7 月之前
父节点
当前提交
960b048c7e

+ 39 - 68
OTSIncAMeasureApp/5-OTSMeasureStatuImageFun/Control_XRayTable.cs

@@ -11,6 +11,7 @@ namespace OTSIncAGraph.Controls
     /// <summary>
     /// 能谱图类
     /// </summary>
+    
     public partial class Control_XRayTable : UserControl
     {
         #region 变量定义
@@ -33,7 +34,7 @@ namespace OTSIncAGraph.Controls
         Font m_thisfont_bold = new Font("微软雅黑", 8, FontStyle.Bold);
 
         //下标尺分界位置
-        float m_f_rulerX_location = 170;
+        float m_f_rulerX_location = 165;
 
         //下坐标尺设定参数
         float m_i_smalkd = 5;//5像素一个小刻度
@@ -41,18 +42,18 @@ namespace OTSIncAGraph.Controls
         float m_i_smallkd_number = 200;//小刻度的个数
         float m_i_bigkd_number = 40;//大刻度的个数
 
-        float m_i_draw_start = 0;//整个界面绘制的起始点
+        float m_i_draw_start = 33;//整个界面绘制的起始点
         float m_i_draw_end = 1004;//整个界面绘制的边界
 
 
         //float m_Y_draw_start = 0;//Y轴的起始点
         //float m_Y_draw_Lenght = 10;//Y轴的刻度长度
-        float m_Y_draw_TopDiff = 15;//Y轴距离顶部距离
+        float m_Y_draw_TopDiff = 20;//Y轴距离顶部距离
         float m_Y_MaxValue = 0;//Y轴显示的最大刻度长度
-
+        float m_Y_draw_end = 200;//整个界面绘制的边界高
         float m_i_rightdrawlabellocation_x = 850;//右上角要显示文字的位置
         float m_i_rightdrawlabellocation_y = 5;//右上角要显示文字的位置
-
+        uint m_Y_Value = 50;//Y轴大刻度包含像素数
         SolidBrush m_this_sb = new SolidBrush(Color.Black);//画刷
         SolidBrush m_this_sb_blue = new SolidBrush(Color.Blue);//
         Pen m_this_p = new Pen(Color.Black, 0.5f);           //画笔的颜色
@@ -182,19 +183,12 @@ namespace OTSIncAGraph.Controls
             #region 重新初始化相关全局变量
             m_list_periodic = CListPeriodic.GetListPeriodic();
             m_list_kmlfpoint = new List<KMLFPoint>();
-
-            m_f_show1 = new float[2000];
             m_f_show2 = new float[2000];
 
             //用来保存实际传入的xray值数,用该数据转换成显示的值
-            m_search_xray = new uint[2000];
             m_analysis_xray = new uint[2000];
-
-            m_list_twopoint1 = new List<TwoPoint>();
             m_list_twopoint2 = new List<TwoPoint>();
-
             m_list_showelementinfo = new List<ShowElementInfo>();
-
             //初始化xray之和为0,之后开始进行求和计算
             m_xraysum2 = 0;
             //重新初始化高度比例尺
@@ -202,7 +196,6 @@ namespace OTSIncAGraph.Controls
             //标准库名
             m_stdname = "无";
             #endregion
-
             //校验数据错误,防止空数据
             if (analysis_xray.Count() == 0)
             {
@@ -219,7 +212,6 @@ namespace OTSIncAGraph.Controls
             {
                 return;
             }
-
             //比例尺,要根据传入的数据,自动进行计算的
             //逻辑那就应该是取最大的xray得到的值,加一点,然后除以我可以显示的像素分辨率,得到的倍数,后面都用这个倍数进行计算
 
@@ -234,8 +226,6 @@ namespace OTSIncAGraph.Controls
             }
             //用最大的值除以可用来显示的像素,得到倍数
             m_xraytopixel_multiple = (float)(Convert.ToDouble(max_xra) / Convert.ToDouble(150));
-
-
             //如果长度不是2000的话,不操作
             if (analysis_xray.Length == 2000)
             {
@@ -266,10 +256,10 @@ namespace OTSIncAGraph.Controls
             for (int i = 0; i < m_f_show2.Length; i++)
             {
                 TwoPoint tp = new TwoPoint();
-                tp.pf1.X = i * m_f_zl;
+                tp.pf1.X = i * m_f_zl + m_i_draw_start;
                 tp.pf1.Y = old_value;
 
-                tp.pf2.X = i * m_f_zl + m_f_zl;
+                tp.pf2.X = i * m_f_zl + m_f_zl + m_i_draw_start;
                 tp.pf2.Y = m_f_rulerX_location - 2 - m_f_show2[i];
                 tp.value = m_analysis_xray[i];
                 tp.kmlf_value = (float)(Convert.ToDouble(i) / Convert.ToDouble(100));
@@ -438,7 +428,7 @@ namespace OTSIncAGraph.Controls
                 KMLFPoint ls_lkmfpoint = new KMLFPoint();
                 ls_lkmfpoint.ysm = in_list_showelementinfo[i].ElementName;
                 //ls_lkmfpoint.kml_x = (float)(in_list_showelementinfo[i].dKF * 1000 / 20);
-                ls_lkmfpoint.kml_x = (float)in_list_showelementinfo[i].dKF ;
+                ls_lkmfpoint.kml_x = (float)in_list_showelementinfo[i].dKF;
 
                 //将该峰值保存到峰值上
                 m_list_kmlfpoint.Add(ls_lkmfpoint);
@@ -476,22 +466,22 @@ namespace OTSIncAGraph.Controls
         /// <param name="g"></param>
         protected void DrawXrayImage(Graphics g)
         {
-
             #region //绘制标尺表盘部份----------------------------------------------------------------------------------------------
 
             //宽度比的缩放基数
             float f_js_width = 1;//经过考虑,先定为1,为固定的像素进行绘制
-
             #region 绘制下面的标尺
             //x轴标尺的线
             g.DrawLine(m_this_p, m_i_draw_start, m_f_rulerX_location, m_i_draw_end * f_js_width, m_f_rulerX_location);
 
-            //200个小刻度
-            for (int i = 0; i < m_i_smallkd_number; i++)
-            {
-                g.DrawLine(m_this_p, m_i_draw_start + (i * m_i_smalkd * f_js_width), m_f_rulerX_location, m_i_draw_start + (i * m_i_smalkd * f_js_width), m_f_rulerX_location + 5);
-            }
 
+            ////200个小刻度
+            //for (int i = 0; i < m_i_smallkd_number; i++)
+            //{
+            //    g.DrawLine(m_this_p, m_i_draw_start + (i * m_i_smalkd * f_js_width), m_f_rulerX_location, m_i_draw_start + (i * m_i_smalkd * f_js_width), m_f_rulerX_location + 5);
+            //}
+            //y轴标尺的线
+            g.DrawLine(m_this_p, m_i_draw_start, m_f_rulerX_location, m_i_draw_start, -m_Y_draw_end + m_Y_draw_TopDiff + m_f_rulerX_location + 20);
             int i_count = 0;
             //40个大刻度
             for (int i = 0; i < m_i_bigkd_number; i++)
@@ -517,49 +507,30 @@ namespace OTSIncAGraph.Controls
             #endregion
 
             #region 图谱Y轴最高刻度
-            //g.DrawLine(m_this_p, m_Y_draw_start, m_Y_draw_start + m_Y_draw_TopDiff, m_Y_draw_Lenght, m_Y_draw_start + m_Y_draw_TopDiff);
-            //Font m_Yfont = new Font("微软雅黑", 7, FontStyle.Regular);
-            //if(m_kml_fz_top!= 0)
-            //{
-            //    m_Y_MaxValue = m_kml_fz_top;
-            //}
-            //double MaxValueTemp = Math.Round(Convert.ToDouble(m_Y_MaxValue));
-            ////判断四舍五入后的数值 是否小于原最高值
-            //if (MaxValueTemp < m_Y_MaxValue)
-            //{
-            //    g.DrawString("Y轴最高值:" + MaxValueTemp+1, m_Yfont, m_this_sb, 0, 0);
-            //}
-            //else
-            //{
-            //    g.DrawString("Y轴最高值:" + MaxValueTemp, m_Yfont, m_this_sb, 0, 0);
-            //}
+            int m_Y_Value_Count = (int)Math.Floor(m_xraytopixel_multiple * 150 / 25);
+            m_Y_Value = (uint)(m_Y_Value_Count / 4) * 25;
+            if (m_Y_Value == 0)
+            {
+                m_Y_Value = (uint)Math.Floor(m_xraytopixel_multiple * 150 / 2);
+            }
+            if (m_xraytopixel_multiple != 0)
+            {
+                //纵坐标
+                for (int i = 0; i < 30; i++)
+                {
+                    if (i * m_Y_Value <= m_xraytopixel_multiple * 150)
+                    {
+                        g.DrawLine(m_this_p, m_i_draw_start, m_f_rulerX_location - (i * GetValueByRatio(m_Y_Value) * f_js_width), m_i_draw_start + 3, m_f_rulerX_location - (i * GetValueByRatio(m_Y_Value) * f_js_width));
+                        int aa = i * Convert.ToInt16(m_Y_Value);
+                        g.DrawString(aa.ToString(), m_thisfont_bold, m_this_sb, m_i_draw_start - 10 - ((aa.ToString().Length - 1) * 6), m_f_rulerX_location - (i * GetValueByRatio(m_Y_Value) * f_js_width) - 7);
+                    }
+                }
+            }
             #endregion
 
             #endregion //--------------------------------------------------------------------------------------------------------
 
             #region 绘制波浪线及线上文字--------------------------------------------------------------------------------------
-            if (m_b_show_searchxray == true)
-            {
-                //画波浪线----第一条线
-                for (int i = 0; i < m_list_twopoint1.Count(); i++)
-                {
-                    PointF ls_pf1 = m_list_twopoint1[i].pf1;
-                    ls_pf1.X = ls_pf1.X * f_js_width;
-                    PointF ls_pf2 = m_list_twopoint1[i].pf2;
-                    ls_pf2.X = ls_pf2.X * f_js_width;
-
-                    g.DrawLine(m_this_p, ls_pf1, ls_pf2);
-
-                    //找到最高值再输出的方式
-                    //if (list_twopoint1[i].pf2.Y < 60)
-                    //{
-                    //    g.DrawString(list_twopoint1[i].value.ToString() + "@ev", thisfont_bold, this_sb, ls_pf1.X + 3, ls_pf2.Y);
-                    //}
-
-                    //找到峰值,并将该峰值,标记出是什么元素
-
-                }
-            }
             if (m_b_show_analysisxray == true)
             {
                 //画波浪线----第二条线
@@ -597,22 +568,22 @@ namespace OTSIncAGraph.Controls
                     //先把峰值上的文字去掉,因为这里与底层分析出的结果不太一致,为了不产生疑问所以这里去掉
 
                     //绘制竖线
-                    g.DrawLine(new Pen(Color.Wheat, 0.5f), f_js_width * (m_list_kmlfpoint[i].kml_x * (m_i_draw_end / 20) ), m_f_rulerX_location / 3 + i_py, f_js_width * (m_list_kmlfpoint[i].kml_x * (m_i_draw_end / 20) ), m_f_rulerX_location - 3);
+                    g.DrawLine(new Pen(Color.Wheat, 0.5f), f_js_width * (m_list_kmlfpoint[i].kml_x * ((m_i_draw_end- m_i_draw_start) / 20) ), m_f_rulerX_location / 3 + i_py, f_js_width * (m_list_kmlfpoint[i].kml_x * ((m_i_draw_end - m_i_draw_start) / 20) ), m_f_rulerX_location - 3);
                     //输出文字,并将字输出到线的上面
                     SizeF out_testsizef = g.MeasureString(m_list_kmlfpoint[i].ysm, m_thisfont);
                     PointF ut_test_pointF = new PointF(m_mouse_point.X - (out_testsizef.Width / 2), 2);
-                    g.FillRectangle(Brushes.Goldenrod, new RectangleF(new PointF(f_js_width * (m_list_kmlfpoint[i].kml_x * (m_i_draw_end / 20) - out_testsizef.Width / 2), m_f_rulerX_location / 3 - 20 + i_py), out_testsizef));
+                    g.FillRectangle(Brushes.Goldenrod, new RectangleF(new PointF(f_js_width * (m_list_kmlfpoint[i].kml_x * ((m_i_draw_end - m_i_draw_start) / 20) - out_testsizef.Width / 2), m_f_rulerX_location / 3 - 20 + i_py), out_testsizef));
                     g.DrawString(m_list_kmlfpoint[i].ysm,
                         m_thisfont_bold,
                         m_this_sb,
-                        new PointF(f_js_width * (m_list_kmlfpoint[i].kml_x * (m_i_draw_end / 20) - out_testsizef.Width / 2), m_f_rulerX_location / 3 - 20 + i_py));
+                        new PointF(f_js_width * (m_list_kmlfpoint[i].kml_x * ((m_i_draw_end - m_i_draw_start) / 20) - out_testsizef.Width / 2), m_f_rulerX_location / 3 - 20 + i_py));
                 }
             }
             #endregion 
 
             #region 绘制鼠标移动显示的线及线上文字---------------------------------------------------------------------------------------
             //再绘制鼠标所在位置的竖线---------------------第一条线
-            g.DrawLine(m_mousemove_p, m_mouse_point.X, m_i_draw_start, m_mouse_point.X, m_f_rulerX_location - 3);
+            g.DrawLine(m_mousemove_p, m_mouse_point.X , m_i_draw_start, m_mouse_point.X, m_f_rulerX_location - 3);
 
             string ls_label_str = "";
             for (int i = 0; i < m_list_twopoint2.Count(); i++)

+ 15 - 14
OTSIncAMeasureApp/5-OTSMeasureStatuImageFun/OTSMeasureStatusWindow.Designer.cs

@@ -42,12 +42,12 @@
             this.MenuItemLineScan = new System.Windows.Forms.ToolStripMenuItem();
             this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
             this.PointScanElementMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+            this.批量采集ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.ExportScanInfoMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.panelXray = new System.Windows.Forms.Panel();
             this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker();
             this.timer1 = new System.Windows.Forms.Timer(this.components);
             this.pictureBox2 = new System.Windows.Forms.PictureBox();
-            this.批量采集ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             ((System.ComponentModel.ISupportInitialize)(this.picBox)).BeginInit();
             this.contextMenuStrip1.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
@@ -59,7 +59,7 @@
             this.picBox.Location = new System.Drawing.Point(0, 0);
             this.picBox.Margin = new System.Windows.Forms.Padding(2);
             this.picBox.Name = "picBox";
-            this.picBox.Size = new System.Drawing.Size(382, 300);
+            this.picBox.Size = new System.Drawing.Size(382, 275);
             this.picBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
             this.picBox.TabIndex = 0;
             this.picBox.TabStop = false;
@@ -86,7 +86,7 @@
             this.批量采集ToolStripMenuItem,
             this.ExportScanInfoMenuItem});
             this.contextMenuStrip1.Name = "contextMenuStrip1";
-            this.contextMenuStrip1.Size = new System.Drawing.Size(243, 264);
+            this.contextMenuStrip1.Size = new System.Drawing.Size(243, 242);
             this.contextMenuStrip1.Opened += new System.EventHandler(this.contextMenuStrip1_Opened);
             // 
             // SampleParaLock
@@ -161,6 +161,13 @@
             this.PointScanElementMenuItem.Text = "X-Ray采集";
             this.PointScanElementMenuItem.Click += new System.EventHandler(this.单点采集MenuItem_Click);
             // 
+            // 批量采集ToolStripMenuItem
+            // 
+            this.批量采集ToolStripMenuItem.Name = "批量采集ToolStripMenuItem";
+            this.批量采集ToolStripMenuItem.Size = new System.Drawing.Size(242, 22);
+            this.批量采集ToolStripMenuItem.Text = "批量采集";
+            this.批量采集ToolStripMenuItem.Click += new System.EventHandler(this.批量采集ToolStripMenuItem_Click);
+            // 
             // ExportScanInfoMenuItem
             // 
             this.ExportScanInfoMenuItem.Name = "ExportScanInfoMenuItem";
@@ -170,11 +177,12 @@
             // 
             // panelXray
             // 
+            this.panelXray.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
             this.panelXray.Dock = System.Windows.Forms.DockStyle.Bottom;
-            this.panelXray.Location = new System.Drawing.Point(0, 300);
+            this.panelXray.Location = new System.Drawing.Point(0, 279);
             this.panelXray.Margin = new System.Windows.Forms.Padding(2);
             this.panelXray.Name = "panelXray";
-            this.panelXray.Size = new System.Drawing.Size(782, 169);
+            this.panelXray.Size = new System.Drawing.Size(782, 190);
             this.panelXray.TabIndex = 0;
             // 
             // backgroundWorker1
@@ -192,7 +200,7 @@
             this.pictureBox2.Location = new System.Drawing.Point(386, 0);
             this.pictureBox2.Margin = new System.Windows.Forms.Padding(2);
             this.pictureBox2.Name = "pictureBox2";
-            this.pictureBox2.Size = new System.Drawing.Size(394, 300);
+            this.pictureBox2.Size = new System.Drawing.Size(394, 275);
             this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
             this.pictureBox2.TabIndex = 0;
             this.pictureBox2.TabStop = false;
@@ -201,13 +209,6 @@
             this.pictureBox2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseDown);
             this.pictureBox2.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseMove);
             // 
-            // 批量采集ToolStripMenuItem
-            // 
-            this.批量采集ToolStripMenuItem.Name = "批量采集ToolStripMenuItem";
-            this.批量采集ToolStripMenuItem.Size = new System.Drawing.Size(242, 22);
-            this.批量采集ToolStripMenuItem.Text = "批量采集";
-            this.批量采集ToolStripMenuItem.Click += new System.EventHandler(this.批量采集ToolStripMenuItem_Click);
-            // 
             // OTSMeasureStatusWindow
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@@ -220,7 +221,7 @@
             this.Controls.Add(this.picBox);
             this.Controls.Add(this.pictureBox2);
             this.DockAreas = ((OTS.WinFormsUI.Docking.DockAreas)((OTS.WinFormsUI.Docking.DockAreas.DockTop | OTS.WinFormsUI.Docking.DockAreas.Document)));
-            this.Font = new System.Drawing.Font("SimSun", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.Name = "OTSMeasureStatusWindow";
             this.Text = "OTSMeasureStatus";
             this.WindowState = System.Windows.Forms.FormWindowState.Maximized;

+ 1 - 1
OTSIncAReportApp/1-UI/Control_Graph/Controls/Control_XRayTable.cs

@@ -48,7 +48,7 @@ namespace OTSIncAReportGraph.Controls
         float m_i_draw_start = 0;                                       //整个界面绘制的起始点
         float m_i_draw_end = 1004;                                      //整个界面绘制的边界
 
-        float m_Y_draw_end = 220;                                      //整个界面绘制的边界高
+        float m_Y_draw_end = 175;                                      //整个界面绘制的边界高
         float m_Y_draw_TopDiff = 15;                                    //Y轴距离顶部距离
         float m_Y_MaxValue = 0;                                         //Y轴显示的最大刻度长度
         uint m_Y_Value = 50;                                           //Y轴大刻度包含像素数