VR-Engage  2.2
Loading...
Searching...
No Matches
rwRadarContactInfo.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file rwRadarContactInfo.h
7//! \ingroup vreVrfMessages
8//! \brief Defines radar contact information structure
9//!
10//! This file contains the DtRwRadarContactInfo class which represents detailed
11//! information about radar contacts in the simulation. It includes data about
12//! contact position, signal strength, and other radar-specific attributes.
13
14#pragma once
15
16#include "export.h"
17
18#include <vrfutil/rwSensorContactInfo.h>
19
20//! \brief Extended radar contact information class
21//!
22//! This class provides detailed information about radar contacts for use with
23//! Radar Scope and EWAWS (Electronic Warfare and Avionics Weapon Systems) extended
24//! radar functionality. It contains all relevant positional, signal, and identification
25//! information needed for radar simulation and display.
26
27class VRFMESSAGES_DLL DtRwRadarContactInfo : public DtRwSensorContactInfo
28{
29public:
30 //! \brief Default constructor
31 //!
32 //! Initializes a radar contact info object with default values.
34
35 //! \brief Constructor with name
36 //! \param name The name of the radar contact
37 //! \param parentRegistry Optional reader-writer registry for serialization
38 DtRwRadarContactInfo(const DtString& name, DtReaderWriterRegistry* const parentRegistry = NULL);
39
40 //! \brief Constructor with symbol name
41 //! \param name The symbol name of the radar contact
42 //! \param parentRegistry Optional reader-writer registry for serialization
43 DtRwRadarContactInfo(const DtSymbolString& name, DtReaderWriterRegistry* const parentRegistry = NULL);
44
45 //! \brief Copy constructor
46 //! \param orig The radar contact info to copy from
47 //! \param parentRegistry Optional reader-writer registry for serialization
48 DtRwRadarContactInfo(const DtRwRadarContactInfo& orig, DtReaderWriterRegistry* const parentRegistry = NULL);
49
50 //! \brief Virtual destructor
51 virtual ~DtRwRadarContactInfo() override;
52
53 //! \brief Assignment operator
54 //! \param orig The radar contact info to copy from
55 //! \return Reference to this object after assignment
57
58 //! \brief Checks if this contact is designated by the radar scope
59 //! \return True if the contact is designated, false otherwise
60 virtual bool isDesignated() const;
61
62 //! \brief Sets whether this contact is designated
63 //! \param val True to designate the contact, false otherwise
64 virtual void setIsDesignated(bool val);
65
66 //! \brief Gets the target's priority in the radar scope
67 //! \return The target priority value
68 //!
69 //! Higher values typically indicate higher priority targets.
70 virtual int targetPriority() const;
71
72 //! \brief Sets the target's priority in the radar scope
73 //! \param val The priority value to set
74 virtual void setTargetPriority(int val);
75
76 //! \brief Gets the radar track ID
77 //! \return The track ID value
78 //!
79 //! This is a unique identifier for the radar track.
80 virtual int trackId() const;
81
82 //! \brief Sets the radar track ID
83 //! \param val The track ID value to set
84 virtual void setTrackId(int val);
85
86 //! \brief Gets the contact's label
87 //! \return The contact label string
88 //!
89 //! This is typically a string representation of the entity type,
90 //! e.g., "29" for a MiG-29 contact.
91 virtual std::string contactLabel() const;
92
93 //! \brief Sets the contact's label
94 //! \param val The contact label to set
95 virtual void setContactLabel(std::string val);
96
97 //! \brief Gets the contact's azimuth in degrees
98 //! \return The azimuth angle in degrees
99 //!
100 //! Contact azimuth (degrees) relative to the platform's heading.
101 //! Negative azimuth is towards the left.
102 virtual double azimuth() const;
103
104 //! \brief Sets the contact's azimuth
105 //! \param val The azimuth angle in degrees
106 virtual void setAzimuth(double val);
107
108 //! \brief Gets the contact's elevation in degrees
109 //! \return The elevation angle in degrees
110 //!
111 //! Contact elevation (degrees) relative to the platform's pitch.
112 virtual double elevation() const;
113
114 //! \brief Sets the contact's elevation
115 //! \param val The elevation angle in degrees
116 virtual void setElevation(double val);
117
118 //! \brief Gets the range to the contact in meters
119 //! \return The range in meters
120 //!
121 //! Straight-line distance from the platform to the contact.
122 virtual double range() const;
123
124 //! \brief Sets the range to the contact
125 //! \param val The range in meters
126 virtual void setRange(double val);
127
128 //! \brief Gets the contact's altitude in meters
129 //! \return The altitude in meters
130 //!
131 //! Altitude of the contact above mean sea level.
132 virtual double altitude() const;
133
134 //! \brief Sets the contact's altitude
135 //! \param val The altitude in meters
136 virtual void setAltitude(double val);
137
138
139 //! \brief Gets the closure rate to the contact in meters per second
140 //! \return The closure rate in m/s
141 //!
142 //! Closure rate of the target in meters per second.
143 //! Positive values mean that the distance is decreasing.
144 //! Negative values mean that the distance is increasing.
145 virtual double closureRate() const;
146
147 //! \brief Sets the closure rate to the contact
148 //! \param val The closure rate in m/s
149 virtual void setClosureRate(double val);
150
151
152 //! \brief Gets the signal strength in Watts
153 //! \return The signal strength in Watts
154 //!
155 //! Detection signal power in Watts. Higher values indicate
156 //! stronger radar returns.
157 virtual double signalStrength() const;
158
159 //! \brief Sets the signal strength
160 //! \param val The signal strength in Watts
161 virtual void setSignalStrength(double val);
162
163
164 //! \brief Gets the target aspect angle in degrees
165 //! \return The aspect angle in degrees
166 //!
167 //! Aspect angle of the target relative to the contact's heading.
168 //! Return value is in [-180,180] range. If the return value is negative, then the
169 //! radar-carrying platform has a left aspect (i.e., on the left hemisphere of the target).
170 virtual double targetAspectAngle() const;
171
172 //! \brief Sets the target aspect angle
173 //! \param val The aspect angle in degrees
174 virtual void setTargetAspectAngle(double val);
175
176 //! \brief Gets the contact's speed in Mach number
177 //! \return The speed in Mach number
178 //!
179 //! Speed of the contact measured in Mach numbers.
180 virtual double machNumber() const;
181
182 //! \brief Sets the contact's speed in Mach number
183 //! \param val The speed in Mach number
184 virtual void setMachNumber(double val);
185
186 //! \brief Encodes this object to a buffer
187 //! \param buffer The buffer to encode into
188 //! \return Pointer to the buffer after the encoded data
189 virtual char* encode(char* buffer) const;
190
191 //! \brief Decodes this object from a buffer
192 //! \param buffer The buffer to decode from
193 //! \return Pointer to the buffer after the decoded data
194 virtual const char* decode(const char* buffer);
195
196 //! \brief Gets the size of the encoded data in bytes
197 //! \return The size in bytes
198 virtual int getSize() const;
199
200 //! \brief Creates a deep copy of this object
201 //! \return Pointer to a newly created clone of this class
202 //!
203 //! Returns a dynamically allocated copy of this radar contact info.
204 virtual DtRwRadarContactInfo* clone() const override;
205
206 //! \brief Equality comparison operator
207 //! \param other The radar contact info to compare with
208 //! \return True if the objects are equal, false otherwise
209 bool operator==(const DtRwRadarContactInfo& other) const;
210
211protected:
212 //! \brief Flag indicating if this contact is designated by the radar scope
213 DtRwBoolean myIsDesignated;
214
215 //! \brief The target's priority in the radar scope, if designated
217
218 //! \brief Radar Track ID for unique identification
219 DtRwInt myTrackId;
220
221 //! \brief The label of the contact's entity type (e.g., "29" for a MiG-29)
222 DtRwString myContactLabel;
223
224 //! \brief Angle to contact relative to observer's heading (degrees)
225 DtRwReal myAzimuth;
226
227 //! \brief Angle to contact relative to observer's pitch (degrees)
228 DtRwReal myElevation;
229
230 //! \brief Range to contact (meters)
231 DtRwReal myRange;
232
233 //! \brief Altitude of contact (meters)
234 DtRwReal myAltitude;
235
236 //! \brief Closure rate between observer and target (meters/second)
238
239 //! \brief Detection signal strength (watts)
241
242 //! \brief Angle to observer relative to contact's heading (degrees)
244
245 //! \brief Speed of contact in Mach number
246 DtRwReal myMachNumber;
247};
248
249//! \brief Namespace containing serialization functions for buffer operations
251{
252//! \brief Gets the number of bytes required to encode the value
253//! \param data The radar contact info to calculate size for
254//! \return The number of bytes required for encoding
256
257//! \brief Serializes the provided data into a buffer
258//! \param data The radar contact info to encode
259//! \param buffer The buffer to serialize into
260//! \return Pointer to the buffer after the serialization
261//!
262//! Serializes the provided value data into buffer. The buffer must have
263//! at least the number of bytes returned by getSize() for the same
264//! parameter. No length checking is done on the buffer.
265VRFMESSAGES_DLL char* encode(const DtRwRadarContactInfo& data, char* buffer);
266
267//! \brief Deserializes data from a buffer into the provided object
268//! \param data The radar contact info to populate
269//! \param buffer The buffer to deserialize from
270//! \return Pointer to the buffer after the deserialization
271//!
272//! Decodes a value from buffer and places the result in data.
273//! Buffer must contain a value created by the corresponding call to encode().
274VRFMESSAGES_DLL const char* decode(DtRwRadarContactInfo& data, const char* buffer);
275} // namespace DtBufferSerialize
276
277//! \brief List type for storing multiple radar contact information entries
278using DtRadarDataEntryList = std::vector<DtRwRadarContactInfo>;
Extended radar contact information class.
Definition rwRadarContactInfo.h:28
virtual void setIsDesignated(bool val)
Sets whether this contact is designated.
virtual void setTargetAspectAngle(double val)
Sets the target aspect angle.
virtual double altitude() const
Gets the contact's altitude in meters.
virtual void setTargetPriority(int val)
Sets the target's priority in the radar scope.
DtRwReal myElevation
Angle to contact relative to observer's pitch (degrees)
Definition rwRadarContactInfo.h:228
virtual void setElevation(double val)
Sets the contact's elevation.
DtRwRadarContactInfo()
Default constructor.
virtual int getSize() const
Gets the size of the encoded data in bytes.
virtual std::string contactLabel() const
Gets the contact's label.
DtRwReal myClosureRate
Closure rate between observer and target (meters/second)
Definition rwRadarContactInfo.h:237
virtual DtRwRadarContactInfo * clone() const override
Creates a deep copy of this object.
virtual double range() const
Gets the range to the contact in meters.
virtual void setTrackId(int val)
Sets the radar track ID.
DtRwInt myTargetPriority
The target's priority in the radar scope, if designated.
Definition rwRadarContactInfo.h:216
DtRwRadarContactInfo(const DtSymbolString &name, DtReaderWriterRegistry *const parentRegistry=NULL)
Constructor with symbol name.
DtRwRadarContactInfo(const DtString &name, DtReaderWriterRegistry *const parentRegistry=NULL)
Constructor with name.
virtual void setRange(double val)
Sets the range to the contact.
virtual void setAzimuth(double val)
Sets the contact's azimuth.
DtRwInt myTrackId
Radar Track ID for unique identification.
Definition rwRadarContactInfo.h:219
virtual double machNumber() const
Gets the contact's speed in Mach number.
virtual int targetPriority() const
Gets the target's priority in the radar scope.
virtual void setSignalStrength(double val)
Sets the signal strength.
DtRwRadarContactInfo & operator=(const DtRwRadarContactInfo &orig)
Assignment operator.
DtRwReal mySignalStrength
Detection signal strength (watts)
Definition rwRadarContactInfo.h:240
virtual double targetAspectAngle() const
Gets the target aspect angle in degrees.
virtual int trackId() const
Gets the radar track ID.
virtual void setContactLabel(std::string val)
Sets the contact's label.
virtual bool isDesignated() const
Checks if this contact is designated by the radar scope.
virtual void setMachNumber(double val)
Sets the contact's speed in Mach number.
virtual void setClosureRate(double val)
Sets the closure rate to the contact.
DtRwReal myMachNumber
Speed of contact in Mach number.
Definition rwRadarContactInfo.h:246
DtRwReal myAltitude
Altitude of contact (meters)
Definition rwRadarContactInfo.h:234
virtual const char * decode(const char *buffer)
Decodes this object from a buffer.
DtRwRadarContactInfo(const DtRwRadarContactInfo &orig, DtReaderWriterRegistry *const parentRegistry=NULL)
Copy constructor.
DtRwReal myTargetAspectAngle
Angle to observer relative to contact's heading (degrees)
Definition rwRadarContactInfo.h:243
DtRwString myContactLabel
The label of the contact's entity type (e.g., "29" for a MiG-29)
Definition rwRadarContactInfo.h:222
DtRwBoolean myIsDesignated
Flag indicating if this contact is designated by the radar scope.
Definition rwRadarContactInfo.h:213
virtual char * encode(char *buffer) const
Encodes this object to a buffer.
virtual double closureRate() const
Gets the closure rate to the contact in meters per second.
bool operator==(const DtRwRadarContactInfo &other) const
Equality comparison operator.
virtual ~DtRwRadarContactInfo() override
Virtual destructor.
DtRwReal myRange
Range to contact (meters)
Definition rwRadarContactInfo.h:231
virtual double signalStrength() const
Gets the signal strength in Watts.
virtual double azimuth() const
Gets the contact's azimuth in degrees.
DtRwReal myAzimuth
Angle to contact relative to observer's heading (degrees)
Definition rwRadarContactInfo.h:225
virtual void setAltitude(double val)
Sets the contact's altitude.
virtual double elevation() const
Gets the contact's elevation in degrees.
Export/import macros for the VRF Messages library.
#define VRFMESSAGES_DLL
Definition export.h:23
Namespace containing serialization functions for buffer operations.
Definition rwRadarContactInfo.h:251
VRFMESSAGES_DLL int getSize(const DtRwRadarContactInfo &data)
Gets the number of bytes required to encode the value.
VRFMESSAGES_DLL const char * decode(DtRwRadarContactInfo &data, const char *buffer)
Deserializes data from a buffer into the provided object.
VRFMESSAGES_DLL char * encode(const DtRwRadarContactInfo &data, char *buffer)
Serializes the provided data into a buffer.
std::vector< DtRwRadarContactInfo > DtRadarDataEntryList
List type for storing multiple radar contact information entries.
Definition rwRadarContactInfo.h:278