VR-Engage  2.2
Loading...
Searching...
No Matches
instrumentPanelManager.h
Go to the documentation of this file.
1/******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4******************************************************************************/
5
6//! \file instrumentPanelManager.h
7//! \brief Provides management for instrument panels and specialized views in simulation environments
8
9#pragma once
10
12
14
16#include <vreUtil/vector2DI.h>
17
18namespace makVrv
19{
20class DtWindow;
21class DtChannel;
22class DtChannelManager;
23class DtInputDriver;
24class DtOsgSensorViewOverlaySectionCreator;
25} // namespace makVrv
26
27namespace makVre
28{
30
31//! \brief Manager for instrument panels, gimbal sensors, and specialized views
32//!
33//! The DtInstrumentPanelManager handles creation, modification, and deletion of
34//! extra channels, windows, or instrument panels used by various roles.
35//! For example:
36//! - Gimbaled Sensor and PVD views for fixed wing pilots
37//! - The guard house's security panel window
38//! - The launcher's scope channel
39//! - The render-to-texture channels used by the T-38 and M1A2 3D models
40//! Interaction with this class is mostly done through sending WindowOperationMessage events.
41//! The manager maintains mappings between entities and their associated panels/cameras,
42//! and provides functionality for controlling sensor modes and overlay elements.
44{
45public:
46 //! \brief Default constructor
47 //!
48 //! Initializes member variables to default values. Full initialization
49 //! occurs when the init method is called.
51
52 //! \brief Virtual destructor
53 //!
54 //! Cleans up any remaining panel structures and resources.
56
57 //! \brief Initializes the instrument panel manager
58 //!
59 //! Sets up message handlers, configures default settings for gimbal and plan views,
60 //! and adds default overlay creators.
61 //!
62 //! \param de Pointer to the rendering engine
63 //! \param app Pointer to the player station application
64 //! \param resolver Pointer to the entity resolver
65 //! \param windowConfig Configuration table containing window settings
66 virtual void init(makVrv::DtDe* de, DtPlayerStationApp* app, DtEntityResolver* resolver, DtInitTable windowConfig);
67
68 //! \brief Handles entity disengagement
69 //!
70 //! Cleans up resources associated with an entity when it's disengaged.
71 //!
72 //! \param id The identifier of the entity being disengaged
73 //! \return true if successful, false otherwise
74 virtual bool onDisengage(const DtEntityIdentifier& id);
75
76 //! \brief Retrieves the panel structure for a given entity
77 //!
78 //! \param id The entity identifier
79 //! \return Pointer to the panel structure or nullptr if not found
80 virtual DtPanelStruct* getPanelStruct(const DtEntityIdentifier& id) const;
81
82 //! \brief Retrieves a camera structure by name from a panel structure
83 //!
84 //! \param panelStruct The panel structure containing the camera
85 //! \param name The name of the camera to retrieve
86 //! \return Pointer to the camera structure or nullptr if not found
87 virtual DtCameraStruct* getCameraStruct(const DtPanelStruct* panelStruct, const std::string& name) const;
88
89 //! \brief Sets the sensor mode for an observer
90 //!
91 //! Attempts to set the sensor mode, and if the mode isn't found, tries
92 //! appending the configurable mode suffix.
93 //!
94 //! \param observer The observer to modify
95 //! \param modeName The name of the sensor mode to set
96 virtual void setObserverSensorMode(makVrv::DtObserver* observer, const std::string& modeName);
97
98 //! \brief Slot called on post-tick to check for pending field of view messages
99 //!
100 //! Processes pending stealth window creation messages when their
101 //! required fields of view become available.
102 virtual void slot_onPostTick();
103
104 //! \brief Slot called when a channel is about to be destroyed
105 //!
106 //! Performs necessary cleanup for the channel and updates associated panel structures.
107 //!
108 //! \param mgr The channel manager
109 //! \param channel The channel being destroyed
110 virtual void slot_channelToBeDestroyed(makVrv::DtChannelManager* mgr, makVrv::DtChannel* channel);
111
112 //! \brief Slot called when a window is about to be destroyed
113 //!
114 //! Performs necessary cleanup for the window and updates associated panel structures.
115 //!
116 //! \param window The window being destroyed
117 virtual void slot_WindowToBeDestroyed(makVrv::DtWindow* window);
118
119 //! \brief Handles entity removal messages
120 //!
121 //! Cleans up resources associated with an entity when it's removed.
122 //!
123 //! \param msg The entity removed message
124 //! \return Message handling result
126
127 //! \brief Sets whether to automatically disable HDR auto exposure on certain views
128 //!
129 //! \param value true to automatically disable HDR auto exposure, false to leave it as is
130 virtual void setAutoDisableHdrAutoExposure(bool value);
131
132 //! \brief Adds or replaces an overlay section creator
133 //!
134 //! Each key is mapped to a creator that can generate a specific overlay section
135 //! type for sensor views. This allows for configurable overlay sections.
136 //!
137 //! \param key The identifier for the overlay section type
138 //! \param creator The creator object for generating the overlay section
139 virtual void addOverlaySectionCreator(const std::string& key, makVrv::DtOsgSensorViewOverlaySectionCreator* creator);
140
141protected:
142 //! \brief Adds default overlay section creators
143 //!
144 //! Adds creators for the following keys:
145 //! - "Crosshair" - Displays 4 corners of a box
146 //! - "PlatformInfo" - Displays information about ownship entity
147 //! - "VrePlatformInfo" - Adds Date and Time displays to PlatformInfo
148 //! - "TargetInfo" - Displays ownship coordinates
149 //! - "VreTargetInfo" - Displays center of sensor's view coordinates
150 //! - "VreMgrsTargetInfo" - Displays coordinates in MGRS format
151 //! - "DisplayInfo" - Displays sensor view information
152 //! - "VreDisplayInfo" - Strips off sensor mode suffixes
153 //! - "Pitch" - Displays ladder showing sensor elevation
154 //! - "VrePitch" - Adds Pitch readout to arrow
155 //! - "Compass" - Displays sensor azimuth and platform heading
156 //! - "Reticle" - Displays cross in the middle of the screen
157 //! - "DateTime" - Displays date and time
158 //! - "Time" - Displays time only
159 //! - "Rec" - Displays static "REC" text
161
162 //! \brief Handles window operation messages
163 //!
164 //! Routes messages to the appropriate handler based on the operation type.
165 //!
166 //! \param msg The window operation message
167 //! \return Message handling result
169
170 //! \brief Handles messages to set gimbal overlay sections
171 //!
172 //! \param msg The message containing overlay section information
173 //! \return Message handling result
175
176 //! \brief Handles messages to restore gimbal overlay sections
177 //!
178 //! \param msg The message to restore overlay sections
179 //! \return Message handling result
181
182 //! \brief Handles messages to reassign panel ownership
183 //!
184 //! \param msg The message containing reassignment information
185 //! \return Message handling result
187
188 //! \brief Processes gimbal operations (create, destroy, modify)
189 //!
190 //! Handles creation, destruction, and modification of gimbal views for
191 //! Multi-function Displays (MFDs). Modification cycles through sensor modes.
192 //!
193 //! \param msg The window operation message
195
196 //! \brief Processes stealth operations
197 //!
198 //! \param msg The window operation message
200
201 //! \brief Processes plan view operations
202 //!
203 //! \param msg The window operation message
205
206 //! \brief Processes instrument panel operations
207 //!
208 //! \param msg The window operation message
210
211 //! \brief Creates a gimbal view
212 //!
213 //! \param msg The window operation message with gimbal creation parameters
215
216 //! \brief Destroys a gimbal view
217 //!
218 //! \param msg The window operation message identifying the gimbal to destroy
220
221 //! \brief Creates a plan view
222 //!
223 //! \param msg The window operation message with plan view creation parameters
225
226 //! \brief Destroys a plan view
227 //!
228 //! \param msg The window operation message identifying the plan view to destroy
230
231 //! \brief Creates an instrument panel
232 //!
233 //! \param msg The window operation message with instrument panel creation parameters
235
236 //! \brief Destroys an instrument panel
237 //!
238 //! \param msg The window operation message identifying the instrument panel to destroy
240
241 //! \brief Creates a render-to-texture instrument panel
242 //!
243 //! \param msg The window operation message with RTT panel creation parameters
245
246 //! \brief Destroys a render-to-texture instrument panel
247 //!
248 //! \param msg The window operation message identifying the RTT panel to destroy
250
251 //! \brief Creates a stealth window
252 //!
253 //! \param msg The window operation message with stealth window creation parameters
255
256 //! \brief Destroys a stealth window
257 //!
258 //! \param msg The window operation message identifying the stealth window to destroy
259 //! \param[out] destroyed Set to true if the window was successfully destroyed; false otherwise
260 virtual void destroyStealth(WindowOperationMessage* msg, bool& destroyed);
261
262 //! \brief Destroys all stealth windows
263 //!
264 //! \param msg The window operation message
266
267 //! \brief Handles minimap-related messages
268 //!
269 //! \param msg The minimap message
270 //! \return Message handling result
272
273 //! \brief Handles messages to set gimbal sensor mode
274 //!
275 //! \param msg The message containing sensor mode information
276 //! \return Message handling result
278
279 //! \brief Sets the current selection
280 //!
281 //! \param id The ID of the entity to select
282 virtual void setCurrentSelection(makVrv::DtUniqueID id);
283
284 //! \brief Clears the current selection
285 virtual void clearCurrentSelection();
286
287 //! \brief Finds or creates a panel structure for a given message
288 //!
289 //! \param msg The window operation message
290 //! \return Pointer to the panel structure
292
293 //! \brief Finds or creates a camera structure
294 //!
295 //! \param panelStruct The panel structure to add the camera to
296 //! \param cameraType The type of camera to create
297 //! \param name The name of the camera
298 //! \return Pointer to the camera structure
300 DtPanelStruct* panelStruct, DtCameraType cameraType, std::string name);
301
302 //! \brief Slot called when an observer is created
303 //!
304 //! Sets the observer name and sensor mode in the camera.
305 //!
306 //! \param inputDriver The input driver
307 //! \param observer The observer that was created
308 //! \param cameraStruct The camera structure to update
310 makVrv::DtInputDriver* inputDriver, makVrv::DtObserver* observer, DtCameraStruct* cameraStruct);
311
312 //! \brief Pointer to the rendering engine
313 makVrv::DtDe* myDe;
314
315 //! \brief Pointer to the player station application
317
318 //! \brief Pointer to the entity resolver
320
321 //! \brief Current sensor mode for gimbal views
323
324 //! \brief Default position for gimbal views
326
327 //! \brief Default size for gimbal views
329
330 //! \brief Resolution for plan views
332
333 //! \brief Default position for plan views
335
336 //! \brief Default size for plan views
338
339 //! \brief Map of entity identifiers to panel structures
340 using DtEntityPanelMap = std::map<DtEntityIdentifier, DtPanelStruct*>;
341
342 //! \brief Map storing all entity-panel associations
344
345 //! \brief Suffix to append when searching for observer modes
346 //!
347 //! If a requested observer mode can't be found, append
348 //! either " (CameraFX)" or " (SensorFX)" and search again.
350
351 //! \brief Storage for pending field of view messages
352 //!
353 //! Stores copies of messages when the required field
354 //! of view does not exist yet.
355 std::vector<WindowOperationMessage*> myPendingFieldOfView;
356
357 //! \brief Map of overlay section keys to their creator objects
358 //!
359 //! Maps string keys to DtOsgSensorViewOverlaySectionCreators, allowing
360 //! users to configure which overlay sections to use depending on
361 //! their role or entity.
362 using DtStringOverlayCreatorMap = std::map<std::string, makVrv::DtOsgSensorViewOverlaySectionCreator*>;
363
364 //! \brief Map storing all overlay section creators
366
367 //! \brief Flag to control HDR auto exposure behavior
368 //!
369 //! When true, HDR auto exposure will be automatically disabled for
370 //! certain types of views.
372};
373} // namespace makVre
Entity resolution and mapping system.
Definition entityResolver.h:52
Table-based access to Lua state for configuration data.
Definition initializer.h:38
virtual void processStealthOperation(WindowOperationMessage *msg)
Processes stealth operations.
virtual void clearCurrentSelection()
Clears the current selection.
int myPlanViewResolution
Resolution for plan views.
Definition instrumentPanelManager.h:331
virtual void destroyGimbal(WindowOperationMessage *msg)
Destroys a gimbal view.
std::string myObserverModeSuffix
Suffix to append when searching for observer modes.
Definition instrumentPanelManager.h:349
virtual void createGimbal(WindowOperationMessage *msg)
Creates a gimbal view.
virtual DtVreMessageResult handleWindowOperation(DtVreMessage *msg)
Handles window operation messages.
DtEntityPanelMap myEntityPanelMap
Map storing all entity-panel associations.
Definition instrumentPanelManager.h:343
std::map< std::string, makVrv::DtOsgSensorViewOverlaySectionCreator * > DtStringOverlayCreatorMap
Map of overlay section keys to their creator objects.
Definition instrumentPanelManager.h:362
virtual void setCurrentSelection(makVrv::DtUniqueID id)
Sets the current selection.
DtEntityResolver * myEntityResolver
Pointer to the entity resolver.
Definition instrumentPanelManager.h:319
DtInstrumentPanelManager()
Default constructor.
virtual ~DtInstrumentPanelManager()
Virtual destructor.
virtual DtVreMessageResult handleEntityRemoved(DtVreMessage *msg)
Handles entity removal messages.
std::string myGimbalViewSensorMode
Current sensor mode for gimbal views.
Definition instrumentPanelManager.h:322
virtual void slot_WindowToBeDestroyed(makVrv::DtWindow *window)
Slot called when a window is about to be destroyed.
virtual DtPanelStruct * findOrCreatePanelStruct(const WindowOperationMessage *msg)
Finds or creates a panel structure for a given message.
virtual void setObserverSensorMode(makVrv::DtObserver *observer, const std::string &modeName)
Sets the sensor mode for an observer.
std::vector< WindowOperationMessage * > myPendingFieldOfView
Storage for pending field of view messages.
Definition instrumentPanelManager.h:355
virtual void processInstrumentPanelOperation(WindowOperationMessage *msg)
Processes instrument panel operations.
virtual DtPanelStruct * getPanelStruct(const DtEntityIdentifier &id) const
Retrieves the panel structure for a given entity.
virtual bool onDisengage(const DtEntityIdentifier &id)
Handles entity disengagement.
virtual void destroyInstrumentPanel(WindowOperationMessage *msg)
Destroys an instrument panel.
virtual DtVreMessageResult handleReassignPanelOwnership(DtVreMessage *msg)
Handles messages to reassign panel ownership.
virtual void slot_onPostTick()
Slot called on post-tick to check for pending field of view messages.
virtual void processGimbalOperation(WindowOperationMessage *msg)
Processes gimbal operations (create, destroy, modify)
virtual DtVreMessageResult handleSetGimbalOverlaySections(DtVreMessage *msg)
Handles messages to set gimbal overlay sections.
virtual void addDefaultOverlayCreators()
Adds default overlay section creators.
virtual void processPlanViewOperation(WindowOperationMessage *msg)
Processes plan view operations.
DtVector2DI myPlanViewSize
Default size for plan views.
Definition instrumentPanelManager.h:337
DtVector2DI myPlanViewPosition
Default position for plan views.
Definition instrumentPanelManager.h:334
bool myAutoDisableHdrAutoExposure
Flag to control HDR auto exposure behavior.
Definition instrumentPanelManager.h:371
DtVector2DI myGimbalSize
Default size for gimbal views.
Definition instrumentPanelManager.h:328
virtual DtVreMessageResult handleRestoreGimbalOverlaySections(DtVreMessage *msg)
Handles messages to restore gimbal overlay sections.
virtual DtVreMessageResult handleMinimapMessage(DtVreMessage *msg)
Handles minimap-related messages.
virtual void slot_observerCreated(makVrv::DtInputDriver *inputDriver, makVrv::DtObserver *observer, DtCameraStruct *cameraStruct)
Slot called when an observer is created.
virtual void destroyAllStealth(WindowOperationMessage *msg)
Destroys all stealth windows.
virtual void addOverlaySectionCreator(const std::string &key, makVrv::DtOsgSensorViewOverlaySectionCreator *creator)
Adds or replaces an overlay section creator.
makVrv::DtDe * myDe
Pointer to the rendering engine.
Definition instrumentPanelManager.h:313
DtStringOverlayCreatorMap myOverlayCreatorMap
Map storing all overlay section creators.
Definition instrumentPanelManager.h:365
virtual DtVreMessageResult handleSetGimbalSensorMode(DtVreMessage *msg)
Handles messages to set gimbal sensor mode.
virtual void destroyStealth(WindowOperationMessage *msg, bool &destroyed)
Destroys a stealth window.
virtual DtCameraStruct * getCameraStruct(const DtPanelStruct *panelStruct, const std::string &name) const
Retrieves a camera structure by name from a panel structure.
virtual void destroyPlanView(WindowOperationMessage *msg)
Destroys a plan view.
virtual void createPlanView(WindowOperationMessage *msg)
Creates a plan view.
virtual DtCameraStruct * findOrCreateCameraStruct(DtPanelStruct *panelStruct, DtCameraType cameraType, std::string name)
Finds or creates a camera structure.
virtual void destroyInstrumentPanelRtt(WindowOperationMessage *msg)
Destroys a render-to-texture instrument panel.
std::map< DtEntityIdentifier, DtPanelStruct * > DtEntityPanelMap
Map of entity identifiers to panel structures.
Definition instrumentPanelManager.h:340
DtPlayerStationApp * myApp
Pointer to the player station application.
Definition instrumentPanelManager.h:316
virtual void slot_channelToBeDestroyed(makVrv::DtChannelManager *mgr, makVrv::DtChannel *channel)
Slot called when a channel is about to be destroyed.
virtual void setAutoDisableHdrAutoExposure(bool value)
Sets whether to automatically disable HDR auto exposure on certain views.
virtual void init(makVrv::DtDe *de, DtPlayerStationApp *app, DtEntityResolver *resolver, DtInitTable windowConfig)
Initializes the instrument panel manager.
virtual void createInstrumentPanelRtt(WindowOperationMessage *msg)
Creates a render-to-texture instrument panel.
virtual void createInstrumentPanel(WindowOperationMessage *msg)
Creates an instrument panel.
DtVector2DI myGimbalPosition
Default position for gimbal views.
Definition instrumentPanelManager.h:325
virtual void createStealth(WindowOperationMessage *msg)
Creates a stealth window.
Top-level class representing the VR-Engage application.
Definition playerStationApp.h:163
Definition vector2DI.h:16
Abstract base class for all VREngage messages.
Definition vreMessage.h:50
Definition windowOperation.h:32
Defines export macros for the VR-Engage Player Station library.
#define PLAYERSTATION_DLL
Definition export.h:24
Defines structures used by the instrument panel manager in VR-Engage.
Include export definitions for this library.
Definition glsVreMessageUtil.h:49
DtCameraType
Enumeration of camera types used in instrument panels.
Definition instrumentPanelManagerStructs.h:77
DtVreMessageResult
Enumeration of possible message handling results.
Definition vreMessage.h:33
Definition appLauncherComponent.h:28
makVrv::DtDe * de()
Gets the display element pointer used by the plugin.
Structure that manages camera and render-to-texture for instrument panels.
Definition instrumentPanelManagerStructs.h:93
Structure that manages a collection of instrument panels.
Definition instrumentPanelManagerStructs.h:222
DtVector2DI is a class that represents a 2-D integer vector.
Defines the base class for all VREngage messages.