- All Implemented Interfaces:
Iterable<Segment>
,Collection<Segment>
,List<Segment>
,SequencedCollection<Segment>
Segments
that define the shape of a part of an immutable
Multipart
geometry - Polygon
or Polyline
. Point-based helper methods also allow working with
the part as a series of Points
.
Use Multipart.getParts()
to return an ImmutablePartCollection
, which can then be used to iterate
through the Segments and Points in each ImmutablePart. Use java.util.AbstractList.iterator()
or getPoints()
to return an
iterator, or use get(int)
or getPoint(int)
to access each specific Segment or Point.
Because geometries themselves are immutable, the collections they are composed of are also immutable. For
geometry editing or creation workflows, a mutable Part
is used instead. Part has constructors that
take an ImmutablePart (among other options), allowing the creation of new geometry parts from existing parts.
For more information about using geometries, see the 'Fundamentals' > 'Geometries' topic in the Guide.
Prior to v100.12, the only supported segment type was LineSegment
. If the
underlying geometry contained curve segments (Geometry.hasCurves()
is true), then the curve information was
lost when iterating through the segments in that part.
From v100.12, curve segments may be returned from get(int)
. A part may contain
a mix of linear and curve segments.
- Since:
- 100.0.0
- See Also:
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount
-
Method Summary
Modifier and TypeMethodDescriptionboolean
get
(int index) Gets theSegment
at the given index position in this ImmutablePart.Gets a Point representing the end of the last Segment of the ImmutablePart.int
getEndPointIndexFromSegmentIndex
(int segmentIndex) Gets the index of the end point of a segment.getPoint
(int index) Gets the Point at the given index in the ImmutablePart.int
Returns the number of Points in the ImmutablePart, representing the number of vertices in the shape.Gets an iterator of Points representing the ends of the Segments in this ImmutablePart (the vertices in the shape).int
getSegmentIndexFromEndPointIndex
(int endPointIndex) Gets the index of the segment that has a given end point.int
getSegmentIndexFromStartPointIndex
(int startPointIndex) Gets the index of the segment that has a given start point.Gets the SpatialReference of the geometries in this ImmutablePart.Gets a Point representing the start of the first Segment of the ImmutablePart.int
getStartPointIndexFromSegmentIndex
(int segmentIndex) Gets the index of the start point of a segment.boolean
Indicates if this ImmutablePart contains Segments that represent true curves.int
boolean
isEmpty()
int
size()
Returns the number ofSegments
in this ImmutablePart.Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, hashCode, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, remove, removeAll, retainAll, toArray, toArray, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.List
addAll, addFirst, addLast, containsAll, getFirst, getLast, remove, removeAll, removeFirst, removeLast, replaceAll, retainAll, reversed, sort, spliterator, toArray, toArray
-
Method Details
-
getSpatialReference
Gets the SpatialReference of the geometries in this ImmutablePart. TheSpatialReference
defines how coordinates correspond to locations in the real world. May be null.- Returns:
- the SpatialReference of the geometries in this ImmutablePart
- Since:
- 100.0.0
-
get
Gets theSegment
at the given index position in this ImmutablePart.To work with the Part as a series of Points, use
getPoint(int)
andgetPointCount()
instead.- Specified by:
get
in interfaceList<Segment>
- Specified by:
get
in classAbstractList<Segment>
- Parameters:
index
- the index of the Segment to return- Returns:
- the Segment at the given index
- Throws:
IndexOutOfBoundsException
- ifindex < 0 || index >= size()
- Since:
- 100.0.0
-
indexOf
-
size
public int size()Returns the number ofSegments
in this ImmutablePart. Use this to find the maximum index for callingget(int)
.An ImmutablePart can also be represented by a set of Points representing each vertex; the getPointCount method returns the number of Points in the ImmutablePart. See
getPointCount()
for an explanation of how the two relate.- Specified by:
size
in interfaceCollection<Segment>
- Specified by:
size
in interfaceList<Segment>
- Specified by:
size
in classAbstractCollection<Segment>
- Since:
- 100.0.0
- See Also:
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceCollection<Segment>
- Specified by:
isEmpty
in interfaceList<Segment>
- Overrides:
isEmpty
in classAbstractCollection<Segment>
-
contains
- Specified by:
contains
in interfaceCollection<Segment>
- Specified by:
contains
in interfaceList<Segment>
- Overrides:
contains
in classAbstractCollection<Segment>
-
getStartPoint
Gets a Point representing the start of the first Segment of the ImmutablePart. This is a shortcut to getting the first Segment in the ImmutablePart, then getting its start point usingSegment.getStartPoint()
, or getting the first Point usinggetPoint(int)
.- Returns:
- a Point representing the start point
- Since:
- 100.0.0
- See Also:
-
getEndPoint
Gets a Point representing the end of the last Segment of the ImmutablePart. This is a shortcut to getting the last Segment in the ImmutablePart, then getting its end point usingSegment.getEndPoint()
, or getting the last Point usinggetPoint(int)
.- Returns:
- a Point representing the end point
- See Also:
-
getPoints
Gets an iterator of Points representing the ends of the Segments in this ImmutablePart (the vertices in the shape).In ImmutableParts, adjacent segments always share a start and end location (there is no gap between the segments), and this is represented by a single Point in this iterator.
- Returns:
- an iterator of Points
- Since:
- 100.0.0
-
getPoint
Gets the Point at the given index in the ImmutablePart. UsegetPointCount()
to determine the maximum possible index.The vertices of a Multipart geometry can be represented as a series of Points, which can be accessed using this method, or by the
getPoints()
iterator. If the geometry containscurves
, this cannot be represented by points; segment-based methods such asget(int)
andjava.util.AbstractList.iterator()
may be more appropriate instead.- Parameters:
index
- the index of the Point to get- Returns:
- the Point at the given index
- Throws:
IndexOutOfBoundsException
- if index is out of range (index
< 0 ||index
>= getPointCount())- Since:
- 100.0.0
-
getPointCount
public int getPointCount()Returns the number of Points in the ImmutablePart, representing the number of vertices in the shape. Use this to find the maximum index for callinggetPoint(int)
.For Polylines, this number is one greater than the number of Segments in this ImmutablePart (
size()
), but for Polygons it equals the number of Segments.Where two adjacent segments share a start and end location (there is no gap between the segments), this is represented by a single Point. Gaps are eliminated when geometries are built using the
GeometryBuilder.toGeometry()
method. Completed Multipart geometries do not have gaps between the segments of a part, but separate ImmutableParts may be disjoint.- Returns:
- the number of Points in the ImmutablePart
- Since:
- 100.0.0
- See Also:
-
hasCurves
public boolean hasCurves()Indicates if this ImmutablePart contains Segments that represent true curves.The ArcGIS system supports polygon and polyline geometries that contain curved segments in some types of data, for example geodatabases, feature services, and JSON. At the current release this SDK can display curved geometries, but you cannot work with curves using the API; any curved segments in a geometry will be represented as
LineSegments
, and the curve information will be lost. In editing workflows, use this method to determine if this ImmutablePart contains curve information which would be lost if used in an editing workflow.Prior to v100.12, if this property returned true, there was no way to access the curve segment information contained by the part. Retrieving the
Segment
instances of the part would return onlyLineSegment
instances.From v100.12, when this property returns true, curve segments may be returned from
get(int)
. A part may contain a mix of linear and curve segments.- Returns:
- true if this ImmutablePart contains curved segments; false otherwise
- Since:
- 100.0.0
-
getSegmentIndexFromStartPointIndex
public int getSegmentIndexFromStartPointIndex(int startPointIndex) Gets the index of the segment that has a given start point.- Parameters:
startPointIndex
- the 0-based index of the start point- Returns:
- the segment index containing the start point. If point is not a start point, then -1 is returned.
- Throws:
IndexOutOfBoundsException
- if startPointIndex is out of bounds- Since:
- 100.1.0
-
getSegmentIndexFromEndPointIndex
public int getSegmentIndexFromEndPointIndex(int endPointIndex) Gets the index of the segment that has a given end point.- Parameters:
endPointIndex
- the 0-based index of the end point- Returns:
- the segment index containing the end point. If the point index is not an end point, then -1 is returned.
- Throws:
IndexOutOfBoundsException
- if endPointIndex is out of bounds- Since:
- 100.1.0
-
getStartPointIndexFromSegmentIndex
public int getStartPointIndexFromSegmentIndex(int segmentIndex) Gets the index of the start point of a segment.- Parameters:
segmentIndex
- the 0-based index of the segment- Returns:
- the index of the start point
- Throws:
IndexOutOfBoundsException
- if segmentIndex is out of bounds- Since:
- 100.1.0
-
getEndPointIndexFromSegmentIndex
public int getEndPointIndexFromSegmentIndex(int segmentIndex) Gets the index of the end point of a segment.- Parameters:
segmentIndex
- the 0-based index of the segment- Returns:
- the index of the end point
- Throws:
IndexOutOfBoundsException
- if segmentIndex is out of bounds- Since:
- 100.1.0
-