/// <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); } }
/// <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) { //20180315 //window.DispRectangle2(rows[activeHandleIdx].D, // cols[activeHandleIdx].D, // -phi, 5, 5); //if (activeHandleIdx == 5) // window.DispArrow(midR, midC, // midR + (Math.Sin(phi) * length1 * 1.2), // midC + (Math.Cos(phi) * length1 * 1.2), // 2.0); window.DispRectangle2(rows[activeHandleIdx].D, cols[activeHandleIdx].D, -phi, 5, 5); if (activeHandleIdx == 5) { window.DispArrow(midR, midC, midR + (Math.Sin(-phi) * length1 * 1.2), midC + (Math.Cos(phi) * length1 * 1.2), 2.0); } }
/// <summary> /// Paints all objects from the ROIList into the HALCON window /// </summary> /// <param name="window">HALCON window</param> public void paintData(HalconDotNet.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.SetLineStyle(((ROI)ROIList[i]).flagLineStyle); ((ROI)ROIList[i]).draw(window); } if (activeROIidx != -1) { window.SetColor(activeCol); window.SetLineStyle(((ROI)ROIList[activeROIidx]).flagLineStyle); ((ROI)ROIList[activeROIidx]).draw(window); window.SetColor(activeHdlCol); ((ROI)ROIList[activeROIidx]).displayActive(window); } } }
/// <summary> /// Paints all objects from the ROIList into the HALCON window /// </summary> /// <param name="window">HALCON window</param> public void paintData(HalconDotNet.HWindow window) { if (isShowROI) { 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.SetLineStyle(((ROI)ROIList[i]).flagLineStyle); ((ROI)ROIList[i]).draw(window, false); window.SetColor("orange");//可以控制显示ROI编号,与HDisplay内的显示重复 double[] p = ((ROI)ROIList[i]).GetPosition(); window.SetTposition((int)p[0], (int)p[1]); window.WriteString(i.ToString()); } if (activeROIidx != -1) { window.SetColor(activeCol); window.SetLineStyle(((ROI)ROIList[activeROIidx]).flagLineStyle); ((ROI)ROIList[activeROIidx]).draw(window, true); window.SetColor(activeHdlCol); ((ROI)ROIList[activeROIidx]).displayActive(window); } } } }
/// <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); } } } }
/// <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); } } }
/// <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; } }
/// <summary> /// 显示没有选中的操作点 /// </summary> /// <param name="number"></param> /// <param name="hwin"></param> void no_chice_point(int number, HalconDotNet.HWindow hwin) { hwin.DispRectangle2(this._rows_y[number].D, this._cols_x[number].D, -this._phi, 5, 5); #region 无用代码 //switch (number) //{ // case 0: // hwin.DispRectangle2(this._row_y1, this._col_x1, 0, 25, 25); // break; // case 1: // hwin.DispRectangle2(this._row_y1, this._col_x2, 0, 25, 25); // break; // case 2: // hwin.DispRectangle2(this._row_y2, this._col_x1, 0, 25, 25); // break; // case 3: // hwin.DispRectangle2(this._row_y2, this._col_x2, 0, 25, 25); // break; // case 4: // hwin.DispRectangle2(this._mid_row_y, this._mid_col_x, 0, 25, 25); // break; //} #endregion }
/// <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); } } } }
/// <summary> /// Paints all objects from the ROIList into the HALCON window /// </summary> /// <param name="window">HALCON window</param> public void paintData(HalconDotNet.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)); } } }
public override void draw(HalconDotNet.HWindow window) { //window.SetColor("white"); //window.SetLineStyle(0); //window.SetLineWidth(1); window.DispRegion(mCurHRegion); }
/// <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; } }
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); } }
/// <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; } }
/// <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 specified region from the ROIList into the HALCON window /// </summary> /// <param name="window">HALCON window</param> public void paintSpecifiedROI(HalconDotNet.HWindow window, int RegionID) { window.SetDraw("margin"); window.SetLineWidth(1); if ((ROIList.Count > 0) && (ROIList.Count > RegionID)) { window.SetColor(inactiveCol); window.SetDraw("margin"); window.SetLineStyle(((ROI)ROIList[RegionID]).flagLineStyle); ((ROI)ROIList[RegionID]).draw(window); if ((activeROIidx != -1) && (activeROIidx == RegionID)) { window.SetColor(activeCol); window.SetLineStyle(((ROI)ROIList[activeROIidx]).flagLineStyle); ((ROI)ROIList[activeROIidx]).draw(window); window.SetColor(activeHdlCol); ((ROI)ROIList[activeROIidx]).displayActive(window); } } }
/// <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; } }
/// <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); } }
/// <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"); }
/// <summary> /// Repaints the HALCON window 'window' /// </summary> public void repaint(HalconDotNet.HWindow window) { HSystem.SetSystem("flush_graphic", "false"); window.ClearWindow(); window.DispObj(ho_Image_Changed); if (roiManager != null && (dispROI == MODE_INCLUDE_ROI)) { roiManager.paintData(window); } HSystem.SetSystem("flush_graphic", "true"); window.SetColor("black"); window.DispLine(-100.0, -100.0, -101.0, -101.0); if (ReDrawEvent != null) { ReDrawEvent(); } mGC.stateOfSettings.Clear(); }
/// <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); } }
/// <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; } }
/// <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; } }
/// <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; } 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; window.DispRectangle2(rows[activeHandleIdx].D, cols[activeHandleIdx].D, phi, smallregionwidth, smallregionheight); if (activeHandleIdx == 5) { window.DispArrow(midR, midC, midR + (Math.Sin(-phi) * length1 * 1.2), midC + (Math.Cos(-phi) * length1 * 1.2), 2.0); } }
/// <summary> /// Repaints the HALCON window 'window' /// </summary> public void repaint(HalconDotNet.HWindow window) { int count = HObjList.Count; HObjectEntry entry; HSystem.SetSystem("flush_graphic", "false"); window.ClearWindow(); mGC.stateOfSettings.Clear(); for (int i = 0; i < count; i++) { entry = ((HObjectEntry)HObjList[i]); mGC.applyContext(window, entry.gContext); window.DispObj(entry.HObj); } addInfoDelegate(); if (roiManager != null && (dispROI == MODE_INCLUDE_ROI)) { roiManager.paintData(window); } HSystem.SetSystem("flush_graphic", "true"); window.SetColor("black"); window.DispLine(-100.0, -100.0, -101.0, -101.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); window.DispRectangle2(row1, col1, 0, 5, 5); //window.DispRectangle2(midR, midC, 0, 5, 5); window.DispCross(midR, midC, 10, 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); }
/// <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); }
/// <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); } }
/// <summary>Paints the ROI into the supplied window.</summary> public override void draw(HalconDotNet.HWindow window) { window.DispLine(_StartRow, _StartColumn, _EndRow, _EndCol); //window.DispRectangle2(_StartRow, _StartColumn, 0, 5, 5);//開始 //window.DispObj(_AuxLineHandleXLD); //window.DispRectangle2( row2, col2, 0, 5, 5); //箭頭 //window.DispRectangle2(_MidRow, _MidCol, 0, 5, 5);//中間 }