WSF
WsfAltLocComponent.hpp
Go to the documentation of this file.
1// ****************************************************************************
2// CUI
3//
4// The Advanced Framework for Simulation, Integration, and Modeling (AFSIM)
5//
6// The use, dissemination or disclosure of data in this file is subject to
7// limitation or restriction. See accompanying README and LICENSE for details.
8// ****************************************************************************
9#ifndef WSF_ALT_LOC_COMPONENT_HPP
10#define WSF_ALT_LOC_COMPONENT_HPP
11
12#include "WsfComponent.hpp"
13#include "WsfObject.hpp"
14#include "WsfPlatform.hpp"
15
16namespace wsf
17{
18namespace altloc
19{
20
22{
23 MSL, // mean sea level
24 AGL // above ground level
25};
26
28{
29 double lat{0.0}; // latitude
30 double lon{0.0}; // longitude
31 double alt{0.0}; // altitude
32 double hed{0.0}; // heading
34 double weight{0.0};
35 bool altSet{false};
36 bool hedSet{false};
37 bool wgtSet{false};
38};
39
48
50{
51public:
52 enum
53 {
54 cCOMPONENT = 20181205
55 };
56
57 static constexpr const char* cNAME = "AlternateLocationsComponent";
58 static constexpr const char* cCOMMAND = "alternate_locations";
59
60 static constexpr double cINVALID_DRAW = -1.0;
61 static constexpr int cINVALID_LOCATION_INDEX = -1;
62
63 union Offset
64 {
65 struct
66 {
67 double lat;
68 double lon;
69 double alt;
70 double hed;
71 bool altSet;
72 bool hedSet;
73 } LLA;
74
75 struct
76 {
77 double angle; // great circle heading-angle to determine position with relation to parent
78 double radius; // radius of great circle w/ parent at center
79 double alt;
80 double hed; // platform heading
81 bool altSet;
82 bool hedSet;
83 } ARA; // angle-radius-altitude
84 };
85
86 Component();
87 Component(const Component& aSrc);
88 Component& operator=(const Component&) = delete;
89 ~Component() override = default;
90
92
93 WsfStringId GetComponentName() const override;
94 const int* GetComponentRoles() const override;
95 WsfComponent* CloneComponent() const override;
96 void* QueryInterface(int aRole) override;
97 static Component* Find(const WsfPlatform& aParent);
98 static Component* FindOrCreate(WsfPlatform& aParent);
100
101 // Framework methods.
103 bool ProcessInput(UtInput& aInput) override;
104 WsfObject* Clone() const override;
106
107 bool PreInitialize(double aSimTime) override;
108
110
113
115 std::vector<WeightedLocation> mLocations;
116
117 double mDraw;
120
121private:
122 enum class DebugType
123 {
124 ON,
125 OFF,
126 GLOBAL,
127 };
128
129 int GetRandomLocation();
130
131 void ReadAltLocLine(UtInput& aInput, WeightedLocation& aLoc);
132 bool ReadPlatformDebugFlag(UtInput& aInput);
133
134 DebugType mDebugType;
135};
136
137} // namespace altloc
138} // namespace wsf
139
141
142#endif
#define WSF_DECLARE_COMPONENT_ROLE_TYPE(TYPE, ROLE)
Definition WsfComponentRoles.hpp:44
WsfComponentT< WsfPlatform > WsfPlatformComponent
A convenient typedef for a platform component.
Definition WsfComponent.hpp:171
UtStringId WsfStringId
WsfStringId – the same thing as UtStringId.
Definition WsfStringId.hpp:23
Definition WsfComponent.hpp:39
WsfObject()
This is the constructor for the WsfObject class.
Definition WsfObject.cpp:88
Platforms represent a entity within the simulation.
Definition WsfPlatform.hpp:115
Definition WsfAltLocComponent.hpp:50
Component & operator=(const Component &)=delete
@ cCOMPONENT
Definition WsfAltLocComponent.hpp:54
static constexpr double cINVALID_DRAW
Definition WsfAltLocComponent.hpp:60
WsfObject * Clone() const override
Definition WsfAltLocComponent.cpp:344
WsfStringId mReferenceName
Definition WsfAltLocComponent.hpp:111
Offset mOffset
Definition WsfAltLocComponent.hpp:114
WsfComponent * CloneComponent() const override
Definition WsfAltLocComponent.cpp:68
static Component * Find(const WsfPlatform &aParent)
Find the instance of this component attached to the specified platform.
Definition WsfAltLocComponent.cpp:323
Component()
Definition WsfAltLocComponent.cpp:30
bool PreInitialize(double aSimTime) override
Definition WsfAltLocComponent.cpp:386
WsfStringId GetComponentName() const override
Definition WsfAltLocComponent.cpp:349
~Component() override=default
static Component * FindOrCreate(WsfPlatform &aParent)
Definition WsfAltLocComponent.cpp:333
const int * GetComponentRoles() const override
Definition WsfAltLocComponent.cpp:61
BlockType mBlockType
Definition WsfAltLocComponent.hpp:109
Component * mReferenceComponent
Definition WsfAltLocComponent.hpp:112
static constexpr const char * cCOMMAND
Definition WsfAltLocComponent.hpp:58
static constexpr int cINVALID_LOCATION_INDEX
Definition WsfAltLocComponent.hpp:61
int mLocationIndex
Definition WsfAltLocComponent.hpp:119
std::vector< WeightedLocation > mLocations
Definition WsfAltLocComponent.hpp:115
static constexpr const char * cNAME
Definition WsfAltLocComponent.hpp:57
double mWeightsSum
Definition WsfAltLocComponent.hpp:118
double mDraw
Definition WsfAltLocComponent.hpp:117
void * QueryInterface(int aRole) override
Definition WsfAltLocComponent.cpp:74
bool ProcessInput(UtInput &aInput) override
Definition WsfAltLocComponent.cpp:87
Definition WsfAltLocComponent.cpp:28
AltitudeReference
Definition WsfAltLocComponent.hpp:22
@ MSL
Definition WsfAltLocComponent.hpp:23
@ AGL
Definition WsfAltLocComponent.hpp:24
BlockType
Definition WsfAltLocComponent.hpp:41
@ LOCAL
Definition WsfAltLocComponent.hpp:42
@ OFF_ARA
Definition WsfAltLocComponent.hpp:44
@ OFF_LLA
Definition WsfAltLocComponent.hpp:45
@ REF_LOC
Definition WsfAltLocComponent.hpp:43
@ NONE
Definition WsfAltLocComponent.hpp:46
Function definitions for those who need run-time access to the version.
Definition WsfComm.cpp:32
Definition WsfAltLocComponent.hpp:28
double weight
Definition WsfAltLocComponent.hpp:34
double alt
Definition WsfAltLocComponent.hpp:31
double lat
Definition WsfAltLocComponent.hpp:29
double lon
Definition WsfAltLocComponent.hpp:30
bool wgtSet
Definition WsfAltLocComponent.hpp:37
bool hedSet
Definition WsfAltLocComponent.hpp:36
double hed
Definition WsfAltLocComponent.hpp:32
bool altSet
Definition WsfAltLocComponent.hpp:35
AltitudeReference altRef
Definition WsfAltLocComponent.hpp:33
Definition WsfAltLocComponent.hpp:64
double lon
Definition WsfAltLocComponent.hpp:68
bool hedSet
Definition WsfAltLocComponent.hpp:72
struct wsf::altloc::Component::Offset::@026051270372300164131153273215144275101004323324 LLA
double alt
Definition WsfAltLocComponent.hpp:69
double hed
Definition WsfAltLocComponent.hpp:70
double angle
Definition WsfAltLocComponent.hpp:77
bool altSet
Definition WsfAltLocComponent.hpp:71
double lat
Definition WsfAltLocComponent.hpp:67
struct wsf::altloc::Component::Offset::@334105115055242107165246354313343116121056236177 ARA
double radius
Definition WsfAltLocComponent.hpp:78
Copyrights Multiple, All Rights Reserved