|
@@ -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++)
|