瀏覽代碼

添加 图标

CXS 3 年之前
父節點
當前提交
cf0ead9496

+ 42 - 13
OTSIncAReportApp/1-UI/Control_Graph/Controls/Control_DrawDistrbutionImageAndBSE.cs

@@ -46,7 +46,8 @@ namespace OTSIncAReportGraph.Controls
         public bool IsParticleSegmentation;
         public Point EndPoint;
         public Particle ParticleData;
-
+        public bool IsParticleSegmentationFinish;
+        public List<Particle> SegmentationParticles;
     }
     public enum RightButtonMenu
     { 
@@ -56,8 +57,7 @@ namespace OTSIncAReportGraph.Controls
        CopyImage=2,
        OriginalSplicing= 3,
        DeleteParticle=4,
-       CopyDatabase=5,
-       ParticleSegmentation=6
+       ParticleSegmentation = 5
     }
     /// <summary>
     /// 选择导出的图片是原图还是颗粒渲染后的图片
@@ -673,6 +673,10 @@ namespace OTSIncAReportGraph.Controls
             {
                 e.Graphics.DrawLine(new Pen(Color.Red), m_ParticleSegmentation.StartPoint.X, m_ParticleSegmentation.StartPoint.Y, m_ParticleSegmentation.EndPoint.X, m_ParticleSegmentation.EndPoint.Y);
             }
+            if (m_ParticleSegmentation.IsParticleSegmentationFinish)
+            {
+                e.Graphics.DrawLine(new Pen(Color.Red), m_ParticleSegmentation.StartPoint.X, m_ParticleSegmentation.StartPoint.Y, m_ParticleSegmentation.EndPoint.X, m_ParticleSegmentation.EndPoint.Y);
+            }
             #endregion
             #region 绘制网格线,帧图边框部份
             if (true == m_is_showgrid)
@@ -976,6 +980,7 @@ namespace OTSIncAReportGraph.Controls
                     m_ParticleSegmentation.EndPoint = e.Location;
                 }
             }
+            
             else
             {
                 if (m_isDrag)
@@ -1164,17 +1169,16 @@ namespace OTSIncAReportGraph.Controls
                     GraphicsPath ls_gpath = new GraphicsPath();
                     //ls_gpath.AddLine(m_ParticleSegmentation.StartPoint.X, m_ParticleSegmentation.StartPoint.Y, m_ParticleSegmentation.EndPoint.X, m_ParticleSegmentation.EndPoint.Y);
                     //m_ParticleSegmentation.IsParticleSegmentation = false;
-                    DialogResult res = MessageBox.Show("Is it ok?");
+                    DialogResult res = MessageBox.Show("Is the division complete?");
                     if (res == DialogResult.OK)
                     {
-                        foreach (BaseObject item in m_list_allDPart)
-                        {
-                            DisplayParticle dp = (DisplayParticle)item;
-                            if (ReportFun.WhetherInRange(dp, e.Location))
-                            {
-                                List<Segment> segments = dp.objParticleData.SegmentList;
-                            }
-                        }
+                        Particle particle1 = new Particle();
+                        Particle particle2 = new Particle();
+
+                        GetTheSegmentsOfTheDividedParticle(m_ParticleSegmentation.StartPoint, m_ParticleSegmentation.EndPoint, m_mouseOver_dparticle.objParticleData,ref particle1,ref particle2);
+
+                        m_ParticleSegmentation.IsParticleSegmentation = false;
+                        m_ParticleSegmentation.IsParticleSegmentationFinish = true;
                     }
                 }
                 else
@@ -2131,14 +2135,39 @@ namespace OTSIncAReportGraph.Controls
             }
            
         }
-        int GetsIntersectionOfTheIntercepts(Point P1,Point P2,int y)
+        int GetsegmentationX(Point P1,Point P2,int y)
         {
             int x = (y - P1.Y * P2.X + P1.X * P2.Y) / (P2.Y - P1.Y);
             return x;
         }
+        void GetTheSegmentsOfTheDividedParticle(Point P1, Point P2,Particle DividedParticle,ref Particle Particle1, ref Particle Particle2)
+        {
+            for (int i = 0; i < DividedParticle.SegmentList.Count; i++)
+            {
+                int h = DividedParticle.SegmentList[i].Height;
+                //Segment segment = DividedParticle.SegmentList[i];
+                //segment.Start = DividedParticle.SegmentList[i].Start;
+                //int end = segment.Start - GetsegmentationX(P1, P2, h);
+                //segment.Length = Math.Abs(end);
+                //Particle1.SegmentList.Add(segment);
 
+                //Segment segment2 = new Segment();
+                //segment.Start = end;
+                //segment.Length = DividedParticle.SegmentList[i].Length- segment.Length;
+                //Particle2.SegmentList.Add(segment2);
+            }
+        }
         private void ParticleSegmentation_Click(object sender, EventArgs e)
         {
+            
+            //foreach (BaseObject item in m_list_allDPart)
+            //{
+            //    DisplayParticle dp = (DisplayParticle)item;
+            //    if (ReportFun.WhetherInRange(dp, ))
+            //    {
+            //        List<Segment> segments = dp.objParticleData.SegmentList;
+            //    }
+            //}
             Particle_Segmentation();
         }
       

二進制
OTSIncAReportApp/Resources/cut.png