ViewAnnotationManager
public final class ViewAnnotationManager
Manager API to control View Annotations.
View annotations are UIView
instances that are drawn on top of the MapView
and bound to some Geometry
(only Point
is supported for now).
In case some view annotations intersect on the screen Z-index is based on addition order.
View annotations are invariant to map camera transformations however such properties as size, visibility etc could be controlled by the user using update operation.
View annotations are not explicitly bound to any sources however ViewAnnotationOptions.associatedFeatureId
could be
used to bind given view annotation with some Feature
by Feature.identifier
meaning visibility of view annotation will be driven
by visibility of given feature.
-
Add annotation to the map which wraps a supplied
UIView
View dimensions will be taken as width / height from the bounds of the view unless they are not specified explicitly withViewAnnotationOptions.width
andViewAnnotationOptions.height
.Annotation
options
must include Geometry where we want to bind our view annotation.Width and height could be specified explicitly but better idea will be not specifying them as they will be calculated automatically based on view layout.
Throws
Throws:
ViewAnnotationManagerError.geometryFieldMissing
if options did not include geometryMapError
: errors during insertion
Declaration
Swift
public func addAnnotationView(withContent view: UIView, options: ViewAnnotationOptions) throws -> AnnotationView
Parameters
view
UIView
to be wrapped in anAnnotationView
and placed on the mapoptions
view annotation options
-
Remove given
AnnotationView
from the map if it was present.Declaration
Swift
public func remove(_ annotatonView: AnnotationView) throws
Parameters
annotatonView
AnnotationView
to be removed -
Update given
AnnotationView
withViewAnnotationOptions
. Important thing to keep in mind that only properties present inoptions
will be updated, all other will remain the same as specified before.Throws
Throws:
ViewAnnotationManagerError.annotationNotFound
: the supplied view was not foundMapError
: errors during the update of the view (eg. incorrect parameters)
Declaration
Swift
public func update(_ annotatonView: AnnotationView, options: ViewAnnotationOptions) throws
Parameters
annotatonView
AnnotationView
to be updatedoptions
view annotation options with optional fields used for the update
-
Find
AnnotationView
by feature id if it was specified as part ofViewAnnotationOptions.associatedFeatureId
.Declaration
Swift
public func viewAnnotation(forFeatureId identifier: String) -> AnnotationView?
Parameters
identifier
the identifier of the feature which will be used for finding the associated
AnnotationView
Return Value
AnnotationView
if view was found andnil
otherwise. -
Find
ViewAnnotationOptions
of view annotation by feature id if it was specified as part ofViewAnnotationOptions.associatedFeatureId
.Declaration
Swift
public func options(forFeatureId identifier: String) -> ViewAnnotationOptions?
Parameters
identifier
the identifier of the feature which will be used for finding the associated
ViewAnnotationOptions
Return Value
ViewAnnotationOptions
if view was found andnil
otherwise. -
Get current
ViewAnnotationOptions
for givenAnnotationView
.Declaration
Swift
public func options(for view: AnnotationView) -> ViewAnnotationOptions?
Parameters
view
an
AnnotationView
for which the associatedViewAnnotationOptions
is looked upReturn Value
ViewAnnotationOptions
if view was found andnil
otherwise.