Exemple #1
0
        /// <summary>
        /// Repaints the HALCON window 'window'
        /// </summary>
        public void repaint(hvppleDotNet.HWindow window)
        {
            try
            {
                int          count = HObjImageList.Count;
                HObjectEntry entry;

                HSystem.SetSystem("flush_graphic", "false");
                window.ClearWindow();
                mGC.stateOfSettings.Clear();

                //显示图片及文字
                showHObjectList();

                //显示region
                showHRegionList();

                //显示ROI
                showROIList();

                showHat(window);

                showBorder(window);

                HSystem.SetSystem("flush_graphic", "true");

                //注释了下面语句,会导致窗口无法实现缩放和拖动
                window.SetColor("dim gray");
                window.DispLine(-100.0, -100.0, -101.0, -101.0);
            }
            catch (Exception exc)
            {
            }
        }
Exemple #2
0
        /// <summary>
        /// Paints all objects from the ROIList into the HALCON window
        /// </summary>
        /// <param name="window">HALCON window</param>
        public void paintData(hvppleDotNet.HWindow window)
        {
            window.SetDraw("margin");
            window.SetLineWidth(1);

            if (ROIList.Count > 0)
            {
                //
                //window.SetColor(inactiveCol);

                window.SetDraw("margin");

                for (int i = 0; i < ROIList.Count; i++)
                {
                    window.SetColor(((ROI)ROIList[i]).Color);
                    window.SetLineStyle(((ROI)ROIList[i]).flagLineStyle);
                    ((ROI)ROIList[i]).draw(window, Convert.ToInt32(viewController.ImgCol2 - viewController.ImgCol1), Convert.ToInt32(viewController.ImgRow2 - viewController.ImgRow1));
                }

                if (activeROIidx != -1)
                {
                    window.SetColor(activeCol);
                    window.SetLineStyle(((ROI)ROIList[activeROIidx]).flagLineStyle);
                    ((ROI)ROIList[activeROIidx]).draw(window, Convert.ToInt32(viewController.ImgCol2 - viewController.ImgCol1), Convert.ToInt32(viewController.ImgRow2 - viewController.ImgRow1));

                    window.SetColor(activeHdlCol);
                    ((ROI)ROIList[activeROIidx]).displayActive(window, Convert.ToInt32(viewController.ImgCol2 - viewController.ImgCol1), Convert.ToInt32(viewController.ImgRow2 - viewController.ImgRow1));
                }
            }
        }
Exemple #3
0
        /// <summary>
        /// Paints the active handle of the ROI object into the supplied window
        /// </summary>
        public override void displayActive(hvppleDotNet.HWindow window, int imageWidth, int imageHeight)
        {
            double littleRecSize = getHandleWidth(imageWidth, imageHeight);

            window.SetDraw("fill");
            switch (activeHandleIdx)
            {
            case 0:
                window.DispRectangle2(midR, midC, 0, littleRecSize, littleRecSize);
                break;

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

            case 2:
                window.DispRectangle2(startR, startC, startPhi, littleRecSize, littleRecSize);
                break;

            case 3:
                window.DispRectangle2(extentR, extentC, 0, littleRecSize, littleRecSize);
                break;
            }
            window.SetDraw("margin");
        }
Exemple #4
0
        /// <summary>Paints the ROI into the supplied window.</summary>
        public override void draw(hvppleDotNet.HWindow window, int imageWidth, int imageHeight)
        {
            window.DispLine(row1, col1, row2, col2);
            window.DispObj(arrowHandleXLD);              //window.DispRectangle2( row2, col2, 0, 25, 25);

            window.SetDraw("fill");
            window.DispRectangle2(row1, col1, 0, 8, 8);
            window.DispRectangle2(midR, midC, 0, 8, 8);
            window.SetDraw("margin");
        }
Exemple #5
0
        /// <summary>Paints the ROI into the supplied window</summary>
        /// <param name="window">HALCON window</param>
        public override void draw(hvppleDotNet.HWindow window, int imageWidth, int imageHeight)
        {
            window.DispCircle(midR, midC, radius);

            double littleRecSize = getHandleWidth(imageWidth, imageHeight);

            window.SetDraw("fill");
            window.DispRectangle2(row1, col1, 0, littleRecSize, littleRecSize);
            window.DispRectangle2(midR, midC, 0, littleRecSize, littleRecSize);
            window.SetDraw("margin");
        }
Exemple #6
0
        /// <summary>Paints the ROI into the supplied window</summary>
        /// <param name="window">HALCON window</param>
        public override void draw(hvppleDotNet.HWindow window, int imageWidth, int imageHeight)
        {
            double littleRecSize = getHandleWidth(imageWidth, imageHeight);

            window.DispRectangle2(midR, midC, -phi, length1, length2);
            window.DispArrow(midR, midC, midR + (Math.Sin(phi) * length1 * 1.2), midC + (Math.Cos(phi) * length1 * 1.2), littleRecSize);

            window.SetDraw("fill");
            for (int i = 0; i < NumHandles; i++)
            {
                window.DispRectangle2(rows[i].D, cols[i].D, -phi, littleRecSize, littleRecSize);
                Application.DoEvents();
            }
            window.SetDraw("margin");
        }
Exemple #7
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(hvppleDotNet.HWindow window, int imageWidth, int imageHeight)
        {
            double littleRecSize = getHandleWidth(imageWidth, imageHeight);

            window.SetDraw("fill");
            switch (activeHandleIdx)
            {
            case 0:
                window.DispRectangle2(row1, col1, 0, littleRecSize, littleRecSize);
                break;

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

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

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

            case 4:
                window.DispRectangle2(midR, midC, 0, littleRecSize, littleRecSize);
                break;

            case 5:
                //window.DispRectangle2((row1 + row2) / 2, col1, 0, littleRecSize, littleRecSize);
                break;

            case 6:
                //window.DispRectangle2((row1 + row2) / 2, col2, 0, littleRecSize, littleRecSize);
                break;

            case 7:
                //window.DispRectangle2(row1, (col1 + col2) / 2, 0, littleRecSize, littleRecSize);
                break;

            case 8:
                //window.DispRectangle2(row2, (col1 + col2) / 2, 0, littleRecSize, littleRecSize);
                break;
            }
            window.SetDraw("margin");
        }
Exemple #8
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(hvppleDotNet.HWindow window, int imageWidth, int imageHeight)
        {
            double littleRecSize = getHandleWidth(imageWidth, imageHeight);

            window.SetDraw("fill");
            window.DispRectangle2(rows[activeHandleIdx].D,
                                  cols[activeHandleIdx].D,
                                  -phi, littleRecSize, littleRecSize);

            if (activeHandleIdx == 5)
            {
                window.DispArrow(midR, midC,
                                 midR + (Math.Sin(phi) * length1 * 1.2),
                                 midC + (Math.Cos(phi) * length1 * 1.2),
                                 littleRecSize);
            }
            window.SetDraw("margin");
        }
Exemple #9
0
        /// <summary>Paints the ROI into the supplied window</summary>
        /// <param name="window">HALCON window</param>
        public override void draw(hvppleDotNet.HWindow window, int imageWidth, int imageHeight)
        {
            double littleRecSize = getHandleWidth(imageWidth, imageHeight);

            window.DispRectangle1(row1, col1, row2, col2);

            window.SetDraw("fill");
            window.DispRectangle2(row1, col1, 0, littleRecSize, littleRecSize);
            window.DispRectangle2(row1, col2, 0, littleRecSize, littleRecSize);
            window.DispRectangle2(row2, col2, 0, littleRecSize, littleRecSize);
            window.DispRectangle2(row2, col1, 0, littleRecSize, littleRecSize);
            window.DispRectangle2(midR, midC, 0, littleRecSize, littleRecSize);
            //window.DispRectangle2((row1 + row2) / 2, col1, 0, littleRecSize, littleRecSize);
            //window.DispRectangle2((row1 + row2) / 2, col2, 0, littleRecSize, littleRecSize);
            //window.DispRectangle2(row1, (col1 + col2) / 2, 0, littleRecSize, littleRecSize);
            //window.DispRectangle2(row2, (col1 + col2) / 2, 0, littleRecSize, littleRecSize);
            window.SetDraw("margin");
        }
Exemple #10
0
        /// <summary>
        /// Paints the active handle of the ROI object into the supplied window.
        /// </summary>
        public override void displayActive(hvppleDotNet.HWindow window, int imageWidth, int imageHeight)
        {
            window.SetDraw("fill");
            switch (activeHandleIdx)
            {
            case 0:
                window.DispRectangle2(row1, col1, 0, 8, 8);
                break;

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

            case 2:
                window.DispRectangle2(midR, midC, 0, 8, 8);
                break;
            }
            window.SetDraw("margin");
        }
Exemple #11
0
        /// <summary>Paints the ROI into the supplied window</summary>
        /// <param name="window">HALCON window</param>
        public override void draw(hvppleDotNet.HWindow window, int imageWidth, int imageHeight)
        {
            contour.Dispose();
            contour.GenCircleContourXld(midR, midC, radius, startPhi,
                                        (startPhi + extentPhi), circDir, 1.0);

            double littleRecSize = getHandleWidth(imageWidth, imageHeight);

            window.DispObj(contour);
            window.DispLine(startR, startC, midR, midC);
            window.DispLine(extentR, extentC, midR, midC);

            window.SetDraw("fill");
            window.DispRectangle2(sizeR, sizeC, 0, littleRecSize, littleRecSize);
            window.DispRectangle2(midR, midC, 0, littleRecSize, littleRecSize);
            window.DispRectangle2(startR, startC, startPhi, littleRecSize, littleRecSize);
            window.DispRectangle2(extentR, extentC, 0, littleRecSize, littleRecSize);
            window.SetDraw("margin");
        }
Exemple #12
0
        /// <summary>Creates a new ROI instance at the mouse position</summary>
        /// <param name="midX">
        /// x (=column) coordinate for interactive ROI
        /// </param>
        /// <param name="midY">
        /// y (=row) coordinate for interactive ROI
        /// </param>
        ////public override void createROI(List<double> rows, List<double> cols)
        ////{
        ////    //////midR = midY;
        ////    //////midC = midX;

        ////    //////row1 = midR - 25;
        ////    //////col1 = midC - 25;
        ////    //////row2 = midR + 25;
        ////    //////col2 = midC + 25;
        ////}

        /// <summary>Paints the ROI into the supplied window</summary>
        /// <param name="window">HALCON window</param>
        public override void draw(hvppleDotNet.HWindow window, int imageWidth, int imageHeight)
        {
            double littleRecSize = getHandleWidth(imageWidth, imageHeight);

            ////// window.DispObj (row1, col1, row2, col2);

            for (int i = 0; i < rows.Length; i++)
            {
                window.SetDraw("fill");
                window.DispRectangle2(rows[i], cols[i], 0, littleRecSize, littleRecSize);
                window.SetDraw("margin");

                if (i < rows.Length - 1)
                {
                    window.DispLine((HTuple)rows[i], (HTuple)cols[i], (HTuple)rows[i + 1], (HTuple)cols[i + 1]);
                }
                else
                {
                    window.DispLine((HTuple)rows[i], (HTuple)cols[i], (HTuple)rows[0], (HTuple)cols[0]);
                }
            }
        }
Exemple #13
0
 /// <summary>
 /// Paints the active handle of the ROI object into the supplied window.
 /// </summary>
 /// <param name="window">HALCON window</param>
 public virtual void displayActive(hvppleDotNet.HWindow window, int imageWidth, int imageHeight)
 {
 }
Exemple #14
0
 /// <summary>Paints the ROI into the supplied window.</summary>
 /// <param name="window">HALCON window</param>
 public virtual void draw(hvppleDotNet.HWindow window, int imageWidth, int imageHeight)
 {
 }