Пример #1
0
        /// <inheritdoc cref="Geometry.CopyInternal"/>>
        protected override IGeometry CopyInternal()

        {
            var points = _points.Copy();

            return(new LineString(points, Factory));
        }
Пример #2
0
        /// <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(ICoordinateSequence 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, (Ordinate)k, copy.GetOrdinate((indexOfFirstCoordinate + j) % last, (Ordinate)k));
                }
            }

            // Fix the ring (first == last)
            if (ensureRing)
            {
                for (int k = 0; k < seq.Dimension; k++)
                {
                    seq.SetOrdinate(last, (Ordinate)k, seq.GetOrdinate(0, (Ordinate)k));
                }
            }
        }
Пример #3
0
            /// <summary>
            /// Transforms a coordinate sequence. The input coordinate sequence remains unchanged.
            /// </summary>
            /// <param name="coordinateSequence">The coordinate sequence to transform.</param>
            /// <returns>The transformed coordinate sequence.</returns>
            public ICoordinateSequence Transform(ICoordinateSequence coordinateSequence)
            {
                var c = (ICoordinateSequence)coordinateSequence.Copy();

                for (int i = 0; i < c.Count; i++)
                {
                    _affineTransformation.Transform(c, i);
                }
                return(c);
            }
            public ICoordinateSequence Transform(ICoordinateSequence coordinateSequence)
            {
                var res = coordinateSequence.Copy();

                for (int i = 0; i < coordinateSequence.Count; i++)
                {
                    double[] pt = Transform(new [] { coordinateSequence.GetX(i), coordinateSequence.GetY(i) });
                    res.SetOrdinate(i, Ordinate.X, pt[0]);
                    res.SetOrdinate(i, Ordinate.Y, pt[1]);
                }

                return(res);
            }
Пример #5
0
 /// <summary>
 /// Convenience method which provides a standard way of copying <see cref="ICoordinateSequence"/>s.
 /// </summary>
 /// <param name="seq">The sequence to copy.</param>
 /// <returns>A deep copy of the sequence.</returns>
 protected virtual ICoordinateSequence Copy(ICoordinateSequence seq)
 {
     return(seq.Copy());
 }
Пример #6
0
        /// <summary>
        /// Creates and returns a full copy of this <see cref="IPoint"/> object.
        /// (including all coordinates contained by it).
        /// </summary>
        /// <returns>A copy of this instance</returns>
        public override IGeometry Copy()
        {
            var coordinates = _coordinates.Copy();

            return(new Point(coordinates, Factory));
        }
Пример #7
0
        /// <summary>
        /// Creates and returns a full copy of this <see cref="ILineString"/> object.
        /// (including all coordinates contained by it).
        /// </summary>
        /// <returns>A copy of this instance</returns>
        public override IGeometry Copy()
        {
            var points = _points.Copy();

            return(new LineString(points, Factory));
        }