当前位置: 首页>>代码示例>>C#>>正文


C# IGeometry.GetGeometryN方法代码示例

本文整理汇总了C#中IGeometry.GetGeometryN方法的典型用法代码示例。如果您正苦于以下问题:C# IGeometry.GetGeometryN方法的具体用法?C# IGeometry.GetGeometryN怎么用?C# IGeometry.GetGeometryN使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IGeometry的用法示例。


在下文中一共展示了IGeometry.GetGeometryN方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IndicesOf

        /// <summary>
        /// 
        /// </summary>
        /// <param name="subLine"></param>
        /// <returns></returns>
        public virtual LinearLocation[] IndicesOf(IGeometry subLine)
        {
            var startPt = ((ILineString) subLine.GetGeometryN(0)).GetCoordinateN(0);
            var lastLine = (ILineString) subLine.GetGeometryN(subLine.NumGeometries - 1);
            var endPt = lastLine.GetCoordinateN(lastLine.NumPoints - 1);

            var locPt = new LocationIndexOfPoint(_linearGeom);
            var subLineLoc = new LinearLocation[2];
            subLineLoc[0] = locPt.IndexOf(startPt);

            // check for case where subline is zero length
            if (subLine.Length == 0)
                 subLineLoc[1] = (LinearLocation) subLineLoc[0].Clone();
            else subLineLoc[1] = locPt.IndexOfAfter(endPt, subLineLoc[0]);
            return subLineLoc;
        }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:21,代码来源:LocationIndexOfLine.cs

示例2: LoadSourceGeometries

 public void LoadSourceGeometries(IGeometry geoms)
 {
     for (var i = 0; i < geoms.NumGeometries; i++)
     {
         var g = geoms.GetGeometryN(i);
         LoadVertices(g.Coordinates, g.UserData);
     }
 }
开发者ID:barentswatch,项目名称:NetTopologySuite,代码行数:8,代码来源:VertexTaggedGeometryDataMapper.cs

示例3: SetComponentDataToIndex

 public static void SetComponentDataToIndex(IGeometry geom)
 {
     for (int i = 0; i < geom.NumGeometries; i++)
     {
         IGeometry comp = geom.GetGeometryN(i);
         comp.UserData = "Component # " + i;
     }
 }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:8,代码来源:GeometryDataUtil.cs

示例4: GetItems

        private static IEnumerable<IGeometry> GetItems(IGeometry coll)
        {
            if (coll == null) 
                throw new ArgumentNullException("coll");

            for (int i = 0; i < coll.NumGeometries; i++)
                yield return coll.GetGeometryN(i);
        }
开发者ID:geobabbler,项目名称:SharpMap,代码行数:8,代码来源:ProcessController.cs

示例5: FirstNComponents

 public static IGeometry FirstNComponents(IGeometry g, int n)
 {
     var comp = new List<IGeometry>();
     for (int i = 0; i < g.NumGeometries && i < n; i++)
     {
         comp.Add(g.GetGeometryN(i));
     }
     return g.Factory.BuildGeometry(comp);
 }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:9,代码来源:SelectionFunctions.cs

示例6: TransferData

 /// <summary>
 /// Input is assumed to be a multiGeometry
 /// in which every component has its userData
 /// set to be a Coordinate which is the key to the output data.
 /// The Coordinate is used to determine
 /// the output data object to be written back into the component. 
 /// </summary>
 /// <param name="targetGeom" />
 public void TransferData(IGeometry targetGeom)
 {
     for (int i = 0; i < targetGeom.NumGeometries; i++)
     {
         var geom = targetGeom.GetGeometryN(i);
         var vertexKey = (Coordinate)geom.UserData;
         if (vertexKey == null) continue;
         geom.UserData = _coordDataMap[vertexKey];
     }
 }
开发者ID:barentswatch,项目名称:NetTopologySuite,代码行数:18,代码来源:VertexTaggedGeometryDataMapper.cs

示例7: Clip

 public static IGeometry Clip(IGeometry a, IGeometry mask)
 {
     var geoms = new List<IGeometry>();
     for (var i = 0; i < a.NumGeometries; i++)
     {
         var clip = a.GetGeometryN(i).Intersection(mask);
         geoms.Add(clip);
     }
     return FunctionsUtil.BuildGeometry(geoms, a);
 }
开发者ID:ste10k41,项目名称:nettopologysuite,代码行数:10,代码来源:OverlayFunctions.cs

示例8: Map

 /// <summary>
 /// Maps the members of a <see cref="IGeometry"/>
 /// (which may be atomic or composite)
 /// into another <tt>Geometry</tt> of most specific type.
 /// <tt>null</tt> results are skipped.
 /// In the case of hierarchical <see cref="IGeometryCollection"/>s,
 /// only the first level of members are mapped.
 /// </summary>
 /// <param name="geom">The input atomic or composite geometry</param>
 /// <param name="op">The mapping operation</param>
 /// <returns>A result collection or geometry of most specific type</returns>
 public static IGeometry Map(IGeometry geom, IMapOp op)
 {
     var mapped = new List<IGeometry>();
     for (var i = 0; i < geom.NumGeometries; i++)
     {
         var g = op.Map(geom.GetGeometryN(i));
         if (g != null)
             mapped.Add(g);
     }
     return geom.Factory.BuildGeometry(mapped);
 }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:22,代码来源:GeometryMapper.cs

示例9: intersects

 public static IGeometry intersects(IGeometry a, IGeometry mask)
 {
     var selected = new List<IGeometry>();
     for (int i = 0; i < a.NumGeometries; i++)
     {
         var g = a.GetGeometryN(i);
         if (mask.Intersects(g))
         {
             selected.Add(g);
         }
     }
     return a.Factory.BuildGeometry(selected);
 }
开发者ID:abrobston,项目名称:NHibernate.Spatial,代码行数:13,代码来源:SelectionFunctions.cs

示例10: Select

 private static IGeometry Select(IGeometry geom, Func<IGeometry, bool> predicate)
 {
     var selected = new List<IGeometry>();
     for (int i = 0; i < geom.NumGeometries; i++)
     {
         var g = geom.GetGeometryN(i);
         if (predicate(g))
         {
             selected.Add(g);
         }
     }
     return geom.Factory.BuildGeometry(selected);
 }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:13,代码来源:SelectionFunctions.cs

示例11: ExtractElements

        private static void ExtractElements(IGeometry geom, ICollection<IGeometry> elems)
        {
            if (geom == null)
                return;

            for (var i = 0; i < geom.NumGeometries; i++)
            {
                var elemGeom = geom.GetGeometryN(i);
                if (skipEmpty && elemGeom.IsEmpty)
                    continue;
                elems.Add(elemGeom);
            }
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:13,代码来源:GeometryCombiner.cs

示例12: TransformByVectors

        public static IGeometry TransformByVectors(IGeometry g, IGeometry control)
	{
		var nControl = control.NumGeometries;
		var src = new Coordinate[nControl];
		var dest = new Coordinate[nControl];
		for (int i = 0; i < nControl; i++) {
			var contComp = control.GetGeometryN(i);
			var pts = contComp.Coordinates;
			src[i] = pts[0];
			dest[i] = pts[1];
		}
		var trans = AffineTransformationFactory.CreateFromControlVectors(src, dest);
		Console.WriteLine(trans);
    return trans.Transform(g);    
	}
开发者ID:russcam,项目名称:Nhibernate.Spatial,代码行数:15,代码来源:AffineTransformationFunctions.cs

示例13: InvalidGeoms

 public static IGeometry InvalidGeoms(IGeometry g)
 {
     var invalidGeoms = new List<IGeometry>();
     for (var i = 0; i < g.NumGeometries; i++)
     {
         var geom = g.GetGeometryN(i);
         var ivop = new IsValidOp(geom);
         var err = ivop.ValidationError;
         if (err != null)
         {
             invalidGeoms.Add(geom);
         }
     }
     return g.Factory.BuildGeometry(invalidGeoms);
 }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:15,代码来源:ValidationFunctions.cs

示例14: InvalidLocations

 /// <summary>
 /// Validates all geometries in a collection independently.
 /// Errors are returned as points at the invalid location
 /// </summary>
 /// <param name="g"></param>
 /// <returns>the invalid locations, if any</returns>
 public static IGeometry InvalidLocations(IGeometry g)
 {
     var invalidLoc = new List<IPoint>();
     for (var i = 0; i < g.NumGeometries; i++)
     {
         var geom = g.GetGeometryN(i);
         var ivop = new IsValidOp(geom);
         var err = ivop.ValidationError;
         if (err != null)
         {
             invalidLoc.Add(g.Factory.CreatePoint(err.Coordinate));
         }
     }
     return g.Factory.BuildGeometry(invalidLoc.ToArray());
 }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:21,代码来源:ValidationFunctions.cs

示例15: ApplyTo

 /// <summary>
 ///
 /// </summary>
 /// <param name="geom"></param>
 public void ApplyTo(IGeometry geom)
 {
     for (int i = 0; i < geom.NumGeometries && !_isDone; i++)
     {
         IGeometry element = geom.GetGeometryN(i);
         if (!(element is GeometryCollection))
         {
             Visit(element);
             if (IsDone())
             {
                 _isDone = true;
                 return;
             }
         }
         else ApplyTo(element);
     }
 }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:21,代码来源:ShortCircuitedGeometryVisitor.cs


注:本文中的IGeometry.GetGeometryN方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。