Package org.gvsig.fmap.geom.jts.mgeom
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
FieldsFields inherited from class com.vividsolutions.jts.geom.Coordinate
NULL_ORDINATE, x, X, y, Y, z, Z -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructorMCoordinate(double x, double y) MCoordinate(double x, double y, double z, double m) MCoordinate(com.vividsolutions.jts.geom.Coordinate coord) MCoordinate(MCoordinate coord) -
Method Summary
Modifier and TypeMethodDescriptionstatic MCoordinateconvertCoordinate(com.vividsolutions.jts.geom.Coordinate coordinate) Converts a standard Coordinate instance to an MCoordinate instance.static MCoordinatecreate2d(double x, double y) A convenience method for creating a MCoordinate instance where there are only 2 coordinates and an lrs measure value.static MCoordinatecreate2dWithMeasure(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.static MCoordinatecreate3d(double x, double y, double z) A convenience method for creating a MCoordinate instance where there are 3 coordinates but no lrs measure value.static MCoordinatecreate3dWithMeasure(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.booleanbooleanequals2DWithMeasure(com.vividsolutions.jts.geom.Coordinate other) booleanequals3DWithMeasure(com.vividsolutions.jts.geom.Coordinate other) doublegetOrdinate(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.voidsetOrdinate(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.toString()Methods inherited from class com.vividsolutions.jts.geom.Coordinate
clone, compareTo, distance, distance3D, equalInZ, equals2D, equals2D, equals3D, hashCode, hashCode, setCoordinate
-
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
-
-
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:
getOrdinatein classcom.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:
setOrdinatein classcom.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
- Overrides:
equalsin classcom.vividsolutions.jts.geom.Coordinate
-
toString
- Overrides:
toStringin classcom.vividsolutions.jts.geom.Coordinate
-
convertCoordinate
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
coordinateparameter
-
create2dWithMeasure
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 valuey- the y coordinate valuem- the lrs measure value- Returns:
- The constructed MCoordinate value
-
create2d
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 valuey- the y coordinate value- Returns:
- The constructed MCoordinate value
-
create3dWithMeasure
A convenience method for creating a MCoordinate instance where there are 3 coordinates and an lrs measure value.- Parameters:
x- the x coordinate valuey- the y coordinate valuez- the z coordinate valuem- the lrs measure value- Returns:
- The constructed MCoordinate value
-
create3d
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 valuey- the y coordinate valuez- the z coordinate value- Returns:
- The constructed MCoordinate value
-