/// <summary> /// Creates a <see cref="IMultiPoint"/> using the given CoordinateSequence. /// A null or empty CoordinateSequence will create an empty MultiPoint. /// </summary> /// <param name="coordinates">A CoordinateSequence (possibly empty), or <c>null</c>.</param> /// <returns>A <see cref="IMultiPoint"/> object</returns> public IMultiPoint CreateMultiPoint(ICoordinateSequence coordinates) { if (coordinates == null) { coordinates = CoordinateSequenceFactory.Create(new Coordinate[] { }); } List <IPoint> points = new List <IPoint>(); for (int i = 0; i < coordinates.Count; i++) { ICoordinateSequence seq = CoordinateSequenceFactory.Create(1, coordinates.Ordinates); CoordinateSequences.Copy(coordinates, i, seq, 0, 1); points.Add(CreatePoint(seq)); } return(CreateMultiPoint(points.ToArray())); }
/// <summary> /// Normalizes a <c>LineString</c>. A normalized <c>LineString</c> /// has the first point which is not equal to it's reflected point /// less than the reflected point. /// </summary> public override void Normalize() { for (int i = 0; i < _points.Count / 2; i++) { int j = _points.Count - 1 - i; // skip equal points on both ends if (!_points.GetCoordinate(i).Equals(_points.GetCoordinate(j))) { if (_points.GetCoordinate(i).CompareTo(_points.GetCoordinate(j)) > 0) { var copy = _points.Copy(); CoordinateSequences.Reverse(copy); _points = copy; } return; } } }