public void funcMeasureLineDistance() { viewPort.Focus(); HWindow window = viewPort.hvppleWindow; HWndMessage message = new HWndMessage(clsWellsLanguage.getString(126), 20, 20, 20, "green", "window"); message.DispMessage(window, message.coordSystem, 1); isStaticWnd = true; viewPort.ContextMenuStrip = null; double r1, c1, r2, c2; HTuple dd; //获取当前显示信息 HTuple hv_Red = null, hv_Green = null, hv_Blue = null; int hv_lineWidth; window.GetRgb(out hv_Red, out hv_Green, out hv_Blue); hv_lineWidth = (int)window.GetLineWidth(); string hv_Draw = window.GetDraw(); window.SetLineWidth(1); //设置线宽 window.SetLineStyle(new HTuple()); window.SetColor("green"); //画点的颜色 window.DrawLine(out r1, out c1, out r2, out c2); window.DispLine(r1, c1, r2, c2); //恢复窗口显示信息 window.SetRgb(hv_Red, hv_Green, hv_Blue); window.SetLineWidth(hv_lineWidth); window.SetDraw(hv_Draw); HOperatorSet.DistancePp(r1, c1, r2, c2, out dd); double dr = Math.Abs(r2 - r1); double dc = Math.Abs(c2 - c1); Wells.class_Public.Show(null, string.Format(clsWellsLanguage.getString(127), dd.D, dc, dr), clsWellsLanguage.getString(128), MessageBoxButtons.OK, MessageBoxIcon.Information); viewPort.ContextMenuStrip = hv_MenuStrip; isStaticWnd = false; repaint(window); }
public void updateImage(List <object> list) { //清空显示image _hWndControl.clearList(false); //清空hobjectList _hWndControl.clearHRegionList(); //清空roi _hWndControl.roiManager.reset(); for (int igg = 0; igg < list.Count / 2; igg++) { string strDrawType = list[igg * 2] as string; if (strDrawType == "message") { HWndMessage msg = list[igg * 2 + 1] as HWndMessage; if (msg != null) { _hWndControl.HObjImageList.Add(new HObjectEntry(msg)); } } if (strDrawType == "region") { HRegionEntry entry = list[igg * 2 + 1] as HRegionEntry; if (entry != null) { _hWndControl.hRegionList.Add(entry); } } if (strDrawType == "roi") { ROI roi = list[igg * 2 + 1] as ROI; _hWndControl.roiManager.ROIList.Add(roi); } } _hWndControl.repaint(); }
public void addIconicVar(HWndMessage message) { HObjectEntry entry; if (message == null) { return; } entry = new HObjectEntry(message); if (HObjImageList.Count < 1) { return; } if (entry.Message != null) { //double zoom = 1.0 / xScale; double zoom = entry.Message.coordSystem == "image" ? 1.0 / xScale : 1.0 / originScale; double sizeTmp = entry.Message.changeDisplayFontSize(viewPort.hvppleWindow, zoom, currentTextSize); currentTextSize = sizeTmp; if (isShowMessage) { entry.Message.DispMessage(viewPort.hvppleWindow, entry.Message.coordSystem); } HObjImageList.Add(entry); if (HObjImageList.Count > MAXNUMOBJLIST) { ((HObjectEntry)HObjImageList[1]).clear(); HObjImageList.RemoveAt(1); } } }
public void funcShowGrayHisto() { viewPort.Focus(); HImage image = null; if (HObjImageList.Count > 0) { image = new HImage(((HObjectEntry)HObjImageList[0]).HObj); } if (image == null) { class_Public.Show(null, clsWellsLanguage.getString(122), clsWellsLanguage.getString(1), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } HWindow window = viewPort.hvppleWindow; HWndMessage message = new HWndMessage(clsWellsLanguage.getString(125), 20, 20, 20, "green", "window"); message.DispMessage(window, message.coordSystem, 1); isStaticWnd = true; viewPort.ContextMenuStrip = null; double r1, c1, r2, c2; //HTuple dd; //获取当前显示信息 HTuple hv_Red = null, hv_Green = null, hv_Blue = null; int hv_lineWidth; window.GetRgb(out hv_Red, out hv_Green, out hv_Blue); hv_lineWidth = (int)window.GetLineWidth(); string hv_Draw = window.GetDraw(); window.SetLineWidth(1); //设置线宽 window.SetLineStyle(new HTuple()); window.SetColor("green"); //画点的颜色 window.DrawRectangle1(out r1, out c1, out r2, out c2); window.DispRectangle1(r1, c1, r2, c2); Form frm = new Form(); frm.Text = "GrayHisto"; frm.StartPosition = FormStartPosition.CenterParent; ThresholdUnit.ThresholdUnit thresUnit = new ThresholdUnit.ThresholdUnit(); Size size = thresUnit.Size; size.Height = (int)(size.Height + 50); size.Width = (int)(size.Width + 50); frm.Size = size; frm.Controls.Add(thresUnit); thresUnit.Dock = DockStyle.Fill; HTuple grayVals; grayVals = class_Hvpple.getGrayHisto(image, new HTuple(r1, c1, r2, c2)); thresUnit.setAxisAdaption(ThresholdUnit.ThresholdPlot.AXIS_RANGE_INCREASING); thresUnit.setLabel(clsWellsLanguage.getString(123), clsWellsLanguage.getString(124)); thresUnit.setFunctionPlotValue(grayVals); thresUnit.computeStatistics(grayVals); frm.ShowDialog(); //window.DrawLine(out r1, out c1, out r2, out c2); //window.DispLine(r1, c1, r2, c2); //恢复窗口显示信息 window.SetRgb(hv_Red, hv_Green, hv_Blue); window.SetLineWidth(hv_lineWidth); window.SetDraw(hv_Draw); viewPort.ContextMenuStrip = hv_MenuStrip; isStaticWnd = false; repaint(); }
public HObjectEntry(HWndMessage message) { this.Message = message; }