WSF
WsfWaypoint.hpp
Go to the documentation of this file.
1// ****************************************************************************
2// CUI
3//
4// The Advanced Framework for Simulation, Integration, and Modeling (AFSIM)
5//
6// Copyright 2003-2015 The Boeing Company. All rights reserved.
7//
8// The use, dissemination or disclosure of data in this file is subject to
9// limitation or restriction. See accompanying README and LICENSE for details.
10// ****************************************************************************
11// ****************************************************************************
12// Updated by Infoscitex, a DCS Company.
13// ****************************************************************************
14
15#ifndef WSFWAYPOINT_HPP
16#define WSFWAYPOINT_HPP
17
18#include "wsf_export.h"
19
20#include <iosfwd>
21#include <memory>
22#include <string>
23
24#include "UtCloneablePtr.hpp"
25class UtInput;
26#include "UtLog.hpp"
27class UtScriptClass;
28class UtScriptTypes;
29#include "WsfAuxDataEnabled.hpp"
30class WsfGeoPoint;
31#include "WsfObject.hpp"
32#include "WsfPath.hpp"
33#include "WsfStringId.hpp"
34
57{
58public:
60 enum
61 {
64 cLOCATION_MASK = 0x000F,
65
68 cHEADING_MASK = 0x0030,
69
70 cDISTANCE = 0x0100,
71 cTIME = 0x0200,
72 cTIME_TO_POINT = 0x0400,
74 };
75
76 WsfWaypoint() = default;
77 WsfWaypoint(double aLat, double aLon, double aAlt, double aSpeed = WsfPath::cUSE_PREVIOUS);
78 WsfWaypoint(const WsfGeoPoint& aPoint, double aSpeed = WsfPath::cUSE_PREVIOUS);
79 WsfWaypoint(const WsfWaypoint&) = default;
81 WsfWaypoint& operator=(const WsfWaypoint&) = default;
83 ~WsfWaypoint() override = default;
84
85 WsfWaypoint* Clone() const;
86 bool ProcessInput(UtInput& aInput);
87 bool ProcessAllInput(UtInput& aInput);
88
91 bool operator==(const WsfWaypoint& aRhs) const
92 {
93 return ((mLat == aRhs.mLat) && (mLon == aRhs.mLon) && (mAlt == aRhs.mAlt));
94 }
95
98 bool operator!=(const WsfWaypoint& aRhs) const { return !(operator==(aRhs)); }
99
100 void ExtrapolateAlongHeading(double aHeading);
101
102 static std::unique_ptr<UtScriptClass> CreateScriptClass(const std::string& aClassName, UtScriptTypes* aScriptTypesPtr);
103
104 void GreatCircleHeadingAndDistance(const WsfWaypoint& aWaypoint, double& aHeading, double& aDistance) const;
105
106 void Print(ut::log::MessageStream& aStream) const;
107
108 void SetCallback(WsfObject* aCallbackPtr);
109 WsfObject* GetCallback() const;
110
111 double GetPauseTime() const { return mPauseTime; }
112 void SetPauseTime(double aPauseTime) { mPauseTime = aPauseTime; }
113
114 WsfStringId GetLabelId() const { return mLabelId; }
115 void SetLabelId(WsfStringId aLabelId) { mLabelId = aLabelId; }
116
117 WsfStringId GetScriptId() const { return mScriptId; }
118 void SetScriptId(WsfStringId aScriptId) { mScriptId = aScriptId; }
119
120 WsfStringId GetGotoId() const { return mGotoId; }
121 void SetGotoId(WsfStringId aGotoId) { mGotoId = aGotoId; }
122
123 WsfStringId GetNewModeId() const { return mNewModeId; }
124 void SetNewModeId(WsfStringId aNewModeId) { mNewModeId = aNewModeId; }
125
126 int GetPointType() const { return mPointType; }
127 void SetPointType(int aPointType) { mPointType = aPointType; }
128
129 double GetLat() const { return mLat; }
130 void SetLat(double aLat) { mLat = aLat; }
131
132 double GetLon() const { return mLon; }
133 void SetLon(double aLon) { mLon = aLon; }
134
135 double GetAlt() const { return mAlt; }
136 void SetAlt(double aAlt) { mAlt = aAlt; }
137
138 void GetLocationLLA(double& aLat, double& aLon, double& aAlt) const;
139 void SetLocationLLA(double aLat, double aLon, double aAlt);
140
141 double GetHeading() const { return mHeading; }
142 void SetHeading(double aHeading) { mHeading = aHeading; }
143
144 double GetLinearAccel() const { return mLinearAccel; }
145 void SetLinearAccel(double aLinearAccel) { mLinearAccel = aLinearAccel; }
146
147 double GetRadialAccel() const { return mRadialAccel; }
148 void SetRadialAccel(double aRadialAccel) { mRadialAccel = aRadialAccel; }
149
150 double GetClimbRate() const { return mClimbRate; }
151 void SetClimbRate(double aClimbRate) { mClimbRate = aClimbRate; }
152
153 double GetMaximumFlightPathAngle() const { return mMaximumFlightPathAngle; }
154 void SetMaximumFlightPathAngle(double aMaximumFlightPathAngle) { mMaximumFlightPathAngle = aMaximumFlightPathAngle; }
155
156 void SetSpeed(double aSpeed) { mSpeed = aSpeed; }
157 double GetSpeed() const { return mSpeed; }
158
159 double GetDistanceAlongRoute() const { return mDistanceAlongRoute; }
160 void SetDistanceAlongRoute(double aDistanceAlongRoute) { mDistanceAlongRoute = aDistanceAlongRoute; }
161
162 double GetDistanceOrTime() const { return mDistanceOrTime; }
163 void SetDistanceOrTime(double aDistanceOrTime) { mDistanceOrTime = aDistanceOrTime; }
164
165 WsfPath::AltRef GetAltRef() const { return mAltRef; }
166 void SetAltRef(WsfPath::AltRef aAltRef) { mAltRef = aAltRef; }
167
168 WsfPath::EndPath GetEndOfPathOption() const { return mEndOfPathOption; }
169 void SetEndOfPathOption(WsfPath::EndPath aEndOfPathOption) { mEndOfPathOption = aEndOfPathOption; }
170
171 WsfPath::TurnDirection GetTurnDirection() const { return mTurnDirection; }
172 void SetTurnDirection(WsfPath::TurnDirection aTurnDirection) { mTurnDirection = aTurnDirection; }
173
174 WsfPath::Switch GetSwitch() const { return mSwitch; }
175 void SetSwitch(WsfPath::Switch aSwitch) { mSwitch = aSwitch; }
176
177 unsigned int GetRouteId() const { return mRouteId; }
178 void SetRouteId(unsigned int aRouteId) { mRouteId = aRouteId; }
179
180 WsfStringId GetNodeId() const { return mNodeId; }
181 void SetNodeId(WsfStringId aNodeId) { mNodeId = aNodeId; }
182
183 unsigned int GetNodeIdNumber() const { return mNodeIdNumber; }
184 void SetNodeIdNumber(unsigned int aNodeIdNumber) { mNodeIdNumber = aNodeIdNumber; }
185
186 unsigned int GetPositionInRoute() const { return mPositionInRoute; }
187 void SetPositionInRoute(unsigned int aPositionInRoute) { mPositionInRoute = aPositionInRoute; }
188
189 // ================================= WARNING: New member variables ===========================
190 //
191 // This class is transmitted over the network. If you add a new member variable, it is
192 // YOUR RESPONSIBILITY to verify that the member is serialized correctly.
193 // Please see the implementation of WsfWaypoint::SerializeP in xio/WsfXIO_SerializeTypes.cpp
194 //
195 // ===========================================================================================
196
198 template<typename T>
199 void SerializeP(T& aBuff);
200
201private:
203 ut::CloneablePtr<WsfObject> mCallbackPtr;
204
212 int mPointType = cLATITUDE_AND_LONGITUDE;
213
216 double mLat = 0.0;
217
220 double mLon = 0.0;
221
227 double mAlt = WsfPath::cUSE_PREVIOUS;
228
231 double mDistanceOrTime = 0.0;
232
234 double mDistanceAlongRoute = 0.0;
235
242 double mHeading = WsfPath::cUSE_PREVIOUS;
243
245 double mSpeed = WsfPath::cUSE_PREVIOUS;
246
249 double mLinearAccel = WsfPath::cUSE_PREVIOUS;
250
253 double mRadialAccel = WsfPath::cUSE_PREVIOUS;
254
257 double mClimbRate = WsfPath::cUSE_PREVIOUS;
258
260 double mMaximumFlightPathAngle = WsfPath::cUSE_PREVIOUS;
261
264 double mPauseTime = 0.0;
265
268 WsfStringId mLabelId = nullptr;
269
274 WsfStringId mScriptId = nullptr;
275
278 WsfStringId mGotoId = nullptr;
279
282 WsfStringId mNewModeId = nullptr;
283
289
299
302
305
308
309
311 unsigned int mRouteId = 0;
312
318 WsfStringId mNodeId = nullptr;
319
320 unsigned int mNodeIdNumber = 0;
321
323 unsigned int mPositionInRoute = 0;
325};
326
327#endif
aObjectPtr GetLocationLLA(lla[0], lla[1], lla[2])
bool operator==(int aId, const WsfStringInt &aRhs)
Equal relational operator for the case of an integer on the LHS and a StringId on the RHS.
Definition WsfStringId.hpp:69
UtStringId WsfStringId
WsfStringId – the same thing as UtStringId.
Definition WsfStringId.hpp:23
#define WSF_EXPORT
Definition WsfXIO_Export.hpp:35
bool ProcessInput(UtInput &aInput)
Definition WsfAuxDataEnabled.cpp:95
WsfAuxDataEnabled()=default
Definition WsfGeoPoint.hpp:29
Definition WsfObject.hpp:40
Definition WsfWaypoint.hpp:57
@ cTIME_TO_POINT
Specifies time duration to reach point.
Definition WsfWaypoint.hpp:72
@ cDURATION_MASK
Utility value to mask off time and distance commands.
Definition WsfWaypoint.hpp:73
@ cABSOLUTE_HEADING
A specified heading is absolute (north-relative).
Definition WsfWaypoint.hpp:66
@ cLATITUDE_AND_LONGITUDE
A (latitude, longitude) waypoint (altitude is optional).
Definition WsfWaypoint.hpp:62
@ cRELATIVE_OFFSET
A WsfWaypoint specified as an (X,Y,Z) relative offset.
Definition WsfWaypoint.hpp:63
@ cLOCATION_MASK
Utility value to mask off location commands.
Definition WsfWaypoint.hpp:64
@ cRELATIVE_HEADING
A specified heading is relative (usually body-relative).
Definition WsfWaypoint.hpp:67
@ cHEADING_MASK
Utility value to mask off heading commands.
Definition WsfWaypoint.hpp:68
@ cTIME
Specifies a target elapsed time value.
Definition WsfWaypoint.hpp:71
@ cDISTANCE
Specifies a target elapsed distance value.
Definition WsfWaypoint.hpp:70
void SetNewModeId(WsfStringId aNewModeId)
Definition WsfWaypoint.hpp:124
WsfWaypoint(WsfWaypoint &&)=default
unsigned int GetRouteId() const
Definition WsfWaypoint.hpp:177
double GetSpeed() const
Definition WsfWaypoint.hpp:157
WsfStringId GetGotoId() const
Definition WsfWaypoint.hpp:120
double GetHeading() const
Definition WsfWaypoint.hpp:141
unsigned int GetPositionInRoute() const
Definition WsfWaypoint.hpp:186
int GetPointType() const
Definition WsfWaypoint.hpp:126
WsfStringId GetScriptId() const
Definition WsfWaypoint.hpp:117
void SetAltRef(WsfPath::AltRef aAltRef)
Definition WsfWaypoint.hpp:166
void SetNodeIdNumber(unsigned int aNodeIdNumber)
Definition WsfWaypoint.hpp:184
void SetRouteId(unsigned int aRouteId)
Definition WsfWaypoint.hpp:178
WsfStringId GetLabelId() const
Definition WsfWaypoint.hpp:114
double GetLinearAccel() const
Definition WsfWaypoint.hpp:144
void SetDistanceOrTime(double aDistanceOrTime)
Definition WsfWaypoint.hpp:163
unsigned int GetNodeIdNumber() const
Definition WsfWaypoint.hpp:183
WsfPath::TurnDirection GetTurnDirection() const
Definition WsfWaypoint.hpp:171
WsfPath::Switch GetSwitch() const
Definition WsfWaypoint.hpp:174
double GetClimbRate() const
Definition WsfWaypoint.hpp:150
void SetLinearAccel(double aLinearAccel)
Definition WsfWaypoint.hpp:145
bool ProcessAllInput(UtInput &aInput)
Definition WsfWaypoint.cpp:119
bool operator==(const WsfWaypoint &aRhs) const
Definition WsfWaypoint.hpp:91
void SetTurnDirection(WsfPath::TurnDirection aTurnDirection)
Definition WsfWaypoint.hpp:172
WsfWaypoint()=default
WsfWaypoint & operator=(WsfWaypoint &&)=default
WsfPath::EndPath GetEndOfPathOption() const
Definition WsfWaypoint.hpp:168
double GetAlt() const
Definition WsfWaypoint.hpp:135
void SetMaximumFlightPathAngle(double aMaximumFlightPathAngle)
Definition WsfWaypoint.hpp:154
void SetSwitch(WsfPath::Switch aSwitch)
Definition WsfWaypoint.hpp:175
double GetRadialAccel() const
Definition WsfWaypoint.hpp:147
void SetLabelId(WsfStringId aLabelId)
Definition WsfWaypoint.hpp:115
double GetLat() const
Definition WsfWaypoint.hpp:129
void SetAlt(double aAlt)
Definition WsfWaypoint.hpp:136
WsfPath::AltRef GetAltRef() const
Definition WsfWaypoint.hpp:165
double GetLon() const
Definition WsfWaypoint.hpp:132
void SetSpeed(double aSpeed)
Definition WsfWaypoint.hpp:156
WsfStringId GetNodeId() const
Definition WsfWaypoint.hpp:180
void SetLon(double aLon)
Definition WsfWaypoint.hpp:133
void SetEndOfPathOption(WsfPath::EndPath aEndOfPathOption)
Definition WsfWaypoint.hpp:169
void SetGotoId(WsfStringId aGotoId)
Definition WsfWaypoint.hpp:121
double GetPauseTime() const
Definition WsfWaypoint.hpp:111
void SetPositionInRoute(unsigned int aPositionInRoute)
Definition WsfWaypoint.hpp:187
void SetDistanceAlongRoute(double aDistanceAlongRoute)
Definition WsfWaypoint.hpp:160
void SetHeading(double aHeading)
Definition WsfWaypoint.hpp:142
WsfWaypoint & operator=(const WsfWaypoint &)=default
bool operator!=(const WsfWaypoint &aRhs) const
Definition WsfWaypoint.hpp:98
WsfStringId GetNewModeId() const
Definition WsfWaypoint.hpp:123
void SetPointType(int aPointType)
Definition WsfWaypoint.hpp:127
void SetScriptId(WsfStringId aScriptId)
Definition WsfWaypoint.hpp:118
void SetRadialAccel(double aRadialAccel)
Definition WsfWaypoint.hpp:148
void SetClimbRate(double aClimbRate)
Definition WsfWaypoint.hpp:151
double GetMaximumFlightPathAngle() const
Definition WsfWaypoint.hpp:153
WsfWaypoint * Clone() const
Clone constructs a new WsfWaypoint equivalent to the (*this) object.
Definition WsfWaypoint.cpp:83
double GetDistanceAlongRoute() const
Definition WsfWaypoint.hpp:159
void SetNodeId(WsfStringId aNodeId)
Definition WsfWaypoint.hpp:181
WsfWaypoint(const WsfWaypoint &)=default
~WsfWaypoint() override=default
void SetLat(double aLat)
Definition WsfWaypoint.hpp:130
double GetDistanceOrTime() const
Definition WsfWaypoint.hpp:162
void SetPauseTime(double aPauseTime)
Definition WsfWaypoint.hpp:112
AltRef
Altitude reference option.
Definition WsfPath.hpp:52
@ cALT_REF_MOVER_DEFAULT
Use the WsfMover altitude reference.
Definition WsfPath.hpp:53
constexpr double cUSE_PREVIOUS
A waypoint parameter with this value is a request to use the previously used value....
Definition WsfPath.hpp:32
TurnDirection
Turn direction for TurnToHeading and TurnToRelativeHeading.
Definition WsfPath.hpp:88
@ cTURN_DIR_SHORTEST
Turn in the direction that results in the shortest turn (DEFAULT).
Definition WsfPath.hpp:90
Switch
Option setting when to react as a WsfWaypoint is approached.
Definition WsfPath.hpp:76
@ cSWITCH_MOVER_DEFAULT
Use the WsfMover switch setting.
Definition WsfPath.hpp:77
EndPath
End of-path option.
Definition WsfPath.hpp:67
@ cEP_MOVER_DEFAULT
Use the WsfMover end-of-path option.
Definition WsfPath.hpp:68
Copyrights Multiple, All Rights Reserved