com.supermap.data

Class GeoLine



  • public class GeoLine
    extends Geometry

    The polygon geometry class is derived from the Geometry class.

    This class is used to depict the linear geographical entity, such as river, road and isoline with one or multiple ordered sets of points. The direction of the line is determined by the ordered set of points, and you can changing the direction of the line by invoking the Reverse method. The GeoLine object can have one or multiple parts, and each part is call a sub object of the GeoLine object, and represented by an ordered set of 3D points. You can add, delete and modify the sub objects.
    • Constructor Summary

      Constructors 
      Constructor and Description
      GeoLine()
      Constructs a new GeoLine object.
      GeoLine(GeoLine geoLine)
      Initializes a new instance according to the specified GeoLine object.
      GeoLine(Point2Ds points)
      Creates a new GeoLine object according to the specified arguments.
    • Constructor Detail

      • GeoLine

        public GeoLine()
        Constructs a new GeoLine object.
      • GeoLine

        public GeoLine(GeoLine geoLine)
        Initializes a new instance according to the specified GeoLine object.
        Parameters:
        geoLine - The specified GeoLineM object.
        Throws:
        ObjectDisposedException - If the original GeoLine object to copy has called the dispose() method.
      • GeoLine

        public GeoLine(Point2Ds points)
        Creates a new GeoLine object according to the specified arguments.
        Parameters:
        points - The ordered 3D point collection that compose the line.
        Throws:
        java.lang.IllegalArgumentException - If the count of points is less than 2.
    • Method Detail

      • isEmpty

        public boolean isEmpty()
        Returns a value indicating whether the count of the subobjects of this GeoLine object is zero.
        Overrides:
        isEmpty in class Geometry
        Returns:
        Rreturns true it the GeoLine object is empty.
      • clone

        public GeoLine clone()
        Returns a copy of the current GeoLine object.
        Specified by:
        clone in class Geometry
        Returns:
        The new GeoLineM object generated from the clone operation.
      • dispose

        public void dispose()
        Release the resource occupy by this object.
        Overrides:
        dispose in class Geometry
      • getLength

        public double getLength()
        Returns the length of the GeoLine object, it's the sum of the lengthes of all the subobjects.
        Returns:
        the length of the GeoLine object.
        Default:
        The default value is 0.0.
      • getPartCount

        public int getPartCount()
        Returns the count of the subobjects of the GeoLine object. If the GeoLine object is cleared, the count of the parts of this GeoLine is zero.
        Returns:
        the count of the subobjects of the GeoLine object.
        Default:
        The default value is 0.
      • addPart

        public int addPart(Point2Ds points)
        Adds a subobject to the GeoLine object.
        Parameters:
        points - the ordered point collection.
        Returns:
        Rreturns the index of the successfully added subobject.
        Throws:
        java.lang.IllegalArgumentException - If the count of points is less than 2.
      • removePart

        public boolean removePart(int index)
        Removes the subobject of the GeoLine object with the specified index.
        Parameters:
        index - int The index number of the specified part.
        Returns:
        Returns true, if successful; otherwise false.
        Throws:
        java.lang.IndexOutOfBoundsException - if the index is larger than or equal to the count of subobjects or less than 0.
      • findPointOnLineByDistance

        public Point2D findPointOnLineByDistance(double distance)
        Finds point on the line according to the specified distance. The searching start point is the starting point of the line.
        1. When distance is greater than the Length property of the GeoLine, this method will return the endpoint of the last part of the GeoLine.
        2. When distance equals zero, the method will return the start point of the GeoLine object.
        3. If a GeoLine object has multiple subobjects, query by the order of he subobjects, for example, a GeoLine object is composed of 3 subobjects, as shown below.

        The arrows shows the direction of the subobjects, P0, P1 and P2 are their start points with length L1, L2 and L3, dl is the given distance, p is the end point of a subobject with the distance dl. P3 is the end point of L3.

        When distance equals zero, the method will return the point of P0;

        When distance is greater than the sum of L1, L2 and L3, the method will return the point of P3;

        When distance is equals the sum of L1, dL, the method will return the point of P;

        Parameters:
        distance - The point distance
        Returns:
        if successful, returns the point; otherwise returns null.
        Throws:
        java.lang.IllegalArgumentException - If the incoming distance is negative.
      • getPart

        public Point2Ds getPart(int index)
        Returns the subobject with the specified index in the GeoLine object, return the subobject in form of a ordered point collection.
        Parameters:
        index - The subobject index.
        Returns:
        Returns the Point2Ds object if succeed, return null if failed.
      • insertPart

        public boolean insertPart(int index,
                                  Point2Ds points)
        Inserts a subobject to the GeoLine object at specified place. If succeeded, this method will return true; otherwise false.
        Parameters:
        index - Inserted position
        points - the ordered set of points that will be inserted.
        Returns:
        Returns true, if successful; otherwise false.
        Throws:
        java.lang.IndexOutOfBoundsException - if the index is greater than the count of the subobjects in the GeoLine object or a negative value.
        java.lang.IllegalArgumentException - If the count of points is less than 2.
      • setPart

        public boolean setPart(int index,
                               Point2Ds points)
        Modify the subobject with the given index of the GeoLine object.
        Parameters:
        index - The index number of the part to be modify.
        points - the ordered point collection.
        Returns:
        Returns true, if successful; otherwise false.
        Throws:
        java.lang.IndexOutOfBoundsException - if index is not less than the count of the subobjects or it is a negative value.
        java.lang.IllegalArgumentException - If the count of points is less than 2.
      • rotate

        public void rotate(Point2D basePoint,
                           double angle)
        Rotate geometry object.
        Overrides:
        rotate in class Geometry
        Parameters:
        basePoint - Point2D The base point of rotation
        angle - double The angle point of rotation