/// <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) { } }
/// <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"); }
/// <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"); }
/// <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]); } } }