Class 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 (an 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). This mechanism contains the symbol primitives for a given symbology specification (such as mil2525d), 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.

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

    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.2.0
    • Constructor Detail

      • DictionarySymbolStyle

        @Deprecated
        public DictionarySymbolStyle​(java.lang.String specificationType,
                                     java.lang.String dictionaryPath)
        Deprecated.
        as of 100.6.0, the specification definition has been moved to an Arcade expression in the style file. These styles no longer reside in a default location and creating a DictionarySymbolStyle from a specification is no longer supported with the new military symbol styles. This constructor is only valid for use with the older format style files. An error occurs if a newer format (Arcade-based) style is encountered. Use createFromFile(String) instead.
        Creates a dictionary symbol style. If the specification type is null or empty, an attempt will be made during loading to infer the type from the meta table, if it exists, inside the *.stylx file. If the load is successful, the type can be retrieved with getSpecificationType(). If the type is known before creating the DictionarySymbolStyle, it is best to provide the type.
        Parameters:
        specificationType - specification type e.g., "mil2525d", can be null or empty
        dictionaryPath - absolute path to dictionary file. It is a file with .stylx extension. The dictionary will fail to load if the file does not exist.
        Since:
        100.2.0
      • 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:
        java.lang.IllegalArgumentException - if portalItem is null
        Since:
        100.10.0
    • Method Detail

      • createFromFile

        public static DictionarySymbolStyle createFromFile​(java.lang.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 file
        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​(java.lang.String webStyleUrl)
        Creates a new dictionary symbol style using a web style item's URL.
        Parameters:
        webStyleUrl - URI of the dictionary web style item
        Returns:
        a new DictionarySymbolStyle instance
        Throws:
        java.lang.IllegalArgumentException - if webStyleUrl is empty or null
        Since:
        100.10.0
      • getSpecificationType

        @Deprecated
        public java.lang.String getSpecificationType()
        Deprecated.
        as of 100.6.0. With the new Arcade-based styles, the style specification logic is embedded in the style file itself. DictionarySymbolStyles are no longer specific to military specifications and can be customized by the end user. Use the getDictionaryName() instead.
        Gets the name of the dictionary (.stylx file), such as "Mil2525D".
        Returns:
        the specification type
        Since:
        100.2.0
      • getConfigurationProperties

        @Deprecated
        public java.util.Map<java.lang.String,​java.lang.String> getConfigurationProperties()
        Deprecated.
        as of 100.6.0, these configuration settings are specific to the older style files. These have no effect on the newer style files where the symbol creation comes from the Arcade expression in the style.
        Gets the configuration settings and values used by the style. These settings are specific to the symbology rule engine used by the DictionarySymbolStyle.

        Each rule engine used by the DictionarySymbolStyle may have additional settings that can be configured. To modify these settings, obtain the defaults using this method, and modify them to the desired values.

        Returns:
        the configuration properties
        Since:
        100.2.0
      • getTextFieldNames

        public java.util.List<java.lang.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. The newer Arcade-based styles define such attributes within the .stylx file as a JSON string.
        Since:
        100.2.0
      • getSymbolAsync

        public ListenableFuture<Symbol> getSymbolAsync​(java.util.Map<java.lang.String,​java.lang.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 start the load cycle.

        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:
        java.lang.IllegalArgumentException - if attributes is null
        Since:
        100.2.0
      • getSymbologyFieldNames

        public java.util.List<java.lang.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.

        Returns:
        The string list of attributes used to construct a symbol from the DictionarySymbolStyle. The newer Arcade-based styles define such attributes within the .stylx file as a JSON string.
        Since:
        100.2.0
      • getDictionaryName

        public java.lang.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 java.util.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