Skip to content

Commit

Permalink
Updated toolkit for v3.0.0 of the specification
Browse files Browse the repository at this point in the history
This coresponds ArcGIS Pro 2.5+, ArcGIS Runtime 100.7+, and allows for web styles that can be published with the ArcGIS API for JavaScript 4.13+
  • Loading branch information
williamscraigm committed Feb 6, 2020
1 parent 017c1de commit d55fde7
Show file tree
Hide file tree
Showing 18 changed files with 280 additions and 122 deletions.
29 changes: 6 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Dictionary renderer toolkit
Extend ArcGIS Pro and the ArcGIS Runtime SDKs by creating custom dictionary renderers. Dictionary renderers allow complex symbology specifications, such as those using in military symbology, to be configured and drawn in maps. This toolkit provides resources to support modifying and creating symbol dictionaries for use with the dictionary renderer to suit your symbolization requirements.
Extend ArcGIS Pro, the ArcGIS API for JavaScript, and the ArcGIS Runtime SDKs by creating custom dictionary renderers. Dictionary renderers allow complex symbology specifications, such as those using in military symbology, to be configured and drawn in maps. This toolkit provides resources to support modifying and creating symbol dictionaries for use with the dictionary renderer to suit your symbolization requirements.

* [Understanding the dictionary](/docs/understanding-the-dictionary.md)
* [Tips for creating custom dictionaries](/docs/tips-for-creating-custom-dictionaries.md)
Expand All @@ -9,30 +9,13 @@ Extend ArcGIS Pro and the ArcGIS Runtime SDKs by creating custom dictionary rend

## Requirements

Dictionaries generated using this toolkit can be used in ArcGIS Pro 2.4 or higher and ArcGIS Runtime SDKs 100.6 or higher.
Dictionaries generated using this toolkit can be used in ArcGIS Pro 2.5 or higher and ArcGIS Runtime SDKs 100.7 or higher and published as web styles for use with the ArcGIS API for JavaScript 4.13 or higher. Note: The ArcGIS API for JavaScript only supports dictionary symbology for point feature layers at this time.

The requirements for the machine on which you modify ArcGIS Pro add-ins are listed here.
A previous version of this toolkit allowed for creation of dictionary styles that worked with ArcGIS Pro 2.4 and ArcGIS Runtime SDKs 100.6. It is archived as a [branch](https://github.com/Esri/dictionary-renderer-toolkit/tree/release/2.0.0) of this repository and it's recommended that dictionaries be upgraded to version 3.0.0, which this toolkit documents from that previous 2.0.0 version. See [Upgrading dictionary styles from a previous version](docs/upgrading-dictionary-styles-from-a-previous-version.md) for steps to upgrade.

#### ArcGIS Pro
See the [ArcGIS Pro system requirements](https://pro.arcgis.com/en/pro-app/get-started/arcgis-pro-system-requirements.htm) for requirements to run ArcGIS Pro.

* ArcGIS Pro 2.4

#### Supported platforms

* Windows 10 (Home, Pro, Enterprise) (64 bit)
* Windows 8.1 (Pro, and Enterprise) (64 bit)
* Windows 7 SP1 (Ultimate, Professional and Enterprise) (64 bit)

#### Supported .NET framework

* Microsoft .NET Framework 4.6.1 Developer Pack

#### Supported IDEs

* Visual Studio 2017 (Professional, Enterprise, and Community Editions)
* Visual Studio 2019 (Professional, Enterprise, and Community Editions)

Note: [ArcGIS Pro system requirements](https://pro.arcgis.com/en/pro-app/get-started/arcgis-pro-system-requirements.htm)
In order to build Add-Ins provided in this repository, see the [ArcGIS Pro 2.5 SDK for .NET requirements](https://github.com/esri/arcgis-pro-sdk/wiki#requirements).

## Contributing

Expand All @@ -42,7 +25,7 @@ Esri welcomes contributions from anyone and everyone. For more information, see
Find a bug or want to request a new feature? Let us know by submitting an issue.

## Licensing
Copyright 2019 Esri
Copyright 2020 Esri

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at:

Expand Down
Binary file added dictionary_examples/Park_Amenities/Parks.ppkx
Binary file not shown.
Binary file not shown.
Binary file added dictionary_examples/Service_Calls/Calls.stylx
Binary file not shown.
Binary file not shown.
68 changes: 34 additions & 34 deletions docs/add-a-configuration-for-country-indicator-for-MIL-STD-2525C.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The example below illustrates how to add a country indicator with an option to d

## Create a custom dictionary
In order to modify the dictionary for MIL-STD-2525C it is necessary to create a custom dictionary.
1. Copy the `mil2525c.stylx` file from `…/Resources/Dictionaries/mil2525c` in the install location and paste it to the location the custom dictionary will be stored.
1. Download the [Joint Military Symbology MIL-STD-2525C](https://www.arcgis.com/home/item.html?id=96fd0d8bb7214755a45818e57ce74988) style from ArcGIS Online.
2. Open the copy of mil2525c.stylx in an SQLite database editor.
3. Update the `dictionary_name` to the name of the custom dictionary.
4. Make the style file editable by changing the `readonly` value to `false`.
Expand Down Expand Up @@ -92,20 +92,20 @@ var _country_code = '--';
2. _Identify which character should be extracted for the two-digit country code in the full SIDC value:_ In the section immediately under the list of variables there is logic for how the 15-character SIDC code is decomposed. The country code is the 13th and 14th digits in the 15-character code. To extract this code, the mid function is used specifying the starting position and how many digits.

```
var _sidc_len = count($sidc);
var _sidc_len = count($feature.sidc);
if (_sidc_len == 15) {
// decompose sidc into individual fields
_coding_scheme = mid($sidc, 0, 1);
_affiliation = mid($sidc, 1, 1);
_battle_dimension = mid($sidc, 2, 1);
_status = mid($sidc, 3, 1);
_function_code = mid($sidc, 4, 6);
_HQ_TF_FD = mid($sidc, 10, 1);
_echelon_mobility = mid($sidc, 11, 1);
_order_of_battle = mid($sidc, 14, 1);
_country_code = mid($sidc, 12, 2);
_coding_scheme = mid($feature.sidc, 0, 1);
_affiliation = mid($feature.sidc, 1, 1);
_battle_dimension = mid($feature.sidc, 2, 1);
_status = mid($feature.sidc, 3, 1);
_function_code = mid($feature.sidc, 4, 6);
_HQ_TF_FD = mid($feature.sidc, 10, 1);
_echelon_mobility = mid($feature.sidc, 11, 1);
_order_of_battle = mid($feature.sidc, 14, 1);
_country_code = mid($feature.sidc, 12, 2);
} else if (_sidc_len == 0) {
```
Expand All @@ -117,23 +117,23 @@ if (_sidc_len == 15) {
// read individual attributes if sidc not specified
if (count($extendedfunctioncode) == 10) {
_coding_scheme = mid($extendedfunctioncode, 0, 1);
_affiliation = mid($extendedfunctioncode, 1, 1);
_battle_dimension = mid($extendedfunctioncode, 2, 1);
_status = mid($extendedfunctioncode, 3, 1);
_function_code = mid($extendedfunctioncode, 4, 6);
if (count($feature.extendedfunctioncode) == 10) {
_coding_scheme = mid($feature.extendedfunctioncode, 0, 1);
_affiliation = mid($feature.extendedfunctioncode, 1, 1);
_battle_dimension = mid($feature.extendedfunctioncode, 2, 1);
_status = mid($feature.extendedfunctioncode, 3, 1);
_function_code = mid($feature.extendedfunctioncode, 4, 6);
}
if (count($affiliation) == 1)
_affiliation = $affiliation;
if (count($status) == 1)
_status = $status;
if (count($hqtffd) == 1)
_HQ_TF_FD = $hqtffd;
if (count($echelonmobility) == 1)
_echelon_mobility = $echelonmobility;
if (count($countrycode) == 2)
_country_code = $countrycode;
_affiliation = $feature.affiliation;
if (count($feature.status) == 1)
_status = $feature.status;
if (count($feature.hqtffd) == 1)
_HQ_TF_FD = $feature.hqtffd;
if (count($feature.echelonmobility) == 1)
_echelon_mobility = $feature.echelonmobility;
if (count($feature.countrycode) == 2)
_country_code = $feature.countrycode;
}
```

Expand All @@ -142,13 +142,13 @@ if (_sidc_len == 15) {
```
// configuration options
var _show_frame = $frame != 'OFF';
var _show_icon = $icon != 'OFF';
var _show_fill = $fill != 'OFF' && !_is_sea_mine;
var _show_amplifiers = $amplifiers != 'OFF';
var _show_text = $text != 'OFF';
var _use_conditionalt = $condition != 'PRIMARY';
var _use_flag = $country != 'ABBREVIATION';
var _show_frame = $config.frame != 'OFF';
var _show_icon = $config.icon != 'OFF';
var _show_fill = $config.fill != 'OFF' && !_is_sea_mine;
var _show_amplifiers = $config.amplifiers != 'OFF';
var _show_text = $config.text != 'OFF';
var _use_conditionalt = $config.condition != 'PRIMARY';
var _use_flag = $config.country != 'ABBREVIATION';
```

Expand Down Expand Up @@ -178,7 +178,7 @@ Once the script has been updated it is good practice to verify the syntax of the
1. Go to https://developers.arcgis.com/arcade/playground/
2. Copy the text from [mil2525c_b2_app6b_arcade_vars.json](../variable_declarations/mil2525c_b2_app6b_arcade_vars.json) into the expression window. These are values that you can change to match the symbols you are adding. The values are used for the string that is returned in the results.
3. _Add new country configuration option below other variables:_
`var $country = 'ABBREVIATION';`
`country: "ABBREVIATION",`
4. Copy the text from the edited dictionary script. Paste below the text from `mil2525c_b2_app6b_arcade_vars`.
5. Click Test. If there is a syntax error, the line with the error is reported in the results. If there are no errors the results show a string of the values returned. You can change the values at the top to test what different keys are returned.

Expand Down
14 changes: 7 additions & 7 deletions docs/add-a-new-identity-to-MIL-STD-2525C.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ To add these new identities the dictionary script must be updated to recognize t

## Create a custom dictionary
In order to modify the dictionary for MIL-STD-2525C it is necessary to create a custom dictionary.
1. Copy the mil2525c.stylx file from `…/Resources/Dictionaries/Mil2525c` in the install location and paste into the location the custom dictionary will be stored.
1. Download the [Joint Military Symbology MIL-STD-2525C](https://www.arcgis.com/home/item.html?id=96fd0d8bb7214755a45818e57ce74988) style from ArcGIS Online.
2. Open the copy of the mil2525c.stylx in an SQLite database editor.
3. In the meta table, update the `dictionary_name` to the name of the custom dictionary.
4. Make the style file to editable by changing the `readonly` value to `false`.
Expand Down Expand Up @@ -61,14 +61,14 @@ if (_affiliation == 'Y')
var _fill_color;
if (_is_civilian)
_fill_color = decode($colors, 'DARK', '#500050', 'MEDIUM', '#800080', '#FFA1FF'); // civilian
_fill_color = decode($config.colors, 'DARK', '#500050', 'MEDIUM', '#800080', '#FFA1FF'); // civilian
else
_fill_color = decode(_color_affiliation,
'F', decode($colors, 'DARK', '#006B8C', 'MEDIUM', '#00A8DC', '#80E0FF'), // friendly
'N', decode($colors, 'DARK', '#00A000', 'MEDIUM', '#00E200', '#AAFFAA'), // neutral
'H', decode($colors, 'DARK', '#C80000', 'MEDIUM', '#FF3031', '#FF8080'), // hostile
'X', decode($colors, 'DARK', '# 9F4B6B', 'MEDIUM', '#BC587E', '#E37DA4'), // paramilitary
decode($colors, 'DARK', '#E1DC00', 'MEDIUM', '#FFFF00', '#FFFF80')); // unknown
'F', decode($config.colors, 'DARK', '#006B8C', 'MEDIUM', '#00A8DC', '#80E0FF'), // friendly
'N', decode($config.colors, 'DARK', '#00A000', 'MEDIUM', '#00E200', '#AAFFAA'), // neutral
'H', decode($config.colors, 'DARK', '#C80000', 'MEDIUM', '#FF3031', '#FF8080'), // hostile
'X', decode($config.colors, 'DARK', '#9F4B6B', 'MEDIUM', '#BC587E', '#E37DA4'), // paramilitary
decode($config.colors, 'DARK', '#E1DC00', 'MEDIUM', '#FFFF00', '#FFFF80')); // unknown
```

Expand Down
8 changes: 4 additions & 4 deletions docs/add-a-new-symbol-set-to-MIL-STD-2525D.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The new symbol set will have a value of `32`.
## Create a custom dictionary

To modify the dictionary for MIL-STD-2525D you must first create a custom dictionary.
1. Copy the mil2525d.stylx file from `…/Resources/Dictionaries/mil2525d` in the install location and paste it to the location the custom dictionary will be stored.
1. Download the [Joint Military Symbology MIL-STD-2525D](https://www.arcgis.com/home/item.html?id=46294aa60b0b47feaca642450127ae12) file from ArcGIS Online.
2. Open the copy of the mil2525d.stylx in an SQLite database editor.
3. In the `meta` table, update the `dictionary_name` to the name of the custom dictionary.
4. Make the style file editable by changing the `readonly` value to `false`.
Expand Down Expand Up @@ -49,8 +49,8 @@ _Update script for new frame:_ To add a new frame, a new symbol set must be adde
```
// validity of critical attributes
var _invalid_symbolset = indexof(['00', '01', '02', '05', '06', '10', '11', '15', '20', '25', '30', '32', '35', '36', '40', '45', '46', '47', '50', '51', '52', '53', '54', '60'], $symbolset) == -1;
var _invalid_identity = indexof(['0', '1', '2', '3', '4', '5', '6'], $identity) == -1;
var _invalid_symbolset = indexof(['00', '01', '02', '05', '06', '10', '11', '15', '20', '25', '30', '32', '35', '36', '40', '45', '46', '47', '50', '51', '52', '53', '54', '60'], _symbolset) == -1;
var _invalid_identity = indexof(['0', '1', '2', '3', '4', '5', '6'], _identity) == -1;
```

Expand All @@ -64,7 +64,7 @@ else {
keys = '';
// map symbolset for frame icons
var _symbolset_frame = decode($symbolset, '01', '01', '02', '01', '05', '05', '06', '05', '10', '10', '11', '10', '15', '30', '20', '20', '30', '30', '32', '32', '35', '35', '36', '35', '40', '40', '50', '05', '51', '01', '52', '30', '53', '30', '54', '35', '60', '30', '00');
var _symbolset_frame = decode(_symbolset, '01', '01', '02', '01', '05', '05', '06', '05', '10', '10', '11', '10', '15', '30', '20', '20', '30', '30', '32', '32', '35', '35', '36', '35', '40', '40', '50', '05', '51', '01', '52', '30', '53', '30', '54', '35', '60', '30', '00');
```

Expand Down
Binary file added docs/images/editprimitivename.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/frameconfigoptions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/parkamenitiesmap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/servicecallmap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/symbolstructure.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 14 additions & 12 deletions docs/understanding-the-dictionary.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ For example, the MIL-STD-2525D dictionary style, which is included in ArcGIS Pro
The dictionary script defines the keys for the individual component symbols. These keys may be a combination of variables, attributes, string, etc. In the example above, the frame key, which returns the blue rectangle, is built by combining the values for context, identity, symbol set and status.

Frame key example code:
`concatenate([_context, '_', $identity, _symbolset, '_', _status])`
`concatenate([_context, '_', $feature.identity, _symbolset, '_', _status])`


Mobile style files that are used as dictionaries must contain the following fields in the `meta` table of the .stylx file:
Expand All @@ -40,14 +40,15 @@ This is the name that shows in the Dictionary symbology pane in ArcGIS Pro.

**_dictionary_version_**

This is the version of the dictionary. The minimum version number for a custom dictionary is `2.0.0`.
This is the version of the dictionary. The minimum version number for a custom dictionary is `2.0.0`. This documentation covers version 3.0.0. For documentation of version 2.0.0, see the archived [branch](https://github.com/Esri/dictionary-renderer-toolkit/tree/release/2.0.0) of this repository. For details on how to upgrade a dictionary, see [Upgrading dictionary styles from a previous version
](docs\upgrading-dictionary-styles-from-a-previous-version.md). Version `3.0.0` or higher is required to share the dictionary as a web style.

**_arcade_version_**

The Arcade version indicates the minimum version of Arcade needed to consume the script. The minimum Arcade version for a custom dictionary is `1.5.0`.

## Dictionary configuration
This JSON object defines attributes that appear in the user interface to allow connection to database attributes. These attributes become available as variables in the script, prefixed by the `$` character.
This JSON object defines attributes that appear in the user interface to allow connection to database attributes. These attributes become available as attributes in the `$config` global variable.

### Configuration
This section lists options that are not feature-dependent. Only text values are supported.
Expand All @@ -65,10 +66,10 @@ declaration

Usage in the script:

`var _show_icon = $icon != 'OFF';`
`var _show_icon = $config.icon != 'OFF';`

### Symbol
The symbol attributes are used to control how to build symbol keys. The symbol attributes are just an array of strings. The order in the array defines the order in the user interface. They are used in the script with the `$` character prefix.
The symbol attributes are used to control how to build symbol keys. The symbol attributes are just an array of strings. The order in the array defines the order in the user interface. Their values are available as attributes in the `$feature` global variable.

### Text
The text attributes are only used by the dictionary labels. They are not available as variables in the script.
Expand All @@ -90,13 +91,13 @@ The dictionary script is an Arcade script that returns a string. The string chai
You can use any Arcade function to produce the string you want. A key is used to retrieve a symbol from the style.

Examples:
This example uses the content of feature attributes (attributes prefixed with `$`) directly:
This example uses the content of feature attributes directly:

`var key = concatenate([$symbolset, $symbolentity]);`
`var key = concatenate([$feature.symbolset, $feature.symbolentity]);`

This example uses a mix of intermediate variables, feature attributes, and constant strings:

`var key = concatenate([_context, '_', $identity, _symbolset_frame, _status]);`
`var key = concatenate([_context, '_', $feature.identity, _symbolset_frame, _status]);`

### Returning multiple keys
Multiple keys are returned as a semi-colon separated string;
Expand All @@ -113,16 +114,17 @@ The script attempts to get the generic key, but if it is not found, it uses an a
Example:
```
keys += concatenate([
concatenate([$symbolset, $symbolentity]), // non touching frames
concatenate([$symbolset, $symbolentity, _affiliation_icon]) // touching frames - Both are provided because the existence of the icon cannot be queried.
concatenate([$feature.symbolset, $feature.symbolentity]), // non touching frames
concatenate([$feature.symbolset, $feature.symbolentity, _affiliation_icon]) // touching frames - Both are provided because the existence of the icon cannot be queried.
], '|'); // use | as the separator
```

### Using overrides
The value returned by the script can also contain overrides. Overrides can be considered as a special key that starts with `po:` (for primitive override).

A primitive override is a way to change a symbol property value differently per feature. Parts of a symbol can be tagged with a primitive name (like an element name in WPF or HTML).
The syntax for a primitive override is `po:<primitive_name>|<property_name>|<value>` which means: for this symbol, replace <property_name> by <value> for all parts that are tagged <primitive_name>.
A primitive override is a way to change a symbol property value differently per feature. Parts of a symbol can be tagged with a primitive name (like an element name in WPF or HTML). The primitive name can be added to the symbol parts in ArcGIS Pro by clicking on the *show primitive name* button on the structure tab in the catalog view.

The syntax for a primitive override is `po:<primitive_name>|<property_name>|<value>` which means: for this symbol, replace `<property_name>` by `<value>` for all parts that are tagged `<primitive_name>`.

In the MIL-STD-2525 dictionaries, the frame symbols have built-in primitive names to identify parts that belong to the fill (`frame_fill`) or the outline (`frame_outline`). They can then be colored by overriding the `Color` property.

Expand Down
Loading

0 comments on commit d55fde7

Please sign in to comment.