mirror of
https://github.com/eggplantlwj/VisionEdit.git
synced 2026-03-25 01:06:36 +08:00
修复了一些bug,降低插件之间耦合度
This commit is contained in:
@@ -55,8 +55,7 @@
|
||||
//
|
||||
// HWindow_Final
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.Controls.Add(this.m_CtrlHStatusLabelCtrl);
|
||||
this.Controls.Add(this.mCtrl_HWindow);
|
||||
this.Name = "HWindow_Final";
|
||||
|
||||
@@ -20,7 +20,6 @@ namespace HalconWindow.HalconWindow
|
||||
private HImage /**/ hv_image; //缩放时操作的图片 此处千万不要使用hv_image = new HImage(),不然在生成控件dll的时候,会导致无法序列化,去你妈隔壁,还好老子有版本控制,不然都找不到这种恶心问题
|
||||
private int /**/ hv_imageWidth, hv_imageHeight; //图片宽,高
|
||||
private string /**/ str_imgSize; //图片尺寸大小 5120X3840
|
||||
private HTuple str_channel; //通道数
|
||||
private bool /**/ drawModel = false; //绘制模式下,不允许缩放和鼠标右键菜单
|
||||
|
||||
public ViewWindow.ViewWindow viewWindow; /**/ //ViewWindow
|
||||
@@ -44,7 +43,7 @@ namespace HalconWindow.HalconWindow
|
||||
// 'arrow' 'default' 'crosshair' 'text I-beam' 'Slashed circle' 'Size All'
|
||||
// 'Size NESW' 'Size S' 'Size NWSE' 'Size WE' 'Vertical Arrow' 'Hourglass'
|
||||
//
|
||||
// hv_window.SetMshape("Hourglass");
|
||||
// hv_window.SetMshape("Hourglass");
|
||||
|
||||
fit_strip = new ToolStripMenuItem("适应窗口");
|
||||
fit_strip.Click += new EventHandler((s, e) => DispImageFit(mCtrl_HWindow));
|
||||
@@ -108,19 +107,6 @@ namespace HalconWindow.HalconWindow
|
||||
drawModel = value;
|
||||
}
|
||||
}
|
||||
private bool _EditModel = true;//绘制的图形是否可以编辑
|
||||
public bool EditModel
|
||||
{
|
||||
get
|
||||
{
|
||||
return _EditModel;
|
||||
}
|
||||
set
|
||||
{
|
||||
viewWindow.setEditModel(value);
|
||||
_EditModel = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置image,初始化控件参数
|
||||
@@ -142,9 +128,7 @@ namespace HalconWindow.HalconWindow
|
||||
|
||||
this.hv_image = value;
|
||||
hv_image.GetImageSize(out hv_imageWidth, out hv_imageHeight);
|
||||
HOperatorSet.CountChannels(hv_image, out str_channel);
|
||||
str_imgSize = String.Format("{0}X{1}", hv_imageWidth, hv_imageHeight);
|
||||
// str_channel = string.Format("C{0}", str_channel);
|
||||
|
||||
//DispImageFit(mCtrl_HWindow);
|
||||
try
|
||||
@@ -289,7 +273,7 @@ namespace HalconWindow.HalconWindow
|
||||
HOperatorSet.CountChannels(hv_image, out channel_count);
|
||||
|
||||
hv_window.GetMpositionSubPix(out positionY, out positionX, out button_state);
|
||||
str_position = String.Format("R: {0:0000.0}, C: {1:0000.0}", positionY, positionX);
|
||||
str_position = String.Format("ROW: {0:0000.0}, COLUMN: {1:0000.0}", positionY, positionX);
|
||||
|
||||
_isXOut = (positionX < 0 || positionX >= hv_imageWidth);
|
||||
_isYOut = (positionY < 0 || positionY >= hv_imageHeight);
|
||||
@@ -298,9 +282,9 @@ namespace HalconWindow.HalconWindow
|
||||
{
|
||||
if ((int)channel_count == 1)
|
||||
{
|
||||
int grayVal;
|
||||
double grayVal;
|
||||
grayVal = hv_image.GetGrayval((int)positionY, (int)positionX);
|
||||
str_value = String.Format("V: {0:000}", grayVal);
|
||||
str_value = String.Format("Val: {0:000.0}", grayVal);
|
||||
}
|
||||
else if ((int)channel_count == 3)
|
||||
{
|
||||
@@ -320,13 +304,13 @@ namespace HalconWindow.HalconWindow
|
||||
_GreenChannel.Dispose();
|
||||
_BlueChannel.Dispose();
|
||||
|
||||
str_value = String.Format("V: ({0:000.0}, {1:000.0}, {2:000.0})", grayValRed, grayValGreen, grayValBlue);
|
||||
str_value = String.Format("Val: ({0:000.0}, {1:000.0}, {2:000.0})", grayValRed, grayValGreen, grayValBlue);
|
||||
}
|
||||
else
|
||||
{
|
||||
str_value = "";
|
||||
}
|
||||
m_CtrlHStatusLabelCtrl.Text = str_channel + " " + str_imgSize + " " + str_position + " " + str_value;
|
||||
m_CtrlHStatusLabelCtrl.Text = str_imgSize + " " + str_position + " " + str_value;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -416,6 +400,7 @@ namespace HalconWindow.HalconWindow
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -3,12 +3,13 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using HalconDotNet;
|
||||
using ViewWindow.Model;
|
||||
|
||||
namespace ViewWindow
|
||||
{
|
||||
public class ViewWindow : Model.IViewWindow
|
||||
{
|
||||
public Model.HWndCtrl _hWndControl;
|
||||
private Model.HWndCtrl _hWndControl;
|
||||
|
||||
private Model.ROIController _roiController;
|
||||
|
||||
@@ -36,11 +37,11 @@ namespace ViewWindow
|
||||
//清空roi容器,不让roi显示
|
||||
this._roiController.reset();
|
||||
//显示图片
|
||||
this._roiController.resetWindowImage();
|
||||
this._roiController.resetWindowImage();
|
||||
|
||||
|
||||
//this._hWndControl.resetWindow();
|
||||
// this._hWndControl.resetAll();
|
||||
// this._hWndControl.resetAll();
|
||||
//this._hWndControl.repaint();
|
||||
}
|
||||
public void notDisplayRoi()
|
||||
@@ -61,12 +62,6 @@ namespace ViewWindow
|
||||
{
|
||||
_hWndControl.drawModel = flag;
|
||||
}
|
||||
//是否开启编辑事件
|
||||
public void setEditModel(bool flag)
|
||||
{
|
||||
_roiController.EditModel = flag;
|
||||
// _hWndControl.drawModel = flag;
|
||||
}
|
||||
public void resetWindowImage()
|
||||
{
|
||||
this._hWndControl.resetWindow();
|
||||
@@ -107,10 +102,7 @@ namespace ViewWindow
|
||||
{
|
||||
this._roiController.genCircle(row, col, radius, ref rois);
|
||||
}
|
||||
public void genCircularArc(double row, double col, double radius, double startPhi, double extentPhi, string direct,ref List<Model.ROI> rois)
|
||||
{
|
||||
this._roiController.genCircularArc(row, col, radius, startPhi, extentPhi,direct,ref rois);
|
||||
}
|
||||
|
||||
public void genLine(double beginRow, double beginCol, double endRow, double endCol, ref List<Model.ROI> rois)
|
||||
{
|
||||
this._roiController.genLine(beginRow, beginCol, endRow, endCol, ref rois);
|
||||
@@ -118,10 +110,10 @@ namespace ViewWindow
|
||||
|
||||
public List<double> smallestActiveROI(out string name, out int index)
|
||||
{
|
||||
List<double> resual = this._roiController.smallestActiveROI(out name,out index);
|
||||
List<double> resual = this._roiController.smallestActiveROI(out name, out index);
|
||||
return resual;
|
||||
}
|
||||
|
||||
|
||||
public Model.ROI smallestActiveROI(out List<double> data, out int index)
|
||||
{
|
||||
Model.ROI roi = this._roiController.smallestActiveROI(out data, out index);
|
||||
@@ -133,10 +125,10 @@ namespace ViewWindow
|
||||
this._roiController.selectROI(index);
|
||||
}
|
||||
|
||||
public void selectROI( List<Model.ROI> rois, int index)
|
||||
public void selectROI(List<Model.ROI> rois, int index)
|
||||
{
|
||||
//this._roiController.selectROI(index);
|
||||
if ((rois.Count > index)&&(index>=0))
|
||||
if ((rois.Count > index) && (index >= 0))
|
||||
{
|
||||
this._hWndControl.resetAll();
|
||||
this._hWndControl.repaint();
|
||||
@@ -167,13 +159,6 @@ namespace ViewWindow
|
||||
this._roiController.displayCircle(rois[index].Color, m_roiData[0].D, m_roiData[1].D, m_roiData[2].D);
|
||||
}
|
||||
break;
|
||||
case "ROICircularArc":
|
||||
|
||||
if (m_roiData != null)
|
||||
{
|
||||
this._roiController.displayCircularArc(rois[index].Color, m_roiData[0].D, m_roiData[1].D, m_roiData[2].D, m_roiData[3].D, m_roiData[4].D);
|
||||
}
|
||||
break;
|
||||
case "ROILine":
|
||||
|
||||
if (m_roiData != null)
|
||||
@@ -215,7 +200,7 @@ namespace ViewWindow
|
||||
if (m_roiData != null)
|
||||
{
|
||||
this._roiController.displayRect2(roi.Color, m_roiData[0].D, m_roiData[1].D, m_roiData[2].D, m_roiData[3].D, m_roiData[4].D);
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
case "ROICircle":
|
||||
@@ -296,15 +281,20 @@ namespace ViewWindow
|
||||
}
|
||||
|
||||
#region 专门用于 显示region 和xld的方法
|
||||
public void displayHobject(HObject obj,string color)
|
||||
public void displayHobject(HObject obj, string color)
|
||||
{
|
||||
_hWndControl.DispObj(obj, color);
|
||||
|
||||
|
||||
}
|
||||
public void displayHobject(HObject obj)
|
||||
{
|
||||
_hWndControl.DispObj(obj, null);
|
||||
}
|
||||
|
||||
public void genCircularArc(double row, double col, double radius, double startPhi, double extentPhi, string direct, ref List<ROI> rois)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user