VR-Engage  2.3
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
17#include <vreUtil/vector2DI.h>
18
19namespace makVrv
20{
21class DtWindow;
22class DtChannel;
23class DtChannelManager;
24class DtInputDriver;
25class DtOsgSensorViewOverlaySectionCreator;
26} // namespace makVrv
27
28namespace makVre
29{
31
32//! \brief Manager for instrument panels, gimbal sensors, and specialized views
33//!
34//! The DtInstrumentPanelManager handles creation, modification, and deletion of
35//! extra channels, windows, or instrument panels used by various roles.
36//! For example:
37//! - Gimbaled Sensor and PVD views for fixed wing pilots
38//! - The guard house's security panel window
39//! - The launcher's scope channel
40//! - The render-to-texture channels used by the T-38 and M1A2 3D models
41//! Interaction with this class is mostly done through sending WindowOperationMessage events.
42//! The manager maintains mappings between entities and their associated panels/cameras,
43//! and provides functionality for controlling sensor modes and overlay elements.
45{
46public:
47 //! \brief Default constructor
48 //!
49 //! Initializes member variables to default values. Full initialization
50 //! occurs when the init method is called.
52
53 //! \brief Virtual destructor
54 //!
55 //! Cleans up any remaining panel structures and resources.
57
58 //! \brief Initializes the instrument panel manager
59 //!
60 //! Sets up message handlers, configures default settings for gimbal and plan views,
61 //! and adds default overlay creators.
62 //!
63 //! \param de Pointer to the rendering engine
64 //! \param app Pointer to the player station application
65 //! \param resolver Pointer to the entity resolver
66 //! \param windowConfig Configuration table containing window settings
67 virtual void init(makVrv::DtDe* de, DtPlayerStationApp* app, DtEntityResolver* resolver, DtInitTable windowConfig);
68
69 //! \brief Handles entity disengagement
70 //!
71 //! Cleans up resources associated with an entity when it's disengaged.
72 //!
73 //! \param id The identifier of the entity being disengaged
74 //! \return true if successful, false otherwise
75 virtual bool onDisengage(const DtEntityIdentifier& id);
76
77 //! \brief Retrieves the panel structure for a given entity
78 //!
79 //! \param id The entity identifier
80 //! \return Pointer to the panel structure or nullptr if not found
81 virtual DtPanelStruct* getPanelStruct(const DtEntityIdentifier& id) const;
82
83 //! \brief Retrieves a camera structure by name from a panel structure
84 //!
85 //! \param panelStruct The panel structure containing the camera
86 //! \param name The name of the camera to retrieve
87 //! \return Pointer to the camera structure or nullptr if not found
88 virtual DtCameraStruct* getCameraStruct(const DtPanelStruct* panelStruct, const std::string& name) const;
89
90 //! \brief Sets the sensor mode for an observer
91 //!
92 //! Attempts to set the sensor mode, and if the mode isn't found, tries
93 //! appending the configurable mode suffix.
94 //!
95 //! \param observer The observer to modify
96 //! \param modeName The name of the sensor mode to set
97 virtual void setObserverSensorMode(makVrv::DtObserver* observer, const std::string& modeName);
98
99 //! \brief Slot called on post-tick to check for pending field of view messages
100 //!
101 //! Processes pending gimbal and stealth window creation messages when their
102 //! required fields of view become available.
103 virtual void slot_onPostTick();
104
105 //! \brief Checks for deferred view creation requests for an entity.
106 //! \param entityId The entity whose pending requests should be checked.
107 //! \return True when at least one request is waiting for sensor field of view data.
108 virtual bool hasPendingFieldOfView(const DtEntityIdentifier& entityId) const;
109
110 //! \brief Slot called when a channel is about to be destroyed
111 //!
112 //! Performs necessary cleanup for the channel and updates associated panel structures.
113 //!
114 //! \param mgr The channel manager
115 //! \param channel The channel being destroyed
116 virtual void slot_channelToBeDestroyed(makVrv::DtChannelManager* mgr, makVrv::DtChannel* channel);
117
118 //! \brief Slot called when a window is about to be destroyed
119 //!
120 //! Performs necessary cleanup for the window and updates associated panel structures.
121 //!
122 //! \param window The window being destroyed
123 virtual void slot_WindowToBeDestroyed(makVrv::DtWindow* window);
124
125 //! \brief Handles entity removal messages
126 //!
127 //! Cleans up resources associated with an entity when it's removed.
128 //!
129 //! \param msg The entity removed message
130 //! \return Message handling result
132
133 //! \brief Sets whether to automatically disable HDR auto exposure on certain views
134 //!
135 //! \param value true to automatically disable HDR auto exposure, false to leave it as is
136 virtual void setAutoDisableHdrAutoExposure(bool value);
137
138 //! \brief Adds or replaces an overlay section creator
139 //!
140 //! Each key is mapped to a creator that can generate a specific overlay section
141 //! type for sensor views. This allows for configurable overlay sections.
142 //!
143 //! \param key The identifier for the overlay section type
144 //! \param creator The creator object for generating the overlay section
145 virtual void addOverlaySectionCreator(const std::string& key, makVrv::DtOsgSensorViewOverlaySectionCreator* creator);
146
147protected:
148 //! \brief Adds default overlay section creators
149 //!
150 //! Adds creators for the following keys:
151 //! - "Crosshair" - Displays 4 corners of a box
152 //! - "PlatformInfo" - Displays information about ownship entity
153 //! - "VrePlatformInfo" - Adds Date and Time displays to PlatformInfo
154 //! - "TargetInfo" - Displays ownship coordinates
155 //! - "VreTargetInfo" - Displays center of sensor's view coordinates
156 //! - "VreMgrsTargetInfo" - Displays coordinates in MGRS format
157 //! - "DisplayInfo" - Displays sensor view information
158 //! - "VreDisplayInfo" - Strips off sensor mode suffixes
159 //! - "Pitch" - Displays ladder showing sensor elevation
160 //! - "VrePitch" - Adds Pitch readout to arrow
161 //! - "Compass" - Displays sensor azimuth and platform heading
162 //! - "Reticle" - Displays cross in the middle of the screen
163 //! - "DateTime" - Displays date and time
164 //! - "Time" - Displays time only
165 //! - "Rec" - Displays static "REC" text
167
168 //! \brief Handles window operation messages
169 //!
170 //! Routes messages to the appropriate handler based on the operation type.
171 //!
172 //! \param msg The window operation message
173 //! \return Message handling result
175
176 //! \brief Handles messages to set gimbal overlay sections
177 //!
178 //! \param msg The message containing overlay section information
179 //! \return Message handling result
181
182 //! \brief Handles messages to restore gimbal overlay sections
183 //!
184 //! \param msg The message to restore overlay sections
185 //! \return Message handling result
187
188 //! \brief Handles messages to reassign panel ownership
189 //!
190 //! \param msg The message containing reassignment information
191 //! \return Message handling result
193
194 //! \brief Processes gimbal operations (create, destroy, modify)
195 //!
196 //! Handles creation, destruction, and modification of gimbal views for
197 //! Multi-function Displays (MFDs). Modification cycles through sensor modes.
198 //!
199 //! \param msg The window operation message
201
202 //! \brief Processes stealth operations
203 //!
204 //! \param msg The window operation message
206
207 //! \brief Processes plan view operations
208 //!
209 //! \param msg The window operation message
211
212 //! \brief Processes instrument panel operations
213 //!
214 //! \param msg The window operation message
216
217 //! \brief Creates a gimbal view
218 //!
219 //! \param msg The window operation message with gimbal creation parameters
221
222 //! \brief Destroys a gimbal view
223 //!
224 //! \param msg The window operation message identifying the gimbal to destroy
226
227 //! \brief Creates a plan view
228 //!
229 //! \param msg The window operation message with plan view creation parameters
231
232 //! \brief Destroys a plan view
233 //!
234 //! \param msg The window operation message identifying the plan view to destroy
236
237 //! \brief Creates an instrument panel
238 //!
239 //! \param msg The window operation message with instrument panel creation parameters
241
242 //! \brief Destroys an instrument panel
243 //!
244 //! \param msg The window operation message identifying the instrument panel to destroy
246
247 //! \brief Creates a render-to-texture instrument panel
248 //!
249 //! \param msg The window operation message with RTT panel creation parameters
251
252 //! \brief Destroys a render-to-texture instrument panel
253 //!
254 //! \param msg The window operation message identifying the RTT panel to destroy
256
257 //! \brief Creates a stealth window
258 //!
259 //! \param msg The window operation message with stealth window creation parameters
261
262 //! \brief Queues a view creation request until sensor field of view data is available.
263 //! \param msg The window operation message to retry.
265
266 //! \brief Removes deferred view creation requests targeted by a destroy operation.
267 //! \param msg The destroy operation identifying requests to remove.
269
270 //! \brief Destroys a stealth window
271 //!
272 //! \param msg The window operation message identifying the stealth window to destroy
273 //! \param[out] destroyed Set to true if the window was successfully destroyed; false otherwise
274 virtual void destroyStealth(WindowOperationMessage* msg, bool& destroyed);
275
276 //! \brief Destroys all stealth windows
277 //!
278 //! \param msg The window operation message
280
281 //! \brief Applies the temporary HDR auto exposure override for a newly created view
283
284 //! \brief Releases the temporary HDR auto exposure override for a destroyed view
286
287 //! \brief Handles minimap-related messages
288 //!
289 //! \param msg The minimap message
290 //! \return Message handling result
292
293 //! \brief Handles messages to set gimbal sensor mode
294 //!
295 //! \param msg The message containing sensor mode information
296 //! \return Message handling result
298
299 //! \brief Sets the current selection
300 //!
301 //! \param id The ID of the entity to select
302 virtual void setCurrentSelection(makVrv::DtUniqueID id);
303
304 //! \brief Clears the current selection
305 virtual void clearCurrentSelection();
306
307 //! \brief Finds or creates a panel structure for a given message
308 //!
309 //! \param msg The window operation message
310 //! \return Pointer to the panel structure
312
313 //! \brief Finds or creates a camera structure
314 //!
315 //! \param panelStruct The panel structure to add the camera to
316 //! \param cameraType The type of camera to create
317 //! \param name The name of the camera
318 //! \return Pointer to the camera structure
320 DtPanelStruct* panelStruct, DtCameraType cameraType, std::string name);
321
322 //! \brief Slot called when an observer is created
323 //!
324 //! Sets the observer name and sensor mode in the camera.
325 //!
326 //! \param inputDriver The input driver
327 //! \param observer The observer that was created
328 //! \param cameraStruct The camera structure to update
330 makVrv::DtInputDriver* inputDriver, makVrv::DtObserver* observer, DtCameraStruct* cameraStruct);
331
332 //! \brief Pointer to the rendering engine
333 makVrv::DtDe* myDe;
334
335 //! \brief Pointer to the player station application
337
338 //! \brief Pointer to the entity resolver
340
341 //! \brief Current sensor mode for gimbal views
343
344 //! \brief Default position for gimbal views
346
347 //! \brief Default size for gimbal views
349
350 //! \brief Resolution for plan views
352
353 //! \brief Default position for plan views
355
356 //! \brief Default size for plan views
358
359 //! \brief Map of entity identifiers to panel structures
360 using DtEntityPanelMap = std::map<DtEntityIdentifier, DtPanelStruct*>;
361
362 //! \brief Map storing all entity-panel associations
364
365 //! \brief Suffix to append when searching for observer modes
366 //!
367 //! If a requested observer mode can't be found, append
368 //! either " (CameraFX)" or " (SensorFX)" and search again.
370
371 //! \brief Storage for pending field of view messages
372 //!
373 //! Stores copies of messages when the required field
374 //! of view does not exist yet.
375 std::vector<WindowOperationMessage*> myPendingFieldOfView;
376
377 //! \brief Map of overlay section keys to their creator objects
378 //!
379 //! Maps string keys to DtOsgSensorViewOverlaySectionCreators, allowing
380 //! users to configure which overlay sections to use depending on
381 //! their role or entity.
382 using DtStringOverlayCreatorMap = std::map<std::string, makVrv::DtOsgSensorViewOverlaySectionCreator*>;
383
384 //! \brief Map storing all overlay section creators
386
387 //! \brief Flag to control HDR auto exposure behavior
388 //!
389 //! When true, HDR auto exposure will be automatically disabled for
390 //! certain types of views.
392
393 //! \brief Number of active views requiring HDR auto exposure to be disabled
395
396 //! \brief Tracks the temporary HDR auto exposure override
398};
399} // 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:351
virtual void destroyGimbal(WindowOperationMessage *msg)
Destroys a gimbal view.
std::string myObserverModeSuffix
Suffix to append when searching for observer modes.
Definition instrumentPanelManager.h:369
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:363
std::map< std::string, makVrv::DtOsgSensorViewOverlaySectionCreator * > DtStringOverlayCreatorMap
Map of overlay section keys to their creator objects.
Definition instrumentPanelManager.h:382
virtual void setCurrentSelection(makVrv::DtUniqueID id)
Sets the current selection.
DtEntityResolver * myEntityResolver
Pointer to the entity resolver.
Definition instrumentPanelManager.h:339
DtInstrumentPanelManager()
Default constructor.
virtual ~DtInstrumentPanelManager()
Virtual destructor.
virtual DtVreMessageResult handleEntityRemoved(DtVreMessage *msg)
Handles entity removal messages.
virtual void releaseHdrAutoExposureOverride()
Releases the temporary HDR auto exposure override for a destroyed view.
std::string myGimbalViewSensorMode
Current sensor mode for gimbal views.
Definition instrumentPanelManager.h:342
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.
unsigned int myHdrAutoExposureOverrideCount
Number of active views requiring HDR auto exposure to be disabled.
Definition instrumentPanelManager.h:394
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:375
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 void removePendingFieldOfView(const WindowOperationMessage &msg)
Removes deferred view creation requests targeted by a destroy operation.
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 applyHdrAutoExposureOverride()
Applies the temporary HDR auto exposure override for a newly created view.
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:357
DtSettingsOverrideGuard myHdrAutoExposureOverrideGuard
Tracks the temporary HDR auto exposure override.
Definition instrumentPanelManager.h:397
virtual bool hasPendingFieldOfView(const DtEntityIdentifier &entityId) const
Checks for deferred view creation requests for an entity.
DtVector2DI myPlanViewPosition
Default position for plan views.
Definition instrumentPanelManager.h:354
bool myAutoDisableHdrAutoExposure
Flag to control HDR auto exposure behavior.
Definition instrumentPanelManager.h:391
DtVector2DI myGimbalSize
Default size for gimbal views.
Definition instrumentPanelManager.h:348
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:333
DtStringOverlayCreatorMap myOverlayCreatorMap
Map storing all overlay section creators.
Definition instrumentPanelManager.h:385
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:360
DtPlayerStationApp * myApp
Pointer to the player station application.
Definition instrumentPanelManager.h:336
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 queuePendingFieldOfView(const WindowOperationMessage &msg)
Queues a view creation request until sensor field of view data is available.
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:345
virtual void createStealth(WindowOperationMessage *msg)
Creates a stealth window.
Top-level class representing the VR-Engage application.
Definition playerStationApp.h:155
Tracks temporary settings overrides and conditionally restores them.
Definition settingsOverrideGuard.h:180
Definition vector2DI.h:16
Abstract base class for all VREngage messages.
Definition vreMessage.h:50
Used to create, modify or destroy a window or channel.
Definition windowOperation.h:36
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.
!
Definition glsVreMessageUtil.h:50
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.
Defines a guard for temporary, non-persistent settings overrides.
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.