/// <summary> /// Creates a <see cref="LineString" /> whose coordinates are in the reverse order of this objects. /// </summary> /// <returns>A <see cref="LineString" /> with coordinates in the reverse order.</returns> public override Geometry Reverse() { var seq = _points.Copy(); CoordinateSequences.Reverse(seq); return(Factory.CreateLineString(seq)); }
/// <summary> /// Shifts the positions of the coordinates until the coordinate at <code>firstCoordinateIndex</code> /// is first. /// </summary> /// <param name="seq">The coordinate sequence to rearrange</param> /// <param name="indexOfFirstCoordinate">The index of the coordinate to make first</param> /// <param name="ensureRing">Makes sure that <paramref name="seq"/> will be a closed ring upon exit</param> public static void Scroll(CoordinateSequence seq, int indexOfFirstCoordinate, bool ensureRing) { int i = indexOfFirstCoordinate; if (i <= 0) { return; } // make a copy of the sequence var copy = seq.Copy(); // test if ring, determine last index int last = ensureRing ? seq.Count - 1 : seq.Count; // fill in values for (int j = 0; j < last; j++) { for (int k = 0; k < seq.Dimension; k++) { seq.SetOrdinate(j, k, copy.GetOrdinate((indexOfFirstCoordinate + j) % last, k)); } } // Fix the ring (first == last) if (ensureRing) { for (int k = 0; k < seq.Dimension; k++) { seq.SetOrdinate(last, k, seq.GetOrdinate(0, k)); } } }
public override Geometry Reverse() { var sequence = CoordinateSequence.Copy(); CoordinateSequences.Reverse(sequence); return(Factory.CreateLinearRing(sequence)); }
private LinearRing CreateLinearRing(CoordinateSequence coordinates, bool ccw) { if (coordinates != null && Orientation.IsCCW(coordinates) != ccw) { coordinates = coordinates.Copy(); CoordinateSequences.Reverse(coordinates); } return(CreateLinearRing(coordinates)); }
/// <inheritdoc cref="Geometry.CopyInternal"/>> protected override Geometry CopyInternal() { var coordinates = _coordinates.Copy(); return(new Point(coordinates, Factory)); }
public override CoordinateSequence Copy() => new ReversedCoordinateSequence(_inner.Copy());
/// <inheritdoc cref="Geometry.CopyInternal"/>> protected override Geometry CopyInternal() { return(new LinearRing(CoordinateSequence.Copy(), Factory)); }