A list model storing a list of LegendInfos available for a LayerContent type. More...
Import Statement: | import Esri.ArcGISRuntime 100.15 |
Since: | Esri.ArcGISRuntime 100.0 |
Properties
- count : int
- error : Error
- fetchLegendInfosStatus : Enums.TaskStatus
Signals
Methods
- bool cancelTask(string taskId)
- void clear()
- string fetchLegendInfos(bool recursive)
- error forEach(callback)
- LegendInfo get(int index)
Detailed Description
Note: You cannot declare or create a component of this type in QML code.
By default, legend information will be fetched recursively (from base layer type to sublayer types) and added to the list model. This automatic fetching of legend information can be changed by setting the autoFetchLegendInfos property on LayerConent or Map, whichever was the source for the model. This list model contains roles for accessing particular legend information.
This class is a subclass of QAbstractListModel.
The model returns data for the following roles:
Role | Type | Description |
---|---|---|
name | string | The name of the legend info value. |
symbolUrl | url | A temporary file path to a symbol image contained in the legend info. This temporary file is deleted when the list model is destroyed. |
symbolWidth | real | The width of the symbol image. |
symbolHeight | real | The height of the symbol image. |
layerName | string | The name of the layer that the legend information belongs to. |
layerMinScale | double | The minimum scale of the layer that the legend information belongs to. |
layerMaxScale | double | The maximum scale of the layer that the legend information belongs to. |
See also Cancelable and LegendInfo.
Property Documentation
error : Error |
Returns the Error object (read-only).
Returns the status for the fetchLegendInfos task (read-only).
See also Enums.TaskStatus.
Signal Documentation
Emitted when the count property changes.
Note: The corresponding handler is onCountChanged
.
Emitted when the error property changes, which can indicate that an error occurred.
Note: The corresponding handler is onErrorChanged
.
Emitted when the fetchLegendInfosStatus property changes.
Note: The corresponding handler is onFetchLegendInfosStatusChanged
.
Method Documentation
Cancel the task with the ID taskId.
Returns false
if the task cannot be canceled or there is no task with the specified id taskId.
See also Cancelable.
Fetches legend information from its source layer or map and adds to the list model.
- recursive - Whether legend information is fetched recursively through the source layer and its sublayers. The default is
true
.
If the model's source LayerContent type or Map is configured to automatically fetch legend infos, then this method will be called automatically.
Returns a task ID that can be used to cancel the fetchLegendInfos task.
See also Cancelable.
Receives a callback function to execute for each legend info in the model.
The callback function can take 0 to 3 optional arguments, in order:
- element Current legend info.
- index Current index in array.
- array Reference to LegendInfoListModel.
Returns undefined if no error occurred, and an error message otherwise.
const error = legendInfoListModel.forEach(function(element, index, array) { ... }); if (error) { console.error(error.message); }
LegendInfo get(int index) |
Returns the legend info at the specified index.