|
|
@@ -37,7 +37,7 @@ namespace OTSIncAReportGraph
|
|
|
/// </summary>
|
|
|
public enum ParticleShowXray
|
|
|
{
|
|
|
- SELECTANDDISPLAYXRAY = 0,
|
|
|
+ DISPLAYXRAY = 0,
|
|
|
NODISPLAY = 1,
|
|
|
}
|
|
|
|
|
|
@@ -53,14 +53,14 @@ namespace OTSIncAReportGraph
|
|
|
/// <summary>
|
|
|
/// 颗粒类
|
|
|
/// </summary>
|
|
|
- public class DisplayParticle : BaseObject, ICloneable, IComparable<DisplayParticle>
|
|
|
+ public class DisplayParticle : ICloneable
|
|
|
{
|
|
|
- private const float m_zoom_displaymultiplier = 0.5f;
|
|
|
+ private const float m_zoom_displayThreshold = 0.1f;
|
|
|
public Particle objParticleData;
|
|
|
private Guid m_id;
|
|
|
private RectangleF m_rect;
|
|
|
private PointF m_OTSPointF;
|
|
|
- private RectangleF m_small_rect;
|
|
|
+ private RectangleF m_smallRect;
|
|
|
private bool m_isSelected_smallrect;
|
|
|
private bool m_showSmallx;
|
|
|
private bool m_isSelected;
|
|
|
@@ -71,11 +71,11 @@ namespace OTSIncAReportGraph
|
|
|
private bool m_isdragging;
|
|
|
private PointF m_dragingpoint;
|
|
|
private Color m_color;
|
|
|
- private Color m_backcolor;
|
|
|
+
|
|
|
private GraphicsPath m_gpath;
|
|
|
private List<DisplaySegment> m_listdsegment = new List<DisplaySegment>();
|
|
|
private DisplayState m_displayState;
|
|
|
-
|
|
|
+ private SegmentShowMode show_mode = SegmentShowMode.DRAWPOINT;//绘线,绘点,默认绘点,意思为默认显示BSE原图像
|
|
|
private Image m_image;
|
|
|
|
|
|
private string m_sort_type = "从大到小";
|
|
|
@@ -84,7 +84,7 @@ namespace OTSIncAReportGraph
|
|
|
private string m_str_klzl = "颗粒种类";
|
|
|
private string m_str_klfl = "颗粒分类";
|
|
|
|
|
|
-
|
|
|
+ private float m_CurrentZoomNum = 1;
|
|
|
|
|
|
public int TypeId
|
|
|
{
|
|
|
@@ -132,12 +132,84 @@ namespace OTSIncAReportGraph
|
|
|
m_id = System.Guid.NewGuid();
|
|
|
}
|
|
|
|
|
|
- public DisplayParticle(Particle part)
|
|
|
+ public DisplayParticle(Particle particle,Point screenPos,Bitmap originalFieldImage,Bitmap fieldParticleImage)
|
|
|
{
|
|
|
+
|
|
|
m_id = System.Guid.NewGuid();
|
|
|
- objParticleData = part;
|
|
|
- this.Color = GetColorBySTDTypeIDForBSEAndSorImage(part.TypeColor, part.TypeId);
|
|
|
+ objParticleData = particle;
|
|
|
+ this.Color = DrawFunction.GetColorBySTDTypeIDForBSEAndSorImage(particle.TypeColor, particle.TypeId);
|
|
|
+
|
|
|
+
|
|
|
+ List<Segment> list_seg;
|
|
|
+ list_seg = particle.SegmentList;
|
|
|
+
|
|
|
+ //创建颗粒分布图对应的类对象
|
|
|
+ List<DisplaySegment> list_dsegment = new List<DisplaySegment>();
|
|
|
+
|
|
|
+
|
|
|
+ //再循环取出里面所有的segment
|
|
|
+ foreach (Segment seg in list_seg)
|
|
|
+ {
|
|
|
+ #region 创建DSegment对象,并将STD分析出的化合物颜色保存到DSegment对象中
|
|
|
+ //对Particle里的Segment进行偏移的计算等,创建了DSegment的大小
|
|
|
+ DisplaySegment ds = new DisplaySegment();
|
|
|
+ ds.SetShowRect(new Rectangle(seg.Start + screenPos.X,
|
|
|
+
|
|
|
+ seg.Height + screenPos.Y,
|
|
|
+ seg.Length,
|
|
|
+ 1));
|
|
|
+
|
|
|
+
|
|
|
+ ds.Color = this.Color;//将线的颜色对应到颗粒的颜色
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region //这里是在Field中,抠取出原BSE图像到DSegment中--------------------------------
|
|
|
+
|
|
|
+ //合成图像完成,开始抠取像素-----------------------------------------------------------------
|
|
|
+ int f_length = seg.Length;
|
|
|
+
|
|
|
+ for (int m = 0; m < f_length; m++)
|
|
|
+ {
|
|
|
+ //这里实现一下代码保护
|
|
|
+ int lsjs_x = seg.Start + m;
|
|
|
+
|
|
|
+ int lsjs_y = seg.Height;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ var pixelColor = originalFieldImage.GetPixel(lsjs_x, lsjs_y);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ fieldParticleImage.SetPixel(lsjs_x, lsjs_y, pixelColor);//ls_list_colors[m]
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion //------------------------------------------------------------------------------
|
|
|
+
|
|
|
+ list_dsegment.Add(ds);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ SetPaintState(PaintState.PAINT);
|
|
|
+
|
|
|
+ SetDSegments(list_dsegment);
|
|
|
+
|
|
|
+
|
|
|
+ var currentRect = new RectangleF(m_rect.X - screenPos.X, m_rect.Y - screenPos.Y, m_rect.Width, m_rect.Height);
|
|
|
+
|
|
|
+
|
|
|
+ var dpImg = fieldParticleImage.Clone(currentRect, fieldParticleImage.PixelFormat);
|
|
|
+ SetImage(dpImg);
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
public DisplayParticle(List<DisplaySegment> in_list_segment, DisplayParticle in_particle)
|
|
|
@@ -157,132 +229,26 @@ namespace OTSIncAReportGraph
|
|
|
{
|
|
|
m_listdsegment.Add(e.Clone() as DisplaySegment);
|
|
|
}
|
|
|
+
|
|
|
+ m_rect = GetRectFromDSegment();
|
|
|
+ m_smallRect = GetSmallRectangleFromRect();
|
|
|
+ m_gpath = GetRegionFromDSegments();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
- /// [目前也不使用该方法了,因为该方法每次排序都有不同的结果]多边形排序,按传入的sort_type的排序类型行排序,但需要两个list做一致性排序
|
|
|
+ /// 设置显示的方式,可以用,绘线显示查看标准库颜色的,也可以用绘点,查看BSE原图颗粒图色的
|
|
|
/// </summary>
|
|
|
- /// <param name="in_ap"></param>
|
|
|
- /// <returns></returns>
|
|
|
- public int CompareTo(DisplayParticle in_particle)
|
|
|
+ public SegmentShowMode ShowMode
|
|
|
{
|
|
|
- int r_b = 0;//排序返回值
|
|
|
- switch (m_sort_type)
|
|
|
- {
|
|
|
- case "从大到小":
|
|
|
- r_b = in_particle.m_f_size.CompareTo(this.m_f_size);
|
|
|
- break;
|
|
|
-
|
|
|
- case "从小到大":
|
|
|
- //与上面的从大到小正好相反即可
|
|
|
- r_b = in_particle.m_f_size.CompareTo(this.m_f_size);
|
|
|
- if (r_b == 1)
|
|
|
- r_b = -1;
|
|
|
- else
|
|
|
- r_b = 1;
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- return r_b;
|
|
|
- }
|
|
|
- public Color GetColorBySTDTypeIDForBSEAndSorImage(string in_partcolor, int in_stdtypeid)
|
|
|
- {
|
|
|
- Color ret_c = new Color();
|
|
|
-
|
|
|
-
|
|
|
- if (in_stdtypeid < 1000)
|
|
|
- {
|
|
|
-
|
|
|
- ret_c = GetColorByEnum(in_stdtypeid);
|
|
|
- }
|
|
|
- else if (in_stdtypeid >= 1000)
|
|
|
- {
|
|
|
- //大于等于1000,并且小于10000时,使用用户标准库来分析夹杂物名称
|
|
|
- if (!in_partcolor.Contains("#"))
|
|
|
- {
|
|
|
- ret_c = DrawFunction.colorHx16toRGB("#" + in_partcolor);//接收必须是#000000的格式
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- ret_c = DrawFunction.colorHx16toRGB(in_partcolor);//接收必须是#000000的格式
|
|
|
- }
|
|
|
- }
|
|
|
- return ret_c;
|
|
|
- }
|
|
|
- public Color GetColorByEnum(int STDID)
|
|
|
- {
|
|
|
- Color ret_c = new Color();
|
|
|
- switch (STDID)
|
|
|
- {
|
|
|
- case -1:
|
|
|
- //INVALID = -1,
|
|
|
- //stdName = "无效颗粒";
|
|
|
- ret_c = Color.Black;
|
|
|
- break;
|
|
|
- case 0:
|
|
|
- //small = 0;
|
|
|
- //stdName = "过小颗粒";
|
|
|
- ret_c = Color.Black;
|
|
|
- break;
|
|
|
- case 1:
|
|
|
- //OVERSIZE = 1,
|
|
|
- //stdName = "过大颗粒";
|
|
|
- ret_c = Color.Black;
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- //AVE_GRAY_NOT_INRANRE = 2,
|
|
|
- //stdName = "亮度不在分析范围内的颗粒";
|
|
|
- ret_c = Color.Black;
|
|
|
- break;
|
|
|
- case 3:
|
|
|
- //SEARCH_X_RAY = 3,
|
|
|
- //stdName = "不进行搜索x-ray分析的颗粒";
|
|
|
- ret_c = Color.Black;
|
|
|
- break;
|
|
|
- case 4:
|
|
|
- //LOW_COUNT = 4,
|
|
|
- //stdName = "低x-ray计数颗粒";
|
|
|
- ret_c = Color.Black;
|
|
|
- break;
|
|
|
- case 5:
|
|
|
- //NO_INTEREST_ELEMENTS = 5,
|
|
|
- //stdName = "不含分析元素的颗粒";
|
|
|
- ret_c = Color.Black;
|
|
|
- break;
|
|
|
- case 6:
|
|
|
- //ALAYSIS_X_RAY = 6,
|
|
|
- //stdName = "不进行x-ray分析的颗粒";
|
|
|
- ret_c = Color.Black;
|
|
|
- break;
|
|
|
- case 7:
|
|
|
- //NOT_IDENTIFIED = 7,
|
|
|
- //stdName = "未识别颗粒";
|
|
|
- ret_c = Color.Black;
|
|
|
- break;
|
|
|
- case 8:
|
|
|
- //NOT_IDENTIFIED = 8,
|
|
|
- //stdName = "未识别颗粒";
|
|
|
- ret_c = Color.Black;
|
|
|
- break;
|
|
|
- case 9:
|
|
|
- //NOT_IDENTIFIED = 9,
|
|
|
- //stdName = "未识别颗粒";
|
|
|
- ret_c = Color.Black;
|
|
|
- break;
|
|
|
- default:
|
|
|
- ret_c = Color.Black;
|
|
|
- break;
|
|
|
- }
|
|
|
- return ret_c;
|
|
|
+ get { return show_mode; }
|
|
|
+ set { show_mode = value; }
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 克隆方法
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
- public override object Clone()
|
|
|
+ public object Clone()
|
|
|
{
|
|
|
return new DisplayParticle(this.m_listdsegment, this);
|
|
|
}
|
|
|
@@ -295,7 +261,7 @@ namespace OTSIncAReportGraph
|
|
|
/// <summary>
|
|
|
/// ID
|
|
|
/// </summary>
|
|
|
- public override Guid guid
|
|
|
+ public Guid guid
|
|
|
{
|
|
|
get { return m_id; }
|
|
|
set { m_id = value; }
|
|
|
@@ -304,16 +270,21 @@ namespace OTSIncAReportGraph
|
|
|
/// <summary>
|
|
|
/// 颗粒的外边框大小
|
|
|
/// </summary>
|
|
|
- public override RectangleF Rect
|
|
|
+ public RectangleF GetShowRect()
|
|
|
{
|
|
|
- get { return m_rect; }
|
|
|
- set { m_rect = value; }
|
|
|
+
|
|
|
+ m_rect= this.GetRectFromDSegment();
|
|
|
+
|
|
|
+ return m_rect;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// OTSPointF
|
|
|
/// </summary>
|
|
|
- public override PointF OTSPointF
|
|
|
+ public PointF OTSPointF
|
|
|
{
|
|
|
get { return m_OTSPointF; }
|
|
|
set { m_OTSPointF = value; }
|
|
|
@@ -322,16 +293,18 @@ namespace OTSIncAReportGraph
|
|
|
/// <summary>
|
|
|
/// 颗粒里+号位置的外边框大小
|
|
|
/// </summary>
|
|
|
- public RectangleF SmallRect
|
|
|
+ public RectangleF GetSmallRect()
|
|
|
{
|
|
|
- get { return m_small_rect; }
|
|
|
- set { m_small_rect = value; }
|
|
|
+
|
|
|
+ m_smallRect=this.GetSmallRectangleFromRect();
|
|
|
+
|
|
|
+
|
|
|
+ return m_smallRect;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 颗粒是否被选择
|
|
|
- /// </summary>
|
|
|
- public override bool IsSelect
|
|
|
+
|
|
|
+ public bool IsSelect
|
|
|
{
|
|
|
get { return m_isSelected; }
|
|
|
set { m_isSelected = value; }
|
|
|
@@ -356,7 +329,28 @@ namespace OTSIncAReportGraph
|
|
|
/// 该颗粒是否被设置成,选中状态
|
|
|
/// </summary>
|
|
|
public void SetPaintState(PaintState value)
|
|
|
- { m_paintState = value; }
|
|
|
+ {
|
|
|
+ if (value == PaintState.PAINT)
|
|
|
+ {
|
|
|
+ if (m_CurrentZoomNum >= m_zoom_displayThreshold)
|
|
|
+ {
|
|
|
+ m_paintState = PaintState.PAINT;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ m_paintState = PaintState.CONCISEPAINT;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ m_paintState = value;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
/// <summary>
|
|
|
/// 是否对该颗粒选定显示X-Ray能谱图
|
|
|
@@ -389,7 +383,7 @@ namespace OTSIncAReportGraph
|
|
|
/// <summary>
|
|
|
/// 是否在被拖动
|
|
|
/// </summary>
|
|
|
- public override bool IsDragging
|
|
|
+ public bool IsDragging
|
|
|
{
|
|
|
get { return m_isdragging; }
|
|
|
set { m_isdragging = value; }
|
|
|
@@ -398,58 +392,162 @@ namespace OTSIncAReportGraph
|
|
|
/// <summary>
|
|
|
/// 被拖动到的位置坐标
|
|
|
/// </summary>
|
|
|
- public override PointF DraggingPoint
|
|
|
+ public PointF DraggingPoint
|
|
|
{
|
|
|
get { return m_dragingpoint; }
|
|
|
- set { m_dragingpoint = value; }
|
|
|
+ set {
|
|
|
+
|
|
|
+ m_dragingpoint = value;
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 线的颜色
|
|
|
/// </summary>
|
|
|
- public override Color Color
|
|
|
+ public Color Color
|
|
|
{
|
|
|
get { return m_color; }
|
|
|
set { m_color = value; }
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/// <summary>
|
|
|
- /// 背景色
|
|
|
+ /// 多边形的图形路径边缘
|
|
|
/// </summary>
|
|
|
- public override Color BackColor
|
|
|
+ public GraphicsPath GetGPath()
|
|
|
{
|
|
|
- get { return m_backcolor; }
|
|
|
- set { m_backcolor = value; }
|
|
|
+
|
|
|
+ m_gpath = this.GetRegionFromDSegments();
|
|
|
+
|
|
|
+ return m_gpath;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
/// <summary>
|
|
|
- /// 多边形的图形路径边缘
|
|
|
+ /// 里面包含的多个线的集合
|
|
|
/// </summary>
|
|
|
- public override GraphicsPath GPath
|
|
|
- {
|
|
|
- get { return m_gpath; }
|
|
|
- set { m_gpath = value; }
|
|
|
- }
|
|
|
+ public List<DisplaySegment> GetDSegments()
|
|
|
+ { return m_listdsegment; }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
/// <summary>
|
|
|
/// 里面包含的多个线的集合
|
|
|
/// </summary>
|
|
|
- public List<DisplaySegment> DSegments
|
|
|
+ public void SetDSegments(List<DisplaySegment> value)
|
|
|
+ {
|
|
|
+ m_listdsegment = value;
|
|
|
+
|
|
|
+ m_rect=GetRectFromDSegment();
|
|
|
+ m_gpath=GetRegionFromDSegments();
|
|
|
+ m_smallRect=GetSmallRectangleFromRect();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public void Zoom(float zoomDelta,PointF refPoint)
|
|
|
{
|
|
|
- get { return m_listdsegment; }
|
|
|
- set { m_listdsegment = value; }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ for (int y = 0; y < this.GetDSegments().Count(); y++)
|
|
|
+ {
|
|
|
+ //这里重新设置每条线的高度,和x,y坐标
|
|
|
+ DisplaySegment ds = this.GetDSegments()[y];
|
|
|
+
|
|
|
+ var rec = ds.GetShowRect();
|
|
|
+
|
|
|
+
|
|
|
+ rec.Width = (float)(rec.Width + Convert.ToDouble(rec.Width/m_CurrentZoomNum * zoomDelta));
|
|
|
+ rec.Height = (float)(rec.Height + Convert.ToDouble(rec.Height/m_CurrentZoomNum * zoomDelta));
|
|
|
+
|
|
|
+
|
|
|
+ //锚点缩放补差值计算,得出差值
|
|
|
+ float xShiftOld = rec.X - refPoint.X;
|
|
|
+ float yShiftOld = rec.Y - refPoint.Y;
|
|
|
+ float xShift = rec.X - refPoint.X + xShiftOld/m_CurrentZoomNum * zoomDelta;
|
|
|
+ float yShift = rec.Y - refPoint.Y + yShiftOld/m_CurrentZoomNum * zoomDelta;
|
|
|
+
|
|
|
+
|
|
|
+ //对背景矩形与所有的segment进行修补差值
|
|
|
+ rec.X = refPoint.X + xShift;
|
|
|
+ rec.Y = refPoint.Y + yShift;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ ds.SetShowRect(rec);
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ m_rect=GetRectFromDSegment();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ //重新计算小矩形边框
|
|
|
+ m_smallRect=GetSmallRectangleFromRect();
|
|
|
+ //设置缩放到多少倍时进行显示
|
|
|
+ if (m_CurrentZoomNum >= m_zoom_displayThreshold)
|
|
|
+ {
|
|
|
+ m_paintState = PaintState.PAINT;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ m_paintState = PaintState.CONCISEPAINT;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ m_CurrentZoomNum += zoomDelta;
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 控制多边形在进行缩放到多少倍时进行显示
|
|
|
- /// </summary>
|
|
|
- public float Zoom_DisPlayThreshold
|
|
|
+ public void DraggingMove(PointF mousePoint)
|
|
|
{
|
|
|
- get { return m_zoom_displaymultiplier; }
|
|
|
-
|
|
|
+ foreach (DisplaySegment ds in this.GetDSegments())
|
|
|
+ {
|
|
|
+ var rec = ds.GetShowRect();
|
|
|
+ rec.X = ds.GetShowRect().X + mousePoint.X - this.DraggingPoint.X; //获取到原先点与移动点的增减量,+原先的x坐标,就是新的坐标
|
|
|
+ rec.Y = ds.GetShowRect().Y + mousePoint.Y - this.DraggingPoint.Y;
|
|
|
+ ds.SetShowRect(rec);
|
|
|
+
|
|
|
+ }
|
|
|
+ this.DraggingPoint = mousePoint;
|
|
|
+
|
|
|
+ //获取矩形的rectangle
|
|
|
+ m_rect = GetRectFromDSegment();
|
|
|
+
|
|
|
+
|
|
|
+ ////重新计算小矩形边框
|
|
|
+ m_smallRect = GetSmallRectangleFromRect();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
+ public void Move(SizeF xyShift)
|
|
|
+ {
|
|
|
+ foreach (DisplaySegment ds in this.GetDSegments())
|
|
|
+ {
|
|
|
+ var rec = ds.GetShowRect();
|
|
|
+ rec.X = ds.GetShowRect().X -xyShift.Width; //获取到原先点与移动点的增减量,+原先的x坐标,就是新的坐标
|
|
|
+ rec.Y = ds.GetShowRect().Y - xyShift.Height ;
|
|
|
+ ds.SetShowRect(rec);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //获取矩形的rectangle
|
|
|
+ m_rect = GetRectFromDSegment();
|
|
|
+ //重新计算小矩形边框
|
|
|
+ m_smallRect = GetSmallRectangleFromRect();
|
|
|
|
|
|
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/// <summary>
|
|
|
/// 设置排序的类型
|
|
|
@@ -547,7 +645,7 @@ namespace OTSIncAReportGraph
|
|
|
/// 绘制函数
|
|
|
/// </summary>
|
|
|
/// <param name="e"></param>
|
|
|
- public override void OnPaint(PaintEventArgs e)
|
|
|
+ public void OnPaint(PaintEventArgs e)
|
|
|
{
|
|
|
Graphics g = e.Graphics;
|
|
|
//绘制鼠标移动到颗粒上时的边框,需要判断当前鼠标在颗粒上,及颗粒的操作为正常显示
|
|
|
@@ -555,7 +653,7 @@ namespace OTSIncAReportGraph
|
|
|
{
|
|
|
//如果有鼠标在该矩形上,那么进行描边
|
|
|
ControlPaint.DrawBorder(g,
|
|
|
- Rectangle.Round(this.Rect),
|
|
|
+ Rectangle.Round(this.GetShowRect()),
|
|
|
Color.Lime,
|
|
|
1,
|
|
|
ButtonBorderStyle.Solid,
|
|
|
@@ -575,18 +673,18 @@ namespace OTSIncAReportGraph
|
|
|
if (m_listdsegment.Count > 0)
|
|
|
{
|
|
|
|
|
|
- DisplaySegment ds = m_listdsegment[0];
|
|
|
- if (ds.ShowMode == SegmentShowMode.DRAWPOINT)
|
|
|
+ //DisplaySegment ds = m_listdsegment[0];
|
|
|
+ if (this.ShowMode == SegmentShowMode.DRAWPOINT)
|
|
|
{
|
|
|
- try
|
|
|
- {
|
|
|
+ //try
|
|
|
+ //{
|
|
|
e.Graphics.DrawImage(m_image, m_rect);
|
|
|
|
|
|
- }
|
|
|
- catch (Exception ex)
|
|
|
- {
|
|
|
- NLog.LogManager.GetCurrentClassLogger().Error(ex.ToString());
|
|
|
- }
|
|
|
+ //}
|
|
|
+ //catch (Exception ex)
|
|
|
+ //{
|
|
|
+ // NLog.LogManager.GetCurrentClassLogger().Error(ex.ToString());
|
|
|
+ //}
|
|
|
|
|
|
|
|
|
}
|
|
|
@@ -610,14 +708,14 @@ namespace OTSIncAReportGraph
|
|
|
}
|
|
|
if (GetPaintState() == PaintState.CONCISEPAINT)
|
|
|
{
|
|
|
- g.DrawString("+", new Font("黑体", 6), new SolidBrush(Color.DarkSlateBlue), new PointF(m_small_rect.X, m_small_rect.Y));
|
|
|
+ g.DrawString("+", new Font("黑体", 6), new SolidBrush(Color.DarkSlateBlue), new PointF(m_smallRect.X, m_smallRect.Y));
|
|
|
}
|
|
|
|
|
|
if (m_isSelected)
|
|
|
{
|
|
|
//如果説该矩形被选择上了的话,那么也显示边框
|
|
|
ControlPaint.DrawBorder(g,
|
|
|
- Rectangle.Round(this.Rect),
|
|
|
+ Rectangle.Round(this.GetShowRect()),
|
|
|
Color.Blue,
|
|
|
1,
|
|
|
ButtonBorderStyle.Solid,
|
|
|
@@ -632,11 +730,11 @@ namespace OTSIncAReportGraph
|
|
|
ButtonBorderStyle.Solid);
|
|
|
}
|
|
|
|
|
|
- if (ParticleShowXray.SELECTANDDISPLAYXRAY == m_operator_showxray && PaintState.NOPAINT != GetPaintState())
|
|
|
+ if (ParticleShowXray.DISPLAYXRAY == m_operator_showxray && PaintState.NOPAINT != GetPaintState())
|
|
|
{
|
|
|
//当鼠标在该颗粒上进行点击,则对颗粒状态更改为选定状态,用来显示X-ray能谱表
|
|
|
ControlPaint.DrawBorder(g,
|
|
|
- Rectangle.Round(this.Rect),
|
|
|
+ Rectangle.Round(this.GetShowRect()),
|
|
|
Color.DeepSkyBlue,
|
|
|
1,
|
|
|
ButtonBorderStyle.Solid,
|
|
|
@@ -658,7 +756,7 @@ namespace OTSIncAReportGraph
|
|
|
/// 从Line中获取矩形的边缘闭合路径
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
- public GraphicsPath GetRegionFromDSegments()
|
|
|
+ private GraphicsPath GetRegionFromDSegments()
|
|
|
{
|
|
|
GraphicsPath gpath = new GraphicsPath();
|
|
|
|
|
|
@@ -668,8 +766,8 @@ namespace OTSIncAReportGraph
|
|
|
//从y循环,这里假设y轴会按lines集合来计算,然后将所有的左x,和右x取出排成两个队列
|
|
|
foreach (DisplaySegment ds in this.m_listdsegment)
|
|
|
{
|
|
|
- list_leftpointf.Add(new PointF(ds.Rect.X, ds.Rect.Y));
|
|
|
- list_rightpointf.Add(new PointF(ds.Rect.X + ds.Rect.Width, ds.Rect.Y));
|
|
|
+ list_leftpointf.Add(new PointF(ds.GetShowRect().X, ds.GetShowRect().Y));
|
|
|
+ list_rightpointf.Add(new PointF(ds.GetShowRect().X + ds.GetShowRect().Width, ds.GetShowRect().Y));
|
|
|
}
|
|
|
|
|
|
PointF[] lsp = new PointF[list_leftpointf.Count + list_rightpointf.Count];
|
|
|
@@ -695,7 +793,7 @@ namespace OTSIncAReportGraph
|
|
|
else
|
|
|
{
|
|
|
//有时居然有颗粒,有没有segment的时候,防止报错
|
|
|
- if (this.DSegments.Count == 0)
|
|
|
+ if (this.GetDSegments().Count == 0)
|
|
|
{
|
|
|
lsp = new PointF[3] { new PointF(0, 0), new PointF(0, 0), new PointF(0, 0) };
|
|
|
gpath.AddPolygon(lsp);
|
|
|
@@ -728,8 +826,9 @@ namespace OTSIncAReportGraph
|
|
|
/// 从已经确定的外边框来计算出里面的+号小框位置
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
- public RectangleF GetSmallRectangleFromRect()
|
|
|
+ private RectangleF GetSmallRectangleFromRect()
|
|
|
{
|
|
|
+
|
|
|
RectangleF rect = new RectangleF();
|
|
|
|
|
|
//用外边框的坐标,除2获得中心点,然后再分别+,- 4
|
|
|
@@ -755,7 +854,7 @@ namespace OTSIncAReportGraph
|
|
|
|
|
|
foreach (DisplaySegment ls_ds in this.m_listdsegment)
|
|
|
{
|
|
|
- f_size_sum = f_size_sum + ls_ds.Rect.Width;
|
|
|
+ f_size_sum = f_size_sum + ls_ds.GetShowRect().Width;
|
|
|
}
|
|
|
return f_size_sum;
|
|
|
}
|
|
|
@@ -764,7 +863,7 @@ namespace OTSIncAReportGraph
|
|
|
/// 从基本线中获取整个矩形的Rectangle
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
- public RectangleF GetRectFromDSegment()
|
|
|
+ private RectangleF GetRectFromDSegment()
|
|
|
{
|
|
|
RectangleF rect = new RectangleF();
|
|
|
|
|
|
@@ -774,31 +873,31 @@ namespace OTSIncAReportGraph
|
|
|
//先从自身中初始化x,y,和宽,高
|
|
|
if (this.m_listdsegment.Count > 0)
|
|
|
{
|
|
|
- x1 = this.m_listdsegment[0].Rect.X;
|
|
|
- y1 = this.m_listdsegment[0].Rect.Y;
|
|
|
- i_width = x1 + this.m_listdsegment[0].Rect.Width;
|
|
|
- i_height = this.m_listdsegment[0].Rect.Y;
|
|
|
+ x1 = this.m_listdsegment[0].GetShowRect().X;
|
|
|
+ y1 = this.m_listdsegment[0].GetShowRect().Y;
|
|
|
+ i_width = x1 + this.m_listdsegment[0].GetShowRect().Width;
|
|
|
+ i_height = this.m_listdsegment[0].GetShowRect().Y;
|
|
|
}
|
|
|
|
|
|
foreach (DisplaySegment ds in this.m_listdsegment)
|
|
|
{
|
|
|
//分别取出,最小的x,y,
|
|
|
- if (ds.Rect.X < x1)
|
|
|
+ if (ds.GetShowRect().X < x1)
|
|
|
{
|
|
|
- x1 = ds.Rect.X;
|
|
|
+ x1 = ds.GetShowRect().X;
|
|
|
}
|
|
|
- if (ds.Rect.Y < y1)
|
|
|
+ if (ds.GetShowRect().Y < y1)
|
|
|
{
|
|
|
- y1 = ds.Rect.Y;
|
|
|
+ y1 = ds.GetShowRect().Y;
|
|
|
}
|
|
|
//最大的x,y
|
|
|
- if (ds.Rect.X + ds.Rect.Width > i_width)
|
|
|
+ if (ds.GetShowRect().X + ds.GetShowRect().Width > i_width)
|
|
|
{
|
|
|
- i_width = ds.Rect.X + ds.Rect.Width;
|
|
|
+ i_width = ds.GetShowRect().X + ds.GetShowRect().Width;
|
|
|
}
|
|
|
- if (ds.Rect.Y > i_height)
|
|
|
+ if (ds.GetShowRect().Y > i_height)
|
|
|
{
|
|
|
- i_height = ds.Rect.Y;
|
|
|
+ i_height = ds.GetShowRect().Y;
|
|
|
}
|
|
|
}
|
|
|
|