Ejemplo n.º 1
0
        /// <summary>Paints the ROI into the supplied window</summary>
        /// <param name="window">HALCON window</param>
        public override void draw(HalconDotNet.HWindow window)
        {
            //畫個 x
            double crossSize  = 12;
            double crossAngle = 0.785398;

            //Reset line Style
            HOperatorSet.SetLineStyle(window, null);
            if (!_initPointsDone)
            {
                foreach (var dot in _clickedPointsPositionList)
                {
                    HOperatorSet.DispCross(window, dot.RowBegin, dot.ColBegin, crossSize, crossAngle);
                }
            }
            else
            {
                //畫弧線
                contour.Dispose();
                contour.GenCircleContourXld(midR, midC, radius, _startPhi,
                                            (_startPhi + _extentPhi), _pointOrder, 1.0);

                this._beginRow = midR + Math.Sin(_startPhi) * radius;
                this._beginCol = midC + Math.Cos(_startPhi) * radius;

                window.DispObj(contour);
                drawOuterArc(window);

                //畫控制點
                window.DispRectangle2(sizeR, sizeC, 0, 5, 5);
                window.DispRectangle2(midR, midC, 0, 5, 5);
                window.DispRectangle2(startR, startC, _startPhi, 10, 2);
                window.DispObj(arrowHandleXLD);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Paints the active handle of the ROI object into the supplied window
        /// </summary>
        public override void displayActive(HalconDotNet.HWindow window)
        {
            if (!_initPointsDone)
            {
                return;
            }
            switch (activeHandleIdx)
            {
            case 0:
                window.DispRectangle2(midR, midC, 0, 5, 5);
                break;

            case 1:
                window.DispRectangle2(sizeR, sizeC, 0, 5, 5);
                break;

            case 2:
                window.DispRectangle2(startR, startC, _startPhi, 10, 2);
                break;

            case 3:
                window.DispObj(arrowHandleXLD);
                break;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Paints the active handle of the ROI object into the supplied window
        /// </summary>
        /// <param name="window">HALCON window</param>
        public override void displayActive(HalconDotNet.HWindow window)
        {
            window.SetDraw("margin");
            double num = 5.0;

            if (this.activeHandleIdx < this.row1.TupleLength())
            {
                window.DispRectangle2(this.row1[this.activeHandleIdx].D, this.col1[this.activeHandleIdx].D, 0.0, num, num);
            }
            else if (this.activeHandleIdx < this.row1.TupleLength() + this.row2.TupleLength())
            {
                window.DispCircle(this.row2[this.activeHandleIdx - this.row1.TupleLength()].D,
                                  this.col2[this.activeHandleIdx - this.row1.TupleLength()].D, num);
            }
            else if (this.activeHandleIdx == this.row1.TupleLength() + this.row2.TupleLength())
            {
                window.DispRectangle2(midR, midC, 0, num, num);
            }
            else
            {
                for (int i = 0; i < this.row1.TupleLength() - 1; i++)
                {
                    window.DispLine(this.row1[i].D, this.col1[i].D, this.row1[i + 1].D, this.col1[i + 1].D);
                }
                window.DispLine(this.row1[0].D, this.col1[0].D, this.row1[this.row1.TupleLength() - 1].D,
                                this.col1[this.row1.TupleLength() - 1].D);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        ///  显示没有选中的操作点
        /// </summary>
        /// <param name="number"></param>
        /// <param name="hwin"></param>
        void no_chice_point(int number, HalconDotNet.HWindow hwin)
        {
            switch (number)
            {
            case 0:
                hwin.DispRectangle2(this._row_y1, this._col_x1, 0, 5, 5);
                break;

            case 1:
                hwin.DispRectangle2(this._row_y1, this._col_x2, 0, 5, 5);
                break;

            case 2:
                hwin.DispRectangle2(this._row_y2, this._col_x1, 0, 5, 5);
                break;

            case 3:
                hwin.DispRectangle2(this._row_y2, this._col_x2, 0, 5, 5);
                break;

            case 4:
                hwin.DispRectangle2(this._mid_row_y, this._mid_col_x, 0, 5, 5);
                break;
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Paints the active handle of the ROI object into the supplied window
        /// </summary>
        /// <param name="window">HALCON window</param>
        public override void displayActive(HalconDotNet.HWindow window)
        {
            if (!SizeEnable || !ShowRect)
            {
                return;
            }

            switch (activeHandleIdx)
            {
            case 0:
                window.DispRectangle2(row1, col1, 0, smallregionwidth, smallregionwidth);
                break;

            case 1:
                window.DispRectangle2(row1, col2, 0, smallregionwidth, smallregionwidth);
                break;

            case 2:
                window.DispRectangle2(row2, col2, 0, smallregionwidth, smallregionwidth);
                break;

            case 3:
                window.DispRectangle2(row2, col1, 0, smallregionwidth, smallregionwidth);
                break;

            case 4:
                window.DispRectangle2(midR, midC, 0, smallregionwidth, smallregionwidth);
                break;
            }
        }
Ejemplo n.º 6
0
 /// <summary>Paints the ROI into the supplied window.</summary>
 public override void draw(HalconDotNet.HWindow window)
 {
     window.DispLine(row1, col1, row2, col2);
     window.DispRectangle2(row1, col1, 0, 5, 5);
     window.DispObj(arrowHandleXLD);              //window.DispRectangle2( row2, col2, 0, 5, 5);
     window.DispRectangle2(midR, midC, 0, 5, 5);
 }
        /// <summary>Paints the ROI into the supplied window</summary>
        /// <param name="window">HALCON window</param>
        public override void draw(HalconDotNet.HWindow window)
        {
            //畫個 x
            double crossSize  = 12;
            double crossAngle = 0.785398;

            //Reset line Style
            HOperatorSet.SetLineStyle(window, null);
            if (!_initPointsDone)
            {
                foreach (var dot in _clickedPointsPositionList)
                {
                    HOperatorSet.DispCross(window, dot.RowBegin, dot.ColBegin, crossSize, crossAngle);
                }
            }
            else
            {
                window.DispCircle(midR, midC, radius);

                var w = _HandleRectangleWidth * _ZoomRatio;
                var h = _HandleRectangleHeight * _ZoomRatio;
                window.DispRectangle2(row1, col1, 0, w, h);
                window.DispRectangle2(midR, midC, 0, w, h);
            }
        }
Ejemplo n.º 8
0
        /// <summary>Paints the ROI into the supplied window</summary>
        /// <param name="window">HALCON window</param>
        public override void draw(HalconDotNet.HWindow window)
        {
            //畫個 x
            double crossSize  = 12;
            double crossAngle = 0.785398;

            HTuple dotLineStyle = new HTuple(new int[4] {
                7, 7, 7, 7
            });

            //Reset line Style
            HOperatorSet.SetLineStyle(window, null);
            if (!_initPointsDone)
            {
                foreach (var dot in _clickedPointsPositionList)
                {
                    HOperatorSet.DispCross(window, dot.RowBegin, dot.ColBegin, crossSize, crossAngle);
                }
            }
            else
            {
                //畫中心點
                window.DispRectangle2(midR, midC, -phi, length1, length2);

                //畫其它的控制點
                for (int i = 0; i < NumHandles; i++)
                {
                    window.DispRectangle2(rows[i].D, cols[i].D, -phi, 5, 5);
                }
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 显示ROI
        /// </summary>
        /// <param name="hwin"></param>
        public override void displayROI(HalconDotNet.HWindow hwin)
        {
            hwin.DispLine(this._row_y1, this._cols_x1, this._row_y2, this._cols_x2);

            if (this._operationing == -1)
            {
                hwin.DispRectangle2(_row_y1, _cols_x1, 0, 5, 5);
                hwin.DispRectangle2(_row_y2, _cols_x2, 0, 5, 5);
                hwin.DispRectangle2(this._mid_row_y, this._mid_col_x, 0, 5, 5);
            }
            else
            {
                for (int i = 0; i < _operation_piont_number; i++)
                {
                    if (i == _operationing)
                    {
                        displayOperation(i, hwin);
                    }
                    else
                    {
                        no_chice_point(i, hwin);
                    }
                }
            }
        }
Ejemplo n.º 10
0
        public int windowsmallregionwidth = 5;//4边小矩形的大小
        /// <summary>Paints the ROI into the supplied window</summary>
        /// <param name="window">HALCON window</param>
        public override void draw(HalconDotNet.HWindow window)
        {
            window.DispRectangle1(row1, col1, row2, col2);
            if (SizeEnable && ShowRect)
            {
                int hrow, hcol, hw, hh;
                window.GetPart(out hrow, out hcol, out hh, out hw);
                int wrow, wcol, ww, wh;
                window.GetWindowExtents(out wrow, out wcol, out ww, out wh);

                double smallregionwidth  = (hw - hcol) * windowsmallregionwidth / ww;
                double smallregionheight = (hh - hrow) * windowsmallregionwidth / wh;
                //焦点小矩形最小为5
                if (smallregionwidth < 5)
                {
                    smallregionwidth = 5;
                }
                if (smallregionheight < 5)
                {
                    smallregionheight = 5;
                }

                window.DispRectangle2(row1, col1, 0, smallregionheight, smallregionwidth);
                window.DispRectangle2(row1, col2, 0, smallregionheight, smallregionwidth);
                window.DispRectangle2(row2, col2, 0, smallregionheight, smallregionwidth);
                window.DispRectangle2(row2, col1, 0, smallregionheight, smallregionwidth);
                window.DispRectangle2(midR, midC, 0, smallregionheight, smallregionwidth);
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Paints the active handle of the ROI object into the supplied window.
        /// </summary>
        public override void displayActive(HalconDotNet.HWindow window)
        {
            if (!SizeEnable || !ShowRect)
            {
                return;
            }
            int hrow, hcol, hw, hh;

            window.GetPart(out hrow, out hcol, out hh, out hw);
            int wrow, wcol, ww, wh;

            window.GetWindowExtents(out wrow, out wcol, out ww, out wh);

            double smallregionwidth  = (hw - hcol) * windowsmallregionwidth / ww;
            double smallregionheight = (hh - hrow) * windowsmallregionwidth / wh;

            switch (activeHandleIdx)
            {
            case 0:
                window.DispRectangle2(row1, col1, 0, smallregionheight, smallregionwidth);
                break;

            case 1:
                window.DispObj(arrowHandleXLD);                         //window.DispRectangle2(row2, col2, 0, 5, 5);
                break;

            case 2:
                window.DispRectangle2(midR, midC, 0, smallregionheight, smallregionwidth);
                break;
            }
        }
Ejemplo n.º 12
0
 /// <summary>
 /// 显示ROI
 /// </summary>
 /// <param name="hwin"></param>
 public override void displayROI(HalconDotNet.HWindow hwin)
 {
     hwin.DispRectangle2(this._mid_row_y, this._mid_col_x, -this._phi, this._len1, this._len2);
     hwin.DispLine(this._mid_row_y, this._mid_col_x, this._rows_y[5], this._cols_x[5]);
     if (this._operationing == -1)
     {
         //hwin.DispRectangle2(this.in
         for (int i = 0; i < this._operation_piont_number; i++)
         {
             hwin.DispRectangle2(this._rows_y[i].D, this._cols_x[i].D, -this._phi, 5, 5);
         }
     }
     else
     {
         for (int i = 0; i < this._operation_piont_number; i++)
         {
             if (i == this._operationing)
             {
                 displayOperation(i, hwin);
             }
             else
             {
                 no_chice_point(i, hwin);
             }
         }
     }
 }
Ejemplo n.º 13
0
        /// <summary>
        /// Paints the active handle of the ROI object into the supplied window
        /// </summary>
        /// <param name="window">HALCON window</param>
        public override void displayActive(HalconDotNet.HWindow window)
        {
            switch (activeHandleIdx)
            {
            case 0:
                window.DispRectangle2(row1, col1, 0, 5, 5);
                break;

            case 1:
                window.DispRectangle2(row1, col2, 0, 5, 5);
                break;

            case 2:
                window.DispRectangle2(row2, col2, 0, 5, 5);
                break;

            case 3:
                window.DispRectangle2(row2, col1, 0, 5, 5);
                break;

            case 4:
                window.DispRectangle2(midR, midC, 0, 5, 5);
                break;
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Paints the active handle of the ROI object into the supplied window
        /// </summary>
        /// <param name="window">HALCON window</param>
        public override void DisplayActive(HalconDotNet.HWindow window)
        {
            int width = GetHandleWidth();

            switch (activeHandleIdx)
            {
            case 0:
                window.DispRectangle2(row1, col1, 0, width, width);
                break;

            case 1:
                window.DispRectangle2(row1, col2, 0, width, width);
                break;

            case 2:
                window.DispRectangle2(row2, col2, 0, width, width);
                break;

            case 3:
                window.DispRectangle2(row2, col1, 0, width, width);
                break;

            case 4:
                window.DispRectangle2(midR, midC, 0, width, width);
                break;
            }
        }
Ejemplo n.º 15
0
        /// <summary>将ROI绘制到提供的窗口中</summary>
        /// <param name="window">HALCON window</param>
        public override void draw(HalconDotNet.HWindow window)
        {
            window.DispLine(midR + Math.Sin(phi) * length1,
                            midC + Math.Cos(phi) * length1,
                            midR + (Math.Sin(phi) * (length1 + 30)),
                            midC + (Math.Cos(phi) * (length1 + 30)));

            for (int i = 0; i < PointNum; i++)
            {
                window.DispRectangle2(midR + (-length1 + length1 / PointNum + length1 * 2 / PointNum * i) * Math.Sin(phi),
                                      midC + (-length1 + length1 / PointNum + length1 * 2 / PointNum * i) * Math.Cos(phi), -phi, length1 / PointNum, length2);
            }
            window.SetDraw("fill");
            for (int i = 0; i < NumHandles - 1; i++)
            {
                window.DispRectangle2(rows[i].D, cols[i].D, -phi, 10, 10);
            }
            window.DispCircle((midR + Math.Sin(phi) * (length1 + 36)), (midC + Math.Cos(phi) * (length1 + 36)), 12);
            window.SetLineWidth(5);
            window.DispArrow(midR - (Math.Sin(phi - Math.PI / 2) * (length2 - 10)),
                             midC - (Math.Cos(phi - Math.PI / 2) * (length2 - 10)),
                             midR - (Math.Sin(phi - Math.PI / 2) * length2),
                             midC - (Math.Cos(phi - Math.PI / 2) * length2), 2.0);
            window.SetLineWidth(1);
            window.SetDraw("margin");
        }
Ejemplo n.º 16
0
        /// <summary>Paints the ROI into the supplied window.</summary>
        public override void draw(HalconDotNet.HWindow window, int imageWidth, int imageHeight)
        {
            window.DispLine(row1, col1, row2, col2);

            window.DispRectangle2(row1, col1, 0, 8, 8);
            window.DispObj(arrowHandleXLD);              //window.DispRectangle2( row2, col2, 0, 25, 25);
            window.DispRectangle2(midR, midC, 0, 8, 8);
        }
Ejemplo n.º 17
0
 /// <summary>Paints the ROI into the supplied window</summary>
 /// <param name="window">HALCON window</param>
 public override void Draw(HalconDotNet.HWindow window)
 {
     window.DispCircle(midR, midC, out_Radius);
     window.DispCircle(midR, midC, inner_Radius);
     window.DispRectangle2(out_Row1, out_Col1, 0, RoiDrawConfig.PaneWidth, RoiDrawConfig.PaneWidth);
     window.DispRectangle2(inner_Row1, inner_Col1, 0, RoiDrawConfig.PaneWidth, RoiDrawConfig.PaneWidth);
     window.DispRectangle2(midR, midC, 0, RoiDrawConfig.PaneWidth, RoiDrawConfig.PaneWidth);
 }
Ejemplo n.º 18
0
 /// <summary>Paints the ROI into the supplied window.</summary>
 public override void draw(HalconDotNet.HWindow window)
 {
     window.SetLineStyle(new HTuple(10, 30));
     window.DispLine(row1, col1, row2, col2);
     window.SetLineStyle(new HTuple());
     window.DispRectangle2(row1, col1, 0, 5, 5);
     /*window.DispObj(arrowHandleXLD);*/ window.DispRectangle2(row2, col2, 0, 5, 5);
     window.DispRectangle2(midR, midC, 0, 5, 5);
 }
Ejemplo n.º 19
0
 /// <summary>Paints the ROI into the supplied window</summary>
 /// <param name="window">HALCON window</param>
 public override void draw(HalconDotNet.HWindow window)
 {
     window.DispCircle(midR, midC, radius);
     if (SizeEnable && ShowRect)
     {
         window.DispRectangle2(row1, col1, 0, 5, 5);
         window.DispRectangle2(midR, midC, 0, 5, 5);
     }
 }
Ejemplo n.º 20
0
 /// <summary>Paints the ROI into the supplied window</summary>
 /// <param name="window">HALCON window</param>
 public override void draw(HalconDotNet.HWindow window)          //显示可以激活的句柄
 {
     window.DispRectangle1(row1, col1, row2, col2);
     window.DispRectangle2(row1, col1, 0, 5, 5);
     window.DispRectangle2(row1, col2, 0, 5, 5);
     window.DispRectangle2(row2, col2, 0, 5, 5);
     window.DispRectangle2(row2, col1, 0, 5, 5);
     window.DispRectangle2(midR, midC, 0, 5, 5);
 }
Ejemplo n.º 21
0
        /// <summary>Paints the ROI into the supplied window</summary>
        /// <param name="window">HALCON window</param>
        public override void draw(HalconDotNet.HWindow window)
        {
            window.DispCircle(midR, midC, radius);

            var w = _HandleRectangleWidth * _ZoomRatio;
            var h = _HandleRectangleHeight * _ZoomRatio;

            window.DispRectangle2(row1, col1, 0, w, h);
            window.DispRectangle2(midR, midC, 0, w, h);
        }
Ejemplo n.º 22
0
        /// <summary>Paints the ROI into the supplied window</summary>
        /// <param name="window">HALCON window</param>
        public override void draw(HalconDotNet.HWindow window)
        {
            window.DispRectangle2(midR, midC, -phi, length1, length2);
            for (int i = 0; i < NumHandles; i++)
            {
                window.DispRectangle2(rows[i].D, cols[i].D, -phi, 5, 5);
            }

            window.DispArrow(midR, midC, midR + (Math.Sin(phi) * length1 * 1.2),
                             midC + (Math.Cos(phi) * length1 * 1.2), 2.0);
        }
Ejemplo n.º 23
0
        /// <summary>Paints the ROI into the supplied window</summary>
        /// <param name="window">HALCON window</param>
        public override void draw(HalconDotNet.HWindow window)
        {
            window.DispRectangle1(row1, col1, row2, col2);

            window.DispRectangle2(row1, col1, 0, 5, 5);
            window.DispRectangle2(row1, col2, 0, 5, 5);
            window.DispRectangle2(row2, col2, 0, 5, 5);
            window.DispRectangle2(row2, col1, 0, 5, 5);
            window.DispCross(midR, midC, 10, 0);
            //window.DispRectangle2(midR, midC, 0, 5, 5);
        }
Ejemplo n.º 24
0
 /// <summary>Paints the ROI into the supplied window.</summary>
 public override void draw(HalconDotNet.HWindow window, bool include)
 {
     window.SetColor(regionColor);
     window.DispLine(row1, col1, row2, col2);
     if (include)
     {
         window.DispRectangle2(row1, col1, 0, 5, 5);
         window.DispRectangle2(midR, midC, 0, 5, 5);
     }
     window.DispObj(arrowHandleXLD);              //window.DispRectangle2( row2, col2, 0, 5, 5);
 }
Ejemplo n.º 25
0
 /// <summary>Paints the ROI into the supplied window</summary>
 /// <param name="window">HALCON window</param>
 public override void draw(HalconDotNet.HWindow window)
 {
     contour.Dispose();
     contour.GenCircleContourXld(midR, midC, radius, startPhi,
                                 (startPhi + extentPhi), circDir, 1.0);
     window.DispObj(contour);
     window.DispRectangle2(sizeR, sizeC, 0, 5, 5);
     window.DispRectangle2(midR, midC, 0, 5, 5);
     window.DispRectangle2(startR, startC, startPhi, 10, 2);
     window.DispObj(arrowHandleXLD);
 }
Ejemplo n.º 26
0
 /// <summary>Paints the ROI into the supplied window</summary>
 /// <param name="window">HALCON window</param>
 public override void draw(HalconDotNet.HWindow window, bool include)
 {
     window.SetColor(regionColor);
     window.SetDraw("margin");
     window.DispCircle(midR, midC, radius);
     if (include)
     {
         window.DispRectangle2(row1, col1, 0, 5, 5);
         window.DispRectangle2(midR, midC, 0, 5, 5);
     }
 }
Ejemplo n.º 27
0
        /// <summary>绘制圆形坐标在窗体上</summary>
        /// <param name="window">HALCON 窗体</param>
        public override void Draw(HalconDotNet.HWindow window)
        {
            //显示圆
            window.DispCircle(midR, midC, radius);

            int width = GetHandleWidth();

            //显示两个控制框
            window.DispRectangle2(row1, col1, 0, width, width);
            window.DispRectangle2(midR, midC, 0, width, width);
        }
Ejemplo n.º 28
0
        /// <summary>Paints the ROI into the supplied window</summary>
        /// <param name="window">HALCON window</param>
        public override void Draw(HalconDotNet.HWindow window)
        {
            window.DispRectangle1(row1, col1, row2, col2);

            int width = GetHandleWidth();

            window.DispRectangle2(row1, col1, 0, width, width);
            window.DispRectangle2(row1, col2, 0, width, width);
            window.DispRectangle2(row2, col2, 0, width, width);
            window.DispRectangle2(row2, col1, 0, width, width);
            window.DispRectangle2(midR, midC, 0, width, width);
        }
Ejemplo n.º 29
0
 /// <summary>Paints the ROI into the supplied window</summary>
 /// <param name="window">HALCON window</param>
 public override void draw(HalconDotNet.HWindow window)
 {
     window.DispRectangle1(row1, col1, row2, col2);
     if (SizeEnable && ShowRect)
     {
         window.DispRectangle2(row1, col1, 0, smallregionwidth, smallregionwidth);
         window.DispRectangle2(row1, col2, 0, smallregionwidth, smallregionwidth);
         window.DispRectangle2(row2, col2, 0, smallregionwidth, smallregionwidth);
         window.DispRectangle2(row2, col1, 0, smallregionwidth, smallregionwidth);
         window.DispRectangle2(midR, midC, 0, smallregionwidth, smallregionwidth);
     }
 }
Ejemplo n.º 30
0
        public void Draw2(HalconDotNet.HWindow window)
        {
            HTuple data = base.GetModeData();

            //ROI矩形
            window.DispRectangle2(data[0].D, data[1], data[2], data[3], data[4]);


            window.DispRectangle2(data[0].D, data[1], data[2], 5, 5);
            window.DispRectangle2(data[0] - (0.8 * data[3] * Math.Sin(data[2])), data[1] + 0.8 * (data[3] * Math.Cos(data[2])), data[2], 5, 5);
            //注:矩形右边的中点坐标(_locateRow-_length1*Sine(angle),_locateCol+_length2*Cosine(angle)),为使箭头超出一点,故而用系数1.3修正
            window.DispArrow(data[0], data[1], data[0] - (1.3 * data[3] * Math.Sin(data[2])), data[1] + 1.3 * (data[3] * Math.Cos(data[2])), 6);
        }