Allows retrieving and manipulating modifiers of a military symbol, without having to worry whether the properties are encoded in the symbol code or in textual modifiers.

The modifiers of a military symbol are partly encoded in its symbol code (e.g. the MIL-STD 2525b symbology encodes the affiliation in the second digit of the symbol code) and partly encoded as additional metadata called text modifiers (usually a key-value map). This class exposes all these modifiers as enumerable, modifiable JavaScript properties.

It does not represent a Feature or domain object, and does not cover the geometry. To generate a Shape that corresponds to a military symbol, please use the SymbologyNode.createTemplates method.

Example usages

Query and configure a symbol

  // 1) create a MIL-STD 2525b "rescue" symbol based on the code from the specification or a SymbologyNode
var codedRescueSymbol = new MilitarySymbol(MIL_STD_2525b, "G*G*GPAR--****X");
// codedRescueSymbol has properties for all applicable code and text modifiers.
// Mask characters have been replaced from the symbol code. Hence, the following statement is true:
// codedRescueSymbol.code === "GUG-GPAR------X"

// 2) query the available modifiers
console.log("available modifiers:");
for (var modifier in codedRescueSymbol) {
if (codedRescueSymbol.hasOwnProperty(modifier) ) {
console.log(modifier); // this outputs, among others, "affiliation" and "additionalInformation"
}
}

// 3) query the possible values of the "affiliation" modifier
codedRescueSymbol.possibleValues("affiliation"); // returns an array containing, among others, the value "Friend"

// 4) change the "affiliation" modifier.
codedRescueSymbol.affiliation = "Friend";
// The properties of a MilitarySymbol object are read-write and immediately update the values for the code and
// text modifiers. The "affiliation" modifier is encoded in the symbol code, so the following statement is true:
// codedRescueSymbol.code === "GFG-GPAR------X"

// 5) change the "additionalInformation" modifier.
codedRescueSymbol.additionalInformation = "this is an example symbol"; // adds a new entry to codedRescueSymbol.textModifiers
// the "additional information" modifier is encoded as a text modifier

// 6) create a domain object with the encoded modifiers
var rescueDomainObject = new Feature(
myRescueGeometry,
{
code : codedRescueSymbol.code, // "GFG-GPAR------X"
textModifiers : codedRescueSymbol.textModifiers
},
1
);

Change a modifier of an existing object

  // Change the value for the status modifier of an existing object
var codedExistingSymbol = new MilitarySymbol(MIL_STD_2525b, existingDomainObject.code, existingDomainObject.textModifiers);
codedExistingSymbol.status = "present";
existingDomainObject.code = codedExistingSymbol.code;
existingDomainObject.textModifiers = codedExistingSymbol.textModifiers;

Available modifiers

Depending on the used symbol, a different set of modifiers is exposed as a properties of the MilitarySymbol object. There is a difference between modifiers that get encoded in the symbol code (SIDC) and modifiers that get encoded as text (TEXT). For a full overview of all modifiers for all symbologies, have a look at the article overview of military symbol modifiers.

Hierarchy

  • MilitarySymbol

Constructors

  • Creates a new coded military symbol with the given code and text properties. All applicable modifiers will be exposed as modifiable properties of the MilitarySymbol. The code is a read-only property. The type of the MilitarySymbol cannot be changed anymore, but you can create a clone with a different type by calling the copyAndChangeCode method.

    Parameters

    • symbology: HierarchicalSymbology

      The symbology the symbol belongs to.

    • code: string

      The (configured) symbol code. Can already contain modified code modifiers.

    • Optional textModifiers: any

      Any (optional) modifiers. Object literal mapping the text modifier name to the value.

    Returns MilitarySymbol

Accessors

  • get code(): string
  • The configured symbol code.

    Returns string

  • get textModifiers(): object
  • Returns a map linking the text modifier names to the text modifier values.

    Returns object

Methods

  • Creates a new military symbol based on the given code. Modifiers of the current symbol are retained if they are still applicable and not overridden by the given code.

    For example, applying this function to an existing MIL_STD_2525b space track with code
    "SUPP------HDBEX"
    by passing the code
    "SFA*------*****"
    will return a new MIL_STD_2525b air track with code
    "SFAP------HDBEX".

    Parameters

    • code: string

      representing the new symbol type

    Returns MilitarySymbol

    a new military symbol of the given type, with the same modifiers as the current symbol (if not overridden)

  • Returns the possible values for a given modifier, or null if the possible values cannot be enumerated. As an example, the possible values for the modifier "affiliation" could be "Neutral" and "Friendly".

    Parameters

    • modifier: string

      the modifier for which to return the possible values. One of the properties defined in this symbol.

    Returns null | (null | string)[]

    the possible values for the given modifier