Class GeoLineM
- java.lang.Object
-
- com.supermap.data.Geometry
-
- com.supermap.data.GeoLineM
-
public class GeoLineM extends Geometry
The GeoLineM object.The Route object is a linear feature object composed of a set of points with x, y coordinates and linear Measures, which is represented by points.The points with linear Measures are often used to label the distances between different points on one line to a specified point.
When an instance of the GeoLineM object executes the
dispose()
method and then calls the object member, an ObjectDisposedException is thrown.
-
-
Constructor Summary
Constructors Constructor and Description GeoLineM()
Constructs a new GeoLineM object.GeoLineM(GeoLineM geoLineM)
Initializes a new instance identical to the given GeoLineM object.GeoLineM(PointMs pointMs)
Creates a new GeoLineM object according to the specified arguments.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description int
addPart(PointMs pointMs)
Appends a part to the GeoLineM object.void
calculateNoM(boolean isIgnoreGap)
Gets the M values for points with no M values through interpolation.boolean
calibrateLineM(GeoLineM geoLineM, CalibrateMode method, boolean isIgnoreGap)
Clibrates the GeoLineM object according to the given GeoLineM object.boolean
calibrateLineM(PointMs pointMs, CalibrateMode method, boolean isIgnoreGap)
Calibrates the GeoLineM object with pointMs.static GeoLineM
clip(GeoLineM geometry, GeoRegion clipGeometry)
Clips the GeoLineM object according to the given clip region.GeoLineM
clone()
Returns a copy of the current GeoLineM object.GeoLine
convertToLine()
Converts the GeoLineM object to a GeoLine object.GeoRegion
convertToRegion()
Converts the GeoLineM object to a GeoRegion object.void
dispose()
Disposes the resources occupied by the object.boolean
extrapolateM(Point2D fromPoint, Point2D toPoint, double fromMeasure, double toMeasure, double tolerance, CalibrateMode method)
Interpolates the GeoLineM to get M values at the positions of BEFORE and AFTER.Point2D
findPointOnLineByDistance(double distance)
Find point on the route with the given distance.double
getDistanceAtM(double measure)
Returns the distance from the point object with the specified M value to the start point of the GeoLineM object.double
getDistanceAtM(double measure, boolean isIgnoreGap)
Returns the distance from the point object with the specified M value to the start point of the GeoLineM object.double
getDistanceAtM(double distance, int subIndex, boolean isIgnoreGap)
Returns the distance from the point object withc to the start point of the specified GeoLineM subobject.double
getLength()
Returns the length of the GeoLineM object and the unit is the same as that of the dataset.double
getMAtDistance(double distance)
Returns the M value of the point object at the specified distance.double
getMAtDistance(double distance, boolean isIgnoreGap)
Returns the M value of the point object at the specified distance.double
getMAtDistance(double distance, int subindex, boolean isIgnoreGap)
Returns the M value of the point object at the specified distance.double
getMAtPoint(Point2D point2D, double tolerance, boolean isIgnoreGap)
Returns the M value of the specified point of the GeoLineM object.double
getMaxM()
Gets the maximum measure value of the GeoLineM object.double
getMinM()
Gets the minimum measure value of the GeoLineM object.PointMs
getPart(int index)
Returns the pointMs of the part at the specified index of the line object.int
getPartCount()
Gets the count of the parts of the GeoLineM object.Point2D
getPointAtDistance(double distance)
Returns the point object at the specified distance.Point2D
getPointAtDistance(double distance, boolean isIgnoreGap)
Returns the point object at the specified distance.Point2D
getPointAtM(double measure)
Returns the point object with the specified M value.Point2D
getPointAtM(double measure, double offset, boolean isIgnoreGap)
Returns the point object with the specified M value.GeoLine
getSubCurveAtM(double fromMeasure, double toMeasure)
Returns the line object corresponding to the GeoLineM object with the specified M range.GeoLineM
getSubLineMAtM(double startMeasure, double endMeasure)
Returns the corresponding GeoLineM object with the given start measure and end measure.int
indexOf(PointMs part)
Returns the index number of the part of the GeoLineM, and the part is represented by the specified set of pointMs.boolean
insertPart(int index, PointMs pointMs)
Inserts a part to the GeoLineM object at specified place.boolean
interpolateM(Point2D fromPoint, Point2D toPoint, double fromMeasure, double toMeasure, double tolerance, CalibrateMode method)
Interpolates the GeoLineM at the INTERVAL position to get M values.boolean
joint(GeoLineM otherLineM)
Joint two GeoLineM objects, the end node of the current GeoLineM object joint with the start point of another GeoLineM object.static GeoLineM
makeLineM(GeoLine geoLine, PointMs pointMs)
Create new GeoLineM object with the specified line object and PointMs.Geometry
mirror(Point2D startPoint, Point2D endPoint)
Gets geometry object symmetrical to the current GeoLineM object with respect to specific segment.void
offset(double dx, double dy)
Moves this GeoLineM object by a specified amount.void
offsetMeasure(double measure)
Modify the M value of the GeoLineM object according to the offset of the M value.boolean
removePart(int index)
Removes the part of the GeoLineM object with a specified index.boolean
reverse()
Changes the direction of the part of the GeoLine, namely, reverses the sequence of set of points that form each part of the GeoLine.boolean
reverseMOrder()
Arrange the M value of the GeoLineM objectin inverted order.void
rotate(Point2D basePoint, double angle)
Rotate the rotate object by specific degree with the specific base point, anticlockwise is the positive direction, in degree.void
setMAsDistance(double originM)
Set the M values of the GeoLineM object according to the distance.void
setMAsDistance(double originM, double scale)
Set the M values of the GeoLineM object according to the distance.void
setMAsDistance(double originM, double scale, boolean isIgnoreGap)
Set the M values of the GeoLineM object according to the distance.boolean
setMAtPoint(Point2D point2D, double measure)
Sets the M value of the specified point of the GeoLineM object.boolean
setMAtPoint(Point2D point2D, double measure, double tolerance, WhereToCalibrate wheretocalibrate)
Sets the M value of the specified point of the GeoLineM object.boolean
setPart(int index, PointMs pointMs)
Modify the GeoLine parts at the given place, return true if succeed.boolean
split(Point2D splitPoint, GeoLineM geoLineM1, GeoLineM geoLineM2)
Split the GeoLineM object based on the specific point object.static GeoLineM
union(GeoLineM geolineM, GeoLineM otherLineM)
Union the two GeoLineM objects.boolean
updateM(int fromIndex, int toIndex, double fromMeasure, double toMeasure, WhereToCalibrate wheretoCalibrate, CalibrateMode calibrateMode)
Update the M value of the GeoLineM object.boolean
updateM(Point2D fromPoint, Point2D toPoint, double fromMeasure, double toMeasure, double tolerance, WhereToCalibrate whereToCalibrate, CalibrateMode method)
Update the M value of the GeoLineM object.
-
-
-
Constructor Detail
-
GeoLineM
public GeoLineM()
Constructs a new GeoLineM object.
-
GeoLineM
public GeoLineM(GeoLineM geoLineM)
Initializes a new instance identical to the given GeoLineM object.- Parameters:
geoLineM
- The specified GeoLineM object.
-
GeoLineM
public GeoLineM(PointMs pointMs)
Creates a new GeoLineM object according to the specified arguments.- Parameters:
pointMs
- The specified PointMs object to form the GeoLineM.
-
-
Method Detail
-
dispose
public void dispose()
Disposes the resources occupied by the object. After calling this method, this object will not be usable.
-
getLength
public double getLength()
Returns the length of the GeoLineM object and the unit is the same as that of the dataset.- Returns:
- The length of the GeoLineM object.
- Default:
- The default value is 0.
-
getPartCount
public int getPartCount()
Gets the count of the parts of the GeoLineM object.For simple object, the value of this property is 1. If the GeoLineM object has been cleared, the value of this property is 0.
- Returns:
- the count of the parts of the GeoLineM object.
- Default:
- The default value is 0.
-
getMaxM
public double getMaxM()
Gets the maximum measure value of the GeoLineM object.- Returns:
- The maximum measure value of the GeoLineM object.
- Default:
- The default value is 0.
-
getMinM
public double getMinM()
Gets the minimum measure value of the GeoLineM object.- Returns:
- The minimum measure value of the GeoLineM object.
- Default:
- The default value is 0.
-
addPart
public int addPart(PointMs pointMs)
Appends a part to the GeoLineM object.- Parameters:
pointMs
- The subobject PointMs.- Returns:
- Returns the index number of the part if successful.
-
removePart
public boolean removePart(int index)
Removes the part of the GeoLineM object with a specified index.The IndexOutOfBoundsException exception is thrown If index is less than zero or is no less than
getPartCount()
.- Parameters:
index
- int The index number of the specified part.- Returns:
- Returns true if it is removed successfully; false otherwise.
-
convertToRegion
public GeoRegion convertToRegion()
Converts the GeoLineM object to a GeoRegion object.For the GeoLineM object that is not closed, when converted to the GeoRegion object, the start point and endpoint will be joined together automatically.
- Returns:
- GeoRegion Returns a GeoRegion object, if succeeded.
- Throws:
java.lang.UnsupportedOperationException
- if a subobject of the instance of theGeoLineM
object has less than 3 points.
-
findPointOnLineByDistance
public Point2D findPointOnLineByDistance(double distance)
Find point on the route with the given distance. See theGeoLine.findPointOnLineByDistance()
method. If the distance passed in is larger than the total length of the route, return the end point of the route.- Parameters:
distance
- The specified distance. The unit is the same with the dataset that contains the route object.- Returns:
- Point2D if successful, returns the Point2D; otherwise returns null.
- Throws:
java.lang.IllegalArgumentException
- When a negative value is passed in.
-
getPart
public PointMs getPart(int index)
Returns the pointMs of the part at the specified index of the line object. The point object will be returned if successful; otherwise, null will be returned.- Parameters:
index
- The subobject index.- Returns:
- PointMs The pointMs of the part at the specified index of the line object.
-
insertPart
public boolean insertPart(int index, PointMs pointMs)
Inserts a part to the GeoLineM object at specified place. If succeeded, this method will return true; otherwise false.- Parameters:
index
- The index at which to insert the part, and begin with zero.pointMs
- The insert object PointMs.- Returns:
- boolean returns true, if sucessful; otherwise false.
- Throws:
java.lang.IndexOutOfBoundsException
- When the index is a negative value or not less than the return value of thegetPartCount()
method.
-
indexOf
public int indexOf(PointMs part)
Returns the index number of the part of the GeoLineM, and the part is represented by the specified set of pointMs.- Parameters:
part
- The specified set of pointMs.- Returns:
- the index of the subobjects represented by ordered point collection of the GeoLineM object. Returns -1 if the part does not exist in the GeoLine object.
-
convertToLine
public GeoLine convertToLine()
Converts the GeoLineM object to a GeoLine object.- Returns:
- Returns the GeoLine object if successful.
-
reverse
public boolean reverse()
Changes the direction of the part of the GeoLine, namely, reverses the sequence of set of points that form each part of the GeoLine.- Returns:
- Returns true, if successful; otherwise false.
-
setPart
public boolean setPart(int index, PointMs pointMs)
Modify the GeoLine parts at the given place, return true if succeed.- Parameters:
index
- The index number of the part to be modify.pointMs
- The subobject PointMs.- Returns:
- Returns true, if successful; otherwise false.
-
mirror
public Geometry mirror(Point2D startPoint, Point2D endPoint)
Gets geometry object symmetrical to the current GeoLineM object with respect to specific segment.- Parameters:
startPoint
- The start point of the specific segment.endPoint
- The end point of the specific segment.- Returns:
- The image of the GeoLineM object.
-
clone
public GeoLineM clone()
Returns a copy of the current GeoLineM object.
-
reverseMOrder
public boolean reverseMOrder()
Arrange the M value of the GeoLineM objectin inverted order.- Returns:
- boolean A boolean, true if modified the direction successfully; otherwise, false.
-
offset
public void offset(double dx, double dy)
Moves this GeoLineM object by a specified amount.
-
offsetMeasure
public void offsetMeasure(double measure)
Modify the M value of the GeoLineM object according to the offset of the M value.- Parameters:
measure
- The M value offset specified.
-
rotate
public void rotate(Point2D basePoint, double angle)
Rotate the rotate object by specific degree with the specific base point, anticlockwise is the positive direction, in degree.
-
setMAsDistance
public void setMAsDistance(double originM)
Set the M values of the GeoLineM object according to the distance.- Parameters:
originM
- the M value of the start point.
-
setMAsDistance
public void setMAsDistance(double originM, double scale)
Set the M values of the GeoLineM object according to the distance.- Parameters:
originM
- the M value of the start point.scale
- M The zoom scale of the M values specified. The M values of the GeoLineM object will be the twice of the actual distance is the zoom scale is 2.
-
setMAsDistance
public void setMAsDistance(double originM, double scale, boolean isIgnoreGap)
Set the M values of the GeoLineM object according to the distance.- Parameters:
originM
- the M value of the start point.scale
- M The zoom scale of the M values specified. The M values of the GeoLineM object will be the twice of the actual distance is the zoom scale is 2.isIgnoreGap
- whether to ignore the interval between the subobject of the GeoLineM object.
-
getPointAtM
public Point2D getPointAtM(double measure)
Returns the point object with the specified M value.- Parameters:
measure
- The M value offset specified.- Returns:
- The point object with the specified M value.
-
getPointAtM
public Point2D getPointAtM(double measure, double offset, boolean isIgnoreGap)
Returns the point object with the specified M value.- Parameters:
measure
- The M value offset specified.offset
- The offset value of the M value. If measure = 10, offset = 2, then the specified range of M value is [8,12].isIgnoreGap
- Specifies whether to ignore the distances between parts.- Returns:
- The point object with the specified M value.
-
getPointAtDistance
public Point2D getPointAtDistance(double distance)
Returns the point object at the specified distance.- Parameters:
distance
- The distance. It is the distance between the point object and the start point of the route object. The unit is the same with the dataset that contains the route.- Returns:
- The point object at the specified distance.
-
getPointAtDistance
public Point2D getPointAtDistance(double distance, boolean isIgnoreGap)
Returns the point object at the specified distance.- Parameters:
distance
- The distance. It is the distance between the point object and the start point of the route object. The unit is the same with the dataset that contains the route.isIgnoreGap
- Specifies whether to ignore the distances between parts.- Returns:
- The point object at the specified distance.
-
getSubLineMAtM
public GeoLineM getSubLineMAtM(double startMeasure, double endMeasure)
Returns the corresponding GeoLineM object with the given start measure and end measure.- Parameters:
startMeasure
- The start M value measureendMeasure
- The end M value measure.- Returns:
- The corresponding GeoLineM object with the given start measure and end measure.
-
getMAtDistance
public double getMAtDistance(double distance)
Returns the M value of the point object at the specified distance.- Parameters:
distance
- The distance. It is the distance between the point object and the start point of the route object. The unit is the same with the dataset that contains the route.- Returns:
- The M value of the point object at the specified distance.
-
getMAtDistance
public double getMAtDistance(double distance, boolean isIgnoreGap)
Returns the M value of the point object at the specified distance.- Parameters:
distance
- The distance. It is the distance between the point object and the start point of the route object. The unit is the same with the dataset that contains the route.isIgnoreGap
- Specifies whether to ignore the distances between parts.- Returns:
- The M value of the point object at the specified distance.
-
getMAtDistance
public double getMAtDistance(double distance, int subindex, boolean isIgnoreGap)
Returns the M value of the point object at the specified distance.- Parameters:
distance
- The distance. It is the distance between the point object and the start point of the route object. The unit is the same with the dataset that contains the route.subindex
- The index of the part to be returned.isIgnoreGap
- Specifies whether to ignore the distances between parts.- Returns:
- The M value of the point object at the specified distance.
-
getDistanceAtM
public double getDistanceAtM(double measure)
Returns the distance from the point object with the specified M value to the start point of the GeoLineM object.- Parameters:
measure
- The M value offset specified.- Returns:
- The distance between the point object of the given M-value and the start point of the route object. The unit is the same with the dataset that contains the route.
-
getDistanceAtM
public double getDistanceAtM(double measure, boolean isIgnoreGap)
Returns the distance from the point object with the specified M value to the start point of the GeoLineM object.- Parameters:
measure
- The M value offset specified.isIgnoreGap
- Specifies whether to ignore the distances between parts.- Returns:
- The distance between the point object of the given M-value and the start point of the route object. The unit is the same with the dataset that contains the route.
-
getDistanceAtM
public double getDistanceAtM(double distance, int subIndex, boolean isIgnoreGap)
Returns the distance from the point object withc to the start point of the specified GeoLineM subobject.- Parameters:
distance
- T the specified M valuesubIndex
- The specified index of specified route subobject.isIgnoreGap
- Specifies whether to ignore the distances between parts.The unit is the same as the unit in which the routing object belongs to the dataset.- Returns:
- The distance between the point object of the given M-value and the start point of the route subobject. The unit is the same with the dataset that contains the route.
-
setMAtPoint
public boolean setMAtPoint(Point2D point2D, double measure)
Sets the M value of the specified point of the GeoLineM object.- Parameters:
point2D
- The specified GeoPoint object.measure
- The M value offset specified.- Returns:
- A boolean value indicates whether the setting was successful. true indicates it was successful, and false indicates it was not.
-
setMAtPoint
public boolean setMAtPoint(Point2D point2D, double measure, double tolerance, WhereToCalibrate wheretocalibrate)
Sets the M value of the specified point of the GeoLineM object.- Parameters:
point2D
- The specified GeoPoint object.measure
- The M value offset specified.tolerance
- The tolerance. It is used to determine whether the specified point is on the GeoLineM object. If the vertical distances from the point to the GeoLineM object are greater than the value, the specified nodes are invalid. The settings will not be performed. The unit is the same with the dataset that contains the route object.wheretocalibrate
- The location to correct the M value of the GeoLineM object.- Returns:
- A boolean value indicates whether the setting was successful. true indicates it was successful, and false indicates it was not.
-
getMAtPoint
public double getMAtPoint(Point2D point2D, double tolerance, boolean isIgnoreGap)
Returns the M value of the specified point of the GeoLineM object.- Parameters:
point2D
- The specified GeoPoint object.tolerance
- The tolerance. It is used to determine whether the specified point is on the GeoLineM object. If the vertical distances from the point to the GeoLineM object are greater than the value, the specified nodes are invalid. The settings will not be performed. The unit is the same with the dataset that contains the route object.isIgnoreGap
- Specifies whether to ignore the distances between parts.- Returns:
- The M value of the specified point of the GeoLineM object.
-
getSubCurveAtM
public GeoLine getSubCurveAtM(double fromMeasure, double toMeasure)
Returns the line object corresponding to the GeoLineM object with the specified M range.- Parameters:
fromMeasure
- Start M ValuetoMeasure
- End M Value- Returns:
- The line object corresponding to the specified M range.
-
union
public static GeoLineM union(GeoLineM geolineM, GeoLineM otherLineM)
Union the two GeoLineM objects.- Parameters:
geolineM
- The GeoLineM objects specified to union.otherLineM
- Another GeoLineM objects specified to union.- Returns:
- Returns true if successful; otherwise, false.
-
joint
public boolean joint(GeoLineM otherLineM)
Joint two GeoLineM objects, the end node of the current GeoLineM object joint with the start point of another GeoLineM object.The process of joint() is as the following:
- Parameters:
otherLineM
- the GeoLineM object to append.- Returns:
- Returns true if successful; otherwise, false.
-
split
public boolean split(Point2D splitPoint, GeoLineM geoLineM1, GeoLineM geoLineM2)
Split the GeoLineM object based on the specific point object.- Parameters:
splitPoint
- the split point specified, it's on the GeoLineM object.geoLineM1
- the first GeoLineM object specified after split.geoLineM2
- the second GeoLineM object specified after split.- Returns:
- Returns true if successful; otherwise, false.
-
calibrateLineM
public boolean calibrateLineM(PointMs pointMs, CalibrateMode method, boolean isIgnoreGap)
Calibrates the GeoLineM object with pointMs.- Parameters:
pointMs
- The subobject PointMs.method
- The calibration mode.isIgnoreGap
- Specifies whether to ignore the distances between parts.- Returns:
- Returns true if successful; otherwise, false.
-
calibrateLineM
public boolean calibrateLineM(GeoLineM geoLineM, CalibrateMode method, boolean isIgnoreGap)
Clibrates the GeoLineM object according to the given GeoLineM object.- Parameters:
geoLineM
- The given GeoLineM object.method
- The calibration mode.isIgnoreGap
- Specifies whether to ignore the distances between parts.- Returns:
- Returns true if successful; otherwise, false.
-
clip
public static GeoLineM clip(GeoLineM geometry, GeoRegion clipGeometry)
Clips the GeoLineM object according to the given clip region.- Parameters:
geometry
- The GeoLineM object to be clipped.clipGeometry
- The given clip region.- Returns:
- The GeoLineM object after being clipped.
-
updateM
public boolean updateM(Point2D fromPoint, Point2D toPoint, double fromMeasure, double toMeasure, double tolerance, WhereToCalibrate whereToCalibrate, CalibrateMode method)
Update the M value of the GeoLineM object.- Parameters:
fromPoint
- The starting point of the route to update.toPoint
- The ending point of the route to update.fromMeasure
- the starting point M value of the route to update.toMeasure
- the ending point M value of the route to update.tolerance
- The tolerance. It is used to determine whether the specified from node and to node are on the GeoLineM object. If the vertical distances from the nodes to the object are greater than the value, the specified nodes are invalid. The update will not be performed. The unit is the same with the dataset that contains the route object.whereToCalibrate
- Specifies the position types of calibrating the M value of GeoLineM object.method
- The calibration mode.- Returns:
- Returns true if successful; otherwise, false.
-
updateM
public boolean updateM(int fromIndex, int toIndex, double fromMeasure, double toMeasure, WhereToCalibrate wheretoCalibrate, CalibrateMode calibrateMode)
Update the M value of the GeoLineM object.- Parameters:
fromIndex
- The index of the start point of the route to update.toIndex
- The index of the end point of the route to update.fromMeasure
- The M value of the start point of the route to update.toMeasure
- The M value of the end point of the route to update.wheretoCalibrate
- Specifies the position types of calibrating the M value.calibrateMode
- The calibration mode specified.- Returns:
- Returns true if successful; otherwise, false.
-
interpolateM
public boolean interpolateM(Point2D fromPoint, Point2D toPoint, double fromMeasure, double toMeasure, double tolerance, CalibrateMode method)
Interpolates the GeoLineM at the INTERVAL position to get M values. About the definition of the position, please refer to the WhereToCalibrate enumeration.- Parameters:
fromPoint
- the starting point of the route to update.toPoint
- The ending point of the route to update.fromMeasure
- the starting point M value of the route to update.toMeasure
- the ending point M value of the route to update.tolerance
- The tolerance. It is used to determine whether the specified from node and to node are on the GeoLineM object. If the vertical distances from the nodes to the object are greater than the value, the specified nodes are invalid. The interpolation will not be performed. The unit is the same with the dataset that contains the route object.method
- The calibration mode.- Returns:
- Returns true if successful; otherwise, false.
-
extrapolateM
public boolean extrapolateM(Point2D fromPoint, Point2D toPoint, double fromMeasure, double toMeasure, double tolerance, CalibrateMode method)
Interpolates the GeoLineM to get M values at the positions of BEFORE and AFTER. About the definition of the position, please refer to the WhereToCalibrate enumeration.- Parameters:
fromPoint
- the starting point of the route to update.toPoint
- The ending point of the route to update.fromMeasure
- the starting point M value of the route to update.toMeasure
- the ending point M value of the route to update.tolerance
- The tolerance. It is used to determine whether the specified from node and to node are on the GeoLineM object. If the vertical distances from the nodes to the object are greater than the value, the specified nodes are invalid. The interpolation will not be performed. The unit is the same with the dataset that contains the route object.method
- The calibration mode.- Returns:
- Returns true if successful; otherwise, false.
-
calculateNoM
public void calculateNoM(boolean isIgnoreGap)
Gets the M values for points with no M values through interpolation.- Parameters:
isIgnoreGap
- Specifies whether to ignore the distances between parts.
-
makeLineM
public static GeoLineM makeLineM(GeoLine geoLine, PointMs pointMs)
Create new GeoLineM object with the specified line object and PointMs.- Parameters:
geoLine
- The specified GeoLineM object.pointMs
- The route points collection, including at least two points.- Returns:
- Returns true if successful; otherwise, false.
-
-