Class DictionarySymbolStyle

java.lang.Object
com.esri.arcgisruntime.symbology.SymbolStyle
com.esri.arcgisruntime.symbology.DictionarySymbolStyle
All Implemented Interfaces:
RemoteResource, Loadable

public class DictionarySymbolStyle extends SymbolStyle
Defines a mechanism to obtain unique multi-layer symbol style from a given specification, such as mil2525d. A DictionarySymbolStyle is created either from a style file on disk (a SQLite database with a .stylx extension, created with ArcGIS Pro) or from a dictionary style file hosted on ArcGIS Online or an ArcGIS Enterprise portal (also referred to as a dictionary web style).

A DictionarySymbolStyle must contain a set of symbol primitives for a given symbology specification, as well as a rule engine that parses input fields. The DictionarySymbolStyle assembles new symbols from the input attributes, and can also apply geometry manipulations to the symbols in the case of multipoint geometries. DictionarySymbolStyle is often used to render symbols from a military specification (such as mil2525D or App6B) bit can also be used with a custom style.

A DictionarySymbolStyle can be used in conjunction with a DictionaryRenderer applied to a FeatureLayer or GraphicsOverlay.

Esri builds and maintains some dictionary web styles according to the US and NATO military symbol specifications. These desktop and web styles are hosted online and are publicly available. Refer to the ArcGIS Online Dictionary Symbology Styles group for the latest versions of the styles available.

When used by itself, the DictionarySymbolStyle supports two key workflows. The first is to find a symbol with provided attributes values. This is done by creating a map of field names and attribute values (as determined by the associated specification), and passing those into getSymbolAsync(Map) ), which returns a new Symbol. In this case, the key is the name of the specification field (e.g. "symbolset" in the case of mil2525d), and the value is the value you want associated with that field (e.g "Atmospheric"). You might use this symbol to create a new Graphic.

You can also use a standalone DictionarySymbolStyle to search for symbol primitives. Symbol primitives are the individual symbols that make up more complex and advanced multilayer military symbols. This is achieved using SymbolStyle.searchSymbolsAsync(SymbolStyleSearchParameters). You could create a symbol picker app that searches for all symbols that have the tag "maritime" in it. The search results contain symbols which you could then either use as they are or extract from them different individual symbols to create a new symbol.

Visit the Esri ArcGIS for Defense web site for details about military symbology styles.

Since:
100.0.0
  • Constructor Details

    • DictionarySymbolStyle

      public DictionarySymbolStyle(PortalItem portalItem)
      Creates a new dictionary symbol style object from a portal item. The portal item must contain a dictionary style.

      If you have the item ID of a style file, you can search the portal to find the item using its item ID. Use this constructor if you have a reference to a portal item.

      Parameters:
      portalItem - a PortalItem that contains a dictionary style
      Throws:
      IllegalArgumentException - if portalItem is null
      Since:
      100.10.0
  • Method Details

    • createFromFile

      public static DictionarySymbolStyle createFromFile(String path)
      Creates a new dictionary symbol style instance from the style file at the provided location.

      Only valid for use with the newer format (Arcade-based) style files.

      Parameters:
      path - the path to the symbol style location
      Returns:
      the new dictionary symbol style instance
      Throws:
      ArcGISRuntimeException - if an older format style is encountered.
      Since:
      100.6.0
    • createDictionarySymbolStyleFromUrl

      public static DictionarySymbolStyle createDictionarySymbolStyleFromUrl(String webStyleUrl)
      Creates a new dictionary symbol style using a web style item's URL.
      Parameters:
      webStyleUrl - the URL of the web style item
      Returns:
      a new DictionarySymbolStyle instance
      Throws:
      IllegalArgumentException - if webStyleUrl is empty or null
      Since:
      100.10.0
    • getTextFieldNames

      public List<String> getTextFieldNames()
      Gets the string list of attributes used to obtain text values for display with a symbol from a DictionarySymbolStyle.

      For example, mil2525d would include "combateffectiveness", "credibility", "reliability", and "staffcomment", among many others. The newer Arcade-based styles define such attributes within the .stylx file as a JSON string.

      Returns:
      the string list of attributes used to obtain text values for display with a symbol from a DictionarySymbolStyle.
      Since:
      100.0.0
    • getSymbolAsync

      public ListenableFuture<Symbol> getSymbolAsync(Map<String,Object> attributes)
      Finds a Symbol, as defined by the input attributes.

      This function is useful for obtaining a single, multi-layer symbol from supplied attributes. This is commonly used to create symbols and graphics on-the-fly. For example, with mil2525d, you may want to obtain a symbol where "symbolset" is 40, "modifier1" is "Incident Qualifier : Accident", "echelon" is "Army", and so on. All of these key/value pairs can be used to obtain the specific symbol that you need. Once you have that symbol, you can apply it to a Graphic or Renderer, obtain its swatch image, or serialize to JSON.

      If the DictionarySymbolStyle is not loaded, then calling this method will initiate loading.

      Parameters:
      attributes - attributes required to obtain CIM symbol from the rule engine associated to Dictionary symbol style
      Returns:
      a Future that represents the symbol found based on attributes
      Throws:
      IllegalArgumentException - if attributes is null
      Since:
      100.0.0
    • getSymbologyFieldNames

      public List<String> getSymbologyFieldNames()
      Gets the string list of attributes used to construct a symbol from the DictionarySymbolStyle.

      For example, mil2525d would include "identity", "symbolset", "symbolentity", and "modifier1", among many others. The newer, Arcade-based styles define such attributes within the .stylx file as a JSON string.

      Returns:
      the string list of attributes used to construct a symbol from the DictionarySymbolStyle.
      Since:
      100.0.0
    • getDictionaryName

      public String getDictionaryName()
      Gets the name of the custom Arcade-based style. This property returns an empty string on older version style files or if this DictionarySymbolStyle instance is not loaded.
      Returns:
      the name of the custom Arcade-based style or an empty string on older version style files.
      Since:
      100.6.0
    • getConfigurations

      public List<DictionarySymbolStyleConfiguration> getConfigurations()
      Gets the configuration settings from the Custom Dictionary as an unmodifiable list. Will return an empty list if the dictionary symbol style is not loaded.
      Returns:
      an unmodifiable list of configuration settings
      Since:
      100.6.0