本文整理汇总了C#中IGeometryCollection类的典型用法代码示例。如果您正苦于以下问题:C# IGeometryCollection类的具体用法?C# IGeometryCollection怎么用?C# IGeometryCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IGeometryCollection类属于命名空间,在下文中一共展示了IGeometryCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ClipGeometryCollection
private static IGeometryCollection ClipGeometryCollection(IGeometryCollection geom, Envelope clipEnv)
{
var clipPoly = geom.Factory.ToGeometry(clipEnv);
var clipped = new List<IGeometry>();
for (var i = 0; i < geom.NumGeometries; i++)
{
var g = geom.GetGeometryN(i);
IGeometry result = null;
// don't clip unless necessary
if (clipEnv.Contains(g.EnvelopeInternal))
result = g;
else if (clipEnv.Intersects(g.EnvelopeInternal))
{
result = clipPoly.Intersection(g);
// keep vertex key info
result.UserData = g.UserData;
}
if (result != null && !result.IsEmpty)
{
clipped.Add(result);
}
}
return geom.Factory.CreateGeometryCollection(GeometryFactory.ToGeometryArray(clipped));
}
示例2: GeometryCollectionEnumerator
/// <summary>
/// Constructs an iterator over the given <c>GeometryCollection</c>.
/// </summary>
/// <param name="parent">
/// The collection over which to iterate; also, the first
/// element returned by the iterator.
/// </param>
public GeometryCollectionEnumerator(IGeometryCollection parent)
{
this.parent = parent;
atStart = true;
index = 0;
max = parent.NumGeometries;
}
示例3: WriteShape
private static void WriteShape(IGeometryCollection geometries, string shapepath)
{
if (File.Exists(shapepath))
File.Delete(shapepath);
var sfw = new ShapefileWriter(geometries.Factory);
sfw.Write(Path.GetFileNameWithoutExtension(shapepath), geometries);
}
示例4: GeometryCollectionEnumerator
/// <summary>
/// Constructs an iterator over the given <c>GeometryCollection</c>.
/// </summary>
/// <param name="parent">
/// The collection over which to iterate; also, the first
/// element returned by the iterator.
/// </param>
public GeometryCollectionEnumerator(IGeometryCollection parent)
{
_parent = parent;
_atStart = true;
_index = 0;
_max = parent.NumGeometries;
}
示例5: LoadSourceGeometries
public void LoadSourceGeometries(IGeometryCollection geomColl)
{
for (int i = 0; i < geomColl.NumGeometries; i++)
{
IGeometry geom = geomColl.GetGeometryN(i);
LoadVertices(geom.Coordinates, geom.UserData);
}
}
示例6: DoMerge
private static IEnumerable<IGeometry> DoMerge(IGeometryCollection coll)
{
if (coll == null)
throw new ArgumentNullException("coll");
IEnumerable<IGeometry> items = GetItems(coll);
yield return UnaryUnionOp.Union(items.ToArray());
}
示例7: AddOutlineToGraphicsLayer3D
public static void AddOutlineToGraphicsLayer3D(IGraphicsContainer3D graphicsContainer3D, IGeometryCollection geometryCollection, IColor color, esriSimple3DLineStyle style, double width)
{
for (int i = 0; i < geometryCollection.GeometryCount; i++)
{
IGeometry geometry = geometryCollection.get_Geometry(i);
graphicsContainer3D.AddElement(ElementUtilities.ConstructPolylineElement(geometry, color, style, width));
}
}
示例8: TestGraphBuilder2WithSampleGeometries
/// <summary>
/// Uses the passed geometry collection to generate a QuickGraph.
/// </summary>
/// <param name="edges"></param>
/// <param name="src"></param>
/// <param name="dst"></param>
public ILineString TestGraphBuilder2WithSampleGeometries(IGeometryCollection edges, ICoordinate src, ICoordinate dst)
{
GraphBuilder2 builder = new GraphBuilder2(true);
foreach (IMultiLineString edge in edges.Geometries)
foreach (ILineString line in edge.Geometries)
builder.Add(line);
builder.Initialize();
return builder.Perform(src, dst);
}
示例9: HasRepeatedPoint
/// <summary>
///
/// </summary>
/// <param name="gc"></param>
/// <returns></returns>
private bool HasRepeatedPoint(IGeometryCollection gc)
{
for (int i = 0; i < gc.NumGeometries; i++)
{
IGeometry g = gc.GetGeometryN(i);
if (HasRepeatedPoint(g))
return true;
}
return false;
}
示例10: TransformGeometryCollection
/// <summary>
/// Transforms a <see cref="IGeometryCollection" /> object.
/// </summary>
/// <param name="factory">The factory to create the new <see cref="IGeometryCollection"/></param>
/// <param name="geoms">The input <see cref="IGeometryCollection"/></param>
/// <param name="transform">The <see cref="IMathTransform"/></param>
/// <returns>A transformed <see cref="IGeometryCollection"/></returns>
public static IGeometryCollection TransformGeometryCollection(IGeometryFactory factory,
IGeometryCollection geoms, IMathTransform transform)
{
var geometries = geoms.Geometries;
var coll = new List<IGeometry>(geometries.Length);
foreach (var g in geometries)
{
var item = TransformGeometry(factory, g, transform);
coll.Add(item);
}
return factory.CreateGeometryCollection(coll.ToArray());
}
示例11: Map
/// <summary>
///
/// </summary>
/// <param name="gc"></param>
/// <returns></returns>
public IGeometryCollection Map(IGeometryCollection gc)
{
IList<IGeometry> mapped = new List<IGeometry>();
for (var i = 0; i < gc.NumGeometries; i++)
{
var g = _mapOp(gc.GetGeometryN(i));
if (!g.IsEmpty)
mapped.Add(g);
}
return gc.Factory.CreateGeometryCollection(
GeometryFactory.ToGeometryArray(mapped));
}
示例12: DoClean
private static IEnumerable<IGeometry> DoClean(IGeometryCollection coll)
{
if (coll == null)
throw new ArgumentNullException("coll");
IEnumerable<IGeometry> items = GetItems(coll);
foreach (IGeometry geom in items)
{
DouglasPeuckerSimplifier simplifier = new DouglasPeuckerSimplifier(geom);
IGeometry clean = simplifier.GetResultGeometry();
yield return clean;
}
}
示例13: ParseGeometryCollection
public List<string> ParseGeometryCollection(IGeometryCollection geometryCollection)
{
var coords = new List<string>();
//for each geometry in the collection
for (int i = 0; i < geometryCollection.GeometryCount; i++)
{
var pGeom = geometryCollection.Geometry[i];
var pntCollection = (IPointCollection)pGeom;
for (var a = 0; a < pntCollection.PointCount; a++)
{
var roundedPoint = Math.Round(pntCollection.Point[a].Y, 5) + " " + Math.Round(pntCollection.Point[a].X, 5);
//compare the point to the last one entered to make sure only unique points are entered
string lastPoint = "";
if (coords.Count > 1) lastPoint = coords[coords.Count - 1];
if (!lastPoint.Equals(roundedPoint)) coords.Add(roundedPoint);
}
}
return coords;
}
示例14: SetByteStreamLength
/// <summary>
///
/// </summary>
/// <param name="geometryCollection"></param>
/// <returns></returns>
protected int SetByteStreamLength(IGeometryCollection geometryCollection)
{
int count = InitValue;
foreach (IGeometry g in geometryCollection.Geometries)
count += SetByteStreamLength(g);
return count;
}
示例15: Write
/// <summary>
///
/// </summary>
/// <param name="geometryCollection"></param>
/// <param name="writer"></param>
protected void Write(IGeometryCollection geometryCollection, XmlTextWriter writer)
{
writer.WriteStartElement("MultiGeometry", GMLElements.gmlNS);
for (int i = 0; i < geometryCollection.NumGeometries; i++)
{
writer.WriteStartElement("geometryMember", GMLElements.gmlNS);
Write(geometryCollection.Geometries[i], writer);
writer.WriteEndElement();
}
writer.WriteEndElement();
}