Class MultiPath

All Implemented Interfaces:
Serializable
Direct Known Subclasses:
Polygon, Polyline

public abstract class MultiPath extends MultiVertexGeometry implements Serializable
The MulitPath class is a base class for polygons and polylines.
See Also:
  • Field Details

  • Constructor Details

    • MultiPath

      public MultiPath()
  • Method Details

    • getDescription

      public VertexDescription getDescription()
      Description copied from class: Geometry
      Returns the VertexDescription of this geometry.
      Overrides:
      getDescription in class Geometry
      Returns:
      VertexDescription
    • assignVertexDescription

      public void assignVertexDescription(VertexDescription src)
      Description copied from class: Geometry
      Assigns the new VertexDescription by adding or dropping attributes. The Geometry will have the src description as a result.
      Overrides:
      assignVertexDescription in class Geometry
      Parameters:
      src - VertexDescription to assign.
    • mergeVertexDescription

      public void mergeVertexDescription(VertexDescription src)
      Description copied from class: Geometry
      Merges the new VertexDescription by adding missing attributes from the src. The Geometry will have a union of the current and the src descriptions.
      Overrides:
      mergeVertexDescription in class Geometry
      Parameters:
      src - VertexDescription to merge.
    • addAttribute

      public void addAttribute(int semantics)
      Description copied from class: Geometry
      Adds a new attribute to the Geometry.
      Overrides:
      addAttribute in class Geometry
      Parameters:
      semantics - The VertexDescription.Semantics to add.
    • dropAttribute

      public void dropAttribute(int semantics)
      Description copied from class: Geometry
      Drops an attribute from the Geometry. Dropping the attribute is equivalent to setting the attribute to the default value for each vertex, However, it is faster and the result Geometry has smaller memory footprint and smaller size when persisted.
      Overrides:
      dropAttribute in class Geometry
      Parameters:
      semantics - The VertexDescription.Semantics to drop.
    • dropAllAttributes

      public void dropAllAttributes()
      Description copied from class: Geometry
      Drops all attributes from the Geometry with exception of POSITON.
      Overrides:
      dropAllAttributes in class Geometry
    • getPointCount

      public int getPointCount()
      Description copied from class: MultiVertexGeometry
      Returns the total vertex count in this Geometry.
      Specified by:
      getPointCount in class MultiVertexGeometry
    • getPoint

      public Point getPoint(int index)
      Description copied from class: MultiVertexGeometry
      Returns given vertex of the Geometry.
      Specified by:
      getPoint in class MultiVertexGeometry
    • setPoint

      public void setPoint(int index, Point point)
      Description copied from class: MultiVertexGeometry
      Sets the vertex at given index of the Geometry.
      Specified by:
      setPoint in class MultiVertexGeometry
      Parameters:
      index - The index of the vertex being changed.
      point - The Point instance to set given vertex attributes from. The pointSrc can not be empty.
      The method throws if the pointSrc is not of the Point type.
      The attributes, that are present in the pointSrc and missing in this Geometry, will be added to the Geometry.
      The vertex attributes missing in the pointSrc but present in the Geometry will be set to the default values (see VertexDescription::GetDefaultValue).
    • isEmpty

      public boolean isEmpty()
      Description copied from class: Geometry
      IsEmpty returns TRUE when the Geometry object does not contain geometric information beyond its original initialization state.
      Specified by:
      isEmpty in class Geometry
      Returns:
      boolean Returns TRUE if this geometry is empty.
    • calculateArea2D

      public double calculateArea2D()
      Description copied from class: Geometry
      Calculates the area of the geometry. If the spatial reference is a Geographic Coordinate System (WGS84) then the 2D area calculation is defined in angular units.
      Overrides:
      calculateArea2D in class Geometry
      Returns:
      A double value representing the 2D area of the geometry.
    • calculateLength2D

      public double calculateLength2D()
      Description copied from class: Geometry
      Calculates the length of the geometry. If the spatial reference is a Geographic Coordinate System (a system where coordinates are defined using angular units such as longitude and latitude) then the 2D distance calculation is returned in angular units. In cases where length must be calculated on a Geographic Coordinate System consider the using the geodeticLength method on the GeometryEngine
      Overrides:
      calculateLength2D in class Geometry
      Returns:
      A double value representing the 2D length of the geometry.
    • calculatePathLength2D

      public double calculatePathLength2D(int pathIndex)
    • getAttributeAsDbl

      public double getAttributeAsDbl(int semantics, int index, int ordinate)
      Description copied from class: MultiVertexGeometry
      Returns value of the given vertex attribute as double.
      Specified by:
      getAttributeAsDbl in class MultiVertexGeometry
      Parameters:
      semantics - The atribute semantics.
      index - is the vertex index in the Geometry.
      ordinate - is the ordinate of a vertex attribute (for example, y has ordinate of 1, because it is second ordinate of POSITION) If attribute is not present, the default value is returned. See VertexDescription::GetDefaultValue() method.
    • getAttributeAsInt

      public int getAttributeAsInt(int semantics, int index, int ordinate)
      Description copied from class: MultiVertexGeometry
      Returns value of the given vertex attribute as int.
      Specified by:
      getAttributeAsInt in class MultiVertexGeometry
      Parameters:
      semantics - The atribute semantics.
      index - is the vertex index in the Geometry.
      ordinate - is the ordinate of a vertex attribute (for example, y has ordinate of 1, because it is second ordinate of POSITION) If attribute is not present, the default value is returned. See VertexDescription::GetDefaultValue() method. Avoid using this method on non-integer atributes.
    • setAttribute

      public void setAttribute(int semantics, int index, int ordinate, double value)
      Description copied from class: MultiVertexGeometry
      Sets the value of given attribute at given posisiotnsis.
      Specified by:
      setAttribute in class MultiVertexGeometry
      Parameters:
      semantics - The atribute semantics.
      index - is the vertex index in the Geometry.
      ordinate - is the ordinate of a vertex attribute (for example, y has ordinate of 1, because it is seond ordinate of POSITION)
      value - is the value to set. as well as the number of components of the attribute. If the attribute is not present in this Geometry, it is added.
    • setAttribute

      public void setAttribute(int semantics, int index, int ordinate, int value)
      Description copied from class: MultiVertexGeometry
      Same as above, but works with ints. Avoid using this method on non-integer atributes because some double attributes may have NaN default values (e.g. Ms)
      Specified by:
      setAttribute in class MultiVertexGeometry
    • getXY

      public Point2D getXY(int index)
      Description copied from class: MultiVertexGeometry
      Returns XY coordinates of the given vertex of the Geometry.
      Specified by:
      getXY in class MultiVertexGeometry
    • getXY

      public void getXY(int index, Point2D pt)
      Specified by:
      getXY in class MultiVertexGeometry
    • setXY

      public void setXY(int index, Point2D pt)
      Description copied from class: MultiVertexGeometry
      Sets XY coordinates of the given vertex of the Geometry. All other attributes are unchanged.
      Specified by:
      setXY in class MultiVertexGeometry
    • getXYZ

      Point3D getXYZ(int index)
      Description copied from class: MultiVertexGeometry
      Returns XYZ coordinates of the given vertex of the Geometry. If the Geometry has no Z's, the default value for Z is returned (0).
      Specified by:
      getXYZ in class MultiVertexGeometry
    • setXYZ

      void setXYZ(int index, Point3D pt)
      Description copied from class: MultiVertexGeometry
      Sets XYZ coordinates of the given vertex of the Geometry. If Z attribute is not present in this Geometry, it is added. All other attributes are unchanged.
      Specified by:
      setXYZ in class MultiVertexGeometry
    • queryEnvelope

      public void queryEnvelope(Envelope env)
      Description copied from class: Geometry
      Returns the axis aligned bounding box of the geometry.
      Specified by:
      queryEnvelope in class Geometry
      Parameters:
      env - The envelope to return the result in.
    • queryEnvelope2D

      public void queryEnvelope2D(Envelope2D env)
      Description copied from class: Geometry
      Returns tight bbox of the Geometry in X, Y plane.
      Specified by:
      queryEnvelope2D in class Geometry
      Parameters:
      env - The envelope to return the result in.
    • queryPathEnvelope2D

      public void queryPathEnvelope2D(int pathIndex, Envelope2D env)
    • queryEnvelope3D

      void queryEnvelope3D(Envelope3D env)
      Description copied from class: Geometry
      Returns tight bbox of the Geometry in 3D.
      Specified by:
      queryEnvelope3D in class Geometry
      Parameters:
      env - The envelope to return the result in.
    • queryLooseEnvelope

      public void queryLooseEnvelope(Envelope2D env)
    • queryLooseEnvelope

      void queryLooseEnvelope(Envelope3D env)
    • queryInterval

      public Envelope1D queryInterval(int semantics, int ordinate)
      Description copied from class: Geometry
      Returns the min and max attribute values at the ordinate of the Geometry.
      Specified by:
      queryInterval in class Geometry
      Parameters:
      semantics - The semantics of the interval.
      ordinate - The ordinate of the interval.
      Returns:
      The interval.
    • copyTo

      public void copyTo(Geometry dst)
      Description copied from class: Geometry
      Copies this geometry to another geometry of the same type. The result geometry is an exact copy.
      Specified by:
      copyTo in class Geometry
      Parameters:
      dst - The geometry instance to copy to.
    • getBoundary

      public Geometry getBoundary()
      Description copied from class: Geometry
      Returns boundary of this geometry. Polygon and Envelope boundary is a Polyline. For Polyline and Line, the boundary is a Multi_point consisting of path end points. For Multi_point and Point null is returned.
      Specified by:
      getBoundary in class Geometry
      Returns:
      The boundary geometry.
    • queryCoordinates

      public void queryCoordinates(Point2D[] dst)
      Description copied from class: MultiVertexGeometry
      Queries XY coordinates as an array. The array must be larg enough (See GetPointCount()).
      Specified by:
      queryCoordinates in class MultiVertexGeometry
    • queryCoordinates

      public void queryCoordinates(Point2D[] dst, int dstSize, int beginIndex, int endIndex)
    • queryCoordinates

      void queryCoordinates(Point3D[] dst)
      Description copied from class: MultiVertexGeometry
      Queries XYZ coordinates as an array. The array must be larg enough (See GetPointCount()).
      Specified by:
      queryCoordinates in class MultiVertexGeometry
    • queryCoordinates

      public void queryCoordinates(Point[] dst)
      Specified by:
      queryCoordinates in class MultiVertexGeometry
    • hasNonLinearSegments

      boolean hasNonLinearSegments()
      Returns TRUE if the multipath contains non-linear segments.
    • getSegmentCount

      public int getSegmentCount()
      Returns total segment count in the MultiPath.
    • getSegmentCount

      public int getSegmentCount(int pathIndex)
      Returns the segment count in the given multipath path.
      Parameters:
      pathIndex - The path to determine the segment.
      Returns:
      The segment of the multipath.
    • add

      public void add(MultiPath src, boolean bReversePaths)
      Appends all paths from another multipath.
      Parameters:
      src - The multipath to append to this multipath.
      bReversePaths - TRUE if the multipath is added should be added with its paths reversed.
    • addPath

      public void addPath(MultiPath src, int srcPathIndex, boolean bForward)
      Copies a path from another multipath.
      Parameters:
      src - The multipath to copy from.
      srcPathIndex - The index of the path in the the source MultiPath.
      bForward - When FALSE, the points are inserted in reverse order.
    • addPath

      void addPath(Point2D[] points, int count, boolean bForward)
      Adds a new path to this multipath.
      Parameters:
      points - The array of points to add to this multipath.
      count - The number of points added to the mulitpath.
      bForward - When FALSE, the points are inserted in reverse order.
    • addSegmentsFromPath

      public void addSegmentsFromPath(MultiPath src, int srcPathIndex, int srcSegmentFrom, int srcSegmentCount, boolean bStartNewPath)
      Adds segments from a source multipath to this MultiPath.
      Parameters:
      src - The source MultiPath to add segments from.
      srcPathIndex - The index of the path in the the source MultiPath.
      srcSegmentFrom - The index of first segment in the path to start adding from. The value has to be between 0 and src.getSegmentCount(srcPathIndex) - 1.
      srcSegmentCount - The number of segments to add. If 0, the function does nothing.
      bStartNewPath - When true, a new path is added and segments are added to it. Otherwise the segments are added to the last path of this MultiPath. If bStartNewPath false, the first point of the first source segment is not added. This is done to ensure proper connection to existing segments. When the source path is closed, and the closing segment is among those to be added, it is added also as a closing segment, not as a real segment. Use add_segment instead if you do not like that behavior. This MultiPath obtains all missing attributes from the src MultiPath.
    • addSegment

      public void addSegment(Segment segment, boolean bStartNewPath)
      Adds a new segment to this multipath.
      Parameters:
      segment - The segment to be added to this mulitpath.
      bStartNewPath - TRUE if a new path will be added.
    • reverseAllPaths

      public void reverseAllPaths()
      Reverses the order of the vertices in each path.
    • reversePath

      public void reversePath(int pathIndex)
      Reverses the order of vertices in the path.
      Parameters:
      pathIndex - The start index of the path to reverse the order.
    • removePath

      public void removePath(int pathIndex)
      Removes the path at the given index.
      Parameters:
      pathIndex - The start index to remove the path.
    • insertPath

      public void insertPath(int pathIndex, MultiPath src, int srcPathIndex, boolean bForward)
      Inserts a path from another multipath.
      Parameters:
      pathIndex - The start index of the multipath to insert.
      src - The multipath to insert into this multipath. Can be the same as the multipath being modified.
      srcPathIndex - The start index to insert the path into the multipath.
      bForward - When FALSE, the points are inserted in reverse order.
    • insertPath

      void insertPath(int pathIndex, Point2D[] points, int pointsOffset, int count, boolean bForward)
      Inserts a path from an array of 2D Points.
      Parameters:
      pathIndex - The path index of the multipath to place the new path.
      points - The array of points defining the new path.
      pointsOffset - The offset into the array to start reading.
      count - The number of points to insert into the new path.
      bForward - When FALSE, the points are inserted in reverse order.
    • insertPoints

      public void insertPoints(int pathIndex, int beforePointIndex, MultiPath src, int srcPathIndex, int srcPointIndexFrom, int srcPointCount, boolean bForward)
      Inserts vertices from the given multipath into this multipath. All added vertices are connected by linear segments with each other and with the existing vertices.
      Parameters:
      pathIndex - The path index in this multipath to insert points to. Must correspond to an existing path.
      beforePointIndex - The point index before all other vertices to insert in the given path of this multipath. This value must be between 0 and GetPathSize(pathIndex), or -1 to insert points at the end of the given path.
      src - The source multipath.
      srcPathIndex - The source path index to copy points from.
      srcPointIndexFrom - The start point in the source path to start copying from.
      srcPointCount - The count of points to add.
      bForward - When FALSE, the points are inserted in reverse order.
    • insertPoints

      void insertPoints(int pathIndex, int beforePointIndex, Point2D[] src, int srcPointIndexFrom, int srcPointCount, boolean bForward)
      Inserts a part of a path from the given array.
      Parameters:
      pathIndex - The path index in this class to insert points to. Must correspond to an existing path.
      beforePointIndex - The point index in the given path of this MultiPath before which the vertices need to be inserted. This value must be between 0 and GetPathSize(pathIndex), or -1 to insert points at the end of the given path.
      src - The source array
      srcPointIndexFrom - The start point in the source array to start copying from.
      srcPointCount - The count of points to add.
      bForward - When FALSE, the points are inserted in reverse order.
    • insertPoint

      void insertPoint(int pathIndex, int beforePointIndex, Point2D pt)
      Inserts a point.
      Parameters:
      pathIndex - The path index in this class to insert the point to. Must correspond to an existing path.
      beforePointIndex - The point index in the given path of this multipath. This value must be between 0 and GetPathSize(pathIndex), or -1 to insert the point at the end of the given path.
      pt - The point to be inserted.
    • insertPoint

      public void insertPoint(int pathIndex, int beforePointIndex, Point pt)
      Inserts a point.
      Parameters:
      pathIndex - The path index in this class to insert the point to. Must correspond to an existing path.
      beforePointIndex - The point index in the given path of this multipath. This value must be between 0 and GetPathSize(pathIndex), or -1 to insert the point at the end of the given path.
      pt - The point to be inserted.
    • removePoint

      public void removePoint(int pathIndex, int pointIndex)
      Removes a point at a given index.
      Parameters:
      pathIndex - The path from whom to remove the point.
      pointIndex - The index of the point to be removed.
    • getPathCount

      public int getPathCount()
      Returns the number of paths in this multipath.
      Returns:
      The number of paths in this multipath.
    • getPathSize

      public int getPathSize(int pathIndex)
      Returns the number of vertices in a path.
      Parameters:
      pathIndex - The index of the path to return the number of vertices from.
      Returns:
      The number of vertices in a path.
    • getPathStart

      public int getPathStart(int pathIndex)
      Returns the start index of the path.
      Parameters:
      pathIndex - The index of the path to return the start index from.
      Returns:
      The start index of the path.
    • getPathEnd

      public int getPathEnd(int pathIndex)
      Returns the index immediately following the last index of the path.
      Parameters:
      pathIndex - The index of the path to return the end index from.
      Returns:
      Integer index after last index of path
    • getPathIndexFromPointIndex

      public int getPathIndexFromPointIndex(int pointIndex)
      Returns the path index from the point index. This is O(log N) operation.
      Parameters:
      pointIndex - The index of the point.
      Returns:
      The index of the path.
    • startPath

      public void startPath(double x, double y)
      Starts a new path at given coordinates.
      Parameters:
      x - The X coordinate of the start point.
      y - The Y coordinate of the start point.
    • startPath

      void startPath(Point2D point)
    • startPath

      void startPath(Point3D point)
    • startPath

      public void startPath(Point point)
      Starts a new path at a point.
      Parameters:
      point - The point to start the path from.
    • lineTo

      public void lineTo(double x, double y)
      Adds a line segment from the last point to the given end coordinates.
      Parameters:
      x - The X coordinate to the end point.
      y - The Y coordinate to the end point.
    • lineTo

      void lineTo(Point2D endPoint)
    • lineTo

      void lineTo(Point3D endPoint)
    • lineTo

      public void lineTo(Point endPoint)
      Adds a Line Segment to the given end point.
      Parameters:
      endPoint - The end point to which the newly added line segment should point.
    • bezierTo

      void bezierTo(Point2D controlPoint1, Point2D controlPoint2, Point2D endPoint)
      Adds a Cubic Bezier Segment to the current Path. The Bezier Segment connects the current last Point and the given endPoint.
    • closePathWithLine

      public void closePathWithLine()
      Closes the last path of this multipath with a line segment. The closing segment is a segment that connects the last and the first points of the path. This is a virtual segment. The first point is not duplicated to close the path. Call this method only for polylines. For polygons this method is implicitly called for the Polygon class.
    • closePathWithBezier

      void closePathWithBezier(Point2D controlPoint1, Point2D controlPoint2)
      Closes last path of the MultiPath with the Bezier Segment. The start point of the Bezier is the last point of the path and the last point of the bezier is the first point of the path.
    • closePathWithArc

      void closePathWithArc()
      Closes last path of the MultiPath with the Arc Segment.
    • closeAllPaths

      public void closeAllPaths()
      Closes all open paths by adding an implicit line segment from the end point to the start point. Call this method only for polylines.For polygons this method is implicitly called for the Polygon class.
    • isClosedPath

      public boolean isClosedPath(int pathIndex)
      Indicates if the given path is closed (represents a ring). A closed path has a virtual segment that connects the last and the first points of the path. The first point is not duplicated to close the path. Polygons always have all paths closed.
      Parameters:
      pathIndex - The index of the path to check to be closed.
      Returns:
      TRUE if the given path is closed (represents a Ring).
    • isClosedPathInXYPlane

      public boolean isClosedPathInXYPlane(int pathIndex)
    • hasNonLinearSegments

      boolean hasNonLinearSegments(int pathIndex)
      Returns TRUE if the given path might have non-linear segments.
    • addEnvelope

      public void addEnvelope(Envelope2D envSrc, boolean bReverse)
      Adds a rectangular closed Path to the MultiPathImpl.
      Parameters:
      envSrc - is the source rectangle.
      bReverse - Creates reversed path.
    • addEnvelope

      public void addEnvelope(Envelope envSrc, boolean bReverse)
      Adds a rectangular closed path to this multipath.
      Parameters:
      envSrc - Is the envelope to add to this mulitpath.
      bReverse - Adds the path reversed (counter-clockwise).
    • querySegmentIterator

      public SegmentIterator querySegmentIterator()
      Returns a SegmentIterator that is set right before the beginning of the multipath. Calling nextPath() will set the iterator to the first path of this multipath.
      Returns:
      The SegmentIterator for this mulitpath.
    • querySegmentIteratorAtVertex

      public SegmentIterator querySegmentIteratorAtVertex(int startVertexIndex)
      Returns a SegmentIterator that is set to a specific vertex of the MultiPath. The call to nextSegment() will return the segment that starts at the vertex. Calling PreviousSegment () will return the segment that starts at the previous vertex.
      Parameters:
      startVertexIndex - The start index of the SegementIterator.
      Returns:
      The SegmentIterator for this mulitpath at the specified vertex.
    • setEmpty

      public void setEmpty()
      Description copied from class: Geometry
      Returns the geometry to its original initialization state by releasing all data referenced by the geometry.
      Specified by:
      setEmpty in class Geometry
    • applyTransformation

      public void applyTransformation(Transformation2D transform)
      Description copied from class: Geometry
      Applies 2D affine transformation in XY plane.
      Specified by:
      applyTransformation in class Geometry
      Parameters:
      transform - The affine transformation to be applied to this geometry.
    • applyTransformation

      void applyTransformation(Transformation3D transform)
      Description copied from class: Geometry
      Applies 3D affine transformation. Adds Z attribute if it is missing.
      Specified by:
      applyTransformation in class Geometry
      Parameters:
      transform - The affine transformation to be applied to this geometry.
    • _getImpl

      protected Object _getImpl()
      Overrides:
      _getImpl in class Geometry
    • hashCode

      public int hashCode()
      Returns the hash code for the multipath.
      Overrides:
      hashCode in class Object
    • getPointByVal

      public void getPointByVal(int index, Point outPoint)
      Description copied from class: MultiVertexGeometry
      Returns given vertex of the Geometry. The outPoint will have same VertexDescription as this Geometry.
      Specified by:
      getPointByVal in class MultiVertexGeometry
    • setPointByVal

      public void setPointByVal(int index, Point point)
      Description copied from class: MultiVertexGeometry
      Sets the vertex at given index of the Geometry.
      Specified by:
      setPointByVal in class MultiVertexGeometry
      Parameters:
      index - The index of the vertex being changed.
      point - The Point instance to set given vertex attributes from. The pointSrc can not be empty.
      The method throws if the pointSrc is not of the Point type.
      The attributes, that are present in the pointSrc and missing in this Geometry, will be added to the Geometry.
      The vertex attributes missing in the pointSrc but present in the Geometry will be set to the default values (see VertexDescription::GetDefaultValue).
    • getStateFlag

      public int getStateFlag()
      Description copied from class: Geometry
      The stateFlag value changes with changes applied to this geometry. This allows the user to keep track of the geometry's state.
      Overrides:
      getStateFlag in class Geometry
      Returns:
      The state of the geometry.
    • replaceNaNs

      public void replaceNaNs(int semantics, double value)
      Description copied from class: Geometry
      Replaces NaNs in the attribute with the given value. If the geometry is not empty, it adds the attribute if geometry does not have it yet, and replaces the values. If the geometry is empty, it adds the attribute and does not set any values.
      Specified by:
      replaceNaNs in class Geometry
      Parameters:
      semantics - The semantics for which to replace the NaNs.
      value - The value to replace NaNs with.