![]() |
VR-Forces Developer's Guide
|
VR-Vantage can display MIL-STD-2525 control-measure graphics – linear and area tactical graphics such as Ambush, Block, Seize, and Withdraw – as first-class scenario elements.
This chapter explains how an application organizes those graphics into named, toggleable overlays, and how a plugin registers a new linear graphic geometry of its own.
Read this chapter if you write an application that places tactical graphics programmatically, or a plugin that extends the set of graphic shapes VR-Vantage knows how to draw. It focuses on the public API a toolkit developer calls; the internal vertex-generation and rendering machinery is not covered here.
The subsystem uses a small vocabulary that recurs throughout the API.
makVrv::vrvTacticalGraphicUtilities namespace.Four public classes carry the API surface a toolkit developer touches.
DtTacticalGraphicOverlayManager is a per-DtDe singleton. It owns the set of overlays, tracks which overlay each graphic belongs to, and emits signals as overlays and graphics are added, renamed, removed, or toggled. Retrieve it with DtTacticalGraphicOverlayManager::instance(de).
DtTacticalGraphicOverlay represents a single overlay. It manages membership (addGraphic(), removeGraphic()) and visibility (setVisible()) for the graphics it contains.
DtOverlayGeometryManager is a per-DtDe singleton that maps a shape name to a linear-geometry creator function. Applications rarely call it directly; it is the registration point plugins use to add new shapes. Retrieve it with DtOverlayGeometryManager::instance(de).
DtLineStyleGeometryManager plays the same role for 2D and 3D line-style geometry, exposing add2DLineStyle() and add3DLineStyle().
Each built-in shape is declared in its own header (for example DtOverlayGeometryBlock.h) as a free function plus a convenience macro. The header for the Block shape, for instance, declares vrvTacticalGraphicUtilities::createVertexAndLabelDataBlock() and the macro DtOverlayGeometryBlockCreator. These are not class hierarchies – they are plain functions bound into the geometry manager.
The overlay manager is the entry point for grouping and toggling graphics. Create an overlay, add graphics to it by unique ID, and control its visibility:
The manager also emits Boost signals – signal_overlayAdded, signal_tacticalGraphicAdded, signal_overlayVisibilityChanged, and others – so a GUI can stay synchronized with the overlay set without polling.
The shape and default styling of a tactical graphic are supplied by element definition files rather than hard-coded. Point VR-Vantage at your definition files through the application configuration:
DtVrvApplicationConfiguration::setTacticalGraphicsElementDefinitionHierFilesOrDirs() and the corresponding ...LeafFilesOrDirs() accessor register additional definition sources.DtElementDefinitionSettings::tacticalGraphicsElementDefinitionDirPath() reports the directory the definitions are loaded from.Prefer the data-driven path when you are adding new graphics that reuse an existing shape: author a definition and reference it by name. Reserve the programmatic geometry-registration path (below) for the case where you need a shape VR-Vantage does not already provide.
To teach VR-Vantage a new linear graphic shape, register a creator function with the geometry manager. A creator matches the signature
and returns true when it successfully populates the supplied model data with vertices and labels. Register a built-in shape using its convenience macro, or a shape of your own by binding your function:
Once registered, a graphic whose definition names "MyGraphic" resolves to your generator when its geometry is built. The 2D and 3D line-style variants follow the same pattern through DtLineStyleGeometryManager::add2DLineStyle() and add3DLineStyle(), using the Dt2DLineStyleGeometryByFireAxisCreator and Dt3DLineStyleGeometryByFireAxisCreator macros for the built-in ByFireAxis style.
The exampleTacticalGraphics example is a complete, buildable driver that creates overlays, builds tactical graphic elements, assigns their definitions, sets line, arrow, and fill styles, and adds the graphics to overlays. See exampleTacticalGraphics for the full walkthrough and source.