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