VR-Engage  2.2
Loading...
Searching...
No Matches
makVre::DtMinimapUpdater Class Reference

Detailed Description

Creates, updates, and destroys a new channel, "Minimap", to display a 2D map in the main window. The minimap can be configured with multiple view modes, ownship indicators, compass overlays, and can be toggled on and off. It also adjusts visibility when binoculars are in use.

#include <minimapUpdater.h>

Inheritance diagram for makVre::DtMinimapUpdater:
[legend]

Classes

struct  ViewMode
 

Public Member Functions

 DtMinimapUpdater ()
 
virtual ~DtMinimapUpdater () override
 
virtual bool initialize (makVre::DtPlayerStation *player, makVre::DtInitTable &config) override
 
virtual bool postInitialize () override
 
virtual void tick (double dt) override
 
virtual void shutdown () override
 
virtual const char * type () const override
 
- Public Member Functions inherited from makVre::DtOverlayComponent
 DtOverlayComponent ()
 
virtual ~DtOverlayComponent () override
 
virtual makVrv::DtTextProxy * findTextByName (const std::string &name)
 
virtual void setTextVisible (const std::string &name, bool isVisible)
 
virtual void setAllElementGroups (int group)
 
- Public Member Functions inherited from makVre::DtPlayerComponent
 DtPlayerComponent ()
 
virtual ~DtPlayerComponent ()
 
virtual void setName (const std::string &name)
 
virtual const std::string & name ()
 
virtual DtPlayerStationplayer ()
 
virtual DtAttributeHandleplayerAttributeStore ()
 
virtual const DtAttributeHandleplayerAttributeStore () const
 

Protected Member Functions

virtual void createOverlay ()
 
virtual void handleUsingBinocularsChanged (bool usingBinoculars)
 
virtual void cycleMinimapMode ()
 
virtual DtVreMessageResult handleWindowCreated (DtVreMessage *msg)
 
virtual DtVreMessageResult handleWindowDestroyed (DtVreMessage *msg)
 
virtual DtVreMessageResult handleMinimapMessage (DtVreMessage *msg)
 
virtual void slot_onWindowConfigurationChanged (const std::string &deName, const std::string &windowName, const makVrv::DtWindowConfiguration &windowConfig)
 
virtual void createMinimap (const ViewMode &mode)
 
virtual void modifyMinimap (const ViewMode &mode)
 
virtual void destroyMinimap ()
 
virtual void registerHandlers ()
 
virtual void unregisterHandlers ()
 
virtual void addChannelEventProcessorAssociation ()
 
virtual void removeChannelEventProcessorAssociation ()
 
virtual void buildElements (DtInitTable &elements) override
 
virtual void getViewModeScreenCoordinates (const ViewMode &mode, double &left, double &right, double &bottom, double &top)
 
virtual void updateMinimapVisibility ()
 
virtual void showMinimap ()
 
virtual void hideMinimap ()
 
virtual void handleMapOverlayResized ()
 
virtual void setNodeMask (makVrv::DtCameraNode *node, unsigned int newMode, unsigned int currentExpected, bool setIfUnexpected=true)
 
- Protected Member Functions inherited from makVre::DtOverlayComponent
virtual void resolveTexts ()
 
virtual std::string getAttributeAsString (const std::string &attrName, const std::vector< std::string > &mappings)
 
virtual void handleOverlayResized ()
 
virtual void destroyElements ()
 
- Protected Member Functions inherited from makVre::DtPlayerComponent
virtual void initializeStateAttributes ()
 

Protected Attributes

std::vector< ViewModemyModes
 
unsigned int myCurrentMode
 
int myInitialMapScale
 
DtColor myFrameColor
 
double myFrameWidth
 
std::string myMinimapChannelName
 
std::string myWindowName
 
std::string myEventProcessorTargetChannel
 
bool myIsMinimapVisible
 
bool myDisableMinimap
 
bool myInitializeMinimapOnEngage
 
makVrv::DtOsgChannel * myMinimapChannel
 
double myMapWidth
 
double myMapHeight
 
double myReferenceHeight
 
std::string myOwnshipDotTextureFilename
 
std::string myOwnshipCompassTextureFilename
 
double myOwnshipDotSize
 
double myOwnshipCompassSize
 
DtColor myOwnshipDotColor
 
DtVrvOverlaymyMapOverlay
 
makVrv::DtQuadProxy * myOwnshipDotQuadProxy
 
makVrv::DtQuadProxy * myOwnshipCompassQuadProxy
 
float myInitialIconScale
 
unsigned int mySceneNodeMask
 
unsigned int myRttNodeMask
 
unsigned int myOverlayNodeMask
 
unsigned int myNormalizedOverlayNodeMask
 
- Protected Attributes inherited from makVre::DtOverlayComponent
DtVrvOverlaymyOverlay
 
std::vector< TextmyTexts
 
std::vector< makVrv::DtLineSegment * > myLines
 
std::vector< makVrv::DtQuadProxy * > myQuads
 
DtInitTable myElementConfig
 
- Protected Attributes inherited from makVre::DtPlayerComponent
std::string myName
 
DtInitTable myConfig
 
DtPlayerStationmyPlayer
 
makVrv::DtDe * myDe
 
DtEntityResolvermyResolver
 
DtAttributeCallbackManager myAttributeCallbacks
 

Constructor & Destructor Documentation

◆ DtMinimapUpdater()

makVre::DtMinimapUpdater::DtMinimapUpdater ( )

Constructor for DtMinimapUpdater.

Initializes component state with default values

◆ ~DtMinimapUpdater()

virtual makVre::DtMinimapUpdater::~DtMinimapUpdater ( )
overridevirtual

Virtual destructor for DtMinimapUpdater.

Member Function Documentation

◆ initialize()

virtual bool makVre::DtMinimapUpdater::initialize ( makVre::DtPlayerStation * player,
makVre::DtInitTable & config )
overridevirtual

Initializes the minimap updater component.

Parameters
playerPointer to the player station this component belongs to
configConfiguration table containing minimap settings
Returns
True if initialization succeeded, false otherwise

Processes configuration data and sets up the minimap channel based on the specified view modes. Configures position, size, frame properties, and ownship indicators.

Reimplemented from makVre::DtOverlayComponent.

References makVre::DtPlayerComponent::player().

◆ postInitialize()

virtual bool makVre::DtMinimapUpdater::postInitialize ( )
overridevirtual

Performs post-initialization tasks after all components are initialized.

Returns
True if post-initialization succeeded, false otherwise

Adds a callback to monitor changes to the binoculars state so the minimap can be hidden when binoculars are active

Reimplemented from makVre::DtOverlayComponent.

◆ tick()

virtual void makVre::DtMinimapUpdater::tick ( double dt)
overridevirtual

Called every frame to update the minimap.

Parameters
dtDelta time since the last frame in seconds

Updates the heading of the compass overlay to match the player's current heading when the minimap is displayed

Reimplemented from makVre::DtOverlayComponent.

◆ shutdown()

virtual void makVre::DtMinimapUpdater::shutdown ( )
overridevirtual

Shuts down the minimap updater component.

Destroys the minimap channel, cleans up resources, and removes callbacks and message handlers. Restores the original icon scale setting.

Reimplemented from makVre::DtOverlayComponent.

◆ type()

virtual const char * makVre::DtMinimapUpdater::type ( ) const
overridevirtual

Returns the type identifier for this component.

Returns
The type string for DtMinimapUpdater

Reimplemented from makVre::DtOverlayComponent.

◆ createOverlay()

virtual void makVre::DtMinimapUpdater::createOverlay ( )
protectedvirtual

Creates the overlay for displaying ownship indicators.

Sets up the VRV overlay that will contain the ownship dot and compass indicators on top of the minimap display

◆ handleUsingBinocularsChanged()

virtual void makVre::DtMinimapUpdater::handleUsingBinocularsChanged ( bool usingBinoculars)
protectedvirtual

Handles changes to the usingBinoculars attribute.

Parameters
usingBinocularsNew value of the usingBinoculars attribute

Shows or hides the minimap when the binoculars state changes, hiding the minimap when binoculars are in use

◆ cycleMinimapMode()

virtual void makVre::DtMinimapUpdater::cycleMinimapMode ( )
protectedvirtual

Switches to the next minimap view mode.

Cycles through the view modes defined in the configuration, updating the minimap's position, size, and visibility

◆ handleWindowCreated()

virtual DtVreMessageResult makVre::DtMinimapUpdater::handleWindowCreated ( DtVreMessage * msg)
protectedvirtual

Handles window creation messages.

Parameters
msgThe window created message
Returns
Message handling result indicating if the message was handled

Captures the minimap channel when it's created and sets up node masks and observer settings

◆ handleWindowDestroyed()

virtual DtVreMessageResult makVre::DtMinimapUpdater::handleWindowDestroyed ( DtVreMessage * msg)
protectedvirtual

Handles window destruction messages.

Parameters
msgThe window destroyed message
Returns
Message handling result indicating if the message was handled

Clears references to the destroyed minimap channel

◆ handleMinimapMessage()

virtual DtVreMessageResult makVre::DtMinimapUpdater::handleMinimapMessage ( DtVreMessage * msg)
protectedvirtual

Handles minimap-specific messages.

Parameters
msgThe minimap message (cycle or reset zoom)
Returns
Message handling result indicating if the message was handled

Processes messages to cycle minimap view modes or reset the zoom level

◆ slot_onWindowConfigurationChanged()

virtual void makVre::DtMinimapUpdater::slot_onWindowConfigurationChanged ( const std::string & deName,
const std::string & windowName,
const makVrv::DtWindowConfiguration & windowConfig )
protectedvirtual

Callback for window configuration change events.

Parameters
deNameName of the distributed environment
windowNameName of the window that changed
windowConfigNew window configuration

Updates the minimap channel's viewport when the window is resized to maintain the correct position and proportions

◆ createMinimap()

virtual void makVre::DtMinimapUpdater::createMinimap ( const ViewMode & mode)
protectedvirtual

Creates the minimap channel using the specified view mode.

Parameters
modeThe view mode configuration to use for the minimap

Creates a new minimap channel with the appropriate position and size

◆ modifyMinimap()

virtual void makVre::DtMinimapUpdater::modifyMinimap ( const ViewMode & mode)
protectedvirtual

Modifies an existing minimap channel using the specified view mode.

Parameters
modeThe view mode configuration to apply to the minimap

Updates the position, size, and visibility of the minimap channel

◆ destroyMinimap()

virtual void makVre::DtMinimapUpdater::destroyMinimap ( )
protectedvirtual

Destroys the minimap channel.

Removes the minimap channel from the window manager

◆ registerHandlers()

virtual void makVre::DtMinimapUpdater::registerHandlers ( )
protectedvirtual

Registers message handlers for minimap-related messages.

Sets up handlers for window creation/destruction and minimap control messages

◆ unregisterHandlers()

virtual void makVre::DtMinimapUpdater::unregisterHandlers ( )
protectedvirtual

Unregisters message handlers.

Removes all handlers for minimap-related messages

◆ addChannelEventProcessorAssociation()

virtual void makVre::DtMinimapUpdater::addChannelEventProcessorAssociation ( )
protectedvirtual

Adds channel event processor association.

Associates the minimap channel with a target channel for event processing

◆ removeChannelEventProcessorAssociation()

virtual void makVre::DtMinimapUpdater::removeChannelEventProcessorAssociation ( )
protectedvirtual

Removes channel event processor association.

Removes the association between the minimap channel and the target channel

◆ buildElements()

virtual void makVre::DtMinimapUpdater::buildElements ( DtInitTable & elements)
overrideprotectedvirtual

Builds frame elements around the minimap.

Parameters
elementsConfiguration table containing element definitions

Overrides the base class function to programmatically create a frame around the minimap based on the current view mode

Reimplemented from makVre::DtOverlayComponent.

◆ getViewModeScreenCoordinates()

virtual void makVre::DtMinimapUpdater::getViewModeScreenCoordinates ( const ViewMode & mode,
double & left,
double & right,
double & bottom,
double & top )
protectedvirtual

Calculates screen coordinates for a minimap view mode.

Parameters
modeThe view mode to calculate coordinates for
leftOutput parameter for the left coordinate
rightOutput parameter for the right coordinate
bottomOutput parameter for the bottom coordinate
topOutput parameter for the top coordinate

Calculates the actual screen coordinates for the minimap based on the view mode settings. If square is true, the right coordinate is adjusted to maintain a square aspect ratio. If visible is false, coordinates are set to place the channel off-screen.

◆ updateMinimapVisibility()

virtual void makVre::DtMinimapUpdater::updateMinimapVisibility ( )
protectedvirtual

Updates the minimap visibility based on current state.

Shows or hides the minimap only when the visibility state changes, avoiding redundant calls to showMinimap or hideMinimap

◆ showMinimap()

virtual void makVre::DtMinimapUpdater::showMinimap ( )
protectedvirtual

Shows the minimap by enabling rendering.

Restores the node masks for the minimap cameras to make the minimap visible

◆ hideMinimap()

virtual void makVre::DtMinimapUpdater::hideMinimap ( )
protectedvirtual

Hides the minimap by disabling rendering.

Sets the node masks for the minimap cameras to zero to hide the minimap

◆ handleMapOverlayResized()

virtual void makVre::DtMinimapUpdater::handleMapOverlayResized ( )
protectedvirtual

Handles resizing of the map overlay.

Adjusts the position and size of the ownship indicators when the map overlay is resized

◆ setNodeMask()

virtual void makVre::DtMinimapUpdater::setNodeMask ( makVrv::DtCameraNode * node,
unsigned int newMode,
unsigned int currentExpected,
bool setIfUnexpected = true )
protectedvirtual

Sets the node mask on a camera node.

Parameters
nodeThe camera node to modify
newModeThe new node mask to apply
currentExpectedThe expected current node mask
setIfUnexpectedWhether to set the mask if the current value is unexpected

Sets the node mask on the specified camera node, with validation to detect if the node mask has been changed by another component

Member Data Documentation

◆ myModes

std::vector<ViewMode> makVre::DtMinimapUpdater::myModes
protected

Collection of available minimap view modes.

◆ myCurrentMode

unsigned int makVre::DtMinimapUpdater::myCurrentMode
protected

Index of the currently active view mode.

◆ myInitialMapScale

int makVre::DtMinimapUpdater::myInitialMapScale
protected

Initial map scale to restore on shutdown.

◆ myFrameColor

DtColor makVre::DtMinimapUpdater::myFrameColor
protected

Color of the frame around the minimap.

◆ myFrameWidth

double makVre::DtMinimapUpdater::myFrameWidth
protected

Width of the frame around the minimap in pixels.

◆ myMinimapChannelName

std::string makVre::DtMinimapUpdater::myMinimapChannelName
protected

Name of the minimap channel.

◆ myWindowName

std::string makVre::DtMinimapUpdater::myWindowName
protected

Name of the window containing the minimap.

◆ myEventProcessorTargetChannel

std::string makVre::DtMinimapUpdater::myEventProcessorTargetChannel
protected

Name of the channel that will receive events from the minimap.

◆ myIsMinimapVisible

bool makVre::DtMinimapUpdater::myIsMinimapVisible
protected

Flag indicating if the minimap is currently visible.

◆ myDisableMinimap

bool makVre::DtMinimapUpdater::myDisableMinimap
protected

Flag indicating if the minimap is disabled.

◆ myInitializeMinimapOnEngage

bool makVre::DtMinimapUpdater::myInitializeMinimapOnEngage
protected

Flag indicating if the minimap should be created at engagement.

◆ myMinimapChannel

makVrv::DtOsgChannel* makVre::DtMinimapUpdater::myMinimapChannel
protected

Pointer to the OSG channel used for the minimap.

◆ myMapWidth

double makVre::DtMinimapUpdater::myMapWidth
protected

Width of the map in screen coordinates.

◆ myMapHeight

double makVre::DtMinimapUpdater::myMapHeight
protected

Height of the map in screen coordinates.

◆ myReferenceHeight

double makVre::DtMinimapUpdater::myReferenceHeight
protected

Reference height for sizing ownship indicators.

◆ myOwnshipDotTextureFilename

std::string makVre::DtMinimapUpdater::myOwnshipDotTextureFilename
protected

Filename of the texture for the ownship dot indicator.

◆ myOwnshipCompassTextureFilename

std::string makVre::DtMinimapUpdater::myOwnshipCompassTextureFilename
protected

Filename of the texture for the ownship compass indicator.

◆ myOwnshipDotSize

double makVre::DtMinimapUpdater::myOwnshipDotSize
protected

Size of the ownship dot indicator as a fraction of map height.

◆ myOwnshipCompassSize

double makVre::DtMinimapUpdater::myOwnshipCompassSize
protected

Size of the ownship compass indicator as a fraction of map height.

◆ myOwnshipDotColor

DtColor makVre::DtMinimapUpdater::myOwnshipDotColor
protected

Color of the ownship dot indicator.

◆ myMapOverlay

DtVrvOverlay* makVre::DtMinimapUpdater::myMapOverlay
protected

Overlay for displaying ownship indicators on the minimap.

◆ myOwnshipDotQuadProxy

makVrv::DtQuadProxy* makVre::DtMinimapUpdater::myOwnshipDotQuadProxy
protected

Quad proxy for the ownship dot indicator.

◆ myOwnshipCompassQuadProxy

makVrv::DtQuadProxy* makVre::DtMinimapUpdater::myOwnshipCompassQuadProxy
protected

Quad proxy for the ownship compass indicator.

◆ myInitialIconScale

float makVre::DtMinimapUpdater::myInitialIconScale
protected

Initial icon scale value to restore on shutdown.

◆ mySceneNodeMask

unsigned int makVre::DtMinimapUpdater::mySceneNodeMask
protected

Cached node mask for the scene camera.

◆ myRttNodeMask

unsigned int makVre::DtMinimapUpdater::myRttNodeMask
protected

Cached node mask for the RTT camera.

◆ myOverlayNodeMask

unsigned int makVre::DtMinimapUpdater::myOverlayNodeMask
protected

Cached node mask for the overlay camera.

◆ myNormalizedOverlayNodeMask

unsigned int makVre::DtMinimapUpdater::myNormalizedOverlayNodeMask
protected

Cached node mask for the normalized overlay camera.


The documentation for this class was generated from the following file: