Esempio n. 1
0
 public override void CreateROI()
 {
     lock (lockObj)
     {
         if (Image != null)
         {
             Window.ClearWindow();
             HTuple[] values = new HTuple[] { Row1, Col1, Row2, Col2 };
             if (drawingObj.ID > -1)
             {
                 try
                 {
                     Window.DetachBackgroundFromWindow();
                     Window.DetachDrawingObjectFromWindow(drawingObj);
                     drawingObj.Dispose();
                 }
                 catch (Exception ex)
                 {
                     WriteErrorLog(ex.ToString());
                 }
             }
             drawingObj = HDrawingObject.CreateDrawingObject(HDrawingObject.HDrawingObjectType.RECTANGLE1, values);
             Window.AttachDrawingObjectToWindow(drawingObj);
             Window.AttachBackgroundToWindow(Image);
             base.SetDefaultSetting();
         }
     }
 }
Esempio n. 2
0
        private void ellipseToolStripMenuItem_Click(object sender, EventArgs e)
        {
            HDrawingObject ellipse = HDrawingObject.CreateDrawingObject(
                HDrawingObject.HDrawingObjectType.ELLIPSE, 50, 50, 0, 100, 50);

            ellipse.SetDrawingObjectParams("color", "blue");
            AttachDrawObj(ellipse);
        }
Esempio n. 3
0
        private void circleToolStripMenuItem_Click(object sender, EventArgs e)
        {
            HDrawingObject circle = HDrawingObject.CreateDrawingObject(
                HDrawingObject.HDrawingObjectType.CIRCLE, 200, 200, 70);

            circle.SetDrawingObjectParams("color", "magenta");
            AttachDrawObj(circle);
        }
Esempio n. 4
0
        private void rectangle2ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            HDrawingObject rect2 = HDrawingObject.CreateDrawingObject(
                HDrawingObject.HDrawingObjectType.RECTANGLE2, 100, 100, 0, 100, 50);

            rect2.SetDrawingObjectParams("color", "yellow");
            AttachDrawObj(rect2);
        }
Esempio n. 5
0
        private void rectangle1ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            HDrawingObject rect1 = HDrawingObject.CreateDrawingObject(
                HDrawingObject.HDrawingObjectType.RECTANGLE1, 100, 100, 210, 210);

            rect1.SetDrawingObjectParams("color", "green");
            AttachDrawObj(rect1);
        }
Esempio n. 6
0
        private void BtnDrawCircle_Click(object sender, EventArgs e)
        {
            HDrawingObject circle = HDrawingObject.CreateDrawingObject(
                HDrawingObject.HDrawingObjectType.CIRCLE, 200, 200, 70);

            circle.SetDrawingObjectParams("color", "green");
            visionControl1.AddOperations(cboOpera.Text);
            visionControl1.AttachDrawObj(circle);
        }
Esempio n. 7
0
        private void BtnDrawLine_Click(object sender, EventArgs e)
        {
            HDrawingObject line = HDrawingObject.CreateDrawingObject(
                HDrawingObject.HDrawingObjectType.LINE, 100, 100, 210, 210);

            line.SetDrawingObjectParams("color", "green");
            visionControl1.AddOperations(cboOpera.Text);
            visionControl1.AttachDrawObj(line);
        }
Esempio n. 8
0
        private void BtnDrawRectangle2_Click(object sender, EventArgs e)
        {
            HDrawingObject rect2 = HDrawingObject.CreateDrawingObject(
                HDrawingObject.HDrawingObjectType.RECTANGLE2, 100, 100, 0, 100, 50);

            rect2.SetDrawingObjectParams("color", "green");
            visionControl1.AddOperations(cboOpera.Text);
            visionControl1.AttachDrawObj(rect2);
        }
Esempio n. 9
0
        private void BtnDrawRectangle1_Click(object sender, EventArgs e)
        {
            HDrawingObject rect1 = HDrawingObject.CreateDrawingObject(
                HDrawingObject.HDrawingObjectType.RECTANGLE1, 100, 100, 210, 210);

            //  rect1.GetDrawingObjectParams(r);
            rect1.SetDrawingObjectParams("color", "green");
            visionControl1.AddOperations(cboOpera.Text);
            visionControl1.AttachDrawObj(rect1);
        }
Esempio n. 10
0
 void createRegion(double x1, double y1, double theta, double x2, double y2)
 {
     if (Drawing_Ob != null)
     {
         Drawing_Ob.Dispose();
     }
     Drawing_Ob = HDrawingObject.CreateDrawingObject(HDrawingObject.HDrawingObjectType.RECTANGLE2, x1, y1, theta, x2, y2);
     Drawing_Ob.SetDrawingObjectParams("color", "green");
     Drawing_Ob.OnDrag(getposistion);
     window.AttachDrawingObjectToWindow(Drawing_Ob);
 }
Esempio n. 11
0
        private void DrawRectangle(object sender, EventArgs e)
        {
            HTuple width, height;

            background_image = new HImage(ho_Image);
            background_image.GetImageSize(out width, out height);
            VideoWindow_hWindowControl.HalconWindow.SetPart(0, 0, height.I - 1, width.I - 1);
            VideoWindow_hWindowControl.HalconWindow.AttachBackgroundToWindow(background_image);


            GraphInteractiveObect.halconWindow.Focus();
            GraphInteractiveObect.graphic_stackClear();
            VideoWindow_hWindowControl.HalconWindow.ClearWindow();

            ObjectRoi = HDrawingObject.CreateDrawingObject(HDrawingObject.HDrawingObjectType.RECTANGLE2, ImageHeight / 2, ImageWidth / 2, 0, 300, 150);
            ObjectRoi.SetDrawingObjectParams("color", "yellow");
            GraphInteractiveObect.AttachDrawObj(ObjectRoi);
        }
Esempio n. 12
0
        private void BtnLoadRoi_Click(object sender, EventArgs e)
        {
            OpenFileDialog f = new OpenFileDialog();

            f.Filter = "ROI文件(.roi)|*.roi;";
            HTuple[] _params;
            if (f.ShowDialog() == DialogResult.OK)
            {
                List <ROI> r = LoadRoi(f.FileName);
                foreach (ROI region in r)
                {
                    _params = new HTuple[region.data.Count];
                    for (int i = 0; i < region.data.Count; i++)
                    {
                        _params[i] = region.data[i];
                    }
                    HDrawingObject obj = HDrawingObject.CreateDrawingObject(region.type, _params);
                    obj.SetDrawingObjectParams("color", "green");
                    visionControl1.AddOperations(region.operation);
                    visionControl1.AttachDrawObj(obj);
                }
            }
        }