WSF
wsf::coverage::Grid Class Referenceabstract

The Grid object defines the region over which coverage can be computed. More...

#include <WsfCoverageGrid.hpp>

Inheritance diagram for wsf::coverage::Grid:
Collaboration diagram for wsf::coverage::Grid:

Public Member Functions

 Grid (const WsfScenario &aScenario)
 Grid (const Grid &aOther)=default
 ~Grid () override=default
GridClone () const override=0
bool ProcessInput (UtInput &aInput) override
virtual void PreparePlatforms (WsfSimulation &aSimulation)=0
virtual const PointGetPoint (PointId aPointId) const =0
virtual std::size_t GetSize () const =0
virtual void Invoke (GridAction &aAction) const =0
virtual GridAsset GetAsset (PointId aPointId) const =0
virtual GridAsset GetAsset (const std::string &aPlatformName) const =0
virtual void HasNullDevice (bool &aAnyNull, bool &aAllNull) const =0
virtual bool CreatesNewPlatforms () const =0
virtual bool IsStructured () const
virtual std::size_t GetNumComponents () const
virtual std::string GetComponentName (std::size_t aComponentIndex) const
 Return the name of the specified grid component.
virtual std::pair< std::size_t, std::size_t > GetComponentSizes (std::size_t aComponentIndex) const
virtual std::pair< std::size_t, std::size_t > GetPointIndices (PointId aPointId) const
virtual void InvokeOnComponent (GridAction &aAction, std::size_t aComponentIndex) const
 Invoke the given aAction on the points of the specified grid component.
void SetUsedFlag ()
bool IsUsed () const
bool Initialize ()
void CategorizeAssets (const WsfSimulation &aSimulation, const std::string &aCategory) const
bool IsInitialized () const
 Return if this Grid has been initialized.
const ut::CentralBody & GetCentralBody () const
 Return the central body to which this grid's point locations refer.
void SetCentralBody (const ut::CentralBody &aCentralBody)
 Set the central body of this grid.
const std::string & GetGridDataFileName () const
 Return the configured grid data file name.
bool GetSuppressGridPlatforms () const
 Return if this grid is suppressing grid platforms.
void SetSuppressGridPlatforms (bool aSuppress)
 Set if this grid suppresses grid platforms.
bool WriteGridDataFile (TextOutputWriter &aWriter) const
bool WriteGridDataFile () const
Public Member Functions inherited from WsfObject
 WsfObject ()
 This is the constructor for the WsfObject class.
 ~WsfObject () override
 This is the destructor for the WsfObject class.
const char * GetScriptClassName () const override
const std::string & GetType () const
WsfStringId GetTypeId () const
 Get the string ID of the 'type' of the object.
void SetType (WsfStringId aType)
const std::string & GetBaseType () const
WsfStringId GetBaseTypeId () const
const TypeListGetTypeList () const
bool IsA_TypeOf (WsfStringId aType) const
WsfObjectoperator= (const WsfObject &aRhs)
 Assignment operator.
template<typename T>
void Serialize (T &aBuff)
 For XIO (de)serialization.
const std::string & GetName () const
WsfStringId GetNameId () const
void SetName (WsfStringId aName)

Protected Member Functions

virtual bool InitializeP ()=0
PointId GetNextAvailableId ()
const WsfScenarioGetScenario () const
 WsfObject (const WsfObject &aSrc)
 Copy constructor (for Clone()).

Additional Inherited Members

Public Types inherited from WsfObject
typedef std::vector< WsfStringIdTypeList
 The list of types returned by GetTypeList.

Detailed Description

The Grid object defines the region over which coverage can be computed.

Constructor & Destructor Documentation

◆ Grid() [1/2]

◆ Grid() [2/2]

wsf::coverage::Grid::Grid ( const Grid & aOther)
default

References Grid().

◆ ~Grid()

wsf::coverage::Grid::~Grid ( )
overridedefault

Member Function Documentation

◆ CategorizeAssets()

void wsf::coverage::Grid::CategorizeAssets ( const WsfSimulation & aSimulation,
const std::string & aCategory ) const

Set the provided category on this object's grid assets.

This method will set two categories for each platform that makes up this grid. The first is the universal coverage grid category of which all grid asset platforms are members. The second is a specific category for a given coverage computation.

Parameters
aSimulation- The simulation in which this grid's platforms exist.
aCategory- The coverage-specific category to assign to this grid's platforms.

References WsfPlatform::AddCategory(), wsf::coverage::CreateGridAction(), wsf::coverage::cUNIVERSAL_GRID_ASSET_CATEGORY, GetAsset(), wsf::coverage::Point::GetID(), WsfSimulation::GetPlatformByName(), Grid(), and Invoke().

◆ Clone()

Grid * wsf::coverage::Grid::Clone ( ) const
overridepure virtual

Return a copy of this object. Must be implemented by all derived types. If cloning is impossible, a WsfUncloneableException should be thrown.

Implements WsfObject.

Implemented in wsf::coverage::CompositeGrid, wsf::coverage::DistanceSteppedGrid, wsf::coverage::ExistingPlatformGrid, wsf::coverage::LatLonGrid, and wsf::coverage::ZoneBasedGrid.

References Grid(), and ProcessInput().

◆ CreatesNewPlatforms()

virtual bool wsf::coverage::Grid::CreatesNewPlatforms ( ) const
pure virtual

Return if the grid creates new platforms during initialization.

A grid should either create new platforms, or use existing platforms. This method returns if this grid creates new platforms. The behavior of some coverage classes will vary depending on the result of this method.

Returns
- true if this grid creates new platforms during initialization; false if it uses existing platforms.

Implemented in wsf::coverage::CompositeGrid, wsf::coverage::ExistingPlatformGrid, and wsf::coverage::RectangularGrid.

◆ GetAsset() [1/2]

virtual GridAsset wsf::coverage::Grid::GetAsset ( const std::string & aPlatformName) const
pure virtual

Return a grid asset for the given platform.

This returns the grid asset associated with the platform that has the given aPlatformName. If there is no such asset, this will return an invalid grid asset.

Parameters
aPlatformName- The name of one of this grid's asset platform.
Returns
- The corresponding grid asset if it exists; an invalid grid asset otherwise.

Implemented in wsf::coverage::CompositeGrid, wsf::coverage::ExistingPlatformGrid, and wsf::coverage::RectangularGrid.

◆ GetAsset() [2/2]

virtual GridAsset wsf::coverage::Grid::GetAsset ( PointId aPointId) const
pure virtual

Return a grid asset for the point with the given ID.

This returns the grid asset for the point with the given aPointId. If there is no such point, this will return an invalid grid asset.

Parameters
aPointId- The ID of a point in this grid.
Returns
- The corresponding grid asset if it exists; an invalid grid asset otherwise.

Implemented in wsf::coverage::CompositeGrid, wsf::coverage::ExistingPlatformGrid, and wsf::coverage::RectangularGrid.

Referenced by CategorizeAssets(), wsf::coverage::CompositeGrid::InitializeP(), wsf::coverage::MeasureGridStats::MeasureGridStats(), and wsf::coverage::MeasureLatLonStats::MeasureLatLonStats().

◆ GetCentralBody()

const ut::CentralBody & wsf::coverage::Grid::GetCentralBody ( ) const
inline

◆ GetComponentName()

virtual std::string wsf::coverage::Grid::GetComponentName ( std::size_t aComponentIndex) const
inlinevirtual

Return the name of the specified grid component.

Reimplemented in wsf::coverage::CompositeGrid.

References WsfObject::GetName().

◆ GetComponentSizes()

std::pair< std::size_t, std::size_t > wsf::coverage::Grid::GetComponentSizes ( std::size_t aComponentIndex) const
virtual

Return the number of points in the specified grid component.

This method returns the size of the structured grid as the N-S and E-W size of the grid in the first and second components of the returned pair, but only if this grid returns true from IsStructured. Otherwise, the size of the component is returned in the first component, and a 1 is returned in the second component.

Parameters
aComponentIndexThe component whose size is being queried.
Returns
A pair containing the N-S and E-W number of points in the structured grid (respectively), or the size of the component in the first component and 1 in the second component if the grid is not structured.

Reimplemented in wsf::coverage::CompositeGrid, and wsf::coverage::RectangularGrid.

References GetSize().

◆ GetGridDataFileName()

const std::string & wsf::coverage::Grid::GetGridDataFileName ( ) const
inline

Return the configured grid data file name.

◆ GetNextAvailableId()

◆ GetNumComponents()

virtual std::size_t wsf::coverage::Grid::GetNumComponents ( ) const
inlinevirtual

Return the number of grid components.

Grid components are geometrically distinct portions of a grid. Most grids have a single component. For an example of a grid with multiple components, see CompositeGrid.

Returns
The number of components of this grid.

Reimplemented in wsf::coverage::CompositeGrid.

Referenced by wsf::coverage::OverlayOutput::Write().

◆ GetPoint()

virtual const Point * wsf::coverage::Grid::GetPoint ( PointId aPointId) const
pure virtual

Return the Point at the given index if it exists.

This will return the Point with the given aPointId if such a point exists. This will return nullptr if this Grid has not been initialized.

Parameters
aPointId- The ID of the point to retrieve.
Returns
- The Point if it exists; nullptr otherwise.

Implemented in wsf::coverage::CompositeGrid, wsf::coverage::ExistingPlatformGrid, and wsf::coverage::RectangularGrid.

◆ GetPointIndices()

std::pair< std::size_t, std::size_t > wsf::coverage::Grid::GetPointIndices ( PointId aPointId) const
virtual

Return the structured index of the point with the given aPointId.

This returns the indices of the point with the given aPointId in the structure of the grid. If the grid is not structured, this will return a pair containing two zeros. The returned indices will each be in the range [0, N) where N is the respective component of the value returned by GetComponentSizes. If the given aPointId does not refer to a point in this grid, this will return a pair with out of bounds indices (they are larger than the return values from GetComponentSizes).

Parameters
aPointIdThe id of the point whose structure indices are requested.
Returns
The structure indices of the point for structured grids; a pair with two zeros otherwise.

Reimplemented in wsf::coverage::CompositeGrid, and wsf::coverage::RectangularGrid.

◆ GetScenario()

◆ GetSize()

virtual std::size_t wsf::coverage::Grid::GetSize ( ) const
pure virtual

Return the number of Points in this Grid.

This will return the number of Points in this Grid. This will return 0 if this Grid has not been initialized.

Returns
- The number of Points in this grid.

Implemented in wsf::coverage::CompositeGrid, wsf::coverage::ExistingPlatformGrid, and wsf::coverage::RectangularGrid.

Referenced by GetComponentSizes(), and Initialize().

◆ GetSuppressGridPlatforms()

bool wsf::coverage::Grid::GetSuppressGridPlatforms ( ) const
inline

Return if this grid is suppressing grid platforms.

Referenced by wsf::coverage::CompositeGrid::InitializeP(), and wsf::coverage::RectangularGrid::PreparePlatforms().

◆ HasNullDevice()

virtual void wsf::coverage::Grid::HasNullDevice ( bool & aAnyNull,
bool & aAllNull ) const
pure virtual

Return if this grid's assets have null devices.

This will determine if this grid has any asset with a null device, and set aAnyNull accordingly. This will also determing if all of this grid's assets have null devices, and set aAllNull accordingly.

Parameters
aAnyNull[out] - Does any asset have a null device.
aAllNull[out] - Do all assets have a null device.

Implemented in wsf::coverage::CompositeGrid, wsf::coverage::ExistingPlatformGrid, and wsf::coverage::RectangularGrid.

◆ Initialize()

bool wsf::coverage::Grid::Initialize ( )

Initialize this Grid.

Initialize this grid. This is called during simulation initialization. This is a template method in which all common initialization tasks can be performed. Specific details for subclasses are handled in InitializeP.

Returns
- true if this Grid was successfully initialized; false otherwise.

References WsfObject::GetName(), GetSize(), InitializeP(), and IsUsed().

Referenced by wsf::coverage::CompositeGrid::InitializeP().

◆ InitializeP()

virtual bool wsf::coverage::Grid::InitializeP ( )
protectedpure virtual

Grid type specific initialization.

Initialization specific to the grid type occurs in this method. In particular, validation on input quantities should occur here. The set of grid points should be defined after this method's successful return, and both GetAsset methods should return valid GridAsset instances for any point in this grid.

Returns
true if initialization is successful; false otherwise.

Implemented in wsf::coverage::CompositeGrid, wsf::coverage::DistanceSteppedGrid, wsf::coverage::ExistingPlatformGrid, wsf::coverage::LatLonGrid, and wsf::coverage::ZoneBasedGrid.

References GetNextAvailableId().

Referenced by Initialize().

◆ Invoke()

virtual void wsf::coverage::Grid::Invoke ( GridAction & aAction) const
pure virtual

Invoke the given action on every Point in this Grid.

This method invokes the given action for every Point in this Grid. If this method is used before this Grid is initialized, this method will do nothing.

Parameters
aAction- The action to invoke for every Point in this Grid.

Implemented in wsf::coverage::CompositeGrid, wsf::coverage::ExistingPlatformGrid, and wsf::coverage::RectangularGrid.

Referenced by CategorizeAssets(), InvokeOnComponent(), wsf::coverage::MeasureGridStats::MeasureGridStats(), wsf::coverage::MeasureLatLonStats::MeasureLatLonStats(), and WriteGridDataFile().

◆ InvokeOnComponent()

virtual void wsf::coverage::Grid::InvokeOnComponent ( GridAction & aAction,
std::size_t aComponentIndex ) const
inlinevirtual

Invoke the given aAction on the points of the specified grid component.

Reimplemented in wsf::coverage::CompositeGrid, and wsf::coverage::ZoneBasedGrid.

References Invoke().

Referenced by wsf::coverage::ZoneBasedGrid::InvokeOnComponent().

◆ IsInitialized()

bool wsf::coverage::Grid::IsInitialized ( ) const
inline

Return if this Grid has been initialized.

Referenced by wsf::coverage::RectangularGrid::RectangularGrid().

◆ IsStructured()

virtual bool wsf::coverage::Grid::IsStructured ( ) const
inlinevirtual

Return if the grid is structured.

Structured grids are those grids that have some positional organization of the grid points. Most grids are structured. For an example of an unstructured grid, see the ExistingPlatformGrid. To prevent a subclass from participating in overlay output from a Coverage object, IsStructured should return false.

Returns
true if the grid has some structure to its points; false otherwise.

Reimplemented in wsf::coverage::CompositeGrid, wsf::coverage::ExistingPlatformGrid, and wsf::coverage::RectangularGrid.

◆ IsUsed()

bool wsf::coverage::Grid::IsUsed ( ) const
inline

Referenced by Initialize().

◆ PreparePlatforms()

virtual void wsf::coverage::Grid::PreparePlatforms ( WsfSimulation & aSimulation)
pure virtual

Prepare the platforms for this grid.

This method will create or modify the platforms associated with this grid object. In particular, this should mark created platforms as private so they are not sent over DIS. This should also set the side of created platforms so they might be easily removed from the visual tools.

Parameters
aSimulation- The simulation in which this grid's platforms will participate.

Implemented in wsf::coverage::CompositeGrid, wsf::coverage::ExistingPlatformGrid, wsf::coverage::RectangularGrid, and wsf::coverage::ZoneBasedGrid.

Referenced by wsf::coverage::ZoneBasedGrid::PreparePlatforms().

◆ ProcessInput()

bool wsf::coverage::Grid::ProcessInput ( UtInput & aInput)
overridevirtual

Process input from a generic source.

Examine the current input command. If it is NOT one of the commands recognized by this class then it simply returns 'false'. If it is one of the commands recognized by this class then it processes the command and returns 'true'.

Parameters
aInputa reference to a UtInput object.
Returns
'true' if the command was one recognized by the class or 'false' if not.
Exceptions
UtInput::ExceptionBase(or an object derived from it) if the command was recognized but contains some sort of error.
Note
If a derived class does not recognize the command (i.e.: the return value is false) then it should call the base class ProcessInput method. This chain should continue until either the command is recognized or the top-level base class is encountered.

Reimplemented from WsfObject.

Reimplemented in wsf::coverage::LatLonGrid, wsf::coverage::RectangularGrid, and wsf::coverage::ZoneBasedGrid.

Referenced by Clone(), wsf::coverage::CompositeGrid::ProcessInput(), wsf::coverage::ExistingPlatformGrid::ProcessInput(), and wsf::coverage::RectangularGrid::ProcessInput().

◆ SetCentralBody()

void wsf::coverage::Grid::SetCentralBody ( const ut::CentralBody & aCentralBody)

Set the central body of this grid.

◆ SetSuppressGridPlatforms()

void wsf::coverage::Grid::SetSuppressGridPlatforms ( bool aSuppress)
inline

Set if this grid suppresses grid platforms.

◆ SetUsedFlag()

void wsf::coverage::Grid::SetUsedFlag ( )
inline

◆ WriteGridDataFile() [1/2]

bool wsf::coverage::Grid::WriteGridDataFile ( ) const

Write the details of the grid points to file.

Grids optionally write details of their points to file. This operation occurs when the simulation is ending. This data is generated only if the user has provided a filename for this file during this object's configuration.

Returns
- false if there was some problem opening and writing to the file; true otherwise.

References WriteGridDataFile().

Referenced by WriteGridDataFile().

◆ WriteGridDataFile() [2/2]

bool wsf::coverage::Grid::WriteGridDataFile ( TextOutputWriter & aWriter) const

Write the details of the grid points to file.

Grids optionally write details of their points to file. This operation occurs when the simulation is ending. This data is generated only if the user has provided a filename for this file during this object's configuration. This form of this method is intended to be used during unit testing.

Parameters
aWriter- The output writer into which the data will be generated.
Returns
- false if there was some problem opening and writing to the file; true otherwise.

References wsf::coverage::TextOutputWriter::CloseStream(), wsf::coverage::TextOutputWriter::CreateContainingFolder(), wsf::coverage::CreateGridAction(), wsf::TerrainInterface::Get(), wsf::coverage::Point::GetAltitude(), wsf::Terrain::GetElevInterp(), wsf::coverage::Point::GetID(), wsf::coverage::Point::GetLatitude(), wsf::coverage::Point::GetLongitude(), Grid(), Invoke(), wsf::coverage::TextOutputWriter::OpenStream(), wsf::coverage::TextOutputWriter::SetPrecision(), wsf::coverage::TextOutputWriter::SetStreamFormat(), wsf::coverage::TextOutputWriter::SetStreamJustify(), wsf::coverage::TextOutputWriter::SetWidth(), and wsf::coverage::TextOutputWriter::WriteField().


The documentation for this class was generated from the following files:
Copyrights Multiple, All Rights Reserved