|
WSF
|
#include <WsfTerrain.hpp>
Classes | |
| struct | Post |
Public Types | |
| enum | ElevationType { cINVALID , cTERRAIN , cVEGETATION , cBATHYMETRY } |
Public Member Functions | |
| Terrain (TerrainInterface *aInterfacePtr) | |
| Terrain (const Terrain &aSrc) | |
| Terrain & | operator= (const Terrain &aRhs)=delete |
| ~Terrain () | |
| bool | Initialize (TerrainInterface *aInterfacePtr) |
| bool | Initialize (WsfSimulation &aSimulation) |
| int | GetElevApprox (double aLat, double aLon, float &aElev) |
| int | GetElevApprox (const double aWCS[3], float &aElev) |
| int | GetElevInterp (double aLat, double aLon, float &aElev) |
| int | GetElevInterp (const double aWCS[3], float &aElev) |
| int | GetVegElevApprox (double aLat, double aLon, float &aElev) |
| int | GetVegElevInterp (double aLat, double aLon, float &aElev) |
| int | GetBathymetryElevApprox (double aLat, double aLon, float &aElev) |
| int | GetBathymetryElevInterp (double aLat, double aLon, float &aElev) |
| void | GetNormalNED (double aLat, double aLon, double aNormal[3]) |
| void | GetNormalENU (double aLat, double aLon, double aNormal[3]) |
| bool | TerrainHitAlongLOS (const double aEyepointWCS[3], double aTerminusWCS[3]) |
| bool | IsEnabled () |
| bool | IsVegetationEnabled () |
| bool | IsBathymetryEnabled () |
| bool | MaskedByTerrain (double aLat1, double aLon1, double aAlt1, double aLat2, double aLon2, double aAlt2, double aMaxRange, double aRadiusScale=1.0) |
| bool | MaskedByTerrainFast (double aLat1, double aLon1, double aAlt1, double aLat2, double aLon2, double aAlt2, double aMaxRange) |
| bool | MaskedByVegetation (double aLat1, double aLon1, double aAlt1, double aLat2, double aLon2, double aAlt2, double aMaxRange, double aRadiusScale=1.0) |
| bool | MaskedByVegetationFast (double aLat1, double aLon1, double aAlt1, double aLat2, double aLon2, double aAlt2, double aMaxRange) |
| bool | GetHeightExtremaIn (WsfSimulation &aSimulation, WsfZone *aZonePtr, Post &aMin, Post &aMax) |
| bool | GetHeightExtremaIn (WsfSimulation &aSimulation, double aLatSouth, double aLonWest, double aLatNorth, double aLonEast, Post &aMin, Post &aMax, WsfZone *aZonePtr=nullptr) |
| bool | IsGeodeticDatabase () |
| bool | DTEDTypeDatabase () |
Protected Member Functions | |
| GeoElevationTile * | GetTilePtr () |
| GeoElevationTileManager & | GetManager () |
| bool | LoadTile (double aLat, double aLon) |
| bool | ComputeTerrainImpactP (double aLocationWCS_1[3], double aLocationWCS_2[3], bool aFirstPass=false) |
Friends | |
| class | TerrainInterface |
Implements the terrain database and query operations.
This class provides the following major functions:
An instance of a Terrain object provides the context in which to perform the first two operations. The object maintains a concept of a 'current tile', which represents the tile that contains the latitude and longitude involved in the last query operation. When a query is performed the object will determine if the current tile is the correct tile and if not, load the correct tile and then perform the requested query. Typically a simulation object (mover, sensor, etc) instantiates a Terrain object and makes queries on the object as it moves along. Therefore, the Terrain object only needs to switch tiles when the owning object crosses a tile boundary.
The terrain masking and height extrema checks are static methods.
The class maintains static data that represents the terrain database. The query methods reference this database to get their terrain data. Note that tiles are shared between Terrain objects through a reference counting mechanism. Thus, only a single instance of a specific tile will actually exist in memory.
| wsf::Terrain::Terrain | ( | TerrainInterface * | aInterfacePtr | ) |
References TerrainInterface.
Referenced by operator=(), and Terrain().
| wsf::Terrain::Terrain | ( | const Terrain & | aSrc | ) |
Copy constructor. If the source object has a tile loaded then the new object will load the same tile.
References Terrain().
| wsf::Terrain::~Terrain | ( | ) |
Delete a terrain object.
The current tile (if any) is unloaded.
|
protected |
Computes terrain impact between two LOS points (Recursive).
| aLocationWCS_1 | WCS location of point 1 |
| aLocationWCS_2 | WCS location of point 2 |
| aFirstPass | Set to true if first pass (default = false) |
References ComputeTerrainImpactP(), and MaskedByTerrain().
Referenced by ComputeTerrainImpactP(), and TerrainHitAlongLOS().
|
inline |
| int wsf::Terrain::GetBathymetryElevApprox | ( | double | aLat, |
| double | aLon, | ||
| float & | aElev ) |
Get the bathymetry depth at the closest sample point.
| aLat | Latitude in the range [-90, 90] |
| aLon | Longitude in the range [-180, 180] |
| aElev | [output] The terrain elevation at the point. This will be 0 if there is no terrain in for the requested point or if terrain processing has been disabled. Positive is up. |
Referenced by operator=(), and UT_DEFINE_SCRIPT_METHOD().
| int wsf::Terrain::GetBathymetryElevInterp | ( | double | aLat, |
| double | aLon, | ||
| float & | aElev ) |
Get the bathymetry depth by interpolating from the bounding sample points.
The terrain height is determined by performing bi-linear interpolation using the four corner points of the cell that contains the requested point.
| aLat | Latitude in the range [-90, 90] |
| aLon | Longitude in the range [-180, 180] |
| aElev | [output] The terrain elevation at the point. This will be 0 if there is no terrain in for the requested point or if terrain processing has been disabled (or if at sea level). Positive is up. |
Referenced by wsf::TerrainInterface::MaskedByTerrainP(), and operator=().
| int wsf::Terrain::GetElevApprox | ( | const double | aWCS[3], |
| float & | aElev ) |
Get the terrain height at the closest sample point.
| aWCS | WCS location of the point |
| aElev | [output] The terrain height at the point. This will be 0 if there is no terrain in for the requested point or if terrain processing has been disabled. |
References GetElevApprox().
| int wsf::Terrain::GetElevApprox | ( | double | aLat, |
| double | aLon, | ||
| float & | aElev ) |
Get the terrain height at the closest sample point.
| aLat | Latitude in the range [-90, 90] |
| aLon | Longitude in the range [-180, 180] |
| aElev | [output] The terrain height at the point. This will be 0 if there is no terrain in for the requested point or if terrain processing has been disabled. |
Referenced by WsfTRIMSIM_SensorComponent::CorrectForAltitude(), WsfNavigationMesh::DebugDrawMesh(), WsfEM_ALARM_Terrain::get_cell_height_deg(), GetElevApprox(), WsfTerrainPathFinder::Initialize(), operator=(), wsf::TerrainInterface::PerformQueries(), and WsfWeaponServer::ProcessCommand().
| int wsf::Terrain::GetElevInterp | ( | const double | aWCS[3], |
| float & | aElev ) |
Get the terrain height by interpolating from the bounding sample points.
The terrain height is determined by performing bi-linear interpolation using the four corner points of the cell that contains the requested point.
| aWCS | WCS location of the point |
| aElev | [output] The terrain height at the point. This will be 0 if there is no terrain in for the requested point or if terrain processing has been disabled (or if at sea level). |
References GetElevInterp().
| int wsf::Terrain::GetElevInterp | ( | double | aLat, |
| double | aLon, | ||
| float & | aElev ) |
Get the terrain height by interpolating from the bounding sample points.
The terrain height is determined by performing bi-linear interpolation using the four corner points of the cell that contains the requested point.
| aLat | Latitude in the range [-90, 90] |
| aLon | Longitude in the range [-180, 180] |
| aElev | [output] The terrain height at the point. This will be 0 if there is no terrain in for the requested point or if terrain processing has been disabled (or if at sea level). |
Referenced by HorizontalMapFunction::BuildContours(), WsfPlatform::CompleteLoad(), WsfTBM_Mover::ComputeTargetError(), wsf::coverage::RectangularGrid::CreateRectangularGrid(), ClutterTableFunction::Execute(), FlightPathAnalysisFunction::Execute(), GetElevInterp(), WsfWeapon::GetTargetLocationWCS(), WsfFalseTarget::Initialize(), WsfTBM_Mover::Initialize(), WsfTBM_Mover::Initialize2(), WsfRotorcraftMover::LocalUpdate(), wsf::TerrainInterface::MaskedByTerrainP(), operator=(), wsf::TerrainInterface::PerformQueries(), wsf::altloc::Component::PreInitialize(), WsfTrack::ProcessInputBlock(), WsfParabolicMover::SetImpactTOFAndLL(), WsfGuidedMoverBase::Update(), UT_DEFINE_SCRIPT_METHOD(), UT_DEFINE_SCRIPT_METHOD(), UT_DEFINE_SCRIPT_METHOD(), UT_DEFINE_SCRIPT_METHOD(), UT_DEFINE_SCRIPT_METHOD(), UT_DEFINE_SCRIPT_METHOD(), UT_DEFINE_SCRIPT_METHOD(), wsf::coverage::Grid::WriteGridDataFile(), and WsfParabolicMover::~WsfParabolicMover().
| bool wsf::Terrain::GetHeightExtremaIn | ( | WsfSimulation & | aSimulation, |
| double | aLatSouth, | ||
| double | aLonWest, | ||
| double | aLatNorth, | ||
| double | aLonEast, | ||
| Post & | aMin, | ||
| Post & | aMax, | ||
| WsfZone * | aZonePtr = nullptr ) |
Compute height extrema within a range of (Lat, Lon) tiles. Optional WsfZoneReference will ignore any terrain outside the zone (if pointer is non-zero). CAUTION: This function is CPU and memory-intensive, and is NOT recommended for real-time use, due to danger of overframing!
| aSimulation | The Simulation |
| aLatSouth | Latitude of the south western edge of the rectangle [-90, 90]. |
| aLonWest | Longitude of the south western edge of the rectangle [-180, 180]. |
| aLatNorth | Latitude of the north eastern edge of the rectangle [-90, 90]. |
| aLonEast | Longitude of the south eastern edge of the rectangle [-180, 180]. |
| aMin | Returned (Lat, Lon) and Height of lowest terrain sample. |
| aMax | Returned (Lat, Lon) and Height of highest terrain sample. |
| aZonePtr | (Optional) The zone will be checked for IsInside() at (lat, lon) before use of this sample. |
References GetManager(), WsfDtedRect::GetNELat(), WsfDtedRect::GetNELon(), WsfDtedRect::GetSWLat(), WsfDtedRect::GetSWLon(), WsfDtedRect::GetTile(), WsfDtedRect::GetTileCount(), WsfZone::IsInitialized(), wsf::Terrain::Post::mHeightM, wsf::Terrain::Post::mLatDeg, wsf::Terrain::Post::mLonDeg, WsfZone::PointIsInside(), and success.
| bool wsf::Terrain::GetHeightExtremaIn | ( | WsfSimulation & | aSimulation, |
| WsfZone * | aZonePtr, | ||
| Post & | aMin, | ||
| Post & | aMax ) |
Compute height extrema within a polygonal (Lat, Lon)-defined zone. CAUTION: This function is CPU and memory-intensive, and is NOT recommended for real-time use, due to danger of overframing.
| aSimulation | The Simulation |
| aZonePtr | The zone region to check for extrema. |
| aMin | Returned (Lat, Lon) and Height of lowest terrain sample. |
| aMax | Returned (Lat, Lon) and Height of highest terrain sample. |
References GetHeightExtremaIn(), and WsfZone::GetLatLonExtrema().
Referenced by GetHeightExtremaIn(), and wsf::TerrainInterface::PerformQueries().
|
protected |
References wsf::TerrainInterface::GetManager().
Referenced by GetHeightExtremaIn().
|
inline |
|
inline |
|
inlineprotected |
| int wsf::Terrain::GetVegElevApprox | ( | double | aLat, |
| double | aLon, | ||
| float & | aElev ) |
Get the vegetation layer height at the closest sample point.
| aLat | Latitude in the range [-90, 90] |
| aLon | Longitude in the range [-180, 180] |
| aElev | [output] The terrain height at the point. This will be 0 if there is no terrain in for the requested point or if terrain processing has been disabled. |
Referenced by operator=().
| int wsf::Terrain::GetVegElevInterp | ( | double | aLat, |
| double | aLon, | ||
| float & | aElev ) |
Get the vegetation layer height by interpolating from the bounding sample points.
The terrain height is determined by performing bi-linear interpolation using the four corner points of the cell that contains the requested point.
| aLat | Latitude in the range [-90, 90] |
| aLon | Longitude in the range [-180, 180] |
| aElev | [output] The terrain height at the point. This will be 0 if there is no terrain in for the requested point or if terrain processing has been disabled (or if at sea level). |
Referenced by operator=().
| bool wsf::Terrain::Initialize | ( | TerrainInterface * | aInterfacePtr | ) |
References TerrainInterface.
Referenced by Initialize(), and operator=().
| bool wsf::Terrain::Initialize | ( | WsfSimulation & | aSimulation | ) |
References WsfSimulation::GetTerrainInterface(), and Initialize().
|
inline |
|
inline |
Is terrain enabled? This can be used by a caller to bypass expensive terrain-related calls if terrain is not available.
Referenced by WsfTRIMSIM_SensorComponent::CorrectForAltitude(), ClutterTableFunction::Execute(), WsfEM_ALARM_Terrain::Initialize(), and WsfWeaponServer::ProcessCommand().
|
inline |
|
inline |
|
inlineprotected |
| bool wsf::Terrain::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?
| aLat1 | Latitude of the first point [-90, 90] |
| aLon1 | Longitude of the first point [-180, 180] |
| aAlt1 | Altitude MSL of the first point. |
| aLat2 | Latitude of the second point [-90, 90] |
| aLon2 | Longitude of the second point [-180, 180] |
| aAlt2 | Altitude MSL of the second point. |
| aMaxRange | Distance at which to stop checking. |
| aRadiusScale | Effective earth radius multiplier (default = 1.0) |
Referenced by ComputeTerrainImpactP(), wsf::TerrainInterface::PerformQueries(), TerrainHitAlongLOS(), and WsfEM_ALARM_Terrain::visble2().
| bool wsf::Terrain::MaskedByTerrainFast | ( | double | aLat1, |
| double | aLon1, | ||
| double | aAlt1, | ||
| double | aLat2, | ||
| double | aLon2, | ||
| double | aAlt2, | ||
| double | aMaxRange ) |
Is the line of sight between two points masked by the terrain? This version varies the step size with height above terrain, but is only valid for an earth scale radius of 1.0.
| aLat1 | Latitude of the first point [-90, 90] |
| aLon1 | Longitude of the first point [-180, 180] |
| aAlt1 | Altitude MSL of the first point. |
| aLat2 | Latitude of the second point [-90, 90] |
| aLon2 | Longitude of the second point [-180, 180] |
| aAlt2 | Altitude MSL of the second point. |
| aMaxRange | Distance at which to stop checking. |
| bool wsf::Terrain::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?
| aLat1 | Latitude of the first point [-90, 90] |
| aLon1 | Longitude of the first point [-180, 180] |
| aAlt1 | Altitude MSL of the first point. |
| aLat2 | Latitude of the second point [-90, 90] |
| aLon2 | Longitude of the second point [-180, 180] |
| aAlt2 | Altitude MSL of the second point. |
| aMaxRange | Distance at which to stop checking. |
| aRadiusScale | Effective earth radius multiplier (default = 1.0) |
| bool wsf::Terrain::MaskedByVegetationFast | ( | double | aLat1, |
| double | aLon1, | ||
| double | aAlt1, | ||
| double | aLat2, | ||
| double | aLon2, | ||
| double | aAlt2, | ||
| double | aMaxRange ) |
Is the line of sight between two points masked by the vegetation? This version varies the step size with height above vegetation, but is only valid for an earth scale radius of 1.0.
| aLat1 | Latitude of the first point [-90, 90] |
| aLon1 | Longitude of the first point [-180, 180] |
| aAlt1 | Altitude MSL of the first point. |
| aLat2 | Latitude of the second point [-90, 90] |
| aLon2 | Longitude of the second point [-180, 180] |
| aAlt2 | Altitude MSL of the second point. |
| aMaxRange | Distance at which to stop checking. |
| bool wsf::Terrain::TerrainHitAlongLOS | ( | const double | aEyepointWCS[3], |
| double | aTerminusWCS[3] ) |
Get the terrain "pixel" along a line-of-sight ray. This algorithm is a brute force approach, and serves as a placeholder for a more elegant solution to come later (?). This will be a CPU- intensive operation. Algorithm will march outward from eyepoint to terminus, so please limit the maximum range as much as is possible. Does not include possible cloud occulting, use the WsfEnvironment for that, prior to using this function.
| aEyepointWCS | Eyepoint of the beginning of the LOS segment. |
| aTerminusWCS | Endpoint of the LOS segment. Will be modified only if return value is true. |
References ComputeTerrainImpactP(), and MaskedByTerrain().
|
friend |
References TerrainInterface.
Referenced by Initialize(), operator=(), Terrain(), and TerrainInterface.