LuciadCPillar 2023.1.04
luciad::MilitarySymbol Class Referenceabstract

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. More...

#include <luciad/symbology/military/MilitarySymbol.h>

Classes

class  Modifiers
 Allows enumerating Modifier values and converting them to and from std::string. More...
 

Public Types

enum class  Affiliation {
  Pending , Unknown , AssumedFriend , Friend ,
  AssumedNeutral , Neutral , Suspect , Hostile ,
  ExercisePending , ExerciseUnknown , ExerciseAssumedFriend , ExerciseFriend ,
  ExerciseAssumedNeutral , ExerciseNeutral , Joker , Faker
}
 The affiliation of a military symbol. More...
 
enum class  Modifier {
  Affiliation , Status , OrderOfBattle , Sector1 ,
  Sector2 , StandardIdentity1 , StandardIdentity2 , Echelon ,
  Mobility , Leadership , HqTaskForceDummy , Quantity ,
  ReinforcedOrReduced , StaffComments , AdditionalInformation , EvaluationRating ,
  CombatEffectiveness , SignatureEquipment , HigherFormation , Hostile ,
  IffSif , MobilityIndicator , UniqueDesignation , TypeLabel ,
  DateTimeGroup , AltitudeDepth , LocationLabel , SpeedLabel ,
  SpecialHeadquarters , PlatformType , TeardownTime , CommonIdentifier ,
  EffectiveTime , MovementDirection , Country , TrackNumber ,
  Name , PositionAndMovement , Capacity , HeadquartersElement ,
  InstallationComposition , SpecialDesignator , GuardedUnit , TargetDesignator ,
  TargetNumberExtension , Attitude , Length , Width
}
 Enumeration type for all available MIL-STD 2525 and APP-6 symbol modifiers. More...
 

Public Member Functions

virtual ~MilitarySymbol ()=default
 
virtual std::shared_ptr< MilitarySymbolcopyAndChangeCode (std::string newCode) const =0
 Creates a new military symbol based on the given code. More...
 
virtual Feature copyToFeature (const Feature &feature, std::shared_ptr< luciad::Geometry > geometry) const =0
 Creates a new feature based on this military symbol and the given feature. More...
 
virtual Affiliation getAffiliation () const =0
 Returns the affiliation of this symbol. More...
 
virtual const std::string & getCode () const =0
 Returns the SIDC code of the symbol. More...
 
virtual std::unordered_set< ModifiergetModifiers () const =0
 Returns the modifiers of this shape symbol that can have a value associated with it. More...
 
virtual std::shared_ptr< MilitarySymbologyNodegetNode () const =0
 Returns the symbology node that is represented by this symbol. More...
 
virtual std::optional< std::vector< std::string > > getPossibleValues (Modifier modifier) const =0
 Returns the possible values for a given modifier, if applicable. More...
 
virtual std::unordered_set< ModifiergetSIDCModifiers () const =0
 Returns the collection of the possible SIDC modifiers of this symbol, e.g. More...
 
virtual MilitarySymbology::Standard getStandard () const =0
 Returns the symbology standard of this symbol. More...
 
virtual std::unordered_set< ModifiergetTextModifiers () const =0
 Returns the collection of the possible text modifiers of this symbol. More...
 
virtual std::optional< std::string > getValue (Modifier modifier) const =0
 Returns the value for the given modifier. More...
 
virtual void putValue (Modifier modifier, std::string value)=0
 Sets the given (modifier,value) pair. More...
 
virtual void resetValue (Modifier modifier)=0
 Resets the value associated with the given modifier. More...
 
virtual std::shared_ptr< IIcontoIcon (std::shared_ptr< MilitarySymbolStyle > style) const =0
 Creates an icon based on this military symbol and the given style. More...
 

Static Public Member Functions

static std::shared_ptr< MilitarySymbolcreate (const Feature &feature)
 Creates an editable military symbol based on the given Feature. More...
 
static std::shared_ptr< MilitarySymbolcreate (MilitarySymbology::Standard standard, std::string sidc)
 Creates an returns a military symbol with the given standard and SIDC. More...
 

Detailed Description

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 and a generic way to retrieve and set modifier values.

Example usages

// 1) create a MIL-STD 2525b "rescue" symbol based on the code from the specification or a MilitarySymbologyNode
auto codedRescueSymbol = MilitarySymbol::create(standard, "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:
EXPECT_TRUE(codedRescueSymbol->getCode() == "GUG-GPAR------X");
// 2) query the available modifiers
std::cout << "available modifiers:" << std::endl;
for (MilitarySymbol::Modifier modifier : codedRescueSymbol->getModifiers()) {
std::cout << to_string(modifier) << std::endl; // this outputs, among others, MilitarySymbol::Modifier::Affiliation and "AdditionalInformation".
}
// 3) query the possible values of the MilitarySymbol::Modifier::Affiliation modifier
codedRescueSymbol->getPossibleValues(MilitarySymbol::Modifier::Affiliation); // returns an array containing, among others, the value "Friend"
// 4) change the MilitarySymbol::Modifier::Affiliation modifier.
codedRescueSymbol->putValue(MilitarySymbol::Modifier::Affiliation, "Friend");
// The properties of a MilitarySymbol object are read-write and immediately update the values for the code and
// text modifiers. The MilitarySymbol::Modifier::Affiliation modifier is encoded in the symbol code, so the following statement is true:
EXPECT_TRUE(codedRescueSymbol->getCode() == "GFG-GPAR------X");
// 5) change the "additional information" modifier.
codedRescueSymbol->putValue(MilitarySymbol::Modifier::AdditionalInformation, "This is an example symbol.");
// the "additional information" modifier is stored as a text modifier
Modifier
Enumeration type for all available MIL-STD 2525 and APP-6 symbol modifiers.
Definition: MilitarySymbol.h:42
@ AdditionalInformation
Additional information for units, equipment and installations (text modifier).
@ Affiliation
Affiliation (SIDC modifier).
static std::shared_ptr< MilitarySymbol > create(MilitarySymbology::Standard standard, std::string sidc)
Creates an returns a military symbol with the given standard and SIDC.
@ MilStd2525b
Constant for MIL-STD 2525 revision B, change 2.
std::string to_string(const Color &value)

Member Enumeration Documentation

◆ Affiliation

The affiliation of a military symbol.

Enumerator
Pending 

A track which has not been subjected to the identification process.

Unknown 

An evaluated track which has not been identified.

AssumedFriend 

A track which is assumed to be a friend because of its characteristics, behavior, or origin.

Friend 

A track belonging to a declared friendly nation.

AssumedNeutral 

A track which is assumed to be neither supporting nor opposing friendly forces because of its characteristics, behavior, or origin.

Neutral 

A track or contact whose characteristics, behavior, origin, or nationality indicate that it is neither supporting nor opposing friendly forces.

Suspect 

A track which is potentially hostile because of its characteristics, behavior, origin, or nationality.

Hostile 

A track declared to belong to any opposing nation, party, group, or entity, which by virtue of its behavior or information collected on it such as characteristics, origin or nationality contributes to the threat to friendly forces.

ExercisePending 

A friendly track acting as not being subjected to the identification process.

ExerciseUnknown 

A friendly track acting as a evaluated, but non-identified track for exercise purposes.

ExerciseAssumedFriend 

A friendly track acting as an assumed friend for exercise purposes.

ExerciseFriend 

A friendly track acting as a friend for exercise purposes.

ExerciseAssumedNeutral 

A friendly track acting as assumed to be neither a supporting nor opposing track for exercise purposes.

ExerciseNeutral 

A friendly track acting as neutral for exercise purposes.

Joker 

A friendly track acting as a suspect for exercise purposes.

Faker 

A friendly track acting as a hostile for exercise purposes.

◆ Modifier

Enumeration type for all available MIL-STD 2525 and APP-6 symbol modifiers.

Refer to the respective standard specifications for a detailed description of the symbol modifiers. Use MilitarySymbol to find out which modifiers are applicable to a specific symbol. Depending on the standard, a specific modifier needs its value to be encoded in the SIDC code (we call this an SIDC modifier) or as a separate value (we call this a text modifier).

See Modifiers to enumerate all values and convert them to and from std::string.

Enumerator
Affiliation 

Affiliation (SIDC modifier).

Status 

Status (SIDC modifier).

OrderOfBattle 

Order Of Battle (SIDC modifier).

Sector1 

Sector 1 (SIDC modifier).

Applies only to APP-6C and APP-6D.

Sector2 

Sector 2 (SIDC modifier).

Applies only to APP-6C and APP-6D.

StandardIdentity1 

Standard Identity 1 (SIDC modifier).

Applies only to APP-6C and APP-6D.

StandardIdentity2 

Standard Identity 2 (SIDC modifier).

Applies only to APP-6C and APP-6D.

Echelon 

Echelon (SIDC modifier).

Mobility 

Mobility (SIDC modifier).

Applies only to APP-6C and APP-6D. The APP6 field(s): R

Leadership 

Leadership (SIDC modifier).

Applies to APP-6D The APP6 field(s): D

HqTaskForceDummy 

Headquarters/Task Force/Dummy (SIDC modifier).

Applies only to APP-6C and APP-6D.

Quantity 

The number of items present in an equipment symbol (text modifier).

ReinforcedOrReduced 

Whether or not a symbol is reinforced and/or reduced (test modifier).

Possible values are 'R' for reinforced, 'D' for reduced, 'RD' for reinforced and reduced. The label will display (+), (-) and (土) respectively.

StaffComments 

Staff comments for units, equipment and installations (text modifier).

AdditionalInformation 

Additional information for units, equipment and installations (text modifier).

EvaluationRating 

Reliability and credibility rating for units, equipment, and installations (text modifier).

Possible values consist of the following:

  • Reliability rating: 'A' (completely reliable), 'B' (usually reliable), 'C' (fairly reliable), 'D' (not usually reliable)
  • Credibility rating: '1' (confirmed by other sources), '2' (probably true), '3' (possibly true), '4' (doubtfully true), '5' (improbable), '6' (truth cannot be judged).

Although both letters and numerals are used to indicate the evaluation of an item of information, they are independent of each other.

CombatEffectiveness 

Unit effectiveness or installation capability (text modifier).

SignatureEquipment 

Signature for hostile equipment (text modifier).

"!" indicates detectable electronic signatures.

HigherFormation 

Number or title of higher echelon command for a unit (text modifier).

Hostile 

Hostile indicator for equipment.

The letters "ENY" denote hostile symbols.

IffSif 

IFF/SIF Identification modes and codes (text modifier).

MobilityIndicator 

Mobility for equipment (SIDC modifier).

UniqueDesignation 

Uniquely identifies a particular unit, equipment, or installation, or identifies the acquisition number when used with SIGINT symbology (text modifier).

TypeLabel 

Type of equipment (text modifier).

DateTimeGroup 

Date/time for units, equipment and installations (text modifier).

Values are according to the Date/Time Group format "DDHHMMSSZMONYY".

AltitudeDepth 

Altitude portion of GPS; flight level for aircraft; depth for submerged objects; height in feet of equipment or structures on the ground (text modifier for units, equipment, and installations).

LocationLabel 

A symbol's location in degrees, minutes, and seconds (or in UTM or other applicable display format) (text modifier for units, equipment, and installations).

SpeedLabel 

Velocity as set forth in MIL-STD-6040 (text modifier for units, equipment, and installations).

SpecialHeadquarters 

The name of the special C2 headquarters (text modifier for units).

PlatformType 

Platform type (text modifier).

Possible values are 'ELNOT' or 'CENOT'.

TeardownTime 

Equipment teardown time in minutes (text modifier).

CommonIdentifier 

Example: "Hawk" for Hawk SAM system (text modifier).

EffectiveTime 

Effective time (text modifier).

MovementDirection 

Direction of movement or intended movement of an object (text modifier for units, equipment, and installations).

Country 

Country.

For MIL-STD 2525b/c, this is an SIDC modifier, for other symbologies this is a text modifier with as possible value a three-letter code.

The APP6 field(s): AC The MS2525 field(s): AS

TrackNumber 

Track number.

Text modifier that applies to APP-6C air, maritime and space units.

Name 

Name.

Text modifier that applies to APP-6C air, maritime and space units.

PositionAndMovement 

Course [degrees] /Speed [knots] and/or Bearing [degrees] / Distance [nautical miles] Applies to APP-6C air, maritime and space units.

Capacity 

Capacity of installation displayed.

Text modifier that applies to APP-6C land installations.

The APP6 field(s): K

HeadquartersElement 

Headquarters element that is being represented, such as TOC, MAIN (text modifier).

The APP6 field(s): AH

InstallationComposition 

Component type of APP-6C land installations (text modifier).

One of:

  • Development
  • Research
  • Production
  • Service
  • Storage
  • Utility

The APP6 field(s): AI

SpecialDesignator 

Special designator (text modifier).

One of 'NRT' or 'SIG'.

The APP6 field(s): AR The MS2525 field(s): AR

GuardedUnit 

Undefined or BG.

The APP6 field(s): AQ The MS2525 field(s): AQ

TargetDesignator 

Used in Fire Support operations to uniquely designate targets in accordance with STANAG 2147.

6-character text modifier, where characters 1 and 2 are alphabetic, and characters 3-6 are numeric: 'AANNNN'.

The MS2525 field(s): AP

TargetNumberExtension 

A sequentially assigned number identifying the individual elements in a target (STANAG 5519).

A 2-3 character text modifier, where character 1 is a dash and characters 2-3 are numeric, from 1 through 15. It is applicable only to the “Point or Single Target” symbol, is conditional upon the presence of the Target Designator amplifier, and is visually displayed appended to the Target Number amplifier.

The APP6 field(s): APX

Attitude 

Target attitude in degrees (text modifier).

Defines the target orientation for rectangular target areas.

Length 

Target length in meters (text modifier).

Defines the total target length for rectangular target areas.

Width 

Target width in meters (text modifier).

Defines the total target width for rectangular target areas.

Constructor & Destructor Documentation

◆ ~MilitarySymbol()

virtual luciad::MilitarySymbol::~MilitarySymbol ( )
virtualdefault

Member Function Documentation

◆ copyAndChangeCode()

virtual std::shared_ptr< MilitarySymbol > luciad::MilitarySymbol::copyAndChangeCode ( std::string  newCode) const
pure virtual

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------MYBEX
by passing the code
SFA*------*****
will return a new MIL-STD 2525b air track with code
SFAP------MYBEX.

Parameters
newCodecode representing the new symbol type
Returns
a new military symbol of the given type, with the same modifiers as the current symbol (if not overridden)
Exceptions
luciad::InvalidArgumentExceptionwhen using an invalid code.

◆ copyToFeature()

virtual Feature luciad::MilitarySymbol::copyToFeature ( const Feature feature,
std::shared_ptr< luciad::Geometry geometry 
) const
pure virtual

Creates a new feature based on this military symbol and the given feature.

Parameters
featurethe feature to apply the geometry to. The feature's data type should be the MilitaryDataModel::getSymbolType.
geometrythe geometry of the feature
Returns
a new military feature, or nullptr if the feature does not yet have a geometry
See also
MilitaryDataModel
Since
2020.1

◆ create() [1/2]

static std::shared_ptr< MilitarySymbol > luciad::MilitarySymbol::create ( const Feature feature)
static

Creates an editable military symbol based on the given Feature.

Parameters
featurethe feature whose SIDC and modifiers should be used
Returns
a new symbol with the same SIDC and text modifiers as the given feature
See also
MilitaryDataModel
Exceptions
luciad::InvalidArgumentExceptionif the military standard or code cannot be derived from the feature.

◆ create() [2/2]

static std::shared_ptr< MilitarySymbol > luciad::MilitarySymbol::create ( MilitarySymbology::Standard  standard,
std::string  sidc 
)
static

Creates an returns a military symbol with the given standard and SIDC.

Parameters
standardthe standard of the military symbol.
sidcthe sidc of the military symbol.
Returns
a new military symbol with the given standard and SIDC.
Exceptions
luciad::InvalidArgumentExceptionif the SIDC code is not valid.

◆ getAffiliation()

virtual Affiliation luciad::MilitarySymbol::getAffiliation ( ) const
pure virtual

Returns the affiliation of this symbol.

This is a convenience method for directly retrieving the affiliation as an enum instance, as opposed to using getValue.

Returns
the symbol's affiliation.

◆ getCode()

virtual const std::string & luciad::MilitarySymbol::getCode ( ) const
pure virtual

Returns the SIDC code of the symbol.

The code represents the type of the symbol and any configured modifiers.

Returns
the SIDC code.

◆ getModifiers()

virtual std::unordered_set< Modifier > luciad::MilitarySymbol::getModifiers ( ) const
pure virtual

Returns the modifiers of this shape symbol that can have a value associated with it.

Returns
the modifiers of this shape symbol that can have a value associated with it.

◆ getNode()

virtual std::shared_ptr< MilitarySymbologyNode > luciad::MilitarySymbol::getNode ( ) const
pure virtual

Returns the symbology node that is represented by this symbol.

Returns
the symbology node that is represented by this symbol.
Since
2020.1

◆ getPossibleValues()

virtual std::optional< std::vector< std::string > > luciad::MilitarySymbol::getPossibleValues ( Modifier  modifier) const
pure virtual

Returns the possible values for a given modifier, if applicable.

Parameters
modifierthe modifier whose values to return
Returns
the possible values for a given modifier, or std::nullopt if the possible values cannot be enumerated.

◆ getSIDCModifiers()

virtual std::unordered_set< Modifier > luciad::MilitarySymbol::getSIDCModifiers ( ) const
pure virtual

Returns the collection of the possible SIDC modifiers of this symbol, e.g.

the affiliation, status, and so on.

Returns
the collection of the possible SIDC modifiers of this symbol, e.g. the affiliation, status, and so on.

◆ getStandard()

virtual MilitarySymbology::Standard luciad::MilitarySymbol::getStandard ( ) const
pure virtual

Returns the symbology standard of this symbol.

Returns
the symbology standard of this symbol.

◆ getTextModifiers()

virtual std::unordered_set< Modifier > luciad::MilitarySymbol::getTextModifiers ( ) const
pure virtual

Returns the collection of the possible text modifiers of this symbol.

There are the modifiers that are not encoded in the symbol code.

Returns
the collection of the possible text modifiers of this symbol.

◆ getValue()

virtual std::optional< std::string > luciad::MilitarySymbol::getValue ( Modifier  modifier) const
pure virtual

Returns the value for the given modifier.

Accepts both SIDC and text modifiers.

Parameters
modifierthe modifier for which the value needs to be returned
Returns
the value associated to the given modifier (or std::nullopt if no value is associated with it)
Exceptions
luciad::InvalidArgumentExceptionwhen the modifier is invalid (the modifier is not part of the symbology).

◆ putValue()

virtual void luciad::MilitarySymbol::putValue ( Modifier  modifier,
std::string  value 
)
pure virtual

Sets the given (modifier,value) pair.

Accepts both SIDC and text modifiers.

Multi-valued modifiers should be specified by joining the values with a colon character. For instance "value1" and "value2" should be combined as "value1:value2".

Parameters
modifierthe key that identifies the text modifier
valuethe value that will be associated with the text modifier
Exceptions
luciad::InvalidArgumentExceptionwhen the modifier is invalid (the modifier is not part of the symbology or the value is not part of the acceptable values).

◆ resetValue()

virtual void luciad::MilitarySymbol::resetValue ( Modifier  modifier)
pure virtual

Resets the value associated with the given modifier.

If the modifier denotes an SIDC modifier, the value is reset to the default value, while for text modifiers, the associated value is simply removed (if any).

Parameters
modifierthe key that identifies the text modifier.
Exceptions
luciad::InvalidArgumentExceptionwhen the modifier is invalid (the modifier is not part of the symbology).

◆ toIcon()

virtual std::shared_ptr< IIcon > luciad::MilitarySymbol::toIcon ( std::shared_ptr< MilitarySymbolStyle style) const
pure virtual

Creates an icon based on this military symbol and the given style.

Once this military symbol icon is created, its luciad::Image can be easily obtained using an luciad::IIconPainter. The following snippet shows an example:

std::string code = "SFSPCLCC-------";
auto symbol = MilitarySymbol::create(standard, code);
auto defaultStyle = MilitarySymbolStyle::newBuilder().build();
auto symbolType = symbol->getNode()->getSymbolType();
auto icon = symbol->toIcon(defaultStyle);
auto displayScale = 1.0;
auto painter = icon->createPainter(IconPainterContext(displayScale));
auto image = painter->paint();
// ...
}
Contains context information for painting the icon.
Definition: IIcon.h:98
std::shared_ptr< MilitarySymbolStyle > build()
Creates a new MilitarySymbolStyle with the properties set on this builder.
static Builder newBuilder()
Creates a new builder for creating a MilitarySymbolStyle.
@ App6b
Constant for APP 6 revision B.
@ Icon
The symbol is represented by a single icon.
Parameters
stylethe styling settings for visualizing this military symbol.
Returns
this military symbol icon.
Exceptions
luciad::LogicExceptionwhen this military symbol is not an MilitarySymbologyNode::SymbolType::Icon.
luciad::NullArgumentExceptionwhen passing nullptr for the style.
Since
2023.0