本文整理汇总了C#中IMultiPolygon类的典型用法代码示例。如果您正苦于以下问题:C# IMultiPolygon类的具体用法?C# IMultiPolygon怎么用?C# IMultiPolygon使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IMultiPolygon类属于命名空间,在下文中一共展示了IMultiPolygon类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddMultiPolygon
private void AddMultiPolygon(IMultiPolygon geometry, GraphicsPath graphicsPath)
{
if (geometry == null)
throw new ArgumentNullException("geometry");
foreach (var geom in geometry.Geometries)
this.AddPolygon((IPolygon)geom, graphicsPath);
}
示例2: Write
/// <summary>
///
/// </summary>
/// <param name="multiPolygon"></param>
/// <param name="writer"></param>
protected void Write(IMultiPolygon multiPolygon, BinaryWriter writer)
{
WriteByteOrder(writer); // LittleIndian
if (Double.IsNaN(multiPolygon.Coordinate.Z))
writer.Write((int)WKBGeometryTypes.WKBMultiPolygon);
else writer.Write((int)WKBGeometryTypes.WKBMultiPolygonZ);
writer.Write((int) multiPolygon.NumGeometries);
for (int i = 0; i < multiPolygon.NumGeometries; i++)
Write(multiPolygon.Geometries[i] as IPolygon, writer);
}
示例3: SetByteStream
/// <summary>
///
/// </summary>
/// <param name="geometry"></param>
/// <returns></returns>
protected int SetByteStream(IMultiPolygon geometry)
{
// 4-byte count + subgeometries
return 4 + SetByteStream(geometry.Geometries);
}
示例4: Write
/// <summary>
///
/// </summary>
/// <param name="multiPolygon"></param>
/// <param name="writer"></param>
protected void Write(IMultiPolygon multiPolygon, BinaryWriter writer)
{
WriteByteOrder(writer); // LittleIndian
writer.Write((int) WKBGeometryTypes.WKBMultiPolygon);
writer.Write((int) multiPolygon.NumGeometries);
for (int i = 0; i < multiPolygon.NumGeometries; i++)
Write(multiPolygon.Geometries[i] as IPolygon, writer);
}
示例5: SetByteStreamLength
/// <summary>
///
/// </summary>
/// <param name="multiPolygon"></param>
/// <returns></returns>
protected int SetByteStreamLength(IMultiPolygon multiPolygon)
{
int numParts = multiPolygon.NumGeometries; // Exterior rings count
foreach (IPolygon polygon in multiPolygon.Geometries) // Adding interior rings count
numParts += polygon.NumInteriorRings;
int numPoints = multiPolygon.NumPoints;
return CalculateLength(numParts, numPoints);
}
示例6: SetByteStreamLength
/// <summary>
///
/// </summary>
/// <param name="multiPolygon"></param>
/// <returns></returns>
protected int SetByteStreamLength(IMultiPolygon multiPolygon)
{
int count = InitValue;
foreach (IPolygon p in multiPolygon.Geometries)
count += SetByteStreamLength(p);
return count;
}
示例7: TransformMultiPolygon
/// <summary>
///
/// </summary>
/// <param name="geom"></param>
/// <param name="parent"></param>
/// <returns></returns>
protected override IGeometry TransformMultiPolygon(IMultiPolygon geom, IGeometry parent)
{
IGeometry roughGeom = base.TransformMultiPolygon(geom, parent);
return CreateValidArea(roughGeom);
}
示例8: Write
/// <summary>
///
/// </summary>
/// <param name="multiPolygon"></param>
/// <param name="writer"></param>
protected virtual void Write(IMultiPolygon multiPolygon, BinaryWriter writer)
{
WriteByteOrder(writer);
writer.Write((int)WkbGeometryType.MultiPolygon);
writer.Write(multiPolygon.NumGeometries);
for (int i = 0; i < multiPolygon.NumGeometries; i++)
Write(multiPolygon.Geometries[i] as Polygon, writer);
}
示例9: FromMultiPolygon
private static DSMultiPolygon FromMultiPolygon(IMultiPolygon geometry, DSGeometryFactory factory, bool setUserData)
{
var dsPolygons = new DotSpatial.Topology.IPolygon[geometry.NumGeometries];
for (var i = 0; i < dsPolygons.Length; i++)
dsPolygons[i] = FromPolygon((IPolygon)geometry.GetGeometryN(i), factory, setUserData);
var result = factory.CreateMultiPolygon(dsPolygons);
if (setUserData)
result.UserData = geometry.UserData;
return result;
}
示例10: FromMultiPolygon
private static GeoAPIMultiPolygon FromMultiPolygon(IMultiPolygon geometry, GeoAPIGeometryFactory factory, bool copyUserData)
{
var dsPolygons = new GeoAPI.Geometries.IPolygon[geometry.NumGeometries];
for (var i = 0; i < dsPolygons.Length; i++)
dsPolygons[i] = FromPolygon((IPolygon)geometry.GetGeometryN(i), factory, copyUserData);
var result = factory.CreateMultiPolygon(dsPolygons);
if (copyUserData)
result.UserData = geometry.UserData;
return result;
}
示例11: CheckShellsNotNested
/// <summary>
/// Tests that no element polygon is wholly in the interior of another element polygon.
/// Preconditions:
/// Shells do not partially overlap.
/// Shells do not touch along an edge.
/// No duplicate rings exists.
/// This routine relies on the fact that while polygon shells may touch at one or
/// more vertices, they cannot touch at ALL vertices.
/// </summary>
private void CheckShellsNotNested(IMultiPolygon mp, GeometryGraph graph)
{
for (int i = 0; i < mp.NumGeometries; i++)
{
IPolygon p = (IPolygon) mp.GetGeometryN(i);
ILinearRing shell = p.Shell;
for (int j = 0; j < mp.NumGeometries; j++)
{
if (i == j)
continue;
IPolygon p2 = (IPolygon) mp.GetGeometryN(j);
CheckShellNotNested(shell, p2, graph);
if (validErr != null) return;
}
}
}
示例12: CheckValid
/// <summary>
///
/// </summary>
/// <param name="g"></param>
private void CheckValid(IMultiPolygon g)
{
foreach(IPolygon p in g.Geometries)
{
CheckInvalidCoordinates(p);
if (validErr != null) return;
CheckClosedRings(p);
if (validErr != null) return;
}
GeometryGraph graph = new GeometryGraph(0, g);
CheckTooFewPoints(graph);
if (validErr != null) return;
CheckConsistentArea(graph);
if (validErr != null) return;
if (!IsSelfTouchingRingFormingHoleValid)
{
CheckNoSelfIntersectingRings(graph);
if (validErr != null) return;
}
foreach(IPolygon p in g.Geometries)
{
CheckHolesInShell(p, graph);
if (validErr != null) return;
}
foreach (IPolygon p in g.Geometries)
{
CheckHolesNotNested(p, graph);
if (validErr != null) return;
}
CheckShellsNotNested(g, graph);
if (validErr != null) return;
CheckConnectedInteriors(graph);
}
示例13: Write
/// <summary>
/// Method to write a multi polygon geometry to the <paramref name="writer"/>
/// </summary>
/// <param name="areas">The multi polygon geometry</param>
/// <param name="writer">The JSON writer</param>
public static void Write(IMultiPolygon areas, TextWriter writer)
{
if (areas == null)
return;
if (writer == null)
throw new ArgumentNullException("writer", "A valid text writer object is required");
Write(areas, CreateWriter(writer));
}
示例14: DrawMultiPolygon
public static void DrawMultiPolygon(D2D1.RenderTarget renderTarget, D2D1.Factory factory, IMultiPolygon pols, D2D1.Brush brush, D2D1.Brush pen, float penWidth, D2D1.StrokeStyle penStrokeStyle, bool clip, Map map)
{
for (var i = 0; i < pols.NumGeometries; i++)
{
var p = (IPolygon)pols[i];
DrawPolygon(renderTarget, factory, p, brush, pen, penWidth, penStrokeStyle, clip, map);
}
}
示例15: WriteMultiPolygon
/// <summary>
/// Writes a multipolygon.
/// </summary>
/// <param name="mp">The mulitpolygon to be written.</param>
/// <param name="bWriter">Stream to write to.</param>
/// <param name="byteorder">Byte order</param>
private static void WriteMultiPolygon(IMultiPolygon mp, BinaryWriter bWriter, WkbByteOrder byteorder)
{
//Write the number of polygons.
int num = mp.NumGeometries;
WriteUInt32((uint) num, bWriter, byteorder);
//Loop on the number of polygons.
//NOTE: by contract, the first item returned
// from GetEnumerator (i.e. using foreach) is the IMultiPolygon itself!
for (int i = 0; i < num; i++)
{
IPolygon poly = (IPolygon) mp.GetGeometryN(i);
//Write polygon header
bWriter.Write((byte) byteorder);
WriteUInt32((uint) WKBGeometryType.wkbPolygon, bWriter, byteorder);
//Write each polygon.
WritePolygon(poly, bWriter, byteorder);
}
}