com.supermap.data
Class PointM
- java.lang.Object
-
- com.supermap.data.PointM
-
public class PointM extends java.lang.Object
The PointM class. The precision is double.The pointM is the point with linear measure value. M indicates the measure value.
-
-
Constructor Summary
Constructors Constructor and Description PointM()
Constructs a new PointM object.PointM(double x, double y, double m)
Creates a new PointM object according to the specified arguments.PointM(PointM pointM)
Constructs a new object identical to the given PointM object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description PointM
clone()
Returns a copy of the current PointM object.boolean
equals(java.lang.Object obj)
Specifies whether thisPointM
structure object has the same value, including X, Y and M, with the specified PointM object.static PointM
getEMPTY()
Returns a nullPointM
object.double
getM()
Returns the measure value of the {PointM
} structure object.double
getX()
Returns the X coordinate of the {PointM
} structure object.double
getY()
Returns the Y coordinate of the {PointM
} structure object.int
hashCode()
Gets the hash code of this PointM.boolean
isEmpty()
Returns a Boolean value that indicates whether this PointM is empty or not.void
setM(double value)
Sets the measure value of the {PointM
} structure object.void
setX(double value)
Sets the X coordinate of the {PointM
} structure object.void
setY(double value)
Sets the Y coordinate of the {PointM
} structure object.java.lang.String
toString()
Creates a readable string indicates the structure object.
-
-
-
Constructor Detail
-
PointM
public PointM()
Constructs a new PointM object.
-
PointM
public PointM(double x, double y, double m)
Creates a new PointM object according to the specified arguments.- Parameters:
x
- The X coordinate of the PointM structure object.y
- The X coordinate of the PointM structure object.m
- The measure value of the PointM object.
-
PointM
public PointM(PointM pointM)
Constructs a new object identical to the given PointM object.- Parameters:
pointM
- The specified PointM object.
-
-
Method Detail
-
getEMPTY
public static final PointM getEMPTY()
Returns a nullPointM
object. (That is X = Double.MIN_VALUE,Y = Double.MIN_VALUE,M = Double.MIN_VALUE)- Returns:
- an empty
PointM
object. - Example:
- The code below demonstrates how to create an empty PointM object.
public void getEMPTYTest(){ // Constructs an empty route point object PointM pointM2 = PointM.getEMPTY(); System.out.println(pointM2.isEmpty()); // true }
-
isEmpty
public boolean isEmpty()
Returns a Boolean value that indicates whether this PointM is empty or not.- Returns:
- a boolean, whether the object is null.
- Default:
- The default value is true.
-
getX
public double getX()
Returns the X coordinate of the {PointM
} structure object.- Returns:
- The X coordinate of the
PointM
structure object. - Default:
- The default value is -1.7976931348623157e+308
-
setX
public void setX(double value)
Sets the X coordinate of the {PointM
} structure object.- Parameters:
value
- The X coordinate of thePointM
structure object.
-
getY
public double getY()
Returns the Y coordinate of the {PointM
} structure object.- Returns:
- The Y coordinate of the
PointM
structure object. - Default:
- The default value is -1.7976931348623157e+308
-
setY
public void setY(double value)
Sets the Y coordinate of the {PointM
} structure object.- Parameters:
value
- The Y coordinate of thePointM
structure object.
-
getM
public double getM()
Returns the measure value of the {PointM
} structure object.- Returns:
- The measure value of the
PointM
structure object. - Default:
- The default value is -1.7976931348623157e+308
-
setM
public void setM(double value)
Sets the measure value of the {PointM
} structure object.- Parameters:
value
- The measure value of thePointM
structure object.
-
clone
public PointM clone()
Returns a copy of the current PointM object.- Overrides:
clone
in classjava.lang.Object
- Returns:
- The new PointM object generated from the clone operation.
- Example:
- The following code demonstrates how to clone a PointM object and determines whether it is equal to the origin route point.
public void cloneTest(){ // Constructs a route point, M represents the measure value of routing point PointM pointM = new PointM(100, 100, 60); System.out.println(pointM); // {X=100.0,Y=100.0,M=60.0} // clone PointM pointM1 = (PointM) pointM.clone(); System.out.println(pointM1); // {X=100.0,Y=100.0,M=60.0} // Determines whether the cloned point is the same as the original routing point System.out.println(pointM.equals(pointM1)); // false }
-
equals
public boolean equals(java.lang.Object obj)
Specifies whether thisPointM
structure object has the same value, including X, Y and M, with the specified PointM object.- Overrides:
equals
in classjava.lang.Object
- Parameters:
obj
- the specifiedPointM
object.- Returns:
- true if the return values of the getX(), getY() and getM() of the given {
PointM
} object equals the that of thisPointM
object. - Example:
- See the sample of
PointM.clone()
method.
-
hashCode
public int hashCode()
Gets the hash code of this PointM.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- the hash code of this PointM object.
-
toString
public java.lang.String toString()
Creates a readable string indicates the structure object. For example, the object is PointM(2,3,4) , the corresponding string is "{X=2.0,Y=3.0,M=4.0}".- Overrides:
toString
in classjava.lang.Object
- Returns:
- A readable string represent this
PointM
structure object.
-
-