com.esri.arcgis.geometry
Interface ISegmentCollection

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
ISegmentCollectionProxy, Path, Polygon, Polyline, Ring

public interface ISegmentCollection
extends java.io.Serializable

Provides access to members that manipulate the segments of a path, ring, polyline, or polygon.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Description

A Segment Collection is a collection of Segments that compose a segment-based geometry.  A Segment Collection can be used to access any segment within a segment-based geometry without regard to the overall geometry that the Segment Collection represents.  As a geometry, the Segment Collection is assumed to be a valid Path.  Although it is possible to access the Segment Collection of an entire Polyline or Polygon, manipulation of Polyline and Polygons is best done with a Geometry Collection.


Method Summary
 void addSegment(ISegment inSegment, java.lang.Object before, java.lang.Object after)
          Adds a reference to the input segment at the end, or before or after a specified index.
 void addSegmentCollection(ISegmentCollection segments)
          Adds references to the segments from the specified segment collection.
 void addSegments(int count, ISegment newSegments)
          Deprecated. This method uses C style arrays which are not supported in the ArcGIS API for Java. It is replaced by GeometryEnvironment.addSegments(com.esri.arcgis.geometry.ISegmentCollection, com.esri.arcgis.geometry.ISegment[]).
 IEnumCurve getEnumCurve()
          A new curve enumerator for this segment collection.
 IEnumSegment getEnumSegments()
          A new enumerator for this segment collection.
 IEnumSegment getIndexedEnumSegments(IGeometry queryGeometry)
          A new indexed segment enumerator for this segment collection.
 ISegment getSegment(int i)
          A reference to the ith segment.
 int getSegmentCount()
          The number of segments.
 void hasNonLinearSegments(boolean[] nonLinearSegments)
          Indicates if this segment collection contains segments other than lines.
 void insertSegmentCollection(int index, ISegmentCollection newSegments)
          Inserts references to the segments in the input collectoin.
 void insertSegmentCollectionEx(int index, int start, int count, ISegmentCollection newSegments)
          Inserts references to some of the segments from the input collection.
 void insertSegments(int index, int count, ISegment newSegments)
          Deprecated. This method uses C style arrays which are not supported in the ArcGIS API for Java. It is replaced by GeometryEnvironment.insertSegments(com.esri.arcgis.geometry.ISegmentCollection, int, com.esri.arcgis.geometry.ISegment[]).
 void querySegments(int index, int count, ISegment[] segments)
          Deprecated. This method uses C style arrays which are not supported in the ArcGIS API for Java. It is replaced by GeometryEnvironment.querySegments(com.esri.arcgis.geometry.ISegmentCollection, int, com.esri.arcgis.geometry.ISegment[][]).
 void removeSegments(int index, int count, boolean closeGap)
          Removes references to some segments.
 void replaceSegmentCollection(int index, int goingAway, ISegmentCollection newSegments)
          Remove and inserts some segments.
 void replaceSegments(int index, int comingIn, int goingAway, ISegment newSegments)
          Deprecated. This method uses C style arrays which are not supported in the ArcGIS API for Java. It is replaced by GeometryEnvironment.replaceSegments(com.esri.arcgis.geometry.ISegmentCollection, int, int, com.esri.arcgis.geometry.ISegment[]).
 void segmentsChanged()
          Informs the segment collection that any cached values that it may be maintaining (envelope, length, etc.) are invalid.
 void setCircle(IPoint cp, double circleRadius)
          Defines this path, ring, polyline or polygon to contain a single circular arc segment that is closed.
 void setRectangle(IEnvelope inEnvelope)
          Defines this path, ring, polyline or polygon to have four line segments in the same positions as the sides of the input envelope.
 void setSegmentCollection(ISegmentCollection newSegments)
          Replaces all segments with references to segments from the input collection.
 void setSegments(int count, ISegment newSegments)
          Replaces all segments with references to the input segments.
 

Method Detail

getSegmentCount

public int getSegmentCount()
                    throws java.io.IOException,
                           AutomationException
The number of segments.

Supported Platforms

Windows, Solaris, Linux

Description

Returns the number of Segments in the Segment Collection.  The last Segment in the Segment Collection has an index equal to SegmentCount - 1.

Returns:
The cSegments
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getSegment

public ISegment getSegment(int i)
                    throws java.io.IOException,
                           AutomationException
A reference to the ith segment.

Supported Platforms

Windows, Solaris, Linux

Description

Returns the ith Segment from the Segment Collection.  The first Segment has index 0 and the last Segment has index equal to SegmentCount - 1.  The last Segment can also be referenced using index -1.

Parameters:
i - The i (in)
Returns:
A reference to a com.esri.arcgis.geometry.ISegment
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

addSegment

public void addSegment(ISegment inSegment,
                       java.lang.Object before,
                       java.lang.Object after)
                throws java.io.IOException,
                       AutomationException
Adds a reference to the input segment at the end, or before or after a specified index.

Supported Platforms

Windows, Solaris, Linux

Description

Adds a Segment to a Segment Collection.  If before and after are omitted, the Segment is added to the end of the Segment Collection.  Additionally, by specifying either the before or after index, the Segment can be added at a specific location in the Segment Collection.

Parameters:
inSegment - A reference to a com.esri.arcgis.geometry.ISegment (in)
before - A Variant (in, optional, pass null if not required)
after - A Variant (in, optional, pass null if not required)
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

querySegments

public void querySegments(int index,
                          int count,
                          ISegment[] segments)
                   throws java.io.IOException,
                          AutomationException
Deprecated. This method uses C style arrays which are not supported in the ArcGIS API for Java. It is replaced by GeometryEnvironment.querySegments(com.esri.arcgis.geometry.ISegmentCollection, int, com.esri.arcgis.geometry.ISegment[][]).

Returns references to some of the input segments. This method is intended for internal use only.

Supported Platforms

Windows, Solaris, Linux

Description

Queries a specified number (Count) of Segments starting at the given index into an array of Segments.

Parameters:
index - The index (in)
count - The count (in)
segments - A reference to a com.esri.arcgis.geometry.ISegment (out: use single element array)
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

addSegments

public void addSegments(int count,
                        ISegment newSegments)
                 throws java.io.IOException,
                        AutomationException
Deprecated. This method uses C style arrays which are not supported in the ArcGIS API for Java. It is replaced by GeometryEnvironment.addSegments(com.esri.arcgis.geometry.ISegmentCollection, com.esri.arcgis.geometry.ISegment[]).

Adds references to segments. This method is intended for internal use only.

Supported Platforms

Windows, Solaris, Linux

Description

Adds the first specified number (Count) of Segments to the Segment Collection from an array of Segments (with at least Count segments).  The Segments are all added to the end of the Segment Collection in the same sequence as they are ordered in the array.

Remarks

Note: the array must contains only ISegment pointers, otherwise it night crash the application.

Parameters:
count - The count (in)
newSegments - A reference to a com.esri.arcgis.geometry.ISegment (in)
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

addSegmentCollection

public void addSegmentCollection(ISegmentCollection segments)
                          throws java.io.IOException,
                                 AutomationException
Adds references to the segments from the specified segment collection.

Supported Platforms

Windows, Solaris, Linux

Description

Adds a Segment Collection of Segments to the end of the existing Segment Collection.  It is assumed that the From Point of the new Segment Collection is the same as the To Point of the existing Segment Collection.

Remarks

AddSegmentCollection add the other geometry to the last part of the current geometry.
For example, adding a polyline (with one part) to another polyline (with one part)
is adding the second polyline segments into the first part of the other polyline
even if the polylines are disjoint.

Parameters:
segments - A reference to a com.esri.arcgis.geometry.ISegmentCollection (in)
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

insertSegments

public void insertSegments(int index,
                           int count,
                           ISegment newSegments)
                    throws java.io.IOException,
                           AutomationException
Deprecated. This method uses C style arrays which are not supported in the ArcGIS API for Java. It is replaced by GeometryEnvironment.insertSegments(com.esri.arcgis.geometry.ISegmentCollection, int, com.esri.arcgis.geometry.ISegment[]).

Inserts references to the input segments. This method is intended for internal use only.

Supported Platforms

Windows, Solaris, Linux

Description

Inserts a specified number (Count) of Segments into the Segment Collection at the given index from an array of Segments.  The first Count segments from the array are inserted.

Parameters:
index - The index (in)
count - The count (in)
newSegments - A reference to a com.esri.arcgis.geometry.ISegment (in)
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

insertSegmentCollection

public void insertSegmentCollection(int index,
                                    ISegmentCollection newSegments)
                             throws java.io.IOException,
                                    AutomationException
Inserts references to the segments in the input collectoin.

Supported Platforms

Windows, Solaris, Linux

Description

Inserts a Segment Collection of segments into the Segment Collection at the specified index.  The resulting Segment Collection does not retain information about the distinction between the old and new Segment Collections.

Parameters:
index - The index (in)
newSegments - A reference to a com.esri.arcgis.geometry.ISegmentCollection (in)
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

insertSegmentCollectionEx

public void insertSegmentCollectionEx(int index,
                                      int start,
                                      int count,
                                      ISegmentCollection newSegments)
                               throws java.io.IOException,
                                      AutomationException
Inserts references to some of the segments from the input collection.

Supported Platforms

Windows, Solaris, Linux

Parameters:
index - The index (in)
start - The start (in)
count - The count (in)
newSegments - A reference to a com.esri.arcgis.geometry.ISegmentCollection (in)
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

replaceSegments

public void replaceSegments(int index,
                            int comingIn,
                            int goingAway,
                            ISegment newSegments)
                     throws java.io.IOException,
                            AutomationException
Deprecated. This method uses C style arrays which are not supported in the ArcGIS API for Java. It is replaced by GeometryEnvironment.replaceSegments(com.esri.arcgis.geometry.ISegmentCollection, int, int, com.esri.arcgis.geometry.ISegment[]).

Removes and inserts from segments. This method is intended for internal use only.

Supported Platforms

Windows, Solaris, Linux

Description

Removes a specified number (goingAway) of Segments from a Segment Collection starting at a given index and replaces them (starting at the same index) with a specified number (comingIn) of Segments from an array of Segments.

Remarks

ReplaceSegments will return an error ("The index is either too large or too small") if the inputs are inconsistent. For example, specifying index = 4 on a polyline with only 2 segments.

On multipart geometry, segments cannot be replaced on more than one part at the time. For example, an error (("The index is either too large or too small") is returned on a polyline with two parts containing three segments each when specifying index= 2, incoming= 2, removal= 2. The error is returned because the first part doesn't contain enough segments to remove two segments starting at index = 2. This behavior is enforced for performance reasons. Please see the example.  

Parameters:
index - The index (in)
comingIn - The comingIn (in)
goingAway - The goingAway (in)
newSegments - A reference to a com.esri.arcgis.geometry.ISegment (in)
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

replaceSegmentCollection

public void replaceSegmentCollection(int index,
                                     int goingAway,
                                     ISegmentCollection newSegments)
                              throws java.io.IOException,
                                     AutomationException
Remove and inserts some segments.

Supported Platforms

Windows, Solaris, Linux

Description

Replaces a specified number (goingAway) of Segments in the Segment Collection begining at a given index with a Segment Collection of Segments (inserted at the given index).

Parameters:
index - The index (in)
goingAway - The goingAway (in)
newSegments - A reference to a com.esri.arcgis.geometry.ISegmentCollection (in)
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

removeSegments

public void removeSegments(int index,
                           int count,
                           boolean closeGap)
                    throws java.io.IOException,
                           AutomationException
Removes references to some segments. If closeGap is TRUE, then any remaining internal gap in the path, ring, polyline or polygon is connected with a single line segment.

Supported Platforms

Windows, Solaris, Linux

Description

Removes a specified number (Count) of Segments from a Segment Collection starting at a given index.
If the removal created a disjoint Path and if closeGap is TRUE, then the remaining segments will
be connected at the midpoint of the gap by modifying the segments adjacent to the gap.This will create a
connected Path.

Parameters:
index - The index (in)
count - The count (in)
closeGap - The closeGap (in)
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setCircle

public void setCircle(IPoint cp,
                      double circleRadius)
               throws java.io.IOException,
                      AutomationException
Defines this path, ring, polyline or polygon to contain a single circular arc segment that is closed.

Parameters:
cp - A reference to a com.esri.arcgis.geometry.IPoint (in)
circleRadius - The circleRadius (in)
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setRectangle

public void setRectangle(IEnvelope inEnvelope)
                  throws java.io.IOException,
                         AutomationException
Defines this path, ring, polyline or polygon to have four line segments in the same positions as the sides of the input envelope.

Parameters:
inEnvelope - A reference to a com.esri.arcgis.geometry.IEnvelope (in)
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setSegments

public void setSegments(int count,
                        ISegment newSegments)
                 throws java.io.IOException,
                        AutomationException
Replaces all segments with references to the input segments. This method is intended for internal use only.

Parameters:
count - The count (in)
newSegments - A reference to a com.esri.arcgis.geometry.ISegment (in)
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setSegmentCollection

public void setSegmentCollection(ISegmentCollection newSegments)
                          throws java.io.IOException,
                                 AutomationException
Replaces all segments with references to segments from the input collection.

Parameters:
newSegments - A reference to a com.esri.arcgis.geometry.ISegmentCollection (in)
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getEnumSegments

public IEnumSegment getEnumSegments()
                             throws java.io.IOException,
                                    AutomationException
A new enumerator for this segment collection.

Supported Platforms

Windows, Solaris, Linux

Description

Returns an IEnumSegment enumerator for the current SegmentCollection.

Returns:
A reference to a com.esri.arcgis.geometry.IEnumSegment
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getEnumCurve

public IEnumCurve getEnumCurve()
                        throws java.io.IOException,
                               AutomationException
A new curve enumerator for this segment collection.

Supported Platforms

Windows, Solaris, Linux

Description

Returns an IEnumCurve enumerator for the current SegmentCollection.

Returns:
A reference to a com.esri.arcgis.geometry.IEnumCurve
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

hasNonLinearSegments

public void hasNonLinearSegments(boolean[] nonLinearSegments)
                          throws java.io.IOException,
                                 AutomationException
Indicates if this segment collection contains segments other than lines.

Supported Platforms

Windows, Solaris, Linux

Description

Returns TRUE if the Segment Collection contains CircularArcs, BezierCurves, or EllipticArcs.  Returns FALSE if all segments are Lines.

Parameters:
nonLinearSegments - The nonLinearSegments (in/out: use single element array)
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getIndexedEnumSegments

public IEnumSegment getIndexedEnumSegments(IGeometry queryGeometry)
                                    throws java.io.IOException,
                                           AutomationException
A new indexed segment enumerator for this segment collection.

Supported Platforms

Windows, Solaris, Linux

Description

The IndexedEnumSegments method returns a spatially indexed enumerator of segments. For example this enumerator can be used to quickly retrieve a small set of segments near a point or an envelope and then perform operations on those segments. Any 2D geometry type can be passed to the IndexedEnumSegments method. Depending on the input geometry the type of spatial index varies.

Remarks

Note: In order to have this method returning an indexed segment enumerator the ISpatialIndex::AllowIndexing property must be set to 'true' on the geometry.

Parameters:
queryGeometry - A reference to a com.esri.arcgis.geometry.IGeometry (in)
Returns:
A reference to a com.esri.arcgis.geometry.IEnumSegment
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

segmentsChanged

public void segmentsChanged()
                     throws java.io.IOException,
                            AutomationException
Informs the segment collection that any cached values that it may be maintaining (envelope, length, etc.) are invalid. Use this method after editing segments directly.

Supported Platforms

Windows, Solaris, Linux

Description

SegmentsChanged forces the SegmentCollection to recalculate any values that it has cached.  SegmentsChanged should be used whenever the Segments in the SegmentCollection are modified without using the SegmentCollection methods.  As long as the SegmentCollection is only modified using SegmentCollection methods, the cached values are current and consistent.

Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.