public abstract class

MultiPath

extends Geometry
implements Serializable Serializable
java.lang.Object
   ↳ com.esri.core.geometry.Geometry
     ↳ com.esri.core.geometry.MultiPath
Known Direct Subclasses

Class Overview

The MulitPath class is a base class for polygons and polylines. Defines default behavior that applies to both Polygon objects and Polyline objects. One would typically work with one of these subclasses.

Summary

Fields
protected MultiPathImpl m_impl
[Expand]
Inherited Fields
From class com.esri.core.geometry.Geometry
Public Constructors
MultiPath()
Public Methods
void add(MultiPath src, boolean bReversePaths)
Appends all paths from another multipath.
void addEnvelope(Envelope envSrc, boolean bReverse)
Adds a rectangular closed path to this multipath.
void addPath(MultiPath src, int srcPathIndex, boolean bForward)
Copies a path from another multipath.
void addSegment(Segment segment, boolean bStartNewPath)
Adds a new segment to this multipath.
void applyTransformation(Transformation2D transform)
Applies 2D affine transformation in XY plane.
double calculateArea2D()
Calculates the area of the geometry.
double calculateLength2D()
Calculates the length of the geometry.
void closeAllPaths()
Closes all open paths by adding an implicit line segment from the end point to the start point.
void closePathWithLine()
Closes the last path of this multipath with a line segment.
void copyTo(Geometry dst)
Copies this geometry to another geometry of the same type.
int getPathCount()
Returns the number of paths in this multipath.
int getPathEnd(int pathIndex)
Returns the index immediately following the last index of the path.
int getPathIndexFromPointIndex(int pointIndex)
Returns the path index from the point index.
int getPathSize(int pathIndex)
Returns the number of vertices in a path.
int getPathStart(int pathIndex)
Returns the start index of the path.
Point getPoint(int index)
Returns given vertex of the Geometry.
void getPoint(int index, Point ptOut)
Returns given vertex of the Geometry by value.
int getPointCount()
Returns the total vertex count in this Geometry.
int getSegmentCount()
Returns total segment count in the MultiPath.
int getSegmentCount(int pathIndex)
Returns the segment count in the given multipath path.
int getStateFlag()
Returns the state of the geometry.
int hashCode()
Returns the hash code for the multipath.
void insertPath(int pathIndex, MultiPath src, int srcPathIndex, boolean bForward)
Inserts a path from another multipath.
void insertPoint(int pathIndex, int beforePointIndex, Point pt)
Inserts a point.
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.
boolean isClosedPath(int pathIndex)
Indicates if the given path is closed (represents a ring).
boolean isEmpty()
Indicates if the geometry object contains geometric information.
void lineTo(Point endPoint)
Adds a Line Segment to the given end point.
void lineTo(double x, double y)
Adds a line segment from the last point to the given end coordinates.
void queryEnvelope(Envelope env)
Gets the axis aligned bounding box of the geometry.
SegmentIterator querySegmentIterator()
Returns a SegmentIterator that is set right before the beginning of the multipath.
SegmentIterator querySegmentIteratorAtVertex(int startVertexIndex)
Returns a SegmentIterator that is set to a specific vertex of the MultiPath.
void removePath(int pathIndex)
Removes the path at the given index.
void removePoint(int pathIndex, int pointIndexRelativeToPath)
Remove a point.
void removePoint(int pointIndex)
Remove a point.
void reverseAllPaths()
Reverses the order of the vertices in each path.
void reversePath(int pathIndex)
Reverses the order of vertices in the path.
void setEmpty()
Sets the geometry to its original initialization state by releasing all data referenced by the geometry.
void setPoint(int index, Point point)
Sets the vertex at given index of the Geometry.
void startPath(Point point)
Starts a new path at a point.
void startPath(double x, double y)
Starts a new path at given coordinates.
Protected Methods
Object _getImpl()
Returns implementation class of the geometry.
[Expand]
Inherited Methods
From class com.esri.core.geometry.Geometry
From class java.lang.Object

Fields

protected MultiPathImpl m_impl

Public Constructors

public MultiPath ()

Public Methods

public void add (MultiPath src, boolean bReversePaths)

Appends all paths from another multipath.

Parameters
src MultiPath: The multipath to append to this multipath.
bReversePaths boolean: TRUE if the multipath is added should be added with its paths reversed.

public void addEnvelope (Envelope envSrc, boolean bReverse)

Adds a rectangular closed path to this multipath.

Parameters
envSrc Envelope: Is the envelope to add to this mulitpath.
bReverse boolean: Adds the path reversed (counter-clockwise).

public void addPath (MultiPath src, int srcPathIndex, boolean bForward)

Copies a path from another multipath.

Parameters
src MultiPath: The multipath to copy from.
srcPathIndex int: The index of the path in the the source MultiPath.
bForward boolean: When FALSE, the points are inserted in reverse order.

public void addSegment (Segment segment, boolean bStartNewPath)

Adds a new segment to this multipath.

Parameters
segment Segment: The segment to be added to this mulitpath.
bStartNewPath boolean: TRUE if a new path will be added.

public void applyTransformation (Transformation2D transform)

Applies 2D affine transformation in XY plane.

Parameters
transform Transformation2D: The affine transformation to be applied to this geometry.

public double calculateArea2D ()

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.

Returns
double A double value representing the 2D area of the geometry.

public double calculateLength2D ()

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 in GeometryEngine.

Returns
double A double value representing the 2D length of the geometry.

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.

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.

public void copyTo (Geometry dst)

Copies this geometry to another geometry of the same type. The result geometry is an exact copy.

Parameters
dst Geometry

public int getPathCount ()

Returns the number of paths in this multipath.

Returns
int The number of paths in this multipath.

public int getPathEnd (int pathIndex)

Returns the index immediately following the last index of the path.

Parameters
pathIndex int: The index of the path to return the end index from.
Returns
int Integer index after last index of path

public int getPathIndexFromPointIndex (int pointIndex)

Returns the path index from the point index. This is O(log N) operation.

Parameters
pointIndex int: The index of the point.
Returns
int The index of the path.

public int getPathSize (int pathIndex)

Returns the number of vertices in a path.

Parameters
pathIndex int: The index of the path to return the number of vertices from.
Returns
int The number of vertices in a path.

public int getPathStart (int pathIndex)

Returns the start index of the path.

Parameters
pathIndex int: The index of the path to return the start index from.
Returns
int The start index of the path.

public Point getPoint (int index)

Returns given vertex of the Geometry.

Parameters
index int
Returns
Point

public void getPoint (int index, Point ptOut)

Returns given vertex of the Geometry by value.

Parameters
index int
ptOut Point

public int getPointCount ()

Returns the total vertex count in this Geometry.

Returns
int

public int getSegmentCount ()

Returns total segment count in the MultiPath.

Returns
int

public int getSegmentCount (int pathIndex)

Returns the segment count in the given multipath path.

Parameters
pathIndex int: The path to determine the segment.
Returns
int The segment of the multipath.

public int getStateFlag ()

Returns the state of the geometry. The stateFlag value changes with changes applied to this geometry. This allows the user to keep track of the geometry's state.

Returns
int The state of the geometry.

public int hashCode ()

Returns the hash code for the multipath.

Returns
int

public void insertPath (int pathIndex, MultiPath src, int srcPathIndex, boolean bForward)

Inserts a path from another multipath.

Parameters
pathIndex int: The start index of the multipath to insert.
src MultiPath: The multipath to insert into this multipath. Can be the same as the multipath being modified.
srcPathIndex int: The start index to insert the path into the multipath.
bForward boolean: When FALSE, the points are inserted in reverse order.

public void insertPoint (int pathIndex, int beforePointIndex, Point pt)

Inserts a point.

Parameters
pathIndex int: The path index in this class to insert the point to. Must correspond to an existing path.
beforePointIndex int: 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 Point: The point to be inserted.

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 int: The path index in this multipath to insert points to. Must correspond to an existing path.
beforePointIndex int: 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 MultiPath: The source multipath.
srcPathIndex int: The source path index to copy points from.
srcPointIndexFrom int: The start point in the source path to start copying from.
srcPointCount int: The count of points to add.
bForward boolean: When FALSE, the points are inserted in reverse order.

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 int: The index of the path to check to be closed.
Returns
boolean TRUE if the given path is closed (represents a Ring).

public boolean isEmpty ()

Indicates if the geometry object contains geometric information. IsEmpty returns true when the geometry object does not contain geometric information beyond its original initialization state.

Returns
boolean boolean Returns true if this geometry is empty.

public void lineTo (Point endPoint)

Adds a Line Segment to the given end point.

Parameters
endPoint Point: The end point to which the newly added line segment should point.

public void lineTo (double x, double y)

Adds a line segment from the last point to the given end coordinates.

Parameters
x double: The X coordinate to the end point.
y double: The Y coordinate to the end point.

public void queryEnvelope (Envelope env)

Gets the axis aligned bounding box of the geometry.

Parameters
env Envelope: The envelope to return the result in.

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
SegmentIterator The SegmentIterator for this mulitpath.

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 int: The start index of the SegementIterator.
Returns
SegmentIterator The SegmentIterator for this mulitpath at the specified vertex.

public void removePath (int pathIndex)

Removes the path at the given index.

Parameters
pathIndex int: The start index to remove the path.

public void removePoint (int pathIndex, int pointIndexRelativeToPath)

Remove a point. If the point is in the middle of a path, previous and next points are reconnected with a straight line.

Parameters
pathIndex int: The path index in this class to insert the point to. Must correspond to an existing path.
pointIndexRelativeToPath int: The point index in the given path of this multipath before which the point needs to be inserted. This value must be between 0 and getPathSize(int), or -1 to insert the point at the end of the given path. Note, the performance is linear in the total point count.

public void removePoint (int pointIndex)

Remove a point. If the point is in the middle of a path, previous and next points are reconnected with a straight line.

Parameters
pointIndex int: The point index in the multi path. This value must be between 0 and getPointCount(), or -1 to insert the point at the end of the last path. Note, the performance is linear in the total point count, and is slower than the removePoint(int, int) because it needs to calculate the path index from the point index.

public void reverseAllPaths ()

Reverses the order of the vertices in each path.

public void reversePath (int pathIndex)

Reverses the order of vertices in the path.

Parameters
pathIndex int: The start index of the path to reverse the order.

public void setEmpty ()

Sets the geometry to its original initialization state by releasing all data referenced by the geometry.

public void setPoint (int index, Point point)

Sets the vertex at given index of the Geometry.

Parameters
index int: The index of the vertex being changed.
point 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).

public void startPath (Point point)

Starts a new path at a point.

Parameters
point Point: The point to start the path from.

public void startPath (double x, double y)

Starts a new path at given coordinates.

Parameters
x double: The X coordinate of the start point.
y double: The Y coordinate of the start point.

Protected Methods

protected Object _getImpl ()

Returns implementation class of the geometry. Subclass overrides this method.

Returns
Object