oracle.sdoapi.geom
Interface Segment

All Superinterfaces:
java.lang.Cloneable, java.io.Serializable
All Known Subinterfaces:
CircularArc, LinearSegment

public interface Segment
extends java.lang.Cloneable, java.io.Serializable

Segment is a helper interface that represents a part of geometry. A segment is not a geometric entity by itself. It has two end points and usually uniform interpolation in between. This interface is a helper to iterate through a curve string composed of heterogeneous parts. For example, a curve string starts with a linear segment and ends with a circular arc.


Method Summary
 java.lang.Object clone()
          Clones this segment to generate another segment object.
 double[] getCoordArray()
          Gets an array of coordinates (x, y, z, etc.) in this segment.
 int getCoordArray(double[] coordArray, int pointOffset, int numPoints)
          Gets the coordinate array of this segment.
 int getDimensionality()
          Gets the dimensionality of this segment.
 CoordPoint getEndPoint()
          Gets the last point of this segment.
 void getEndPoint(CoordPoint point)
          Gets the last point of this segment.
 Envelope getEnvelope()
          Gets the envelope for this segment.
 int getNumPoints()
          Gets the number of coordinate points in this segment.
 CoordPoint[] getPointArray()
          Gets an array of all coordinate points in this segment.
 int getPointArray(CoordPoint[] pointArray, int pointOffset, int numPoints)
          Gets an array of all coordinate points in this segment.
 void getPointAt(CoordPoint point, int i)
          Gets the i-th coordinate point on this segment.
 CoordPoint getPointAt(int i)
          Gets the i-th coordinate point on this segment.
 java.util.Enumeration getPoints()
          Gets an enumeration of all coordinate points in this segment.
 java.lang.Class getSegmentType()
          Gets the segment type as defined in this interface package or extended subtypes defined by users.
 CoordPoint getStartPoint()
          Gets the first point of this segment.
 void getStartPoint(CoordPoint point)
          Gets the first point of this segment.
 LinearSegment linearizeSegment(double tolerance)
          Linearizes (densifies) this segment into a linear geometry segment.
 LinearSegment linearizeSegment(int numPoints)
          Linearizes (densifies) this segment into a linear geometry segment which may contain more points.
 

Method Detail

getSegmentType

public java.lang.Class getSegmentType()
Gets the segment type as defined in this interface package or extended subtypes defined by users. Implementation classes should always return an appropriate interface type to standardize the segment usage and hide implementation details. For example, a circular arc implementation class should return a CircularArc interface so that user can compare it with CircularArc.class to determine the type of this segment object. This method could be helpful to avoid extensive use of the instanceof operator.
Returns:
an interface representing the type of this segment

getDimensionality

public int getDimensionality()
Gets the dimensionality of this segment.
Returns:
the dimension of the data that define this segment object

getStartPoint

public CoordPoint getStartPoint()
Gets the first point of this segment.
Returns:
the first coordinate point of this segment

getStartPoint

public void getStartPoint(CoordPoint point)
Gets the first point of this segment. This method may be more memory efficient when you can reuse the coordinate point object.
Parameters:
point - a preallocated coordinate point that is to be filled with the ordinates of the first point of this segment

getEndPoint

public CoordPoint getEndPoint()
Gets the last point of this segment.
Returns:
the last coordinate point of this segment

getEndPoint

public void getEndPoint(CoordPoint point)
Gets the last point of this segment. This method may be more memory efficient when you can reuse the coordinate point object.
Parameters:
point - a preallocated coordinate point that is to be filled with the ordinates of the last point of this segment

getNumPoints

public int getNumPoints()
Gets the number of coordinate points in this segment.
Returns:
the number of coordinate points in this segment

getPoints

public java.util.Enumeration getPoints()
Gets an enumeration of all coordinate points in this segment.
Returns:
an enumeration of all coordinate points in this segment

getPointArray

public CoordPoint[] getPointArray()
Gets an array of all coordinate points in this segment.
Returns:
an array of all coordinate points in this segment

getPointArray

public int getPointArray(CoordPoint[] pointArray,
                         int pointOffset,
                         int numPoints)
Gets an array of all coordinate points in this segment.
Parameters:
pointArray - a preallocated array of coordinate point to be filled with all coordinates in this segment. All points in this array must be preallocated.
pointOffset - position in this curve string from which to begin to retrieve points
numPoints - number of points to retrieve
Returns:
the actual number of points that are retrieved by this invocation

getCoordArray

public double[] getCoordArray()
Gets an array of coordinates (x, y, z, etc.) in this segment.
Returns:
an array of coordinates of all the points in this segment

getCoordArray

public int getCoordArray(double[] coordArray,
                         int pointOffset,
                         int numPoints)
Gets the coordinate array of this segment. This method may be memory efficient when you can reuse the double array.
Parameters:
coordArray - a preallocated double array that is to be filled with all coordinates of this segment
pointOffset - position in this segment from which to begin to retrieve x, y coordinates
numPoints - number of points to retrieve
Returns:
the actual number of points that are retrieved by this invocation

getPointAt

public CoordPoint getPointAt(int i)
Gets the i-th coordinate point on this segment.
Parameters:
i - the index of the coordinate point
Returns:
the i-th coordinate point of this segment

getPointAt

public void getPointAt(CoordPoint point,
                       int i)
Gets the i-th coordinate point on this segment.
Parameters:
point - the coordinate point that is to be filled with the ordinates of point i of this segment
i - the index of the coordinate point

getEnvelope

public Envelope getEnvelope()
Gets the envelope for this segment. Usually this envelope will be the aligned Minimal Bounding Rectangle for this segment.
Returns:
the envelope for this segment

linearizeSegment

public LinearSegment linearizeSegment(int numPoints)
                               throws InvalidGeometryException
Linearizes (densifies) this segment into a linear geometry segment which may contain more points.
Parameters:
numPoints - the desired number of points that will be in the result linear geometry segment
Returns:
the linearized segment

linearizeSegment

public LinearSegment linearizeSegment(double tolerance)
                               throws InvalidGeometryException
Linearizes (densifies) this segment into a linear geometry segment.
Parameters:
tolerance - the maximum tolarable distance between the orginal segment and the result linear segment
Returns:
the linearized segment

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Clones this segment to generate another segment object.
Overrides:
clone in class java.lang.Object
Returns:
a segment object with the same content as in this segment