using System; namespace GeoAPI.Geometries { /// /// Standard ordinate index values. /// public enum Ordinates { /// /// X Ordinate = 0. /// X = 0, /// /// Y Ordinate = 1. /// Y = 1, /// /// Z Ordinate = 2. /// Z = 2, /// /// M Ordinate = 3. /// M = 3, } /// /// The internal representation of a list of coordinates inside a Geometry. /// /// There are some cases in which you might want Geometries to store their /// points using something other than the NTS Coordinate class. For example, you /// may want to experiment with another implementation, such as an array of x’s /// and an array of y’s. or you might want to use your own coordinate class, one /// that supports extra attributes like M-values. /// /// /// You can do this by implementing the ICoordinateSequence and /// ICoordinateSequenceFactory interfaces. You would then create a /// GeometryFactory parameterized by your ICoordinateSequenceFactory, and use /// this GeometryFactory to create new Geometries. All of these new Geometries /// will use your ICoordinateSequence implementation. /// A note on performance. If your ICoordinateSequence is not based on an array /// of Coordinates, it may incur a performance penalty when its ToArray() method /// is called because the array needs to be built from scratch. /// /// /// public interface ICoordinateSequence : ICloneable { /// /// Returns the dimension (number of ordinates in each coordinate) for this sequence. /// int Dimension { get; } /// /// Returns the number of coordinates in this sequence. /// int Count { get;} /// /// Returns (possibly a copy of) the ith Coordinate in this collection. /// Whether or not the Coordinate returned is the actual underlying /// Coordinate or merely a copy depends on the implementation. /// Note that in the future the semantics of this method may change /// to guarantee that the Coordinate returned is always a copy. Callers are /// advised not to assume that they can modify a CoordinateSequence by /// modifying the Coordinate returned by this method. /// /// /// ICoordinate GetCoordinate(int i); /// /// Returns a copy of the i'th coordinate in this sequence. /// This method optimizes the situation where the caller is /// going to make a copy anyway - if the implementation /// has already created a new Coordinate object, no further copy is needed. /// /// The index of the coordinate to retrieve. /// A copy of the i'th coordinate in the sequence ICoordinate GetCoordinateCopy(int i); /// /// Copies the i'th coordinate in the sequence to the supplied Coordinate. /// Only the first two dimensions are copied. /// /// The index of the coordinate to copy. /// A Coordinate to receive the value. void GetCoordinate(int index, ICoordinate coord); /// /// Returns ordinate X (0) of the specified coordinate. /// /// /// The value of the X ordinate in the index'th coordinate. double GetX(int index); /// /// Returns ordinate Y (1) of the specified coordinate. /// /// /// The value of the Y ordinate in the index'th coordinate. double GetY(int index); /// /// Returns the ordinate of a coordinate in this sequence. /// Ordinate indices 0 and 1 are assumed to be X and Y. /// Ordinates indices greater than 1 have user-defined semantics /// (for instance, they may contain other dimensions or measure values). /// /// The coordinate index in the sequence. /// The ordinate index in the coordinate (in range [0, dimension-1]). /// double GetOrdinate(int index, Ordinates ordinate); /// /// Sets the value for a given ordinate of a coordinate in this sequence. /// /// The coordinate index in the sequence. /// The ordinate index in the coordinate (in range [0, dimension-1]). /// The new ordinate value. void SetOrdinate(int index, Ordinates ordinate, double value); /// /// Returns (possibly copies of) the Coordinates in this collection. /// Whether or not the Coordinates returned are the actual underlying /// Coordinates or merely copies depends on the implementation. Note that /// if this implementation does not store its data as an array of Coordinates, /// this method will incur a performance penalty because the array needs to /// be built from scratch. /// /// ICoordinate[] ToCoordinateArray(); /// /// Expands the given Envelope to include the coordinates in the sequence. /// Allows implementing classes to optimize access to coordinate values. /// /// The envelope to expand. /// A reference to the expanded envelope. IEnvelope ExpandEnvelope(IEnvelope env); } }