本文整理汇总了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);
}
示例2: AppendLineStringText
/// <summary>
/// Converts a <c>LineString</c> to <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(")");
}
}
示例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;
}