- All Implemented Interfaces:
Iterable<Part>
,Collection<Part>
,List<Part>
,SequencedCollection<Part>
Multipart
geometry from a MultipartBuilder
.
Parts
can be added to, inserted into, and removed from PartCollections in order to define or change
the complete shape of a Multipart (for example a Polygon or Polyline).
The SpatialReference of any Parts added to a PartCollection must match that of the PartCollection, or be null (in which case the geometries in that Part are assumed to have the same SpatialReference as the PartCollection).
- Since:
- 100.0.0
- See Also:
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount
-
Constructor Summary
ConstructorDescriptionPartCollection
(ImmutablePart part) Creates a new PartCollection with one Part, and copies the geometries from the given ImmutablePart into the Part.Creates a new PartCollection and copies the ImmutableParts in the given ImmutablePartCollection into new Parts in the new PartCollection.PartCollection
(ImmutablePartCollection parts, SpatialReference spatialReference) Creates a new PartCollection with the given SpatialReference, and copies the ImmutableParts in the given ImmutablePartCollection into new Parts in the new PartCollection.PartCollection
(ImmutablePart part, SpatialReference spatialReference) Creates a new PartCollection with one Part and with the given SpatialReference, and copies the geometries from the given ImmutablePart into the Part.PartCollection
(ImmutablePointCollection partAsPoints) Creates a new PartCollection with one Part, and copies the geometries from the given ImmutablePointCollection into the Part.PartCollection
(ImmutablePointCollection partAsPoints, SpatialReference spatialReference) Creates a new PartCollection with one Part and the given SpatialReference, and copies the geometries from the given ImmutablePointCollection into the Part.PartCollection
(Part part) Creates a new PartCollection and adds the given Part to the collection.PartCollection
(PartCollection parts) Creates a new PartCollection containing the Parts in the given PartCollection.PartCollection
(PartCollection parts, SpatialReference spatialReference) Creates a new PartCollection with the given SpatialReference, containing the Parts in the given PartCollection.PartCollection
(Part part, SpatialReference spatialReference) Creates a new PartCollection with the given SpatialReference, and adds the given Part to the collection.PartCollection
(PointCollection partAsPoints) Creates a new PartCollection with one Part, and copies the Points from the given PointCollection into the Part.PartCollection
(PointCollection partAsPoints, SpatialReference spatialReference) Creates a new PartCollection with one Part and with the given SpatialReference, and copies the Points from the given PointCollection into the Part.PartCollection
(SpatialReference spatialReference) Creates a new empty PartCollection with the given SpatialReference. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Inserts the given Part at the given index position in this PartCollection.void
add
(int index, PointCollection pointCollection) Inserts a new Part at the given index position in this PartCollection, and copies each Point from the given PointCollection into the added Part.boolean
Appends the given Part to the end of this PartCollection.boolean
add
(PointCollection pointCollection) Appends a new Part to the end of the PartCollection, and copies each Point from the given PointCollection into the added Part.void
clear()
Removes all Parts from the PartCollection.get
(int index) Gets the Part at the given index position in this PartCollection.Returns a copy of an iterable containing all the Points in all of the parts of this PartCollection, ordered continuously from the first to last part in this collection.Gets the SpatialReference of the geometries in this PartCollection.int
boolean
isEmpty()
remove
(int index) Removes the Part at the specified index position from this PartCollection.Replaces the Part at the given index position with the given Part.int
size()
Returns the number of Parts in this PartCollection.Methods inherited from class java.util.AbstractList
addAll, equals, hashCode, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList
Methods inherited from class java.util.AbstractCollection
addAll, contains, 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, contains, containsAll, getFirst, getLast, remove, removeAll, removeFirst, removeLast, replaceAll, retainAll, reversed, sort, spliterator, toArray, toArray
-
Constructor Details
-
PartCollection
Creates a new empty PartCollection with the given SpatialReference. SpatialReference cannot be changed after instantiation.Parts can be instantiated directly, or by using the
MultipartBuilder.addPart()
method or one of its overloads.- Parameters:
spatialReference
- the SpatialReference of the new PartCollection. May be null.- Since:
- 100.0.0
-
PartCollection
Creates a new PartCollection and adds the given Part to the collection. The SpatialReference of the new PartCollection will match that of the given Part, and cannot be changed after instantiation.- Parameters:
part
- the Part to add to the new PartCollection- Throws:
NullPointerException
- ifpart
is null- Since:
- 100.0.0
-
PartCollection
Creates a new PartCollection with the given SpatialReference, and adds the given Part to the collection. The SpatialReference cannot be changed after instantiation.This overload can be used to create a PartCollection with a specific SpatialReference from a Part that has a null SpatialReference (the points are assigned the given SpatialReference-they are not projected).
- Parameters:
part
- the part to add to the new PartCollectionspatialReference
- the SpatialReference of the new PartCollection. May be null.- Throws:
ArcGISRuntimeException
- if the SpatialReference ofpart
does not match the match thespatialReference
argument.NullPointerException
- ifpart
is null- Since:
- 100.0.0
-
PartCollection
Creates a new PartCollection with one Part, and copies the geometries from the given ImmutablePart into the Part. The SpatialReference of the new PartCollection will match that of the given ImmutablePart, and cannot be changed after instantiation.- Parameters:
part
- the ImmutablePart used to populate the Part in the new PartCollection- Since:
- 100.0.0
-
PartCollection
Creates a new PartCollection with one Part and with the given SpatialReference, and copies the geometries from the given ImmutablePart into the Part. The SpatialReference cannot be changed after instantiation.This overload can be used to create a PartCollection with a specific SpatialReference by using an ImmutablePart from an existing Multipart geometry that has a null SpatialReference, in which case the input geometries are simply assigned the given SpatialReference.
- Parameters:
part
- the ImmutablePart used to populate the Part in the new PartCollectionspatialReference
- the SpatialReference of the new PartCollection. May be null.- Since:
- 100.0.0
-
PartCollection
Creates a new PartCollection with one Part, and copies the Points from the given PointCollection into the Part. The SpatialReference of the new PartCollection will match that of the given PointCollection, and cannot be changed after instantiation.- Parameters:
partAsPoints
- the PointCollection used to populate the Part in the new PartCollection- Since:
- 100.0.0
-
PartCollection
Creates a new PartCollection with one Part and with the given SpatialReference, and copies the Points from the given PointCollection into the Part. The SpatialReference of the new PartCollection cannot be changed after instantiation.This overload can be used to create a PartCollection with a specific SpatialReference from a PointCollection that has a null SpatialReference, in which case the input geometries are simply assigned the given SpatialReference.
- Parameters:
partAsPoints
- the PointCollection used to populate the Part in the new PartCollectionspatialReference
- the SpatialReference of the new PartCollection. May be null.- Since:
- 100.0.0
-
PartCollection
Creates a new PartCollection with one Part, and copies the geometries from the given ImmutablePointCollection into the Part. The SpatialReference of the new PartCollection will match that of the given ImmutablePointCollection, and cannot be changed after instantiation.- Parameters:
partAsPoints
- the ImmutablePointCollection used to populate the Part in the new PartCollection- Since:
- 100.0.0
-
PartCollection
Creates a new PartCollection with one Part and the given SpatialReference, and copies the geometries from the given ImmutablePointCollection into the Part. The SpatialReference of the new PartCollection cannot be changed after instantiation.This overload can be used to create a PartCollection with a specific SpatialReference from an ImmutablePointCollection that has a null SpatialReference, in which case the input geometries are simply assigned the given SpatialReference.
- Parameters:
partAsPoints
- the ImmutablePointCollection used to populate the Part in the new PartCollectionspatialReference
- the SpatialReference of the new PartCollection. May be null.- Since:
- 100.0.0
-
PartCollection
Creates a new PartCollection containing the Parts in the given PartCollection. The SpatialReference of the new PartCollection will match that of the given PartCollection, and cannot be changed after instantiation.- Parameters:
parts
- the collection of Parts to add to the new PartCollection- Throws:
NullPointerException
- ifparts
is null- Since:
- 100.0.0
-
PartCollection
Creates a new PartCollection with the given SpatialReference, containing the Parts in the given PartCollection. This overload can be used to create a PartCollection with a specific SpatialReference from a PartCollection that has a null SpatialReference, in which case the input geometries are simply assigned the given SpatialReference.- Parameters:
parts
- the collection of Parts to add to the new PartCollectionspatialReference
- the SpatialReference of the new PartCollection. May be null.- Throws:
NullPointerException
- ifparts
is null- Since:
- 100.0.0
-
PartCollection
Creates a new PartCollection and copies the ImmutableParts in the given ImmutablePartCollection into new Parts in the new PartCollection. The SpatialReference of the new PartCollection will match that of the given ImmutablePartCollection, and cannot be changed after instantiation.- Parameters:
parts
- the collection of ImmutableParts used to populate new Parts in the new PartCollection- Since:
- 100.0.0
-
PartCollection
Creates a new PartCollection with the given SpatialReference, and copies the ImmutableParts in the given ImmutablePartCollection into new Parts in the new PartCollection.This overload can be used to create a PartCollection with a specific SpatialReference from an ImmutablePartCollection that has a null SpatialReference, in which case the input geometries are simply assigned the given SpatialReference.
- Parameters:
parts
- the collection of ImmutableParts used to populate new Parts in the new PartCollectionspatialReference
- the SpatialReference of the new PartCollection. May be null.- Since:
- 100.0.0
-
-
Method Details
-
getSpatialReference
Gets the SpatialReference of the geometries in this PartCollection. TheSpatialReference
defines how coordinates correspond to locations in the real world. This is set during instantiation and cannot be changed. May be null.- Returns:
- the SpatialReference of the geometries in this PartCollection
- Since:
- 100.0.0
-
get
Gets the Part at the given index position in this PartCollection. Use this to access the individual parts that compose a MultipartBuilders current state. The part is returned by reference, therefore changes made to the part affect the builder.- Specified by:
get
in interfaceList<Part>
- Specified by:
get
in classAbstractList<Part>
- Parameters:
index
- the index of the Part to return- Returns:
- the Part at the given index
- Throws:
IndexOutOfBoundsException
- ifindex
< 0 ||index
>= size()- Since:
- 100.0.0
-
getPartsAsPoints
Returns a copy of an iterable containing all the Points in all of the parts of this PartCollection, ordered continuously from the first to last part in this collection. If the PartCollectionisEmpty()
, this method returns an empty iterable.The points represent the ends of the Segments in all of the Parts in this collection (all the vertices in the shape currently under construction in the MultipartBuilder). Where two adjacent segments share a start and end location (there is no gap between the segments), this is represented by a single Point.
- Returns:
- an iterable set of all the Points in all the parts of this PartCollection
- Since:
- 100.0.0
- See Also:
-
size
public int size()Returns the number of Parts in this PartCollection. Use this to find the maximum index for callingget(int)
.- Specified by:
size
in interfaceCollection<Part>
- Specified by:
size
in interfaceList<Part>
- Specified by:
size
in classAbstractCollection<Part>
- Since:
- 100.0.0
- See Also:
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceCollection<Part>
- Specified by:
isEmpty
in interfaceList<Part>
- Overrides:
isEmpty
in classAbstractCollection<Part>
-
indexOf
-
set
Replaces the Part at the given index position with the given Part. The Part is set by reference-changes made to the added Part are reflected immediately in the PartCollection.Use this method to change a Part of a PartCollection-for example, to replace one ring in a Polygon with a different existing ring.
- Specified by:
set
in interfaceList<Part>
- Overrides:
set
in classAbstractList<Part>
- Parameters:
index
- the index of the Part to replacepart
- the Part to set into the PartCollection- Throws:
IndexOutOfBoundsException
- ifindex
< 0 ||index
>= size()NullPointerException
- ifpart
is nullArcGISRuntimeException
- if thepart
has a SpatialReference that does not match that of this PartCollection. The SpatialReference of thepart
may however be null.- Since:
- 100.0.0
- See Also:
-
add
Appends the given Part to the end of this PartCollection. The Part is added by reference-changes made to the added Part are reflected immediately in the PartCollection.Alternatively, use the
addPart
convenience methods directly on MultipartBuilder.- Specified by:
add
in interfaceCollection<Part>
- Specified by:
add
in interfaceList<Part>
- Overrides:
add
in classAbstractList<Part>
- Parameters:
part
- the Part to add to the PartCollection- Returns:
- always true
- Throws:
NullPointerException
- ifpart
is nullArcGISRuntimeException
- if thepart
has a SpatialReference that does not match that of this PartCollection. The SpatialReference ofpart
may however be null.- Since:
- 100.0.0
- See Also:
-
add
Inserts the given Part at the given index position in this PartCollection. The index positions of all existing Parts at that index or greater increase by one.The Part is added by reference-changes made to the inserted Part are reflected immediately in the PartCollection.
- Specified by:
add
in interfaceList<Part>
- Overrides:
add
in classAbstractList<Part>
- Parameters:
index
- the index position at which to add the Partpart
- the Part to insert into the PartCollection- Throws:
IndexOutOfBoundsException
- ifindex
< 0 ||index
> size()NullPointerException
- ifpart
is null- See Also:
-
add
Appends a new Part to the end of the PartCollection, and copies each Point from the given PointCollection into the added Part.Alternatively, use the
MultipartBuilder.addPart(PointCollection)
convenience method directly on MultipartBuilder.- Parameters:
pointCollection
- the collection of points to copy to the new Part in the PartCollection- Returns:
- true, if successful
- Throws:
NullPointerException
- ifpointCollection
is null- Since:
- 100.0.0
- See Also:
-
add
Inserts a new Part at the given index position in this PartCollection, and copies each Point from the given PointCollection into the added Part. The index positions of all existing Parts at that index or greater increase by one.- Parameters:
index
- the index position at which to insert the new PartpointCollection
- the collection of points to copy to the new Part in the PartCollection- Throws:
IndexOutOfBoundsException
- ifindex
< 0 ||index
> size()NullPointerException
- ifpointCollection
is null- Since:
- 100.0.0
-
remove
Removes the Part at the specified index position from this PartCollection.Note if calling this method on a PartCollection from a Polygon, removing a part from a PolygonBuilder can affect which parts represent outer rings and which represent inner rings.
- Specified by:
remove
in interfaceList<Part>
- Overrides:
remove
in classAbstractList<Part>
- Parameters:
index
- the index of the Part to remove- Returns:
- the removed Part
- Throws:
IndexOutOfBoundsException
- ifindex
< 0 ||index
>= size()- Since:
- 100.0.0
- See Also:
-
clear
public void clear()Removes all Parts from the PartCollection. Using this method is more efficient than removing all Parts individually. The state of the removed Parts is not affected.- Specified by:
clear
in interfaceCollection<Part>
- Specified by:
clear
in interfaceList<Part>
- Overrides:
clear
in classAbstractList<Part>
- Since:
- 100.0.0
-