Summary
An ArcGISCollection<T> represents a mutable collection of supported ArcGIS objects. It acts as a lightweight proxy to an underlying native collection and creates wrapper objects when elements are accessed.
The collection supports C++ range-based for loops through its begin() and end() functions. It is move-only: copy construction and copy assignment are deleted.
Explicit collection specializations are provided for:
- ArcGISBuildingAttributeFilter
- ArcGISElevationSource
- ArcGISLayer
- ArcGISMeshModification
- ArcGISPolygon
Compatible derived types, such as specific layer types, can be passed to supported collection operations where applicable.
Constructors
explicit ArcGISCollection<T>(void* handle)
Creates an ArcGISCollection<T> that references an existing native collection handle.
Since 1.0.0
Arguments
| Name | Type | Const | Summary |
|---|---|---|---|
handle | void* | No | The native collection handle. |
ArcGISCollection<T>(ArcGISCollection<T>&& other)
Moves the native collection handle from another ArcGISCollection<T>.
The source collection is left in a valid but unspecified state.
Since 1.0.0
Arguments
| Name | Type | Const | Summary |
|---|---|---|---|
other | ArcGISCollection<T>&& | No | The collection to move. |
Properties
| Property | Type | Nullable | Readonly | Summary |
|---|---|---|---|---|
Handle | void* | Yes | No | The native collection handle. |
Size | size_t | No | Yes | The number of elements in the collection. |
Nested classes
| Name | Summary |
|---|---|
ConstIterator | A read-only iterator over the collection. |
Iterator | An iterator over the collection. |
ConstIterator
A read-only iterator returned by the const overloads of Begin and End.
ConstIterator(const ArcGISCollection<T>* collection, size_t offset)
Creates a read-only iterator at the specified offset.
Arguments
| Name | Type | Const | Summary |
|---|---|---|---|
collection | const ArcGIS | Yes | The collection to iterate. |
offset | size_t | No | The initial zero-based offset. |
ConstIterator& operator++()
Advances the iterator to the next element.
bool operator!=(const ConstIterator& rhs) const
Indicates whether two iterators refer to different positions or collections.
const T operator*() const
Returns the element at the current iterator position.
Iterator
An iterator returned by the non-const overloads of Begin and End.
Iterator(ArcGISCollection<T>* collection, size_t offset)
Creates an iterator at the specified offset.
Arguments
| Name | Type | Const | Summary |
|---|---|---|---|
collection | ArcGIS | No | The collection to iterate. |
offset | size_t | No | The initial zero-based offset. |
Iterator& operator++()
Advances the iterator to the next element.
bool operator!=(const Iterator& rhs) const
Indicates whether two iterators refer to different positions or collections.
T operator*()
Returns the element at the current iterator position.
Methods
| Signature | Return Type | Summary |
|---|---|---|
T | Returns the element at the specified index. | |
Begin() | Iterator | Returns an iterator to the first element. |
Begin() const | ConstIterator | Returns a read-only iterator to the first element. |
End() | Iterator | Returns an iterator one position past the last element. |
End() const | ConstIterator | Returns a read-only iterator one position past the last element. |
operator bool() const noexcept | Indicates whether the collection contains a valid native handle. | |
operator=(ArcGISCollection<T>&&) | ArcGISCollection<T>& | Move-assigns another collection to this collection. |
Add(const T&) | Adds an element to the collection. | |
Add(const U&) | Adds a compatible element type to the collection. | |
AddArray(const ArcGISCollection<T>&) | Adds all elements from another collection. | |
T | Returns the element at the specified position. | |
Contains(const T&) | Indicates whether the collection contains the specified element. | |
Contains(const U&) | Indicates whether the collection contains a compatible element type. | |
Equals(const ArcGISCollection<T>&) | Indicates whether this collection is equal to another collection. | |
First() | T | Returns the first element. |
IndexOf(const T&) | Returns the position of the specified element. | |
IndexOf(const U&) | Returns the position of a compatible element type. | |
Inserts an element at the specified position. | ||
Inserts a compatible element type at the specified position. | ||
IsEmpty() | Indicates whether the collection contains no elements. | |
Last() | T | Returns the last element. |
Moves an element from one position to another. | ||
Npos() | Returns the value used to indicate that a position was not found. | |
Removes the element at the specified position. | ||
Removes all elements. |
OperatorSubscript
T operator[](size_t index) const
Returns the element at the specified zero-based index.
Since 1.0.0
Arguments
| Name | Type | Const | Summary |
|---|---|---|---|
index | size_t | No | The zero-based index of the element. |
Returns T
The element at the specified index.
Begin
Iterator begin()
Returns an iterator to the first element in the collection.
Since 1.0.0
Returns Iterator
An iterator to the first element.
ConstIterator begin() const
Returns a read-only iterator to the first element in the collection.
Since 1.0.0
Returns ConstIterator
A read-only iterator to the first element.
End
Iterator end()
Returns an iterator one position past the last element in the collection.
Since 1.0.0
Returns Iterator
An iterator one position past the last element.
ConstIterator end() const
Returns a read-only iterator one position past the last element in the collection.
Since 1.0.0
Returns ConstIterator
A read-only iterator one position past the last element.
OperatorBool
operator bool() const noexcept
Indicates whether the collection contains a valid native handle.
Since 1.0.0
Returns bool
true if the native handle is not null; otherwise, false.
OperatorAssign
ArcGISCollection<T>& operator=(ArcGISCollection<T>&& other) noexcept
Move-assigns another collection to this collection.
Since 1.0.0
Arguments
| Name | Type | Const | Summary |
|---|---|---|---|
other | ArcGISCollection<T>&& | No | The collection to move. |
Returns ArcGISCollection<T>&
A reference to this collection.
Add
size_t Add(const T& value)
Adds an element to the collection.
Since 1.0.0
Arguments
| Name | Type | Const | Summary |
|---|---|---|---|
value | T | Yes | The element to add. |
Returns size_t
The position where the element was added.
template<typename U> size_t Add(const U& value)
Adds a compatible element type to the collection.
Since 1.0.0
Arguments
| Name | Type | Const | Summary |
|---|---|---|---|
value | U | Yes | The compatible element to add. |
Returns size_t
The position where the element was added.
AddArray
size_t AddArray(const ArcGISCollection<T>& vector2)
Adds all elements from another collection to the end of this collection.
Since 1.0.0
Arguments
| Name | Type | Const | Summary |
|---|---|---|---|
vector2 | ArcGISCollection<T> | Yes | The collection containing the elements to add. |
Returns size_t
The position returned after the elements are added.
At
T At(size_t position) const
Returns the element at the specified position.
Since 1.0.0
Arguments
| Name | Type | Const | Summary |
|---|---|---|---|
position | size_t | No | The zero-based position of the element. |
Returns T
The element at the specified position.
Contains
bool Contains(const T& value) const
Indicates whether the collection contains the specified element.
Since 1.0.0
Arguments
| Name | Type | Const | Summary |
|---|---|---|---|
value | T | Yes | The element to find. |
Returns bool
true if the collection contains the element; otherwise, false.
template<typename U> bool Contains(const U& value) const
Indicates whether the collection contains a compatible element type.
Since 1.0.0
Arguments
| Name | Type | Const | Summary |
|---|---|---|---|
value | U | Yes | The compatible element to find. |
Returns bool
true if the collection contains the element; otherwise, false.
Equals
bool Equals(const ArcGISCollection<T>& vector2) const
Indicates whether this collection is equal to another collection.
Since 1.0.0
Arguments
| Name | Type | Const | Summary |
|---|---|---|---|
vector2 | ArcGISCollection<T> | Yes | The collection to compare. |
Returns bool
true if the collections are equal; otherwise, false.
First
T First() const
Returns the first element in the collection.
Since 1.0.0
Returns T
The first element in the collection.
IndexOf
size_t IndexOf(const T& value) const
Returns the position of the specified element.
Since 1.0.0
Arguments
| Name | Type | Const | Summary |
|---|---|---|---|
value | T | Yes | The element to find. |
Returns size_t
The position of the element, or Npos if the element is not found.
template<typename U> size_t IndexOf(const U& value) const
Returns the position of a compatible element type.
Since 1.0.0
Arguments
| Name | Type | Const | Summary |
|---|---|---|---|
value | U | Yes | The compatible element to find. |
Returns size_t
The position of the element, or Npos if the element is not found.
Insert
Inserts an element at the specified position.
Since 1.0.0
Arguments
| Name | Type | Const | Summary |
|---|---|---|---|
position | size_t | No | The zero-based position where the element will be inserted. |
value | T | Yes | The element to insert. |
Returns void
This method does not return a value.
Inserts a compatible element type at the specified position.
Since 1.0.0
Arguments
| Name | Type | Const | Summary |
|---|---|---|---|
position | size_t | No | The zero-based position where the element will be inserted. |
value | U | Yes | The compatible element to insert. |
Returns void
This method does not return a value.
IsEmpty
bool IsEmpty() const
Indicates whether the collection contains no elements.
Since 1.0.0
Returns bool
true if the collection is empty; otherwise, false.
Last
T Last() const
Returns the last element in the collection.
Since 1.0.0
Returns T
The last element in the collection.
Move
Moves an element from one position to another.
Since 1.0.0
Arguments
| Name | Type | Const | Summary |
|---|---|---|---|
old | size_t | No | The current zero-based position of the element. |
new | size_t | No | The new zero-based position of the element. |
Returns void
This method does not return a value.
Npos
static size_t Npos()
Returns the value used to indicate that a position was not found.
Since 1.0.0
Returns size_t
The value representing an invalid or unavailable position.
Remove
Removes the element at the specified position.
Since 1.0.0
Arguments
| Name | Type | Const | Summary |
|---|---|---|---|
position | size_t | No | The zero-based position of the element to remove. |
Returns void
This method does not return a value.
RemoveAll
void RemoveAll()
Removes all elements from the collection.
Since 1.0.0
Returns void
This method does not return a value.
Examples
The collection can be iterated using a C++ range-based for loop.
Esri::Unreal::ArcGISCollection<Esri::GameEngine::Layers::Base::ArcGISLayer> layers;
layers.Add(imageLayer);
for (auto layer : layers)
{
// Use the layer.
}