An event object, describing a change in a LayerList instance.
More...
#include <luciad/layers/LayerList.h>
An event object, describing a change in a LayerList instance.
◆ Type
The type of LayerListEvent.
Enumerator |
---|
Added | When the layer list event is for a layer that is added.
|
Moved | When the layer list event is for a layer that is moved.
|
Removed | When the layer list event is for a layer that is removed.
|
◆ added()
static LayerListEvent luciad::LayerListEvent::added |
( |
std::shared_ptr< Layer > |
layer, |
|
|
size_t |
index |
|
) |
| |
|
static |
Returns a new event that indicates that a layer has been added to the LayerList.
- Parameters
-
layer | the layer that was added, must not be nullptr |
index | the index if the layer in the LayerList |
- Returns
- a new event that indicates that a layer has been added to the LayerList
- Exceptions
-
- Since
- 2021.1
◆ getEventType()
Returns the event type.
Depending on this type, the LayerListEvent::getOldIndex and LayerListEvent::getNewIndex methods return different values:
- Added: getOldIndex returns
std::nullopt
, getNewIndex returns the index at which the layer was added
- Moved: both getOldIndex and getNewIndex return a value
- Removed: getNewIndex returns
std::nullopt
, getOldIndex return the index from which the layer was removed
- Returns
- the event type.
◆ getLayer()
std::shared_ptr< Layer > luciad::LayerListEvent::getLayer |
( |
| ) |
const |
Returns the layer for which a change was made.
- Returns
- the layer for which a change was made.
◆ getNewIndex()
std::optional< size_t > luciad::LayerListEvent::getNewIndex |
( |
| ) |
const |
Returns the new index of the layer, or nothing in case of an LayerListChangeType::Removed event.
- Returns
- the new index of the layer, or nothing in case of an LayerListChangeType::Removed event.
◆ getOldIndex()
std::optional< size_t > luciad::LayerListEvent::getOldIndex |
( |
| ) |
const |
Returns the old index of the layer, or nothing in case of an LayerListChangeType::Added event.
- Returns
- the old index of the layer, or nothing in case of an LayerListChangeType::Added event.
◆ moved()
static LayerListEvent luciad::LayerListEvent::moved |
( |
std::shared_ptr< Layer > |
layer, |
|
|
size_t |
oldIndex, |
|
|
size_t |
newIndex |
|
) |
| |
|
static |
Returns a new event that indicates that a layer has been moved in the LayerList.
- Parameters
-
layer | the layer that was moved, must not be nullptr |
oldIndex | the previous index in the LayerList |
newIndex | the new index in the LayerList |
- Returns
- a new event that indicates that a layer has been moved in the LayerList
- Exceptions
-
- Since
- 2021.1
◆ removed()
static LayerListEvent luciad::LayerListEvent::removed |
( |
std::shared_ptr< Layer > |
layer, |
|
|
size_t |
oldIndex |
|
) |
| |
|
static |
Returns a new event that indicates that a layer has been removed from the LayerList.
- Parameters
-
layer | the layer that was removed, must not be nullptr |
oldIndex | the index of the layer in the LayerList before it was removed |
- Returns
- a new event that indicates that a layer has been removed from the LayerList
- Exceptions
-
- Since
- 2021.1