本文整理汇总了C#中ICoordinateSequence类的典型用法代码示例。如果您正苦于以下问题:C# ICoordinateSequence类的具体用法?C# ICoordinateSequence怎么用?C# ICoordinateSequence使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ICoordinateSequence类属于命名空间,在下文中一共展示了ICoordinateSequence类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Reverse
/// <summary>
/// Reverses the coordinates in a sequence in-place.
/// </summary>
/// <param name="seq"></param>
public static void Reverse(ICoordinateSequence seq)
{
int last = seq.Count - 1;
int mid = last / 2;
for (int i = 0; i <= mid; i++)
Swap(seq, i, last - i);
}
示例2: Reproject
public ICoordinateSequence Reproject(ICoordinateSequence sequence, ISpatialReference @from, ISpatialReference to)
{
double[] xy, z, m;
ToDotSpatial(sequence, out xy, out z, out m);
DotSpatial.Projections.Reproject.ReprojectPoints(xy, z, GetProjectionInfo(@from), GetProjectionInfo(to), 0, sequence.Count);
return ToGeoAPI(DefaultSequenceFactory, xy, z, m);
}
示例3: Point
/// <summary>
/// Constructs a <c>Point</c> with the given coordinate.
/// </summary>
/// <param name="coordinates">
/// Contains the single coordinate on which to base this <c>Point</c>,
/// or <c>null</c> to create the empty point.
/// </param>
/// <param name="factory"></param>
public Point(ICoordinateSequence coordinates, IGeometryFactory factory) : base(factory)
{
if (coordinates == null)
coordinates = factory.CoordinateSequenceFactory.Create(new Coordinate[] { });
NetTopologySuite.Utilities.Assert.IsTrue(coordinates.Count <= 1);
this._coordinates = coordinates;
}
示例4: Point
/// <summary>
/// Constructs a <c>Point</c> with the given coordinate.
/// </summary>
/// <param name="coordinates">
/// Contains the single coordinate on which to base this <c>Point</c>,
/// or <c>null</c> to create the empty point.
/// </param>
/// <param name="factory"></param>
public Point(ICoordinateSequence coordinates, IGeometryFactory factory) : base(factory)
{
if (coordinates == null)
coordinates = factory.CoordinateSequenceFactory.Create(new ICoordinate[] { });
Debug.Assert(coordinates.Count <= 1);
this.coordinates = (ICoordinateSequence) coordinates;
}
示例5: Filter
public void Filter(ICoordinateSequence seq, int i)
{
if (i == 0) return;
seq.GetCoordinate(i - 1, p0);
seq.GetCoordinate(i, p1);
rcc.CountSegment(p0, p1);
}
示例6: CoordinateArraySequence
/// <summary>
/// Constructs a sequence based on the given array (the array is not copied).
/// </summary>
/// <param name="coordSeq">The coordinate array that will be referenced.</param>
public CoordinateArraySequence(ICoordinateSequence coordSeq)
{
if (coordSeq != null)
coordinates = new ICoordinate[coordSeq.Count];
else coordinates = new ICoordinate[0];
for (int i = 0; i < coordinates.Length; i++)
coordinates[i] = coordSeq.GetCoordinateCopy(i);
}
示例7: LineString
/// <summary>
///
/// </summary>
/// <param name="points">
/// The points of the linestring, or <c>null</c>
/// to create the empty point. Consecutive points may not be equal.
/// </param>
/// <param name="factory"></param>
public LineString(ICoordinateSequence points, IGeometryFactory factory) : base(factory)
{
if (points == null)
points = factory.CoordinateSequenceFactory.Create(new ICoordinate[] { });
if (points.Count == 1)
throw new ArgumentException("point array must contain 0 or >1 elements", "points");
this.points = points;
}
示例8: ProjectToXY
// ReSharper disable InconsistentNaming
/// <summary>
/// Creates a wrapper projecting to the XY plane.
/// </summary>
/// <param name="seq">The sequence to be projected</param>
/// <returns>A sequence which projects coordinates</returns>
public static ICoordinateSequence ProjectToXY(ICoordinateSequence seq)
{
/**
* This is just a no-op, but return a wrapper
* to allow better testing
*/
return new AxisPlaneCoordinateSequence(seq, XYIndex);
}
示例9: CreateLinearRing
private ILinearRing CreateLinearRing(ICoordinateSequence coordinates, bool ccw)
{
if (coordinates != null && Algorithm.CGAlgorithms.IsCCW(coordinates) != ccw)
{
//CoordinateSequences.Reverse(coordinates);
coordinates = coordinates.Reversed();
}
return CreateLinearRing(coordinates);
}
示例10: CopyToSequence
private static ICoordinateSequence CopyToSequence(Coordinate[] coords, ICoordinateSequence sequence)
{
for (int i = 0; i < coords.Length; i++)
{
sequence.SetOrdinate(i, Ordinate.X, coords[i].X);
sequence.SetOrdinate(i, Ordinate.Y, coords[i].Y);
}
return sequence;
}
示例11: Copy
public static MCoordinate[] Copy(ICoordinateSequence coordSeq)
{
MCoordinate[] copy = new MCoordinate[coordSeq.Count];
for (int i = 0; i < coordSeq.Count; i++)
{
copy[i] = new MCoordinate(coordSeq.GetCoordinate(i));
}
return copy;
}
示例12: HasIntersectionWithLineStrings
/// <summary>
///
/// </summary>
/// <param name="seq"></param>
/// <param name="lines"></param>
/// <returns></returns>
public bool HasIntersectionWithLineStrings(ICoordinateSequence seq, ICollection<IGeometry> lines)
{
foreach (ILineString line in lines)
{
HasIntersection(seq, line.CoordinateSequence);
if (_hasIntersection)
break;
}
return _hasIntersection;
}
示例13: CreateClosedRing
private static ICoordinateSequence CreateClosedRing(ICoordinateSequenceFactory fact, ICoordinateSequence seq, int size)
{
var newseq = fact.Create(size, seq.Dimension);
int n = seq.Count;
Copy(seq, 0, newseq, 0, n);
// fill remaining coordinates with start point
for (int i = n; i < size; i++)
Copy(seq, 0, newseq, i, 1);
return newseq;
}
示例14: CopyCoord
///<summary>
/// Copies a coordinate of a <see cref="ICoordinateSequence"/> to another <see cref="ICoordinateSequence"/>.
/// The sequences may have different dimensions;
/// in this case only the common dimensions are copied.
///</summary>
/// <param name="src">The sequence to copy coordinate from</param>
/// <param name="srcPos">The index of the coordinate to copy</param>
/// <param name="dest">The sequence to which the coordinate should be copied to</param>
/// <param name="destPos">The index of the coordinate in <see paramref="dest"/></param>
public static void CopyCoord(ICoordinateSequence src, int srcPos, ICoordinateSequence dest, int destPos)
{
int minDim = Math.Min(src.Dimension, dest.Dimension);
for (int dim = 0; dim < minDim; dim++)
{
Ordinate ordinate = (Ordinate)dim;
double value = src.GetOrdinate(srcPos, ordinate);
dest.SetOrdinate(destPos, ordinate, value);
}
}
示例15: WriteInterval
protected void WriteInterval(ICoordinateSequence sequence, Ordinate ordinate, BinaryWriter writer)
{
var val = GetOrdinate(sequence, ordinate, 0);
var interval = Interval.Create(val);
for (var i = 1; i < sequence.Count; i++)
interval = interval.ExpandedByValue(GetOrdinate(sequence, ordinate, i));
writer.Write(interval.Min);
writer.Write(interval.Max);
}