소스 검색

Merge branch 'Release2.5' of http://36.129.163.148:30080/gogsadmin/OTS into Release2.5

zhangjiaxin 2 년 전
부모
커밋
078db84057

+ 4 - 1
OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/OTSSamplespaceWindow.cs

@@ -190,7 +190,10 @@ namespace OTSMeasureApp
                 var sam = GetWorkingVisualSample();
                 SizeF size = new SizeF(diameter, diameter);
                 var position =sam.GetMeasureGDIObject().GetZoomedRegionF().Location;
-                RectangleF rectangle = new RectangleF(position, size);
+                RectangleF rec = sam.GetMeasureGDIObject().GetZoomedRegionF();
+                PointF centerPos = new PointF(position.X + rec.Width / 2, position.Y + rec.Height / 2);
+                PointF newRegionFPos = new PointF(centerPos.X - diameter / 2, centerPos.Y - diameter / 2);
+                RectangleF rectangle = new RectangleF(newRegionFPos, size);
                 Color MeasureColor = Color.Red;
                 CRingGDIObject newGDI;
                

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

@@ -172,8 +172,7 @@ namespace OTSIncAReportGraph.Controls
         //移动SEM到指定位置发生线程
         private Thread m_mythread;
 
-        //记录线程是否已经运行完成的状态
-        //private bool m_mythread_state = false;
+
 
         private Color m_ColorNotContent = Color.SkyBlue;
 
@@ -335,7 +334,7 @@ namespace OTSIncAReportGraph.Controls
             //记录原值,用于缩放计算操作 ,此处要用克隆 ,原particle颗粒的值,在底层调用时已经赋值过了
             foreach (DisplayParticle ls_dp in m_list_allDPart)
             {
-                ls_dp.SetPaintState(PaintState.NORMALPAINT);
+                ls_dp.SetPaintState(PaintState.PAINT);
                 DisplayParticle old_dp = ls_dp.Clone() as DisplayParticle;
                 ReportFun. m_original_list_baseobject.Add(old_dp);
             }
@@ -778,7 +777,7 @@ namespace OTSIncAReportGraph.Controls
                 DisplayParticle dp = (DisplayParticle)m_list_allDPart[i];
                 
                 
-                    //dp.displayState = DisplayState.NORMALDISPLAY;
+                  
                     for (int y = 0; y < dp.DSegments.Count(); y++)
                     {
                         //这里重新设置每条线的高度,和x,y坐标
@@ -802,7 +801,7 @@ namespace OTSIncAReportGraph.Controls
                 //设置缩放到多少倍时进行显示
                 if (m_zoom_record >= dp.Zoom_DisPlayThreshold)
                 {
-                    dp.SetPaintState(PaintState.NORMALPAINT);
+                    dp.SetPaintState(PaintState.PAINT);
                 }
                 else
                 {
@@ -810,13 +809,15 @@ namespace OTSIncAReportGraph.Controls
                 }
 
 
-                if (dp.Rect.Left < -120 || dp.Rect.Right > this.Width+120 || dp.Rect.Top < -120 || dp.Rect.Bottom > this.Height+120)
+          
+                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);//the particles which are out of screen don't display.to speed up the display efficient.
+
                 }
-               
 
-               
+
             }
             if (m_list_allDfield != null)
             {
@@ -913,11 +914,15 @@ namespace OTSIncAReportGraph.Controls
                         foreach (BaseObject item in m_list_allDPart)
                         {
                             var dp = (DisplayParticle)item;
-                            if (dp.Rect.Left > -120 && dp.Rect.Right < this.Width + 120 && dp.Rect.Top > -120 && dp.Rect.Bottom < this.Height + 120)
+                         
+
+                            PointF ct = dp.GetCenterPoint();
+                            if (ct.X > -100 && ct.X < this.Width + 100 && ct.Y > -100 && ct.Y < this.Height + 100)
                             {
                                 item.IsDragging = true;
-                            
+
                             }
+
                             item.DraggingPoint = e.Location;
                             if (OriginalBackground)
                             {
@@ -1013,15 +1018,18 @@ namespace OTSIncAReportGraph.Controls
                             dp.SmallRect = dp.GetSmallRectangleFromRect();
                             if (m_zoom_record >= dp.Zoom_DisPlayThreshold)
                             {
-                                dp.SetPaintState(PaintState.NORMALPAINT);
+                                dp.SetPaintState(PaintState.PAINT);
                             }
                             else
                             {
                                 dp.SetPaintState(PaintState.CONCISEPAINT);
                             }
-                            if (dp.Rect.Left < -120 || dp.Rect.Right > this.Width + 120 || dp.Rect.Top < -120 || dp.Rect.Bottom > this.Height + 120)
+                       
+                            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);
+                                dp.SetPaintState(PaintState.NOPAINT);//the particles which are out of screen don't display.to speed up the display efficient.
+
                             }
                         }
                     }
@@ -1049,7 +1057,7 @@ namespace OTSIncAReportGraph.Controls
                     foreach (BaseObject item in m_list_allDPart)
                     {
                         DisplayParticle dp = (DisplayParticle)item;
-                        if (dp.GetPaintState() == PaintState.NORMALPAINT)
+                        if (dp.GetPaintState() == PaintState.PAINT)
                         {
                             if (ReportFun.WhetherInRange(dp, e.Location))
                             {
@@ -1282,17 +1290,21 @@ namespace OTSIncAReportGraph.Controls
                             dp.SmallRect = dp.GetSmallRectangleFromRect();
                             if (m_zoom_record >= dp.Zoom_DisPlayThreshold)
                             {
-                                dp.SetPaintState(PaintState.NORMALPAINT);
+                                dp.SetPaintState(PaintState.PAINT);
                             }
                             else
                             {
                                 dp.SetPaintState(PaintState.CONCISEPAINT);
                             }
-                            if (dp.Rect.Left < -120 || dp.Rect.Right > this.Width + 120 || dp.Rect.Top < -120 || dp.Rect.Bottom > this.Height + 120)
+
+
+                            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);
+                                dp.SetPaintState(PaintState.NOPAINT);//the particles which are out of screen don't display.to speed up the display efficient.
+
                             }
-                            
+
                         }
 
 
@@ -1322,20 +1334,15 @@ namespace OTSIncAReportGraph.Controls
                         CMenuStrip.Items[(int)RightButtonMenu.CopyImage].Visible = false;
                         CMenuStrip.Items[(int)RightButtonMenu.OriginalSplicing].Visible = false;
                         CMenuStrip.Items[(int)RightButtonMenu.DeleteParticle].Visible = true;
-                        //CMenuStrip.Items[(int)RightButtonMenu.CopyDatabase].Visible = true;
+                  
 
                         CMenuStrip.Items[(int)RightButtonMenu.MoveSEMToParticle].Visible = true;
                         CMenuStrip.Items[(int)RightButtonMenu.MoveSEMToParticle].Tag = item;
 
                         DisplayParticle dp = (DisplayParticle)item;
-                        //if (dp.TypeId == 9)
-                        //{
+                     
                             CMenuStrip.Items[(int)RightButtonMenu.ImportSTDDb].Visible = true;
-                        //}
-                        //else
-                        //{
-                        //    CMenuStrip.Items[(int)RightButtonMenu.ImportSTDDb].Visible = false;
-                        //}
+                     
 
                         CMenuStrip.Items[(int)RightButtonMenu.ParticleSegmentation].Visible = true;
                         m_ParticleSegmentation.ParticleData = dp.objParticleData;
@@ -1362,7 +1369,7 @@ namespace OTSIncAReportGraph.Controls
 
                     }
                     CMenuStrip.Items[(int)RightButtonMenu.DeleteParticle].Visible = false;
-                    //CMenuStrip.Items[(int)RightButtonMenu.CopyDatabase].Visible = false;
+                
                     CMenuStrip.Items[(int)RightButtonMenu.CopyImage].Visible = true;
                     CMenuStrip.Items[(int)RightButtonMenu.OriginalSplicing].Visible = true;
                     CMenuStrip.Items[(int)RightButtonMenu.MoveSEMToParticle].Visible = false;
@@ -1574,7 +1581,7 @@ namespace OTSIncAReportGraph.Controls
             foreach (DisplayParticle ls_dp in m_list_allDPart)
             {
               
-                if (ls_dp.GetPaintState() == PaintState.NORMALPAINT)
+                if (ls_dp.GetPaintState() == PaintState.PAINT)
                 {
                     for (int i = 0; i < particles.Count; i++)
                     {
@@ -1683,7 +1690,6 @@ namespace OTSIncAReportGraph.Controls
 
               
 
-                //Thread.Sleep(500);
 
                 //第二步,移动到指定位置,先读取再设置
                 if (ReportFun.ConnectToIpcSvr())
@@ -1693,10 +1699,7 @@ namespace OTSIncAReportGraph.Controls
 
                 }
 
-                //Thread.Sleep(1500);
-
-                //第三步,断开电镜连接
-                //ReportFun.DisConnectSEM();
+               
 
                
 
@@ -1832,9 +1835,11 @@ namespace OTSIncAReportGraph.Controls
 
                 //重新计算小矩形边框
                 dp.SmallRect = dp.GetSmallRectangleFromRect();
-                if (dp.Rect.Left < -120 || dp.Rect.Right > this.Width + 120 || dp.Rect.Top < -120 || dp.Rect.Bottom > this.Height + 120)
+                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);
+                    dp.SetPaintState(PaintState.NOPAINT);//the particles which are out of screen don't display.to speed up the display efficient.
+
                 }
             }
             //同样重新计算backrectf的坐标
@@ -2004,7 +2009,7 @@ namespace OTSIncAReportGraph.Controls
                         ls_ds.ShowMode = SegmentShowMode.DRAWPOINT;
                     }
                 }
-                FullGraphMatch();
+              
             }
             else if (a_type == IMAGE_TYPE.CLASSIFIED)
             {
@@ -2018,7 +2023,7 @@ namespace OTSIncAReportGraph.Controls
                         ls_ds.ShowMode = SegmentShowMode.DRAWLINE;
                     }
                 }
-                FullGraphMatch();
+               
             }
             else if (a_type== IMAGE_TYPE.ORIGINAl)
             {
@@ -2028,7 +2033,7 @@ namespace OTSIncAReportGraph.Controls
                 {
                     ls_dp.SetDisplayState(DisplayState.NODISPLAY);
                 }
-                FullGraphMatch();
+               
             }
             else if(a_type== IMAGE_TYPE.ORIGINALCLASSIFIED)
             {
@@ -2042,7 +2047,7 @@ namespace OTSIncAReportGraph.Controls
                         ls_ds.ShowMode = SegmentShowMode.DRAWLINE;
                     }
                 }
-                FullGraphMatch();
+              
             }
 
         
@@ -2081,7 +2086,7 @@ namespace OTSIncAReportGraph.Controls
             {
 
                 var curfldrec = f.Current_Rect;
-                if (curfldrec.Left > -1000 && curfldrec.Right < this.Width + 1000 && curfldrec.Top > -1000 && curfldrec.Bottom < this.Height + 1000)
+                if (curfldrec.Left > -2000 && curfldrec.Right < this.Width + 2000 && curfldrec.Top > -2000 && curfldrec.Bottom < this.Height + 2000)
                 {
                    
                   
@@ -2156,7 +2161,7 @@ namespace OTSIncAReportGraph.Controls
                 //"单个OTS视域屏幕像素宽:" + m_OneField_OTS_Rect.Width.ToString() + " 高:" + m_OneField_OTS_Rect.Height.ToString() + Environment.NewLine +
                 "屏幕像素backrectf  x:" + m_backRect.X.ToString() + "  y:" + m_backRect.Y.ToString() + "  width:" + m_backRect.Width.ToString() + "  height:" + m_backRect.Height.ToString() + Environment.NewLine +
                 "包含Field数量:" + ReportFun.m_field_count.ToString() + " Particle数量:" + ReportFun.m_particle_count.ToString() + Environment.NewLine +
-                "正常显示Paticle数量:" + GetParticleNumberByState(PaintState.NORMALPAINT).ToString() + " 不显示Particel数量:" + GetParticleNumberByState(PaintState.NOPAINT).ToString() + Environment.NewLine +
+                "正常显示Paticle数量:" + GetParticleNumberByState(PaintState.PAINT).ToString() + " 不显示Particel数量:" + GetParticleNumberByState(PaintState.NOPAINT).ToString() + Environment.NewLine +
                 //"删除Particle数量:" + GetParticleNumberByState("删除").ToString() + " 选中Particle数量:" + GetParticleNumberByState("选择").ToString() + Environment.NewLine +
                 "加载底层数据用时:" + ReportFun.m_time_str + Environment.NewLine +
                 "组建并计算图像用时:" + ReportFun.m_time_str2 + Environment.NewLine +

+ 8 - 8
OTSIncAReportApp/1-UI/Control_Graph/Controls/Control_DrawDistrbutionSortImage.cs

@@ -386,7 +386,7 @@ namespace OTSIncAReportGraph.Controls
                     DisplayParticle dp = (DisplayParticle)item;
                     if (dp.IsDeleted==false)
                     {
-                        if (dp.GetPaintState() == PaintState.NORMALPAINT)
+                        if (dp.GetPaintState() == PaintState.PAINT)
                         {
                             item.OnPaint(e);
                         }
@@ -480,7 +480,7 @@ namespace OTSIncAReportGraph.Controls
                         }
                         else
                         {
-                            dp.SetPaintState(PaintState.NORMALPAINT);
+                            dp.SetPaintState(PaintState.PAINT);
                         }
 
                     }
@@ -675,7 +675,7 @@ namespace OTSIncAReportGraph.Controls
                         {
 
                             DisplayParticle dp = (DisplayParticle)item;
-                            if (dp.GetPaintState() == PaintState.NORMALPAINT )
+                            if (dp.GetPaintState() == PaintState.PAINT )
                             {
                                 CMenuStrip.Items[0].Enabled = true;
                                 CMenuStrip.Items[0].Tag = dp;
@@ -782,7 +782,7 @@ namespace OTSIncAReportGraph.Controls
                             DisplayParticle dp = (DisplayParticle)item;
 
                     
-                        if (dp.GetPaintState() == PaintState.NORMALPAINT)
+                        if (dp.GetPaintState() == PaintState.PAINT)
                         {
                             if (true == m_ReportFun.WhetherInRange(dp, e.Location))
                             {
@@ -866,7 +866,7 @@ namespace OTSIncAReportGraph.Controls
                     DisplayParticle dp = (DisplayParticle)item;
                     if (true == m_ReportFun.WhetherInRange(dp, e.Location))
                     {
-                        if (dp.GetPaintState() == PaintState.NORMALPAINT)
+                        if (dp.GetPaintState() == PaintState.PAINT)
                         {
  
 
@@ -1073,7 +1073,7 @@ namespace OTSIncAReportGraph.Controls
                 foreach (DisplayParticle ls_dp in spd.List_DParticle)
                 {
                     //只有显示状态,才可以切换到选择状态,考虑可能会出现如果在条件选择成不显示状态下,如果被选择了,是不是就强制切换成了选择状态
-                    if (ls_dp.GetPaintState() == PaintState.NORMALPAINT)
+                    if (ls_dp.GetPaintState() == PaintState.PAINT)
                     {
                         for (int i = 0; i < in_list_cotsparticleclr.Count; i++)
                         {
@@ -1118,7 +1118,7 @@ namespace OTSIncAReportGraph.Controls
                 foreach (DisplayParticle ls_dp in m_list_baseobject)
                 {
                     ls_dp.ParticleFL = Convert.ToString(Math.Sqrt(ls_dp.objParticleData.Area / 3.14159) * 2);
-                    ls_dp.SetPaintState(PaintState.NORMALPAINT);
+                    ls_dp.SetPaintState(PaintState.PAINT);
                    
                     if (!FLNameList.ContainsKey(ls_dp.TypeName))
                     {
@@ -1430,7 +1430,7 @@ namespace OTSIncAReportGraph.Controls
 
             if (dp.IsSelect)
             {
-                dp.SetPaintState(PaintState.NORMALPAINT);
+                dp.SetPaintState(PaintState.PAINT);
                 CMenuStrip.Items[1].Text = "选择颗粒";
 
                 control_XRayTable1.Visible = false;

+ 3 - 8
OTSIncAReportApp/1-UI/OTSDisplaySourceGridData/frmReportConditionChoose.cs

@@ -527,16 +527,11 @@ namespace OTSIncAReportApp
         {
             int sourceid = 0;
             sourceid =(int) m_CurrentConditions[OTS_REPORT_PROP_GRID_ITEMS.DATA_SOURCE].itemVal;
-            //sourceid = m_rstDataMgr.GetWorkingResult();
-            //m_rstDataMgr.SetWorkingResult(sourceid);
-
-
-
-            //var resultFile = m_rstDataMgr.ResultFilesList[sourceid];
+         
 
             var prop = m_SourceGridData;
 
-            //String m_fileName = resultFile.FileName;
+           
             String m_fileName=m_CurrentConditions[OTS_REPORT_PROP_GRID_ITEMS.DATA_SOURCE].itemDisplayVal.ToString();
 
 
@@ -579,7 +574,7 @@ namespace OTSIncAReportApp
                             IMAGE_TYPE t = (IMAGE_TYPE)imgType.itemVal;
                             m_ReportApp.im_Control_DrawDistrbutionImageAndBSE.ShowMode(t);
 
-                            m_ReportApp.im_Control_DrawDistrbutionImageAndBSE.FullGraphMatch();
+                          
 
                         }
                         else if (m_ReportApp.im_Control_DrawDistrbutionImageAndBSE == null)

+ 41 - 11
OTSIncAReportApp/2-CommonFunction/CommonClass/DisplayField.cs

@@ -41,6 +41,7 @@ namespace OTSIncAReportGraph
         /// </summary>
         public DisplayField(Field fld, int fldwidth, int fldheight,Point screenPos)
         {
+         
             m_list_dparticle = new List<DisplayParticle>();
             m_list_Useparticle = new List<DisplayParticle>();
             m_id = System.Guid.NewGuid();
@@ -48,7 +49,9 @@ namespace OTSIncAReportGraph
            
             FieldID = fld.FieldID.ToString();
             Show_Rect = new Rectangle(screenPos, new Size(fldwidth, fldheight));
+
             Current_Rect = new Rectangle(screenPos, new Size(fldwidth, fldheight));
+
             OTSCoordinatePos = new PointF(thisfield_point.X, thisfield_point.Y);
             //先获取该Field中的所有Particle
             List<Particle> list_particle;
@@ -57,6 +60,7 @@ namespace OTSIncAReportGraph
             //然后将取出的数据,转换成Bitmap对象
             m_originalImage = DrawFunction.ReadImageFile(fld.FieldImage);
 
+            Bitmap dpImage = new Bitmap(fldwidth, fldheight);
             //再循环计算所有的Particle对象
             foreach (Particle particle in list_particle)
             {
@@ -68,6 +72,7 @@ namespace OTSIncAReportGraph
                 //创建DParticle颗粒
                 DisplayParticle dp = new DisplayParticle(particle);
 
+             
                 List<Segment> list_seg;
                 list_seg = particle.SegmentList;
 
@@ -83,7 +88,7 @@ namespace OTSIncAReportGraph
                     DisplaySegment ds = new DisplaySegment();
                     ds.Rect = new Rectangle(seg.Start + screenPos.X,
                      
-                       seg.Height + screenPos.Y,
+                        seg.Height + screenPos.Y,
                         seg.Length,
                         1);
 
@@ -95,35 +100,60 @@ namespace OTSIncAReportGraph
                   
                     //合成图像完成,开始抠取像素-----------------------------------------------------------------
                     int f_length = seg.Length;
-                    List<Color> ls_list_colors = new List<Color>();
+                 
                     for (int m = 0; m < f_length; m++)
                     {
                         //这里实现一下代码保护
                         int lsjs_x = seg.Start + m;
                      
                         int lsjs_y = seg.Height;
-                   
-                        ls_list_colors.Add(m_originalImage.GetPixel(lsjs_x,
-                           lsjs_y));
+
+                    
+
+
+                        var pixelColor = m_originalImage.GetPixel(lsjs_x, lsjs_y);
+
+
+
+                        try
+                        {
+                           
+                            dpImage.SetPixel(lsjs_x, lsjs_y, pixelColor);//ls_list_colors[m]
+                        }
+                        catch (Exception ex)
+                        {
+                            NLog.LogManager.GetCurrentClassLogger().Error(ex.Message.ToString());
+                        }
+                        
                     }
-                    //保存原BSE图中的颜色列表
-                    ds.List_Colors = ls_list_colors;
+                  
                     #endregion //------------------------------------------------------------------------------
 
                     list_dsegment.Add(ds);
-
+                   
                 }
 
           
-                dp.SetPaintState(PaintState.NORMALPAINT);
+                dp.SetPaintState(PaintState.PAINT);
 
                 dp.DSegments = list_dsegment;
 
-               
+
                 dp.Rect = dp.GetRectFromDSegment();
                 dp.GPath = dp.GetRegionFromDSegments();
                 dp.SmallRect = dp.GetSmallRectangleFromRect();
+                var currentRect = new RectangleF(dp.Rect.X - screenPos.X, dp.Rect.Y - screenPos.Y, dp.Rect.Width, dp.Rect.Height);
 
+                try 
+                {
+                    var dpImg = dpImage.Clone(currentRect, dpImage.PixelFormat);
+                    dp.SetImage(dpImg);
+                } catch (Exception ex)
+                {
+                    NLog.LogManager.GetCurrentClassLogger().Error(ex.ToString());
+                }
+             
+               
                
                 m_list_dparticle.Add(dp);
                 if (dp.XRayId > -1)
@@ -246,7 +276,7 @@ namespace OTSIncAReportGraph
                 DisplayParticle dp = (DisplayParticle)item;
                 if (dp.IsDeleted==false)
                 {
-                    if (dp.GetPaintState() == PaintState.NORMALPAINT)
+                    if (dp.GetPaintState() == PaintState.PAINT)
                     {
                         item.OnPaint(e);
                     }

+ 53 - 19
OTSIncAReportApp/2-CommonFunction/CommonClass/DisplayParticle.cs

@@ -17,7 +17,7 @@ namespace OTSIncAReportGraph
     /// </summary>
     public enum PaintState
     {
-        NORMALPAINT = 0,
+        PAINT = 0,
         NOPAINT = 1,
         CONCISEPAINT=2,// display as a "+"
  
@@ -66,7 +66,7 @@ namespace OTSIncAReportGraph
         private bool m_isSelected;
         private bool m_isDeleted;
         private bool m_isMouseOver;
-        private PaintState m_paintState = PaintState.NORMALPAINT;
+        private PaintState m_paintState = PaintState.PAINT;
         private ParticleShowXray m_operator_showxray = ParticleShowXray.NODISPLAY;//选定显示XRAY,不显示XRAY,默认应为(不显示XRAY)
         private bool m_isdragging;
         private PointF m_dragingpoint;
@@ -76,6 +76,8 @@ namespace OTSIncAReportGraph
         private List<DisplaySegment> m_listdsegment = new List<DisplaySegment>();
         private DisplayState m_displayState;
 
+        private Image m_image;
+
         private string m_sort_type = "从大到小";
         private float m_f_size = 0;
         private string m_str_lj = "颗粒粒级";
@@ -135,6 +137,7 @@ namespace OTSIncAReportGraph
             m_id = System.Guid.NewGuid();
             objParticleData = part;
             this.Color = GetColorBySTDTypeIDForBSEAndSorImage(part.TypeColor, part.TypeId);
+           
         }
 
         public DisplayParticle(List<DisplaySegment> in_list_segment, DisplayParticle in_particle)
@@ -283,7 +286,12 @@ namespace OTSIncAReportGraph
         {
             return new DisplayParticle(this.m_listdsegment, this);
         }
+        public PointF GetCenterPoint()
+        {
 
+            return new PointF(m_rect.X + m_rect.Width / 2, m_rect.Y + m_rect.Height / 2);
+        
+        }
         /// <summary>
         /// ID
         /// </summary>
@@ -509,6 +517,16 @@ namespace OTSIncAReportGraph
         public bool IsDeleted { get => m_isDeleted; set => m_isDeleted = value; }
         public bool IsMouseOver { get => m_isMouseOver; set => m_isMouseOver = value; }
 
+        public Image GetImage()
+        {
+            return m_image;
+        }
+
+        public void SetImage(Image value)
+        {
+            m_image = value;
+        }
+
         public DisplayState GetDisplayState()
         {
             if (m_isDeleted)
@@ -552,14 +570,35 @@ namespace OTSIncAReportGraph
                                     ButtonBorderStyle.Solid);
             }
            
-            if (GetPaintState() == PaintState.NORMALPAINT)
+            if (GetPaintState() == PaintState.PAINT)
             {
-             
-                //调用绘制基本线
-                foreach (DisplaySegment item in m_listdsegment)
+                DisplaySegment ds = m_listdsegment[0];
+                if (ds.ShowMode == SegmentShowMode.DRAWPOINT)
                 {
-                    item.OnPaint(e);
+                    try
+                    {
+                        e.Graphics.DrawImage(m_image, m_rect);
+
+                    }
+                    catch (Exception ex)
+                    {
+                        NLog.LogManager.GetCurrentClassLogger().Error(ex.ToString());
+                    }
+                  
+
                 }
+                else 
+                {
+                    //调用绘制基本线
+                    foreach (DisplaySegment item in m_listdsegment)
+                    {
+                        item.OnPaint(e);
+                    }
+
+                }
+             
+              
+
 
 
             }
@@ -757,18 +796,13 @@ namespace OTSIncAReportGraph
                 }
             }
 
-            //对矩形Rect大小位置进行修补,因为画线是内边框,并且计算出来的位置也是向内占用一像素的,
-            //正常应该是 +2,但实际效果,+3也才勉强够用,因为放大缩小画笔宽度影响的
-            rect.X = x1 - 2;
-            rect.Y = y1 - 3;
-            rect.Width = i_width - rect.X + 2;
-            rect.Height = i_height - rect.Y + 3;
-
-            //判断如果太小,就给个最小值吧
-            if (rect.Width < 8)
-                rect.Width = 8;
-            if (rect.Height < 8)
-                rect.Height = 8;
+  
+            rect.X = x1 ;
+            rect.Y = y1 ;
+            rect.Width = i_width - rect.X ;
+            rect.Height = i_height - rect.Y ;
+
+        
 
             return rect;
         }

+ 15 - 12
OTSIncAReportApp/2-CommonFunction/CommonClass/DisplaySegment.cs

@@ -154,6 +154,7 @@ namespace OTSIncAReportGraph
         /// <param name="e"></param>
         public override void OnPaint(PaintEventArgs e)
         {
+          
             //两种绘制模式的选择,绘线还是缓点
             if (show_mode == SegmentShowMode.DRAWLINE)
             {
@@ -161,18 +162,20 @@ namespace OTSIncAReportGraph
                 Pen p = new Pen(m_color, m_PenWidthAndHeight + 1f);//这里加1f的宽度后,用线组成多边形不会分散,效果正常,原因不知,但目前没有遇到问题
                 e.Graphics.DrawLine(p, Rect.X, Rect.Y, Rect.X + Rect.Width, Rect.Y);
             }
-            else if (show_mode == SegmentShowMode.DRAWPOINT)
-            {
-                //根据color的序列,显示绘制的原像素的图像。
-                for (int i = 0; i < m_list_colors.Count(); i++)
-                {
-                    e.Graphics.FillRectangle(new SolidBrush(m_list_colors[i]),
-                                            this.Rect.X + (i * m_PenWidthAndHeight) + 1f,
-                            this.Rect.Y,
-                            m_PenWidthAndHeight,
-                            m_PenWidthAndHeight);
-                }
-            }
+            //else if (show_mode == SegmentShowMode.DRAWPOINT)
+            //{
+            //    //根据color的序列,显示绘制的原像素的图像。
+            //    for (int i = 0; i < m_list_colors.Count(); i++)
+            //    {
+                 
+            //        e.Graphics.FillRectangle(new SolidBrush(m_list_colors[i]),
+            //                                this.Rect.X + (i * m_PenWidthAndHeight) + 1f,
+            //                this.Rect.Y,
+            //                m_PenWidthAndHeight,
+            //                m_PenWidthAndHeight);
+                   
+            //    }
+            //}
         }
     }
 

+ 11 - 3
OTSPartA_STDEditor/Form_ConstantsEditor2.cs

@@ -1561,7 +1561,7 @@ namespace OTSPartA_STDEditor
                         OtsDatabaseCommand.ExecuteNonQuery();
                         OtsDatabaseCommand.CommandText = "CREATE TABLE MaxEDSRules (MaxEDSTime INT,UsingElementList TEXT, UsingImgPropertyList TEXT,UsingOtherPropertyList TEXT,Expression TEXT)";
                         OtsDatabaseCommand.ExecuteNonQuery();
-                        OtsDatabaseCommand.CommandText = "CREATE TABLE STDGroups (id INTEGER,name TEXT, color INTEGER,iorder INTEGER)";
+                        OtsDatabaseCommand.CommandText = "CREATE TABLE STDGroups (id INTEGER,name TEXT, color TEXT,iorder INTEGER)";
                         OtsDatabaseCommand.ExecuteNonQuery();
                         OtsDatabaseCommand.CommandText = "CREATE TABLE STDMinerals (id INTEGER,SPEC BLOB)";
                         OtsDatabaseCommand.ExecuteNonQuery();
@@ -1571,11 +1571,19 @@ namespace OTSPartA_STDEditor
 
                         foreach (DataRow item in OreDatabasedt.Rows)
                         {
-                            OtsDatabaseCommand.CommandText = "insert into ClassifySTD (Density,BSE,Formula,StrName,Color,STDId,ListNum,GroupId,KeyElementList,SubElementList,UsingImgPropertyList,UsingOtherPropertyList,Expression,Hardness,Electrical_conductivity,Element) values ( '" + item["density"].ToString() + "','" + item["BSEValue"].ToString() + "','" + item["formula"].ToString() + "','" + item["name"].ToString() + "','" + item["color"].ToString() + "'," + item["id"].ToString() + "," + listnum.ToString() + @",0,' ',' ',' ',' ',' ',' ',' ',' ')";
+                            int n = 0;
+                            string STRcolor = "#0";
+                            if(int.TryParse(item["color"].ToString(),out n))
+                            {
+                                STRcolor = "#"+n.ToString("X6");
+                            }
+                            int idaAdd10 = 0;
+                            idaAdd10 = int.Parse(item["id"].ToString()) + 10;
+                            OtsDatabaseCommand.CommandText = "insert into ClassifySTD (Density,BSE,Formula,StrName,Color,STDId,ListNum,GroupId,KeyElementList,SubElementList,UsingImgPropertyList,UsingOtherPropertyList,Expression,Hardness,Electrical_conductivity,Element) values ( '" + item["density"].ToString() + "','" + item["BSEValue"].ToString() + "','" + item["formula"].ToString() + "','" + item["name"].ToString() + "','" + STRcolor + "'," + idaAdd10.ToString() + "," + listnum.ToString() + @",0,' ',' ',' ',' ',' ',' ',' ',' ')";
                             OtsDatabaseCommand.ExecuteNonQuery();
                             listnum++;
                             OtsDatabaseCommand.CommandText = "insert into STDMinerals (id,SPEC) values (@id,@SPEC)";
-                            OtsDatabaseCommand.Parameters.Add("id", DbType.Int32).Value = item["id"];
+                            OtsDatabaseCommand.Parameters.Add("id", DbType.Int32).Value = idaAdd10;
                             OtsDatabaseCommand.Parameters.Add("SPEC", DbType.Binary).Value = item["SPEC"];
                             OtsDatabaseCommand.ExecuteNonQuery();
                         }