ArcGIS Runtime SDK for iOS
100.15
|
A layer that can visualize annotation text data. Annotation can be used to symbolize text on your maps as described in the Annotation ArcGIS Pro documentation. Annotation is defined by a text string, geographical location, and display properties including font, size, and color. These are stored together in an annotation feature class within a geodatabase.
There are two kinds of annotation:
AGSMapView
. If the feature-linked annotation is stored in an Enterprise server, its feature and annotation tables must contain global object ids.You can construct an annotation layer in the following ways:
AGSServiceFeatureTable
that has a feature layer service type of AGSArcGISFeatureLayerInfoServiceType::annotationLayer
. AGSGeodatabaseFeatureTable
returned by the AGSGeodatabase::geodatabaseAnnotationTables
array when a AGSGenerateGeodatabaseJob
has completed.Annotation layers can be taken offline from a feature service hosted on ArcGIS Enterprise 10.7.1 or later, using the AGSGeodatabaseSyncTask
. Annotation layers are also supported in mobile map packages created in ArcGIS Pro 2.3 or later.
Annotation respects the reference scale defined by the map, so annotation will always be presented to the user at the correct size and position, as defined by the annotation author.
Each annotation layer is partitioned into annotation sublayers. Each annotation sublayer corresponds to the label class of the original labels that were used to publish the annotation. In ArcGIS Pro, the annotation sublayers are known as annotation classes.
Annotation sublayers offer greater control over the annotation:
AGSLayer
, Sample: Display annotation, Sample: Control annotation sublayer visibility Instance Methods | |
(void) | - cancelLoad |
(void) | - clearSelection |
(void) | - doCancelLoading |
(void) | - doStartLoading: |
(id< AGSCancelable >) | - fetchLegendInfosWithCompletion: |
(instancetype) | - initWithFeatureTable: |
(instancetype) | - initWithItem:serviceLayerID: |
(instancetype) | - initWithURL: |
(BOOL) | - isEqualToLayer: |
(BOOL) | - isVisibleAtScale: |
(void) | - loadDidFinishWithError: |
(void) | - loadWithCompletion: |
(void) | - onLoadStatusChanged |
(void) | - resetFeaturesVisible |
(void) | - retryLoadWithCompletion: |
(id< AGSCancelable >) | - selectedFeaturesWithCompletion: |
(void) | - selectFeature: |
(void) | - selectFeatures: |
(id< AGSCancelable >) | - selectFeaturesWithParameters:mode:completion: |
(void) | - setFeature:visible: |
(void) | - setFeatures:visible: |
(void) | - unselectFeature: |
(void) | - unselectFeatures: |
Class Methods | |
(instancetype) | + annotationLayerWithFeatureTable: |
(instancetype) | + annotationLayerWithItem:serviceLayerID: |
(instancetype) | + annotationLayerWithURL: |
Properties | |
NSString * | attribution |
AGSLabelBarrierWeight | barrierWeight |
BOOL | canChangeVisibility |
AGSCredential * | credential |
NSString * | definitionExpression |
AGSArcGISFeatureTable * | featureTable |
AGSEnvelope * | fullExtent |
BOOL | identifyEnabled |
AGSItem * | item |
NSString * | layerDescription |
NSString * | layerID |
NSError * | loadError |
AGSLoadStatus | loadStatus |
double | maxScale |
double | minScale |
NSString * | name |
float | opacity |
double | referenceScale |
AGSRequestConfiguration * | requestConfiguration |
NSInteger | serviceLayerID |
BOOL | showInLegend |
AGSSpatialReference * | spatialReference |
NSArray< id< AGSLayerContent > > * | subLayerContents |
void(^ | subLayerContentsChangedHandler )(void) |
NSURL * | URL |
BOOL | visible |
+ (instancetype) annotationLayerWithFeatureTable: | (AGSArcGISFeatureTable *) | featureTable |
Creates an annotation layer from a feature table containing annotation features. If the feature table does not contain annotation data then the AGSAnnotationLayer
will fail to load. AGSArcGISFeatureTable::layerInfo
and AGSArcGISFeatureLayerInfo::serviceType
can be checked, to verify the feature type, before attempting to create an AGSLayer
.
featureTable | The feature table, containing annotation features, used as the source of the annotation layer. |
AGSArcGISFeatureTable
+ (instancetype) annotationLayerWithItem: | (AGSItem *) | item | |
serviceLayerID: | (NSInteger) | serviceLayerID | |
Creates a new annotation layer from a feature service portal item.
item | A feature service AGSPortalItem . |
serviceLayerID | The ID of the layer in the service for which to create the annotation layer. |
AGSLayer::item
+ (instancetype) annotationLayerWithURL: | (NSURL *) | URL |
Creates a new annotation layer from a feature service URL. If the specified URL is not a valid Feature Service endpoint, then it will fail to load.
URL | The URL to the feature service layer. |
|
requiredinherited |
Cancels loading if it is in progress, otherwise it does nothing. This should be called carefully because other objects could be waiting for loadWithCompletion:
or retryLoadWithCompletion:
to complete and this will call them all back with the error of NSUserCancelledError
- (void) clearSelection |
Updates any selected features in the layer back to the un-selected state.
- (void) doCancelLoading |
Never call this method directly. The framework calls this method on a background thread when cancelLoad (AGSLoadable-p)
is called. It is meant to be overriden by subclasses. Subclasses should override this method to cancel loading their data and call loadDidFinishWithError: (AGSLoadableBase(ForSubclassEyesOnly))
at the end passing in an error representing NSUserCancelledError
.
Provided by category AGSLoadableBase(ForSubclassEyesOnly).
- (void) doStartLoading: | (BOOL) | retrying |
Never call this method directly. The framework calls this method on a background thread when loadWithCompletion: (AGSLoadable-p)
or retryLoadWithCompletion: (AGSLoadable-p)
is called. It is meant to be overriden by subclasses. Subclasses should override this method to load their data and call loadDidFinishWithError: (AGSLoadableBase(ForSubclassEyesOnly))
upon completion, passing in the error if any.
retrying | flag that is true if this method was called from retryLoadWithCompletion: (AGSLoadable-p) . |
Provided by category AGSLoadableBase(ForSubclassEyesOnly).
- (id<AGSCancelable>) fetchLegendInfosWithCompletion: | (void(^)(NSArray< AGSLegendInfo * > *__nullable legendInfos, NSError *__nullable error)) | completion |
Fetches the array of legend infos (AGSLegendInfo
) for this layer.
- (instancetype) initWithFeatureTable: | (AGSArcGISFeatureTable *) | featureTable |
Creates an annotation layer from a feature table containing annotation features. If the feature table does not contain annotation data then the AGSAnnotationLayer
will fail to load. AGSArcGISFeatureTable::layerInfo
and AGSArcGISFeatureLayerInfo::serviceType
can be checked, to verify the feature type, before attempting to create an AGSLayer
.
featureTable | The feature table, containing annotation features, used as the source of the annotation layer. |
AGSArcGISFeatureTable
- (instancetype) initWithItem: | (AGSItem *) | item | |
serviceLayerID: | (NSInteger) | serviceLayerID | |
Creates a new annotation layer from a feature service portal item.
item | A feature service AGSPortalItem . |
serviceLayerID | The ID of the layer in the service for which to create the annotation layer. |
AGSLayer::item
- (instancetype) initWithURL: | (NSURL *) | URL |
Creates a new annotation layer from a feature service URL. If the specified URL is not a valid Feature Service endpoint, then it will fail to load.
URL | The URL to the feature service layer. |
- (BOOL) isEqualToLayer: | (AGSLayer *) | other |
- (BOOL) isVisibleAtScale: | (double) | scale |
Check whether this layer is visible at a given scale.
- (void) loadDidFinishWithError: | (nullable NSError *) | error |
Only subclasses should call this method in doStartLoading: (AGSLoadableBase(ForSubclassEyesOnly))
and doCancelLoading (AGSLoadableBase(ForSubclassEyesOnly))
when done loading or failed to load.
Provided by category AGSLoadableBase(ForSubclassEyesOnly).
|
requiredinherited |
Loads data for the object asynchronously. The completion block is invoked upon completion.
You can call this method any number of times, however only one attempt is made to load the data. If it is already loading, it will just continue to load (i.e. not force a reload). If it has already loaded successfully, the completion block will be invoked right away. If it has already failed to load, the completion block will be invoked right away with error previously encountered. This method supports multiple callers and will call them all back on completion. However, each caller's completion block will be invoked once and only once.
completion | block that is invoked when object loads successfully or fails to load. An error is passed to the block if the object fails to load. |
- cancelLoad
to cancel loading - retryLoadWithCompletion:
to force reload - (void) onLoadStatusChanged |
Never call this method directly. The framework calls this method on a background thread when AGSLoadable::loadStatus
changes is called. Subclasses can optionally implement this to know when their loading status has changed.
Provided by category AGSLoadableBase(ForSubclassEyesOnly).
- (void) resetFeaturesVisible |
Resets the visibility of the layer's features back to the original visibility when loaded from the data source.
|
requiredinherited |
Tries to reload when an object has failed to load. This method should be called judiciously. It should be called when:
cancelLoad
and then this methodIf the data hasn't started loading, it will start loading. If it is already loading, it will just continue to load. If it has already loaded successfully, calls back right away. If it has already failed to load, tries again. This method supports multiple callers and will call them all back on completion. However, each caller's completion block will be invoked once and only once.
completion | block that is invoked when object loads successfully or fails to load. An error is passed to the block if the object fails to load. |
- (id<AGSCancelable>) selectedFeaturesWithCompletion: | (void(^)(AGSFeatureQueryResult *__nullable result, NSError *__nullable error)) | completion |
Finds a list of the currently selected features.
completion | A block that is invoked when the operation finishes. The result parameter is populated if the operation completed successfully, otherwise the error parameter is populated. |
- (void) selectFeature: | (AGSFeature *) | feature |
Selects the given feature and adds it to the current list of selected features.
feature | The feature. |
- (void) selectFeatures: | (NSArray< AGSFeature * > *) | features |
Selects the features in the list and adds them to the current list of selected features.
features | An NSArray of type AGSFeature . Contents of the NSArray are copied. |
- (id<AGSCancelable>) selectFeaturesWithParameters: | (AGSQueryParameters *) | parameters | |
mode: | (AGSSelectionMode) | mode | |
completion: | (void(^)(AGSFeatureQueryResult *__nullable result, NSError *__nullable error)) | completion | |
Selects the features that match the criteria in the AGSQueryParameters
object and adds them to the current list of selected features.
parameters | The definition of the query to submit to the feature table. |
mode | The mode that defines how the list of currently selected features will be updated with the features returned from the query. |
completion | A block that is invoked when the operation finishes. The result parameter is populated if the operation completed successfully, otherwise the error parameter is populated. |
- (void) setFeature: | (AGSFeature *) | feature | |
visible: | (BOOL) | visible | |
Sets the visibility of the given feature.
feature | The feature. |
visible | YES to show, NO to hide. |
- (void) setFeatures: | (NSArray< AGSFeature * > *) | features | |
visible: | (BOOL) | visible | |
Sets the visibility of the given features.
features | An NSArray of type AGSFeature . Contents of the NSArray are copied. |
visible | YES to show, NO to hide. |
- (void) unselectFeature: | (AGSFeature *) | feature |
Unselects the given feature and removes it from the current list of selected features.
feature | The feature. |
- (void) unselectFeatures: | (NSArray< AGSFeature * > *) | features |
Unselects the features in the given list and removes them from the current list of selected features.
features | An NSArray of type AGSFeature . Contents of the NSArray are copied. |
|
readnonatomiccopyinherited |
Attribution information of the layer.
|
readwritenonatomicassign |
The weight of annotation features when considered as barriers to labeling. The default is AGSLabelBarrierWeightHigh
.
|
readrequirednonatomicassigninherited |
Denotes whether the layer can change visibility or not.
|
readwritenonatomicstronginherited |
Security credentials to access the remote resource. Only applicable if the resource is secured.
|
readwritenonatomiccopy |
An expression which is a SQL statement where clause to specify the subset of features to be displayed.
The definition expression string uses the SQL-92 where clause syntax (https://en.wikipedia.org/wiki/SQL-92). The default value is an empty string, which will allow all annotation features in the data source to be used by the AGSAnnotationLayer
.
|
readnonatomicstrong |
The feature table associated with this layer.
|
readnonatomicstronginherited |
Full extent of the layer.
|
readnonatomicassigninherited |
Specifies whether the layer supports identify.
|
readnonatomicstronginherited |
The item the layer has been created from.
|
readwritenonatomiccopyinherited |
The layer's description.
|
readwritenonatomiccopyinherited |
The layer's ID specified in the web map item of ArcGIS Online or an on-premises portal.
|
readnonatomicstronginherited |
The error that was encountered during the most recent load operation. Will be nil if the operation succeeded.
|
readrequirednonatomicassigninherited |
Status of the load operation.
|
readwritenonatomicassigninherited |
The maximum scale at which this layer is visible. If the map or scene is zoomed in beyond this scale, the layer will not be visible. A value of 0
means there is no maximum scale threshold and the layer will be visible at the smallest scale available for the map or scene.
|
readwritenonatomicassigninherited |
The minimum scale at which this layer is visible. If the map or scene is zoomed out. beyond this scale, the layer will not be visible. A value of 0
means there is no minimum scale threshold and the layer will be visible at the largest scale available for the map or scene.
|
readwritenonatomiccopyinherited |
The name of the layer.
|
readwritenonatomicassigninherited |
The opacity of this layer as a value between 0 (fully transparent) and 1 (fully opaque). Default value is 1.
|
readnonatomicassign |
The reference scale for the layer. The reference scale of the layer is the scale at which a client should view the layer for the text to appear at its authored size.
If the client changes the viewing scale, then text will grow or shrink to keep a consistent size on the map (not the screen).
For a valid layer, the reference scale will always be a finite value, greater than zero. Until the layer is loaded, the reference scale will be zero.
|
readwritenonatomicstronginherited |
The AGSRequestConfiguration object which defines the behavior and policies to use when accessing the remote resource. The default will be nil. If it is nil the [AGSRequestConfiguration globalConfiguration] will be used.
|
readnonatomicassign |
The layer ID that defines the layer within the feature service portal item.
AGSLayer::item
|
readwritenonatomicassigninherited |
Indicates whether to show legend information.
|
readnonatomicstronginherited |
The spatial reference of the layer.
|
readnonatomiccopyinherited |
This layer's sub-layers.
|
readwritenonatomiccopyinherited |
Block that is invoked when the sub layer contents changes.
|
readrequirednonatomicstronginherited |
The URL of the remote resource.
|
readwritenonatomicassigninherited |
Denotes whether the layer is visible or not. The visibility changes can be monitored using Key-Value Observing (KVO).