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 (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).A
DictionarySymbolStyle
must contain a set of symbol primitives for a given symbology specification, as well as a rule engine that parses input fields. TheDictionarySymbolStyle
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 aFeatureLayer
orGraphicsOverlay
.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 Summary
Constructors Constructor Description DictionarySymbolStyle(PortalItem portalItem)
Creates a new dictionary symbol style object from a portal item.DictionarySymbolStyle(String specificationType)
Deprecated, for removal: This API element is subject to removal in a future version.as of 100.6.0, the specification definition has been moved to an Arcade expression in the style file.DictionarySymbolStyle(String specificationType, String dictionaryPath)
Deprecated, for removal: This API element is subject to removal in a future version.as of 100.6.0, the specification definition has been moved to an Arcade expression in the style file.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static DictionarySymbolStyle
createDictionarySymbolStyleFromUrl(String webStyleUrl)
Creates a new dictionary symbol style using a web style item's URL.static DictionarySymbolStyle
createFromFile(String path)
Creates a new dictionary symbol style instance from the style file at the provided location.Map<String,String>
getConfigurationProperties()
Deprecated, for removal: This API element is subject to removal in a future version.as of 100.6.0, these configuration settings are specific to the older style files and have no effect on the newer style files, where the symbol creation comes from the Arcade expression in the style.List<DictionarySymbolStyleConfiguration>
getConfigurations()
Gets the configuration settings from the Custom Dictionary as an unmodifiable list.String
getDictionaryName()
Gets the name of the custom Arcade-based style.String
getSpecificationType()
Deprecated, for removal: This API element is subject to removal in a future version.as of 100.6.0.ListenableFuture<Symbol>
getSymbolAsync(Map<String,Object> attributes)
Finds a Symbol, as defined by the input attributes.List<String>
getSymbologyFieldNames()
Gets the string list of attributes used to construct a symbol from the DictionarySymbolStyle.List<String>
getTextFieldNames()
Gets the string list of attributes used to obtain text values for display with a symbol from a DictionarySymbolStyle.-
Methods inherited from class com.esri.arcgisruntime.symbology.SymbolStyle
addDoneLoadingListener, addLoadStatusChangedListener, cancelLoad, createSymbolStyleFromUrl, getCredential, getDefaultSearchParametersAsync, getLoadError, getLoadStatus, getPortal, getPortalItem, getRequestConfiguration, getStyleLocation, getStyleName, getSymbolAsync, getUri, loadAsync, removeDoneLoadingListener, removeLoadStatusChangedListener, retryLoadAsync, searchSymbolsAsync, setCredential, setRequestConfiguration
-
-
-
-
Constructor Detail
-
DictionarySymbolStyle
@Deprecated(since="100.6.0", forRemoval=true) public DictionarySymbolStyle(String specificationType)
Deprecated, for removal: This API element is subject to removal in a future version.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. UsecreateFromFile(String)
instead.Creates a dictionary symbol style based on specification type.An example of specificationType is "mil2525d".
Since a SymbolDictionary requires a *.stylx file and no dictionary path is set, it is assumed that the *.stylx file is in the default location. For example, a mil2525d stylx file's default path is <sdk_resources_path>/symbols/mil2525d/mil2525d.stylx, where <sdk_resources_path> can be obtained using
ArcGISRuntimeEnvironment.getResourcesDirectory()
.- Parameters:
specificationType
- the name of supported military standard to use for the dictionary style, e.g., "mil2525d"- Since:
- 100.0.0
-
DictionarySymbolStyle
@Deprecated(since="100.6.0", forRemoval=true) public DictionarySymbolStyle(String specificationType, String dictionaryPath)
Deprecated, for removal: This API element is subject to removal in a future version.as of 100.6.0, the specification definition has been moved to an Arcade expression in the style file. 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. UsecreateFromFile(String)
instead.Creates a dictionary symbol style based on specification type and symbol dictionary file path. 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 withgetSpecificationType()
. If the type is known before creating the DictionarySymbolStyle, it is best to provide the type.If no dictionary path is set, it is assumed that the *.stylx file is in the default location. For example, a mil2525d stylx file's default path is <sdk_resources_path>/symbols/mil2525d/mil2525d.stylx, where <sdk_resources_path> can be obtained using
ArcGISRuntimeEnvironment.getResourcesDirectory()
.- Parameters:
specificationType
- the name of supported military standard to use for the dictionary style, e.g., "mil2525d"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.0.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:
IllegalArgumentException
- if portalItem is null- Since:
- 100.10.0
-
-
Method Detail
-
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
-
getSpecificationType
@Deprecated(since="100.6.0", forRemoval=true) public String getSpecificationType()
Deprecated, for removal: This API element is subject to removal in a future version.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 thegetDictionaryName()
instead.Gets the name of the dictionary (.stylx file), such as "Mil2525D".- Returns:
- the name of the dictionary (.stylx file), such as "Mil2525D".
- Since:
- 100.0.0
-
getConfigurationProperties
@Deprecated(since="100.6.0", forRemoval=true) public Map<String,String> getConfigurationProperties()
Deprecated, for removal: This API element is subject to removal in a future version.as of 100.6.0, these configuration settings are specific to the older style files and have no effect on the newer style files, where the symbol creation comes from the Arcade expression in the style.Gets the configuration properties.Each symbology rule engine may have additional properties that can be configured. To modify these properties, obtain the defaults using this method, and modify them to the desired values.
- Returns:
- the configuration properties used by the style. These settings are specific to the rule engine used by the DictionarySymbolStyle.
- Since:
- 100.0.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
-
-