Class MCoordinate

java.lang.Object
com.vividsolutions.jts.geom.Coordinate
org.gvsig.fmap.geom.jts.mgeom.MCoordinate
All Implemented Interfaces:
Serializable, Cloneable, Comparable

public class MCoordinate extends com.vividsolutions.jts.geom.Coordinate
This coordinate class supports 4D coordinates, where the first 3 measures (x,y,z) are coordinates in a 3 dimensional space (cartesian for example), and the fourth is a measure value used for linear referencing. Note that the measure value is independent of whether the (x,y,z) values are used. For example, the z value can not be used while the measure value is used.

While this class extends the Coordinate class, it can be used seamlessly as a substitute in the event that the Measure value is not used. In these cases the Measure value shall simply be Double.NaN

See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class com.vividsolutions.jts.geom.Coordinate

    com.vividsolutions.jts.geom.Coordinate.DimensionalComparator
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    double
     

    Fields inherited from class com.vividsolutions.jts.geom.Coordinate

    NULL_ORDINATE, x, X, y, Y, z, Z
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor
    MCoordinate(double x, double y)
     
    MCoordinate(double x, double y, double z, double m)
     
    MCoordinate(com.vividsolutions.jts.geom.Coordinate coord)
     
     
  • Method Summary

    Modifier and Type
    Method
    Description
    convertCoordinate(com.vividsolutions.jts.geom.Coordinate coordinate)
    Converts a standard Coordinate instance to an MCoordinate instance.
    create2d(double x, double y)
    A convenience method for creating a MCoordinate instance where there are only 2 coordinates and an lrs measure value.
    create2dWithMeasure(double x, double y, double m)
    A convenience method for creating a MCoordinate instance where there are only 2 coordinates and an lrs measure value.
    create3d(double x, double y, double z)
    A convenience method for creating a MCoordinate instance where there are 3 coordinates but no lrs measure value.
    create3dWithMeasure(double x, double y, double z, double m)
    A convenience method for creating a MCoordinate instance where there are 3 coordinates and an lrs measure value.
    boolean
    equals(Object other)
     
    boolean
    equals2DWithMeasure(com.vividsolutions.jts.geom.Coordinate other)
     
    boolean
    equals3DWithMeasure(com.vividsolutions.jts.geom.Coordinate other)
     
    double
    getOrdinate(int ordinateIndex)
    TODO: I'd like to see this method added to the base Coordinate class Returns the ordinate value specified in this Coordinate instance.
    void
    setOrdinate(int ordinateIndex, double value)
    TODO: I'd like to see this method added to the base Coordinate class Sets the value for a given ordinate.
     

    Methods inherited from class com.vividsolutions.jts.geom.Coordinate

    clone, compareTo, distance, distance3D, equalInZ, equals2D, equals2D, equals3D, hashCode, hashCode, setCoordinate

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • m

      public double m
  • Constructor Details

    • MCoordinate

      public MCoordinate()
      Default constructor
    • MCoordinate

      public MCoordinate(double x, double y, double z, double m)
    • MCoordinate

      public MCoordinate(double x, double y)
    • MCoordinate

      public MCoordinate(com.vividsolutions.jts.geom.Coordinate coord)
    • MCoordinate

      public MCoordinate(MCoordinate coord)
  • Method Details

    • getOrdinate

      public double getOrdinate(int ordinateIndex)
      TODO: I'd like to see this method added to the base Coordinate class Returns the ordinate value specified in this Coordinate instance. The index of the desired ordinates are specified in the CoordinateSequence class; hence CoodinateSequence.X returns the x ordinate, CoodinateSequence.Y the y ordinate, CoodinateSequence.Z the z ordinate, and CoodinateSequence.M the m ordinate. Note that the dimension may not imply the desired ordinate in the case where one is using a 2 dimensional geometry with a measure value. Therefore, these constants are highly recommended.
      Overrides:
      getOrdinate in class com.vividsolutions.jts.geom.Coordinate
      Parameters:
      ordinateIndex - the desired ordinate index.
      Returns:
      the value of stored in the ordinate index. Incorrect or unused indexes shall return Double.NaN
    • setOrdinate

      public void setOrdinate(int ordinateIndex, double value)
      TODO: I'd like to see this method added to the base Coordinate class Sets the value for a given ordinate. This should be specified using the CoordinateSequence ordinate index constants.
      Overrides:
      setOrdinate in class com.vividsolutions.jts.geom.Coordinate
      Parameters:
      ordinateIndex - the desired ordinate index.
      value - the new ordinate value
      Throws:
      IllegalArgumentException - if the ordinateIndex value is incorrect
      See Also:
    • equals2DWithMeasure

      public boolean equals2DWithMeasure(com.vividsolutions.jts.geom.Coordinate other)
    • equals3DWithMeasure

      public boolean equals3DWithMeasure(com.vividsolutions.jts.geom.Coordinate other)
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class com.vividsolutions.jts.geom.Coordinate
    • toString

      public String toString()
      Overrides:
      toString in class com.vividsolutions.jts.geom.Coordinate
    • convertCoordinate

      public static MCoordinate convertCoordinate(com.vividsolutions.jts.geom.Coordinate coordinate)
      Converts a standard Coordinate instance to an MCoordinate instance. If coordinate is already an instance of an MCoordinate, then it is simply returned. In cases where it is converted, the measure value of the coordinate is initialized to Double.NaN.
      Parameters:
      coordinate - The coordinate to be converted
      Returns:
      an instance of MCoordinate corresponding to the coordinate parameter
    • create2dWithMeasure

      public static MCoordinate create2dWithMeasure(double x, double y, double m)
      A convenience method for creating a MCoordinate instance where there are only 2 coordinates and an lrs measure value. The z value of the coordinate shall be set to Double.NaN
      Parameters:
      x - the x coordinate value
      y - the y coordinate value
      m - the lrs measure value
      Returns:
      The constructed MCoordinate value
    • create2d

      public static MCoordinate create2d(double x, double y)
      A convenience method for creating a MCoordinate instance where there are only 2 coordinates and an lrs measure value. The z and m value of the coordinate shall be set to Double.NaN
      Parameters:
      x - the x coordinate value
      y - the y coordinate value
      Returns:
      The constructed MCoordinate value
    • create3dWithMeasure

      public static MCoordinate create3dWithMeasure(double x, double y, double z, double m)
      A convenience method for creating a MCoordinate instance where there are 3 coordinates and an lrs measure value.
      Parameters:
      x - the x coordinate value
      y - the y coordinate value
      z - the z coordinate value
      m - the lrs measure value
      Returns:
      The constructed MCoordinate value
    • create3d

      public static MCoordinate create3d(double x, double y, double z)
      A convenience method for creating a MCoordinate instance where there are 3 coordinates but no lrs measure value. The m value of the coordinate shall be set to Double.NaN
      Parameters:
      x - the x coordinate value
      y - the y coordinate value
      z - the z coordinate value
      Returns:
      The constructed MCoordinate value