本文整理汇总了C#中Polygon.GetInteriorRingN方法的典型用法代码示例。如果您正苦于以下问题:C# Polygon.GetInteriorRingN方法的具体用法?C# Polygon.GetInteriorRingN怎么用?C# Polygon.GetInteriorRingN使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Polygon
的用法示例。
在下文中一共展示了Polygon.GetInteriorRingN方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckShellNotNested
/// <summary>
/// Check if a shell is incorrectly nested within a polygon. This is the case
/// if the shell is inside the polygon shell, but not inside a polygon hole.
/// (If the shell is inside a polygon hole, the nesting is valid.)
/// The algorithm used relies on the fact that the rings must be properly contained.
/// E.g. they cannot partially overlap (this has been previously checked by
/// <c>CheckRelateConsistency</c>).
/// </summary>
private void CheckShellNotNested(LinearRing shell, Polygon p, GeometryGraph graph)
{
IList<Coordinate> shellPts = shell.Coordinates;
// test if shell is inside polygon shell
LinearRing polyShell = (LinearRing)p.ExteriorRing;
IList<Coordinate> polyPts = polyShell.Coordinates;
Coordinate shellPt = FindPointNotNode(shellPts, polyShell, graph);
// if no point could be found, we can assume that the shell is outside the polygon
if (shellPt == null) return;
bool insidePolyShell = CgAlgorithms.IsPointInRing(shellPt, polyPts);
if (!insidePolyShell) return;
// if no holes, this is an error!
if (p.NumHoles <= 0)
{
_validErr = new TopologyValidationError(TopologyValidationErrorType.NestedShells, shellPt);
return;
}
/*
* Check if the shell is inside one of the holes.
* This is the case if one of the calls to checkShellInsideHole
* returns a null coordinate.
* Otherwise, the shell is not properly contained in a hole, which is an error.
*/
Coordinate badNestedPt = null;
for (int i = 0; i < p.NumHoles; i++)
{
LinearRing hole = (LinearRing)p.GetInteriorRingN(i);
badNestedPt = CheckShellInsideHole(shell, hole, graph);
if (badNestedPt == null) return;
}
_validErr = new TopologyValidationError(TopologyValidationErrorType.NestedShells, badNestedPt);
}
示例2: AddPolygon
/// <summary>
///
/// </summary>
/// <param name="p"></param>
private void AddPolygon(Polygon p)
{
AddPolygonRing(p.ExteriorRing, LocationType.Exterior, LocationType.Interior);
for (int i = 0; i < p.NumHoles; i++)
// Holes are topologically labelled opposite to the shell, since
// the interior of the polygon lies on their opposite side
// (on the left, if the hole is oriented CW)
AddPolygonRing(p.GetInteriorRingN(i), LocationType.Interior, LocationType.Exterior);
}