WSF
WsfZone.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#ifndef WSFZONE_HPP
13#define WSFZONE_HPP
14
15#include "wsf_export.h"
16
17#include <map>
18#include <vector>
19
20#include "UtColor.hpp"
21class UtInput;
22class UtInputBlock;
23#include "UtOptional.hpp"
24#include "WsfAuxDataEnabled.hpp"
25#include "WsfComponent.hpp"
26class WsfDraw;
27class WsfGeoPoint;
28#include "WsfObject.hpp"
29class WsfPlatform;
30class WsfScenario;
31class WsfSimulation;
32
63{
64public:
65 static constexpr const char* cTYPE_KIND = "zone";
66
67 static constexpr double cUNSPECIFIED = 1.0E20;
68 static constexpr double cHUGE = 9.9E20;
69 static constexpr double cSMALL = -9.9E20;
70
71 struct Point
72 {
73 Point(double aX, double aY)
74 : mX(aX)
75 , mY(aY)
76 {
77 }
78
79 double mX;
80 double mY;
81 };
82
83 WsfZone();
84 WsfZone& operator=(const WsfZone&) = delete;
85 ~WsfZone() override = default;
86
88
89 WsfComponent* CloneComponent() const override { return Clone(); }
91 WsfStringId GetComponentName() const override { return GetNameId(); }
92 const int* GetComponentRoles() const override;
93 void* QueryInterface(int aRole) override;
94 void ComponentParentChanged(WsfPlatform* aPlatformPtr) override { mPlatformPtr = aPlatformPtr; }
96
98
100 WsfZone* Clone() const override = 0;
101
102 // Needed to resolve ambiguity between WsfObject and WsfComponent.
103 bool ProcessInput(UtInput& aInput) override;
104
105 bool Initialize(double aSimTime) override;
106 virtual void Initialize(const WsfScenario& aScenario);
107
108 virtual bool PointIsInside(WsfSimulation* aSimulationPtr,
109 const double aViewedPointWCS[3],
110 const double aEyePointWCS[3],
111 const double aLookHeading,
112 const double aDeltaDownRange = 0.0);
113
114 virtual double CheckIntersections(const double aLLA1[3], const double aLLA2[3]) { return 0.0; }
115
116 virtual bool GetLatLonExtrema(double& aSouthernLat, double& aWesternLon, double& aNorthernLat, double& aEasternLon) const;
117
119 void SetGlobalName(WsfStringId aGlobalName) { mGlobalName = aGlobalName; }
120
124 WsfStringId GetGlobalName() const { return mGlobalName; }
125
126 virtual double Area();
127
128 virtual WsfGeoPoint Reference() = 0;
129 virtual WsfGeoPoint Centroid();
130
131 virtual void MaxPoint(double& aX, double& aY, double& aAlt);
132 virtual void MinPoint(double& aX, double& aY, double& aAlt);
133
134 virtual void DrawBounds(WsfDraw& aDraw) {}
135 virtual void DrawCentroid(WsfDraw& aDraw) {}
136 virtual void Draw(WsfDraw& aDraw) {}
137 virtual void DrawRelative(WsfDraw& aDraw, const double aEyePointWCS[3], const double aLookHeading) {}
138
139 virtual void DebugDrawBounds(WsfDraw& aDraw) {}
140 virtual void DebugDrawCentroid(WsfDraw& aDraw) {}
141 virtual void DebugDrawZone(WsfDraw& aDraw) {}
142 virtual void DebugDrawZoneRelative(WsfDraw& aDraw, const double aEyePointWCS[3], const double aLookHeading) {}
143
145 virtual const std::map<WsfStringId, double>& GetModifierList() const { return mModifierList; }
146
148 virtual double ModifierValue(const std::string& aModifierName) const;
149
150 bool IsInitialized() const { return mIsInitialized; }
151
152 void SetFillColor(const std::string& aColor);
153 void SetFillColor(const UtColor& aColor) { mFillColor = aColor; }
154 void SetLineColor(const std::string& aColor);
155 void SetLineColor(const UtColor& aColor) { mLineColor = aColor; }
156
157 virtual ut::optional<UtColor> GetFillColor() const { return mFillColor; }
158 virtual ut::optional<UtColor> GetLineColor() const { return mLineColor; }
159
160protected:
162 WsfZone(const WsfZone& aSrc);
163
165
166 std::map<WsfStringId, double> mModifierList;
167
168 // bounding box coordinates
169 double mMinAlt; // Bottom of the Zone (meters)
170 double mMaxAlt; // Top of the Zone (meters)
171 double mMinX;
172 double mMaxX;
173 double mMinY;
174 double mMaxY;
175
176 double mArea;
178
180
181private:
182 WsfStringId mGlobalName;
183 ut::optional<UtColor> mFillColor;
184 ut::optional<UtColor> mLineColor;
185};
186
188
189#endif
@ cWSF_INITIALIZE_ORDER_ZONE
Zones generally aren't dependent on anything except position, but something may be dependent on them.
Definition WsfComponentRoles.hpp:183
#define WSF_DECLARE_COMPONENT_ROLE_TYPE(TYPE, ROLE)
Definition WsfComponentRoles.hpp:44
@ cWSF_COMPONENT_ZONE
A 'zone' component (WsfZone).
Definition WsfComponentRoles.hpp:110
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
#define WSF_EXPORT
Definition WsfXIO_Export.hpp:35
WsfAuxDataEnabled()=default
Definition WsfComponent.hpp:39
virtual const int * GetComponentRoles() const =0
virtual bool Initialize(double aSimTime)
Definition WsfComponent.cpp:45
virtual void * QueryInterface(int aRole)=0
Provides the capability to draw shapes into the WSF replay file.
Definition WsfDraw.hpp:35
Definition WsfGeoPoint.hpp:29
WsfStringId GetNameId() const
Definition WsfObject.hpp:66
WsfObject()
This is the constructor for the WsfObject class.
Definition WsfObject.cpp:88
virtual WsfObject * Clone() const =0
virtual bool ProcessInput(UtInput &aInput)
Definition WsfObject.cpp:140
Platforms represent a entity within the simulation.
Definition WsfPlatform.hpp:115
Contains the data required to create a simulation, and acts as the entry point for input file process...
Definition WsfScenario.hpp:111
The main controller for a simulation.
Definition WsfSimulation.hpp:109
Definition WsfZone.hpp:63
std::map< WsfStringId, double > mModifierList
Definition WsfZone.hpp:166
int GetComponentInitializationOrder() const override
Definition WsfZone.hpp:90
WsfPlatform * GetPlatform() const
Definition WsfZone.hpp:97
virtual void MinPoint(double &aX, double &aY, double &aAlt)
Definition WsfZone.cpp:194
virtual void DebugDrawBounds(WsfDraw &aDraw)
Definition WsfZone.hpp:139
void SetLineColor(const UtColor &aColor)
Definition WsfZone.hpp:155
double mMinX
Definition WsfZone.hpp:171
virtual double CheckIntersections(const double aLLA1[3], const double aLLA2[3])
Definition WsfZone.hpp:114
static constexpr double cSMALL
Definition WsfZone.hpp:69
WsfStringId GetComponentName() const override
Definition WsfZone.hpp:91
virtual ut::optional< UtColor > GetFillColor() const
Definition WsfZone.hpp:157
virtual const std::map< WsfStringId, double > & GetModifierList() const
Get the modifier list for WsfZoneAttenuation.
Definition WsfZone.hpp:145
virtual void DebugDrawZone(WsfDraw &aDraw)
Definition WsfZone.hpp:141
static constexpr const char * cTYPE_KIND
Definition WsfZone.hpp:65
void SetGlobalName(WsfStringId aGlobalName)
Set the global model that this zone was cloned from.
Definition WsfZone.hpp:119
void ComponentParentChanged(WsfPlatform *aPlatformPtr) override
Definition WsfZone.hpp:94
bool IsInitialized() const
Definition WsfZone.hpp:150
virtual void DrawCentroid(WsfDraw &aDraw)
Definition WsfZone.hpp:135
WsfZone()
Definition WsfZone.cpp:21
WsfStringId GetGlobalName() const
Definition WsfZone.hpp:124
double mMaxY
Definition WsfZone.hpp:174
WsfPlatform * mPlatformPtr
Definition WsfZone.hpp:164
virtual WsfGeoPoint Reference()=0
bool mIsInitialized
Definition WsfZone.hpp:179
virtual void MaxPoint(double &aX, double &aY, double &aAlt)
Definition WsfZone.cpp:185
static constexpr double cHUGE
Definition WsfZone.hpp:68
virtual ut::optional< UtColor > GetLineColor() const
Definition WsfZone.hpp:158
WsfZone * Clone() const override=0
The standard Clone() method (virtual copy constructor).
WsfZone & operator=(const WsfZone &)=delete
virtual bool PointIsInside(WsfSimulation *aSimulationPtr, const double aViewedPointWCS[3], const double aEyePointWCS[3], const double aLookHeading, const double aDeltaDownRange=0.0)
Definition WsfZone.cpp:160
virtual void Draw(WsfDraw &aDraw)
Definition WsfZone.hpp:136
void SetFillColor(const UtColor &aColor)
Definition WsfZone.hpp:153
double mMaxX
Definition WsfZone.hpp:172
double mMinY
Definition WsfZone.hpp:173
static constexpr double cUNSPECIFIED
Definition WsfZone.hpp:67
double mMaxAlt
Definition WsfZone.hpp:170
double mMinAlt
Definition WsfZone.hpp:169
~WsfZone() override=default
WsfComponent * CloneComponent() const override
Definition WsfZone.hpp:89
virtual void DebugDrawZoneRelative(WsfDraw &aDraw, const double aEyePointWCS[3], const double aLookHeading)
Definition WsfZone.hpp:142
double mArea
Definition WsfZone.hpp:176
virtual void DebugDrawCentroid(WsfDraw &aDraw)
Definition WsfZone.hpp:140
virtual WsfGeoPoint Centroid()
Definition WsfZone.cpp:178
Point mCentroid
Definition WsfZone.hpp:177
virtual void DrawRelative(WsfDraw &aDraw, const double aEyePointWCS[3], const double aLookHeading)
Definition WsfZone.hpp:137
virtual void DrawBounds(WsfDraw &aDraw)
Definition WsfZone.hpp:134
Definition WsfZone.hpp:72
double mY
Definition WsfZone.hpp:80
double mX
Definition WsfZone.hpp:79
Point(double aX, double aY)
Definition WsfZone.hpp:73
Copyrights Multiple, All Rights Reserved