|
@@ -44,8 +44,9 @@ namespace OTSIncAReportGraph.Controls
|
|
|
Include=0,
|
|
|
|
|
|
MoveSEMToParticle=1,
|
|
|
- CopyImage=2
|
|
|
-
|
|
|
+ CopyImage=2,
|
|
|
+ OriginalSplicing=3
|
|
|
+
|
|
|
}
|
|
|
public partial class Control_DrawDistrbutionImageAndBSE : UserControl
|
|
|
{
|
|
@@ -353,28 +354,21 @@ namespace OTSIncAReportGraph.Controls
|
|
|
log.Info(str27);
|
|
|
Application.DoEvents();
|
|
|
ProgressBarUpdate(1, str27);
|
|
|
-
|
|
|
-
|
|
|
|
|
|
List<Field> fieldlist = resultFile.List_OTSField;
|
|
|
|
|
|
//防止有时底层返回的Field的List是0,直接返回
|
|
|
if (fieldlist.Count == 0)
|
|
|
{
|
|
|
-
|
|
|
-
|
|
|
ProgressBarUpdate(100, "field number =0 !....");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
string str29 = "begin to composit field picture....";
|
|
|
log.Info(str29);
|
|
|
Application.DoEvents();
|
|
|
ProgressBarUpdate(15, str29);
|
|
|
|
|
|
-
|
|
|
-
|
|
|
//第一次循环,用来计算单个Field的像素分辨率,和将所有的物理位置存放到List当中
|
|
|
List<Point> list_point = new List<Point>();
|
|
|
int fieldwidth = 0, fieldheight = 0;
|
|
@@ -394,14 +388,9 @@ namespace OTSIncAReportGraph.Controls
|
|
|
list_point.Add(ls_point);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
//计算出整个绘制图像总Rectagnle的大小
|
|
|
m_backRect = ReportFun. ConvertAndGetMaxRect(list_point, fieldwidth, fieldheight);
|
|
|
|
|
|
-
|
|
|
-
|
|
|
ProgressBarUpdate(18, "calculate ruler....");
|
|
|
|
|
|
#region //标尺相关------------------------------------------------------------------------------
|
|
@@ -410,74 +399,49 @@ namespace OTSIncAReportGraph.Controls
|
|
|
double d_onepixel_scale = Convert.ToDouble(ls_jsblrect.Width) / Convert.ToDouble(fieldwidth);
|
|
|
//再用该比例对标尺进行相应的赋值
|
|
|
m_pixelSize = (float)d_onepixel_scale;
|
|
|
-
|
|
|
-
|
|
|
#endregion //---------------------------------------------------------------------------------------
|
|
|
|
|
|
-
|
|
|
-
|
|
|
ProgressBarUpdate(20, "composit whole picture....");
|
|
|
|
|
|
//70的进度条给到下面的循环中,计算进度条各分类进度分配
|
|
|
float ls_int_progresscalc = 0;
|
|
|
if (fieldlist.Count > 0)
|
|
|
ls_int_progresscalc = (float)70 / (float)fieldlist.Count;
|
|
|
-
|
|
|
string str32 = "finished ";
|
|
|
-
|
|
|
string str33 = "total ";
|
|
|
-
|
|
|
string str34 = "field...";
|
|
|
|
|
|
-
|
|
|
var otsLeftBottomPoint = ReportFun.GetOTSCoordLeftBottomPoint(list_point);
|
|
|
|
|
|
for (int i = 0; i < fieldlist.Count(); i++)
|
|
|
{
|
|
|
-
|
|
|
ProgressBarUpdate(20 + (int)(ls_int_progresscalc * (i + 1)), str32 + i.ToString() + str33 + resultFile.List_OTSField.Count.ToString() + str34);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
//取出该Field的物理坐标,将其转换成对应的屏幕像素坐标,屏幕左上角为原点(0,0)的偏移值,用于后面计算各Segment的位置使用
|
|
|
-
|
|
|
Point thisfield_point = new Point() { X = fieldlist[i].FieldPosX, Y = fieldlist[i].FieldPosY };
|
|
|
-
|
|
|
-
|
|
|
Point offset_point = ReportFun.ConvertOTSCoordinateToScreenCoord(otsLeftBottomPoint, m_pixelSize, thisfield_point, m_backRect, new RectangleF(0,0,fieldwidth,fieldheight));//the ots coordinate is always the up right positive.
|
|
|
-
|
|
|
DisplayField df = new DisplayField(fieldlist[i],fieldwidth,fieldheight, offset_point);
|
|
|
-
|
|
|
m_list_allDfield.Add(df);
|
|
|
m_list_allDPart.AddRange(df.List_DParticle);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
|
|
|
ProgressBarUpdate(90, "convert solution...");
|
|
|
-
|
|
|
//然后这里还需要计算出,各field的宽和高,帧图边框分别需要显示多少个框
|
|
|
if (fieldwidth != 0 && fieldheight != 0)
|
|
|
{
|
|
|
m_i_grid_showlinesnumber_width = Convert.ToInt32(BackRectF.Width / fieldwidth);
|
|
|
m_i_grid_showlinesnumber_height = Convert.ToInt32(BackRectF.Height / fieldheight);
|
|
|
}
|
|
|
-
|
|
|
|
|
|
ProgressBarUpdate(95, "other work...");
|
|
|
-
|
|
|
|
|
|
//相关计数
|
|
|
ReportFun.m_field_count = fieldlist.Count;
|
|
|
ReportFun.m_particle_count = m_list_allDPart.Count;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 分布图和BSE图中,从底层获取相关结果后,重新组织显示
|
|
|
/// </summary>
|
|
@@ -1216,6 +1180,7 @@ namespace OTSIncAReportGraph.Controls
|
|
|
CMenuStrip.Items[(int)RightButtonMenu.Include].Visible = false;
|
|
|
|
|
|
CMenuStrip.Items[(int)RightButtonMenu.CopyImage].Visible = false;
|
|
|
+ CMenuStrip.Items[(int)RightButtonMenu.OriginalSplicing].Visible = false;
|
|
|
CMenuStrip.Items[(int)RightButtonMenu.MoveSEMToParticle].Visible = true;
|
|
|
CMenuStrip.Items[(int)RightButtonMenu.MoveSEMToParticle].Tag = item;
|
|
|
}
|
|
@@ -1241,7 +1206,7 @@ namespace OTSIncAReportGraph.Controls
|
|
|
|
|
|
}
|
|
|
CMenuStrip.Items[(int)RightButtonMenu.CopyImage].Visible = true;
|
|
|
-
|
|
|
+ CMenuStrip.Items[(int)RightButtonMenu.OriginalSplicing].Visible = true;
|
|
|
CMenuStrip.Items[(int)RightButtonMenu.MoveSEMToParticle].Visible = false;
|
|
|
|
|
|
|
|
@@ -1480,6 +1445,7 @@ namespace OTSIncAReportGraph.Controls
|
|
|
//复制图像
|
|
|
private void toolStripMenuItem_copyimage_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
+
|
|
|
//outpic();
|
|
|
if (outpic())
|
|
|
{
|
|
@@ -1489,7 +1455,7 @@ namespace OTSIncAReportGraph.Controls
|
|
|
{
|
|
|
MessageBox.Show("Picture export failed");
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//CopyImage();
|
|
|
}
|
|
|
|
|
@@ -1949,8 +1915,10 @@ namespace OTSIncAReportGraph.Controls
|
|
|
|
|
|
private bool outpic()
|
|
|
{
|
|
|
+
|
|
|
SaveFileDialog sfd = new SaveFileDialog();
|
|
|
- sfd.Filter = "BMP Files(*.bmp)|*.bmp|JPG Files(*.jpg)|*.jpg;*.jpeg|ALL Files(*.*)|*.*";
|
|
|
+ //|ALL Files(*.*)|*.*
|
|
|
+ sfd.Filter = "BMP Files(*.bmp)|*.bmp|JPG Files(*.jpg)|*.jpg;*.jpeg";
|
|
|
if (sfd.ShowDialog() == DialogResult.OK)
|
|
|
{
|
|
|
try
|
|
@@ -1978,7 +1946,6 @@ namespace OTSIncAReportGraph.Controls
|
|
|
|
|
|
pic_bitmap.Save(sfd.FileName);
|
|
|
pic_bitmap.Dispose();
|
|
|
- pic_bitmap.Dispose();
|
|
|
return true;
|
|
|
}
|
|
|
catch
|
|
@@ -1990,6 +1957,88 @@ namespace OTSIncAReportGraph.Controls
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
+ private bool outpic_Render()
|
|
|
+ {
|
|
|
+ SaveFileDialog sfd = new SaveFileDialog();
|
|
|
+ sfd.Filter = "BMP Files(*.bmp)|*.bmp|JPG Files(*.jpg)|*.jpg;*.jpeg";
|
|
|
+ List<Field> fieldlist = resultFile.List_OTSField;
|
|
|
+
|
|
|
+ if (sfd.ShowDialog() == DialogResult.OK)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ double x_max ;
|
|
|
+ double y_max ;
|
|
|
+ DataTable picDatat = new DataTable();
|
|
|
+ picDatat.Columns.Add("X", typeof(double));
|
|
|
+ picDatat.Columns.Add("Y", typeof(double));
|
|
|
+ picDatat.Columns.Add("pic_ID");
|
|
|
+ foreach (var f in m_list_allDfield)
|
|
|
+ {
|
|
|
+ DataRow dr = picDatat.NewRow();
|
|
|
+ dr["X"] = f.Rect.X;
|
|
|
+ dr["Y"] = f.Rect.Y;
|
|
|
+ dr["pic_ID"] = f.FieldID;
|
|
|
+ picDatat.Rows.Add(dr);
|
|
|
+ }
|
|
|
+ x_max = Convert.ToDouble(picDatat.Compute("Max(X)", "true"));
|
|
|
+ y_max = Convert.ToDouble(picDatat.Compute("Max(Y)", "true"));
|
|
|
+ Bitmap pic_bitmap = new Bitmap((int)x_max, (int)y_max);
|
|
|
+ Graphics graph = Graphics.FromImage(pic_bitmap);
|
|
|
+ foreach (var f in m_list_allDfield)
|
|
|
+ {
|
|
|
+ Bitmap image = new Bitmap(f.OriginalImage.Width,f.OriginalImage.Height);
|
|
|
+ Graphics g2= Graphics.FromImage(image);
|
|
|
+ g2.DrawImage(f.OriginalImage,0,0, f.OriginalImage.Width, f.OriginalImage.Height);
|
|
|
+ Graphics graph_2 = Graphics.FromImage(image);
|
|
|
+
|
|
|
+ for (int i = 0; i < fieldlist.Count; i++)
|
|
|
+ {
|
|
|
+ if (fieldlist[i].FieldID.ToString() == f.FieldID.ToString())
|
|
|
+ {
|
|
|
+ //先获取该Field中的所有Particle
|
|
|
+ List<Particle> list_particle;
|
|
|
+ list_particle = fieldlist[i].ParticleList;
|
|
|
+ //再循环计算所有的Particle对象
|
|
|
+ foreach (Particle particle in list_particle)
|
|
|
+ {
|
|
|
+ //创建DParticle颗粒
|
|
|
+ DisplayParticle dp = new DisplayParticle(particle);
|
|
|
+ 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对象中
|
|
|
+
|
|
|
+ Point on_p = new Point() { X = seg.Start, Y = seg.Height };
|
|
|
+ Point off_p = new Point() { X = seg.Start + seg.Length, Y = seg.Height };
|
|
|
+ Pen npen = new Pen(dp.Color);
|
|
|
+ graph_2.DrawLine(npen, on_p, off_p);
|
|
|
+
|
|
|
+ #endregion
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ graph.DrawImage(image, f.Rect.X, f.Rect.Y, f.Rect.Width, f.Rect.Height);
|
|
|
+ }
|
|
|
+
|
|
|
+ pic_bitmap.Save(sfd.FileName);
|
|
|
+ pic_bitmap.Dispose();
|
|
|
+ pic_bitmap.Dispose();
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ catch
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
private static byte[] ImgtoByte(Image img)
|
|
|
{
|
|
|
MemoryStream ms = new MemoryStream();
|
|
@@ -2046,9 +2095,20 @@ namespace OTSIncAReportGraph.Controls
|
|
|
);
|
|
|
#endif
|
|
|
}
|
|
|
- #endregion
|
|
|
|
|
|
|
|
|
+ #endregion
|
|
|
|
|
|
+ private void ExportoriginalspliceToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
+ {
|
|
|
+ if (outpic_Render())
|
|
|
+ {
|
|
|
+ MessageBox.Show("Picture export complete");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ MessageBox.Show("Picture export failed");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|