Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[ios] Use transparent image for annotations backed by views #5461

Merged
merged 1 commit into from
Jun 24, 2016

Conversation

boundsj
Copy link
Contributor

@boundsj boundsj commented Jun 23, 2016

The current implementation of view backed annotations mostly relies on the existing annotation model manager and the associated underlying boost query implementations for annotation management. However since, in the case of view backed annotations, the representation of the model is a UIView, an image was not installed. Because the underlying annotation management implementation is not entirely comfortable working without an image, it would report [INFO] {Worker}[Sprite]: Can't find sprite named 'default_marker' when annotation models without an image were encountered.

This updates the annotation adding logic to create (or reuse) and install a small, invisible image for each view backed annotation.

This stops the issue noted in #5210 for iOS.

cc @1ec5

@boundsj boundsj added the iOS Mapbox Maps SDK for iOS label Jun 23, 2016
@boundsj boundsj added this to the ios-v3.3.0 milestone Jun 23, 2016
@boundsj boundsj self-assigned this Jun 23, 2016
@boundsj
Copy link
Contributor Author

boundsj commented Jun 23, 2016

@1ec5 although I think this is a workable solution for #5165 I don't think we actually need #5165 for the ios-v3.3.0 milestone since a solution for #5166 landed in #5460.

@1ec5
Copy link
Contributor

1ec5 commented Jun 23, 2016

A bit kludgy, but this is exactly what I had in mind. The benefit of leaving mbgl responsible for these annotation views’ positions is that, in the future, it might be possible for annotation views to collide out labels, for instance. (That would require us to vary the spacer image’s size by the view’s size, but that isn’t necessary just yet.)

although I think this is a workable solution for #5165 I don't think we actually need #5165 for the ios-v3.3.0 milestone since a solution for #5166 landed in #5460.

Does #5165 address any other issues like #5151? If not, then it’s fine to leave that for 3.4.0.


if (!annotationImage)
{
UIGraphicsBeginImageContext(CGSizeMake(1, 1));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this creating an image with width/height 1/1 and using this in core as image for the pointannotation? As far as I can see this is the same hack I'm using on Android: https://github.com/mapbox/mapbox-gl-native/blob/master/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerView.java#L299

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tobrun yes

The current implementation of view backed annotations mostly relies
on the existing annotation model manager and the associated underlying
boost query implementations for annotation management. However, since
the representation of the model is a view, an image was not installed
for view backed annotations. Because the underlying annotation
management implementation is not entire comfortable working without
an image, it would report
`[INFO] {Worker}[Sprite]: Can't find sprite named 'default_marker'`
when annotation models without an image were encountered.

This updates the annotation adding logic in to create (or reuse) and
install a small, invisible image for each view backed annotation.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
iOS Mapbox Maps SDK for iOS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants