WSF
wsf::TerrainInterface Class Reference

Manages interface to terrain for a set of WsfTerrain objects. More...

#include <WsfTerrain.hpp>

Classes

class  RectInput
struct  DtedInput
struct  FloatGridInput
struct  GeotiffInput
struct  BathymetryInput
struct  Query

Public Types

enum  DataType {
  cDTED , cFLOAT_GRID , cVISUAL_DATABASE , cGEODETIC_EARTH_DATABASE ,
  cGEOTIFF , cBATHYMETRY
}

Public Member Functions

 TerrainInterface (WsfScenario &aScenarioPtr)
 ~TerrainInterface ()
bool ProcessInput (UtInput &aInput)
bool Initialize ()
WsfScenarioGetScenario ()
std::vector< int > * GetDTEDLevel ()
 Access for DTED DB Information.
int GetDTEDLevelByIndex (size_t aIndex)
std::vector< std::string > * GetDTEDPath ()
void GetDTEDPathByIndex (size_t aIndex, std::string &aPath)
const std::vector< DtedInput > & GetDTEDInputs () const
const std::vector< GeotiffInput > & GetGeotiffInputs () const
 Access for geotiff DB Information.
double GetEarthRadiusMultiplier ()
 Access for Earth Radius Multiplier.
void PerformQueries (WsfSimulation &aSimulation)
bool IsEnabled () const
bool IsVegetationEnabled () const
bool IsGeodeticDatabase () const
bool IsDTED () const
bool IsBathymetryEnabled () const

Static Public Member Functions

static TerrainInterfaceGet (const WsfScenario &aScenario)

Friends

class Terrain

External Services access.

These methods support the External Services and are not part of the WSF public interface.

GeoElevationTileManager & GetTileManager ()
GeoElevationTileManager & GetVegetationManager ()
GeoElevationTileManager & GetManager ()
GeoElevationTileManager & GetBathymetryManager ()
bool AddDtedDirectory (const std::string &aDirName, int aLevel)
bool AddRawDtedDirectory (const std::string &aDirName, int aLevel, int aSwLat, int aSwLon, int aNeLat, int aNeLon)
bool AddGeotiffDirectory (const std::string &aDirName)
bool AddBathymetry (const std::string &aFileName)
int GetElevApproxP (double aLat, double aLon, float &aElev, GeoElevationTileManager &aTileManager, GeoElevationTile *&aTilePtr)
void GetGeodeticElev (double aLat, double aLon, float &aElev)
void GeodeticComputeNormal (double aLat, double aLon, double aNormal[3])
void GetNormalNED (double aLat, double aLon, double aNormal[3], GeoElevationTile *&aTilePtr)
void GetNormalENU (double aLat, double aLon, double aNormal[3], GeoElevationTile *&aTilePtr)
void DisableTerrain ()
void EnableTerrain ()
bool MaskedByTerrain (double aLat1, double aLon1, double aAlt1, double aLat2, double aLon2, double aAlt2, double aMaxRange, double aRadiusScale=1.0)
bool MaskedByVegetation (double aLat1, double aLon1, double aAlt1, double aLat2, double aLon2, double aAlt2, double aMaxRange, double aRadiusScale=1.0)
bool MaskedByUnderwaterTerrain (double aLat1, double aLon1, double aAlt1, double aLat2, double aLon2, double aAlt2, double aMaxRange, double aRadiusScale=1.0)
void ValidateDTED ()
bool SetFloatGridDirectory (const std::string &aDirName, double aSwLat, double aSwLon, double aNeLat, double aNeLon, GeoElevationTileManager &aTileManager)
bool SetFloatGridFile (const std::string &aFileName, GeoElevationTileManager &aTileManager)
int GetElevInterpP (double aLat, double aLon, float &aElev, GeoElevationTileManager &aTileManager, GeoElevationTile *&aTilePtr)
bool MaskedByTerrainP (double aLat1, double aLon1, double aAlt1, double aLat2, double aLon2, double aAlt2, double aMaxRange, GeoElevationTileManager &TileManager, double aRadiusScale)
bool MaskedByTerrainFastP (double aLat1, double aLon1, double aAlt1, double aLat2, double aLon2, double aAlt2, double aMaxRange, GeoElevationTileManager &aTileManager)
bool ListTheFiles (const std::string &aGeodeticEarthFilePathname)
bool DirectoryExists (const std::string &aDirName, const std::string &aCommand)
 Check to see if the indicated directory exists.
bool LoadTile (double aLat, double aLon, GeoElevationTile *&aTilePtr)
int LoadCME_File (const char *aCfgFile)
bool LoadCME_Terrain ()
void ReadString (std::istream &aIn, std::string &aString)

Detailed Description

Manages interface to terrain for a set of WsfTerrain objects.

Member Enumeration Documentation

◆ DataType

Enumerator
cDTED 
cFLOAT_GRID 
cVISUAL_DATABASE 
cGEODETIC_EARTH_DATABASE 
cGEOTIFF 
cBATHYMETRY 

Constructor & Destructor Documentation

◆ TerrainInterface()

wsf::TerrainInterface::TerrainInterface ( WsfScenario & aScenarioPtr)

Referenced by Get(), and Terrain.

◆ ~TerrainInterface()

wsf::TerrainInterface::~TerrainInterface ( )

Member Function Documentation

◆ AddBathymetry()

bool wsf::TerrainInterface::AddBathymetry ( const std::string & aFileName)

◆ AddDtedDirectory()

bool wsf::TerrainInterface::AddDtedDirectory ( const std::string & aDirName,
int aLevel )

Add a NIMA DTED directory to the list of directories containing elevation data.

The directory tree should be in the EXACT format as copied from a NIMA CD (i.e.: The specified directory must contain a file named 'dmed' and a sub-directory named 'dted' which contains the longitudinal directories) The 'dmed' file is expected to be intact and reflect the limits of what is contained in the directory.

Parameters
aDirNameThe name of the directory. It must contain a valid 'dmed' file and a directory 'dted' which contains the longitudinal directories.
aLevelThe DTED level (0, 1, or 2)
Returns
'true' if successful and 'false' if not.

References cDTED, DirectoryExists(), GetManager(), GetScenario(), WsfScenario::GetSystemLog(), ok, and WsfSystemLog::WriteLogEntry().

Referenced by Initialize(), and LoadCME_File().

◆ AddGeotiffDirectory()

bool wsf::TerrainInterface::AddGeotiffDirectory ( const std::string & aDirName)

◆ AddRawDtedDirectory()

bool wsf::TerrainInterface::AddRawDtedDirectory ( const std::string & aDirName,
int aLevel,
int aSwLat,
int aSwLon,
int aNeLat,
int aNeLon )

Add a NIMA DTED directory to the list of directories containing elevation data.

This method is used when the 'dmed' file does not exist or does not represent the true contents of the directory (such as when multiple DTED CDs have been copied into the same directory). The bounding box of the region must be specified.

Parameters
aDirNameThe name of the directory. The immediate sub-directories must be the longitudinal directories.
aLevelThe DTED level (0, 1, or 2)
aSwLatThe latitude of the southwest corner of the bounding box.
aSwLonThe longitude of the southwest corner of the bounding box.
aNeLatThe latitude of the northeast corner of the bounding box.
aNeLonThe longitude of the northeast corner of the bounding box.
Returns
'true' if successful and 'false' if not.

References cDTED, DirectoryExists(), GetManager(), GetScenario(), WsfScenario::GetSystemLog(), ok, and WsfSystemLog::WriteLogEntry().

Referenced by Initialize(), and LoadCME_File().

◆ DirectoryExists()

bool wsf::TerrainInterface::DirectoryExists ( const std::string & aDirName,
const std::string & aCommand )
protected

Check to see if the indicated directory exists.

Referenced by AddDtedDirectory(), AddRawDtedDirectory(), and SetFloatGridDirectory().

◆ DisableTerrain()

void wsf::TerrainInterface::DisableTerrain ( )

Disable terrain processing even if terrain has been loaded. All subsequent terrain calls will operate as though no terrain has been loaded.

◆ EnableTerrain()

void wsf::TerrainInterface::EnableTerrain ( )

(Re)enable terrain processing. If terrain has been defined and terrain processing has not been disabled by the user then subsequent terrain processing calls will utilize the terrain.

Referenced by WsfNavigationMesh::DebugDrawMesh(), and WsfTerrainPathFinder::Initialize().

◆ GeodeticComputeNormal()

void wsf::TerrainInterface::GeodeticComputeNormal ( double aLat,
double aLon,
double aNormal[3] )

Referenced by GetNormalENU(), and GetNormalNED().

◆ Get()

◆ GetBathymetryManager()

GeoElevationTileManager & wsf::TerrainInterface::GetBathymetryManager ( )

◆ GetDTEDInputs()

const std::vector< DtedInput > & wsf::TerrainInterface::GetDTEDInputs ( ) const
inline

◆ GetDTEDLevel()

std::vector< int > * wsf::TerrainInterface::GetDTEDLevel ( )
inline

Access for DTED DB Information.

◆ GetDTEDLevelByIndex()

int wsf::TerrainInterface::GetDTEDLevelByIndex ( size_t aIndex)

◆ GetDTEDPath()

std::vector< std::string > * wsf::TerrainInterface::GetDTEDPath ( )
inline

◆ GetDTEDPathByIndex()

void wsf::TerrainInterface::GetDTEDPathByIndex ( size_t aIndex,
std::string & aPath )

◆ GetEarthRadiusMultiplier()

double wsf::TerrainInterface::GetEarthRadiusMultiplier ( )
inline

Access for Earth Radius Multiplier.

◆ GetElevApproxP()

int wsf::TerrainInterface::GetElevApproxP ( double aLat,
double aLon,
float & aElev,
GeoElevationTileManager & aTileManager,
GeoElevationTile *& aTilePtr )

◆ GetElevInterpP()

int wsf::TerrainInterface::GetElevInterpP ( double aLat,
double aLon,
float & aElev,
GeoElevationTileManager & aTileManager,
GeoElevationTile *& aTilePtr )
protected

◆ GetGeodeticElev()

void wsf::TerrainInterface::GetGeodeticElev ( double aLat,
double aLon,
float & aElev )

◆ GetGeotiffInputs()

const std::vector< GeotiffInput > & wsf::TerrainInterface::GetGeotiffInputs ( ) const
inline

Access for geotiff DB Information.

◆ GetManager()

GeoElevationTileManager & wsf::TerrainInterface::GetManager ( )

◆ GetNormalENU()

void wsf::TerrainInterface::GetNormalENU ( double aLat,
double aLon,
double aNormal[3],
GeoElevationTile *& aTilePtr )

Get the unit normal vector to the terrain in East-North-Up coordinates.

Parameters
aLatLatitude in the range [-90, 90]
aLonLongitude in the range [-180, 180]
aNormal[output] The resulting normal vector or [0, 0, 1] if
aTilePtr[output] The tile containing aLat, aLon there is no terrain at the requested point or if terrain processing has been disabled.

References cBATHYMETRY, cDTED, cFLOAT_GRID, cGEODETIC_EARTH_DATABASE, cGEOTIFF, cVISUAL_DATABASE, GeodeticComputeNormal(), and LoadTile().

◆ GetNormalNED()

void wsf::TerrainInterface::GetNormalNED ( double aLat,
double aLon,
double aNormal[3],
GeoElevationTile *& aTilePtr )

Get the unit normal vector to the terrain in North-East-Down coordinates.

Parameters
aLatLatitude in the range [-90, 90]
aLonLongitude in the range [-180, 180]
aNormal[output] The resulting normal vector or [0, 0, -1] if
aTilePtr[output] The tile containing aLat,aLon there is no terrain at the requested point or if terrain processing has been disabled.

References cBATHYMETRY, cDTED, cFLOAT_GRID, cGEODETIC_EARTH_DATABASE, cGEOTIFF, cVISUAL_DATABASE, GeodeticComputeNormal(), and LoadTile().

◆ GetScenario()

◆ GetTileManager()

GeoElevationTileManager & wsf::TerrainInterface::GetTileManager ( )

References GetManager().

◆ GetVegetationManager()

GeoElevationTileManager & wsf::TerrainInterface::GetVegetationManager ( )

References cDTED, and wsf::Terrain::cVEGETATION.

Referenced by Initialize(), and MaskedByVegetation().

◆ Initialize()

◆ IsBathymetryEnabled()

bool wsf::TerrainInterface::IsBathymetryEnabled ( ) const
inline

◆ IsDTED()

bool wsf::TerrainInterface::IsDTED ( ) const
inline

◆ IsEnabled()

bool wsf::TerrainInterface::IsEnabled ( ) const
inline

Referenced by MaskedByTerrain().

◆ IsGeodeticDatabase()

bool wsf::TerrainInterface::IsGeodeticDatabase ( ) const
inline

◆ IsVegetationEnabled()

bool wsf::TerrainInterface::IsVegetationEnabled ( ) const
inline

Referenced by MaskedByVegetation().

◆ ListTheFiles()

bool wsf::TerrainInterface::ListTheFiles ( const std::string & aGeodeticEarthFilePathname)
protected

Referenced by Initialize().

◆ LoadCME_File()

int wsf::TerrainInterface::LoadCME_File ( const char * aCfgFile)
protected

This is a cut down version of 'GeoData::LoadConfigurationFile' from the geodata project. This allows us to read our normal 'geodata.dat' files. All of the directives except 'dted' and 'raw_dted' are ignored.

Returns
0 File open and processed successfully <0 File name not specified or doesn't exist >0 terrain data load error.

References AddDtedDirectory(), AddRawDtedDirectory(), GetScenario(), WsfScenario::GetSystemLog(), ReadString(), and WsfSystemLog::WriteLogEntry().

Referenced by LoadCME_Terrain().

◆ LoadCME_Terrain()

bool wsf::TerrainInterface::LoadCME_Terrain ( )
protected

References LoadCME_File(), and ok.

Referenced by Initialize().

◆ LoadTile()

bool wsf::TerrainInterface::LoadTile ( double aLat,
double aLon,
GeoElevationTile *& aTilePtr )
protected

Check to see if the current tile encloses the provided latitude and longitude. If not load the tile that does.

Parameters
aLatLatitude in the range [-90, 90].
aLonLongitude in the range [-180, 180].
aTilePtr[output] The tile containing aLat,aLon
Returns
Returns true if a tile was loaded, false if a tile was not loaded.
Note
This method loads a tile for "bare earth" terrain only, not the vegetation layer.

References GetManager().

Referenced by GetNormalENU(), and GetNormalNED().

◆ MaskedByTerrain()

bool wsf::TerrainInterface::MaskedByTerrain ( double aLat1,
double aLon1,
double aAlt1,
double aLat2,
double aLon2,
double aAlt2,
double aMaxRange,
double aRadiusScale = 1.0 )

Is the line of sight between two points masked by the terrain?

Parameters
aLat1Latitude of the first point [-90, 90]
aLon1Longitude of the first point [-180, 180]
aAlt1Altitude MSL of the first point.
aLat2Latitude of the second point [-90, 90]
aLon2Longitude of the second point [-180, 180]
aAlt2Altitude MSL of the second point.
aMaxRangeDistance at which to stop checking.
aRadiusScaleEffective earth radius multiplier (default = 1.0)
Returns
'true' if masked by terrain or 'false' if not.

References GetBathymetryManager(), GetManager(), IsBathymetryEnabled(), IsEnabled(), and MaskedByTerrainP().

Referenced by wsf::comm::ComponentHW_Subsurface::CanSendTo(), WsfLOS_Manager::MaskedByTerrain(), WsfLOS_Manager::MaskedByTerrain(), and WsfLOS_Manager::MaskedByTerrain().

◆ MaskedByTerrainFastP()

bool wsf::TerrainInterface::MaskedByTerrainFastP ( double aLat1,
double aLon1,
double aAlt1,
double aLat2,
double aLon2,
double aAlt2,
double aMaxRange,
GeoElevationTileManager & aTileManager )
protected

◆ MaskedByTerrainP()

bool wsf::TerrainInterface::MaskedByTerrainP ( double aLat1,
double aLon1,
double aAlt1,
double aLat2,
double aLon2,
double aAlt2,
double aMaxRange,
GeoElevationTileManager & TileManager,
double aRadiusScale )
protected

◆ MaskedByUnderwaterTerrain()

bool wsf::TerrainInterface::MaskedByUnderwaterTerrain ( double aLat1,
double aLon1,
double aAlt1,
double aLat2,
double aLon2,
double aAlt2,
double aMaxRange,
double aRadiusScale = 1.0 )

Is the line of sight between two points masked by the underwater terrain?

Parameters
aLat1Latitude of the first point [-90, 90]
aLon1Longitude of the first point [-180, 180]
aAlt1Altitude MSL of the first point.
aLat2Latitude of the second point [-90, 90]
aLon2Longitude of the second point [-180, 180]
aAlt2Altitude MSL of the second point.
aMaxRangeDistance at which to stop checking.
aRadiusScaleEffective earth radius multiplier (default = 1.0)
Returns
'true' if masked by terrain or 'false' if not.

References GetBathymetryManager(), IsBathymetryEnabled(), and MaskedByTerrainP().

◆ MaskedByVegetation()

bool wsf::TerrainInterface::MaskedByVegetation ( double aLat1,
double aLon1,
double aAlt1,
double aLat2,
double aLon2,
double aAlt2,
double aMaxRange,
double aRadiusScale = 1.0 )

Is the line of sight between two points masked by the vegetation layer?

Parameters
aLat1Latitude of the first point [-90, 90]
aLon1Longitude of the first point [-180, 180]
aAlt1Altitude MSL of the first point.
aLat2Latitude of the second point [-90, 90]
aLon2Longitude of the second point [-180, 180]
aAlt2Altitude MSL of the second point.
aMaxRangeDistance at which to stop checking.
aRadiusScaleEffective earth radius multiplier (default = 1.0)
Returns
'true' if masked by vegetation layer or 'false' if not.

References GetVegetationManager(), IsVegetationEnabled(), and MaskedByTerrainP().

Referenced by WsfLOS_Manager::MaskedByVegetation(), WsfLOS_Manager::MaskedByVegetation(), and WsfLOS_Manager::MaskedByVegetation().

◆ PerformQueries()

◆ ProcessInput()

◆ ReadString()

void wsf::TerrainInterface::ReadString ( std::istream & aIn,
std::string & aString )
protected

Referenced by LoadCME_File().

◆ SetFloatGridDirectory()

bool wsf::TerrainInterface::SetFloatGridDirectory ( const std::string & aDirName,
double aSwLat,
double aSwLon,
double aNeLat,
double aNeLon,
GeoElevationTileManager & aTileManager )
protected

Set a Grid-Float processed DEM directory tree. The bounding box of the region must be specified.

Parameters
aDirNameThe name of the directory. The immediate sub-directories must be the longitudinal directories.
aSwLatThe latitude of the southwest corner of the bounding box.
aSwLonThe longitude of the southwest corner of the bounding box.
aNeLatThe latitude of the northeast corner of the bounding box.
aNeLonThe longitude of the northeast corner of the bounding box.
aTileManagerThe tile manager
Returns
'true' if successful and 'false' if not.

References cFLOAT_GRID, wsf::Terrain::cTERRAIN, DirectoryExists(), GetScenario(), WsfScenario::GetSystemLog(), ok, and WsfSystemLog::WriteLogEntry().

Referenced by Initialize().

◆ SetFloatGridFile()

bool wsf::TerrainInterface::SetFloatGridFile ( const std::string & aFileName,
GeoElevationTileManager & aTileManager )
protected

Set a Grid-Float processed DEM directory tree. The bounding box of the region must be specified.

Parameters
aFileNameThe name of the file. The program must be able to find the file, independent of any directory entries you may have made; so there must be an absolute or relative path associated with it.
aTileManagerThe tile manager
Returns
'true' if successful and 'false' if not.

References cFLOAT_GRID, wsf::Terrain::cTERRAIN, GetScenario(), WsfScenario::GetSystemLog(), ok, and WsfSystemLog::WriteLogEntry().

Referenced by Initialize().

◆ ValidateDTED()

void wsf::TerrainInterface::ValidateDTED ( )
protected

Validate DTED data for correctness. This method examines ALL of the loaded DTED to see if the elevation data is reasonable.

Referenced by Initialize().

◆ Terrain

friend class Terrain
friend

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