mirror of
https://github.com/eggplantlwj/VisionEdit.git
synced 2026-04-06 18:26:35 +08:00
1、增加单独Job的保存、添加和创建
2、每个Job单独绑定一个图像窗体 3、支持通过以job的方式外部调用
This commit is contained in:
@@ -227,11 +227,15 @@ namespace FindLineTool
|
||||
public void UpdateModelLineLocation()
|
||||
{
|
||||
// 计算新的位置线和转换之后位置线之间的差异,再将差异补偿到模板位置线中
|
||||
HOperatorSet.VectorToSimilarity(new HTuple(newExpectLineStartRow, newExpectLineEndRow), new HTuple(newExpectLineStartCol, newExpectLineEndCol),
|
||||
if(newExpectLineStartRow.Type != HTupleType.EMPTY)
|
||||
{
|
||||
HOperatorSet.VectorToSimilarity(new HTuple(newExpectLineStartRow, newExpectLineEndRow), new HTuple(newExpectLineStartCol, newExpectLineEndCol),
|
||||
new HTuple(expectLineStartRow, expectLineEndRow), new HTuple(expectLineStartCol, expectLineEndCol), out changePoseHomMat2D);
|
||||
// 更新位置
|
||||
HOperatorSet.AffineTransPixel(changePoseHomMat2D, modelStartRow, modelStartCol, out modelStartRow, out modelStartCol);
|
||||
HOperatorSet.AffineTransPixel(changePoseHomMat2D, modelEndRow, modelEndCol, out modelEndRow, out modelEndCol);
|
||||
// 更新位置
|
||||
HOperatorSet.AffineTransPixel(changePoseHomMat2D, modelStartRow, modelStartCol, out modelStartRow, out modelStartCol);
|
||||
HOperatorSet.AffineTransPixel(changePoseHomMat2D, modelEndRow, modelEndCol, out modelEndRow, out modelEndCol);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override void Run(SoftwareRunState softwareRunState)
|
||||
@@ -253,7 +257,7 @@ namespace FindLineTool
|
||||
{
|
||||
UpdateImage();
|
||||
}
|
||||
if (inputPoseHomMat2D != null)
|
||||
if (inputPoseHomMat2D.Type != HTupleType.EMPTY)
|
||||
{
|
||||
//对预期线的起始点做放射变换
|
||||
HOperatorSet.AffineTransPixel(inputPoseHomMat2D, modelStartRow, modelStartCol, out newExpectLineStartRow, out newExpectLineStartCol);
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="WeifenLuo.WinFormsUI.Docking, Version=2.9.0.0, Culture=neutral, PublicKeyToken=null" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="FindLine.cs" />
|
||||
|
||||
@@ -31,10 +31,10 @@ namespace FindLineTool
|
||||
{
|
||||
public class FindLineRun : IToolRun
|
||||
{
|
||||
public void ToolRun(string jobName, int toolIndex, int inputItemNum, TreeNode selectNode, List<IToolInfo> L_toolList)
|
||||
public void ToolRun(string jobName, int toolIndex, int inputItemNum, TreeNode selectNode, List<IToolInfo> L_toolList, IVisionJob runJob, Form myHalconWindowForm)
|
||||
{
|
||||
FindLine myFindLine = (FindLine)L_toolList[toolIndex].tool;
|
||||
VisionJob myJob = VisionJobParams.pVisionProject.Project[jobName];
|
||||
VisionJob myJob = (VisionJob)runJob;
|
||||
for (int j = 0; j < inputItemNum; j++)
|
||||
{
|
||||
if (L_toolList[toolIndex].GetInput(L_toolList[toolIndex].toolInput[j].IOName).value == null)
|
||||
@@ -74,8 +74,9 @@ namespace FindLineTool
|
||||
else
|
||||
{
|
||||
myJob.FormLogDisp($"{L_toolList[toolIndex].toolName} 运行成功,{myFindLine.runTime}", Color.Green, selectNode);
|
||||
myFindLine.DispMainWindow(FormImageWindow.Instance.myHWindow);
|
||||
myFindLine.DispMainWindow(((FormImageWindow)myHalconWindowForm).myHWindow);
|
||||
}
|
||||
L_toolList[toolIndex].toolRunStatu = myFindLine.toolRunStatu;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace FindLineTool
|
||||
chBDispRec.Checked = myFindLine.dispRec;
|
||||
chBDispCross.Checked = myFindLine.dispCross;
|
||||
//// 将要编辑的线显示
|
||||
selected_drawing_object = myFindLine.inputPoseHomMat2D != null? HDrawingObject.CreateDrawingObject(HDrawingObject.HDrawingObjectType.LINE, new HTuple[] { myFindLine.newExpectLineStartRow, myFindLine.newExpectLineStartCol, myFindLine.newExpectLineEndRow, myFindLine.newExpectLineEndCol })
|
||||
selected_drawing_object = myFindLine.inputPoseHomMat2D.Length != 0? HDrawingObject.CreateDrawingObject(HDrawingObject.HDrawingObjectType.LINE, new HTuple[] { myFindLine.newExpectLineStartRow, myFindLine.newExpectLineStartCol, myFindLine.newExpectLineEndRow, myFindLine.newExpectLineEndCol })
|
||||
:HDrawingObject.CreateDrawingObject(HDrawingObject.HDrawingObjectType.LINE, new HTuple[] {myFindLine.modelStartRow, myFindLine.modelStartCol, myFindLine.modelEndRow, myFindLine.modelEndCol });
|
||||
GC.KeepAlive(selected_drawing_object);
|
||||
selected_drawing_object.OnSelect(OnSelectDrawingObject);
|
||||
|
||||
Reference in New Issue
Block a user