本文整理汇总了C#中IGraphic.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# IGraphic.GetHashCode方法的具体用法?C# IGraphic.GetHashCode怎么用?C# IGraphic.GetHashCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IGraphic
的用法示例。
在下文中一共展示了IGraphic.GetHashCode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GraphicToIMarkup
internal static IMarkup GraphicToIMarkup(IGraphic graphic)
{
if (graphic == null || graphic.ParentPresentationImage == null)
return null;
var markup = DoGraphicToIMarkup(graphic);
if (markup != null)
{
var sopInstanceUid = string.Empty;
var frameNumber = 1;
try
{
if (graphic.ParentPresentationImage is IImageSopProvider)
{
var imageSopProvider = graphic.ParentPresentationImage as IImageSopProvider;
sopInstanceUid = imageSopProvider.ImageSop.SopInstanceUid;
frameNumber = imageSopProvider.Frame.FrameNumber;
}
else if (!string.IsNullOrEmpty(graphic.ParentPresentationImage.Uid))
sopInstanceUid = graphic.ParentPresentationImage.Uid;
}
catch (Exception)
{
}
markup.PresentationImageUid = sopInstanceUid;
markup.FrameNumber = frameNumber;
markup.IncludeInAnnotation = true;
markup.GraphicHashcode = graphic.GetHashCode();
}
return markup;
}
示例2: DoGraphicToIMarkup
private static IMarkup DoGraphicToIMarkup(IGraphic graphic)
{
if (graphic == null || graphic.ParentPresentationImage == null)
return null;
IMarkup markup = null;
var roiGraphic = graphic as RoiGraphic;
if (roiGraphic != null)
{
if (roiGraphic.Roi is EllipticalRoi)
{
var ellipse = roiGraphic.Roi as EllipticalRoi;
markup = new MarkupEllipse
{
TopLeft = new PointF(ellipse.BoundingBox.Left, ellipse.BoundingBox.Top),
BottomRight = new PointF(ellipse.BoundingBox.Right, ellipse.BoundingBox.Bottom),
Name = graphic.Name,
GraphicHashcode = graphic.GetHashCode(),
CalloutLocation = roiGraphic.Callout.TextLocation
};
}
else if (roiGraphic.Roi is PolygonalRoi)
{
var polygon = roiGraphic.Roi as PolygonalRoi;
markup = new MarkupPolygonal
{
Name = graphic.Name,
Vertices = polygon.Polygon.Vertices == null ? null : new List<PointF>(polygon.Polygon.Vertices),
GraphicHashcode = graphic.GetHashCode(),
CalloutLocation = roiGraphic.Callout.TextLocation
};
}
else if (roiGraphic.Roi is RectangularRoi)
{
var rectangularRoi = roiGraphic.Roi as RectangularRoi;
markup = new MarkupRectangle
{
TopLeft = new PointF(rectangularRoi.BoundingBox.Left, rectangularRoi.BoundingBox.Top),
BottomRight = new PointF(rectangularRoi.BoundingBox.Right, rectangularRoi.BoundingBox.Bottom),
Name = graphic.Name,
GraphicHashcode = graphic.GetHashCode(),
CalloutLocation = roiGraphic.Callout.TextLocation
};
}
else if (roiGraphic.Roi is ProtractorRoi)
{
var protractorRoi = roiGraphic.Roi as ProtractorRoi;
markup = new MarkupProtractor
{
TopLeft = new PointF(protractorRoi.BoundingBox.Left, protractorRoi.BoundingBox.Top),
BottomRight = new PointF(protractorRoi.BoundingBox.Right, protractorRoi.BoundingBox.Bottom),
Name = graphic.Name,
Points = protractorRoi.Points == null ? null : new List<PointF>(protractorRoi.Points),
GraphicHashcode = graphic.GetHashCode(),
CalloutLocation = roiGraphic.Callout.TextLocation
};
}
else if (roiGraphic.Roi is LinearRoi)
{
var linearRoi = roiGraphic.Roi as LinearRoi;
markup = new MarkupLinear
{
Vertices = linearRoi.Points == null ? null : new List<PointF>(linearRoi.Points),
Name = graphic.Name,
GraphicHashcode = graphic.GetHashCode(),
CalloutLocation = roiGraphic.Callout.TextLocation
};
}
if (markup != null)
markup.CaptionText = roiGraphic.Roi.GetType().Name + Environment.NewLine + roiGraphic.Callout.Text;
}
else if (graphic is UserCalloutGraphic)
{
var userCalloutGraphic = graphic as UserCalloutGraphic;
markup = new MarkupPoint
{
Name = graphic.Name,
CaptionText = userCalloutGraphic.Text,
CalloutText = userCalloutGraphic.Text,
CalloutLocation = userCalloutGraphic.TextLocation,
Point = userCalloutGraphic.AnchorPoint,
GraphicHashcode = graphic.GetHashCode()
};
}
else if (graphic is CrosshairCalloutGraphic)
{
var userCalloutGraphic = graphic as CrosshairCalloutGraphic;
markup = new MarkupPoint
{
Name = graphic.Name,
CaptionText = userCalloutGraphic.Text,
//.........这里部分代码省略.........
示例3: RoiGraphicAndSegGraphicsMatch
internal static bool RoiGraphicAndSegGraphicsMatch(IGraphic roiGraphic, ISegGraphic segGraphic)
{
return roiGraphic.GetHashCode().Equals(segGraphic.GraphicHashCode) &&
roiGraphic.Name == segGraphic.Label;
}