本文整理汇总了C#中IPresentationImage.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# IPresentationImage.Clone方法的具体用法?C# IPresentationImage.Clone怎么用?C# IPresentationImage.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPresentationImage
的用法示例。
在下文中一共展示了IPresentationImage.Clone方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ClonePresentationImage
/// <summary>
/// Creates a clone of a <see cref="IPresentationImage"/> suitable for static export.
/// </summary>
/// <remarks>
/// Functionally, this method is similar to <see cref="IPresentationImage.Clone"/>.
/// However, this method also fills the <see cref="IPresentationImage.ParentDisplaySet"/>
/// property with a static <see cref="IDisplaySet"/> instance whose properties are a snapshot
/// of the source image's parent display set at the time the clone was created.
/// This makes the resulting images suitable for export with features like annotation overlay
/// enabled, as certain items (specifically, display set description and number) depend on
/// this information.
/// </remarks>
/// <param name="presentationImage">The source image to be cloned.</param>
/// <returns>A clone of the source image.</returns>
/// <exception cref="ArgumentNullException">Thrown if <paramref name="presentationImage"/> is null.</exception>
public static IPresentationImage ClonePresentationImage(IPresentationImage presentationImage)
{
Platform.CheckForNullReference(presentationImage, "presentationImage");
var imageClone = presentationImage.Clone();
try
{
var parentDisplaySet = presentationImage.ParentDisplaySet;
if (parentDisplaySet != null)
{
var descriptor = parentDisplaySet.Descriptor;
if (descriptor != null)
parentDisplaySet = new DisplaySet(new BasicDisplaySetDescriptor {Description = descriptor.Description, Name = descriptor.Name, Number = descriptor.Number, Uid = descriptor.Uid});
else
parentDisplaySet = new DisplaySet(parentDisplaySet.Name, parentDisplaySet.Uid);
parentDisplaySet.PresentationImages.Add(imageClone);
}
}
catch (Exception ex)
{
Platform.Log(LogLevel.Debug, ex, "Failed to create a dummy parent display set for the cloned presentation image");
}
return imageClone;
}