VR-Engage  2.2
Loading...
Searching...
No Matches
rfxElevationMessage.h
Go to the documentation of this file.
1// ******************************************************************************
2// ** Copyright (c) 2025 MAK Technologies
3// ** All rights reserved.
4// ******************************************************************************
5
6
7//! \file rfxElevationMessage.h
8//! \brief Defines the request and response messages for terrain elevation queries
9//! \ingroup vreRadarFxShared
10//!
11//! This file contains message classes for requesting terrain elevation data
12//! at specific locations and receiving the elevation results
13
14
15#pragma once
16
17#include "export.h"
18#include "rfxMessage.h"
19
20#include <matrix/vlVector.h>
21
22#include <string>
23
24namespace makRadarFx
25{
26
27//! \brief Request message for terrain elevation data
28//!
29//! This message requests the elevation at a specific target location using sensors
30//! on a specified platform or from the ownship location. The request supports multiple
31//! methods of specifying both the sensor position (ownship) and the target position,
32//! including using the observer's current view, specifying an entity by ID, or using
33//! absolute coordinates. If line of sight is not available from the sensing platform
34//! to the target location, the corresponding response will contain an error.
36{
37public:
38 //! \brief Default constructor
39 //!
40 //! Initializes a new elevation request message with default settings
42
43 //! \brief Virtual destructor
45
46 //! \brief Uses the current observer's position for the sensor location
47 //!
48 //! When called, this function configures the request to use the current observer's
49 //! position and orientation for the sensor placement. The client does not need to
50 //! set an ownship location if using this method to position the sensor.
51 virtual void useObserverAsHost();
52
53 //! \brief Sets an absolute position for the sensor location
54 //! \param location Vector containing the sensor position (latitude, longitude, altitude)
55 //!
56 //! If the ownship is not hosted in the simulation system, this method allows
57 //! explicit specification of the sensor position for the elevation test.
58 virtual void setOwnshipLocation(DtVector location);
59
60 //! \brief Gets the absolute sensor position
61 //! \return Vector containing the sensor position (latitude, longitude, altitude)
62 //!
63 //! Returns the currently set absolute sensor position
64 virtual DtVector ownshipLocation();
65
66 //! \brief Sets an entity ID to use for the sensor position
67 //! \param name String identifier of the entity to use as the sensor platform
68 //!
69 //! If the sensor platform is hosted by the simulation system, this method allows
70 //! specification of the entity by its global simulation name or ID.
71 virtual void setOwnshipEntityId(const std::string& name);
72
73 //! \brief Gets the entity ID used for the sensor position
74 //! \return String identifier of the entity used as the sensor platform
75 virtual std::string ownshipEntityId();
76
77 //! \name Sensor Placement Mode Queries
78 //! @{
79 //! \brief Methods to determine how the sensor is being positioned
80
81 //! \brief Checks if using the observer position for the sensor
82 //! \return True if the observer is being used as the sensor host
83 virtual bool isUsingObserverAsHost();
84
85 //! \brief Checks if using an entity as the sensor platform
86 //! \return True if an entity ID is being used for the sensor host
87 virtual bool isUsingEntityAsHost();
88
89 //! \brief Checks if using an absolute position for the sensor
90 //! \return True if absolute coordinates are being used for the sensor position
92 //! @}
93
94 //! \brief Uses the current observer's view direction for the target position
95 //!
96 //! When called, this function configures the request to use the current observer's
97 //! view direction to determine the target position for the elevation query.
98 virtual void useObserverForTarget();
99
100 //! \brief Sets an entity ID to use for the target position
101 //! \param name String identifier of the entity to use as the target
102 //!
103 //! Specifies an entity by its global simulation name or ID to use as the
104 //! target location for the elevation query.
105 virtual void setTargetEntityId(const std::string& name);
106
107 //! \brief Gets the entity ID used for the target position
108 //! \return String identifier of the entity used as the target
109 virtual std::string targetEntityId();
110
111 //! \brief Sets an absolute position for the target location
112 //! \param location Vector containing the target position (latitude, longitude, altitude)
113 //!
114 //! Specifies the absolute coordinates of the target location for the elevation query.
115 //! Location format is latitude/longitude/altitude (in degrees/meters).
116 //! The altitude component is not required and will be determined by the query.
117 virtual void setTargetLocation(DtVector location);
118
119 //! \brief Gets the absolute target position
120 //! \return Vector containing the target position (latitude, longitude, altitude)
121 virtual DtVector targetLocation();
122
123 //! \name Target Placement Mode Queries
124 //! @{
125 //! \brief Methods to determine how the target is being positioned
126
127 //! \brief Checks if using the observer view for the target position
128 //! \return True if the observer view is being used to determine the target
130
131 //! \brief Checks if using an entity as the target
132 //! \return True if an entity ID is being used for the target
134
135 //! \brief Checks if using an absolute position for the target
136 //! \return True if absolute coordinates are being used for the target position
138 //! @}
139
140
141 //! \brief size of the message
142 virtual int messageSize();
143 //! \brief decode a message. Used by the factory
144 static DtBaseMessage* decode(unsigned char* buffer, int length);
145 //! \brief clone a message. Caller of function is responsible managing this memory
147
148protected:
149 //! \brief Serializes the message data to a stream writer
150 //! \param writer Reference to the stream writer to write the data to
151 virtual void serialize(DtStreamWriter& writer);
152
153 //! \brief Deserializes message data from a stream reader
154 //! \param reader Reference to the stream reader to read the data from
155 virtual void deserialize(DtStreamReader& reader);
156
157 //! \brief Flag indicating if using observer as the sensor host
159
160 //! \brief Flag indicating if using an entity as the sensor host
162
163 //! \brief Flag indicating if using absolute coordinates for the sensor position
165
166 //! \brief Flag indicating if using observer view for the target
168
169 //! \brief Flag indicating if using an entity as the target
171
172 //! \brief Flag indicating if using absolute coordinates for the target position
174
175 //! \brief Name/ID of the entity to use as the sensor host
176 std::string myOwnshipName;
177
178 //! \brief Name/ID of the entity to use as the target
179 std::string myTargetName;
180
181 //! \brief Absolute coordinates for the sensor position
183
184 //! \brief Absolute coordinates for the target position
186};
187
188//! \brief Response message containing terrain elevation data
189//!
190//! This message contains the response to an elevation request, providing
191//! the terrain elevation at the requested location and any error information
192//! if the elevation could not be determined. The response may include an error
193//! if there is no line of sight from the sensor position to the target location.
195{
196public:
197 //! \brief Error codes for elevation responses
199 {
200 ELEVATION_NO_ERROR, //!< No error, elevation is valid
201 ELEVATION_ERROR_OCCLUDED, //!< Error due to occlusion (no line of sight)
202 ELEVATION_ERROR_OTHER //!< Other unspecified error
203 };
204
205 //! \brief Default constructor
206 //!
207 //! Initializes a new elevation response message with default settings
209
210 //! \brief Virtual destructor
212
213 //! \brief Sets the elevation result
214 //! \param elevation The elevation value in meters
215 //!
216 //! Sets the elevation at the requested location. A value of NaN indicates
217 //! that the request could not be completed due to line of sight being
218 //! blocked from the sensing platform to the requested target or another error.
219 virtual void setElevation(float elevation);
220
221 //! \brief Gets the elevation result
222 //! \return The elevation value in meters, or NaN if unavailable
223 //!
224 //! Returns the terrain elevation at the requested location.
225 virtual float elevation();
226
227 //! \brief Sets the error code
228 //! \param error The error code to set
229 //!
230 //! Sets the error status for this elevation response. Use ELEVATION_NO_ERROR
231 //! if the elevation value is valid.
233
234 //! \brief Gets the error code
235 //! \return The current error code
236 //!
237 //! Returns the error status for this elevation response.
239
240 //! \brief size of the message
241 virtual int messageSize();
242 //! \brief decode a message. Used by the factory
243 static DtBaseMessage* decode(unsigned char* buffer, int length);
244 //! \brief clone a message. Caller of function is responsible managing this memory
246
247protected:
248 //! \brief Serializes the message data to a stream writer
249 //! \param writer Reference to the stream writer to write the data to
250 virtual void serialize(DtStreamWriter& writer);
251
252 //! \brief Deserializes message data from a stream reader
253 //! \param reader Reference to the stream reader to read the data from
254 virtual void deserialize(DtStreamReader& reader);
255
256 //! \brief The elevation value in meters
258
259 //! \brief The error code for this response
261};
262} // namespace makRadarFx
DtBaseMessage()
Default constructor.
virtual void setTargetEntityId(const std::string &name)
Sets an entity ID to use for the target position.
virtual bool isUsingObserverForTarget()
Checks if using the observer view for the target position.
virtual void useObserverForTarget()
Uses the current observer's view direction for the target position.
virtual void useObserverAsHost()
Uses the current observer's position for the sensor location.
virtual bool isUsingEntityAsHost()
Checks if using an entity as the sensor platform.
virtual int messageSize()
size of the message
virtual DtBaseMessage * clone()
clone a message. Caller of function is responsible managing this memory
virtual void setOwnshipLocation(DtVector location)
Sets an absolute position for the sensor location.
bool myUseEntityAsTarget
Flag indicating if using an entity as the target.
Definition rfxElevationMessage.h:170
bool myUseObserverForTarget
Flag indicating if using observer view for the target.
Definition rfxElevationMessage.h:167
virtual void setTargetLocation(DtVector location)
Sets an absolute position for the target location.
std::string myTargetName
Name/ID of the entity to use as the target.
Definition rfxElevationMessage.h:179
std::string myOwnshipName
Name/ID of the entity to use as the sensor host.
Definition rfxElevationMessage.h:176
DtElevationRequest()
Default constructor.
bool myUseEntityAsHost
Flag indicating if using an entity as the sensor host.
Definition rfxElevationMessage.h:161
virtual std::string targetEntityId()
Gets the entity ID used for the target position.
virtual DtVector ownshipLocation()
Gets the absolute sensor position.
virtual std::string ownshipEntityId()
Gets the entity ID used for the sensor position.
bool myUseAbsoluteOwnship
Flag indicating if using absolute coordinates for the sensor position.
Definition rfxElevationMessage.h:164
virtual bool isUsingEntityForTarget()
Checks if using an entity as the target.
virtual void serialize(DtStreamWriter &writer)
Serializes the message data to a stream writer.
virtual void deserialize(DtStreamReader &reader)
Deserializes message data from a stream reader.
DtVector myOwnshipLocation
Absolute coordinates for the sensor position.
Definition rfxElevationMessage.h:182
virtual ~DtElevationRequest()
Virtual destructor.
virtual bool isUsingObserverAsHost()
Checks if using the observer position for the sensor.
bool myUseAbsoluteTarget
Flag indicating if using absolute coordinates for the target position.
Definition rfxElevationMessage.h:173
virtual void setOwnshipEntityId(const std::string &name)
Sets an entity ID to use for the sensor position.
static DtBaseMessage * decode(unsigned char *buffer, int length)
decode a message. Used by the factory
DtVector myTargetLocation
Absolute coordinates for the target position.
Definition rfxElevationMessage.h:185
virtual DtVector targetLocation()
Gets the absolute target position.
virtual bool isUsingLocationForTarget()
Checks if using an absolute position for the target.
virtual bool isUsingAbsoluteLocation()
Checks if using an absolute position for the sensor.
bool myUseObserverAsHost
Flag indicating if using observer as the sensor host.
Definition rfxElevationMessage.h:158
virtual void setElevation(float elevation)
Sets the elevation result.
virtual int messageSize()
size of the message
virtual void serialize(DtStreamWriter &writer)
Serializes the message data to a stream writer.
virtual DtElevationError error()
Gets the error code.
virtual ~DtElevationResponse()
Virtual destructor.
static DtBaseMessage * decode(unsigned char *buffer, int length)
decode a message. Used by the factory
DtElevationResponse()
Default constructor.
float myElevation
The elevation value in meters.
Definition rfxElevationMessage.h:257
DtElevationError
Error codes for elevation responses.
Definition rfxElevationMessage.h:199
@ ELEVATION_ERROR_OCCLUDED
Error due to occlusion (no line of sight)
Definition rfxElevationMessage.h:201
@ ELEVATION_ERROR_OTHER
Other unspecified error.
Definition rfxElevationMessage.h:202
@ ELEVATION_NO_ERROR
No error, elevation is valid.
Definition rfxElevationMessage.h:200
virtual void setError(DtElevationError error)
Sets the error code.
DtElevationError myError
The error code for this response.
Definition rfxElevationMessage.h:260
virtual void deserialize(DtStreamReader &reader)
Deserializes message data from a stream reader.
virtual float elevation()
Gets the elevation result.
virtual DtBaseMessage * clone()
clone a message. Caller of function is responsible managing this memory
Stream reader for decoding values from a byte array in little endian format.
Definition byteStream.h:32
Stream writer for encoding values into a byte array in little endian format.
Definition byteStream.h:159
Defines export macros for the RadarFx Shared library.
#define RFX_DLL_SHARED
Export/import macro for non-Windows platforms (empty)
Definition export.h:25
Definition radarFxConnectorDriver.h:21
Defines the base message class for RadarFX client-server communication.