VR-Engage  2.2
Loading...
Searching...
No Matches
osgSensorViewRecOverlaySection.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file osgSensorViewRecOverlaySection.h
7//! \brief Defines the recording status overlay section for sensor views
8//!
9//! This file contains the DtOsgSensorViewRecOverlaySection class which
10//! provides a sensor view overlay that displays recording status information.
11//! When recording is active, a "REC" indicator is displayed in the upper
12//! left corner of the sensor view.
13
14#pragma once
15
17
18#include <vrvOsg/DtOsgSensorViewOverlaySection.h>
19
20namespace makVrv
21{
22//! \brief Forward declaration of the display engine class
23class DtDe;
24
25//! \brief Forward declaration of the text proxy class
26class DtTextProxy;
27
28//! \brief Forward declaration of the overlay renderer class
29class DtOverlayRenderer;
30} // namespace makVrv
31
32//! \brief Overlay section that displays recording status in sensor views
33//!
34//! DtOsgSensorViewRecOverlaySection provides a sensor view overlay that
35//! displays recording status information. When recording is active, it shows
36//! a "REC" indicator in the upper left corner of the sensor view, typically
37//! in red text to indicate the recording state. The overlay is designed to be
38//! easily visible without obstructing important sensor information.
39class PLAYERSTATION_DLL DtOsgSensorViewRecOverlaySection : public makVrv::DtOsgSensorViewOverlaySection
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.95;
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.3;
56
57 //! \brief Height of the text box as a fraction of display height
58 const double TextBoxHeight = 0.3;
59
60public:
61 //! \brief Friend declaration for creator class
62 //!
63 //! Only the creator class can construct instances of this section.
65
66 //! \brief Destructor
67 //!
68 //! Cleans up resources used by the recording status overlay section,
69 //! particularly the text display objects.
71
72 //! \brief Initializes the overlay section
73 //! \param overlayRenderer Renderer for creating overlay elements
74 //! \param channelWidth Width of the channel in pixels
75 //! \param channelHeight Height of the channel in pixels
76 //! \param channelXOffset X offset of the channel in pixels
77 //! \param channelYOffset Y offset of the channel in pixels
78 //!
79 //! Initializes the overlay section by creating the text element that displays
80 //! the recording status. This must be called prior to any update calls. The
81 //! position of the text is calculated based on the channel dimensions and offsets.
82 virtual void initialize(makVrv::DtOverlayRenderer& overlayRenderer, unsigned int channelWidth,
83 unsigned int channelHeight, unsigned int channelXOffset, unsigned int channelYOffset) override;
84
85 //! \brief Updates the overlay when the channel size changes
86 //! \param channelWidth New width of the channel in pixels
87 //! \param channelHeight New height of the channel in pixels
88 //! \param channelXOffset New X offset of the channel in pixels
89 //! \param channelYOffset New Y offset of the channel in pixels
90 //!
91 //! Adjusts the position and size of the text element when the channel
92 //! dimensions or position change. This ensures the recording status display
93 //! maintains its relative position in the view.
94 virtual void setChannelSize(unsigned int channelWidth, unsigned int channelHeight, unsigned int channelXOffset,
95 unsigned int channelYOffset) override;
96
97 //! \brief Updates the recording status display
98 //! \param observer Observer object representing the viewer's position and orientation
99 //! \param state Current state of the sensor field of view
100 //!
101 //! Updates the overlay text based on the current recording status. If recording
102 //! is active, the "REC" indicator is displayed; otherwise, it is hidden. This method
103 //! is called once per frame to keep the display synchronized with the actual recording state.
104 virtual void update(const makVrv::DtOsgObserverObject& observer,
105 const makVrv::DtSensorFieldOfViewData& state) override;
106
107 //! \brief Gets the unique name of this overlay section
108 //! \return Reference to the section name string
109 //!
110 //! Returns the name of this section with which it may be retrieved from
111 //! the DtOsgSensorViewOverlay. Each section type has a unique name.
112 virtual const std::string& sectionName() const override;
113
114public:
115 //! \brief Static constant defining the section name
116 //!
117 //! This string identifier is used to register and retrieve this overlay section.
118 static const std::string SectionName;
119
120protected:
121 //! \brief Protected constructor
122 //! \param de Reference to the display engine
123 //!
124 //! Creates a new recording status overlay section. This constructor is protected
125 //! because instances should only be created through the creator class.
127 : DtOsgSensorViewOverlaySection(de)
128 , myText(0)
129 {
130 }
131
132protected:
133 //! \brief Text element displaying the recording status
134 //!
135 //! Pointer to the text proxy object that renders the recording status text.
136 //! This is created during initialization and made visible or hidden during
137 //! each update call based on the current recording state.
138 makVrv::DtTextProxy* myText;
139};
140
141//! \brief Factory class for creating recording status overlay sections
142//!
143//! DtOsgSensorViewRecOverlaySectionCreator is responsible for creating
144//! instances of DtOsgSensorViewRecOverlaySection. It implements the
145//! factory pattern, allowing the overlay system to create specialized sections
146//! without knowing their implementation details.
147class PLAYERSTATION_DLL DtOsgSensorViewRecOverlaySectionCreator : public makVrv::DtOsgSensorViewOverlaySectionCreator
148{
149public:
150 //! \brief Creates a new recording status overlay section
151 //! \param de Reference to the display engine
152 //! \return Pointer to the newly created overlay section
153 //!
154 //! Factory method that creates a new DtOsgSensorViewRecOverlaySection
155 //! instance with the specified display engine.
156 virtual makVrv::DtOsgSensorViewOverlaySection* create(makVrv::DtDe& de) override
157 {
159 }
160
161 //! \brief Creates a clone of this creator
162 //! \return Pointer to a new instance of this creator
163 //!
164 //! Creates and returns a new instance of this creator class. This is used
165 //! by the overlay system for creator registration and management.
166 virtual makVrv::DtOsgSensorViewOverlaySectionCreator* clone() const override
167 {
169 }
170};
Factory class for creating recording status overlay sections.
Definition osgSensorViewRecOverlaySection.h:148
virtual makVrv::DtOsgSensorViewOverlaySection * create(makVrv::DtDe &de) override
Creates a new recording status overlay section.
Definition osgSensorViewRecOverlaySection.h:156
virtual makVrv::DtOsgSensorViewOverlaySectionCreator * clone() const override
Creates a clone of this creator.
Definition osgSensorViewRecOverlaySection.h:166
Overlay section that displays recording status in sensor views.
Definition osgSensorViewRecOverlaySection.h:40
const double TextVertLocation
Vertical position of the text as a fraction of display height (0.0-1.0)
Definition osgSensorViewRecOverlaySection.h:49
const double TextBoxWidth
Width of the text box as a fraction of display width.
Definition osgSensorViewRecOverlaySection.h:55
makVrv::DtTextProxy * myText
Text element displaying the recording status.
Definition osgSensorViewRecOverlaySection.h:138
const double TextHorizLocation
Horizontal position of the text as a fraction of display width (0.0-1.0)
Definition osgSensorViewRecOverlaySection.h:44
virtual const std::string & sectionName() const override
Gets the unique name of this overlay section.
static const std::string SectionName
Static constant defining the section name.
Definition osgSensorViewRecOverlaySection.h:118
DtOsgSensorViewRecOverlaySection(makVrv::DtDe &de)
Protected constructor.
Definition osgSensorViewRecOverlaySection.h:126
friend class DtOsgSensorViewRecOverlaySectionCreator
Friend declaration for creator class.
Definition osgSensorViewRecOverlaySection.h:64
virtual void update(const makVrv::DtOsgObserverObject &observer, const makVrv::DtSensorFieldOfViewData &state) override
Updates the recording status display.
virtual void initialize(makVrv::DtOverlayRenderer &overlayRenderer, unsigned int channelWidth, unsigned int channelHeight, unsigned int channelXOffset, unsigned int channelYOffset) override
Initializes the overlay section.
const double DefaultFontSize
Default font size for the recording status text in points.
Definition osgSensorViewRecOverlaySection.h:52
virtual void setChannelSize(unsigned int channelWidth, unsigned int channelHeight, unsigned int channelXOffset, unsigned int channelYOffset) override
Updates the overlay when the channel size changes.
const double TextBoxHeight
Height of the text box as a fraction of display height.
Definition osgSensorViewRecOverlaySection.h:58
virtual ~DtOsgSensorViewRecOverlaySection() override
Destructor.
Defines export macros for the VR-Engage Player Station library.
#define PLAYERSTATION_DLL
Definition export.h:24
Definition appLauncherComponent.h:28
makVrv::DtDe * de()
Gets the display element pointer used by the plugin.