- All Implemented Interfaces:
Iterable<Point>
,Collection<Point>
,List<Point>
,SequencedCollection<Point>
Multipoint
geometry from a
MultipointBuilder
. Points
can be added to, inserted into, and removed from the collection in
order to define or change the shape of the Multipoint. Also used in geometry constructors and builders.
The SpatialReference of any Points added to a PointCollection must match that of the PointCollection, or be null (in which case the Points are assumed to have the same SpatialReference as the PointCollection).
- Since:
- 100.0.0
- See Also:
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount
-
Constructor Summary
ConstructorDescriptionPointCollection
(Part part) Creates a new PointCollection by copying the points from the given Part.PointCollection
(Part part, SpatialReference spatialReference) Creates a new PointCollection with the given SpatialReference by copying the points from the given Part (the points are assigned the given SpatialReference-they are not projected).PointCollection
(SpatialReference spatialReference) Creates a new empty PointCollection with the given SpatialReference.PointCollection
(Iterable<Point> points) Creates a new PointCollection with the given iterable set of Points.PointCollection
(Iterable<Point> points, SpatialReference spatialReference) Creates a new PointCollection with the given iterable set of Points and SpatialReference. -
Method Summary
Modifier and TypeMethodDescriptionboolean
add
(double x, double y) Creates a new Point with the given x,y coordinates and appends it to the end of this PointCollection.boolean
add
(double x, double y, double z) Creates a new Point with the given x,y coordinates and z value, and appends it to the end of this PointCollection.void
add
(int index, double x, double y) Creates a new Point with the given x,y coordinates and inserts it at the given index of this PointCollection.void
add
(int index, double x, double y, double z) Creates a new Point with the given x,y coordinates and z value, and inserts it at the given index of this PointCollection.void
Inserts the given Point at the given index of this PointCollection.boolean
Appends the given Point to the end of this PointCollection.void
clear()
Removes all Points from the PointCollection.get
(int index) Gets a copy of the Point at the given index in the PointCollection.Gets the SpatialReference of the geometries in this PointCollection.int
boolean
isEmpty()
remove
(int index) Removes the Point at the given index position from the PointCollection.set
(int index, double x, double y) Replaces the Point at the given index position with a new Point that has the given x,y coordinates.Replaces the Point at the given index position with the given Point.int
size()
Returns the number of Points in this PointCollection.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
-
PointCollection
Creates a new empty PointCollection with the given SpatialReference. TheSpatialReference
defines how coordinates correspond to locations in the real world. This is set during instantiation and cannot be changed. May be null.- Parameters:
spatialReference
- the SpatialReference of the Points in this collection- Since:
- 100.0.0
-
PointCollection
Creates a new PointCollection with the given iterable set of Points. The SpatialReference of the new PointCollection will match that of the given points.- Parameters:
points
- the set of Points that this PointCollection will be initialised with. For example, this argument may be an existing PointCollection,ImmutablePointCollection
, or standard generic JavaArrayList
containing Points. If null, an empty PointCollection is created.- Throws:
ArcGISRuntimeException
- ifpoints
contains Points that have differing SpatialReferences set.- Since:
- 100.0.0
-
PointCollection
Creates a new PointCollection with the given iterable set of Points and SpatialReference.Use this constructor to create a new PointCollection with a specific SpatialReference from an existing set of points that have null SpatialReferences (the points are assigned the given SpatialReference-they are not projected). Can also be used where the SpatialReference of some points matches that of the argument, but is null for other points.
- Parameters:
points
- the set of Points that this PointCollection will be initialised with. For example, this argument may be an existing PointCollection,ImmutablePointCollection
, or standard generic JavaArrayList
containing Points. If null, an empty PointCollection is created.spatialReference
- the SpatialReference of the new PointCollection. May be null.- Throws:
ArcGISRuntimeException
- if thepoints
argument contains Points with SpatialReferences that do not match thespatialReference
argument.- Since:
- 100.0.0
-
PointCollection
Creates a new PointCollection by copying the points from the given Part. The SpatialReference of the new PointCollection will match that of the given Part.- Parameters:
part
- the Part containing Points that will be copied into this PointCollection. For example, this argument may be an existing PointCollection,ImmutablePointCollection
, or standard generic JavaArrayList
containing Points. If null, an empty PointCollection is created.- Since:
- 100.0.0
-
PointCollection
Creates a new PointCollection with the given SpatialReference by copying the points from the given Part (the points are assigned the given SpatialReference-they are not projected).- Parameters:
part
- the Part containing Points that will be copied into this PointCollection. For example, this argument may be an existing PointCollection,ImmutablePointCollection
, or standard generic JavaArrayList
containing Points. If null, an empty PointCollection is created.spatialReference
- the SpatialReference of the new PointCollection. May be null.- Throws:
ArcGISRuntimeException
- if thepart
argument has a SpatialReference that does not match thespatialReference
argument.- Since:
- 100.0.0
-
-
Method Details
-
getSpatialReference
Gets the SpatialReference of the geometries in this PointCollection. 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 PointCollection
- Since:
- 100.0.0
-
get
Gets a copy of the Point at the given index in the PointCollection. Usesize()
to determine the maximum possible index.Use the
set(int, Point)
method or its overloads to replace an existing Point with a different Point.- Specified by:
get
in interfaceList<Point>
- Specified by:
get
in classAbstractList<Point>
- Parameters:
index
- the index of the Point to get- Returns:
- a copy of the Point at the given index
- Throws:
IndexOutOfBoundsException
- if index is out of range (index
< 0 ||index
>= size())- Since:
- 100.0.0
-
size
public int size()Returns the number of Points in this PointCollection. Use this to find the maximum index for callingget(int)
.- Specified by:
size
in interfaceCollection<Point>
- Specified by:
size
in interfaceList<Point>
- Specified by:
size
in classAbstractCollection<Point>
- Since:
- 100.0.0
- See Also:
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceCollection<Point>
- Specified by:
isEmpty
in interfaceList<Point>
- Overrides:
isEmpty
in classAbstractCollection<Point>
-
set
Replaces the Point at the given index position with the given Point.Use this method to replace a Point in the collection with a different instance - as Points are immutable, properties of existing Points cannot be changed.
- Specified by:
set
in interfaceList<Point>
- Overrides:
set
in classAbstractList<Point>
- Parameters:
index
- the index of the Point to replacepoint
- the Point to set at the given index- Returns:
- the Point that was replaced
- Throws:
IndexOutOfBoundsException
- ifindex
< 0 ||index
>= size()NullPointerException
- ifpoint
is nullArcGISRuntimeException
- if thepoint
has a SpatialReference that does not match that of this PointCollection. The SpatialReference of thepoint
may however be null.- Since:
- 100.0.0
- See Also:
-
set
Replaces the Point at the given index position with a new Point that has the given x,y coordinates.Use this method to replace a Point in the collection with a different instance - as Points are immutable, properties of existing Points cannot be changed. The
x
andy
parameters should be defined in the SpatialReference of this PointCollection.- Parameters:
index
- the index of the Point to replacex
- the x coordinate of the new Pointy
- the y coordinate of the new Point- Returns:
- the Point that was replaced
- Throws:
IndexOutOfBoundsException
- ifindex
< 0 ||index
>= size()- Since:
- 100.0.0
-
add
Appends the given Point to the end of this PointCollection.- Specified by:
add
in interfaceCollection<Point>
- Specified by:
add
in interfaceList<Point>
- Overrides:
add
in classAbstractList<Point>
- Parameters:
point
- the Point to append to this PointCollection- Returns:
- always true
- Throws:
NullPointerException
- ifpoint
is nullArcGISRuntimeException
- if thepoint
has a SpatialReference that does not match that of this PointCollection. The SpatialReference of thepoint
may however be null.- Since:
- 100.0.0
-
add
public boolean add(double x, double y) Creates a new Point with the given x,y coordinates and appends it to the end of this PointCollection.- Parameters:
x
- the x coordinate of the new Point appended to this PointCollectiony
- the y coordinate of the new Point appended to this PointCollection- Returns:
- always true
- Throws:
NullPointerException
- ifpoint
is nullArcGISRuntimeException
- if thepoint
has a SpatialReference that does not match that of this PointCollection. The SpatialReference of thepoint
may however be null.- Since:
- 100.0.0
-
add
public boolean add(double x, double y, double z) Creates a new Point with the given x,y coordinates and z value, and appends it to the end of this PointCollection.Calling this method on the PointCollection of a MultipointBuilder will set
hasZ
to true, because a z value has been explicitly set.- Parameters:
x
- the x coordinate of the new Point appended to this PointCollectiony
- the y coordinate of the new Point appended to this PointCollectionz
- the z value of the new Point appended to this PointCollection- Returns:
- always true
- Since:
- 100.0.0
-
add
Inserts the given Point at the given index of this PointCollection. The index positions of all subsequent Points increase by one. If the point index is equal to the point count, this method is equivalent to adding a point to the end of the collection.- Specified by:
add
in interfaceList<Point>
- Overrides:
add
in classAbstractList<Point>
- Parameters:
index
- the index of the Point to insert in the Partpoint
- the Point to insert at the given index- Throws:
NullPointerException
- ifpoint
is nullIndexOutOfBoundsException
- ifindex
< 0 ||index
> size()ArcGISRuntimeException
- if thepoint
has a SpatialReference that does not match that of this PointCollection. The SpatialReference of thepoint
may however be null.- Since:
- 100.0.0
-
add
public void add(int index, double x, double y) Creates a new Point with the given x,y coordinates and inserts it at the given index of this PointCollection. The index positions of all subsequent Points increase by one.- Parameters:
index
- the index to insert the point atx
- the x coordinate of the new Point inserted into this PointCollectiony
- the y coordinate of the new Point inserted into this PointCollection- Throws:
IndexOutOfBoundsException
- ifindex
< 0 ||index
> size()- Since:
- 100.0.0
-
add
public void add(int index, double x, double y, double z) Creates a new Point with the given x,y coordinates and z value, and inserts it at the given index of this PointCollection. The index positions of all subsequent Points increase by one.Calling this method on the PointCollection of a MultipointBuilder will set
hasZ
to true, because a z value has been explicitly set.- Parameters:
index
- the index to insert the point atx
- the x coordinate of the new Point inserted into this PointCollectiony
- the y coordinate of the new Point inserted into this PointCollectionz
- the z value of the new Point inserted into this PointCollection- Throws:
IndexOutOfBoundsException
- ifindex
< 0 ||index
>= size()- Since:
- 100.0.0
-
remove
Removes the Point at the given index position from the PointCollection.- Specified by:
remove
in interfaceList<Point>
- Overrides:
remove
in classAbstractList<Point>
- Parameters:
index
- the index of the Point to remove from the Part- Returns:
- a copy of the removed Point
- Throws:
IndexOutOfBoundsException
- ifindex
< 0 ||index
>= size()- Since:
- 100.0.0
-
clear
public void clear()Removes all Points from the PointCollection. Using this method is more efficient than removing all Points individually.- Specified by:
clear
in interfaceCollection<Point>
- Specified by:
clear
in interfaceList<Point>
- Overrides:
clear
in classAbstractList<Point>
- Since:
- 100.0.0
- See Also:
-
indexOf
- Specified by:
indexOf
in interfaceList<Point>
- Overrides:
indexOf
in classAbstractList<Point>
- Throws:
NullPointerException
- if object is null- Since:
- 100.0.0
-