mirror of
https://github.com/eggplantlwj/VisionEdit.git
synced 2026-03-23 16:26:35 +08:00
版本初始化,建立主窗体页面
This commit is contained in:
BIN
.vs/VisionEditTest/v14/.suo
Normal file
BIN
.vs/VisionEditTest/v14/.suo
Normal file
Binary file not shown.
6
HalconWindowTest/App.config
Normal file
6
HalconWindowTest/App.config
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||
</startup>
|
||||
</configuration>
|
||||
BIN
HalconWindowTest/HalconWindow/Config/Circle.cs
Normal file
BIN
HalconWindowTest/HalconWindow/Config/Circle.cs
Normal file
Binary file not shown.
BIN
HalconWindowTest/HalconWindow/Config/CircularArc.cs
Normal file
BIN
HalconWindowTest/HalconWindow/Config/CircularArc.cs
Normal file
Binary file not shown.
BIN
HalconWindowTest/HalconWindow/Config/HObjectWithColor.cs
Normal file
BIN
HalconWindowTest/HalconWindow/Config/HObjectWithColor.cs
Normal file
Binary file not shown.
BIN
HalconWindowTest/HalconWindow/Config/Line.cs
Normal file
BIN
HalconWindowTest/HalconWindow/Config/Line.cs
Normal file
Binary file not shown.
BIN
HalconWindowTest/HalconWindow/Config/Rectangle1.cs
Normal file
BIN
HalconWindowTest/HalconWindow/Config/Rectangle1.cs
Normal file
Binary file not shown.
BIN
HalconWindowTest/HalconWindow/Config/Rectangle2.cs
Normal file
BIN
HalconWindowTest/HalconWindow/Config/Rectangle2.cs
Normal file
Binary file not shown.
BIN
HalconWindowTest/HalconWindow/Config/SerializeHelper.cs
Normal file
BIN
HalconWindowTest/HalconWindow/Config/SerializeHelper.cs
Normal file
Binary file not shown.
73
HalconWindowTest/HalconWindow/HWindow_Final.Designer.cs
generated
Normal file
73
HalconWindowTest/HalconWindow/HWindow_Final.Designer.cs
generated
Normal file
@@ -0,0 +1,73 @@
|
||||
namespace HalconWindowTest.HalconWindow
|
||||
{
|
||||
partial class HWindow_Final
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要修改
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.m_CtrlHStatusLabelCtrl = new System.Windows.Forms.Label();
|
||||
this.mCtrl_HWindow = new HalconDotNet.HWindowControl();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// m_CtrlHStatusLabelCtrl
|
||||
//
|
||||
this.m_CtrlHStatusLabelCtrl.AutoSize = true;
|
||||
this.m_CtrlHStatusLabelCtrl.Location = new System.Drawing.Point(14, 533);
|
||||
this.m_CtrlHStatusLabelCtrl.Name = "m_CtrlHStatusLabelCtrl";
|
||||
this.m_CtrlHStatusLabelCtrl.Size = new System.Drawing.Size(41, 12);
|
||||
this.m_CtrlHStatusLabelCtrl.TabIndex = 1;
|
||||
this.m_CtrlHStatusLabelCtrl.Text = "label1";
|
||||
//
|
||||
// mCtrl_HWindow
|
||||
//
|
||||
this.mCtrl_HWindow.BackColor = System.Drawing.Color.Black;
|
||||
this.mCtrl_HWindow.BorderColor = System.Drawing.Color.Black;
|
||||
this.mCtrl_HWindow.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.mCtrl_HWindow.ImagePart = new System.Drawing.Rectangle(0, 0, 640, 480);
|
||||
this.mCtrl_HWindow.Location = new System.Drawing.Point(0, 0);
|
||||
this.mCtrl_HWindow.Name = "mCtrl_HWindow";
|
||||
this.mCtrl_HWindow.Size = new System.Drawing.Size(629, 558);
|
||||
this.mCtrl_HWindow.TabIndex = 2;
|
||||
this.mCtrl_HWindow.WindowSize = new System.Drawing.Size(629, 558);
|
||||
//
|
||||
// HWindow_Final
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.m_CtrlHStatusLabelCtrl);
|
||||
this.Controls.Add(this.mCtrl_HWindow);
|
||||
this.Name = "HWindow_Final";
|
||||
this.Size = new System.Drawing.Size(629, 558);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
private System.Windows.Forms.Label m_CtrlHStatusLabelCtrl;
|
||||
private HalconDotNet.HWindowControl mCtrl_HWindow;
|
||||
}
|
||||
}
|
||||
433
HalconWindowTest/HalconWindow/HWindow_Final.cs
Normal file
433
HalconWindowTest/HalconWindow/HWindow_Final.cs
Normal file
@@ -0,0 +1,433 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using HalconDotNet;
|
||||
|
||||
namespace HalconWindowTest.HalconWindow
|
||||
{
|
||||
public partial class HWindow_Final : UserControl
|
||||
{
|
||||
#region 私有变量定义.
|
||||
|
||||
private HWindow /**/ hv_window; //halcon窗体控件的句柄 this.mCtrl_HWindow.HalconWindow;
|
||||
private ContextMenuStrip /**/ hv_MenuStrip; //右键菜单控件
|
||||
// 窗体控件右键菜单内容
|
||||
ToolStripMenuItem fit_strip;
|
||||
ToolStripMenuItem saveImg_strip;
|
||||
ToolStripMenuItem saveWindow_strip;
|
||||
ToolStripMenuItem barVisible_strip;
|
||||
ToolStripMenuItem histogram_strip;
|
||||
|
||||
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
|
||||
public HWindowControl hWindowControl; /**/ // 当前halcon窗口
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 初始化控件
|
||||
/// </summary>
|
||||
public HWindow_Final()
|
||||
{
|
||||
InitializeComponent();
|
||||
//
|
||||
viewWindow = new ViewWindow.ViewWindow(mCtrl_HWindow);
|
||||
hWindowControl = this.mCtrl_HWindow;
|
||||
hv_window = this.mCtrl_HWindow.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");
|
||||
|
||||
fit_strip = new ToolStripMenuItem("适应窗口");
|
||||
fit_strip.Click += new EventHandler((s, e) => DispImageFit(mCtrl_HWindow));
|
||||
|
||||
barVisible_strip = new ToolStripMenuItem("显示StatusBar");
|
||||
barVisible_strip.CheckOnClick = true;
|
||||
barVisible_strip.CheckedChanged += new EventHandler(barVisible_strip_CheckedChanged);
|
||||
m_CtrlHStatusLabelCtrl.Visible = false;
|
||||
mCtrl_HWindow.Height = this.Height;
|
||||
|
||||
saveImg_strip = new ToolStripMenuItem("保存原始图像");
|
||||
saveImg_strip.Click += new EventHandler((s, e) => SaveImage());
|
||||
|
||||
saveWindow_strip = new ToolStripMenuItem("保存窗口缩略图");
|
||||
saveWindow_strip.Click += new EventHandler((s, e) => SaveWindowDump());
|
||||
|
||||
histogram_strip = new ToolStripMenuItem("显示直方图(H)");
|
||||
histogram_strip.CheckOnClick = true;
|
||||
histogram_strip.Checked = false;
|
||||
|
||||
hv_MenuStrip = new ContextMenuStrip();
|
||||
hv_MenuStrip.Items.Add(fit_strip);
|
||||
hv_MenuStrip.Items.Add(barVisible_strip);
|
||||
hv_MenuStrip.Items.Add(new ToolStripSeparator());
|
||||
hv_MenuStrip.Items.Add(saveImg_strip);
|
||||
hv_MenuStrip.Items.Add(saveWindow_strip);
|
||||
|
||||
barVisible_strip.Enabled = true;
|
||||
fit_strip.Enabled = false;
|
||||
histogram_strip.Enabled = false;
|
||||
saveImg_strip.Enabled = false;
|
||||
saveWindow_strip.Enabled = false;
|
||||
|
||||
mCtrl_HWindow.ContextMenuStrip = hv_MenuStrip;
|
||||
mCtrl_HWindow.SizeChanged += new EventHandler((s, e) => DispImageFit(mCtrl_HWindow));
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 绘制模式下,不允许缩放和鼠标右键菜单
|
||||
/// </summary>
|
||||
public bool DrawModel
|
||||
{
|
||||
get { return drawModel; }
|
||||
set
|
||||
{
|
||||
//缩放控制
|
||||
viewWindow.setDrawModel(value);
|
||||
//绘制模式 不现实右键
|
||||
if (value == true)
|
||||
{
|
||||
|
||||
mCtrl_HWindow.ContextMenuStrip = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
//恢复
|
||||
mCtrl_HWindow.ContextMenuStrip = hv_MenuStrip;
|
||||
}
|
||||
drawModel = value;
|
||||
}
|
||||
}
|
||||
private bool _EditModel = true;//绘制的图形是否可以编辑
|
||||
public bool EditModel
|
||||
{
|
||||
get
|
||||
{
|
||||
return _EditModel;
|
||||
}
|
||||
set
|
||||
{
|
||||
viewWindow.setEditModel(value);
|
||||
_EditModel = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置image,初始化控件参数
|
||||
/// </summary>
|
||||
public HImage Image
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.hv_image;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
if (this.hv_image != null)
|
||||
{
|
||||
this.hv_image.Dispose();
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
barVisible_strip.Enabled = true;
|
||||
fit_strip.Enabled = true;
|
||||
histogram_strip.Enabled = true;
|
||||
saveImg_strip.Enabled = true;
|
||||
saveWindow_strip.Enabled = true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
|
||||
viewWindow.displayImage(hv_image);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得halcon窗体控件的句柄
|
||||
/// </summary>
|
||||
public IntPtr HWindowHalconID
|
||||
{
|
||||
get { return this.mCtrl_HWindow.HalconID; }
|
||||
}
|
||||
|
||||
public HWindowControl getHWindowControl()
|
||||
{
|
||||
return this.mCtrl_HWindow;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 状态条 显示/隐藏 CheckedChanged事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
void barVisible_strip_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
ToolStripMenuItem strip = sender as ToolStripMenuItem;
|
||||
|
||||
this.SuspendLayout();
|
||||
|
||||
if (strip.Checked)
|
||||
{
|
||||
m_CtrlHStatusLabelCtrl.Visible = true;
|
||||
//mCtrl_HWindow.Height = this.Height - m_CtrlHStatusLabelCtrl.Height - m_CtrlHStatusLabelCtrl.Margin.Top - m_CtrlHStatusLabelCtrl.Margin.Bottom;
|
||||
mCtrl_HWindow.HMouseMove += HWindowControl_HMouseMove;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_CtrlHStatusLabelCtrl.Visible = false;
|
||||
//mCtrl_HWindow.Height = this.Height;
|
||||
mCtrl_HWindow.HMouseMove -= HWindowControl_HMouseMove;
|
||||
}
|
||||
|
||||
//DispImageFit(mCtrl_HWindow);
|
||||
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
}
|
||||
|
||||
public void showStatusBar()
|
||||
{
|
||||
barVisible_strip.Checked = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存窗体截图到本地
|
||||
/// </summary>
|
||||
private void SaveWindowDump()
|
||||
{
|
||||
SaveFileDialog sfd = new SaveFileDialog();
|
||||
sfd.Filter = "PNG图像|*.png|所有文件|*.*";
|
||||
|
||||
if (sfd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (String.IsNullOrEmpty(sfd.FileName))
|
||||
return;
|
||||
|
||||
//截取窗口图
|
||||
HOperatorSet.DumpWindow(HWindowHalconID, "png best", sfd.FileName);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存原始图片到本地
|
||||
/// </summary>
|
||||
private void SaveImage()
|
||||
{
|
||||
SaveFileDialog sfd = new SaveFileDialog();
|
||||
sfd.Filter = "BMP图像|*.bmp|所有文件|*.*";
|
||||
|
||||
if (sfd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (String.IsNullOrEmpty(sfd.FileName))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
HOperatorSet.WriteImage(hv_image, "bmp", 0, sfd.FileName);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 图片适应大小显示在窗体
|
||||
/// </summary>
|
||||
/// <param name="hw_Ctrl">halcon窗体控件</param>
|
||||
private void DispImageFit(HWindowControl hw_Ctrl)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
this.viewWindow.resetWindowImage();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 鼠标在空间窗体里滑动,显示鼠标所在位置的灰度值
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void HWindowControl_HMouseMove(object sender, HMouseEventArgs e)
|
||||
{
|
||||
|
||||
if (hv_image != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
int button_state;
|
||||
double positionX, positionY;
|
||||
string str_value;
|
||||
string str_position;
|
||||
bool _isXOut = true, _isYOut = true;
|
||||
HTuple channel_count;
|
||||
|
||||
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);
|
||||
|
||||
_isXOut = (positionX < 0 || positionX >= hv_imageWidth);
|
||||
_isYOut = (positionY < 0 || positionY >= hv_imageHeight);
|
||||
|
||||
if (!_isXOut && !_isYOut)
|
||||
{
|
||||
if ((int)channel_count == 1)
|
||||
{
|
||||
int grayVal;
|
||||
grayVal = hv_image.GetGrayval((int)positionY, (int)positionX);
|
||||
str_value = String.Format("V: {0:000}", grayVal);
|
||||
}
|
||||
else if ((int)channel_count == 3)
|
||||
{
|
||||
double grayValRed, grayValGreen, grayValBlue;
|
||||
|
||||
HImage _RedChannel, _GreenChannel, _BlueChannel;
|
||||
|
||||
_RedChannel = hv_image.AccessChannel(1);
|
||||
_GreenChannel = hv_image.AccessChannel(2);
|
||||
_BlueChannel = hv_image.AccessChannel(3);
|
||||
|
||||
grayValRed = _RedChannel.GetGrayval((int)positionY, (int)positionX);
|
||||
grayValGreen = _GreenChannel.GetGrayval((int)positionY, (int)positionX);
|
||||
grayValBlue = _BlueChannel.GetGrayval((int)positionY, (int)positionX);
|
||||
|
||||
_RedChannel.Dispose();
|
||||
_GreenChannel.Dispose();
|
||||
_BlueChannel.Dispose();
|
||||
|
||||
str_value = String.Format("V: ({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;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//不处理
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public void ClearWindow()
|
||||
{
|
||||
try
|
||||
{
|
||||
this.Invoke(new Action(
|
||||
() =>
|
||||
{
|
||||
//this.hv_image = null;
|
||||
m_CtrlHStatusLabelCtrl.Visible = false;
|
||||
barVisible_strip.Enabled = false;
|
||||
fit_strip.Enabled = false;
|
||||
histogram_strip.Enabled = false;
|
||||
saveImg_strip.Enabled = false;
|
||||
saveWindow_strip.Enabled = false;
|
||||
|
||||
mCtrl_HWindow.HalconWindow.ClearWindow();
|
||||
viewWindow.ClearWindow();
|
||||
|
||||
}
|
||||
));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.ToString());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Hobject转换为的临时Himage,显示背景图
|
||||
/// </summary>
|
||||
/// <param name="hobject">传递Hobject,必须为图像</param>
|
||||
public void HobjectToHimage(HObject hobject)
|
||||
{
|
||||
if (hobject == null || !hobject.IsInitialized())
|
||||
{
|
||||
ClearWindow();
|
||||
return;
|
||||
}
|
||||
|
||||
this.Image = new HImage(hobject);
|
||||
|
||||
}
|
||||
|
||||
#region 缩放后,再次显示传入的HObject
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 默认红颜色显示
|
||||
/// </summary>
|
||||
/// <param name="hObj">传入的region.xld,image</param>
|
||||
public void DispObj(HObject hObj)
|
||||
{
|
||||
|
||||
lock (this)
|
||||
{
|
||||
viewWindow.displayHobject(hObj, null);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重新开辟内存保存 防止被传入的HObject在其他地方dispose后,不能重现
|
||||
/// </summary>
|
||||
/// <param name="hObj">传入的region.xld,image</param>
|
||||
/// <param name="color">颜色</param>
|
||||
public void DispObj(HObject hObj, string color)
|
||||
{
|
||||
|
||||
lock (this)
|
||||
{
|
||||
viewWindow.displayHobject(hObj, color);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 鼠标离开事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void mCtrl_HWindow_MouseLeave(object sender, EventArgs e)
|
||||
{
|
||||
//避免鼠标离开窗口,再返回的时候,图表随着鼠标移动
|
||||
viewWindow.mouseleave();
|
||||
}
|
||||
}
|
||||
}
|
||||
123
HalconWindowTest/HalconWindow/HWindow_Final.resx
Normal file
123
HalconWindowTest/HalconWindow/HWindow_Final.resx
Normal file
@@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="mCtrl_HWindow.LayoutBitmap" type="System.Resources.ResXNullRef, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value />
|
||||
</metadata>
|
||||
</root>
|
||||
BIN
HalconWindowTest/HalconWindow/Model/GraphicsContext.cs
Normal file
BIN
HalconWindowTest/HalconWindow/Model/GraphicsContext.cs
Normal file
Binary file not shown.
BIN
HalconWindowTest/HalconWindow/Model/HObjectEntry.cs
Normal file
BIN
HalconWindowTest/HalconWindow/Model/HObjectEntry.cs
Normal file
Binary file not shown.
BIN
HalconWindowTest/HalconWindow/Model/HWndCtrl.cs
Normal file
BIN
HalconWindowTest/HalconWindow/Model/HWndCtrl.cs
Normal file
Binary file not shown.
BIN
HalconWindowTest/HalconWindow/Model/IViewWindow.cs
Normal file
BIN
HalconWindowTest/HalconWindow/Model/IViewWindow.cs
Normal file
Binary file not shown.
BIN
HalconWindowTest/HalconWindow/Model/ROI.cs
Normal file
BIN
HalconWindowTest/HalconWindow/Model/ROI.cs
Normal file
Binary file not shown.
BIN
HalconWindowTest/HalconWindow/Model/ROICircle.cs
Normal file
BIN
HalconWindowTest/HalconWindow/Model/ROICircle.cs
Normal file
Binary file not shown.
BIN
HalconWindowTest/HalconWindow/Model/ROICircularArc.cs
Normal file
BIN
HalconWindowTest/HalconWindow/Model/ROICircularArc.cs
Normal file
Binary file not shown.
BIN
HalconWindowTest/HalconWindow/Model/ROIController.cs
Normal file
BIN
HalconWindowTest/HalconWindow/Model/ROIController.cs
Normal file
Binary file not shown.
BIN
HalconWindowTest/HalconWindow/Model/ROILine.cs
Normal file
BIN
HalconWindowTest/HalconWindow/Model/ROILine.cs
Normal file
Binary file not shown.
BIN
HalconWindowTest/HalconWindow/Model/ROIRectangle1.cs
Normal file
BIN
HalconWindowTest/HalconWindow/Model/ROIRectangle1.cs
Normal file
Binary file not shown.
BIN
HalconWindowTest/HalconWindow/Model/ROIRectangle2.cs
Normal file
BIN
HalconWindowTest/HalconWindow/Model/ROIRectangle2.cs
Normal file
Binary file not shown.
BIN
HalconWindowTest/HalconWindow/Model/RoiData.cs
Normal file
BIN
HalconWindowTest/HalconWindow/Model/RoiData.cs
Normal file
Binary file not shown.
310
HalconWindowTest/HalconWindow/ViewWindow.cs
Normal file
310
HalconWindowTest/HalconWindow/ViewWindow.cs
Normal file
@@ -0,0 +1,310 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using HalconDotNet;
|
||||
|
||||
namespace ViewWindow
|
||||
{
|
||||
public class ViewWindow : Model.IViewWindow
|
||||
{
|
||||
public Model.HWndCtrl _hWndControl;
|
||||
|
||||
private Model.ROIController _roiController;
|
||||
|
||||
|
||||
public ViewWindow(HWindowControl window)
|
||||
{
|
||||
this._hWndControl = new Model.HWndCtrl(window);
|
||||
this._roiController = new Model.ROIController();
|
||||
this._hWndControl.setROIController(this._roiController);
|
||||
this._hWndControl.setViewState(Model.HWndCtrl.MODE_VIEW_NONE);
|
||||
}
|
||||
|
||||
//清空所有显示内容
|
||||
public void ClearWindow()
|
||||
{
|
||||
//清空显示image
|
||||
_hWndControl.clearList();
|
||||
//清空hobjectList
|
||||
_hWndControl.clearHObjectList();
|
||||
}
|
||||
public void displayImage(HObject img)
|
||||
{
|
||||
//添加背景图片
|
||||
this._hWndControl.addImageShow(img);
|
||||
//清空roi容器,不让roi显示
|
||||
this._roiController.reset();
|
||||
//显示图片
|
||||
this._roiController.resetWindowImage();
|
||||
|
||||
|
||||
//this._hWndControl.resetWindow();
|
||||
// this._hWndControl.resetAll();
|
||||
//this._hWndControl.repaint();
|
||||
}
|
||||
public void notDisplayRoi()
|
||||
{
|
||||
|
||||
this._roiController.reset();
|
||||
//显示图片
|
||||
this._roiController.resetWindowImage();
|
||||
|
||||
}
|
||||
//获取当前窗口显示的roi数量
|
||||
public int getRoiCount()
|
||||
{
|
||||
return _roiController.ROIList.Count;
|
||||
}
|
||||
//是否开启缩放事件
|
||||
public void setDrawModel(bool flag)
|
||||
{
|
||||
_hWndControl.drawModel = flag;
|
||||
}
|
||||
//是否开启编辑事件
|
||||
public void setEditModel(bool flag)
|
||||
{
|
||||
_roiController.EditModel = flag;
|
||||
// _hWndControl.drawModel = flag;
|
||||
}
|
||||
public void resetWindowImage()
|
||||
{
|
||||
this._hWndControl.resetWindow();
|
||||
this._roiController.resetWindowImage();
|
||||
}
|
||||
|
||||
public void mouseleave()
|
||||
{
|
||||
_hWndControl.raiseMouseup();
|
||||
}
|
||||
|
||||
public void zoomWindowImage()
|
||||
{
|
||||
this._roiController.zoomWindowImage();
|
||||
}
|
||||
|
||||
public void moveWindowImage()
|
||||
{
|
||||
this._roiController.moveWindowImage();
|
||||
}
|
||||
|
||||
public void noneWindowImage()
|
||||
{
|
||||
this._roiController.noneWindowImage();
|
||||
}
|
||||
|
||||
public void genRect1(double row1, double col1, double row2, double col2, ref List<Model.ROI> rois)
|
||||
{
|
||||
this._roiController.genRect1(row1, col1, row2, col2, ref rois);
|
||||
}
|
||||
|
||||
public void genRect2(double row, double col, double phi, double length1, double length2, ref List<Model.ROI> rois)
|
||||
{
|
||||
this._roiController.genRect2(row, col, phi, length1, length2, ref rois);
|
||||
}
|
||||
|
||||
public void genCircle(double row, double col, double radius, ref List<Model.ROI> rois)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
public List<double> smallestActiveROI(out string name, out int 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);
|
||||
return roi;
|
||||
}
|
||||
|
||||
public void selectROI(int index)
|
||||
{
|
||||
this._roiController.selectROI(index);
|
||||
}
|
||||
|
||||
public void selectROI( List<Model.ROI> rois, int index)
|
||||
{
|
||||
//this._roiController.selectROI(index);
|
||||
if ((rois.Count > index)&&(index>=0))
|
||||
{
|
||||
this._hWndControl.resetAll();
|
||||
this._hWndControl.repaint();
|
||||
|
||||
HTuple m_roiData = null;
|
||||
m_roiData = rois[index].getModelData();
|
||||
|
||||
switch (rois[index].Type)
|
||||
{
|
||||
case "ROIRectangle1":
|
||||
|
||||
if (m_roiData != null)
|
||||
{
|
||||
this._roiController.displayRect1(rois[index].Color, m_roiData[0].D, m_roiData[1].D, m_roiData[2].D, m_roiData[3].D);
|
||||
}
|
||||
break;
|
||||
case "ROIRectangle2":
|
||||
|
||||
if (m_roiData != null)
|
||||
{
|
||||
this._roiController.displayRect2(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 "ROICircle":
|
||||
|
||||
if (m_roiData != null)
|
||||
{
|
||||
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)
|
||||
{
|
||||
this._roiController.displayLine(rois[index].Color, m_roiData[0].D, m_roiData[1].D, m_roiData[2].D, m_roiData[3].D);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void displayROI(List<Model.ROI> rois)
|
||||
{
|
||||
if (rois == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
//this._hWndControl.resetAll();
|
||||
//this._hWndControl.repaint();
|
||||
|
||||
foreach (var roi in rois)
|
||||
{
|
||||
HTuple m_roiData = null;
|
||||
m_roiData = roi.getModelData();
|
||||
|
||||
switch (roi.Type)
|
||||
{
|
||||
case "ROIRectangle1":
|
||||
|
||||
if (m_roiData != null)
|
||||
{
|
||||
this._roiController.displayRect1(roi.Color, m_roiData[0].D, m_roiData[1].D, m_roiData[2].D, m_roiData[3].D);
|
||||
}
|
||||
break;
|
||||
case "ROIRectangle2":
|
||||
|
||||
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":
|
||||
|
||||
if (m_roiData != null)
|
||||
{
|
||||
this._roiController.displayCircle(roi.Color, m_roiData[0].D, m_roiData[1].D, m_roiData[2].D);
|
||||
}
|
||||
break;
|
||||
case "ROILine":
|
||||
|
||||
if (m_roiData != null)
|
||||
{
|
||||
this._roiController.displayLine(roi.Color, m_roiData[0].D, m_roiData[1].D, m_roiData[2].D, m_roiData[3].D);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void removeActiveROI(ref List<Model.ROI> rois)
|
||||
{
|
||||
this._roiController.removeActiveROI(ref rois);
|
||||
}
|
||||
|
||||
public void setActiveRoi(int index)
|
||||
{
|
||||
this._roiController.activeROIidx = index;
|
||||
}
|
||||
public void saveROI(List<Model.ROI> rois, string fileNmae)
|
||||
{
|
||||
List<Model.RoiData> m_RoiData = new List<Model.RoiData>();
|
||||
for (int i = 0; i < rois.Count; i++)
|
||||
{
|
||||
m_RoiData.Add(new Model.RoiData(i, rois[i]));
|
||||
}
|
||||
|
||||
Config.SerializeHelper.Save(m_RoiData, fileNmae);
|
||||
}
|
||||
|
||||
public void loadROI(string fileName, out List<Model.ROI> rois)
|
||||
{
|
||||
rois = new List<Model.ROI>();
|
||||
List<Model.RoiData> m_RoiData = new List<Model.RoiData>();
|
||||
m_RoiData = (List<Model.RoiData>)Config.SerializeHelper.Load(m_RoiData.GetType(), fileName);
|
||||
for (int i = 0; i < m_RoiData.Count; i++)
|
||||
{
|
||||
switch (m_RoiData[i].Name)
|
||||
{
|
||||
case "Rectangle1":
|
||||
this._roiController.genRect1(m_RoiData[i].Rectangle1.Row1, m_RoiData[i].Rectangle1.Column1,
|
||||
m_RoiData[i].Rectangle1.Row2, m_RoiData[i].Rectangle1.Column2, ref rois);
|
||||
rois.Last().Color = m_RoiData[i].Rectangle1.Color;
|
||||
break;
|
||||
case "Rectangle2":
|
||||
this._roiController.genRect2(m_RoiData[i].Rectangle2.Row, m_RoiData[i].Rectangle2.Column,
|
||||
m_RoiData[i].Rectangle2.Phi, m_RoiData[i].Rectangle2.Lenth1, m_RoiData[i].Rectangle2.Lenth2, ref rois);
|
||||
rois.Last().Color = m_RoiData[i].Rectangle2.Color;
|
||||
break;
|
||||
case "Circle":
|
||||
this._roiController.genCircle(m_RoiData[i].Circle.Row, m_RoiData[i].Circle.Column, m_RoiData[i].Circle.Radius, ref rois);
|
||||
rois.Last().Color = m_RoiData[i].Circle.Color;
|
||||
break;
|
||||
case "Line":
|
||||
this._roiController.genLine(m_RoiData[i].Line.RowBegin, m_RoiData[i].Line.ColumnBegin,
|
||||
m_RoiData[i].Line.RowEnd, m_RoiData[i].Line.ColumnEnd, ref rois);
|
||||
rois.Last().Color = m_RoiData[i].Line.Color;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this._hWndControl.resetAll();
|
||||
this._hWndControl.repaint();
|
||||
}
|
||||
|
||||
#region 专门用于 显示region 和xld的方法
|
||||
public void displayHobject(HObject obj,string color)
|
||||
{
|
||||
_hWndControl.DispObj(obj, color);
|
||||
|
||||
}
|
||||
public void displayHobject(HObject obj)
|
||||
{
|
||||
_hWndControl.DispObj(obj, null);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
147
HalconWindowTest/HalconWindowTest.csproj
Normal file
147
HalconWindowTest/HalconWindowTest.csproj
Normal file
@@ -0,0 +1,147 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{4ADC75AE-59C7-4D36-B675-A6CE51B6F5BA}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>HalconWindowTest</RootNamespace>
|
||||
<AssemblyName>HalconWindowTest</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="halcondotnet, Version=19.5.0.0, Culture=neutral, PublicKeyToken=4973bed59ddbf2b8, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>C:\Program Files\MVTec\HALCON-19.05-Progress\bin\dotnet20\halcondotnet.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Design" />
|
||||
<Reference Include="System.Runtime.Serialization.Formatters.Soap" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="WindowsBase" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="HalconWindow\Config\Circle.cs" />
|
||||
<Compile Include="HalconWindow\Config\CircularArc.cs" />
|
||||
<Compile Include="HalconWindow\Config\HObjectWithColor.cs" />
|
||||
<Compile Include="HalconWindow\Config\Line.cs" />
|
||||
<Compile Include="HalconWindow\Config\Rectangle1.cs" />
|
||||
<Compile Include="HalconWindow\Config\Rectangle2.cs" />
|
||||
<Compile Include="HalconWindow\Config\SerializeHelper.cs" />
|
||||
<Compile Include="HalconWindow\Model\GraphicsContext.cs" />
|
||||
<Compile Include="HalconWindow\Model\HObjectEntry.cs" />
|
||||
<Compile Include="HalconWindow\Model\HWndCtrl.cs" />
|
||||
<Compile Include="HalconWindow\Model\IViewWindow.cs" />
|
||||
<Compile Include="HalconWindow\Model\ROI.cs" />
|
||||
<Compile Include="HalconWindow\Model\ROICircle.cs" />
|
||||
<Compile Include="HalconWindow\Model\ROICircularArc.cs" />
|
||||
<Compile Include="HalconWindow\Model\ROIController.cs" />
|
||||
<Compile Include="HalconWindow\Model\RoiData.cs" />
|
||||
<Compile Include="HalconWindow\Model\ROILine.cs" />
|
||||
<Compile Include="HalconWindow\Model\ROIRectangle1.cs" />
|
||||
<Compile Include="HalconWindow\Model\ROIRectangle2.cs" />
|
||||
<Compile Include="HalconWindow\HWindow_Final.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="HalconWindow\HWindow_Final.Designer.cs">
|
||||
<DependentUpon>HWindow_Final.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="HalconWindow\ViewWindow.cs" />
|
||||
<Compile Include="MainForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MainForm.Designer.cs">
|
||||
<DependentUpon>MainForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="HalconWindow\HWindow_Final.resx">
|
||||
<DependentUpon>HWindow_Final.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="MainForm.resx">
|
||||
<DependentUpon>MainForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
58
HalconWindowTest/MainForm.Designer.cs
generated
Normal file
58
HalconWindowTest/MainForm.Designer.cs
generated
Normal file
@@ -0,0 +1,58 @@
|
||||
namespace HalconWindowTest
|
||||
{
|
||||
partial class MainForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Location = new System.Drawing.Point(27, 53);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(366, 483);
|
||||
this.panel1.TabIndex = 0;
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(807, 600);
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Name = "MainForm";
|
||||
this.Text = "MainForm";
|
||||
this.Load += new System.EventHandler(this.MainForm_Load);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
}
|
||||
}
|
||||
26
HalconWindowTest/MainForm.cs
Normal file
26
HalconWindowTest/MainForm.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using HalconWindowTest.HalconWindow;
|
||||
|
||||
namespace HalconWindowTest
|
||||
{
|
||||
public partial class MainForm : Form
|
||||
{
|
||||
public MainForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void MainForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
this.panel1.Controls.Add(new HWindow_Final());
|
||||
}
|
||||
}
|
||||
}
|
||||
120
HalconWindowTest/MainForm.resx
Normal file
120
HalconWindowTest/MainForm.resx
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
22
HalconWindowTest/Program.cs
Normal file
22
HalconWindowTest/Program.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace HalconWindowTest
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// 应用程序的主入口点。
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new MainForm());
|
||||
}
|
||||
}
|
||||
}
|
||||
36
HalconWindowTest/Properties/AssemblyInfo.cs
Normal file
36
HalconWindowTest/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 有关程序集的一般信息由以下
|
||||
// 控制。更改这些特性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("HalconWindowTest")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("HalconWindowTest")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2019")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
//将 ComVisible 设置为 false 将使此程序集中的类型
|
||||
//对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
|
||||
//请将此类型的 ComVisible 特性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||
[assembly: Guid("4adc75ae-59c7-4d36-b675-a6ce51b6f5ba")]
|
||||
|
||||
// 程序集的版本信息由下列四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
|
||||
// 方法是按如下所示使用“*”: :
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
71
HalconWindowTest/Properties/Resources.Designer.cs
generated
Normal file
71
HalconWindowTest/Properties/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,71 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
// 运行时版本: 4.0.30319.42000
|
||||
//
|
||||
// 对此文件的更改可能导致不正确的行为,如果
|
||||
// 重新生成代码,则所做更改将丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace HalconWindowTest.Properties
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 强类型资源类,用于查找本地化字符串等。
|
||||
/// </summary>
|
||||
// 此类是由 StronglyTypedResourceBuilder
|
||||
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
|
||||
// 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
|
||||
// (以 /str 作为命令选项),或重新生成 VS 项目。
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources
|
||||
{
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回此类使用的缓存 ResourceManager 实例。
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((resourceMan == null))
|
||||
{
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("HalconWindowTest.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 覆盖当前线程的 CurrentUICulture 属性
|
||||
/// 使用此强类型的资源类的资源查找。
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture
|
||||
{
|
||||
get
|
||||
{
|
||||
return resourceCulture;
|
||||
}
|
||||
set
|
||||
{
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
117
HalconWindowTest/Properties/Resources.resx
Normal file
117
HalconWindowTest/Properties/Resources.resx
Normal file
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
30
HalconWindowTest/Properties/Settings.Designer.cs
generated
Normal file
30
HalconWindowTest/Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,30 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace HalconWindowTest.Properties
|
||||
{
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||
{
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default
|
||||
{
|
||||
get
|
||||
{
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
7
HalconWindowTest/Properties/Settings.settings
Normal file
7
HalconWindowTest/Properties/Settings.settings
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
BIN
HalconWindowTest/bin/Debug/HalconWindowTest.exe
Normal file
BIN
HalconWindowTest/bin/Debug/HalconWindowTest.exe
Normal file
Binary file not shown.
6
HalconWindowTest/bin/Debug/HalconWindowTest.exe.config
Normal file
6
HalconWindowTest/bin/Debug/HalconWindowTest.exe.config
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||
</startup>
|
||||
</configuration>
|
||||
BIN
HalconWindowTest/bin/Debug/HalconWindowTest.pdb
Normal file
BIN
HalconWindowTest/bin/Debug/HalconWindowTest.pdb
Normal file
Binary file not shown.
BIN
HalconWindowTest/bin/Debug/HalconWindowTest.vshost.exe
Normal file
BIN
HalconWindowTest/bin/Debug/HalconWindowTest.vshost.exe
Normal file
Binary file not shown.
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||
</startup>
|
||||
</configuration>
|
||||
BIN
HalconWindowTest/bin/Debug/halcondotnet.dll
Normal file
BIN
HalconWindowTest/bin/Debug/halcondotnet.dll
Normal file
Binary file not shown.
61480
HalconWindowTest/bin/Debug/halcondotnet.xml
Normal file
61480
HalconWindowTest/bin/Debug/halcondotnet.xml
Normal file
File diff suppressed because it is too large
Load Diff
BIN
HalconWindowTest/bin/x64/Debug/HalconWindowTest.exe
Normal file
BIN
HalconWindowTest/bin/x64/Debug/HalconWindowTest.exe
Normal file
Binary file not shown.
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||
</startup>
|
||||
</configuration>
|
||||
BIN
HalconWindowTest/bin/x64/Debug/HalconWindowTest.pdb
Normal file
BIN
HalconWindowTest/bin/x64/Debug/HalconWindowTest.pdb
Normal file
Binary file not shown.
BIN
HalconWindowTest/bin/x64/Debug/HalconWindowTest.vshost.exe
Normal file
BIN
HalconWindowTest/bin/x64/Debug/HalconWindowTest.vshost.exe
Normal file
Binary file not shown.
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||
</startup>
|
||||
</configuration>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
</assembly>
|
||||
BIN
HalconWindowTest/bin/x64/Debug/halcondotnet.dll
Normal file
BIN
HalconWindowTest/bin/x64/Debug/halcondotnet.dll
Normal file
Binary file not shown.
61480
HalconWindowTest/bin/x64/Debug/halcondotnet.xml
Normal file
61480
HalconWindowTest/bin/x64/Debug/halcondotnet.xml
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
HalconWindowTest/obj/Debug/HalconWindowTest.MainForm.resources
Normal file
BIN
HalconWindowTest/obj/Debug/HalconWindowTest.MainForm.resources
Normal file
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,12 @@
|
||||
F:\VSCode\VisionEditTest\HalconWindowTest\bin\Debug\HalconWindowTest.exe.config
|
||||
F:\VSCode\VisionEditTest\HalconWindowTest\bin\Debug\HalconWindowTest.exe
|
||||
F:\VSCode\VisionEditTest\HalconWindowTest\bin\Debug\HalconWindowTest.pdb
|
||||
F:\VSCode\VisionEditTest\HalconWindowTest\obj\Debug\HalconWindowTest.MainForm.resources
|
||||
F:\VSCode\VisionEditTest\HalconWindowTest\obj\Debug\HalconWindowTest.Properties.Resources.resources
|
||||
F:\VSCode\VisionEditTest\HalconWindowTest\obj\Debug\HalconWindowTest.csproj.GenerateResource.Cache
|
||||
F:\VSCode\VisionEditTest\HalconWindowTest\obj\Debug\HalconWindowTest.exe
|
||||
F:\VSCode\VisionEditTest\HalconWindowTest\obj\Debug\HalconWindowTest.pdb
|
||||
F:\VSCode\VisionEditTest\HalconWindowTest\bin\Debug\halcondotnet.dll
|
||||
F:\VSCode\VisionEditTest\HalconWindowTest\bin\Debug\halcondotnet.xml
|
||||
F:\VSCode\VisionEditTest\HalconWindowTest\obj\Debug\HalconWindowTest.HalconWindow.HWindow_Final.resources
|
||||
F:\VSCode\VisionEditTest\HalconWindowTest\obj\Debug\HalconWindowTest.csprojResolveAssemblyReference.cache
|
||||
Binary file not shown.
Binary file not shown.
BIN
HalconWindowTest/obj/Debug/HalconWindowTest.exe
Normal file
BIN
HalconWindowTest/obj/Debug/HalconWindowTest.exe
Normal file
Binary file not shown.
BIN
HalconWindowTest/obj/Debug/HalconWindowTest.pdb
Normal file
BIN
HalconWindowTest/obj/Debug/HalconWindowTest.pdb
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,13 @@
|
||||
F:\VSCode\VisionEditTest\HalconWindowTest\bin\x64\Debug\HalconWindowTest.exe.config
|
||||
F:\VSCode\VisionEditTest\HalconWindowTest\bin\x64\Debug\HalconWindowTest.exe
|
||||
F:\VSCode\VisionEditTest\HalconWindowTest\bin\x64\Debug\HalconWindowTest.pdb
|
||||
F:\VSCode\VisionEditTest\HalconWindowTest\bin\x64\Debug\halcondotnet.dll
|
||||
F:\VSCode\VisionEditTest\HalconWindowTest\obj\x64\Debug\HalconWindowTest.MainForm.resources
|
||||
F:\VSCode\VisionEditTest\HalconWindowTest\obj\x64\Debug\HalconWindowTest.Properties.Resources.resources
|
||||
F:\VSCode\VisionEditTest\HalconWindowTest\obj\x64\Debug\HalconWindowTest.csproj.GenerateResource.Cache
|
||||
F:\VSCode\VisionEditTest\HalconWindowTest\obj\x64\Debug\HalconWindowTest.exe
|
||||
F:\VSCode\VisionEditTest\HalconWindowTest\obj\x64\Debug\HalconWindowTest.pdb
|
||||
F:\VSCode\VisionEditTest\HalconWindowTest\obj\x64\Debug\HalconWindowTest.HalconWindow.HWindow_Final.resources
|
||||
F:\VSCode\VisionEditTest\HalconWindowTest\bin\x64\Debug\halcondotnet.xml
|
||||
F:\VSCode\VisionEditTest\HalconWindowTest\obj\x64\Debug\HalconWindowTest.HalconWindow.FormHalconWindow.resources
|
||||
F:\VSCode\VisionEditTest\HalconWindowTest\obj\x64\Debug\HalconWindowTest.csprojResolveAssemblyReference.cache
|
||||
Binary file not shown.
Binary file not shown.
BIN
HalconWindowTest/obj/x64/Debug/HalconWindowTest.exe
Normal file
BIN
HalconWindowTest/obj/x64/Debug/HalconWindowTest.exe
Normal file
Binary file not shown.
BIN
HalconWindowTest/obj/x64/Debug/HalconWindowTest.pdb
Normal file
BIN
HalconWindowTest/obj/x64/Debug/HalconWindowTest.pdb
Normal file
Binary file not shown.
160
ImageWindow/4 HWindow_Tool.csproj
Normal file
160
ImageWindow/4 HWindow_Tool.csproj
Normal file
@@ -0,0 +1,160 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{9BAA53FD-89B5-43E2-AC59-A27B006DEBB6}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ViewROI</RootNamespace>
|
||||
<AssemblyName>HWindow_Tool</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<SccProjectName>
|
||||
</SccProjectName>
|
||||
<SccLocalPath>
|
||||
</SccLocalPath>
|
||||
<SccAuxPath>
|
||||
</SccAuxPath>
|
||||
<SccProvider>
|
||||
</SccProvider>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject>
|
||||
</StartupObject>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="halcondotnet">
|
||||
<HintPath>C:\Program Files\MVTec\HALCON-17.12-Progress\bin\dotnet35\halcondotnet.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Runtime.Serialization.Formatters.Soap" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Config\Circle.cs" />
|
||||
<Compile Include="Config\CircularArc.cs" />
|
||||
<Compile Include="Config\HObjectWithColor.cs" />
|
||||
<Compile Include="Config\Line.cs" />
|
||||
<Compile Include="Config\Rectangle1.cs" />
|
||||
<Compile Include="Config\Rectangle2.cs" />
|
||||
<Compile Include="Config\SerializeHelper.cs" />
|
||||
<Compile Include="HWindow_Final.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Compile>
|
||||
<Compile Include="HWindow_Final.designer.cs">
|
||||
<DependentUpon>HWindow_Final.cs</DependentUpon>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Compile>
|
||||
<Compile Include="Model\GraphicsContext.cs" />
|
||||
<Compile Include="Model\HObjectEntry.cs" />
|
||||
<Compile Include="Model\HWndCtrl.cs" />
|
||||
<Compile Include="Model\IViewWindow.cs" />
|
||||
<Compile Include="Model\ROI.cs" />
|
||||
<Compile Include="Model\ROICircle.cs" />
|
||||
<Compile Include="Model\ROICircularArc.cs" />
|
||||
<Compile Include="Model\ROIController.cs" />
|
||||
<Compile Include="Model\RoiData.cs" />
|
||||
<Compile Include="Model\ROILine.cs" />
|
||||
<Compile Include="Model\ROIRectangle1.cs" />
|
||||
<Compile Include="Model\ROIRectangle2.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ViewWindow.cs" />
|
||||
<EmbeddedResource Include="HWindow_Final.resx">
|
||||
<DependentUpon>HWindow_Final.cs</DependentUpon>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<None Include="app.config" />
|
||||
<None Include="ClassDiagram1.cd" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
6
ImageWindow/4 HWindow_Tool.csproj.user
Normal file
6
ImageWindow/4 HWindow_Tool.csproj.user
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectView>ProjectFiles</ProjectView>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
26
ImageWindow/Backup/HWindow_Tool.sln
Normal file
26
ImageWindow/Backup/HWindow_Tool.sln
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual Studio 2008
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HWindow_Tool", "HWindow_Tool.csproj", "{9BAA53FD-89B5-43E2-AC59-A27B006DEBB6}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{9BAA53FD-89B5-43E2-AC59-A27B006DEBB6}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{9BAA53FD-89B5-43E2-AC59-A27B006DEBB6}.Debug|x64.Build.0 = Debug|x64
|
||||
{9BAA53FD-89B5-43E2-AC59-A27B006DEBB6}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{9BAA53FD-89B5-43E2-AC59-A27B006DEBB6}.Debug|x86.Build.0 = Debug|x86
|
||||
{9BAA53FD-89B5-43E2-AC59-A27B006DEBB6}.Release|x64.ActiveCfg = Release|x64
|
||||
{9BAA53FD-89B5-43E2-AC59-A27B006DEBB6}.Release|x64.Build.0 = Release|x64
|
||||
{9BAA53FD-89B5-43E2-AC59-A27B006DEBB6}.Release|x86.ActiveCfg = Release|x86
|
||||
{9BAA53FD-89B5-43E2-AC59-A27B006DEBB6}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
BIN
ImageWindow/Backup/HWindow_Tool.v11.suo
Normal file
BIN
ImageWindow/Backup/HWindow_Tool.v11.suo
Normal file
Binary file not shown.
12
ImageWindow/ClassDiagram1.cd
Normal file
12
ImageWindow/ClassDiagram1.cd
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ClassDiagram MajorVersion="1" MinorVersion="1">
|
||||
<Class Name="ViewWindow.ViewWindow" Collapsed="true">
|
||||
<Position X="0.5" Y="0.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>CACAAQCAAAEAAAABAAAIgCOAAAAAAAAAIACAADxJACA=</HashCode>
|
||||
<FileName>ViewWindow.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<Lollipop Position="0.2" />
|
||||
</Class>
|
||||
<Font Name="宋体" Size="9" />
|
||||
</ClassDiagram>
|
||||
55
ImageWindow/Config/Circle.cs
Normal file
55
ImageWindow/Config/Circle.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace ViewWindow.Config
|
||||
{
|
||||
[Serializable]
|
||||
public class Circle
|
||||
{
|
||||
private double _row;
|
||||
private double _column;
|
||||
private double _radius;
|
||||
|
||||
[XmlElement(ElementName = "Row")]
|
||||
public double Row
|
||||
{
|
||||
get { return this._row; }
|
||||
set { this._row = value; }
|
||||
}
|
||||
|
||||
[XmlElement(ElementName = "Column")]
|
||||
public double Column
|
||||
{
|
||||
get { return this._column; }
|
||||
set { this._column = value; }
|
||||
}
|
||||
[XmlElement(ElementName = "Radius")]
|
||||
public double Radius
|
||||
{
|
||||
get { return this._radius; }
|
||||
set { this._radius = value; }
|
||||
}
|
||||
|
||||
private string color = "yellow";
|
||||
[XmlElement(ElementName = "Color")]
|
||||
public string Color
|
||||
{
|
||||
get { return this.color; }
|
||||
set { this.color = value; }
|
||||
}
|
||||
public Circle()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Circle(double row, double column, double radius)
|
||||
{
|
||||
this._row = row;
|
||||
this._column = column;
|
||||
this._radius = radius;
|
||||
}
|
||||
}
|
||||
}
|
||||
71
ImageWindow/Config/CircularArc.cs
Normal file
71
ImageWindow/Config/CircularArc.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
namespace ViewROI.Config
|
||||
{
|
||||
[Serializable]
|
||||
class CircularArc
|
||||
{
|
||||
private double _row;
|
||||
private double _column;
|
||||
private double _radius;
|
||||
private double _startPhi;
|
||||
private double _extentPhi;
|
||||
[XmlElement(ElementName = "Row")]
|
||||
public double Row
|
||||
{
|
||||
get { return this._row; }
|
||||
set { this._row = value; }
|
||||
}
|
||||
|
||||
[XmlElement(ElementName = "Column")]
|
||||
public double Column
|
||||
{
|
||||
get { return this._column; }
|
||||
set { this._column = value; }
|
||||
}
|
||||
[XmlElement(ElementName = "Radius")]
|
||||
public double Radius
|
||||
{
|
||||
get { return this._radius; }
|
||||
set { this._radius = value; }
|
||||
}
|
||||
|
||||
[XmlElement(ElementName = "startPhi")]
|
||||
public double StartPhi
|
||||
{
|
||||
get { return this._startPhi; }
|
||||
set { this._startPhi = value; }
|
||||
}
|
||||
|
||||
[XmlElement(ElementName = "ExtentPhi")]
|
||||
public double ExtentPhi
|
||||
{
|
||||
get { return this._extentPhi; }
|
||||
set { this._extentPhi = value; }
|
||||
}
|
||||
|
||||
private string color = "yellow";
|
||||
[XmlElement(ElementName = "Color")]
|
||||
public string Color
|
||||
{
|
||||
get { return this.color; }
|
||||
set { this.color = value; }
|
||||
}
|
||||
public CircularArc()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public CircularArc(double row, double column, double radius,double startPhi, double extentPhi)
|
||||
{
|
||||
this._row = row;
|
||||
this._column = column;
|
||||
this._radius = radius;
|
||||
this._startPhi = startPhi;
|
||||
this._extentPhi = extentPhi;
|
||||
}
|
||||
}
|
||||
}
|
||||
36
ImageWindow/Config/HObjectWithColor.cs
Normal file
36
ImageWindow/Config/HObjectWithColor.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using HalconDotNet;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace ViewROI.Config
|
||||
{
|
||||
/// <summary>
|
||||
/// 显示xld和region 带有颜色
|
||||
/// </summary>
|
||||
class HObjectWithColor
|
||||
{
|
||||
private HObject hObject;
|
||||
private string color;
|
||||
|
||||
|
||||
public HObjectWithColor(HObject _hbj, string _color)
|
||||
{
|
||||
hObject = _hbj;
|
||||
color = _color;
|
||||
}
|
||||
|
||||
public HObject HObject
|
||||
{
|
||||
get { return hObject; }
|
||||
set { hObject = value; }
|
||||
}
|
||||
|
||||
public string Color
|
||||
{
|
||||
get { return color; }
|
||||
set { color = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
63
ImageWindow/Config/Line.cs
Normal file
63
ImageWindow/Config/Line.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace ViewWindow.Config
|
||||
{
|
||||
[Serializable]
|
||||
public class Line
|
||||
{
|
||||
private double _rowBegin;
|
||||
private double _columnBegin;
|
||||
private double _rowEnd;
|
||||
private double _columnEnd;
|
||||
|
||||
[XmlElement(ElementName = "RowBegin")]
|
||||
public double RowBegin
|
||||
{
|
||||
get { return this._rowBegin; }
|
||||
set { this._rowBegin = value; }
|
||||
}
|
||||
|
||||
[XmlElement(ElementName = "ColumnBegin")]
|
||||
public double ColumnBegin
|
||||
{
|
||||
get { return this._columnBegin; }
|
||||
set { this._columnBegin = value; }
|
||||
}
|
||||
[XmlElement(ElementName = "RowEnd")]
|
||||
public double RowEnd
|
||||
{
|
||||
get { return this._rowEnd; }
|
||||
set { this._rowEnd = value; }
|
||||
}
|
||||
|
||||
[XmlElement(ElementName = "ColumnEnd")]
|
||||
public double ColumnEnd
|
||||
{
|
||||
get { return this._columnEnd; }
|
||||
set { this._columnEnd = value; }
|
||||
}
|
||||
private string color = "yellow";
|
||||
[XmlElement(ElementName = "Color")]
|
||||
public string Color
|
||||
{
|
||||
get { return this.color; }
|
||||
set { this.color = value; }
|
||||
}
|
||||
public Line()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Line(double rowBegin, double columnBegin, double rowEnd, double columnEnd)
|
||||
{
|
||||
this._rowBegin = rowBegin;
|
||||
this._columnBegin = columnBegin;
|
||||
this._rowEnd = rowEnd;
|
||||
this._columnEnd = columnEnd;
|
||||
}
|
||||
}
|
||||
}
|
||||
65
ImageWindow/Config/Rectangle1.cs
Normal file
65
ImageWindow/Config/Rectangle1.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace ViewWindow.Config
|
||||
{
|
||||
[Serializable]
|
||||
public class Rectangle1
|
||||
{
|
||||
private double _row1;
|
||||
private double _column1;
|
||||
private double _row2;
|
||||
private double _column2;
|
||||
|
||||
[XmlElement(ElementName = "Row1")]
|
||||
public double Row1
|
||||
{
|
||||
get { return this._row1; }
|
||||
set { this._row1 = value; }
|
||||
}
|
||||
|
||||
[XmlElement(ElementName = "Column1")]
|
||||
public double Column1
|
||||
{
|
||||
get { return this._column1; }
|
||||
set { this._column1 = value; }
|
||||
}
|
||||
|
||||
[XmlElement(ElementName = "Row2")]
|
||||
public double Row2
|
||||
{
|
||||
get { return this._row2; }
|
||||
set { this._row2 = value; }
|
||||
}
|
||||
|
||||
[XmlElement(ElementName = "Column2")]
|
||||
public double Column2
|
||||
{
|
||||
get { return this._column2; }
|
||||
set { this._column2 = value; }
|
||||
}
|
||||
private string color = "yellow";
|
||||
[XmlElement(ElementName = "Color")]
|
||||
public string Color
|
||||
{
|
||||
get { return this.color; }
|
||||
set { this.color = value; }
|
||||
}
|
||||
public Rectangle1()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Rectangle1(double row1, double column1, double row2, double column2)
|
||||
{
|
||||
this._row1 = row1;
|
||||
this._column1 = column1;
|
||||
this._row2 = row2;
|
||||
this._column2 = column2;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
73
ImageWindow/Config/Rectangle2.cs
Normal file
73
ImageWindow/Config/Rectangle2.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace ViewWindow.Config
|
||||
{
|
||||
[Serializable]
|
||||
public class Rectangle2
|
||||
{
|
||||
private double _row;
|
||||
private double _column;
|
||||
private double _phi;
|
||||
private double _lenth1;
|
||||
private double _lenth2;
|
||||
|
||||
[XmlElement(ElementName = "Row")]
|
||||
public double Row
|
||||
{
|
||||
get { return this._row; }
|
||||
set { this._row = value; }
|
||||
}
|
||||
|
||||
[XmlElement(ElementName = "Column")]
|
||||
public double Column
|
||||
{
|
||||
get { return this._column; }
|
||||
set { this._column = value; }
|
||||
}
|
||||
[XmlElement(ElementName = "Phi")]
|
||||
public double Phi
|
||||
{
|
||||
get { return this._phi; }
|
||||
set { this._phi = value; }
|
||||
}
|
||||
|
||||
[XmlElement(ElementName = "Lenth1")]
|
||||
public double Lenth1
|
||||
{
|
||||
get { return this._lenth1; }
|
||||
set { this._lenth1 = value; }
|
||||
}
|
||||
|
||||
[XmlElement(ElementName = "Lenth2")]
|
||||
public double Lenth2
|
||||
{
|
||||
get { return this._lenth2; }
|
||||
set { this._lenth2 = value; }
|
||||
}
|
||||
private string color = "yellow";
|
||||
|
||||
[XmlElement(ElementName = "Color")]
|
||||
public string Color
|
||||
{
|
||||
get { return this.color; }
|
||||
set { this.color = value; }
|
||||
}
|
||||
public Rectangle2()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Rectangle2(double row, double column, double phi, double lenth1, double lenth2)
|
||||
{
|
||||
this._row = row;
|
||||
this._column = column;
|
||||
this._phi = phi;
|
||||
this._lenth1 = lenth1;
|
||||
this._lenth2 = lenth2;
|
||||
}
|
||||
}
|
||||
}
|
||||
266
ImageWindow/Config/SerializeHelper.cs
Normal file
266
ImageWindow/Config/SerializeHelper.cs
Normal file
@@ -0,0 +1,266 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
//using System.Runtime.Serialization.Json;
|
||||
using System.Runtime.Serialization.Formatters.Soap;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
|
||||
namespace ViewWindow.Config
|
||||
{
|
||||
public class SerializeHelper
|
||||
{
|
||||
public SerializeHelper()
|
||||
{ }
|
||||
|
||||
#region XML序列化
|
||||
/// <summary>
|
||||
/// 文件化XML序列化
|
||||
/// </summary>
|
||||
/// <param name="obj">对象</param>
|
||||
/// <param name="filename">文件路径</param>
|
||||
public static void Save(object obj, string filename)
|
||||
{
|
||||
FileStream fs = null;
|
||||
try
|
||||
{
|
||||
fs = new FileStream(filename, FileMode.Create, FileAccess.Write, FileShare.ReadWrite);
|
||||
XmlSerializer serializer = new XmlSerializer(obj.GetType());
|
||||
serializer.Serialize(fs, obj);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (fs != null) fs.Close();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 文件化XML反序列化
|
||||
/// </summary>
|
||||
/// <param name="type">对象类型</param>
|
||||
/// <param name="filename">文件路径</param>
|
||||
public static object Load(Type type, string filename)
|
||||
{
|
||||
FileStream fs = null;
|
||||
try
|
||||
{
|
||||
fs = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
|
||||
XmlSerializer serializer = new XmlSerializer(type);
|
||||
return serializer.Deserialize(fs);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (fs != null) fs.Close();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 文本化XML序列化
|
||||
/// </summary>
|
||||
/// <param name="item">对象</param>
|
||||
public string ToXml<T>(T item)
|
||||
{
|
||||
XmlSerializer serializer = new XmlSerializer(item.GetType());
|
||||
StringBuilder sb = new StringBuilder();
|
||||
using (XmlWriter writer = XmlWriter.Create(sb))
|
||||
{
|
||||
serializer.Serialize(writer, item);
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 文本化XML反序列化
|
||||
/// </summary>
|
||||
/// <param name="str">字符串序列</param>
|
||||
public T FromXml<T>(string str)
|
||||
{
|
||||
XmlSerializer serializer = new XmlSerializer(typeof(T));
|
||||
using (XmlReader reader = new XmlTextReader(new StringReader(str)))
|
||||
{
|
||||
return (T)serializer.Deserialize(reader);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Json序列化
|
||||
/// <summary>
|
||||
/// JsonSerializer序列化
|
||||
/// </summary>
|
||||
/// <param name="item">对象</param>
|
||||
//public string ToJson<T>(T item)
|
||||
//{
|
||||
// DataContractJsonSerializer serializer = new DataContractJsonSerializer(item.GetType());
|
||||
// using (MemoryStream ms = new MemoryStream())
|
||||
// {
|
||||
// serializer.WriteObject(ms, item);
|
||||
// return Encoding.UTF8.GetString(ms.ToArray());
|
||||
// }
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// JsonSerializer反序列化
|
||||
///// </summary>
|
||||
///// <param name="str">字符串序列</param>
|
||||
//public T FromJson<T>(string str) where T : class
|
||||
//{
|
||||
// DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(T));
|
||||
// using (MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(str)))
|
||||
// {
|
||||
// return serializer.ReadObject(ms) as T;
|
||||
// }
|
||||
//}
|
||||
#endregion
|
||||
|
||||
#region SoapFormatter序列化
|
||||
/// <summary>
|
||||
/// SoapFormatter序列化
|
||||
/// </summary>
|
||||
/// <param name="item">对象</param>
|
||||
public string ToSoap<T>(T item)
|
||||
{
|
||||
SoapFormatter formatter = new SoapFormatter();
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
{
|
||||
formatter.Serialize(ms, item);
|
||||
ms.Position = 0;
|
||||
XmlDocument xmlDoc = new XmlDocument();
|
||||
xmlDoc.Load(ms);
|
||||
return xmlDoc.InnerXml;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SoapFormatter反序列化
|
||||
/// </summary>
|
||||
/// <param name="str">字符串序列</param>
|
||||
public T FromSoap<T>(string str)
|
||||
{
|
||||
XmlDocument xmlDoc = new XmlDocument();
|
||||
xmlDoc.LoadXml(str);
|
||||
SoapFormatter formatter = new SoapFormatter();
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
{
|
||||
xmlDoc.Save(ms);
|
||||
ms.Position = 0;
|
||||
return (T)formatter.Deserialize(ms);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region BinaryFormatter序列化
|
||||
/// <summary>
|
||||
/// BinaryFormatter序列化
|
||||
/// </summary>
|
||||
/// <param name="item">对象</param>
|
||||
public string ToBinary<T>(T item)
|
||||
{
|
||||
BinaryFormatter formatter = new BinaryFormatter();
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
{
|
||||
formatter.Serialize(ms, item);
|
||||
ms.Position = 0;
|
||||
byte[] bytes = ms.ToArray();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
foreach (byte bt in bytes)
|
||||
{
|
||||
sb.Append(string.Format("{0:X2}", bt));
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// BinaryFormatter反序列化
|
||||
/// </summary>
|
||||
/// <param name="str">字符串序列</param>
|
||||
public T FromBinary<T>(string str)
|
||||
{
|
||||
int intLen = str.Length / 2;
|
||||
byte[] bytes = new byte[intLen];
|
||||
for (int i = 0; i < intLen; i++)
|
||||
{
|
||||
int ibyte = Convert.ToInt32(str.Substring(i * 2, 2), 16);
|
||||
bytes[i] = (byte)ibyte;
|
||||
}
|
||||
BinaryFormatter formatter = new BinaryFormatter();
|
||||
using (MemoryStream ms = new MemoryStream(bytes))
|
||||
{
|
||||
return (T)formatter.Deserialize(ms);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 获取对象序列化的二进制版本
|
||||
/// </summary>
|
||||
/// <param name="pObj">对象实体</param>
|
||||
/// <returns>如果对象实体为Null,则返回结果为Null。</returns>
|
||||
public static byte[] GetBytes(object pObj)
|
||||
{
|
||||
if (pObj == null) { return null; }
|
||||
MemoryStream serializationStream = new MemoryStream();
|
||||
new BinaryFormatter().Serialize(serializationStream, pObj);
|
||||
serializationStream.Position = 0L;
|
||||
byte[] buffer = new byte[serializationStream.Length];
|
||||
serializationStream.Read(buffer, 0, buffer.Length);
|
||||
serializationStream.Close();
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取对象序列化的XmlDocument版本
|
||||
/// </summary>
|
||||
/// <param name="pObj">对象实体</param>
|
||||
/// <returns>如果对象实体为Null,则返回结果为Null。</returns>
|
||||
public static XmlDocument GetXmlDoc(object pObj)
|
||||
{
|
||||
if (pObj == null) { return null; }
|
||||
XmlSerializer serializer = new XmlSerializer(pObj.GetType());
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringWriter writer = new StringWriter(sb);
|
||||
serializer.Serialize((TextWriter)writer, pObj);
|
||||
XmlDocument document = new XmlDocument();
|
||||
document.LoadXml(sb.ToString());
|
||||
writer.Close();
|
||||
return document;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从已序列化数据中(byte[])获取对象实体
|
||||
/// </summary>
|
||||
/// <typeparam name="T">要返回的数据类型</typeparam>
|
||||
/// <param name="binData">二进制数据</param>
|
||||
/// <returns>对象实体</returns>
|
||||
public static T GetObject<T>(byte[] binData)
|
||||
{
|
||||
if (binData == null) { return default(T); }
|
||||
BinaryFormatter formatter = new BinaryFormatter();
|
||||
MemoryStream serializationStream = new MemoryStream(binData);
|
||||
return (T)formatter.Deserialize(serializationStream);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从已序列化数据(XmlDocument)中获取对象实体
|
||||
/// </summary>
|
||||
/// <typeparam name="T">要返回的数据类型</typeparam>
|
||||
/// <param name="xmlDoc">已序列化的文档对象</param>
|
||||
/// <returns>对象实体</returns>
|
||||
public static T GetObject<T>(XmlDocument xmlDoc)
|
||||
{
|
||||
if (xmlDoc == null) { return default(T); }
|
||||
XmlNodeReader xmlReader = new XmlNodeReader(xmlDoc.DocumentElement);
|
||||
XmlSerializer serializer = new XmlSerializer(typeof(T));
|
||||
return (T)serializer.Deserialize(xmlReader);
|
||||
}
|
||||
}
|
||||
}
|
||||
458
ImageWindow/HWindow_Final.cs
Normal file
458
ImageWindow/HWindow_Final.cs
Normal file
@@ -0,0 +1,458 @@
|
||||
// 版权所有(C) ChoiceTech Corporation。保留所有权利。
|
||||
// 此代码的发布遵从
|
||||
// ChoiceTech 公共许可(HY-PL,http://choicetech.cn/hy-pl.html)的条款。
|
||||
//
|
||||
//版权所有(C) ChoiceTech Corporation。保留所有权利。
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using HalconDotNet;
|
||||
|
||||
|
||||
namespace ChoiceTech.Halcon.Control
|
||||
{
|
||||
/// <summary>
|
||||
/// halcon鼠标缩放控件
|
||||
///
|
||||
/// 描述:
|
||||
/// 1, 必须首先通过this.HobjectToHimage(HObject hobject)传入图片,此图片称为"背景图"
|
||||
/// 2, 有了背景图,就可以通过本控件自定义的 this.DispObj(HObject hObj)显示HObject,类似原方法
|
||||
/// 3,默认显示红色,DispObj(HObject hObj,string color)可显示其他颜色
|
||||
/// </summary>
|
||||
public partial class HWindow_Final : UserControl
|
||||
{
|
||||
#region 私有变量定义.
|
||||
|
||||
private HWindow /**/ hv_window; //halcon窗体控件的句柄 this.mCtrl_HWindow.HalconWindow;
|
||||
private ContextMenuStrip /**/ hv_MenuStrip; //右键菜单控件
|
||||
// 窗体控件右键菜单内容
|
||||
ToolStripMenuItem fit_strip;
|
||||
ToolStripMenuItem saveImg_strip;
|
||||
ToolStripMenuItem saveWindow_strip;
|
||||
ToolStripMenuItem barVisible_strip;
|
||||
ToolStripMenuItem histogram_strip;
|
||||
|
||||
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
|
||||
public HWindowControl hWindowControl; /**/ // 当前halcon窗口
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 初始化控件
|
||||
/// </summary>
|
||||
public HWindow_Final()
|
||||
{
|
||||
InitializeComponent();
|
||||
//
|
||||
viewWindow = new ViewWindow.ViewWindow(mCtrl_HWindow);
|
||||
hWindowControl = this.mCtrl_HWindow;
|
||||
hv_window = this.mCtrl_HWindow.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");
|
||||
|
||||
fit_strip = new ToolStripMenuItem("适应窗口");
|
||||
fit_strip.Click += new EventHandler((s, e) => DispImageFit(mCtrl_HWindow));
|
||||
|
||||
barVisible_strip = new ToolStripMenuItem("显示StatusBar");
|
||||
barVisible_strip.CheckOnClick = true;
|
||||
barVisible_strip.CheckedChanged += new EventHandler(barVisible_strip_CheckedChanged);
|
||||
m_CtrlHStatusLabelCtrl.Visible = false;
|
||||
mCtrl_HWindow.Height = this.Height;
|
||||
|
||||
saveImg_strip = new ToolStripMenuItem("保存原始图像");
|
||||
saveImg_strip.Click += new EventHandler((s, e) => SaveImage());
|
||||
|
||||
saveWindow_strip = new ToolStripMenuItem("保存窗口缩略图");
|
||||
saveWindow_strip.Click += new EventHandler((s, e) => SaveWindowDump());
|
||||
|
||||
histogram_strip = new ToolStripMenuItem("显示直方图(H)");
|
||||
histogram_strip.CheckOnClick = true;
|
||||
histogram_strip.Checked = false;
|
||||
|
||||
hv_MenuStrip = new ContextMenuStrip();
|
||||
hv_MenuStrip.Items.Add(fit_strip);
|
||||
hv_MenuStrip.Items.Add(barVisible_strip);
|
||||
hv_MenuStrip.Items.Add(new ToolStripSeparator());
|
||||
hv_MenuStrip.Items.Add(saveImg_strip);
|
||||
hv_MenuStrip.Items.Add(saveWindow_strip);
|
||||
|
||||
barVisible_strip.Enabled = true;
|
||||
fit_strip.Enabled = false;
|
||||
histogram_strip.Enabled = false;
|
||||
saveImg_strip.Enabled = false;
|
||||
saveWindow_strip.Enabled = false;
|
||||
|
||||
mCtrl_HWindow.ContextMenuStrip = hv_MenuStrip;
|
||||
mCtrl_HWindow.SizeChanged += new EventHandler((s, e) => DispImageFit(mCtrl_HWindow));
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 绘制模式下,不允许缩放和鼠标右键菜单
|
||||
/// </summary>
|
||||
public bool DrawModel
|
||||
{
|
||||
get { return drawModel; }
|
||||
set
|
||||
{
|
||||
//缩放控制
|
||||
viewWindow.setDrawModel(value);
|
||||
//绘制模式 不现实右键
|
||||
if (value == true)
|
||||
{
|
||||
|
||||
mCtrl_HWindow.ContextMenuStrip = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
//恢复
|
||||
mCtrl_HWindow.ContextMenuStrip = hv_MenuStrip;
|
||||
}
|
||||
drawModel = value;
|
||||
}
|
||||
}
|
||||
private bool _EditModel = true;//绘制的图形是否可以编辑
|
||||
public bool EditModel
|
||||
{
|
||||
get
|
||||
{
|
||||
return _EditModel;
|
||||
}
|
||||
set
|
||||
{
|
||||
viewWindow.setEditModel(value);
|
||||
_EditModel = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置image,初始化控件参数
|
||||
/// </summary>
|
||||
public HImage Image
|
||||
{
|
||||
get {
|
||||
return this.hv_image;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
if (this.hv_image != null)
|
||||
{
|
||||
this.hv_image.Dispose();
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
barVisible_strip.Enabled = true;
|
||||
fit_strip.Enabled = true;
|
||||
histogram_strip.Enabled = true;
|
||||
saveImg_strip.Enabled = true;
|
||||
saveWindow_strip.Enabled = true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
|
||||
viewWindow.displayImage(hv_image);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得halcon窗体控件的句柄
|
||||
/// </summary>
|
||||
public IntPtr HWindowHalconID
|
||||
{
|
||||
get { return this.mCtrl_HWindow.HalconID; }
|
||||
}
|
||||
|
||||
public HWindowControl getHWindowControl()
|
||||
{
|
||||
return this.mCtrl_HWindow;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 状态条 显示/隐藏 CheckedChanged事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
void barVisible_strip_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
ToolStripMenuItem strip = sender as ToolStripMenuItem;
|
||||
|
||||
this.SuspendLayout();
|
||||
|
||||
if (strip.Checked)
|
||||
{
|
||||
m_CtrlHStatusLabelCtrl.Visible = true;
|
||||
//mCtrl_HWindow.Height = this.Height - m_CtrlHStatusLabelCtrl.Height - m_CtrlHStatusLabelCtrl.Margin.Top - m_CtrlHStatusLabelCtrl.Margin.Bottom;
|
||||
mCtrl_HWindow.HMouseMove += HWindowControl_HMouseMove;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_CtrlHStatusLabelCtrl.Visible = false;
|
||||
//mCtrl_HWindow.Height = this.Height;
|
||||
mCtrl_HWindow.HMouseMove -= HWindowControl_HMouseMove;
|
||||
}
|
||||
|
||||
//DispImageFit(mCtrl_HWindow);
|
||||
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
}
|
||||
|
||||
public void showStatusBar()
|
||||
{
|
||||
barVisible_strip.Checked = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存窗体截图到本地
|
||||
/// </summary>
|
||||
private void SaveWindowDump()
|
||||
{
|
||||
SaveFileDialog sfd = new SaveFileDialog();
|
||||
sfd.Filter = "PNG图像|*.png|所有文件|*.*";
|
||||
|
||||
if (sfd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (String.IsNullOrEmpty(sfd.FileName))
|
||||
return;
|
||||
|
||||
//截取窗口图
|
||||
HOperatorSet.DumpWindow(HWindowHalconID, "png best", sfd.FileName);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存原始图片到本地
|
||||
/// </summary>
|
||||
private void SaveImage()
|
||||
{
|
||||
SaveFileDialog sfd = new SaveFileDialog();
|
||||
sfd.Filter = "BMP图像|*.bmp|所有文件|*.*";
|
||||
|
||||
if (sfd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (String.IsNullOrEmpty(sfd.FileName))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
HOperatorSet.WriteImage(hv_image, "bmp", 0, sfd.FileName);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 图片适应大小显示在窗体
|
||||
/// </summary>
|
||||
/// <param name="hw_Ctrl">halcon窗体控件</param>
|
||||
private void DispImageFit(HWindowControl hw_Ctrl)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
this.viewWindow.resetWindowImage();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 鼠标在空间窗体里滑动,显示鼠标所在位置的灰度值
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void HWindowControl_HMouseMove(object sender, HMouseEventArgs e)
|
||||
{
|
||||
|
||||
if (hv_image != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
int button_state;
|
||||
double positionX, positionY;
|
||||
string str_value;
|
||||
string str_position;
|
||||
bool _isXOut = true, _isYOut = true;
|
||||
HTuple channel_count;
|
||||
|
||||
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);
|
||||
|
||||
_isXOut = (positionX < 0 || positionX >= hv_imageWidth);
|
||||
_isYOut = (positionY < 0 || positionY >= hv_imageHeight);
|
||||
|
||||
if (!_isXOut && !_isYOut)
|
||||
{
|
||||
if ((int)channel_count == 1)
|
||||
{
|
||||
int grayVal;
|
||||
grayVal = hv_image.GetGrayval((int)positionY, (int)positionX);
|
||||
str_value = String.Format("V: {0:000}", grayVal);
|
||||
}
|
||||
else if ((int)channel_count == 3)
|
||||
{
|
||||
double grayValRed, grayValGreen, grayValBlue;
|
||||
|
||||
HImage _RedChannel, _GreenChannel, _BlueChannel;
|
||||
|
||||
_RedChannel = hv_image.AccessChannel(1);
|
||||
_GreenChannel = hv_image.AccessChannel(2);
|
||||
_BlueChannel = hv_image.AccessChannel(3);
|
||||
|
||||
grayValRed = _RedChannel.GetGrayval((int)positionY, (int)positionX);
|
||||
grayValGreen = _GreenChannel.GetGrayval((int)positionY, (int)positionX);
|
||||
grayValBlue = _BlueChannel.GetGrayval((int)positionY, (int)positionX);
|
||||
|
||||
_RedChannel.Dispose();
|
||||
_GreenChannel.Dispose();
|
||||
_BlueChannel.Dispose();
|
||||
|
||||
str_value = String.Format("V: ({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;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//不处理
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public void ClearWindow()
|
||||
{
|
||||
try
|
||||
{
|
||||
this.Invoke(new Action(
|
||||
() =>
|
||||
{
|
||||
//this.hv_image = null;
|
||||
m_CtrlHStatusLabelCtrl.Visible = false;
|
||||
barVisible_strip.Enabled = false;
|
||||
fit_strip.Enabled = false;
|
||||
histogram_strip.Enabled = false;
|
||||
saveImg_strip.Enabled = false;
|
||||
saveWindow_strip.Enabled = false;
|
||||
|
||||
mCtrl_HWindow.HalconWindow.ClearWindow();
|
||||
viewWindow.ClearWindow();
|
||||
|
||||
}
|
||||
));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.ToString());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Hobject转换为的临时Himage,显示背景图
|
||||
/// </summary>
|
||||
/// <param name="hobject">传递Hobject,必须为图像</param>
|
||||
public void HobjectToHimage(HObject hobject)
|
||||
{
|
||||
if (hobject == null || !hobject.IsInitialized())
|
||||
{
|
||||
ClearWindow();
|
||||
return;
|
||||
}
|
||||
|
||||
this.Image = new HImage(hobject);
|
||||
|
||||
}
|
||||
|
||||
#region 缩放后,再次显示传入的HObject
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 默认红颜色显示
|
||||
/// </summary>
|
||||
/// <param name="hObj">传入的region.xld,image</param>
|
||||
public void DispObj(HObject hObj)
|
||||
{
|
||||
|
||||
lock (this)
|
||||
{
|
||||
viewWindow.displayHobject(hObj, null);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重新开辟内存保存 防止被传入的HObject在其他地方dispose后,不能重现
|
||||
/// </summary>
|
||||
/// <param name="hObj">传入的region.xld,image</param>
|
||||
/// <param name="color">颜色</param>
|
||||
public void DispObj(HObject hObj, string color)
|
||||
{
|
||||
|
||||
lock (this)
|
||||
{
|
||||
viewWindow.displayHobject(hObj, color);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 鼠标离开事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void mCtrl_HWindow_MouseLeave(object sender, EventArgs e)
|
||||
{
|
||||
//避免鼠标离开窗口,再返回的时候,图表随着鼠标移动
|
||||
viewWindow.mouseleave();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
105
ImageWindow/HWindow_Final.designer.cs
generated
Normal file
105
ImageWindow/HWindow_Final.designer.cs
generated
Normal file
@@ -0,0 +1,105 @@
|
||||
namespace ChoiceTech.Halcon.Control
|
||||
{
|
||||
partial class HWindow_Final
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
hv_MenuStrip.Dispose();
|
||||
|
||||
mCtrl_HWindow.HMouseMove -= HWindowControl_HMouseMove;
|
||||
}
|
||||
if (disposing && hv_image != null)
|
||||
{
|
||||
hv_image.Dispose();
|
||||
}
|
||||
if (disposing && hv_window != null)
|
||||
{
|
||||
hv_window.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(HWindow_Final));
|
||||
this.m_CtrlHStatusLabelCtrl = new System.Windows.Forms.Label();
|
||||
this.m_CtrlImageList = new System.Windows.Forms.ImageList(this.components);
|
||||
this.mCtrl_HWindow = new HalconDotNet.HWindowControl();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// m_CtrlHStatusLabelCtrl
|
||||
//
|
||||
this.m_CtrlHStatusLabelCtrl.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.m_CtrlHStatusLabelCtrl.AutoSize = true;
|
||||
this.m_CtrlHStatusLabelCtrl.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.m_CtrlHStatusLabelCtrl.ForeColor = System.Drawing.SystemColors.WindowText;
|
||||
this.m_CtrlHStatusLabelCtrl.Location = new System.Drawing.Point(3, 498);
|
||||
this.m_CtrlHStatusLabelCtrl.Margin = new System.Windows.Forms.Padding(3);
|
||||
this.m_CtrlHStatusLabelCtrl.Name = "m_CtrlHStatusLabelCtrl";
|
||||
this.m_CtrlHStatusLabelCtrl.Size = new System.Drawing.Size(0, 17);
|
||||
this.m_CtrlHStatusLabelCtrl.TabIndex = 1;
|
||||
//
|
||||
// m_CtrlImageList
|
||||
//
|
||||
this.m_CtrlImageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("m_CtrlImageList.ImageStream")));
|
||||
this.m_CtrlImageList.TransparentColor = System.Drawing.Color.Transparent;
|
||||
this.m_CtrlImageList.Images.SetKeyName(0, "TableIcon.png");
|
||||
this.m_CtrlImageList.Images.SetKeyName(1, "PicturesIcon.png");
|
||||
//
|
||||
// mCtrl_HWindow
|
||||
//
|
||||
this.mCtrl_HWindow.BackColor = System.Drawing.Color.Black;
|
||||
this.mCtrl_HWindow.BorderColor = System.Drawing.Color.Black;
|
||||
this.mCtrl_HWindow.Cursor = System.Windows.Forms.Cursors.Default;
|
||||
this.mCtrl_HWindow.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.mCtrl_HWindow.ImagePart = new System.Drawing.Rectangle(0, 0, 640, 480);
|
||||
this.mCtrl_HWindow.Location = new System.Drawing.Point(0, 0);
|
||||
this.mCtrl_HWindow.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.mCtrl_HWindow.Name = "mCtrl_HWindow";
|
||||
this.mCtrl_HWindow.Size = new System.Drawing.Size(562, 518);
|
||||
this.mCtrl_HWindow.TabIndex = 0;
|
||||
this.mCtrl_HWindow.WindowSize = new System.Drawing.Size(562, 518);
|
||||
this.mCtrl_HWindow.HMouseMove += new HalconDotNet.HMouseEventHandler(this.HWindowControl_HMouseMove);
|
||||
this.mCtrl_HWindow.MouseLeave += new System.EventHandler(this.mCtrl_HWindow_MouseLeave);
|
||||
//
|
||||
// HWindow_Final
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.Transparent;
|
||||
this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.Controls.Add(this.m_CtrlHStatusLabelCtrl);
|
||||
this.Controls.Add(this.mCtrl_HWindow);
|
||||
this.Name = "HWindow_Final";
|
||||
this.Size = new System.Drawing.Size(562, 518);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label m_CtrlHStatusLabelCtrl;
|
||||
private System.Windows.Forms.ImageList m_CtrlImageList;
|
||||
private HalconDotNet.HWindowControl mCtrl_HWindow;
|
||||
}
|
||||
}
|
||||
172
ImageWindow/HWindow_Final.resx
Normal file
172
ImageWindow/HWindow_Final.resx
Normal file
@@ -0,0 +1,172 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="m_CtrlImageList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<data name="m_CtrlImageList.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
|
||||
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
|
||||
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADk
|
||||
CAAAAk1TRnQBSQFMAgEBAgEAAbABAAGwAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
||||
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
|
||||
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
|
||||
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
|
||||
AWYDAAGZAwABzAIAATMDAAIzAgABMwFmAgABMwGZAgABMwHMAgABMwH/AgABZgMAAWYBMwIAAmYCAAFm
|
||||
AZkCAAFmAcwCAAFmAf8CAAGZAwABmQEzAgABmQFmAgACmQIAAZkBzAIAAZkB/wIAAcwDAAHMATMCAAHM
|
||||
AWYCAAHMAZkCAALMAgABzAH/AgAB/wFmAgAB/wGZAgAB/wHMAQABMwH/AgAB/wEAATMBAAEzAQABZgEA
|
||||
ATMBAAGZAQABMwEAAcwBAAEzAQAB/wEAAf8BMwIAAzMBAAIzAWYBAAIzAZkBAAIzAcwBAAIzAf8BAAEz
|
||||
AWYCAAEzAWYBMwEAATMCZgEAATMBZgGZAQABMwFmAcwBAAEzAWYB/wEAATMBmQIAATMBmQEzAQABMwGZ
|
||||
AWYBAAEzApkBAAEzAZkBzAEAATMBmQH/AQABMwHMAgABMwHMATMBAAEzAcwBZgEAATMBzAGZAQABMwLM
|
||||
AQABMwHMAf8BAAEzAf8BMwEAATMB/wFmAQABMwH/AZkBAAEzAf8BzAEAATMC/wEAAWYDAAFmAQABMwEA
|
||||
AWYBAAFmAQABZgEAAZkBAAFmAQABzAEAAWYBAAH/AQABZgEzAgABZgIzAQABZgEzAWYBAAFmATMBmQEA
|
||||
AWYBMwHMAQABZgEzAf8BAAJmAgACZgEzAQADZgEAAmYBmQEAAmYBzAEAAWYBmQIAAWYBmQEzAQABZgGZ
|
||||
AWYBAAFmApkBAAFmAZkBzAEAAWYBmQH/AQABZgHMAgABZgHMATMBAAFmAcwBmQEAAWYCzAEAAWYBzAH/
|
||||
AQABZgH/AgABZgH/ATMBAAFmAf8BmQEAAWYB/wHMAQABzAEAAf8BAAH/AQABzAEAApkCAAGZATMBmQEA
|
||||
AZkBAAGZAQABmQEAAcwBAAGZAwABmQIzAQABmQEAAWYBAAGZATMBzAEAAZkBAAH/AQABmQFmAgABmQFm
|
||||
ATMBAAGZATMBZgEAAZkBZgGZAQABmQFmAcwBAAGZATMB/wEAApkBMwEAApkBZgEAA5kBAAKZAcwBAAKZ
|
||||
Af8BAAGZAcwCAAGZAcwBMwEAAWYBzAFmAQABmQHMAZkBAAGZAswBAAGZAcwB/wEAAZkB/wIAAZkB/wEz
|
||||
AQABmQHMAWYBAAGZAf8BmQEAAZkB/wHMAQABmQL/AQABzAMAAZkBAAEzAQABzAEAAWYBAAHMAQABmQEA
|
||||
AcwBAAHMAQABmQEzAgABzAIzAQABzAEzAWYBAAHMATMBmQEAAcwBMwHMAQABzAEzAf8BAAHMAWYCAAHM
|
||||
AWYBMwEAAZkCZgEAAcwBZgGZAQABzAFmAcwBAAGZAWYB/wEAAcwBmQIAAcwBmQEzAQABzAGZAWYBAAHM
|
||||
ApkBAAHMAZkBzAEAAcwBmQH/AQACzAIAAswBMwEAAswBZgEAAswBmQEAA8wBAALMAf8BAAHMAf8CAAHM
|
||||
Af8BMwEAAZkB/wFmAQABzAH/AZkBAAHMAf8BzAEAAcwC/wEAAcwBAAEzAQAB/wEAAWYBAAH/AQABmQEA
|
||||
AcwBMwIAAf8CMwEAAf8BMwFmAQAB/wEzAZkBAAH/ATMBzAEAAf8BMwH/AQAB/wFmAgAB/wFmATMBAAHM
|
||||
AmYBAAH/AWYBmQEAAf8BZgHMAQABzAFmAf8BAAH/AZkCAAH/AZkBMwEAAf8BmQFmAQAB/wKZAQAB/wGZ
|
||||
AcwBAAH/AZkB/wEAAf8BzAIAAf8BzAEzAQAB/wHMAWYBAAH/AcwBmQEAAf8CzAEAAf8BzAH/AQAC/wEz
|
||||
AQABzAH/AWYBAAL/AZkBAAL/AcwBAAJmAf8BAAFmAf8BZgEAAWYC/wEAAf8CZgEAAf8BZgH/AQAC/wFm
|
||||
AQABIQEAAaUBAANfAQADdwEAA4YBAAOWAQADywEAA7IBAAPXAQAD3QEAA+MBAAPqAQAD8QEAA/gBAAHw
|
||||
AfsB/wEAAaQCoAEAA4ADAAH/AgAB/wMAAv8BAAH/AwAB/wEAAf8BAAL/AgAD/4IAAbwB9wPvAZID7wHt
|
||||
A+8B6gIAAQcB6wpyAesBFSIAAbwB8wL/AfQB8QP/AQcD/wHqAgABBwyYAREiAAG8AfMC/wH0AfED/wEH
|
||||
A/8B6gIAAQcGmAF4AZgCmQKYAREiAAG8AQcD8AG8A/ABBwPwAeoCAAEHAfACeAKYAXgBCAH2BP8BFSIA
|
||||
AbwB8gL0AfMB8QL0Af8BBwH/AfQB/wHqAgABBwH/AfMDCAHzBv8BFCIAAbwB8wL/AfQB8QP/AQcD/wHq
|
||||
AgABBwf/AcMBWQGaAv8BFCIAAbwB8gL0AfMB8QL0Af8BBwH/AfQB/wHqAgABBwf/AZoB/wHDAZoB/wEU
|
||||
IgABvAEHA/ABvAPwAQcD8AHqAgABBwb/AfYBGgH/AfYBegH/ARQiAAG8AfMC/wH0AfED/wEHA/8B6gIA
|
||||
AQcH/wEaApoBwwH/ARQiAAG8AfMC/wH0AfED/wEHA/8B6gIAAQcM/wEUIgABvAH3A+8BkgPvAe0D7wHq
|
||||
AgABBwz3ARThAAFCAU0BPgcAAT4DAAEoAwABQAMAARADAAEBAQABAQUAAYAXAAP/AQAE/wQABP8EAAGA
|
||||
AQEBgAEBBAABgAEBAYABAQQAAYABAQGAAQEEAAGAAQEBgAEBBAABgAEBAYABAQQAAYABAQGAAQEEAAGA
|
||||
AQEBgAEBBAABgAEBAYABAQQAAYABAQGAAQEEAAGAAQEBgAEBBAABgAEBAYABAQQABP8EAAT/BAAE/wQA
|
||||
Cw==
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="mCtrl_HWindow.LayoutBitmap" type="System.Resources.ResXNullRef, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value />
|
||||
</metadata>
|
||||
</root>
|
||||
32
ImageWindow/HWindow_Tool.sln
Normal file
32
ImageWindow/HWindow_Tool.sln
Normal file
@@ -0,0 +1,32 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HWindow_Tool", "HWindow_Tool.csproj", "{9BAA53FD-89B5-43E2-AC59-A27B006DEBB6}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{9BAA53FD-89B5-43E2-AC59-A27B006DEBB6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9BAA53FD-89B5-43E2-AC59-A27B006DEBB6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9BAA53FD-89B5-43E2-AC59-A27B006DEBB6}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{9BAA53FD-89B5-43E2-AC59-A27B006DEBB6}.Debug|x64.Build.0 = Debug|x64
|
||||
{9BAA53FD-89B5-43E2-AC59-A27B006DEBB6}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{9BAA53FD-89B5-43E2-AC59-A27B006DEBB6}.Debug|x86.Build.0 = Debug|x86
|
||||
{9BAA53FD-89B5-43E2-AC59-A27B006DEBB6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9BAA53FD-89B5-43E2-AC59-A27B006DEBB6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9BAA53FD-89B5-43E2-AC59-A27B006DEBB6}.Release|x64.ActiveCfg = Release|x64
|
||||
{9BAA53FD-89B5-43E2-AC59-A27B006DEBB6}.Release|x64.Build.0 = Release|x64
|
||||
{9BAA53FD-89B5-43E2-AC59-A27B006DEBB6}.Release|x86.ActiveCfg = Release|x86
|
||||
{9BAA53FD-89B5-43E2-AC59-A27B006DEBB6}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
BIN
ImageWindow/HWindow_Tool.suo
Normal file
BIN
ImageWindow/HWindow_Tool.suo
Normal file
Binary file not shown.
BIN
ImageWindow/HWindow_Tool.v11.suo
Normal file
BIN
ImageWindow/HWindow_Tool.v11.suo
Normal file
Binary file not shown.
415
ImageWindow/Model/GraphicsContext.cs
Normal file
415
ImageWindow/Model/GraphicsContext.cs
Normal file
@@ -0,0 +1,415 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using HalconDotNet;
|
||||
|
||||
namespace ViewWindow.Model
|
||||
{
|
||||
public delegate void GCDelegate(string val);
|
||||
|
||||
/// <summary>
|
||||
/// This class contains the graphical context of an HALCON object. The
|
||||
/// set of graphical modes is defined by the hashlist 'graphicalSettings'.
|
||||
/// If the list is empty, then there is no difference to the graphical
|
||||
/// setting defined by the system by default. Otherwise, the provided
|
||||
/// HALCON window is adjusted according to the entries of the supplied
|
||||
/// graphical context (when calling applyContext())
|
||||
/// </summary>
|
||||
public class GraphicsContext
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Graphical mode for the output color (see dev_set_color)
|
||||
/// </summary>
|
||||
public const string GC_COLOR = "Color";
|
||||
|
||||
/// <summary>
|
||||
/// Graphical mode for the multi-color output (see dev_set_colored)
|
||||
/// </summary>
|
||||
public const string GC_COLORED = "Colored";
|
||||
|
||||
/// <summary>
|
||||
/// Graphical mode for the line width (see set_line_width)
|
||||
/// </summary>
|
||||
public const string GC_LINEWIDTH = "LineWidth";
|
||||
|
||||
/// <summary>
|
||||
/// Graphical mode for the drawing (see set_draw)
|
||||
/// </summary>
|
||||
public const string GC_DRAWMODE = "DrawMode";
|
||||
|
||||
/// <summary>
|
||||
/// Graphical mode for the drawing shape (see set_shape)
|
||||
/// </summary>
|
||||
public const string GC_SHAPE = "Shape";
|
||||
|
||||
/// <summary>
|
||||
/// Graphical mode for the LUT (lookup table) (see set_lut)
|
||||
/// </summary>
|
||||
public const string GC_LUT = "Lut";
|
||||
|
||||
/// <summary>
|
||||
/// Graphical mode for the painting (see set_paint)
|
||||
/// </summary>
|
||||
public const string GC_PAINT = "Paint";
|
||||
|
||||
/// <summary>
|
||||
/// Graphical mode for the line style (see set_line_style)
|
||||
/// </summary>
|
||||
public const string GC_LINESTYLE = "LineStyle";
|
||||
|
||||
/// <summary>
|
||||
/// Hashlist containing entries for graphical modes (defined by GC_*),
|
||||
/// which is then linked to some HALCON object to describe its
|
||||
/// graphical context.
|
||||
/// </summary>
|
||||
private Hashtable graphicalSettings;
|
||||
|
||||
/// <summary>
|
||||
/// Backup of the last graphical context applied to the window.
|
||||
/// </summary>
|
||||
public Hashtable stateOfSettings;
|
||||
|
||||
private IEnumerator iterator;
|
||||
|
||||
/// <summary>
|
||||
/// Option to delegate messages from the graphical context
|
||||
/// to some observer class
|
||||
/// </summary>
|
||||
public GCDelegate gcNotification;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Creates a graphical context with no initial
|
||||
/// graphical modes
|
||||
/// </summary>
|
||||
public GraphicsContext()
|
||||
{
|
||||
graphicalSettings = new Hashtable(10, 0.2f);
|
||||
gcNotification = new GCDelegate(dummy);
|
||||
stateOfSettings = new Hashtable(10, 0.2f);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Creates an instance of the graphical context with
|
||||
/// the modes defined in the hashtable 'settings'
|
||||
/// </summary>
|
||||
/// <param name="settings">
|
||||
/// List of modes, which describes the graphical context
|
||||
/// </param>
|
||||
public GraphicsContext(Hashtable settings)
|
||||
{
|
||||
graphicalSettings = settings;
|
||||
gcNotification = new GCDelegate(dummy);
|
||||
stateOfSettings = new Hashtable(10, 0.2f);
|
||||
}
|
||||
|
||||
/// <summary>Applies graphical context to the HALCON window</summary>
|
||||
/// <param name="window">Active HALCON window</param>
|
||||
/// <param name="cContext">
|
||||
/// List that contains graphical modes for window
|
||||
/// </param>
|
||||
public void applyContext(HWindow window, Hashtable cContext)
|
||||
{
|
||||
string key = "";
|
||||
string valS = "";
|
||||
int valI = -1;
|
||||
HTuple valH = null;
|
||||
|
||||
iterator = cContext.Keys.GetEnumerator();
|
||||
|
||||
try
|
||||
{
|
||||
while (iterator.MoveNext())
|
||||
{
|
||||
|
||||
key = (string)iterator.Current;
|
||||
|
||||
if (stateOfSettings.Contains(key) &&
|
||||
stateOfSettings[key] == cContext[key])
|
||||
continue;
|
||||
|
||||
switch (key)
|
||||
{
|
||||
case GC_COLOR:
|
||||
valS = (string)cContext[key];
|
||||
window.SetColor(valS);
|
||||
if (stateOfSettings.Contains(GC_COLORED))
|
||||
stateOfSettings.Remove(GC_COLORED);
|
||||
|
||||
break;
|
||||
case GC_COLORED:
|
||||
valI = (int)cContext[key];
|
||||
window.SetColored(valI);
|
||||
|
||||
if (stateOfSettings.Contains(GC_COLOR))
|
||||
stateOfSettings.Remove(GC_COLOR);
|
||||
|
||||
break;
|
||||
case GC_DRAWMODE:
|
||||
valS = (string)cContext[key];
|
||||
window.SetDraw(valS);
|
||||
break;
|
||||
case GC_LINEWIDTH:
|
||||
valI = (int)cContext[key];
|
||||
window.SetLineWidth(valI);
|
||||
break;
|
||||
case GC_LUT:
|
||||
valS = (string)cContext[key];
|
||||
window.SetLut(valS);
|
||||
break;
|
||||
case GC_PAINT:
|
||||
valS = (string)cContext[key];
|
||||
window.SetPaint(valS);
|
||||
break;
|
||||
case GC_SHAPE:
|
||||
valS = (string)cContext[key];
|
||||
window.SetShape(valS);
|
||||
break;
|
||||
case GC_LINESTYLE:
|
||||
valH = (HTuple)cContext[key];
|
||||
window.SetLineStyle(valH);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (valI != -1)
|
||||
{
|
||||
if (stateOfSettings.Contains(key))
|
||||
stateOfSettings[key] = valI;
|
||||
else
|
||||
stateOfSettings.Add(key, valI);
|
||||
|
||||
valI = -1;
|
||||
}
|
||||
else if (valS != "")
|
||||
{
|
||||
if (stateOfSettings.Contains(key))
|
||||
stateOfSettings[key] = valI;
|
||||
else
|
||||
stateOfSettings.Add(key, valI);
|
||||
|
||||
valS = "";
|
||||
}
|
||||
else if (valH != null)
|
||||
{
|
||||
if (stateOfSettings.Contains(key))
|
||||
stateOfSettings[key] = valI;
|
||||
else
|
||||
stateOfSettings.Add(key, valI);
|
||||
|
||||
valH = null;
|
||||
}
|
||||
}//while
|
||||
}
|
||||
catch (HOperatorException e)
|
||||
{
|
||||
gcNotification(e.Message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Sets a value for the graphical mode GC_COLOR</summary>
|
||||
/// <param name="val">
|
||||
/// A single color, e.g. "blue", "green" ...etc.
|
||||
/// </param>
|
||||
public void setColorAttribute(string val)
|
||||
{
|
||||
if (graphicalSettings.ContainsKey(GC_COLORED))
|
||||
graphicalSettings.Remove(GC_COLORED);
|
||||
|
||||
addValue(GC_COLOR, val);
|
||||
}
|
||||
|
||||
/// <summary>Sets a value for the graphical mode GC_COLORED</summary>
|
||||
/// <param name="val">
|
||||
/// The colored mode, which can be either "colored3" or "colored6"
|
||||
/// or "colored12"
|
||||
/// </param>
|
||||
public void setColoredAttribute(int val)
|
||||
{
|
||||
if (graphicalSettings.ContainsKey(GC_COLOR))
|
||||
graphicalSettings.Remove(GC_COLOR);
|
||||
|
||||
addValue(GC_COLORED, val);
|
||||
}
|
||||
|
||||
/// <summary>Sets a value for the graphical mode GC_DRAWMODE</summary>
|
||||
/// <param name="val">
|
||||
/// One of the possible draw modes: "margin" or "fill"
|
||||
/// </param>
|
||||
public void setDrawModeAttribute(string val)
|
||||
{
|
||||
addValue(GC_DRAWMODE, val);
|
||||
}
|
||||
|
||||
/// <summary>Sets a value for the graphical mode GC_LINEWIDTH</summary>
|
||||
/// <param name="val">
|
||||
/// The line width, which can range from 1 to 50
|
||||
/// </param>
|
||||
public void setLineWidthAttribute(int val)
|
||||
{
|
||||
addValue(GC_LINEWIDTH, val);
|
||||
}
|
||||
|
||||
/// <summary>Sets a value for the graphical mode GC_LUT</summary>
|
||||
/// <param name="val">
|
||||
/// One of the possible modes of look up tables. For
|
||||
/// further information on particular setups, please refer to the
|
||||
/// Reference Manual entry of the operator set_lut.
|
||||
/// </param>
|
||||
public void setLutAttribute(string val)
|
||||
{
|
||||
addValue(GC_LUT, val);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Sets a value for the graphical mode GC_PAINT</summary>
|
||||
/// <param name="val">
|
||||
/// One of the possible paint modes. For further
|
||||
/// information on particular setups, please refer refer to the
|
||||
/// Reference Manual entry of the operator set_paint.
|
||||
/// </param>
|
||||
public void setPaintAttribute(string val)
|
||||
{
|
||||
addValue(GC_PAINT, val);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Sets a value for the graphical mode GC_SHAPE</summary>
|
||||
/// <param name="val">
|
||||
/// One of the possible shape modes. For further
|
||||
/// information on particular setups, please refer refer to the
|
||||
/// Reference Manual entry of the operator set_shape.
|
||||
/// </param>
|
||||
public void setShapeAttribute(string val)
|
||||
{
|
||||
addValue(GC_SHAPE, val);
|
||||
}
|
||||
|
||||
/// <summary>Sets a value for the graphical mode GC_LINESTYLE</summary>
|
||||
/// <param name="val">
|
||||
/// A line style mode, which works
|
||||
/// identical to the input for the HDevelop operator
|
||||
/// 'set_line_style'. For particular information on this
|
||||
/// topic, please refer to the Reference Manual entry of the operator
|
||||
/// set_line_style.
|
||||
/// </param>
|
||||
public void setLineStyleAttribute(HTuple val)
|
||||
{
|
||||
addValue(GC_LINESTYLE, val);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a value to the hashlist 'graphicalSettings' for the
|
||||
/// graphical mode described by the parameter 'key'
|
||||
/// </summary>
|
||||
/// <param name="key">
|
||||
/// A graphical mode defined by the constant GC_*
|
||||
/// </param>
|
||||
/// <param name="val">
|
||||
/// Defines the value as an int for this graphical
|
||||
/// mode 'key'
|
||||
/// </param>
|
||||
private void addValue(string key, int val)
|
||||
{
|
||||
if (graphicalSettings.ContainsKey(key))
|
||||
graphicalSettings[key] = val;
|
||||
else
|
||||
graphicalSettings.Add(key, val);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a value to the hashlist 'graphicalSettings' for the
|
||||
/// graphical mode, described by the parameter 'key'
|
||||
/// </summary>
|
||||
/// <param name="key">
|
||||
/// A graphical mode defined by the constant GC_*
|
||||
/// </param>
|
||||
/// <param name="val">
|
||||
/// Defines the value as a string for this
|
||||
/// graphical mode 'key'
|
||||
/// </param>
|
||||
private void addValue(string key, string val)
|
||||
{
|
||||
if (graphicalSettings.ContainsKey(key))
|
||||
graphicalSettings[key] = val;
|
||||
else
|
||||
graphicalSettings.Add(key, val);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Adds a value to the hashlist 'graphicalSettings' for the
|
||||
/// graphical mode, described by the parameter 'key'
|
||||
/// </summary>
|
||||
/// <param name="key">
|
||||
/// A graphical mode defined by the constant GC_*
|
||||
/// </param>
|
||||
/// <param name="val">
|
||||
/// Defines the value as a HTuple for this
|
||||
/// graphical mode 'key'
|
||||
/// </param>
|
||||
private void addValue(string key, HTuple val)
|
||||
{
|
||||
if (graphicalSettings.ContainsKey(key))
|
||||
graphicalSettings[key] = val;
|
||||
else
|
||||
graphicalSettings.Add(key, val);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears the list of graphical settings.
|
||||
/// There will be no graphical changes made prior
|
||||
/// before drawing objects, since there are no
|
||||
/// graphical entries to be applied to the window.
|
||||
/// </summary>
|
||||
public void clear()
|
||||
{
|
||||
graphicalSettings.Clear();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns an exact clone of this graphicsContext instance
|
||||
/// </summary>
|
||||
public GraphicsContext copy()
|
||||
{
|
||||
return new GraphicsContext((Hashtable)this.graphicalSettings.Clone());
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// If the hashtable contains the key, the corresponding
|
||||
/// hashtable value is returned
|
||||
/// </summary>
|
||||
/// <param name="key">
|
||||
/// One of the graphical keys starting with GC_*
|
||||
/// </param>
|
||||
public object getGraphicsAttribute(string key)
|
||||
{
|
||||
if (graphicalSettings.ContainsKey(key))
|
||||
return graphicalSettings[key];
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a copy of the hashtable that carries the
|
||||
/// entries for the current graphical context
|
||||
/// </summary>
|
||||
/// <returns> current graphical context </returns>
|
||||
public Hashtable copyContextList()
|
||||
{
|
||||
return (Hashtable)graphicalSettings.Clone();
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************/
|
||||
public void dummy(string val) { }
|
||||
|
||||
}//end of class
|
||||
}//end of namespace
|
||||
51
ImageWindow/Model/HObjectEntry.cs
Normal file
51
ImageWindow/Model/HObjectEntry.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using HalconDotNet;
|
||||
using System.Collections;
|
||||
|
||||
namespace ViewWindow.Model
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// This class is an auxiliary class, which is used to
|
||||
/// link a graphical context to an HALCON object. The graphical
|
||||
/// context is described by a hashtable, which contains a list of
|
||||
/// graphical modes (e.g GC_COLOR, GC_LINEWIDTH and GC_PAINT)
|
||||
/// and their corresponding values (e.g "blue", "4", "3D-plot"). These
|
||||
/// graphical states are applied to the window before displaying the
|
||||
/// object.
|
||||
/// </summary>
|
||||
public class HObjectEntry
|
||||
{
|
||||
/// <summary>Hashlist defining the graphical context for HObj</summary>
|
||||
public Hashtable gContext;
|
||||
|
||||
/// <summary>HALCON object</summary>
|
||||
public HObject HObj;
|
||||
|
||||
|
||||
|
||||
/// <summary>Constructor</summary>
|
||||
/// <param name="obj">
|
||||
/// HALCON object that is linked to the graphical context gc.
|
||||
/// </param>
|
||||
/// <param name="gc">
|
||||
/// Hashlist of graphical states that are applied before the object
|
||||
/// is displayed.
|
||||
/// </param>
|
||||
public HObjectEntry(HObject obj, Hashtable gc)
|
||||
{
|
||||
gContext = gc;
|
||||
HObj = obj;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears the entries of the class members Hobj and gContext
|
||||
/// </summary>
|
||||
public void clear()
|
||||
{
|
||||
gContext.Clear();
|
||||
HObj.Dispose();
|
||||
}
|
||||
|
||||
}//end of class
|
||||
}//end of namespace
|
||||
1147
ImageWindow/Model/HWndCtrl.cs
Normal file
1147
ImageWindow/Model/HWndCtrl.cs
Normal file
File diff suppressed because it is too large
Load Diff
30
ImageWindow/Model/IViewWindow.cs
Normal file
30
ImageWindow/Model/IViewWindow.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using HalconDotNet;
|
||||
|
||||
namespace ViewWindow.Model
|
||||
{
|
||||
interface IViewWindow
|
||||
{
|
||||
void displayImage(HObject img);
|
||||
void resetWindowImage();
|
||||
void zoomWindowImage();
|
||||
void moveWindowImage();
|
||||
void noneWindowImage();
|
||||
void genRect1(double row1, double col1, double row2, double col2, ref List<ROI> rois);
|
||||
void genRect2(double row, double col, double phi, double length1, double length2, ref List<ROI> rois);
|
||||
void genCircle(double row, double col, double radius, ref List<ROI> rois);
|
||||
void genCircularArc(double row, double col, double radius,double startPhi, double extentPhi,string direct, ref List<ROI> rois);
|
||||
void genLine(double beginRow, double beginCol, double endRow, double endCol, ref List<ROI> rois);
|
||||
List<double> smallestActiveROI(out string name,out int index);
|
||||
ROI smallestActiveROI(out List<double> data, out int index);
|
||||
void selectROI(int index);
|
||||
void selectROI(List<ROI> rois, int index);
|
||||
void displayROI(List<ROI> rois);
|
||||
void removeActiveROI(ref List<ROI> rois);
|
||||
void saveROI(List<ROI> rois, string fileNmae);
|
||||
void loadROI(string fileName, out List<ROI> rois);
|
||||
}
|
||||
}
|
||||
187
ImageWindow/Model/ROI.cs
Normal file
187
ImageWindow/Model/ROI.cs
Normal file
@@ -0,0 +1,187 @@
|
||||
using System;
|
||||
using HalconDotNet;
|
||||
|
||||
namespace ViewWindow.Model
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// This class is a base class containing virtual methods for handling
|
||||
/// ROIs. Therefore, an inheriting class needs to define/override these
|
||||
/// methods to provide the ROIController with the necessary information on
|
||||
/// its (= the ROIs) shape and position. The example project provides
|
||||
/// derived ROI shapes for rectangles, lines, circles, and circular arcs.
|
||||
/// To use other shapes you must derive a new class from the base class
|
||||
/// ROI and implement its methods.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class ROI
|
||||
{
|
||||
private string color = "blue";
|
||||
|
||||
public string Color
|
||||
{
|
||||
get { return this.color; }
|
||||
set { this.color = value; }
|
||||
}
|
||||
|
||||
private string _type;
|
||||
public string Type
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._type ;
|
||||
}
|
||||
set
|
||||
{
|
||||
this._type = value;
|
||||
}
|
||||
}
|
||||
|
||||
// class members of inheriting ROI classes
|
||||
protected int NumHandles;
|
||||
protected int activeHandleIdx;
|
||||
|
||||
/// <summary>
|
||||
/// Flag to define the ROI to be 'positive' or 'negative'.
|
||||
/// </summary>
|
||||
protected int OperatorFlag;
|
||||
|
||||
/// <summary>Parameter to define the line style of the ROI.</summary>
|
||||
public HTuple flagLineStyle;
|
||||
|
||||
/// <summary>Constant for a positive ROI flag.</summary>
|
||||
public const int POSITIVE_FLAG = ROIController.MODE_ROI_POS;
|
||||
|
||||
/// <summary>Constant for a negative ROI flag.</summary>
|
||||
public const int NEGATIVE_FLAG = ROIController.MODE_ROI_NEG;
|
||||
|
||||
public const int ROI_TYPE_LINE = 10;
|
||||
public const int ROI_TYPE_CIRCLE = 11;
|
||||
public const int ROI_TYPE_CIRCLEARC = 12;
|
||||
public const int ROI_TYPE_RECTANCLE1 = 13;
|
||||
public const int ROI_TYPE_RECTANGLE2 = 14;
|
||||
|
||||
|
||||
protected HTuple posOperation = new HTuple();
|
||||
protected HTuple negOperation = new HTuple(new int[] { 2, 2 });
|
||||
|
||||
/// <summary>Constructor of abstract ROI class.</summary>
|
||||
public ROI() { }
|
||||
|
||||
public virtual void createRectangle1(double row1, double col1, double row2, double col2) { }
|
||||
public virtual void createRectangle2(double row, double col, double phi, double length1, double length2) { }
|
||||
public virtual void createCircle(double row,double col,double radius) { }
|
||||
public virtual void createCircularArc(double row, double col, double radius, double startPhi, double extentPhi, string direct) { }
|
||||
public virtual void createLine(double beginRow, double beginCol, double endRow, double endCol) { }
|
||||
|
||||
/// <summary>Creates a new ROI instance at the mouse position.</summary>
|
||||
/// <param name="midX">
|
||||
/// x (=column) coordinate for ROI
|
||||
/// </param>
|
||||
/// <param name="midY">
|
||||
/// y (=row) coordinate for ROI
|
||||
/// </param>
|
||||
public virtual void createROI(double midX, double midY) { }
|
||||
|
||||
/// <summary>Paints the ROI into the supplied window.</summary>
|
||||
/// <param name="window">HALCON window</param>
|
||||
public virtual void draw(HalconDotNet.HWindow window) { }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the distance of the ROI handle being
|
||||
/// closest to the image point(x,y)
|
||||
/// </summary>
|
||||
/// <param name="x">x (=column) coordinate</param>
|
||||
/// <param name="y">y (=row) coordinate</param>
|
||||
/// <returns>
|
||||
/// Distance of the closest ROI handle.
|
||||
/// </returns>
|
||||
public virtual double distToClosestHandle(double x, double y)
|
||||
{
|
||||
return 0.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(HalconDotNet.HWindow window) { }
|
||||
|
||||
/// <summary>
|
||||
/// Recalculates the shape of the ROI. Translation is
|
||||
/// performed at the active handle of the ROI object
|
||||
/// for the image coordinate (x,y).
|
||||
/// </summary>
|
||||
/// <param name="x">x (=column) coordinate</param>
|
||||
/// <param name="y">y (=row) coordinate</param>
|
||||
public virtual void moveByHandle(double x, double y) { }
|
||||
|
||||
/// <summary>Gets the HALCON region described by the ROI.</summary>
|
||||
public virtual HRegion getRegion()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual double getDistanceFromStartPoint(double row, double col)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the model information described by
|
||||
/// the ROI.
|
||||
/// </summary>
|
||||
public virtual HTuple getModelData()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>Number of handles defined for the ROI.</summary>
|
||||
/// <returns>Number of handles</returns>
|
||||
public int getNumHandles()
|
||||
{
|
||||
return NumHandles;
|
||||
}
|
||||
|
||||
/// <summary>Gets the active handle of the ROI.</summary>
|
||||
/// <returns>Index of the active handle (from the handle list)</returns>
|
||||
public int getActHandleIdx()
|
||||
{
|
||||
return activeHandleIdx;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sign of the ROI object, being either
|
||||
/// 'positive' or 'negative'. This sign is used when creating a model
|
||||
/// region for matching applications from a list of ROIs.
|
||||
/// </summary>
|
||||
public int getOperatorFlag()
|
||||
{
|
||||
return OperatorFlag;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the sign of a ROI object to be positive or negative.
|
||||
/// The sign is used when creating a model region for matching
|
||||
/// applications by summing up all positive and negative ROI models
|
||||
/// created so far.
|
||||
/// </summary>
|
||||
/// <param name="flag">Sign of ROI object</param>
|
||||
public void setOperatorFlag(int flag)
|
||||
{
|
||||
OperatorFlag = flag;
|
||||
|
||||
switch (OperatorFlag)
|
||||
{
|
||||
case ROI.POSITIVE_FLAG:
|
||||
flagLineStyle = posOperation;
|
||||
break;
|
||||
case ROI.NEGATIVE_FLAG:
|
||||
flagLineStyle = negOperation;
|
||||
break;
|
||||
default:
|
||||
flagLineStyle = posOperation;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}//end of class
|
||||
}//end of namespace
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user