97 lines
2.8 KiB
C++
Executable File
97 lines
2.8 KiB
C++
Executable File
|
|
// **************************************************************************
|
|
//
|
|
// (C) Copyright 2009 Swiss SIMTEC AG
|
|
//
|
|
// **************************************************************************
|
|
//
|
|
// $HeadURL$
|
|
// $LastChangedBy$
|
|
// $LastChangedDate$
|
|
// $LastChangedRevision$
|
|
//
|
|
// **************************************************************************
|
|
|
|
// manual class headers
|
|
#include "GeoPairingImplFiredBulletDted.hpp"
|
|
#include <GBL_ConfigSystem/geoconfig.h>
|
|
|
|
namespace N_GeoPairingImpl
|
|
{
|
|
|
|
// ---------------------------------------------------------------
|
|
GeoPairingImplFiredBulletDted::GeoPairingImplFiredBulletDted(GeoPairingImplSensorData &a_sensorData)
|
|
: GeoPairingImplFiredBulletBalistic(a_sensorData/*, m_ballisticService*/)
|
|
{
|
|
N_Types::Radian64 l_weaponLat;
|
|
l_weaponLat.setDegree(m_SensorData.WeaponPositionLat);
|
|
N_Types::Radian64 l_weaponLong;
|
|
l_weaponLong.setDegree(m_SensorData.WeaponPositionLong);
|
|
|
|
Float64 l_elevationInitial = getElevation(l_weaponLong, l_weaponLat);
|
|
|
|
if (l_elevationInitial > m_SensorData.WeaponPositionHeight)
|
|
{
|
|
INFO_LOG(m_logger) << "Use effective Terrain Elevation: " << l_elevationInitial;
|
|
m_SensorData.WeaponPositionHeight = l_elevationInitial;
|
|
a_sensorData.WeaponPositionHeight = l_elevationInitial;
|
|
}
|
|
|
|
m_UtmSensor.setLlPositionDegree(m_SensorData.WeaponPositionLat,
|
|
m_SensorData.WeaponPositionLong,
|
|
m_SensorData.WeaponPositionHeight);
|
|
|
|
}
|
|
|
|
|
|
// ---------------------------------------------------------------
|
|
bool GeoPairingImplFiredBulletDted::checkTerrainHit(const N_Types::Coord3 &a_pos, Float64 &a_height)
|
|
{
|
|
N_Types::Radian64 l_posLat;
|
|
l_posLat.setDegree(a_pos.m_Y);
|
|
N_Types::Radian64 l_posLong;
|
|
l_posLong.setDegree(a_pos.m_X);
|
|
|
|
Float64 l_elevation = getElevation(l_posLong, l_posLat);
|
|
/*
|
|
if (l_elevation == ZWLA::Elevation::OUT_OF_MAP)
|
|
{
|
|
ERROR_LOG(m_logger) << "OUT_OF_MAP : a_pos=" << a_pos;
|
|
}
|
|
else if (l_elevation == ZWLA::Elevation::ILLEGAL_ELEVATION)
|
|
{
|
|
ERROR_LOG(m_logger) << "ILLEGAL_ELEVATION : a_pos=" << a_pos;
|
|
}
|
|
else if (l_elevation == ZWLA::Elevation::UNDEFINED_ELEVATION)
|
|
{
|
|
ERROR_LOG(m_logger) << "UNDEFINED_ELEVATION : a_pos=" << a_pos;
|
|
}*/
|
|
/* else
|
|
{
|
|
INFO_LOG(m_logger) << "a_pos = " << a_pos << " : << l_elevation = " << l_elevation;
|
|
}*/
|
|
|
|
a_height = l_elevation;
|
|
return l_elevation > a_pos.m_Z;
|
|
}
|
|
|
|
|
|
// ---------------------------------------------------------------
|
|
bool GeoPairingImplFiredBulletDted::initStatic()
|
|
{
|
|
bool l_Success = true;
|
|
return l_Success;
|
|
}
|
|
|
|
// ---------------------------------------------------------------
|
|
void GeoPairingImplFiredBulletDted::deinitStatic()
|
|
{
|
|
}
|
|
|
|
double GeoPairingImplFiredBulletDted::getElevation(double lon, double lat)
|
|
{
|
|
return N_ConfigSystem::GeoConfig::getInstance()->getElevation(lon, lat);
|
|
}
|
|
|
|
} // namespace N_GeoPairingImpl
|