VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtMilStdSymbol.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2026 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
6 // This C++ implementation was translated from the original Javascript code by
7 // Mans Beckman - www.spatialillusions.com. The original Javascript code is
8 // licensed under the MIT License found below.
9 /******************************************************************************
10 ** The MIT License (MIT)
11 **
12 ** Copyright (c) 2017 Mans Beckman - www.spatialillusions.com
13 **
14 ** Permission is hereby granted, free of charge, to any person obtaining a copy
15 ** of this software and associated documentation files (the "Software"), to deal
16 ** in the Software without restriction, including without limitation the rights
17 ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18 ** copies of the Software, and to permit persons to whom the Software is
19 ** furnished to do so, subject to the following conditions:
20 **
21 ** The above copyright notice and this permission notice shall be included in all
22 ** copies or substantial portions of the Software.
23 **
24 ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25 ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27 ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29 ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 ** SOFTWARE.
31 ******************************************************************************/
32 
33 #pragma once
34 
35 #include <vrvMilStd/vrvMilStd.h>
36 
38 
40 
41 #include <string>
42 #include <map>
43 
44 namespace makVrv
45 {
46 
52  {
53  public:
56  DtMilStdSymbol(const std::string& sidc);
57 
59  void parse();
60 
62  const std::string& sidc() const { return mySIDCString; }
63 
65  DtStandardIdentity standardIdentity() const { return myStandardIdentity; }
66 
68  DtContext context() const { return myContext; }
69 
71  DtHqTfDummy hqtf() const { return myHqtf; }
72 
74  DtEchelonMobilityTowed echelonMobility() const { return myEchelonMobility; }
75 
77  int modifier1() const { return myModifier1; }
78 
80  int modifier2() const { return myModifier2; }
81 
83  DtSymbolSet symbolSet() const { return mySymbolSet; }
84 
86  DtStatus status() const { return myStatus; }
87 
89  const std::string& functionCode() const { return myFunctionCodeString; }
90 
95  void setMilStandard(DtSymbologyStandard standard);
96 
98  DtSymbologyStandard milStandard() const { return myMilStandard; }
99 
102  void setSize(int size);
103  int size() const { return mySize; }
105 
108  void setFilled(bool filled) { myFilled = filled; }
109  bool filled() const { return myFilled; }
111 
114  void setFramed(bool framed) { myFramed = framed; }
115  bool framed() const { return myFramed; }
117 
120  void setScale(double scale) { myScale = scale; }
121  double scale() const { return myScale; }
123 
126  void setUniqueDesignation(const std::string& text) { myUniqueDesignation = text; }
127  const std::string& uniqueDesignation() const { return myUniqueDesignation; }
129 
132  void setHigherFormation(const std::string& text) { myHigherFormation = text; }
133  const std::string& higherFormation() const { return myHigherFormation; }
135 
138  void setQuantity(const std::string& text) { myQuantity = text; }
139  const std::string& quantity() const { return myQuantity; }
141 
144  void setColorMode(DtColorMode mode) { myColorMode = mode; }
145  DtColorMode colorMode() const { return myColorMode; }
147 
150  void setFrameOutlineColorOverride(uint32_t color) { myFrameOutlineColorOverride = color; }
151  uint32_t frameOutlineColorOverride() const { return myFrameOutlineColorOverride; }
153 
156  void setFrameFillColorOverride(uint32_t color) { myFrameFillColorOverride = color; }
157  uint32_t frameFillColorOverride() const { return myFrameFillColorOverride; }
159 
162  void setIconColorOverride(uint32_t color) { myIconColorOverride = color; }
163  uint32_t iconColorOverride() const { return myIconColorOverride; }
165 
168  void setAlphaOverride(uint8_t a) { myAlphaOverride = a; }
169  uint8_t alphaOverride() const { return myAlphaOverride; }
171 
173  bool hasTopHat() const;
174 
176  bool hasBottomHat() const;
177 
183  bool hasExtendedTop() const;
184 
186  bool isDecorated() const { return hasTopHat() || hasBottomHat() || hasExtendedTop(); }
187 
189  int topHatSize() const;
190 
192  int bottomHatSize() const;
193 
195  int renderHeight() const { return size() + topHatSize() + bottomHatSize(); }
196 
199  void setColorScheme(const DtColorScheme& scheme);
200  DtColorScheme colorScheme() const;
202 
204  bool isCivilian() const;
205 
207  bool isValid() const { return myIsValidFlag; }
208 
210  const std::string& error() const { return myErrorString; }
211 
213  DtPoint anchor() const;
214 
216  int overrideIndex() const { return myOverrideIndex; }
217 
219  void setOverrideIndex( int index ) { myOverrideIndex = index; }
220 
224  void setHighlighted( bool highlighted ) { myHighlighted = highlighted; }
225  bool highlighted() const { return myHighlighted; }
227 
233 
234  protected:
236  void validateSIDC();
237  void extractComponents();
238 
239  protected:
240  std::string mySIDCString;
241 
249  std::string myFunctionCodeString;
252 
254 
256 
258 
260 
263 
266  std::string myErrorString;
267 
269  int mySize;
270  bool myFilled;
271  bool myFramed;
272  double myScale;
273  std::string myUniqueDesignation;
274  std::string myHigherFormation;
275  std::string myQuantity;
277  uint32_t myFrameOutlineColorOverride;
305  };
306 
307 } // namespace makVrv
Definition: DtMilStdTypes.h:205
void setScale(double scale)
Set/Get the additional scale factor applied at render time.
Definition: DtMilStdSymbol.h:120
int myOverrideIndex
SVG override entry index; -1 = no override.
Definition: DtMilStdSymbol.h:255
const std::string & error() const
Return the error description when isValid() is false.
Definition: DtMilStdSymbol.h:210
DtSymbolSet symbolSet() const
Return the symbol set (SIDC positions 5-6).
Definition: DtMilStdSymbol.h:83
bool myFramed
Include the affiliation frame.
Definition: DtMilStdSymbol.h:271
uint8_t myAlphaOverride
Ghost alpha override: 0 = fully transparent, 255 = fully opaque.
Definition: DtMilStdSymbol.h:304
DtEchelonMobilityTowed
MIL-STD-2525D Table A-8 amplifier descriptor codes for SIDC positions 9-10.
Definition: DtMilStdTypes.h:146
void setUniqueDesignation(const std::string &text)
Set/Get the unique designation label text.
Definition: DtMilStdSymbol.h:126
int modifier1() const
Return the modifier 1 code (SIDC positions 17-18) as an integer.
Definition: DtMilStdSymbol.h:77
std::string myHigherFormation
Higher formation label text.
Definition: DtMilStdSymbol.h:274
bool isDecorated() const
Return true when any decoration extends beyond the base symbol frame.
Definition: DtMilStdSymbol.h:186
uint32_t myIconColorOverride
ABGR colour override for the icon.
Definition: DtMilStdSymbol.h:298
void setAlphaOverride(uint8_t a)
Set/Get the ghost alpha override; 255 = fully opaque (no ghosting).
Definition: DtMilStdSymbol.h:168
DtStatus status() const
Return the status from SIDC position 7.
Definition: DtMilStdSymbol.h:86
bool myIsValidFlag
Validation.
Definition: DtMilStdSymbol.h:265
std::string myErrorString
Definition: DtMilStdSymbol.h:266
void setFrameFillColorOverride(uint32_t color)
Set/Get the affiliation fill colour override (ABGR); 0 means use the standard colour.
Definition: DtMilStdSymbol.h:156
voidpf void uLong size
Definition: ioapi.h:39
bool filled() const
Set/Get whether the symbol frame is filled.
Definition: DtMilStdSymbol.h:109
void setHigherFormation(const std::string &text)
Set/Get the higher formation label text.
Definition: DtMilStdSymbol.h:132
DtSymbologyStandard milStandard() const
Return the military symbology standard.
Definition: DtMilStdSymbol.h:98
void setHighlighted(bool highlighted)
Set/Get whether the symbol is rendered in its highlight state. Set by DtMilStdManager::buildSymbol() ...
Definition: DtMilStdSymbol.h:224
bool myHighlighted
True when rendered in the highlight state; set from the key&#39;s H segment.
Definition: DtMilStdSymbol.h:257
DtEchelonMobilityTowed myEchelonMobility
Definition: DtMilStdSymbol.h:248
DtSymbolSet mySymbolSet
Definition: DtMilStdSymbol.h:245
DtHqTfDummy myHqtf
Definition: DtMilStdSymbol.h:247
DtContext myContext
Parsed SIDC components.
Definition: DtMilStdSymbol.h:243
uint32_t frameOutlineColorOverride() const
Set/Get the frame outline colour override (ABGR); 0 means use the standard colour.
Definition: DtMilStdSymbol.h:151
bool highlighted() const
Set/Get whether the symbol is rendered in its highlight state. Set by DtMilStdManager::buildSymbol() ...
Definition: DtMilStdSymbol.h:225
const std::string & quantity() const
Set/Get the quantity label text.
Definition: DtMilStdSymbol.h:139
uint32_t frameFillColorOverride() const
Set/Get the affiliation fill colour override (ABGR); 0 means use the standard colour.
Definition: DtMilStdSymbol.h:157
int myModifier1
Definition: DtMilStdSymbol.h:250
double myScale
Additional scale factor applied at render time.
Definition: DtMilStdSymbol.h:272
DtStatus myStatus
Definition: DtMilStdSymbol.h:246
bool isValid() const
Return true when the SIDC was parsed successfully.
Definition: DtMilStdSymbol.h:207
DtColorMode
Definition: DtMilStdTypes.h:72
Contains various enum classes relating to symbology.
void setIconColorOverride(uint32_t color)
Set/Get the icon colour override (ABGR); 0 means use the standard colour.
Definition: DtMilStdSymbol.h:162
int myModifier2
Definition: DtMilStdSymbol.h:251
#define DT_DLL_VRVMILSTD
Definition: vrvMilStd.h:20
DtEchelonMobilityTowed echelonMobility() const
Return the echelon/mobility/towed-array code from SIDC positions 9-10.
Definition: DtMilStdSymbol.h:74
std::string myFunctionCodeString
Definition: DtMilStdSymbol.h:249
int mySize
Symbol Options.
Definition: DtMilStdSymbol.h:269
std::string mySIDCString
Definition: DtMilStdSymbol.h:240
void setQuantity(const std::string &text)
Set/Get the quantity label text.
Definition: DtMilStdSymbol.h:138
DtOperationalConditionMode operationalConditionMode() const
Set/Get the operational condition display mode.
Definition: DtMilStdSymbol.h:231
DtColorScheme myColorScheme
Pre-built colour scheme; set by DtMilStdManager::buildSymbol().
Definition: DtMilStdSymbol.h:259
DtStandardIdentity standardIdentity() const
Return the standard identity (affiliation) from SIDC position 4.
Definition: DtMilStdSymbol.h:65
void setOverrideIndex(int index)
Set the SVG override entry index. Called by DtMilStdManager::buildSymbol().
Definition: DtMilStdSymbol.h:219
bool framed() const
Set/Get whether the affiliation frame is drawn.
Definition: DtMilStdSymbol.h:115
void setColorMode(DtColorMode mode)
Set/Get the fill colour palette (Light / Medium / Dark).
Definition: DtMilStdSymbol.h:144
int renderHeight() const
Return the total render height: size() + topHatSize() + bottomHatSize().
Definition: DtMilStdSymbol.h:195
void setOperationalConditionMode(DtOperationalConditionMode mode)
Set/Get the operational condition display mode.
Definition: DtMilStdSymbol.h:230
DtStatus
Definition: DtMilStdTypes.h:56
void setFilled(bool filled)
Set/Get whether the symbol frame is filled.
Definition: DtMilStdSymbol.h:108
DtSymbologyStandard myMilStandard
Symbology standard for icon geometry.
Definition: DtMilStdSymbol.h:253
DtStandardIdentity
Definition: DtMilStdTypes.h:44
DtContext
Definition: DtMilStdTypes.h:119
DtHqTfDummy
Definition: DtMilStdTypes.h:128
DtSymbologyStandard
Military symbology standard.
Definition: DtSymbologyEnums.h:18
int modifier2() const
Return the modifier 2 code (SIDC positions 19-20) as an integer.
Definition: DtMilStdSymbol.h:80
uint8_t alphaOverride() const
Set/Get the ghost alpha override; 255 = fully opaque (no ghosting).
Definition: DtMilStdSymbol.h:169
const char int mode
Definition: ioapi.h:38
const std::string & sidc() const
Return the normalised (dashes-stripped) SIDC string.
Definition: DtMilStdSymbol.h:62
DtSymbolSet
Definition: DtMilStdTypes.h:92
DtOperationalConditionMode
Operational Condition display mode for Damaged/Destroyed symbols.
Definition: DtMilStdTypes.h:85
DtOperationalConditionMode myOcMode
Current operational condition display mode.
Definition: DtMilStdSymbol.h:262
std::string myQuantity
Quantity label text.
Definition: DtMilStdSymbol.h:275
int overrideIndex() const
Return the SVG override entry index, or -1 if no override applies.
Definition: DtMilStdSymbol.h:216
const std::string & higherFormation() const
Set/Get the higher formation label text.
Definition: DtMilStdSymbol.h:133
DtStandardIdentity myStandardIdentity
Definition: DtMilStdSymbol.h:244
uint32_t myFrameFillColorOverride
ABGR colour override for the affiliation fill area.
Definition: DtMilStdSymbol.h:290
double scale() const
Set/Get the additional scale factor applied at render time.
Definition: DtMilStdSymbol.h:121
int size() const
Set/Get the symbol canvas size.
Definition: DtMilStdSymbol.h:103
void setFramed(bool framed)
Set/Get whether the affiliation frame is drawn.
Definition: DtMilStdSymbol.h:114
DtColorMode myColorMode
Fill colour palette (Light / Medium / Dark).
Definition: DtMilStdSymbol.h:276
Military symbol parsed from a SIDC string.
Definition: DtMilStdSymbol.h:51
DtHqTfDummy hqtf() const
Return the HQ/TF/Dummy bit-field from SIDC position 8.
Definition: DtMilStdSymbol.h:71
void setFrameOutlineColorOverride(uint32_t color)
Set/Get the frame outline colour override (ABGR); 0 means use the standard colour.
Definition: DtMilStdSymbol.h:150
const std::string & uniqueDesignation() const
Set/Get the unique designation label text.
Definition: DtMilStdSymbol.h:127
Contains DLL export macros.
Definition: DtMilStdTypes.h:188
std::string myUniqueDesignation
Unique designation label text.
Definition: DtMilStdSymbol.h:273
bool myFilled
Fill the symbol frame or outline only.
Definition: DtMilStdSymbol.h:270
const std::string & functionCode() const
Return the 6-digit function code string (SIDC positions 11-16).
Definition: DtMilStdSymbol.h:89
DtColorMode colorMode() const
Set/Get the fill colour palette (Light / Medium / Dark).
Definition: DtMilStdSymbol.h:145
DtContext context() const
Return the context (Reality/Exercise/Simulation) from SIDC position 3.
Definition: DtMilStdSymbol.h:68
uint32_t iconColorOverride() const
Set/Get the icon colour override (ABGR); 0 means use the standard colour.
Definition: DtMilStdSymbol.h:163

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)