![]() |
VR-Forces Developer's Guide
|
Complete MIL-STD geometry registry loaded from JSON files.
DtMilStdJsonRegistry is a concrete subclass of DtMilStdJsonRegistryBase that loads, caches, and serves all parsed MIL-STD SVG geometry for a single simulation. It covers frames, status overlays, context decorators, HQ/TF/Dummy overlays, echelon marks, icon bodies, and modifier 1/2 symbols.
``` DtMilStdJsonRegistry* reg = new DtMilStdJsonRegistry(); reg->load(dataDir); // parse all JSON files DtMilStdJsonRegistry::registerInstance(de, reg); // attach to DtDe ... DtMilStdJsonRegistry& r = DtMilStdJsonRegistry::instance(de); // retrieve auto paths = r.buildFramePaths(ssId, stdId, colors, center, size); ```
All geometry is stored in 200x200 space centred at (100,100). build*Paths() methods scale to render space internally with sc = size / 200.0. Callers always receive final DtDrawPath vectors in render-space pixels - raw coordinates are an internal implementation detail.
Most internal unordered_map containers are keyed by makeKey(ssId, stdId), which evaluates to ssId * 100 + stdId.
Each frame entry in the JSON can carry up to three LayerKind sub-layers:
Not thread-safe. Do not call load() concurrently with any build*Paths() call.

Classes | |
| struct | ContextDecoratorDef |
| struct | EchelonCodeDef |
| struct | EchelonMark |
| struct | ExtraGroup |
| struct | ExtraPathDef |
| struct | HqtfOverlayData |
| struct | IconItem |
| struct | LayerDef |
| struct | NamePair |
| struct | PolylineSet |
Public Types | |
| enum | LayerKind { LayerKind::Frame, LayerKind::Dashed, LayerKind::Decorator } |
Static Public Member Functions | |
| static DtMilStdJsonRegistry & | instance (DtDe &de) |
| static void | registerInstance (DtDe &de, DtMilStdJsonRegistry *registry) |
| static const std::string & | instanceName () |
| static int | makeKey (int ssId, int stdId) |
Protected Types | |
| using | ModifierDataMap = std::unordered_map< int, std::unordered_map< int, std::vector< IconItem >>> |
| using | NameMap = std::unordered_map< int, std::unordered_map< std::string, NamePair >> |
Protected Member Functions | |
| void | appendPolylineSet (const PolylineSet &ps, DtDrawPath templateDp, const DtPoint ¢er, double sc, std::vector< DtDrawPath > &result) const |
| virtual std::vector< std::string > | symbolSetEntries () const |
| virtual std::vector< int > | standardIdentityIds () const |
| bool | loadFrameJson (const std::string &dataDir) |
| bool | loadStatusJson (const std::string &dataDir) |
| bool | loadContextJson (const std::string &dataDir) |
| bool | loadHqtfJson (const std::string &dataDir) |
| bool | loadEchelonJson (const std::string &dataDir) |
| bool | loadIconJson (const std::string &dataDir) |
| bool | loadModifier1Json (const std::string &dataDir) |
| bool | loadModifier2Json (const std::string &dataDir) |
| bool | loadModifierJson (const std::string &filePath, ModifierDataMap &outData, NameMap &outNames) |
| std::vector< DtDrawPath > | buildModifierPaths (const ModifierDataMap &data, int ssId, int stdId, int modCode, const DtColorScheme &colors, const DtPoint ¢er, double size) const |
Protected Member Functions inherited from makVrv::DtMilStdJsonRegistryBase | |
| virtual bool | openAndParse (const std::string &filePath, rapidjson::Document &doc) const |
| virtual bool | setAndValidateVersions (const rapidjson::Document &doc, const std::string &filePath) |
| virtual bool | requireField (const rapidjson::Value &obj, const char *fieldName, const std::string &context) const |
| virtual bool | validateStructure (const rapidjson::Document &doc, const std::string &filePath, int version) const |
Static Protected Member Functions | |
| static DtPoint | scalePoint (const DtPoint &p, const DtPoint ¢er, double sc) |
|
protected |
|
protected |
Per-symbol-set map from code string to NamePair.
|
strong |
The three kinds of frame sub-layer stored per (ssId x stdId) frame entry.
|
default |
|
inlineoverridevirtual |
Return the class name used in warning messages.
Implements makVrv::DtMilStdJsonRegistryBase.
|
static |
Retrieve the registry registered on de.
|
static |
Register registry on de (takes ownership).
|
static |
Return the canonical instance name used with DtDe::findInstance().
| bool makVrv::DtMilStdJsonRegistry::load | ( | const std::string & | dataDir | ) |
Load all milstd_*.json files from dataDir.
Safe to call more than once (replaces the existing registry). Returns true on success; prints a message to stderr and returns false if a file cannot be opened or contains a parse error.
| const std::vector<LayerDef>& makVrv::DtMilStdJsonRegistry::frameLayers | ( | int | ssId, |
| int | stdId | ||
| ) | const |
Return pre-parsed LayerDefs for (ssId, stdId).
| ssId | Symbol-set integer (e.g. 1 = Air, 10 = LandUnit, 36 = MineWarfare). |
| stdId | Standard-identity digit from SIDC position 4 (0 = Pending ... 6 = Hostile). |
Returns a reference to an empty vector if the combination is not found in the loaded JSON.
| bool makVrv::DtMilStdJsonRegistry::isFrameFilled | ( | DtSymbolSet | ss, |
| DtStandardIdentity | si | ||
| ) | const |
Query whether a symbol set's frame is filled for the given standard identity.
Checks the loaded frame layers for the specified (ss, si) pair. Returns true when the primary Frame-kind layer has geometry.filled == true (i.e. fillopacity > 0 in the source JSON). Returns true by default when no frame data is found (most symbol sets have filled frames).
| ss | Symbol set. |
| si | Standard identity. |
| std::vector<DtDrawPath> makVrv::DtMilStdJsonRegistry::buildFramePaths | ( | DtSymbolSet | ss, |
| DtStandardIdentity | si, | ||
| const DtColorScheme & | colors, | ||
| const DtPoint & | center, | ||
| double | size | ||
| ) | const |
Build render-ready DrawPaths for the given symbol parameters.
Applies the DtColorScheme and scales the stored 200-unit geometry into render-space coordinates centred at center.
| ss | Symbol set. |
| si | Standard identity. |
| colors | Affiliation colour scheme from DtMilStdSymbol::colorScheme(). |
| center | Pixel centre of the symbol in the output canvas. |
| size | Symbol size in pixels (same as DtMilStdSymbol::mySize). |
| std::vector<DtDrawPath> makVrv::DtMilStdJsonRegistry::buildStatusPaths | ( | DtStatus | status, |
| DtSymbolSet | ss, | ||
| DtStandardIdentity | si, | ||
| const DtColorScheme & | colors, | ||
| const DtPoint & | center, | ||
| double | size, | ||
| DtOperationalConditionMode | ocMode = DtOperationalConditionMode::AlternateColorBar |
||
| ) | const |
Build status overlay DrawPaths (drawn between frame and icon).
DtStatus 0: empty - no overlay. DtStatus 1: re-draws the primary frame layer with a dashed stroke. DtStatus 2-5: capability bar below the symbol, or MineWarfare damage marks (slash / X cross) for symbol set 36.
| statusCode | SIDC status digit (0-7). |
| ssId | Symbol-set integer. |
| stdId | Standard-identity digit. |
| colors | Affiliation colour scheme. |
| center | Pixel centre of the symbol. |
| size | Symbol size in pixels. |
| ocMode | Operational condition display mode; AlternateColorBar draws Table 1-4 colour bars (default), Amplifier draws Table 1-3 slash/X marks. |
| std::vector<DtDrawPath> makVrv::DtMilStdJsonRegistry::buildContextPaths | ( | DtContext | ctx, |
| DtSymbolSet | ss, | ||
| DtStandardIdentity | si, | ||
| const DtColorScheme & | colors, | ||
| const DtPoint & | center, | ||
| double | size | ||
| ) | const |
Build context decorator DrawPaths.
DtContext 0 (Reality): empty. DtContext 1 (Exercise): letter "X" (or "J"/"K" for Suspect/Hostile) right of the frame, plus extra frame-outline paths for some stdIds. DtContext 2 (Simulation): letter "S" right of the frame.
| ctx | Context. |
| ss | Symbol set. |
| si | Standard identity. |
| colors | Affiliation colour scheme. |
| center | Pixel centre of the symbol. |
| size | Symbol size in pixels. |
| std::vector<DtDrawPath> makVrv::DtMilStdJsonRegistry::buildHqtfPaths | ( | DtHqTfDummy | hqtf, |
| DtSymbolSet | ss, | ||
| DtStandardIdentity | si, | ||
| const DtColorScheme & | colors, | ||
| const DtPoint & | center, | ||
| double | size | ||
| ) | const |
Build HQ/TF/Dummy overlay DrawPaths.
hqtfCode is a bit-field from SIDC digit 8: bit 0 (& 1): Feint/Dummy - dashed V-shape above the symbol. bit 1 (& 2): Headquarters - staff line below the symbol. bit 2 (& 4): Task Force - open bracket above the symbol. hqtfCode == 0 returns an empty vector.
| hqtf | HQ/TF/Dummy value. |
| ss | Symbol set. |
| si | Standard identity. |
| colors | Affiliation colour scheme. |
| center | Pixel centre of the symbol. |
| size | Symbol size in pixels. |
| std::vector<DtDrawPath> makVrv::DtMilStdJsonRegistry::buildEchelonPaths | ( | DtEchelonMobilityTowed | echelon, |
| DtSymbolSet | ss, | ||
| DtStandardIdentity | si, | ||
| const DtColorScheme & | colors, | ||
| const DtPoint & | center, | ||
| double | size | ||
| ) | const |
Build DtEchelonMobilityTowed overlay DrawPaths.
Echelon/mobility marks appear above/inside the frame (SIDC digits 9-10). An empty echelonCode (or code "00") returns an empty vector.
| echelon | Echelon/mobility/towed-array code. |
| ss | Symbol set. |
| si | Standard identity. |
| colors | Affiliation colour scheme. |
| center | Pixel centre of the symbol. |
| size | Symbol size in pixels. |
| std::vector<DtDrawPath> makVrv::DtMilStdJsonRegistry::buildIconPaths | ( | DtSymbolSet | ss, |
| const std::string & | functionCode, | ||
| const DtColorScheme & | colors, | ||
| const DtPoint & | center, | ||
| double | size, | ||
| DtSymbologyStandard | standard = DtSymbologyStandard::MilStd2525D, |
||
| DtStandardIdentity | si = DtStandardIdentity::Friend |
||
| ) | const |
Build icon DrawPaths for a given symbol set and function code.
Returns an empty vector if the function code is not present in the loaded data for that symbol set.
| ss | Symbol set. |
| functionCode | 6-digit zero-padded function code string (e.g. "110100"). |
| colors | Affiliation colour scheme. |
| center | Pixel centre of the symbol. |
| size | Symbol size in pixels. |
| standard | Symbology standard; selects APP-6D geometry when available. |
| si | Standard identity; selects per-affiliation geometry for frame-following icons. Default Friend. |
| std::vector<DtDrawPath> makVrv::DtMilStdJsonRegistry::buildModifier1Paths | ( | DtSymbolSet | ss, |
| DtStandardIdentity | si, | ||
| int | modCode, | ||
| const DtColorScheme & | colors, | ||
| const DtPoint & | center, | ||
| double | size | ||
| ) | const |
Build modifier 1 DrawPaths for a given symbol set and modifier code.
| ss | Symbol set. |
| si | Standard identity. |
| modCode | Modifier code integer (0 = none). |
| colors | Affiliation colour scheme. |
| center | Pixel centre of the symbol. |
| size | Symbol size in pixels. |
| std::vector<DtDrawPath> makVrv::DtMilStdJsonRegistry::buildModifier2Paths | ( | DtSymbolSet | ss, |
| DtStandardIdentity | si, | ||
| int | modCode, | ||
| const DtColorScheme & | colors, | ||
| const DtPoint & | center, | ||
| double | size | ||
| ) | const |
Build modifier 2 DrawPaths for a given symbol set and modifier code.
| ss | Symbol set. |
| si | Standard identity. |
| modCode | Modifier code integer (0 = none). |
| colors | Affiliation colour scheme. |
| center | Pixel centre of the symbol. |
| size | Symbol size in pixels. |
Compose the integer map key used by all internal (ssId x stdId) maps.
ssId is the MIL-STD symbol-set number (1-36); stdId is the standard-identity code (0-6). Multiplying by 100 avoids collisions because stdId is always less than 100 and the largest defined ssId (36) yields a maximum key of 3606.
| ssId | Symbol-set integer (e.g. 1 = Air, 10 = Land Unit, 36 = Mine Warfare). |
| stdId | Standard-identity digit (0 = Pending ... 6 = Hostile). |
|
protected |
Appends one DtDrawPath per sub-polyline in ps into result. templateDp carries pre-set style fields (colors, strokeWidth, etc.); commands and points are filled in from the polyline geometry. Empty sub-polylines are skipped.
|
protectedvirtual |
Returns the list of active symbol-set file-name suffixes recognised by this registry.
Each entry is a string such as "01_air" or "27_dismountedindividual". The first two characters are the zero-padded symbol-set id. Override in a subclass to add or remove symbol sets without altering any load method.
|
protectedvirtual |
Returns the list of standard-identity digit values recognised by this registry.
Values range from 0 to 6, corresponding to the standard-identity codes defined in MIL-STD-. Override in a subclass to restrict or extend the set of identities for which frame and icon data are loaded.
|
protected |
Reads milstd_standardidentity.json from dataDir; populates myFrameData.
|
protected |
Reads milstd_status.json; populates myBarData, myMineWarfareData, myOcAmplifierData, and myPlanned* fields.
|
protected |
Reads milstd_context.json; populates myContextData and myFrameX2.
|
protected |
Reads milstd_hqtf.json; populates myHqtfFeint, myHqtfHQ, and myHqtfTF.
|
protected |
Reads milstd_echelon.json; populates myEchelonData.
|
protected |
Reads all milstd_ss*.json symbol-set files; populates myIconData.
|
protected |
Reads milstd_modifier1.json; populates myModifier1Data.
|
protected |
Reads milstd_modifier2.json; populates myModifier2Data.
|
protected |
Loads modifier icon geometry from filePath into outData. Returns false and logs an error if the file cannot be opened or parsed.
|
protected |
Builds DrawPaths for a modifier icon selected from data. Returns an empty vector when modCode is 0 or not found.
Frame geometry: key = makeKey(ssId, stdId), value = ordered list of LayerDef sub-layers.
Always-empty sentinel returned when a (ssId, stdId) key is absent from myFrameData.
|
protected |
|
protected |
[stdId] true when no dashed re-draw is needed.
|
protected |
Stroke width for the dashed planned overlay.
|
protected |
SVG dash pattern, e.g. "8,12"; "" = solid.
|
protected |
Bar geometry; key = makeKey(ssId, stdId).
|
protected |
Stroke width for the bar outline.
|
protected |
[statusCode] Fill colour per status code (ABGR).
|
protected |
Geometry per status code.
|
protected |
Stroke width for damage marks.
|
protected |
Geometry per status code (3=Damaged, 4=Destroyed).
|
protected |
Stroke width for amplifier marks.
|
protected |
Right-edge x coordinate for each symbol set in 200-unit space; key = ssId. Used to position context letters.
|
protected |
Vertical baseline for context letters (200-unit space).
|
protected |
Font size for context letters (200-unit space).
|
protected |
bit 0 (hqtfCode & 1): Feint/Dummy - dashed V-shape above the symbol.
|
protected |
bit 1 (hqtfCode & 2): Headquarters - vertical staff line below the symbol.
|
protected |
bit 2 (hqtfCode & 4): Task Force - open bracket above the symbol.
|
protected |
< Echelon geometry; outer key = integer echelon code (e.g. 11 = Team, 16 = Battalion, 31 = Wheeled).
|
protected |
< Icon body geometry; outer key = ssId, inner key = 6-digit function code string (e.g. "110100").
|
protected |
Modifier 1 icon geometry.
|
protected |
Modifier 2 icon geometry.
|
protected |
Icon names; outer key = ssId, inner key = 6-digit function code.
|
protected |
Modifier 1 names; outer key = ssId, inner key = 2-char modifier code.
|
protected |
Modifier 2 names; outer key = ssId, inner key = 2-char modifier code.