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


C# ILineString.GetCoordinateN方法代码示例

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


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

示例1: ExtractChain

 private static ILineString ExtractChain(ILineString line, int index, int maxChainSize)
 {
     int size = maxChainSize + 1;
     if (index + size > line.NumPoints)
         size = line.NumPoints - index;
     Coordinate[] pts = new Coordinate[size];
     for (int i = 0; i < size; i++)
     {
         pts[i] = line.GetCoordinateN(index + i);
     }
     return line.Factory.CreateLineString(pts);
 }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:12,代码来源:LineHandlingFunctions.cs

示例2: AppendLineStringText

 /// <summary>
 /// Converts a <c>LineString</c> to &lt;LineString Text format, then
 /// appends it to the writer.
 /// </summary>
 /// <param name="lineString">The <c>LineString</c> to process.</param>
 /// <param name="level"></param>
 /// <param name="doIndent"></param>
 /// <param name="writer">The output writer to append to.</param>
 private void AppendLineStringText(ILineString lineString, int level, bool doIndent, TextWriter writer)
 {
     if (lineString.IsEmpty)
         writer.Write(" EMPTY");            
     else 
     {
         if (doIndent) Indent(level, writer);
         writer.Write("(");
         for (int i = 0; i < lineString.NumPoints; i++) 
         {
             if (i > 0) 
             {
                 writer.Write(",");
                 if (i % 10 == 0) Indent(level + 2, writer);
             }
             AppendCoordinate(lineString.GetCoordinateN(i), writer, lineString.PrecisionModel);
         }
         writer.Write(")");
     }
 }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:28,代码来源:WKTWriter.cs

示例3: ToShape

        private GraphicsPath ToShape(ILineString lineString)
        {
            var shape = new GraphicsPath();
            
            var points = new List<PointF>(lineString.NumPoints);
            var prev = lineString.GetCoordinateN(0);
            var transPoint = TransformPoint(prev);
            points.Add(transPoint);

            var prevX = transPoint.X;
            var prevY = transPoint.Y;

            var n = lineString.NumPoints - 1;
            
            //int count = 0;
            for (var i = 1; i <= n; i++)
            {
                var currentCoord = lineString.GetCoordinateN(i);
                if (Decimation > 0.0)
                {
                    var isDecimated = prev != null
                            && Math.Abs(currentCoord.X - prev.X) < Decimation
                            && Math.Abs(currentCoord.Y - prev.Y) < Decimation;
                    
                    if (i < n && isDecimated)
                    {
                        continue;
                    }
                    prev = currentCoord;
                }

                transPoint = TransformPoint(lineString.GetCoordinateN(i));

                if (RemoveDuplicatePoints)
                {
                    // skip duplicate points (except the last point)
                    var isDup = transPoint.X == prevX && transPoint.Y == prevY;
                    if (i < n && isDup)
                        continue;
                    prevX = transPoint.X;
                    prevY = transPoint.Y;
                    //count++;
                }
                points.Add(transPoint);
            }
            //System.out.println(count);
            shape.AddLines(points.ToArray());
            return shape;
        }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:49,代码来源:GraphicsPathWriter.cs


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