|
@@ -6,7 +6,6 @@ using OTSIncAReportGraph.Class;
|
|
|
|
|
|
using OTSIncAReportGraph.OTSIncAReportGraphFuncation;
|
|
|
using OTSIncAReportMailInterface;
|
|
|
-using OTSRptPeriodicTable;
|
|
|
|
|
|
using System;
|
|
|
using System.Collections;
|
|
@@ -47,12 +46,9 @@ namespace OTSIncAReportGraph.Controls
|
|
|
//拖动前的坐标记录
|
|
|
private PointF m_beforedrag_pointf = new PointF();
|
|
|
|
|
|
-
|
|
|
-
|
|
|
//标尺的大小记录
|
|
|
public float m_f_ruler_size = 100;
|
|
|
|
|
|
-
|
|
|
//每像素代表的尺寸大小,还不知道在哪里进行计算
|
|
|
public float m_pixelSize = 4.5f;
|
|
|
|
|
@@ -119,6 +115,18 @@ namespace OTSIncAReportGraph.Controls
|
|
|
Hashtable resourceTable;
|
|
|
ResultFile resultFile = null;
|
|
|
|
|
|
+ #region 缩放
|
|
|
+ //缩放的增大缩小的增量
|
|
|
+ private const float const_zoom_increment = 0.1f;
|
|
|
+ //最大缩放倍数
|
|
|
+ private const float m_f_zoom_max = 5f;
|
|
|
+ //最小缩放倍数
|
|
|
+ private float m_f_zoom_mix = 0.1f;
|
|
|
+ //与原先缩放的记录数
|
|
|
+ private float m_zoom_record = 1;
|
|
|
+ NLog.Logger log = null;
|
|
|
+ #endregion
|
|
|
+
|
|
|
#endregion
|
|
|
|
|
|
#region 构造函数及窗体加载
|
|
@@ -140,7 +148,12 @@ namespace OTSIncAReportGraph.Controls
|
|
|
//初始化数据操作类
|
|
|
m_imgDisHelper =new OTSImageDisHelp(resultFile);
|
|
|
m_list_baseobject = new List<DisplayParticle>();
|
|
|
- var allpart = m_ReportApp.im_Control_DrawDistrbutionImageAndBSE.m_list_allDPart;
|
|
|
+ List<DisplayParticle> allpart = new List<DisplayParticle>();
|
|
|
+ foreach(var apart in m_ReportApp.im_Control_DrawDistrbutionImageAndBSE.m_list_allDPart_original)
|
|
|
+ {
|
|
|
+ allpart.Add(apart.Clone() as DisplayParticle);
|
|
|
+ }
|
|
|
+
|
|
|
for (int i=0;i< allpart.Count;i++)
|
|
|
{
|
|
|
m_list_baseobject.Add(allpart[i]);
|
|
@@ -151,8 +164,9 @@ namespace OTSIncAReportGraph.Controls
|
|
|
resourceTable = stringResource.GetNameTable(this.Name);
|
|
|
#endregion
|
|
|
|
|
|
-
|
|
|
-
|
|
|
+ log = NLog.LogManager.GetCurrentClassLogger();
|
|
|
+
|
|
|
+
|
|
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Control_DrawDistrbutionImageAndBSE));
|
|
|
this.control_XRayTable1 = new Control_XRayTable();
|
|
|
this.control_XRayTable1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(180)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
|
|
@@ -201,8 +215,10 @@ namespace OTSIncAReportGraph.Controls
|
|
|
|
|
|
//设置标尺
|
|
|
//根据f_onepixel_size计算出要显示出100um的实际宽度
|
|
|
- double d_onefixel_width = 100 / m_pixelSize;
|
|
|
- if (d_onefixel_width == 0)
|
|
|
+ ResultFile resfile = m_ReportApp.m_rstDataMgr.ResultFilesList[m_ReportApp.m_rstDataMgr.getSelectedIndex()];
|
|
|
+ double pixel = resfile.GetPixelSize();
|
|
|
+ m_f_ruler_size = (float)(100 / pixel);
|
|
|
+ if (m_f_ruler_size == 0)
|
|
|
{
|
|
|
this.control_Ruler1.Visible = false;
|
|
|
}
|
|
@@ -211,7 +227,8 @@ namespace OTSIncAReportGraph.Controls
|
|
|
//将标尺定位到合理的位置上
|
|
|
this.control_Ruler1.Location = new Point(10, MyPrimaryScreen.WorkingArea.Height - 300);
|
|
|
this.control_Ruler1.Visible = true;
|
|
|
- this.control_Ruler1.SetValue(m_f_ruler_size, m_pixelSize);
|
|
|
+ this.control_Ruler1.SetValue(m_f_ruler_size);
|
|
|
+ this.control_Ruler1.ShowString = Convert.ToInt32(100).ToString() + "μm";
|
|
|
}
|
|
|
|
|
|
|
|
@@ -448,63 +465,74 @@ namespace OTSIncAReportGraph.Controls
|
|
|
#region 鼠标操作相关事件
|
|
|
protected override void OnMouseWheel(MouseEventArgs e)
|
|
|
{
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- foreach (SortParticleDistribution ls_sortparticledistribution in m_list_sortparticledistribution)
|
|
|
- {
|
|
|
- foreach (DisplayParticle item in ls_sortparticledistribution.List_DParticle)
|
|
|
- {
|
|
|
- DisplayParticle dp = item;
|
|
|
-
|
|
|
+ //float zoomDelta;
|
|
|
+ float currentZoom;
|
|
|
+ if (e.Delta > 0)
|
|
|
+ {
|
|
|
|
|
|
+ currentZoom = m_zoom_record + const_zoom_increment;
|
|
|
|
|
|
- foreach (DisplaySegment ds in dp.GetDSegments())
|
|
|
- {
|
|
|
- ds.SetShowRect(new RectangleF(
|
|
|
- ds.GetShowRect().X, //获取到原先点与移动点的增减量,+原先的x坐标,就是新的坐标
|
|
|
- ds.GetShowRect().Y + e.Delta / 2,
|
|
|
- ds.GetShowRect().Width,
|
|
|
- ds.GetShowRect().Height));
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
|
|
|
- //获取矩形的rectangle
|
|
|
- //dp.SetRect(dp.GetRectFromDSegment());
|
|
|
+ currentZoom = m_zoom_record - const_zoom_increment;
|
|
|
|
|
|
-
|
|
|
- if (dp.GetShowRect().Left < -60 || dp.GetShowRect().Right > this.Width +60|| dp.GetShowRect().Top < -60 || dp.GetShowRect().Bottom > this.Height+60)
|
|
|
- {
|
|
|
- dp.SetPaintState(PaintState.NOPAINT);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- dp.SetPaintState(PaintState.PAINT);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
+ if (currentZoom > m_f_zoom_max) currentZoom = m_f_zoom_max;
|
|
|
+ if (currentZoom < m_f_zoom_mix) currentZoom = m_f_zoom_mix;
|
|
|
+ ImageZoom(currentZoom, new PointF(e.X, e.Y));
|
|
|
+ Invalidate();
|
|
|
+ }
|
|
|
|
|
|
- foreach (SortParticleDistribution ls_sortparticledistribution in m_list_sortparticledistribution)
|
|
|
+ private void ImageZoom(float newZoom, PointF refPoint)
|
|
|
+ {
|
|
|
+ float zoomDelta = newZoom - m_zoom_record;
|
|
|
+ RectangleF rectangle = new Rectangle();
|
|
|
+ foreach (SortParticleDistribution ls_sortparticledistribution in m_list_sortparticledistribution)
|
|
|
+ {
|
|
|
+ rectangle = ls_sortparticledistribution.RectF;
|
|
|
+ rectangle.Width += rectangle.Width / m_zoom_record * zoomDelta;
|
|
|
+ rectangle.Height += rectangle.Height / m_zoom_record * zoomDelta;
|
|
|
+ //锚点缩放补差值计算,得出差值
|
|
|
+ float xShiftOld = (rectangle.X - refPoint.X);
|
|
|
+ float yShiftOld = (rectangle.Y - refPoint.Y);
|
|
|
+ float xShift = rectangle.X - refPoint.X + xShiftOld / m_zoom_record * zoomDelta;
|
|
|
+ float yShift = rectangle.Y - refPoint.Y + yShiftOld / m_zoom_record * zoomDelta;
|
|
|
+ //对背景矩形与所有的segment进行修补差值
|
|
|
+ rectangle.X = refPoint.X + xShift;
|
|
|
+ rectangle.Y = refPoint.Y + yShift;
|
|
|
+ ls_sortparticledistribution.RectF = rectangle;
|
|
|
+
|
|
|
+ for (int i = 0; i < ls_sortparticledistribution.List_DParticle.Count(); i++)
|
|
|
{
|
|
|
- ls_sortparticledistribution.RectF = new RectangleF(ls_sortparticledistribution.RectF.Location.X,
|
|
|
- ls_sortparticledistribution.RectF.Location.Y + e.Delta / 2, ls_sortparticledistribution.RectF.Width, ls_sortparticledistribution.RectF.Height);
|
|
|
- }
|
|
|
+ DisplayParticle dp = ls_sortparticledistribution.List_DParticle[i];
|
|
|
|
|
|
+ dp.Zoom(zoomDelta, refPoint);
|
|
|
|
|
|
+ PointF ct = dp.GetCenterPoint();
|
|
|
+ if (ct.X < -100 || ct.X > this.Width + 100 || ct.Y < -100 || ct.Y > this.Height + 100)
|
|
|
+ {
|
|
|
+ dp.SetPaintState(PaintState.NOPAINT);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //ls_sortparticledistribution.SortDParticle();
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- Invalidate();
|
|
|
+ #region 计算标尺尺寸部份-----放大------
|
|
|
+ //计算标尺实际占用像素的宽度
|
|
|
+ m_f_ruler_size = m_f_ruler_size + m_f_ruler_size / m_zoom_record * zoomDelta;//m_f_old_ruler_size
|
|
|
+ control_Ruler1.SetValue(m_f_ruler_size);
|
|
|
+ #endregion
|
|
|
+ m_zoom_record = newZoom;
|
|
|
+ //if (m_zoom_record <= m_f_zoom_mix)
|
|
|
+ //{
|
|
|
+ // MoveImageToPoint(new PointF(0, 0));
|
|
|
+ //}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
-
|
|
|
|
|
|
private void Control_DrawDistrbutionSortImage_KeyDown(object sender, KeyEventArgs e)
|
|
|
{
|
|
@@ -622,7 +650,6 @@ namespace OTSIncAReportGraph.Controls
|
|
|
}
|
|
|
}
|
|
|
m_isDrag = false;
|
|
|
-
|
|
|
//在颗粒上点击,则对该颗粒附加显示x-ray的状态,同时将其它颗粒上显示x-ray的状态全部去掉。
|
|
|
if (false == m_isDrag)
|
|
|
{
|
|
@@ -777,50 +804,54 @@ namespace OTSIncAReportGraph.Controls
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- foreach (SortParticleDistribution ls_sortparticledistribution in m_list_sortparticledistribution)
|
|
|
+ foreach (SortParticleDistribution ls_sortparticledistribution in m_list_sortparticledistribution)
|
|
|
+ {
|
|
|
+ foreach (DisplayParticle dp in ls_sortparticledistribution.List_DParticle)
|
|
|
{
|
|
|
- foreach (DisplayParticle dp in ls_sortparticledistribution.List_DParticle)
|
|
|
- {
|
|
|
-
|
|
|
-
|
|
|
- if (dp.GetPaintState() == PaintState.PAINT)
|
|
|
- {
|
|
|
+
|
|
|
+
|
|
|
+ if (dp.GetPaintState() == PaintState.PAINT)
|
|
|
+ {
|
|
|
if (true == m_imgDisHelper.WhetherInRange(dp, e.Location))
|
|
|
- {
|
|
|
+ {
|
|
|
|
|
|
- dp.IsMouseOver = true;
|
|
|
+ dp.IsMouseOver = true;
|
|
|
|
|
|
|
|
|
- ShowXRay(dp);
|
|
|
+ ShowXRay(dp);
|
|
|
|
|
|
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- dp.IsMouseOver = false;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ dp.IsMouseOver = false;
|
|
|
|
|
|
|
|
|
- HideXRay(dp);
|
|
|
-
|
|
|
- }
|
|
|
+ HideXRay(dp);
|
|
|
|
|
|
- }
|
|
|
-
|
|
|
+ }
|
|
|
|
|
|
- if (true == dp.IsDragging)
|
|
|
- {
|
|
|
- dp.DraggingMove(e.Location);
|
|
|
-
|
|
|
- if (dp.GetShowRect().Left < 0 || dp.GetShowRect().Right > this.Width || dp.GetShowRect().Top < 0 || dp.GetShowRect().Bottom > this.Height)
|
|
|
- {
|
|
|
- dp.SetPaintState(PaintState.NOPAINT);
|
|
|
- }
|
|
|
- }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (true == dp.IsDragging)
|
|
|
+ {
|
|
|
+ dp.DraggingMove(e.Location);
|
|
|
+
|
|
|
+ if (dp.GetShowRect().Left < ClientRectangle.Width * 1f / 50 || dp.GetShowRect().Right > ClientRectangle.Width * 48f / 50f || dp.GetShowRect().Top < 0 || dp.GetShowRect().Bottom > this.Height)
|
|
|
+ {
|
|
|
+ dp.SetPaintState(PaintState.NOPAINT);
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ dp.SetPaintState(PaintState.PAINT);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- //如果在拖动中
|
|
|
- if (true == m_isDrag)
|
|
|
+ //如果在拖动中
|
|
|
+ if (true == m_isDrag)
|
|
|
{
|
|
|
//同样重新计算backrectf的坐标
|
|
|
foreach (SortParticleDistribution ls_sortparticledistribution in m_list_sortparticledistribution)
|
|
@@ -1118,8 +1149,8 @@ namespace OTSIncAReportGraph.Controls
|
|
|
foreach (var keyvaluePair in FLNameList)
|
|
|
{
|
|
|
SortParticleDistribution sortparticledistribution = new SortParticleDistribution();
|
|
|
- sortparticledistribution.RectF = new RectangleF(ClientRectangle.X+ClientRectangle.Width*1f/6, ClientRectangle.Y,
|
|
|
- ClientRectangle.Width*2f/3f, ClientRectangle.Height);
|
|
|
+ sortparticledistribution.RectF = new RectangleF(ClientRectangle.X+ClientRectangle.Width*1f/50, ClientRectangle.Y,
|
|
|
+ ClientRectangle.Width*48f/50f, ClientRectangle.Height);
|
|
|
sortparticledistribution.ShowStr = keyvaluePair.Key;//设置分类grid
|
|
|
sortparticledistribution.List_DParticle = keyvaluePair.Value;
|
|
|
m_list_sortparticledistribution.Add(sortparticledistribution);
|