|
@@ -5,6 +5,7 @@ using System.Linq;
|
|
|
using System.Windows.Forms;
|
|
|
using System.Collections;
|
|
|
using OTSPeriodicTable;
|
|
|
+using System.Text;
|
|
|
|
|
|
namespace OTSIncAGraph.Controls
|
|
|
{
|
|
@@ -33,53 +34,53 @@ namespace OTSIncAGraph.Controls
|
|
|
Font m_thisfont_bold = new Font("微软雅黑", 8, FontStyle.Bold);
|
|
|
|
|
|
//下标尺分界位置
|
|
|
- float m_f_rulerX_location = 170;
|
|
|
+ float m_f_rulerX_location = 160;
|
|
|
|
|
|
//下坐标尺设定参数
|
|
|
- float m_i_smalkd = 5;//5像素一个小刻度
|
|
|
- float m_i_bigkd = 25;//25像素一个大刻度
|
|
|
- float m_i_smallkd_number = 200;//小刻度的个数
|
|
|
- float m_i_bigkd_number = 40;//大刻度的个数
|
|
|
+ float m_i_smalkd = 5; //5像素一个小刻度
|
|
|
+ float m_i_bigkd = 25; //25像素一个大刻度
|
|
|
+ float m_i_smallkd_number = 200; //小刻度的个数
|
|
|
+ float m_i_bigkd_number = 40; //大刻度的个数
|
|
|
|
|
|
- float m_i_draw_start = 0;//整个界面绘制的起始点
|
|
|
- float m_i_draw_end = 1004;//整个界面绘制的边界
|
|
|
+ float m_i_draw_start = 0; //整个界面绘制的起始点
|
|
|
+ float m_i_draw_end = 1004; //整个界面绘制的边界
|
|
|
|
|
|
+ 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轴大刻度包含像素数
|
|
|
|
|
|
- //float m_Y_draw_start = 0;//Y轴的起始点
|
|
|
- //float m_Y_draw_Lenght = 10;//Y轴的刻度长度
|
|
|
- float m_Y_draw_TopDiff = 15;//Y轴距离顶部距离
|
|
|
- float m_Y_MaxValue = 0;//Y轴显示的最大刻度长度
|
|
|
+ float m_i_rightdrawlabellocation_x = 850; //右上角要显示文字的位置
|
|
|
+ float m_i_rightdrawlabellocation_y = 5; //右上角要显示文字的位置
|
|
|
|
|
|
- float m_i_rightdrawlabellocation_x = 850;//右上角要显示文字的位置
|
|
|
- float m_i_rightdrawlabellocation_y = 5;//右上角要显示文字的位置
|
|
|
+ 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); //画笔的颜色
|
|
|
+ Pen m_this_p_blue = new Pen(Color.DimGray, 0.5f); //画笔的颜色 , 分析xray的颜色
|
|
|
+ Pen m_mousemove_p = new Pen(Color.PowderBlue, 0.1f); //鼠标移动画的竖线的画笔颜色
|
|
|
|
|
|
- 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); //画笔的颜色
|
|
|
- Pen m_this_p_blue = new Pen(Color.DimGray, 0.5f); //画笔的颜色 , 分析xray的颜色
|
|
|
- Pen m_mousemove_p = new Pen(Color.PowderBlue, 0.1f);//鼠标移动画的竖线的画笔颜色
|
|
|
+ float m_kml_fz_top = 0; //计算KML峰值记录最高点变量
|
|
|
|
|
|
- float m_kml_fz_top = 0; //计算KML峰值记录最高点变量
|
|
|
+ float m_xraytopixel_multiple = 40; //比如,从xray0-6000的值,转到显示像素中0-150的比例倍数
|
|
|
|
|
|
- float m_xraytopixel_multiple = 40; //比如,从xray0-6000的值,转到显示像素中0-150的比例倍数
|
|
|
-
|
|
|
- float m_xraysum2 = 0; //xray计数总和2
|
|
|
- List<Periodic> m_list_periodic; //元素周期表,相关数据,窗体加载时初始化,然后用来计算使用
|
|
|
- List<KMLFPoint> m_list_kmlfpoint; //KML峰值,对应的位置和元素名
|
|
|
+ float m_xraysum2 = 0; //xray计数总和2
|
|
|
+ List<Periodic> m_list_periodic; //元素周期表,相关数据,窗体加载时初始化,然后用来计算使用
|
|
|
+ List<KMLFPoint> m_list_kmlfpoint; //KML峰值,对应的位置和元素名
|
|
|
|
|
|
//属性相关变量,用来显示使用
|
|
|
- private bool m_b_show_searchxray = false; //是否绘制搜索xray线,不再显示搜索xray,只显示分析xray
|
|
|
- private bool m_b_show_analysisxray = true; //设置是否绘制分析xray线
|
|
|
- private string m_goodname = ""; //夹杂物名称
|
|
|
- private string m_goodchinesename = ""; //夹杂物的中文名称
|
|
|
- private string m_stdname = ""; //标准名称
|
|
|
- private List<ShowElementInfo> m_list_showelementinfo = null;//需要显示的元素信息列表
|
|
|
- private string m_GBinfostr = ""; //国标信息显示
|
|
|
-
|
|
|
- float m_f_zl = 0.5f; //2000个数据放到1000个像素中计算出的增量
|
|
|
-
|
|
|
- float m_f_kmlfzpd_max = 30;//KML峰值上界限,进行记数的值,峰值判断的界限,需要按峰值最高值,和
|
|
|
- float m_f_kmlfzpd_mix = 5;//KML峰值下界限
|
|
|
+ private bool m_b_show_searchxray = false; //是否绘制搜索xray线,不再显示搜索xray,只显示分析xray
|
|
|
+ private bool m_b_show_analysisxray = true; //设置是否绘制分析xray线
|
|
|
+ private string m_goodname = ""; //夹杂物名称
|
|
|
+ private string m_goodchinesename = ""; //夹杂物的中文名称
|
|
|
+ private string m_stdname = ""; //标准名称
|
|
|
+ private List<ShowElementInfo> m_list_showelementinfo = null; //需要显示的元素信息列表
|
|
|
+ private string m_GBinfostr = ""; //国标信息显示
|
|
|
+
|
|
|
+ float m_f_zl = 0.5f; //2000个数据放到1000个像素中计算出的增量
|
|
|
+
|
|
|
+ float m_f_kmlfzpd_max = 30; //KML峰值上界限,进行记数的值,峰值判断的界限,需要按峰值最高值,和
|
|
|
+ float m_f_kmlfzpd_mix = 5; //KML峰值下界限
|
|
|
+ string m_ParticleInfo = ""; //颗粒相关信息
|
|
|
#endregion
|
|
|
|
|
|
#region 属性相关
|
|
@@ -105,7 +106,7 @@ namespace OTSIncAGraph.Controls
|
|
|
/// <summary>
|
|
|
/// 显示当前夹杂物的名称
|
|
|
/// </summary>
|
|
|
- public string GoodName
|
|
|
+ public string MaterialName
|
|
|
{
|
|
|
get { return m_goodname; }
|
|
|
set { m_goodname = value; }
|
|
@@ -146,16 +147,28 @@ namespace OTSIncAGraph.Controls
|
|
|
get { return m_b_show_analysisxray; }
|
|
|
set { m_b_show_analysisxray = value; }
|
|
|
}
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 显示颗粒相关信息
|
|
|
+ /// </summary>
|
|
|
+ public string ParticleInfo
|
|
|
+ {
|
|
|
+ get { return m_ParticleInfo; }
|
|
|
+ set { m_ParticleInfo = value; }
|
|
|
+ }
|
|
|
#endregion
|
|
|
|
|
|
#region 构造函数
|
|
|
public Control_XRayTable()
|
|
|
{
|
|
|
InitializeComponent();
|
|
|
+ m_i_draw_start += 40;
|
|
|
+ }
|
|
|
+ public Control_XRayTable(Bitmap a_bitmap)
|
|
|
+ {
|
|
|
+ InitializeComponent();
|
|
|
+ m_i_draw_start += 40;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
/// <summary>
|
|
|
/// 需要确定下来倍数后,从xray最大值6000,转换成显示最大值150的比例转换
|
|
|
/// </summary>
|
|
@@ -166,17 +179,23 @@ namespace OTSIncAGraph.Controls
|
|
|
return in_value / m_xraytopixel_multiple;
|
|
|
}
|
|
|
|
|
|
+ public void SetParticleInfo(string a_ParticleInfo)
|
|
|
+ {
|
|
|
+ m_ParticleInfo = a_ParticleInfo;
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 设置搜索xray和分析xray值到,记录变量中,及转换成显示变量中,用来供XrayTable显示及计算使用
|
|
|
/// </summary>
|
|
|
/// <param name="search_xray"></param>
|
|
|
/// <param name="analysis_xray"></param>
|
|
|
- public void SetXRayShowLineValue(uint[] search_xray,uint[] analysis_xray,List<ShowElementInfo> in_list_showelementinfo)
|
|
|
+ public void SetXRayShowLineValue(uint[] search_xray, uint[] analysis_xray, List<ShowElementInfo> in_list_showelementinfo)
|
|
|
{
|
|
|
//重新加载时,对当前的宽度等重新加载并计算
|
|
|
m_i_draw_end = this.Width;
|
|
|
- m_i_smalkd = (m_i_draw_end - 4) / m_i_smallkd_number;//按宽度重新计算小刻度的长度 -4是有4像素的边框差
|
|
|
- m_i_bigkd = (m_i_draw_end - 4) / m_i_bigkd_number; //按宽度重新计算大刻度的长度
|
|
|
+ m_Y_draw_end = this.Height;
|
|
|
+ m_i_smalkd = (m_i_draw_end - m_i_draw_start - 4) / m_i_smallkd_number;//按宽度重新计算小刻度的长度 -4是有4像素的边框差
|
|
|
+ m_i_bigkd = (m_i_draw_end - m_i_draw_start - 4) / m_i_bigkd_number; //按宽度重新计算大刻度的长度
|
|
|
|
|
|
|
|
|
#region 重新初始化相关全局变量
|
|
@@ -244,20 +263,20 @@ namespace OTSIncAGraph.Controls
|
|
|
for (int i = 0; i < analysis_xray.Length; i++)
|
|
|
{
|
|
|
//这里按比例进行转换
|
|
|
- m_f_show2[i] = GetValueByRatio( analysis_xray[i]);
|
|
|
+ m_f_show2[i] = GetValueByRatio(analysis_xray[i]);
|
|
|
m_xraysum2 = m_xraysum2 + analysis_xray[i];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//生成xray对应的绘制线段
|
|
|
float old_value = m_f_rulerX_location - 2;//从基础线-2的位置上进行绘制
|
|
|
- //float f_zl = 0.5f;//坐标值的增量,以小数做为增量的值,,,,这个坐标的增量应该根据实际的显示长度进行修改
|
|
|
- //当1000个像素时显示2000个数据,需要2000/1000=0.5f
|
|
|
- //0.5f就是2000个数据需要放到1000个像素中的计算系数
|
|
|
-
|
|
|
+ //float f_zl = 0.5f;//坐标值的增量,以小数做为增量的值,,,,这个坐标的增量应该根据实际的显示长度进行修改
|
|
|
+ //当1000个像素时显示2000个数据,需要2000/1000=0.5f
|
|
|
+ //0.5f就是2000个数据需要放到1000个像素中的计算系数
|
|
|
+
|
|
|
double ls_width = m_i_draw_end;//改成固定值,整个绘制浪线的总长
|
|
|
double ls_cs = 2000;
|
|
|
- m_f_zl = (float)(ls_width / ls_cs);
|
|
|
+ m_f_zl = (float)((ls_width - m_i_draw_start) / ls_cs);
|
|
|
|
|
|
//计算KML峰值判定的上标值与下标值
|
|
|
GetKMLFPD_MAXANDMIN(m_analysis_xray);
|
|
@@ -281,11 +300,13 @@ namespace OTSIncAGraph.Controls
|
|
|
|
|
|
m_list_twopoint2.Add(tp);
|
|
|
}
|
|
|
-
|
|
|
+ List<ShowElementInfo> in_list_showelementinfo2 = new List<ShowElementInfo>();
|
|
|
+ if (in_list_showelementinfo.Count > 10) in_list_showelementinfo2 = in_list_showelementinfo.GetRange(0, 10);
|
|
|
+ else in_list_showelementinfo2 = in_list_showelementinfo;
|
|
|
//重新实现的计算峰值上显示元素的计算方法
|
|
|
- CalcKMLFPoint(in_list_showelementinfo);
|
|
|
+ CalcKMLFPoint(in_list_showelementinfo2);
|
|
|
|
|
|
- m_list_showelementinfo = in_list_showelementinfo;
|
|
|
+ m_list_showelementinfo = in_list_showelementinfo2;
|
|
|
|
|
|
this.Invalidate();
|
|
|
}
|
|
@@ -309,7 +330,7 @@ namespace OTSIncAGraph.Controls
|
|
|
|
|
|
m_f_kmlfzpd_max = (float)(f_lsmax * 0.3);//最顶点的峰
|
|
|
m_f_kmlfzpd_mix = (float)(f_lsmax * 0.1);
|
|
|
- return ;
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -348,7 +369,7 @@ namespace OTSIncAGraph.Controls
|
|
|
}
|
|
|
if (kml_value >= (ls_f_sx2 - f_rect) && kml_value < (ls_f_sx2 + f_rect))
|
|
|
{
|
|
|
- str_ret = m_list_periodic[i].Symbol ;
|
|
|
+ str_ret = m_list_periodic[i].Symbol;
|
|
|
break;
|
|
|
}
|
|
|
if (kml_value >= (ls_f_sx3 - f_rect) && kml_value < (ls_f_sx3 + f_rect))
|
|
@@ -373,7 +394,7 @@ namespace OTSIncAGraph.Controls
|
|
|
{
|
|
|
m_kml_fz_top = tp.kmlf_value;
|
|
|
}
|
|
|
- else if( tp.value < m_f_kmlfzpd_mix && m_kml_fz_top != 0)//平均小于平均峰值 min时,结束记录,并将峰值保存,记录峰值元素
|
|
|
+ else if (tp.value < m_f_kmlfzpd_mix && m_kml_fz_top != 0)//平均小于平均峰值 min时,结束记录,并将峰值保存,记录峰值元素
|
|
|
{
|
|
|
//构造KML峰值list对象
|
|
|
KMLFPoint ls_lkmfpoint = new KMLFPoint();
|
|
@@ -387,48 +408,6 @@ namespace OTSIncAGraph.Controls
|
|
|
m_Y_MaxValue = m_kml_fz_top;
|
|
|
m_kml_fz_top = 0;
|
|
|
}
|
|
|
-
|
|
|
- #region 该方法先保留,待重写观察效果
|
|
|
- ////当峰值大于了 某值,判定值,同时,记录峰起点值是0时,为记录峰值开始
|
|
|
- //if (tp.value >= f_kmlfzpd_mix && kml_fz_start == 0)
|
|
|
- //{
|
|
|
- // kml_fz_start = tp.kmlf_value;//记录峰值起点
|
|
|
- //}
|
|
|
- //else
|
|
|
- //{
|
|
|
- // //记录该阶段最高的峰值
|
|
|
- // if (kml_fz_top < tp.kmlf_value)
|
|
|
- // kml_fz_top = tp.kmlf_value;
|
|
|
-
|
|
|
- // //这里又记录的结束点,如果判断到了结束点,那么就用开始点和结束点,来计算峰值的中心位置在哪
|
|
|
- // if (tp.value < f_kmlfzpd_mix && kml_fz_start != 0)
|
|
|
- // {
|
|
|
- // //说明已经在峰值结束后,的区间了
|
|
|
- // //保存峰值end
|
|
|
- // kml_fz_end = tp.kmlf_value;//记录峰值结束点
|
|
|
-
|
|
|
- // //计算峰值中心点,起点+(结束点-起点=起止段长)/2,就是起点+半段长,为峰值中心
|
|
|
- // kml_fz_start = kml_fz_start + (kml_fz_end - kml_fz_start) / 2;
|
|
|
-
|
|
|
- // //构造KML峰值list对象
|
|
|
- // KMLFPoint ls_lkmfpoint = new KMLFPoint();
|
|
|
- // //ls_lkmfpoint.kml_x = kml_fz_start;//不再使用中间阶段
|
|
|
- // ls_lkmfpoint.kml_x = kml_fz_top;
|
|
|
-
|
|
|
- // //查找出该峰值是什么元素的, 待完成
|
|
|
- // ls_lkmfpoint.ysm = GetElementNameByKMLRange(kml_fz_start, 0.2f);
|
|
|
- // //ls_lkmfpoint.ysm = "元素名";
|
|
|
-
|
|
|
- // //将该峰值保存到峰值上
|
|
|
- // m_list_kmlfpoint.Add(ls_lkmfpoint);
|
|
|
-
|
|
|
- // //最后再将记录kml峰值的起和止,都新初始化一下
|
|
|
- // kml_fz_start = 0;
|
|
|
- // kml_fz_end = 0;
|
|
|
- // kml_fz_top = 0;
|
|
|
- // }
|
|
|
- //}
|
|
|
- #endregion
|
|
|
}
|
|
|
|
|
|
private void CalcKMLFPoint(List<ShowElementInfo> in_list_showelementinfo)
|
|
@@ -437,9 +416,8 @@ 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;
|
|
|
+ ls_lkmfpoint.lml_x = (float)in_list_showelementinfo[i].dLF;
|
|
|
//将该峰值保存到峰值上
|
|
|
m_list_kmlfpoint.Add(ls_lkmfpoint);
|
|
|
}
|
|
@@ -462,6 +440,8 @@ namespace OTSIncAGraph.Controls
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
+
|
|
|
+
|
|
|
#region 绘制事件
|
|
|
protected override void OnPaint(PaintEventArgs e)
|
|
|
{
|
|
@@ -482,15 +462,18 @@ namespace OTSIncAGraph.Controls
|
|
|
//宽度比的缩放基数
|
|
|
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);
|
|
|
+ //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);
|
|
|
|
|
|
- //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);
|
|
|
+ //}
|
|
|
|
|
|
int i_count = 0;
|
|
|
//40个大刻度
|
|
@@ -504,9 +487,34 @@ namespace OTSIncAGraph.Controls
|
|
|
g.DrawString((i_count - 1).ToString(), m_thisfont_bold, m_this_sb, m_i_draw_start + (i * m_i_bigkd * f_js_width) + 1, m_f_rulerX_location + 10);
|
|
|
}
|
|
|
}
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
//补充输入文字,为了美观
|
|
|
//g.DrawString("kv", m_thisfont_bold, m_this_sb, 8, m_f_rulerX_location + 10);
|
|
|
+ Font m_thisfont_bold2 = new Font("微软雅黑", 11, FontStyle.Bold);
|
|
|
+ g.DrawString("Kev", m_thisfont_bold2, m_this_sb, (m_i_draw_end - m_i_draw_start) / 2 + m_i_draw_start, m_f_rulerX_location + 23);
|
|
|
+ g.TranslateTransform(m_i_draw_start - 45, m_f_rulerX_location - 25); // 移动到绘图起始点
|
|
|
+ g.RotateTransform(-90); // 逆时针旋转90度
|
|
|
+ g.DrawString("Counts", m_thisfont_bold2, m_this_sb, 0, 0);
|
|
|
+ g.ResetTransform();
|
|
|
#endregion
|
|
|
|
|
|
#region 绘制x-ray线的边框
|
|
@@ -516,24 +524,6 @@ namespace OTSIncAGraph.Controls
|
|
|
//g.DrawLine(m_this_p, m_i_draw_start, m_f_rulerX_location - 2, m_i_draw_end* f_js_width, m_f_rulerX_location - 2);
|
|
|
#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);
|
|
|
- //}
|
|
|
- #endregion
|
|
|
|
|
|
#endregion //--------------------------------------------------------------------------------------------------------
|
|
|
|
|
@@ -544,20 +534,11 @@ namespace OTSIncAGraph.Controls
|
|
|
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;
|
|
|
+ ls_pf1.X = ls_pf1.X * f_js_width + m_i_draw_start;
|
|
|
PointF ls_pf2 = m_list_twopoint1[i].pf2;
|
|
|
- ls_pf2.X = ls_pf2.X * f_js_width;
|
|
|
+ ls_pf2.X = ls_pf2.X * f_js_width + m_i_draw_start;
|
|
|
|
|
|
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)
|
|
@@ -566,9 +547,9 @@ namespace OTSIncAGraph.Controls
|
|
|
for (int i = 0; i < m_list_twopoint2.Count(); i++)
|
|
|
{
|
|
|
PointF ls_pf1_2 = m_list_twopoint2[i].pf1;
|
|
|
- ls_pf1_2.X = ls_pf1_2.X * f_js_width;
|
|
|
+ ls_pf1_2.X = (ls_pf1_2.X) * f_js_width + m_i_draw_start;
|
|
|
PointF ls_pf2_2 = m_list_twopoint2[i].pf2;
|
|
|
- ls_pf2_2.X = ls_pf2_2.X * f_js_width;
|
|
|
+ ls_pf2_2.X = (ls_pf2_2.X) * f_js_width + m_i_draw_start;
|
|
|
|
|
|
g.DrawLine(m_this_p_blue, ls_pf1_2, ls_pf2_2);
|
|
|
|
|
@@ -594,18 +575,32 @@ namespace OTSIncAGraph.Controls
|
|
|
else
|
|
|
i_py = 20;
|
|
|
|
|
|
- //先把峰值上的文字去掉,因为这里与底层分析出的结果不太一致,为了不产生疑问所以这里去掉
|
|
|
+
|
|
|
|
|
|
//绘制竖线
|
|
|
- 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_i_draw_start, 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_i_draw_start), 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)) + m_i_draw_start - 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)) + m_i_draw_start - out_testsizef.Width / 2), m_f_rulerX_location / 3 - 20 + i_py));
|
|
|
+
|
|
|
+ if (m_list_kmlfpoint[i].lml_x != 0)
|
|
|
+ {
|
|
|
+ //绘制竖线
|
|
|
+ g.DrawLine(new Pen(Color.Wheat, 0.5f), f_js_width * (m_list_kmlfpoint[i].lml_x * ((m_i_draw_end - m_i_draw_start) / 20)) + m_i_draw_start, m_f_rulerX_location / 3 + i_py, f_js_width * (m_list_kmlfpoint[i].lml_x * ((m_i_draw_end - m_i_draw_start) / 20) + m_i_draw_start), m_f_rulerX_location - 3);
|
|
|
+ //输出文字,并将字输出到线的上面
|
|
|
+ SizeF out_testsizef2 = g.MeasureString(m_list_kmlfpoint[i].ysm, m_thisfont);
|
|
|
+ PointF ut_test_pointF2 = 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].lml_x * ((m_i_draw_end - m_i_draw_start) / 20)) + m_i_draw_start - 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].lml_x * ((m_i_draw_end - m_i_draw_start) / 20)) + m_i_draw_start - out_testsizef.Width / 2), m_f_rulerX_location / 3 - 20 + i_py));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
#endregion
|
|
@@ -621,11 +616,11 @@ namespace OTSIncAGraph.Controls
|
|
|
if (m_analysis_xray[i] > m_f_kmlfzpd_mix)
|
|
|
{
|
|
|
//用绘线线段,的起始点与鼠标当前位置进行对应上的话,那么就进行取kmlf值,进行显示
|
|
|
- if (Convert.ToInt32(m_list_twopoint2[i].pf1.X * f_js_width) == m_mouse_point.X)
|
|
|
+ if (Convert.ToInt32(m_list_twopoint2[i].pf1.X * f_js_width) == m_mouse_point.X + m_i_draw_start)
|
|
|
{
|
|
|
ls_label_str = m_list_twopoint2[i].kmlf_value.ToString();
|
|
|
}
|
|
|
- if (Convert.ToInt32(m_list_twopoint2[i].pf2.X * f_js_width) == m_mouse_point.X)
|
|
|
+ if (Convert.ToInt32(m_list_twopoint2[i].pf2.X * f_js_width) == m_mouse_point.X + m_i_draw_start)
|
|
|
{
|
|
|
ls_label_str = m_list_twopoint2[i].kmlf_value.ToString();
|
|
|
}
|
|
@@ -643,17 +638,10 @@ namespace OTSIncAGraph.Controls
|
|
|
|
|
|
#region //右上角输出文字设置-------------------------------------------------------------------------------------------------
|
|
|
m_i_rightdrawlabellocation_x = m_i_draw_end * f_js_width - 260;
|
|
|
- //国标
|
|
|
- //g.DrawString("国标:", m_thisfont, m_this_sb, new PointF(m_i_rightdrawlabellocation_x, m_i_rightdrawlabellocation_y));
|
|
|
- //
|
|
|
- //国际化
|
|
|
- OTSCommon.Language lan = new OTSCommon.Language();
|
|
|
- Hashtable table = lan.GetNameTable("Control_XRayTable");
|
|
|
- string str1 = table["str1"].ToString();
|
|
|
- string str2 = table["str2"].ToString();
|
|
|
- g.DrawString(str1, m_thisfont, m_this_sb, new PointF(m_i_rightdrawlabellocation_x, m_i_rightdrawlabellocation_y + 20));
|
|
|
+
|
|
|
+ g.DrawString("计数:", m_thisfont, m_this_sb, new PointF(m_i_rightdrawlabellocation_x, m_i_rightdrawlabellocation_y + 20));
|
|
|
//g.DrawString("高度比例尺:", m_thisfont, m_this_sb, new PointF(m_i_rightdrawlabellocation_x, m_i_rightdrawlabellocation_y + 20));
|
|
|
- g.DrawString(str2, m_thisfont, m_this_sb, new PointF(m_i_rightdrawlabellocation_x, m_i_rightdrawlabellocation_y + 40));
|
|
|
+ g.DrawString("物质:", m_thisfont, m_this_sb, new PointF(m_i_rightdrawlabellocation_x, m_i_rightdrawlabellocation_y + 40));
|
|
|
|
|
|
//显示国标相关信息
|
|
|
g.DrawString(m_GBinfostr, m_thisfont_bold, m_this_sb, new PointF(m_i_rightdrawlabellocation_x, m_i_rightdrawlabellocation_y));
|
|
@@ -665,87 +653,52 @@ namespace OTSIncAGraph.Controls
|
|
|
g.DrawString(m_goodname, m_thisfont_bold, m_this_sb, new PointF(m_i_rightdrawlabellocation_x + 50, m_i_rightdrawlabellocation_y + 40));
|
|
|
|
|
|
//show element list information,using the elementlist number to make sure width,number take width 25 growth
|
|
|
+
|
|
|
if (m_list_showelementinfo != null)
|
|
|
{
|
|
|
- PointF ls_pt = new PointF(m_i_rightdrawlabellocation_x - (m_list_showelementinfo.Count * 25 - 60), m_i_rightdrawlabellocation_y + 60);
|
|
|
+ //make it 100%
|
|
|
+ double sumpercentage = 0;
|
|
|
+ for (int i = 0; i < m_list_showelementinfo.Count; i++)
|
|
|
+ {
|
|
|
+ sumpercentage += m_list_showelementinfo[i].Percentage;
|
|
|
+
|
|
|
+ }
|
|
|
+ for (int i = 0; i < m_list_showelementinfo.Count; i++)
|
|
|
+ {
|
|
|
+ m_list_showelementinfo[i].percentageIn100 = m_list_showelementinfo[i].Percentage / sumpercentage * 100;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
for (int i = 0; i < m_list_showelementinfo.Count; i++)
|
|
|
{
|
|
|
- string str_element = "" + m_list_showelementinfo[i].ElementName + "(" + m_list_showelementinfo[i].Percentage.ToString("0.00") + ")";
|
|
|
- SizeF out_testsizef = g.MeasureString(str_element, m_thisfont);
|
|
|
- g.DrawString(str_element, m_thisfont, new SolidBrush(GetColorByNumber(i + 1)), ls_pt);
|
|
|
- ls_pt.X = ls_pt.X + out_testsizef.Width + 2;
|
|
|
+ if (i > 6 && m_list_showelementinfo[i].Percentage < 0.1) break;
|
|
|
+ sb.Append(m_list_showelementinfo[i].ElementName);
|
|
|
+ sb.Append("(");
|
|
|
+ sb.Append(m_list_showelementinfo[i].Percentage.ToString("0.00) "));
|
|
|
}
|
|
|
+ sb.Append("\n");
|
|
|
+ sb.Append(m_ParticleInfo);
|
|
|
+ string str_element = sb.ToString();
|
|
|
+ SizeF out_testsizef = g.MeasureString(str_element, m_thisfont);
|
|
|
+
|
|
|
+
|
|
|
+ PointF ls_pt = new PointF(m_i_rightdrawlabellocation_x, m_i_rightdrawlabellocation_y + 60);
|
|
|
+
|
|
|
+ ls_pt.X = (ls_pt.X - out_testsizef.Width / 2 - 10);
|
|
|
+
|
|
|
+ g.DrawString(str_element, m_thisfont, new SolidBrush(Color.Blue), ls_pt);
|
|
|
+
|
|
|
}
|
|
|
- //标准库显示
|
|
|
- //g.DrawString("标准来自: "+m_stdname, m_thisfont, m_this_sb_blue, new PointF(m_i_rightdrawlabellocation_x + 10, m_i_rightdrawlabellocation_y + 80));
|
|
|
+
|
|
|
#endregion //------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
}
|
|
|
#endregion
|
|
|
- public static Color GetColorByNumber(int number)
|
|
|
- {
|
|
|
- Color ret_color = new Color();
|
|
|
- switch (number)
|
|
|
- {
|
|
|
- case 1:
|
|
|
- ret_color = Color.Blue;
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- ret_color = Color.Brown;
|
|
|
- break;
|
|
|
- case 3:
|
|
|
- ret_color = Color.LimeGreen;
|
|
|
- break;
|
|
|
- case 13:
|
|
|
- ret_color = Color.Cyan;
|
|
|
- break;
|
|
|
- case 4:
|
|
|
- ret_color = Color.DarkBlue;
|
|
|
- break;
|
|
|
- case 5:
|
|
|
- ret_color = Color.Red;
|
|
|
- break;
|
|
|
- case 6:
|
|
|
- ret_color = Color.SaddleBrown;
|
|
|
- break;
|
|
|
- case 7:
|
|
|
- ret_color = Color.DimGray;
|
|
|
- break;
|
|
|
- case 8:
|
|
|
- ret_color = Color.Navy;
|
|
|
- break;
|
|
|
- case 9:
|
|
|
- ret_color = Color.Peru;
|
|
|
- break;
|
|
|
- case 10:
|
|
|
- ret_color = Color.Red;
|
|
|
- break;
|
|
|
- case 11:
|
|
|
- ret_color = Color.SeaGreen;
|
|
|
- break;
|
|
|
- case 12:
|
|
|
- ret_color = Color.MintCream;
|
|
|
- break;
|
|
|
- case 14:
|
|
|
- ret_color = Color.PaleTurquoise;
|
|
|
- break;
|
|
|
- case 15:
|
|
|
- ret_color = Color.SeaShell;
|
|
|
- break;
|
|
|
- case 16:
|
|
|
- ret_color = Color.Snow;
|
|
|
- break;
|
|
|
- case 17:
|
|
|
- ret_color = Color.WhiteSmoke;
|
|
|
- break;
|
|
|
-
|
|
|
- default:
|
|
|
- ret_color = Color.White;
|
|
|
- break;
|
|
|
- }
|
|
|
|
|
|
- return ret_color;
|
|
|
- }
|
|
|
#region 导出绘制的XRay能谱方法
|
|
|
/// <summary>
|
|
|
/// 导出能谱的图像截图Bitmap对象
|
|
@@ -755,12 +708,6 @@ namespace OTSIncAGraph.Controls
|
|
|
public Bitmap ExportXRayImage()
|
|
|
{
|
|
|
Bitmap ret_bmp = new Bitmap(this.Width, this.Height);
|
|
|
- //Graphics g = this.CreateGraphics();
|
|
|
-
|
|
|
- //g.DrawImage(ret_bmp, new Point(0, 0));
|
|
|
- //DrawXrayImage(g);
|
|
|
-
|
|
|
- //Bitmap image = new Bitmap(this.Width, this.Height);
|
|
|
this.DrawToBitmap(ret_bmp, new Rectangle(0, 0, this.Width, this.Height));
|
|
|
|
|
|
return ret_bmp;
|
|
@@ -779,6 +726,10 @@ namespace OTSIncAGraph.Controls
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
+ private void label_close_Click(object sender, EventArgs e)
|
|
|
+ {
|
|
|
+ this.Visible = false;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
#region 用来显示连接线封装的类
|
|
@@ -818,5 +769,4 @@ namespace OTSIncAGraph.Controls
|
|
|
public double percentageIn100;//归一化后的百分比
|
|
|
}
|
|
|
#endregion
|
|
|
-
|
|
|
}
|