VR-Engage  2.2
Loading...
Searching...
No Matches
vreOsgSensorViewTargetInfoOverlaySection.h
Go to the documentation of this file.
1/******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4******************************************************************************/
5
6//! \file vreOsgSensorViewTargetInfoOverlaySection.h
7//! \brief Defines the overlay section for displaying target information
8//!
9//! This file contains the DtVreOsgSensorViewTargetInfoOverlaySection class which
10//! provides an overlay section for displaying information about the target at the
11//! center of the sensor view. This includes target location coordinates in either
12//! latitude/longitude or MGRS format.
13
14#pragma once
15
17
18#include <vrvOsg/DtOsgSensorViewTargetInfoOverlaySection.h>
19
20
21namespace makVrv
22{
23//! \brief Forward declaration of the text proxy class
24class DtTextProxy;
25
26//! \brief Forward declaration of the ray intersector class
27class DtIntersector;
28} // namespace makVrv
29
30namespace makVre
31{
32//! \brief Overlay section for displaying target information
33//!
34//! DtVreOsgSensorViewTargetInfoOverlaySection is responsible for displaying
35//! information about the target at the center of the sensor view. It performs
36//! ray intersection with the terrain or 3D model to determine the exact location
37//! of the target point, and displays the coordinates in either latitude/longitude
38//! or Military Grid Reference System (MGRS) format.
39class PLAYERSTATION_DLL DtVreOsgSensorViewTargetInfoOverlaySection : public makVrv::DtOsgSensorViewTargetInfoOverlaySection
40{
41 //! \brief Horizontal position of the text as a fraction of display width (0.0-1.0)
42 //!
43 //! Value of 0.02 positions the text near the left edge of the display
44 const double TextHorizLocation = 0.02;
45
46 //! \brief Vertical position of the text as a fraction of display height (0.0-1.0)
47 //!
48 //! Value of 0.95 positions the text near the top edge of the display
49 const double TextVertLocation = 0.05;
50
51 //! \brief Default font size for the recording status text in points
52 const double DefaultFontSize = 12;
53
54 //! \brief Width of the text box as a fraction of display width
55 const double TextBoxWidth = 0.2;
56
57 //! \brief Height of the text box as a fraction of display height
58 const double TextBoxHeight = 0.2;
59public:
60 //! \brief Friend declarations for creator classes
61 //!
62 //! Allow the creator classes to access protected constructor.
65
66 //! \brief Destructor
67 //!
68 //! Cleans up resources used by the target info overlay section.
70
71 //! \brief Updates the overlay with current target information
72 //! \param observer Reference to the observer object
73 //! \param state Current sensor field of view data
74 //!
75 //! Updates the text display with target information based on the current
76 //! observer view. This performs a ray intersection with the terrain or 3D model
77 //! at the center of the view to determine the exact target location, and then
78 //! formats the coordinates for display.
79 virtual void update(const makVrv::DtOsgObserverObject& observer,
80 const makVrv::DtSensorFieldOfViewData& state) override;
81
82 //! \brief Gets the name of this overlay section
83 //! \return Reference to the section name string
84 //!
85 //! Returns the name of this section, which can be used to retrieve it
86 //! from the DtOsgSensorViewOverlay. The name uniquely identifies this
87 //! section type in the overlay system.
88 virtual const std::string& sectionName() const override;
89
90public:
91 //! \brief Static section name identifier
92 //!
93 //! Constant string that identifies this type of overlay section.
94 static const std::string SectionName;
95
96protected:
97 //! \brief Protected constructor
98 //! \param de Reference to the display engine
99 //!
100 //! Creates a new target info overlay section for the specified display engine.
101 //! This constructor is protected because instances should only be created by
102 //! the creator classes.
104
105 //! \brief Initializes the overlay section
106 //! \param overlayRenderer Renderer for creating overlay elements
107 //! \param channelWidth Width of the channel in pixels
108 //! \param channelHeight Height of the channel in pixels
109 //! \param channelXOffset X offset of the channel in pixels
110 //! \param channelYOffset Y offset of the channel in pixels
111 //!
112 //! Initializes the overlay section by creating the text element that displays
113 //! the recording status. This must be called prior to any update calls. The
114 //! position of the text is calculated based on the channel dimensions and offsets.
115 virtual void initialize(makVrv::DtOverlayRenderer& overlayRenderer, unsigned int channelWidth,
116 unsigned int channelHeight, unsigned int channelXOffset, unsigned int channelYOffset) override;
117
118 //! \brief Updates the overlay when the channel size changes
119 //! \param channelWidth New width of the channel in pixels
120 //! \param channelHeight New height of the channel in pixels
121 //! \param channelXOffset New X offset of the channel in pixels
122 //! \param channelYOffset New Y offset of the channel in pixels
123 //!
124 //! Adjusts the position and size of the text element when the channel
125 //! dimensions or position change. This ensures the recording status display
126 //! maintains its relative position in the view.
127 virtual void setChannelSize(unsigned int channelWidth, unsigned int channelHeight, unsigned int channelXOffset,
128 unsigned int channelYOffset) override;
129
130protected:
131 //! \brief Enumeration for coordinate system display formats
132 //!
133 //! Defines the coordinate system formats that can be used for displaying
134 //! the target location.
136 {
137 LatLon = 0, //!< Latitude/Longitude coordinate system
138 MGRS = 1 //!< Military Grid Reference System coordinate format
139 };
140
141 //! \brief Current coordinate system format
142 //!
143 //! Determines whether coordinates are displayed in Lat/Lon or MGRS format.
145
146 int myFontSize = 0;
147};
148
149//! \brief Factory creator for target info overlay sections with Lat/Lon format
150//!
151//! DtVreOsgSensorViewTargetInfoOverlaySectionCreator is a factory class that
152//! creates target info overlay section instances with coordinates displayed
153//! in Latitude/Longitude format. It allows the overlay sections to be created
154//! on demand by the overlay system using the factory pattern.
156 : public makVrv::DtOsgSensorViewOverlaySectionCreator
157{
158public:
159 //! \brief Creates a new target info overlay section
160 //! \param de Reference to the display engine
161 //! \return Pointer to a newly created overlay section
162 //!
163 //! Factory method that creates a new target info overlay section instance
164 //! for the specified display engine, configured to display coordinates
165 //! in Latitude/Longitude format.
166 virtual makVrv::DtOsgSensorViewOverlaySection* create(makVrv::DtDe& de) override;
167
168 //! \brief Creates a copy of this creator
169 //! \return Pointer to a new creator instance of the same type
170 //!
171 //! Creates a new instance of this creator class, used by the overlay system
172 //! for creator registration and management.
173 virtual DtOsgSensorViewOverlaySectionCreator* clone() const override;
174};
175
176//! \brief Factory creator for target info overlay sections with MGRS format
177//!
178//! DtVreOsgSensorViewMgrsTargetInfoOverlaySectionCreator is a factory class that
179//! creates target info overlay section instances with coordinates displayed
180//! in Military Grid Reference System (MGRS) format. It allows the overlay sections
181//! to be created on demand by the overlay system using the factory pattern.
183 : public makVrv::DtOsgSensorViewOverlaySectionCreator
184{
185public:
186 //! \brief Creates a new target info overlay section with MGRS coordinates
187 //! \param de Reference to the display engine
188 //! \return Pointer to a newly created overlay section
189 //!
190 //! Factory method that creates a new target info overlay section instance
191 //! for the specified display engine, configured to display coordinates
192 //! in Military Grid Reference System (MGRS) format.
193 virtual makVrv::DtOsgSensorViewOverlaySection* create(makVrv::DtDe& de) override;
194
195 //! \brief Creates a copy of this creator
196 //! \return Pointer to a new creator instance of the same type
197 //!
198 //! Creates a new instance of this creator class, used by the overlay system
199 //! for creator registration and management.
200 virtual DtOsgSensorViewOverlaySectionCreator* clone() const override;
201};
202} // namespace makVre
Factory creator for target info overlay sections with MGRS format.
Definition vreOsgSensorViewTargetInfoOverlaySection.h:184
virtual makVrv::DtOsgSensorViewOverlaySection * create(makVrv::DtDe &de) override
Creates a new target info overlay section with MGRS coordinates.
virtual DtOsgSensorViewOverlaySectionCreator * clone() const override
Creates a copy of this creator.
Factory creator for target info overlay sections with Lat/Lon format.
Definition vreOsgSensorViewTargetInfoOverlaySection.h:157
virtual makVrv::DtOsgSensorViewOverlaySection * create(makVrv::DtDe &de) override
Creates a new target info overlay section.
virtual DtOsgSensorViewOverlaySectionCreator * clone() const override
Creates a copy of this creator.
static const std::string SectionName
Static section name identifier.
Definition vreOsgSensorViewTargetInfoOverlaySection.h:94
DtVreOsgSensorViewTargetInfoOverlaySection(makVrv::DtDe &de)
Protected constructor.
virtual void initialize(makVrv::DtOverlayRenderer &overlayRenderer, unsigned int channelWidth, unsigned int channelHeight, unsigned int channelXOffset, unsigned int channelYOffset) override
Initializes the overlay section.
virtual void update(const makVrv::DtOsgObserverObject &observer, const makVrv::DtSensorFieldOfViewData &state) override
Updates the overlay with current target information.
virtual const std::string & sectionName() const override
Gets the name of this overlay section.
const double TextBoxHeight
Height of the text box as a fraction of display height.
Definition vreOsgSensorViewTargetInfoOverlaySection.h:58
friend class DtVreOsgSensorViewTargetInfoOverlaySectionCreator
Friend declarations for creator classes.
Definition vreOsgSensorViewTargetInfoOverlaySection.h:63
int myFontSize
Definition vreOsgSensorViewTargetInfoOverlaySection.h:146
CoordSysType
Enumeration for coordinate system display formats.
Definition vreOsgSensorViewTargetInfoOverlaySection.h:136
@ MGRS
Military Grid Reference System coordinate format.
Definition vreOsgSensorViewTargetInfoOverlaySection.h:138
@ LatLon
Latitude/Longitude coordinate system.
Definition vreOsgSensorViewTargetInfoOverlaySection.h:137
const double DefaultFontSize
Default font size for the recording status text in points.
Definition vreOsgSensorViewTargetInfoOverlaySection.h:52
const double TextHorizLocation
Horizontal position of the text as a fraction of display width (0.0-1.0)
Definition vreOsgSensorViewTargetInfoOverlaySection.h:44
friend class DtVreOsgSensorViewMgrsTargetInfoOverlaySectionCreator
Definition vreOsgSensorViewTargetInfoOverlaySection.h:64
const double TextBoxWidth
Width of the text box as a fraction of display width.
Definition vreOsgSensorViewTargetInfoOverlaySection.h:55
CoordSysType myCoordSysType
Current coordinate system format.
Definition vreOsgSensorViewTargetInfoOverlaySection.h:144
const double TextVertLocation
Vertical position of the text as a fraction of display height (0.0-1.0)
Definition vreOsgSensorViewTargetInfoOverlaySection.h:49
virtual void setChannelSize(unsigned int channelWidth, unsigned int channelHeight, unsigned int channelXOffset, unsigned int channelYOffset) override
Updates the overlay when the channel size changes.
virtual ~DtVreOsgSensorViewTargetInfoOverlaySection() override
Destructor.
Defines export macros for the VR-Engage Player Station library.
#define PLAYERSTATION_DLL
Definition export.h:24
Include export definitions for this library.
Definition glsVreMessageUtil.h:49
Definition appLauncherComponent.h:28
makVrv::DtDe * de()
Gets the display element pointer used by the plugin.