Browse Source

Merge branch 'OTSRelease3_0' of http://36.129.163.148:30080/gogsadmin/OTS into OTSRelease3_0

cxs 1 năm trước cách đây
mục cha
commit
7d4a6b4f5b

+ 18 - 7
OTSIncAReportApp/1-UI/Control_Graph/Controls/Control_DrawDistrbutionImageAndBSE.cs

@@ -60,6 +60,7 @@ namespace OTSIncAReportGraph.Controls
         Render_pic = 1,
         noBackground_pic = 2,
         GBOne = 3,
+        ColoredParticles=4,
         Combin,
         Render_Combin
     }
@@ -1384,12 +1385,26 @@ namespace OTSIncAReportGraph.Controls
             }
         }
 
-        //复制图像
+        
         private void toolStripMenuItem_copyimage_Click(object sender, EventArgs e)
         {
 
+            //SaveFileDialog sfd = new SaveFileDialog();
+            //sfd.Filter = "png Files(*.png)| *.png |BMP Files(*.bmp)| *.bmp |JPG Files(*.jpg)|*.jpg;*.jpeg";
+            //if (sfd.ShowDialog() == DialogResult.OK)
+            //{
+            //    this.Cursor = System.Windows.Forms.Cursors.WaitCursor;
+            //    OutPIC outpic = new OutPIC();
+            //    outpic.m_list_allDfield = m_list_allDfield;
+            //    outpic.resultFile = resultFile;
+            //    outpic.sfd = sfd;
+            //    outpic.type = (int)Outpic_enum.pic;
+            //    outpic.m_ReportApp = m_ReportApp;
+            //    Thread bThread = new Thread(new ThreadStart(outpic.opencv_outpic));
+            //    bThread.IsBackground = true;
+            //    bThread.Start();
+            //}
             SaveFileDialog sfd = new SaveFileDialog();
-
             sfd.Filter = "png Files(*.png)| *.png |BMP Files(*.bmp)| *.bmp |JPG Files(*.jpg)|*.jpg;*.jpeg";
             if (sfd.ShowDialog() == DialogResult.OK)
             {
@@ -1398,18 +1413,14 @@ namespace OTSIncAReportGraph.Controls
                 outpic.m_list_allDfield = m_list_allDfield;
                 outpic.resultFile = resultFile;
                 outpic.sfd = sfd;
-                outpic.type = (int)Outpic_enum.pic;
+                outpic.type = (int)Outpic_enum.ColoredParticles;
                 outpic.m_ReportApp = m_ReportApp;
                 Thread bThread = new Thread(new ThreadStart(outpic.opencv_outpic));
-
                 bThread.IsBackground = true;
-
                 bThread.Start();
-
             }
 
 
-
         }
 
         public void msgInform()

+ 41 - 51
OTSIncAReportApp/1-UI/Control_Graph/Controls/Control_DrawDistrbutionImageAndBSE.designer.cs

@@ -32,7 +32,6 @@
             this.CMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
             this.ToolStripMenuItem_ParticleSplicing = new System.Windows.Forms.ToolStripMenuItem();
             this.toolStripMenuItem_copyimage = new System.Windows.Forms.ToolStripMenuItem();
-            this.ExportoriginalspliceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.显示国标信息ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
             this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
@@ -51,14 +50,14 @@
             this.清除ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.toolStripMenuItem_combin = new System.Windows.Forms.ToolStripMenuItem();
             this.toolStripMenuItem_combinClass = new System.Windows.Forms.ToolStripMenuItem();
-            this.contextMenuStrip_Particle = new System.Windows.Forms.ContextMenuStrip(this.components);
-            this.ToolStripMenuItem_movesempoint = new System.Windows.Forms.ToolStripMenuItem();
-            this.toolStripMenuItem_DeleteParticles = new System.Windows.Forms.ToolStripMenuItem();
-            this.toolStripMenuItem_Segmentation = new System.Windows.Forms.ToolStripMenuItem();
             this.国标图导出ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.方法一ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.方法二ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.aSTMToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
+            this.contextMenuStrip_Particle = new System.Windows.Forms.ContextMenuStrip(this.components);
+            this.ToolStripMenuItem_movesempoint = new System.Windows.Forms.ToolStripMenuItem();
+            this.toolStripMenuItem_DeleteParticles = new System.Windows.Forms.ToolStripMenuItem();
+            this.toolStripMenuItem_Segmentation = new System.Windows.Forms.ToolStripMenuItem();
             this.CMenuStrip.SuspendLayout();
             this.contextMenuStrip_Particle.SuspendLayout();
             this.SuspendLayout();
@@ -69,13 +68,12 @@
             this.CMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
             this.ToolStripMenuItem_ParticleSplicing,
             this.toolStripMenuItem_copyimage,
-            this.ExportoriginalspliceToolStripMenuItem,
             this.显示国标信息ToolStripMenuItem,
             this.toolStripMenuItem_combin,
             this.toolStripMenuItem_combinClass,
             this.国标图导出ToolStripMenuItem});
             this.CMenuStrip.Name = "contextMenuStrip1";
-            this.CMenuStrip.Size = new System.Drawing.Size(185, 180);
+            this.CMenuStrip.Size = new System.Drawing.Size(185, 158);
             // 
             // ToolStripMenuItem_ParticleSplicing
             // 
@@ -88,16 +86,9 @@
             // 
             this.toolStripMenuItem_copyimage.Name = "toolStripMenuItem_copyimage";
             this.toolStripMenuItem_copyimage.Size = new System.Drawing.Size(184, 22);
-            this.toolStripMenuItem_copyimage.Text = "导出原图拼接图";
+            this.toolStripMenuItem_copyimage.Text = "导出渲染拼接图";
             this.toolStripMenuItem_copyimage.Click += new System.EventHandler(this.toolStripMenuItem_copyimage_Click);
             // 
-            // ExportoriginalspliceToolStripMenuItem
-            // 
-            this.ExportoriginalspliceToolStripMenuItem.Name = "ExportoriginalspliceToolStripMenuItem";
-            this.ExportoriginalspliceToolStripMenuItem.Size = new System.Drawing.Size(184, 22);
-            this.ExportoriginalspliceToolStripMenuItem.Text = "导出原图拼接分类图";
-            this.ExportoriginalspliceToolStripMenuItem.Click += new System.EventHandler(this.ExportoriginalspliceToolStripMenuItem_Click);
-            // 
             // 显示国标信息ToolStripMenuItem
             // 
             this.显示国标信息ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@@ -116,7 +107,7 @@
             this.查询DS类颗粒ToolStripMenuItem,
             this.显示当前帧国标分类ToolStripMenuItem});
             this.toolStripMenuItem2.Name = "toolStripMenuItem2";
-            this.toolStripMenuItem2.Size = new System.Drawing.Size(112, 22);
+            this.toolStripMenuItem2.Size = new System.Drawing.Size(180, 22);
             this.toolStripMenuItem2.Text = "方法一";
             // 
             // toolStripMenuItem1
@@ -189,7 +180,7 @@
             this.toolStripMenuItem4,
             this.toolStripMenuItem10});
             this.toolStripMenuItem3.Name = "toolStripMenuItem3";
-            this.toolStripMenuItem3.Size = new System.Drawing.Size(112, 22);
+            this.toolStripMenuItem3.Size = new System.Drawing.Size(180, 22);
             this.toolStripMenuItem3.Text = "方法二";
             // 
             // toolStripMenuItem4
@@ -213,7 +204,7 @@
             this.aSTMToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
             this.显示所有帧ToolStripMenuItem});
             this.aSTMToolStripMenuItem.Name = "aSTMToolStripMenuItem";
-            this.aSTMToolStripMenuItem.Size = new System.Drawing.Size(112, 22);
+            this.aSTMToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
             this.aSTMToolStripMenuItem.Tag = "";
             this.aSTMToolStripMenuItem.Text = "ASTM";
             // 
@@ -228,7 +219,7 @@
             // 清除ToolStripMenuItem
             // 
             this.清除ToolStripMenuItem.Name = "清除ToolStripMenuItem";
-            this.清除ToolStripMenuItem.Size = new System.Drawing.Size(112, 22);
+            this.清除ToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
             this.清除ToolStripMenuItem.Text = "清除";
             this.清除ToolStripMenuItem.Click += new System.EventHandler(this.清除ToolStripMenuItem_Click);
             // 
@@ -248,6 +239,37 @@
             this.toolStripMenuItem_combinClass.Visible = false;
             this.toolStripMenuItem_combinClass.Click += new System.EventHandler(this.toolStripMenuItem_combinClass_Click);
             // 
+            // 国标图导出ToolStripMenuItem
+            // 
+            this.国标图导出ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+            this.方法一ToolStripMenuItem,
+            this.方法二ToolStripMenuItem,
+            this.aSTMToolStripMenuItem1});
+            this.国标图导出ToolStripMenuItem.Name = "国标图导出ToolStripMenuItem";
+            this.国标图导出ToolStripMenuItem.Size = new System.Drawing.Size(184, 22);
+            this.国标图导出ToolStripMenuItem.Text = "国标图导出";
+            // 
+            // 方法一ToolStripMenuItem
+            // 
+            this.方法一ToolStripMenuItem.Name = "方法一ToolStripMenuItem";
+            this.方法一ToolStripMenuItem.Size = new System.Drawing.Size(112, 22);
+            this.方法一ToolStripMenuItem.Text = "方法一";
+            this.方法一ToolStripMenuItem.Click += new System.EventHandler(this.方法一ToolStripMenuItem_Click);
+            // 
+            // 方法二ToolStripMenuItem
+            // 
+            this.方法二ToolStripMenuItem.Name = "方法二ToolStripMenuItem";
+            this.方法二ToolStripMenuItem.Size = new System.Drawing.Size(112, 22);
+            this.方法二ToolStripMenuItem.Text = "方法二";
+            this.方法二ToolStripMenuItem.Click += new System.EventHandler(this.方法二ToolStripMenuItem_Click);
+            // 
+            // aSTMToolStripMenuItem1
+            // 
+            this.aSTMToolStripMenuItem1.Name = "aSTMToolStripMenuItem1";
+            this.aSTMToolStripMenuItem1.Size = new System.Drawing.Size(112, 22);
+            this.aSTMToolStripMenuItem1.Text = "ASTM";
+            this.aSTMToolStripMenuItem1.Click += new System.EventHandler(this.aSTMToolStripMenuItem1_Click);
+            // 
             // contextMenuStrip_Particle
             // 
             this.contextMenuStrip_Particle.ImageScalingSize = new System.Drawing.Size(24, 24);
@@ -279,37 +301,6 @@
             this.toolStripMenuItem_Segmentation.Text = "分割颗粒";
             this.toolStripMenuItem_Segmentation.Click += new System.EventHandler(this.toolStripMenuItem_Segmentation_Click);
             // 
-            // 国标图导出ToolStripMenuItem
-            // 
-            this.国标图导出ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
-            this.方法一ToolStripMenuItem,
-            this.方法二ToolStripMenuItem,
-            this.aSTMToolStripMenuItem1});
-            this.国标图导出ToolStripMenuItem.Name = "国标图导出ToolStripMenuItem";
-            this.国标图导出ToolStripMenuItem.Size = new System.Drawing.Size(184, 22);
-            this.国标图导出ToolStripMenuItem.Text = "国标图导出";
-            // 
-            // 方法一ToolStripMenuItem
-            // 
-            this.方法一ToolStripMenuItem.Name = "方法一ToolStripMenuItem";
-            this.方法一ToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
-            this.方法一ToolStripMenuItem.Text = "方法一";
-            this.方法一ToolStripMenuItem.Click += new System.EventHandler(this.方法一ToolStripMenuItem_Click);
-            // 
-            // 方法二ToolStripMenuItem
-            // 
-            this.方法二ToolStripMenuItem.Name = "方法二ToolStripMenuItem";
-            this.方法二ToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
-            this.方法二ToolStripMenuItem.Text = "方法二";
-            this.方法二ToolStripMenuItem.Click += new System.EventHandler(this.方法二ToolStripMenuItem_Click);
-            // 
-            // aSTMToolStripMenuItem1
-            // 
-            this.aSTMToolStripMenuItem1.Name = "aSTMToolStripMenuItem1";
-            this.aSTMToolStripMenuItem1.Size = new System.Drawing.Size(180, 22);
-            this.aSTMToolStripMenuItem1.Text = "ASTM";
-            this.aSTMToolStripMenuItem1.Click += new System.EventHandler(this.aSTMToolStripMenuItem1_Click);
-            // 
             // Control_DrawDistrbutionImageAndBSE
             // 
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@@ -328,7 +319,6 @@
         private Control_XRayTable control_XRayTable1;
         private Control_Ruler control_Ruler1;
         private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem_copyimage;
-        private System.Windows.Forms.ToolStripMenuItem ExportoriginalspliceToolStripMenuItem;
         private System.Windows.Forms.ToolStripMenuItem 显示国标信息ToolStripMenuItem;
         private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem2;
         private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1;

+ 145 - 66
OTSIncAReportApp/1-UI/Control_Graph/Controls/OutPIC.cs

@@ -33,6 +33,11 @@ namespace OTSIncAReportApp._3_ServiceCenter
         /// </summary>
         public int GridLength { get; set; }
         public int type = 0;
+
+        private double picYmin = 0;
+        private double picGBYmin = 0;
+        private int imgeH = 0;
+        private int imgeW = 0;
         /// <summary>
         /// 获取每行图片的位置配合opencv方法使用
         /// </summary>
@@ -49,12 +54,8 @@ namespace OTSIncAReportApp._3_ServiceCenter
 
                 dr["X"] = f.OTSCoordinatePos.X;
                 dr["Y"] = f.OTSCoordinatePos.Y;
-                //dr["X"] = f.GetShowRect().X;
-                //dr["Y"] = f.GetShowRect().Y;
                 picDatat.Rows.Add(dr);
             }
-            //int y_max = Convert.ToInt32(picDatat.Compute("Max(Y)", "true"));
-            //int y_min = Convert.ToInt32(picDatat.Compute("Min(Y)", "true"));
             DataTable total_dt_X = picDatat.Copy();
             DataView dv_x = total_dt_X.DefaultView;
             DataView dv_x_2 = dv_x.ToTable(true, "X").DefaultView;
@@ -81,13 +82,11 @@ namespace OTSIncAReportApp._3_ServiceCenter
                     DataRow dr2 = data.NewRow();
                     Bitmap bitmap = new Bitmap((int)m_list_allDfield[0].OriginalImage.Width, (int)m_list_allDfield[0].OriginalImage.Height);
 
-                    //Bitmap bitmap = new Bitmap((int)m_list_allDfield[0].GetShowRect().Width, (int)m_list_allDfield[0].GetShowRect().Height);
                     Graphics g = Graphics.FromImage(bitmap);
                     g.Clear(Color.White);
                     g.Dispose();
                     dr2["mat"] = bitmap;
                     dr2["X"] = total_dt_X.Rows[a]["X"];
-                    //dr2["Y"] = total_dt_X.Rows[a]["Y"];
                     data.Rows.Add(dr2);
                 }
                 foreach (var f in m_list_allDfield)
@@ -118,6 +117,123 @@ namespace OTSIncAReportApp._3_ServiceCenter
 
             return list_dt_picdata;
         }
+
+        private List<DataTable> color_piclist()
+        {
+            List<DataTable> list_dt_picdata = new List<DataTable>();
+            DataTable picDatat = new DataTable();
+            List<Field> fieldlist = resultFile.List_OTSField;
+            picDatat.Columns.Add("X", typeof(double));
+            picDatat.Columns.Add("Y", typeof(double));
+            foreach (var f in m_list_allDfield)
+            {
+                DataRow dr = picDatat.NewRow();
+                dr["X"] = f.OTSCoordinatePos.X;
+                dr["Y"] = f.OTSCoordinatePos.Y;
+                picDatat.Rows.Add(dr);
+            }
+            DataTable total_dt_X = picDatat.Copy();
+            DataView dv_x = total_dt_X.DefaultView;
+            DataView dv_x_2 = dv_x.ToTable(true, "X").DefaultView;
+            dv_x_2.Sort = "X ASC";
+            total_dt_X = dv_x_2.ToTable();
+
+
+            DataTable total_dt_Y = picDatat.Copy();
+            DataView dv_Y = total_dt_Y.DefaultView;
+            DataView dv_Y_2 = dv_Y.ToTable(true, "Y").DefaultView;
+            dv_Y_2.Sort = "Y ASC";
+            total_dt_Y = dv_Y_2.ToTable();
+            picYmin = Convert.ToDouble(total_dt_Y.Rows[0]["Y"]);
+
+            for (int i = 0; i < total_dt_Y.Rows.Count; i++)
+            {
+                NLog.LogManager.GetCurrentClassLogger().Info("Splice line" + i + 1.ToString() + "of" + total_dt_Y.Rows.Count.ToString() + ".....");
+                DataTable data = new DataTable();
+                data.Columns.Add("mat", typeof(Bitmap));
+                data.Columns.Add("X", typeof(double));
+                data.Columns.Add("Y", typeof(double));
+                imgeH = (int)m_list_allDfield[0].OriginalImage.Height;
+                imgeW = (int)m_list_allDfield[0].OriginalImage.Width;
+                Bitmap bitmap = new Bitmap((int)m_list_allDfield[0].OriginalImage.Width, (int)m_list_allDfield[0].OriginalImage.Height);
+                for (int a = 0; a < total_dt_X.Rows.Count; a++)
+                {
+                    DataRow dr2 = data.NewRow();
+                    Graphics g = Graphics.FromImage(bitmap);
+
+                    g.Clear(Color.White);
+                    g.Dispose();
+                    dr2["mat"] = bitmap;
+                    dr2["X"] = total_dt_X.Rows[a]["X"];
+                    data.Rows.Add(dr2);
+                }
+
+
+                foreach (var f in m_list_allDfield)
+                {
+                    if (total_dt_Y.Rows[i]["Y"].ToString() == f.OTSCoordinatePos.Y.ToString())
+                    {
+                        for (int c = 0; c < data.Rows.Count; c++)
+                        {
+                            if (data.Rows[c]["X"].ToString() == f.OTSCoordinatePos.X.ToString())
+                            {
+
+                                Bitmap image = new Bitmap(bitmap.Width, bitmap.Height);
+                                Graphics graph_2 = Graphics.FromImage(image);
+
+                                for (int a = 0; a < fieldlist.Count; a++)
+                                {
+                                    if (fieldlist[a].FieldID.ToString() == f.FieldID.ToString())
+                                    {
+                                        //先获取该Field中的所有Particle
+                                        List<Particle> list_particle;
+                                        list_particle = fieldlist[a].ParticleList;
+                                        //再循环计算所有的Particle对象
+                                        foreach (Particle particle in list_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对象中
+
+                                                System.Drawing.Point on_p = new System.Drawing.Point() { X = seg.Start, Y = seg.Height };
+                                                System.Drawing.Point off_p = new System.Drawing.Point() { X = seg.Start + seg.Length, Y = seg.Height };
+                                                var color = DrawFunction.GetColorBySTDTypeIDForBSEAndSorImage(particle.TypeColor, particle.TypeId);
+                                                Pen npen = new Pen(color);
+                                                graph_2.DrawLine(npen, on_p, off_p);
+
+                                                #endregion
+                                            }
+                                        }
+                                    }
+                                    
+                                }
+                                data.Rows[c]["mat"] = image;
+                                data.Rows[c]["X"] = f.OTSCoordinatePos.X;
+                                data.Rows[c]["Y"] = f.OTSCoordinatePos.Y;
+                            }
+                        }
+
+                    }
+                }
+
+
+                DataView dataView1 = data.DefaultView;
+                dataView1.Sort = "X ASC";
+                data = dataView1.ToTable();
+
+
+                list_dt_picdata.Add(data);
+            }
+
+            return list_dt_picdata;
+        }
+
+
         public void opencv_outpic()
         {
 
@@ -134,9 +250,14 @@ namespace OTSIncAReportApp._3_ServiceCenter
                 list_dt_picdata = opencv_piclist_Render();
                 list_mats = new OpenCvSharp.Mat[list_dt_picdata.Count + 1];
             }
-            if (type == (int)Outpic_enum.GBOne)
+            else if (type == (int)Outpic_enum.GBOne)
             {
-                list_dt_picdata = opencv_piclist();
+                list_dt_picdata = color_piclist();
+                list_mats = new OpenCvSharp.Mat[list_dt_picdata.Count];
+            }
+            else if (type == (int)Outpic_enum.ColoredParticles)
+            {
+                list_dt_picdata = color_piclist();
                 list_mats = new OpenCvSharp.Mat[list_dt_picdata.Count];
             }
             else
@@ -145,7 +266,7 @@ namespace OTSIncAReportApp._3_ServiceCenter
                 list_mats = new OpenCvSharp.Mat[list_dt_picdata.Count];
             }
 
-          
+
             NLog.LogManager.GetCurrentClassLogger().Info("Organize and splice all pictures......");
 
             List<OpenCvSharp.Mat> list_pano = new List<OpenCvSharp.Mat>();
@@ -160,7 +281,6 @@ namespace OTSIncAReportApp._3_ServiceCenter
                     mats[a] = OpenCvSharp.Extensions.BitmapConverter.ToMat((Bitmap)list_dt_picdata[i].Rows[a]["mat"]);
                 }
                 OpenCvSharp.Mat pano = new OpenCvSharp.Mat();
-
                 
                 OpenCvSharp.Cv2.HConcat(mats, pano);
                 list_pano.Add(pano);
@@ -170,7 +290,7 @@ namespace OTSIncAReportApp._3_ServiceCenter
            
 
             //导出原图(渲染图)在下方增加每种颜色的标注和面积占比
-            if (type == (int)Outpic_enum.Render_pic)
+            if (type == (int)Outpic_enum.Render_pic && type == (int)Outpic_enum.GBOne)
             {
                 DataTable particleData = ParticleDataIntegration(ParticleData, ParticleClassData);
                 int NumberOfRows = getPICstringLong(particleData, list_pano);
@@ -182,10 +302,6 @@ namespace OTSIncAReportApp._3_ServiceCenter
                 g.Clear(Color.White);
                 int rowData = 10;
 
-                
-
-                
-
                 //矩形格子宽500
 
                 SolidBrush mysbrush1 = new SolidBrush(ColorTranslator.FromHtml("#000000"));
@@ -195,7 +311,6 @@ namespace OTSIncAReportApp._3_ServiceCenter
                 int Color_Y = 10; int TypeName_Y = 40; int Prozentsatz_Y = 100;int Area_Y = 70;
                 int Gitter_X = 10;
                 picKopfzeile(mypen, myFont, sbrush, g, 10, rowData);
-              
 
                 Gitter_X = Gitter_X + 350;
                 for (int i = 0; i < particleData.Rows.Count; i++)
@@ -224,17 +339,11 @@ namespace OTSIncAReportApp._3_ServiceCenter
                     Gitter_X = Gitter_X + 350;
                 }
 
-
                 g.Dispose();
-               
-
-
                 OpenCvSharp.Mat pano = OpenCvSharp.Extensions.BitmapConverter.ToMat(bitmap);
                 list_pano.Add(pano);
             }
 
-
-
             for (int i = 0; i < list_pano.Count; i++)
             {
                 list_mats[i] = list_pano[i];
@@ -256,19 +365,19 @@ namespace OTSIncAReportApp._3_ServiceCenter
                     distinctValuesY.Add(Convert.ToInt32(GBDatatableOne.Rows[i]["fieldY"]));
                     distinctValuesX.Add(Convert.ToInt32(GBDatatableOne.Rows[i]["fieldX"]));
                 }
-                int picdataYmin = Convert.ToInt32(list_dt_picdata[0].Rows[0]["Y"]);
-                int picdataXmin = Convert.ToInt32(list_dt_picdata[0].Rows[0]["X"]);
+                //int picdataYmin = Convert.ToInt32(list_dt_picdata[0].Rows[0]["Y"]);
+                //int picdataXmin = Convert.ToInt32(list_dt_picdata[0].Rows[0]["X"]);
                 var distinctY = distinctValuesY.ToList();
                 distinctY.Sort((a, b) => b.CompareTo(a));
                 var distinctX = distinctValuesX.ToList();
                 distinctX.Sort();
 
-                //int Yzhou = (distinctY[0] - picdataYmin);
-                int Yzhou = 0;
+                //int Yzhou = 0;
+                int Yzhou = (int)picYmin- distinctY.Min();
+                Yzhou = Yzhou + (GridLength / 2)+(imgeH/2);
                 for (int i = 0; i < distinctY.Count; i++)
                 {
-                    //int Xzhou = (distinctX[0] - picdataXmin);
-                    int Xzhou = 0;
+                    int Xzhou = +(GridLength / 2) + (imgeW / 2);
                     DataTable number = CountTheNumberOfX_axes(GBDatatableOne, "fieldY", distinctY[i].ToString());
                     for (int j = 0; j < number.Rows.Count; j++)
                     {
@@ -283,7 +392,7 @@ namespace OTSIncAReportApp._3_ServiceCenter
 
                         // 定义矩形的颜色(BGR)和线宽  
                         OpenCvSharp.Scalar color = new OpenCvSharp.Scalar(0, 0, 255, 255); // 蓝色  
-                        int thickness = 10;
+                        int thickness = 2;
                         // 在图像上绘制矩形  
                         OpenCvSharp.Cv2.Rectangle(save_pano, topLeft, bottomRight, color, thickness);
 
@@ -292,20 +401,16 @@ namespace OTSIncAReportApp._3_ServiceCenter
 
 
                         string input = number.Rows[j]["data"].ToString();
-                        int chunkSize = 40; // 分割长度  
-
+                        double fontScale = 1; // 字体大小缩放因子  
+                        int thickness2 = 1; // 字体粗细 
+                        // 获取文字的大小,以便我们可以更好地定位它  
+                        OpenCvSharp.Size textSize = OpenCvSharp.Cv2.GetTextSize(input, HersheyFonts.HersheySimplex, fontScale, thickness2, out int baseline);
+                        int chunkSize = GridLength / textSize.Height; // 分割长度  
                         // 使用LINQ的Enumerable.Chunk扩展方法分割字符串  
                         var chunks = Enumerable.Range(0, input.Length / chunkSize + (input.Length % chunkSize > 0 ? 1 : 0))
                             .Select(x => input.Substring(x * chunkSize, Math.Min(chunkSize, input.Length - x * chunkSize)))
                             .ToList();
-
-                        // 输出分割后的子字符串  
-                        //foreach (var chunk in chunks)
-                        //{
-                        //    Console.WriteLine(chunk);
-                        //}
-
-
+    
                         int topgrade = Convert.ToInt32(number.Rows[j]["color"]);
                         // 设置字体样式和大小  
                         Color color1 = new Color();
@@ -335,39 +440,23 @@ namespace OTSIncAReportApp._3_ServiceCenter
 
                         }
                         OpenCvSharp.Scalar fontColor = new OpenCvSharp.Scalar(color1.B, color1.G, color1.R, 255); // 文字颜色:黑色  
-                        double fontScale = 2.5; // 字体大小缩放因子  
-                        //int thickness = 2; // 字体粗细  
                         OpenCvSharp.LineTypes lineType = OpenCvSharp.LineTypes.AntiAlias; // 线条类型  
 
-                        int thickness2 = 1; // 字体粗细 
-
                         foreach (var chunk in chunks)
                         {
-                            // 获取文字的大小,以便我们可以更好地定位它  
-                            OpenCvSharp.Size textSize = OpenCvSharp.Cv2.GetTextSize(chunk, HersheyFonts.HersheySimplex, fontScale, thickness2, out int baseline);
                             // 使用PutText方法在图像上绘制文字  
                             OpenCvSharp.Cv2.PutText(save_pano, chunk, textOrg, HersheyFonts.HersheySimplex, fontScale, fontColor, thickness, lineType);
-                            textOrg.Y = textOrg.Y + 100;
+                            textOrg.Y = textOrg.Y + 70;
                         }
-
-
-
                     }
                     Yzhou = Yzhou + GridLength;
                 }
-
-
             }
             OpenCvSharp.Cv2.ImWrite(sfd.FileName, save_pano);
             NLog.LogManager.GetCurrentClassLogger().Info("Save complete.");
-
             Control_DrawDistrbutionImageAndBSE v = m_ReportApp.im_Control_DrawDistrbutionImageAndBSE;
             MyEvent += new MyEntrust(v.msgInform);
-          
-           
             v.Invoke(MyEvent);
-
-           
         }
 
         private DataTable CountTheNumberOfX_axes(DataTable dataTable, string ColumnName, string name)
@@ -509,16 +598,10 @@ namespace OTSIncAReportApp._3_ServiceCenter
                 data.Columns.Add("X", typeof(double));
                 //循环每行图片进行拼接
                 Bitmap bitmap = new Bitmap((int)m_list_allDfield[0].OriginalImage.Width, (int)m_list_allDfield[0].OriginalImage.Height);
-               
-                
                 
                 for (int a = 0; a < total_dt_X.Rows.Count; a++)
                 {
                     DataRow dr2 = data.NewRow();
-
-                   
-
-                    //Bitmap bitmap = new Bitmap((int)m_list_allDfield[0].GetShowRect().Width, (int)m_list_allDfield[0].GetShowRect().Height);
                     Graphics g = Graphics.FromImage(bitmap);
 
                     g.Clear(Color.White);
@@ -555,8 +638,6 @@ namespace OTSIncAReportApp._3_ServiceCenter
                                         //再循环计算所有的Particle对象
                                         foreach (Particle particle in list_particle)
                                         {
-
-
                                             List<Segment> list_seg;
                                             list_seg = particle.SegmentList;
                                             //创建颗粒分布图对应的类对象
@@ -568,8 +649,6 @@ namespace OTSIncAReportApp._3_ServiceCenter
 
                                                 System.Drawing.Point on_p = new System.Drawing.Point() { X = seg.Start, Y = seg.Height };
                                                 System.Drawing.Point off_p = new System.Drawing.Point() { X = seg.Start + seg.Length, Y = seg.Height };
-                                                //var color = DrawFunction.GetColorBySTDTypeIDForBSEAndSorImage("#434343", particle.TypeId);
-                                                
                                                 Pen npen = new Pen(Color.FromArgb(255-particle.AveGray, 0, 0, 0));
                                                 graph_2.DrawLine(npen, on_p, off_p);
 

+ 20 - 9
OTSIncAReportApp/1-UI/OTSTemplateDesigner/Export_ReportTemplate.cs

@@ -305,7 +305,7 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
                     dr["con"] = dt.Rows[i]["con"].ToString();
                     
                     if (dt.Rows[i]["GroupName"].ToString() == "")
-                        dr["Class"] = "NULL";
+                        dr["Class"] = "Default";
                     else
                         dr["Class"] = dt.Rows[i]["GroupName"].ToString();
                     //continue;
@@ -1548,7 +1548,7 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
             {
                 if (getClass_dt.Rows[i]["GroupName"].ToString() != "NOT_INCLUTION" && getClass_dt.Rows[i]["GroupName"].ToString() != "Invalid")
                     if (getClass_dt.Rows[i]["GroupName"].ToString() == "")
-                        ClassName.Add("NULL");
+                        ClassName.Add("Default");
                     else
                         ClassName.Add(getClass_dt.Rows[i]["GroupName"].ToString());
             }
@@ -1792,7 +1792,7 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
                 if (getClass_dt.Rows[i]["GroupName"].ToString() != "NOT_INCLUTION" && getClass_dt.Rows[i]["GroupName"].ToString() != "Invalid")
                     //ClassName.Add(getClass_dt.Rows[i]["GroupName"].ToString());
                     if (getClass_dt.Rows[i]["GroupName"].ToString() == "")
-                        ClassName.Add("NULL");
+                        ClassName.Add("Default");
                     else
                         ClassName.Add(getClass_dt.Rows[i]["GroupName"].ToString());
             }
@@ -1925,7 +1925,7 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
                 if (getClass_dt.Rows[i]["GroupName"].ToString() != "NOT_INCLUTION" && getClass_dt.Rows[i]["GroupName"].ToString() != "Invalid")
                     //ClassName.Add(getClass_dt.Rows[i]["GroupName"].ToString());
                     if (getClass_dt.Rows[i]["GroupName"].ToString() == "")
-                        ClassName.Add("NULL");
+                        ClassName.Add("Default");
                     else
                         ClassName.Add(getClass_dt.Rows[i]["GroupName"].ToString());
             }
@@ -2516,7 +2516,10 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
             DataTable getClass_dt = fielddata.GetAllClass();
             for (int i = 0; i < getClass_dt.Rows.Count; i++)
             {
-                ClassName.Add(getClass_dt.Rows[i]["GroupName"].ToString());
+                if (getClass_dt.Rows[i]["GroupName"].ToString() == "")
+                    ClassName.Add("Default");
+                else
+                    ClassName.Add(getClass_dt.Rows[i]["GroupName"].ToString());
             }
 
             DataTable AreaRatio = new DataTable();
@@ -2533,7 +2536,12 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
             for (int i = 0; i < AllAnalysisDetails.Rows.Count; i++)
             {
                 DataRow dr2 = AreaRatio.NewRow();
-                dr2["Class"] = AllAnalysisDetails.Rows[i]["Class"].ToString();
+
+                if (AllAnalysisDetails.Rows[i]["Class"].ToString() == "")
+                    dr2["Class"] = "Default";
+                else
+                    dr2["Class"] = AllAnalysisDetails.Rows[i]["Class"].ToString();
+                //dr2["Class"] = AllAnalysisDetails.Rows[i]["Class"].ToString();
                 dr2["Name"] = AllAnalysisDetails.Rows[i]["Name"].ToString();
                 dr2["Area"] = Convert.ToDouble(AllAnalysisDetails.Rows[i]["Area"]);
                 dr2["inca_proportion"] = Math.Round((Convert.ToDouble(AllAnalysisDetails.Rows[i]["Area"]) / totalInclusionArea) * 100, 2);
@@ -2694,7 +2702,7 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
                 if (getClass_dt.Rows[i]["GroupName"].ToString() != "NOT_INCLUTION" && getClass_dt.Rows[i]["GroupName"].ToString() != "Invalid")
                     //ClassName.Add(getClass_dt.Rows[i]["GroupName"].ToString());
                     if (getClass_dt.Rows[i]["GroupName"].ToString() == "")
-                        ClassName.Add("NULL");
+                        ClassName.Add("Default");
                     else
                         ClassName.Add(getClass_dt.Rows[i]["GroupName"].ToString());
             }
@@ -2779,7 +2787,7 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
                 if (getClass_dt.Rows[i]["GroupName"].ToString() != "NOT_INCLUTION" && getClass_dt.Rows[i]["GroupName"].ToString() != "Invalid")
                     //ClassName.Add(getClass_dt.Rows[i]["GroupName"].ToString());
                     if (getClass_dt.Rows[i]["GroupName"].ToString() == "")
-                        ClassName.Add("NULL");
+                        ClassName.Add("Default");
                     else
                         ClassName.Add(getClass_dt.Rows[i]["GroupName"].ToString());
             }
@@ -2801,7 +2809,10 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
             for (int i = 0; i < AllAnalysisDetails.Rows.Count; i++)
             {
                 DataRow dr = AreaRatio.NewRow();
-                dr["Class"] = AllAnalysisDetails.Rows[i]["Class"].ToString();
+                if (AllAnalysisDetails.Rows[i]["Class"].ToString() == "")
+                    dr["Class"] = "Default";
+                else
+                    dr["Class"] = AllAnalysisDetails.Rows[i]["Class"].ToString();
                 dr["subdivision"] = AllAnalysisDetails.Rows[i]["Name"].ToString();
                 dr["Area"] = Convert.ToDouble(AllAnalysisDetails.Rows[i]["Area"]);
                 dr["inca_proportion"] = Math.Round((Convert.ToDouble(AllAnalysisDetails.Rows[i]["Area"]) / sumArea) * 100, 2);

+ 19 - 18
OTSIncAReportApp/ReportTemplate/GBReport.Designer.cs

@@ -31,7 +31,9 @@ namespace OTSIncAReportApp.ReportTemplate
         {
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(GBReport));
             this.TopMargin = new DevExpress.XtraReports.UI.TopMarginBand();
+            this.xrLine1 = new DevExpress.XtraReports.UI.XRLine();
             this.GB_dev_ym = new DevExpress.XtraReports.UI.XRLabel();
+            this.xrPictureBox1 = new DevExpress.XtraReports.UI.XRPictureBox();
             this.BottomMargin = new DevExpress.XtraReports.UI.BottomMarginBand();
             this.Detail = new DevExpress.XtraReports.UI.DetailBand();
             this.xrPageBreak1 = new DevExpress.XtraReports.UI.XRPageBreak();
@@ -59,8 +61,6 @@ namespace OTSIncAReportApp.ReportTemplate
             this.GB_dev_ckbz = new DevExpress.XtraReports.UI.XRTableCell();
             this.GB_dev_ckbz_text = new DevExpress.XtraReports.UI.XRTableCell();
             this.GB_bt = new DevExpress.XtraReports.UI.XRLabel();
-            this.xrPictureBox1 = new DevExpress.XtraReports.UI.XRPictureBox();
-            this.xrLine1 = new DevExpress.XtraReports.UI.XRLine();
             ((System.ComponentModel.ISupportInitialize)(this.xrTable1)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this)).BeginInit();
             // 
@@ -73,6 +73,12 @@ namespace OTSIncAReportApp.ReportTemplate
             this.TopMargin.HeightF = 79.25F;
             this.TopMargin.Name = "TopMargin";
             // 
+            // xrLine1
+            // 
+            this.xrLine1.LocationFloat = new DevExpress.Utils.PointFloat(5.000051F, 56.25F);
+            this.xrLine1.Name = "xrLine1";
+            this.xrLine1.SizeF = new System.Drawing.SizeF(634.9998F, 23F);
+            // 
             // GB_dev_ym
             // 
             this.GB_dev_ym.LocationFloat = new DevExpress.Utils.PointFloat(170.3751F, 15.95834F);
@@ -84,8 +90,16 @@ namespace OTSIncAReportApp.ReportTemplate
             this.GB_dev_ym.Text = "标准名";
             this.GB_dev_ym.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter;
             // 
+            // xrPictureBox1
+            // 
+            this.xrPictureBox1.ImageSource = new DevExpress.XtraPrinting.Drawing.ImageSource("img", resources.GetString("xrPictureBox1.ImageSource"));
+            this.xrPictureBox1.LocationFloat = new DevExpress.Utils.PointFloat(5F, 7F);
+            this.xrPictureBox1.Name = "xrPictureBox1";
+            this.xrPictureBox1.SizeF = new System.Drawing.SizeF(159.375F, 47.91667F);
+            // 
             // BottomMargin
             // 
+            this.BottomMargin.HeightF = 69.70838F;
             this.BottomMargin.Name = "BottomMargin";
             // 
             // Detail
@@ -107,7 +121,7 @@ namespace OTSIncAReportApp.ReportTemplate
             this.xrTable1.Borders = ((DevExpress.XtraPrinting.BorderSide)((((DevExpress.XtraPrinting.BorderSide.Left | DevExpress.XtraPrinting.BorderSide.Top) 
             | DevExpress.XtraPrinting.BorderSide.Right) 
             | DevExpress.XtraPrinting.BorderSide.Bottom)));
-            this.xrTable1.LocationFloat = new DevExpress.Utils.PointFloat(5.000051F, 770.8333F);
+            this.xrTable1.LocationFloat = new DevExpress.Utils.PointFloat(5.000051F, 738.5417F);
             this.xrTable1.Name = "xrTable1";
             this.xrTable1.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 96F);
             this.xrTable1.Rows.AddRange(new DevExpress.XtraReports.UI.XRTableRow[] {
@@ -305,19 +319,6 @@ namespace OTSIncAReportApp.ReportTemplate
             this.GB_bt.Text = "标准评级";
             this.GB_bt.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter;
             // 
-            // xrPictureBox1
-            // 
-            this.xrPictureBox1.ImageSource = new DevExpress.XtraPrinting.Drawing.ImageSource("img", resources.GetString("xrPictureBox1.ImageSource"));
-            this.xrPictureBox1.LocationFloat = new DevExpress.Utils.PointFloat(5F, 7F);
-            this.xrPictureBox1.Name = "xrPictureBox1";
-            this.xrPictureBox1.SizeF = new System.Drawing.SizeF(159.375F, 47.91667F);
-            // 
-            // xrLine1
-            // 
-            this.xrLine1.LocationFloat = new DevExpress.Utils.PointFloat(5.000051F, 56.25F);
-            this.xrLine1.Name = "xrLine1";
-            this.xrLine1.SizeF = new System.Drawing.SizeF(634.9998F, 23F);
-            // 
             // GBReport
             // 
             this.Bands.AddRange(new DevExpress.XtraReports.UI.Band[] {
@@ -325,8 +326,8 @@ namespace OTSIncAReportApp.ReportTemplate
             this.BottomMargin,
             this.Detail});
             this.Font = new System.Drawing.Font("Arial", 9.75F);
-            this.Margins = new System.Drawing.Printing.Margins(100, 100, 79, 100);
-            this.Version = "20.1";
+            this.Margins = new System.Drawing.Printing.Margins(100, 100, 79, 70);
+            this.Version = "21.2";
             ((System.ComponentModel.ISupportInitialize)(this.xrTable1)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this)).EndInit();
 

+ 1 - 0
OTSIncAReportApp/ReportTemplate/GBReport.cs

@@ -110,6 +110,7 @@ namespace OTSIncAReportApp.ReportTemplate
             Template.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter;
             Template.LocationF = new PointF(5, LowPlace);
             Template.SizeF = new SizeF(640, 0);
+            Template.Font = new Font(typeface, Template.Font.Size);
             this.Detail.Controls.Add(Template);
 
             LowPlace = LowPlace + Template.SizeF.Height + 50;

+ 2 - 4
OTSIncAReportApp/ReportTemplate/OTS_DEVReport.cs

@@ -16,7 +16,7 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
     {
         public OTSReport_Export m_otsreport_export;
         //string typeface = "Arial Unicode MS";
-        string Schriftart_chinese = "Arial Unicode MS";
+        string Schriftart_chinese = "宋体";
         string Schriftart_english = "Arial Unicode MS";
         List<string> TemplateList;
         Export_ReportTemplate export_ReportTemplate;
@@ -118,7 +118,6 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
             setXRLabelData(dev_quantity, GetlanguageData(dev_quantity.Name.ToString(), languageData));//数量
 
 
-            //xrPictureBox1.ImageSource= 
             string str3 = System.IO.Directory.GetCurrentDirectory();
             Bitmap bitmap = (Bitmap)Image.FromFile(str3 + "\\Config\\ReportTemplate\\ReportIdentification.bmp");
             xrPictureBox1.ImageSource = new ImageSource(bitmap);
@@ -400,8 +399,7 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
 
             #endregion
             #endregion
-            //xrPageBreak3.LocationF = new PointF(xrPageBreak3.LocationF.X, NeueStartposition);
-            //NeueStartposition = xrPageBreak3.LocationF.Y + xrPageBreak3.SizeF.Height + 10;
+ 
         }
 
         public void HistogramChart()