Now CalloutPopupWindow is deprecated, what is the alternative?

4514
8
05-20-2015 02:17 AM
RobertBares
New Contributor III

As unanswered in Various issues while attempting to show custom metadata on map / hook gestures in ArcGIS Runtime SDK...

CalloutPopupWindow is deprecated, but was the only means of adding multiple callouts simultaneously. What is the recommended means of achieving this functionality?

More generally, how should developers display custom metadata on offline maps at runtime for multiple features simultaneously? TextSymbol is not appropriate as readability is dependent on the map colour beneath it.

The current solution is a composite symbol including a polygon projected from screen to map coordinates which is unnecessarily costly. Furthermore this requires some unpleasant calculations to estimate font height. There must be a better approach available in the existing API.

Tags (2)
0 Kudos
8 Replies
WillCrick
Occasional Contributor

Hi Robert,

Could you share more information on what you are trying to achieve please?

You are right in saying that the existing Callout only supports one callout at a time. This satisfies the majority of use cases for using a callout. It looks like you are trying to show information (on a tablet sized screen?) for multiple features at a time. A screen shot or mock up of what you want to achieve (or what you have implemented using the CalloutPopupWindow) would help us understand what you are trying to do, so we can see if this is something we might want to support down the line.

Thanks in advance.

Will

0 Kudos
RobertBares
New Contributor III

You are correct the aim is to display custom metadata on screen for multiple features simultaneously, but needs to work entirely offline. This would predominantly be used for labelling in a way similar to google maps pins (as per the image in Android Google Map: How to Draw pin which have text like (1,2,3,4,5..etc)? - Stack Overflow  but with arbitrary text in the labels rather than just a large single letter). As these labels can be quite small this is not exclusive to large tablet displays.

As described in the previously linked forum post it is not well supported by CalloutPopupWindow or Callout. If labels supported borders, to increase contrast, then this would be a step in the right direction but unfortunately they do not. Currently we have to generate screen coordinates for our border which are then projected back to map coordinates for use with Polygons. Labels are then displayed on-top of the Polygons to ensure readability and point the label to the related location. I suspect this could be done far more efficiently elsewhere in the rendering pipeline, avoiding two unnecessary projection steps per point per polygon.

As a side-note, some of our indicators are associated with lines on the map. The position of these indicators along the associated line is derived from the users current view of the map, to ensure the indicator is shown on-screen when possible. To achieve this we have to hook pan and zoom events, but unfortunately zoom events do not fire reliably. See the originally linked forum post and the associated breakout post: OnZoomListener.postAction does not fire reliably at the end of a series of zoom actions​​.

We currently have a reasonably workable solution but the performance and UX could be improved by changes to the SDK. From a development perspective the barrier to entry for this functionality is high.

Thank you for the response and look forward to hearing from you

0 Kudos
SalihYalcin
New Contributor III

Hello Robert,

If I understand your situation right, I've faced with this problem too. As you mentioned; I've understand that you want to display data on the callout (like pop-up).

I've solved this issue by myself. At the phone side I use callout, and add information button. User see few data when callout opens, when user click the button, full screen information comes to user. At the tablet side when user click the map I displayed a custom dialog to give information users about data.

If I understand you rightly, and if you want to see my solutions, I can share my codes with you.

Thanks.

0 Kudos
RobertBares
New Contributor III

The objective was to display persistent labels for multiple features simultaneously. Anything which involves only showing details for a single feature is not suitable for us. We do already have a solution but are looking for alternative means / future API enhancements to facilitate this. Thanks

0 Kudos
WillCrick
Occasional Contributor

Hi,

I have already responded to another post that i think is related, but you should look at the composite symbol, i think this might do what you need:

CompositeSymbol | ArcGIS Android 10.2.6 API

thanks

Will

0 Kudos
RobertBares
New Contributor III

That would be the original post I linked to here. So if I understand this suggestion correctly you recommend estimating the bounds of the TextSymbol, generating a drawable suitable to these bounds, and then assigning that as a PictureMarkerSymbol underneath the TextSymbol? It that is the case it would be helpful for TextSymbol to provide its bounds directly. I have previously attempted to get TextSymbol bounds from the API but to no avail. Although usable, estimating the bounds from the font size and text does not give accurate results.

0 Kudos
WillCrick
Occasional Contributor

OK, i think i now understand your problem, the text you want for each feature differs greatly in size, so its hard to build a composite symbol for all text values.

There are other options:

If you author your labels (simple labels only, but i believe a background color is possible) in ArcMap or Pro, publish a feature service, then take the features offline in to a GeodatabaseFeatureTable then we support rendering these on the map, the label definition we support is here:

ArcGIS REST API

will.

0 Kudos
RobertBares
New Contributor III

This looks like it could be a viable albeit cumbersome approach for static content. As the majority of our labels are based on dynamic content this would not be sufficient for our use-case. The features do need to be generated and manipulated at runtime as per Callouts. The manipulation necessary is at minimum:

  • Adding one or more labels
  • Removing one or more labels
  • Replacing the text within a label
  • Moving a label to a new location

These labels move a lot, to the extent that the position is also dependent on map centreing and zoom level.

Thanks again

0 Kudos