本文整理汇总了C#中Envelope.ToPolygon方法的典型用法代码示例。如果您正苦于以下问题:C# Envelope.ToPolygon方法的具体用法?C# Envelope.ToPolygon怎么用?C# Envelope.ToPolygon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Envelope
的用法示例。
在下文中一共展示了Envelope.ToPolygon方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MarkupHitTest
private HitType MarkupHitTest(Markup markup, IGeometry g, double distance, double scale)
{
WKTReader wktReader = new WKTReader();
IGeometry geometry = wktReader.Read(markup.Shape);
HitType hitType = HitType.None;
if (geometry.OgcGeometryType != OgcGeometryType.Point || String.IsNullOrEmpty(markup.Text))
{
if ((g is IPoint && geometry.Distance(g) <= distance) || (!(g is IPoint) && geometry.Intersects(g)))
{
hitType = geometry.OgcGeometryType == OgcGeometryType.Point && markup.Measured.HasValue && markup.Measured == 1 ? HitType.Coordinate : HitType.Shape;
}
}
else
{
System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(new System.Drawing.Bitmap(10, 10));
Coordinate origin = ((IPoint)geometry).Coordinate;
System.Drawing.SizeF textSize = graphics.MeasureString(markup.Text, AppSettings.MarkupFont);
Envelope box = new Envelope(new Coordinate(origin.X, origin.Y), new Coordinate(origin.X + textSize.Width * scale, origin.Y + textSize.Height * scale));
if (box.ToPolygon().Intersects(g))
{
hitType = HitType.Text;
}
}
return hitType;
}