VR-Engage  2.2
Loading...
Searching...
No Matches
osgSensorViewTimeOverlaySection.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file osgSensorViewTimeOverlaySection.h
7//! \brief Defines the time display overlay section for sensor views
8//!
9//! This file contains the DtOsgSensorViewTimeOverlaySection class which
10//! provides a sensor view overlay that displays the current simulation time.
11//! This information helps users track the time within the simulation environment.
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 simulation time in sensor views
32//!
33//! DtOsgSensorViewTimeOverlaySection provides a sensor view overlay that
34//! displays the current simulation time. This is useful for mission timing,
35//! coordination, and after-action review. The time is typically displayed in
36//! a standard format (HH:MM:SS) positioned in a non-intrusive location on
37//! the sensor view.
38class PLAYERSTATION_DLL DtOsgSensorViewTimeOverlaySection : public makVrv::DtOsgSensorViewOverlaySection
39{
40public:
41 //! \brief Friend declaration for creator class
42 //!
43 //! Only the creator class can construct instances of this section.
45
46 //! \brief Destructor
47 //!
48 //! Cleans up resources used by the time overlay section,
49 //! particularly the text display objects.
51
52 //! \brief Initializes the overlay section
53 //! \param overlayRenderer Renderer for creating overlay elements
54 //! \param windowWidth Width of the window in pixels
55 //! \param windowHeight Height of the window in pixels
56 //! \param channelXOffset X offset of the channel in pixels
57 //! \param channelYOffset Y offset of the channel in pixels
58 //!
59 //! Initializes the overlay section by creating the text element that displays
60 //! the simulation time. This must be called prior to any update calls. The position
61 //! of the text is calculated based on the window dimensions and channel offsets.
62 virtual void initialize(makVrv::DtOverlayRenderer& overlayRenderer, unsigned int windowWidth,
63 unsigned int windowHeight, unsigned int channelXOffset, unsigned int channelYOffset) override;
64
65 //! \brief Updates the overlay when the channel size changes
66 //! \param windowWidth New width of the window in pixels
67 //! \param windowHeight New height of the window in pixels
68 //! \param channelXOffset New X offset of the channel in pixels
69 //! \param channelYOffset New Y offset of the channel in pixels
70 //!
71 //! Adjusts the position and size of the text element when the channel
72 //! dimensions or position change. This ensures the time display
73 //! maintains its relative position in the view.
74 virtual void setChannelSize(unsigned int windowWidth, unsigned int windowHeight, unsigned int channelXOffset,
75 unsigned int channelYOffset) override;
76
77 //! \brief Updates the time display
78 //! \param observer Observer object representing the viewer's position and orientation
79 //! \param state Current state of the sensor field of view
80 //!
81 //! Updates the overlay text with the current simulation time during each
82 //! frame update. The time format is typically HH:MM:SS and is retrieved from
83 //! the simulation environment rather than the system clock.
84 virtual void update(const makVrv::DtOsgObserverObject& observer,
85 const makVrv::DtSensorFieldOfViewData& state) override;
86
87 //! \brief Gets the unique name of this overlay section
88 //! \return Reference to the section name string
89 //!
90 //! Returns the name of this section with which it may be retrieved from
91 //! the DtOsgSensorViewOverlay. Each section type has a unique name.
92 virtual const std::string& sectionName() const override;
93
94public:
95 //! \brief Static constant defining the section name
96 //!
97 //! This string identifier is used to register and retrieve this overlay section.
98 static const std::string SectionName;
99
100protected:
101 //! \brief Protected constructor
102 //! \param de Reference to the display engine
103 //!
104 //! Creates a new time overlay section. This constructor is protected
105 //! because instances should only be created through the creator class.
107 : DtOsgSensorViewOverlaySection(de)
108 , myText(0)
109 {
110 }
111
112 //! \brief Text element displaying the simulation time
113 //!
114 //! Pointer to the text proxy object that renders the time text.
115 //! This is created during initialization and updated during each update call.
116 makVrv::DtTextProxy* myText;
117};
118
119//! \brief Factory class for creating time overlay sections
120//!
121//! DtOsgSensorViewTimeOverlaySectionCreator is responsible for creating
122//! instances of DtOsgSensorViewTimeOverlaySection. It implements the
123//! factory pattern, allowing the overlay system to create specialized sections
124//! without knowing their implementation details.
125class PLAYERSTATION_DLL DtOsgSensorViewTimeOverlaySectionCreator : public makVrv::DtOsgSensorViewOverlaySectionCreator
126{
127public:
128 //! \brief Creates a new time overlay section
129 //! \param de Reference to the display engine
130 //! \return Pointer to the newly created overlay section
131 //!
132 //! Factory method that creates a new DtOsgSensorViewTimeOverlaySection
133 //! instance with the specified display engine.
134 virtual makVrv::DtOsgSensorViewOverlaySection* create(makVrv::DtDe& de) override
135 {
137 }
138
139 //! \brief Creates a clone of this creator
140 //! \return Pointer to a new instance of this creator
141 //!
142 //! Creates and returns a new instance of this creator class. This is used
143 //! by the overlay system for creator registration and management.
144 virtual makVrv::DtOsgSensorViewOverlaySectionCreator* clone() const override
145 {
147 }
148};
Factory class for creating time overlay sections.
Definition osgSensorViewTimeOverlaySection.h:126
virtual makVrv::DtOsgSensorViewOverlaySectionCreator * clone() const override
Creates a clone of this creator.
Definition osgSensorViewTimeOverlaySection.h:144
virtual makVrv::DtOsgSensorViewOverlaySection * create(makVrv::DtDe &de) override
Creates a new time overlay section.
Definition osgSensorViewTimeOverlaySection.h:134
Overlay section that displays current simulation time in sensor views.
Definition osgSensorViewTimeOverlaySection.h:39
virtual ~DtOsgSensorViewTimeOverlaySection() override
Destructor.
virtual const std::string & sectionName() const override
Gets the unique name of this overlay section.
virtual void update(const makVrv::DtOsgObserverObject &observer, const makVrv::DtSensorFieldOfViewData &state) override
Updates the time display.
static const std::string SectionName
Static constant defining the section name.
Definition osgSensorViewTimeOverlaySection.h:98
makVrv::DtTextProxy * myText
Text element displaying the simulation time.
Definition osgSensorViewTimeOverlaySection.h:116
friend class DtOsgSensorViewTimeOverlaySectionCreator
Friend declaration for creator class.
Definition osgSensorViewTimeOverlaySection.h:44
virtual void initialize(makVrv::DtOverlayRenderer &overlayRenderer, unsigned int windowWidth, unsigned int windowHeight, unsigned int channelXOffset, unsigned int channelYOffset) override
Initializes the 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.
DtOsgSensorViewTimeOverlaySection(makVrv::DtDe &de)
Protected constructor.
Definition osgSensorViewTimeOverlaySection.h:106
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.