VR-Vantage
Loading...
Searching...
No Matches
14 - Tactical Graphic Overlays

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.

14.1 - Core Concepts

The subsystem uses a small vocabulary that recurs throughout the API.

  • Tactical graphic. A scenario graphic element identified by a DtUniqueID and drawn from a set of control points (for example, the three points that define a Block symbol). A tactical graphic behaves like any other scenario element; the tactical-graphics API is concerned only with how it is organized and what shape it draws.
  • Overlay. A named collection of tactical graphics that can be shown or hidden as a unit. Overlays let an operator group related graphics – for example, one overlay per phase of an operation – and toggle their visibility independently. Overlays are managed by DtTacticalGraphicOverlayManager.
  • Linear geometry creator. A function that converts a graphic's control points and definition into the vertex and label data that gives the graphic its shape. Each shape is registered by name with DtOverlayGeometryManager. The built-in shapes live in the makVrv::vrvTacticalGraphicUtilities namespace.
  • Line-style geometry. A parallel mechanism, managed by DtLineStyleGeometryManager, that supplies 2D and 3D geometry for line styles such as ByFireAxis.

14.2 - Class Roles

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.

14.3 - Organizing Graphics into Overlays

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:

using namespace makVrv;
// Create a named overlay.
overlayMgr.addOverlay("Phase 1");
// Add an existing tactical graphic (identified by its unique ID) to it.
DtTacticalGraphicOverlay* overlay = overlayMgr.findOverlay("Phase 1");
if (overlay != nullptr)
{
overlay->addGraphic(graphicId);
}
// Show or hide the whole overlay.
overlayMgr.setOverlayVisible("Phase 1", true);
// Mark it as the overlay that receives newly created graphics.
overlayMgr.setCurrentOverlay("Phase 1");
Holds information about the overlays managed by the Tactical Graphic Overlay Manager.
Definition DtTacticalGraphicOverlay.h:26
virtual void addGraphic(const DtUniqueID &id)
Adds a graphic to the overlay.
Definition DtTacticalGraphicOverlayManager.h:34
virtual void addOverlay(const std::string &name)
Creates a new overlay with the given name. Name must be not empty. emits signal_overlayAdded if overl...
static DtTacticalGraphicOverlayManager & instance(DtDe &de)
virtual void setOverlayVisible(const std::string &overlayName, bool flag)
virtual void setCurrentOverlay(const std::string &name)
virtual DtTacticalGraphicOverlay * findOverlay(const std::string &name) const
Finds the overlay associated with the given name.
Contains DtCreateSensorFieldOfViewCommand and DtCreateSensorFieldOfViewCommandCreator class declarati...
Definition DtGridLinesSettingsRecord.h:16

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.

14.4 - Data-Driven Definitions

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.

14.5 - Registering a Custom Linear Geometry

To teach VR-Vantage a new linear graphic shape, register a creator function with the geometry manager. A creator matches the signature

using LinearCreateFunction = std::function<bool(const makVrv::DtLinearModelData&)>;
Definition DtOverlayLinearModel.h:27

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:

using namespace makVrv;
// Register a built-in shape by name.
// Register a custom shape.
bool createMyGraphic(const DtLinearModelData& data); // your generator
"MyGraphic",
boost::bind(&createMyGraphic, boost::placeholders::_1));
#define DtOverlayGeometryBlockCreator
Define that can be used to reference the function to supply to the DtOverlayGeometryManager.
Definition DtOverlayGeometryBlock.h:41
Definition DtOverlayGeometryManager.h:28
virtual void addLinearCreate(const std::string &, LinearCreateFunction)
Registers a generation function for an overlay model. Overwrites if one exists.
static DtOverlayGeometryManager & instance(DtDe &de)
Get the creator instance for this IG object.

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.

14.6 - Complete Example

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.

14.7 - Related Reference