Esempio n. 1
0
        private void SaveBtn_Click(object sender, EventArgs e)
        {
            bool bOk = true;

            foreach (var info in Infos)
            {
                if (Tools.ContainsKey(info.ToolName))
                {
                    ShapeMatchTool tool = Tools[info.ToolName];
                    tool.Image  = currentImage;
                    tool.Window = displayForm;
                    bOk        &= tool.CreateMatchTool();
                }
            }
            if (bOk)
            {
                MessageHelper.ShowTips("模板保存成功!");
            }
        }
Esempio n. 2
0
 private void DisplayForm_Rectangle1ROIEvent(double t1, double t2, double t3, double t4, object t5)
 {
     if (!bModifyModelROI && !bModifyFindROI && !bDrawFindROI)
     {
         if (!string.IsNullOrEmpty(newModelName))
         {
             //Create a new setting info
             ShapeMatchToolInfo info = new ShapeMatchToolInfo();
             info.ToolName      = newModelName;
             info.ModelROIParam = new Rectangle1Param()
             {
                 RectangleStartRow    = t1,
                 RectangleStartColumn = t2,
                 RectangleEndRow      = t3,
                 RectangleEndColumn   = t4,
                 GraphName            = newModelName
             };
             //Create a new match tool
             ShapeMatchTool tool = new ShapeMatchTool(info, displayForm);
             if (!tool.CreateMatchTool())
             {
                 MessageHelper.ShowError("模板创建失败,请重新创建");
                 return;
             }
             Infos.Add(info);
             Tools.Add(info.ToolName, tool);
             CurrentModelComb.Items.Add(info.ToolName);
             currentFindRegionComb.Items.Add(info.ToolName);
         }
     }
     else if (bModifyModelROI && !bModifyFindROI && !bDrawFindROI)
     {
         bModifyModelROI = false;
         if (Info != null)
         {
             Rectangle1Param rectangle1 = Info.ModelROIParam as Rectangle1Param;
             if (rectangle1 != null)
             {
                 rectangle1.RectangleStartRow    = t1;
                 rectangle1.RectangleStartColumn = t2;
                 rectangle1.RectangleEndRow      = t3;
                 rectangle1.RectangleEndColumn   = t4;
             }
         }
     }
     else if (!bModifyModelROI && !bModifyFindROI && bDrawFindROI)
     {
         bDrawFindROI = false;
         ShapeMatchToolInfo info = Infos.Find(p => p.ToolName == currentFindRegionComb.SelectedItem.ToString());
         if (info != null)
         {
             info.FindModelROIParam = new Rectangle1Param()
             {
                 GraphName            = currentFindRegionComb.SelectedItem.ToString(),
                 RectangleStartRow    = t1,
                 RectangleStartColumn = t2,
                 RectangleEndRow      = t3,
                 RectangleEndColumn   = t4,
             };
         }
     }
     else if (!bModifyModelROI && bModifyFindROI && bDrawFindROI)
     {
         bDrawFindROI   = false;
         bModifyFindROI = false;
         ShapeMatchToolInfo info = Infos.Find(p => p.ToolName == currentFindRegionComb.SelectedItem.ToString());
         if (info != null)
         {
             Rectangle1Param rectangle1 = info.FindModelROIParam as Rectangle1Param;
             if (rectangle1 != null)
             {
                 rectangle1.RectangleStartRow    = t1;
                 rectangle1.RectangleStartColumn = t2;
                 rectangle1.RectangleEndRow      = t3;
                 rectangle1.RectangleEndColumn   = t4;
             }
         }
     }
 }
Esempio n. 3
0
 private void DisplayForm_CircleROIEvent(int t1, int t2, double t3, object t4, object t5)
 {
     if (!bModifyModelROI && !bModifyFindROI && !bDrawFindROI)
     {
         if (!string.IsNullOrEmpty(newModelName))
         {
             //Create a new setting info
             ShapeMatchToolInfo info = new ShapeMatchToolInfo();
             info.ToolName      = newModelName;
             info.ModelROIParam = new CircleParam()
             {
                 CircleRow = t1, CircleColumn = t2, Radius = t3, GraphName = newModelName
             };
             //Create a new match tool
             ShapeMatchTool tool = new ShapeMatchTool(info, displayForm);
             if (!tool.CreateMatchTool())
             {
                 MessageHelper.ShowError("模板创建失败,请重新创建");
                 return;
             }
             Infos.Add(info);
             Tools.Add(info.ToolName, tool);
             CurrentModelComb.Items.Add(info.ToolName);
             currentFindRegionComb.Items.Add(info.ToolName);
         }
     }
     else if (bModifyModelROI && !bModifyFindROI && !bDrawFindROI)
     {
         bModifyModelROI = false;
         if (Info != null)
         {
             CircleParam circle = Info.ModelROIParam as CircleParam;
             if (circle != null)
             {
                 circle.CircleRow    = t1;
                 circle.CircleColumn = t2;
                 circle.Radius       = t3;
             }
         }
     }
     else if (!bModifyModelROI && !bModifyFindROI && bDrawFindROI)
     {
         bDrawFindROI = false;
         ShapeMatchToolInfo info = Infos.Find(p => p.ToolName == currentFindRegionComb.SelectedItem.ToString());
         if (info != null)
         {
             info.FindModelROIParam = new CircleParam()
             {
                 GraphName = currentFindRegionComb.SelectedItem.ToString(),
                 CircleRow = t1, CircleColumn = t2, Radius = t3
             };
         }
     }
     else if (!bModifyModelROI && bModifyFindROI && bDrawFindROI)
     {
         bDrawFindROI   = false;
         bModifyFindROI = false;
         ShapeMatchToolInfo info = Infos.Find(p => p.ToolName == currentFindRegionComb.SelectedItem.ToString());
         if (info != null)
         {
             CircleParam circle = info.FindModelROIParam as CircleParam;
             if (circle != null)
             {
                 circle.CircleRow    = t1;
                 circle.CircleColumn = t2;
                 circle.Radius       = t3;
             }
         }
     }
 }
Esempio n. 4
0
 private void DisplayForm_EllipseROIEvent(double t1, double t2, double t3, double t4, double t5)
 {
     if (!bModifyModelROI && !bModifyFindROI && !bDrawFindROI)
     {
         if (!string.IsNullOrEmpty(newModelName))
         {
             //Create a new setting info
             ShapeMatchToolInfo info = new ShapeMatchToolInfo();
             info.ToolName      = newModelName;
             info.ModelROIParam = new EllipseParam()
             {
                 EllipseCenterRow = t1, EllipseCenterColumn = t2, EllipseAngle = t3,
                 EllipseRadius1   = t4, EllipseRadius2 = t5, GraphName = newModelName
             };
             //Create a new match tool
             ShapeMatchTool tool = new ShapeMatchTool(info, displayForm);
             if (!tool.CreateMatchTool())
             {
                 MessageHelper.ShowError("模板创建失败,请重新创建");
                 return;
             }
             Infos.Add(info);
             Tools.Add(info.ToolName, tool);
             CurrentModelComb.Items.Add(info.ToolName);
             currentFindRegionComb.Items.Add(info.ToolName);
         }
     }
     else if (bModifyModelROI && !bModifyFindROI && !bDrawFindROI)
     {
         bModifyModelROI = false;
         if (Info != null)
         {
             EllipseParam ellipse = Info.ModelROIParam as EllipseParam;
             if (ellipse != null)
             {
                 ellipse.EllipseCenterRow    = t1;
                 ellipse.EllipseCenterColumn = t2;
                 ellipse.EllipseAngle        = t3;
                 ellipse.EllipseRadius1      = t4;
                 ellipse.EllipseRadius2      = t5;
             }
         }
     }
     else if (!bModifyModelROI && !bModifyFindROI && bDrawFindROI)
     {
         bDrawFindROI = false;
         ShapeMatchToolInfo info = Infos.Find(p => p.ToolName == currentFindRegionComb.SelectedItem.ToString());
         if (info != null)
         {
             info.FindModelROIParam = new EllipseParam()
             {
                 GraphName           = currentFindRegionComb.SelectedItem.ToString(),
                 EllipseCenterRow    = t1,
                 EllipseCenterColumn = t2,
                 EllipseAngle        = t3,
                 EllipseRadius1      = t4,
                 EllipseRadius2      = t5
             };
         }
     }
     else if (!bModifyModelROI && bModifyFindROI && bDrawFindROI)
     {
         bDrawFindROI   = false;
         bModifyFindROI = false;
         ShapeMatchToolInfo info = Infos.Find(p => p.ToolName == currentFindRegionComb.SelectedItem.ToString());
         if (info != null)
         {
             EllipseParam ellipse = info.FindModelROIParam as EllipseParam;
             if (ellipse != null)
             {
                 ellipse.EllipseCenterRow    = t1;
                 ellipse.EllipseCenterColumn = t2;
                 ellipse.EllipseAngle        = t3;
                 ellipse.EllipseRadius1      = t4;
                 ellipse.EllipseRadius2      = t5;
             }
         }
     }
 }