Skip To Content ArcGIS for Developers Sign In Dashboard

Managing the visibility of message labels

You can manage the way that military messages are displayed by:

  • Controlling the visibility of the message labels
  • Setting the maximum and minimum scale threshold of when the labels are displayed
You control these properties using the dictionary renderer of the graphiclayer that the message has been added to. To do this you need to know:
  • Which graphics layer has been created to display the message
  • How to use the dictionary renderer to change the display parameters

Which graphics layers are created by the message processor

When the message processor processes a message it creates a graphics layer and places it into the group layer used by the message processor. The name of the graphics layer is determined by the layerName attribute in the associated message type json files that can be found in this location; ${HOME}/Library/SDKs/ArcGIS/iOS/ArcGIS.framework/Versions/Current/Resources/Symbols/xxx/messagetypes folder (where xxx is the message standard, for example, mil2525c). For example, if the message has a layerName of position_report then one of the following graphics layers will be created depending on whether the message requires a point, line or area type symbol, respectively.

  • positon_report
  • position_report_Lines
  • position_report_Areas

The message processor adds the message graphic to the appropriate graphics layer. For example, a linear position_report message will add a graphic to the graphicslayer called position_report_Lines. If subsequent linear position_report messages are processed then they are just added to this graphics layer.

The current standards support 3 types of message and so you will find 3 associated JSON files in the MessageTypes folder.

  • Chemlight.json
  • SpotReport.json
  • PositionReport.json

Note: that the creation of the graphics layer and message graphics are handled automatically by the message processor.

Manage the graphic layer using the dictionary renderer

You can control how military symbols are displayed using the graphic layer's dictionary renderer. The following code shows you how to iterate through the graphics layers and make all military labels invisible.

var layer:AGSLayer!
var graphicsLayer:AGSGraphicsLayer!
var dictionaryRenderer:AGSMPDictionaryRenderer!
for var i = 1; i < groupLayer.layers.count; i++ {
 layer = groupLayer.layers[i] as AGSLayer
 graphicsLayer = layer as AGSGraphicsLayer
 dictionaryRenderer = graphicsLayer.renderer as AGSMPDictionaryRenderer
 dictionaryRenderer.labelsVisible = true

If you want to set a maximum and minimum scale threshold for your labels then set the labelMaxScale and labelMinScale properties on the AGSMPDictionaryRenderer.

dictionaryRenderer.labelMaxScale = 100000
dictionaryRenderer.labelMinScale = 1000000