com.esri.arcgis.geometry
Interface ISegmentCollection

All Superinterfaces:
Serializable
All Known Implementing Classes:
Path, Polygon, Polyline, Ring

public interface ISegmentCollection
extends Serializable

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

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.

When To Use

If you are using a development language that does not support C style arrays, use IGeometryBridge instead. The IGeometryBridge interface solves that problem allowing you to pass safe arrays instead.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

See Also:
ICircularArc, IPointCollection, IEllipticArc, IBezierCurve, ISegmentCollection, ILine, ISegment, IGeometryCollection

Method Summary
 void addSegment(ISegment inSegment, Object before, 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)
          Deprecated. This method uses C style arrays which are not supported in the ArcGIS API for Java. It is replaced by GeometryEnvironment.setSegments(com.esri.arcgis.geometry.ISegmentCollection, com.esri.arcgis.geometry.ISegment[]).
 

Method Detail

getSegmentCount

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

Description

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

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

getSegment

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

Product Availability

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

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

addSegment

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

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.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

querySegments

void querySegments(int index,
                   int count,
                   ISegment[] segments)
                   throws 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.

Description

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

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

addSegments

void addSegments(int count,
                 ISegment newSegments)
                 throws 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.

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.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

addSegmentCollection

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

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.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

insertSegments

void insertSegments(int index,
                    int count,
                    ISegment newSegments)
                    throws 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.

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.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

insertSegmentCollection

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

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.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

insertSegmentCollectionEx

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

Product Availability

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

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:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

replaceSegments

void replaceSegments(int index,
                     int comingIn,
                     int goingAway,
                     ISegment newSegments)
                     throws 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.

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.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

replaceSegmentCollection

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

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).

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

removeSegments

void removeSegments(int index,
                    int count,
                    boolean closeGap)
                    throws 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.

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.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

setCircle

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

Description

Sets a SegmentCollection equal to a single segment CircularArc. The CircularArc is a complete circle centered at the input point with a given input Radius. After SetCircle is called, the SegmentCollection contains only the CiruclarArc (regardless of what it may have contained previously). The To and From Points at located at the top (Pi/2 Radians) of the circle.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Parameters:
cp - A reference to a com.esri.arcgis.geometry.IPoint (in)
circleRadius - The circleRadius (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.
See Also:
IConstructCircularArc.constructCircle(com.esri.arcgis.geometry.IPoint, double, boolean), ISegmentCollection.setCircle(com.esri.arcgis.geometry.IPoint, double)

setRectangle

void setRectangle(IEnvelope inEnvelope)
                  throws 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.

Description

Sets the contents of the SegmentCollection equal to four Line segments that form the sides of the input Envelope. The Segments begin with the LowerLeft point and proceed clockwise (the first side is the left side). After SetRectangle is called, the SegmentCollection contains only the 4 Line segments (regardless of what it may have contained previously). The spatial reference of the envelope is transferred to the SegmentCollection.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

setSegments

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

Replaces all segments with references to the input segments. This method is intended for internal use only.

Description

Sets the contents of the Segment Collection equal to the first Count segments from the input array of Segments. After SetSegments is called, the Segment Collection contains only count segments from the input Segment array (regardless of what it may have contained previously).

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

setSegmentCollection

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

Description

Sets the contents of the Segment Collection equal to the contents of the input Segment Collection. After SetSegmentCollection is called, the Segment Collection contains only the segments from the input Segment Collection (regardless of what it may have contained previously).

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

getEnumSegments

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

Description

Returns an IEnumSegment enumerator for the current SegmentCollection.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

getEnumCurve

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

Description

Returns an IEnumCurve enumerator for the current SegmentCollection.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

hasNonLinearSegments

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

Description

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

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

getIndexedEnumSegments

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

Product Availability

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

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

segmentsChanged

void segmentsChanged()
                     throws 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.

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.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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