QQ群日志记录
使用代码设定所选模板区域的中心原点,图形界面中可以使用如下图的按钮来操作
C#代码中可以使用如下的代码来完成中心原点的设定:
private void PatternCenterPoint()
{
try
{
if (this.pmalign_.Pattern != null && this.pmalign_.Pattern.TrainImage != null && this.pmalign_.Pattern.TrainRegion != null)
{
ICogTransform2D transform = this.pmalign_.Pattern.TrainImage.GetTransform(".", this.pmalign_.Pattern.TrainRegion.SelectedSpaceName);
CogRectangle rectangle = this.pmalign_.Pattern.TrainRegion.Map(transform, CogCopyShapeConstants.GeometryOnly).EnclosingRectangle(CogCopyShapeConstants.GeometryOnly);
this.pmalign_.Pattern.Origin.TranslationX = rectangle.CenterX;
this.pmalign_.Pattern.Origin.TranslationY = rectangle.CenterY;
this.Display_.AutoFit = true;
}
}
catch (Exception e)
{
Common.MsgBox.show(e.Message);
}
}