Commit baf442cd authored by Philipp Schäfer's avatar Philipp Schäfer
Browse files

ART Simulator

- now catches unhandles exceptions while loading atmosphere
- uses default atmosphere if not set in config
parent cfbcc8b1
......@@ -42,8 +42,8 @@ namespace ITA
VistaPropertyList Store() const override;
void Load(const VistaPropertyList& oProperties) override;
CoordinateSystem eClientCoordinateSystem = CoordinateSystem::Cartesian;
std::string sJsonAtmosphere;
CoordinateSystem eClientCoordinateSystem = CoordinateSystem::Cartesian; //!< 0 = Cartesian, 1 = OpenGL
std::string sJsonAtmosphere; //!< Either JSON formatted string or path to atmosphere JSON file.
};
......
......@@ -6,11 +6,17 @@
#include "../../configuration_keys.h"
//ITAGeo
// ITAGeo
#include <ITAGeo/Utils/JSON/Atmosphere.h>
#include <ITAPropagationModels/Atmosphere/AirAttenuation.h>
// ITA Base
#include <ITAFileSystemUtils.h>
// STD
#include <ostream>
using namespace ITAPropagationPathSim::AtmosphericRayTracing;
using namespace ITAPropagationModels::Atmosphere;
namespace ITA
......@@ -35,7 +41,10 @@ namespace ITA
{
ISimulatorInterface::SimulatorConfig::Load(oProperties);
eClientCoordinateSystem = static_cast<CoordinateSystem>(oProperties.GetValue <int>(CLIENT_COORDINATE_SYSTEM_KEY));
oProperties.GetValue(STRATIFIED_ATMOSPHERE_KEY, sJsonAtmosphere);
if (oProperties.HasProperty(STRATIFIED_ATMOSPHERE_KEY))
oProperties.GetValue(STRATIFIED_ATMOSPHERE_KEY, sJsonAtmosphere);
else
sJsonAtmosphere = "";
}
#pragma endregion
......@@ -47,7 +56,29 @@ namespace ITA
CARTSimulator::CARTSimulator(const ARTSimulatorConfig& oConfig)
{
m_eClientCoordinateSystem = oConfig.eClientCoordinateSystem;
ITAGeo::Utils::JSON::Decode(m_oAtmosphere, oConfig.sJsonAtmosphere);
if (oConfig.sJsonAtmosphere.empty())
std::cout << "ART Simulator: Atmosphere undefined, using default atmosphere." << std::endl;
else
{
try
{
// Assume file if contains path separator and no {
if (oConfig.sJsonAtmosphere.find(PATH_SEPARATOR) != std::string::npos && oConfig.sJsonAtmosphere.find("{") == std::string::npos)
ITAGeo::Utils::JSON::Import(m_oAtmosphere, oConfig.sJsonAtmosphere);
// Assume JSON formatted string
else
ITAGeo::Utils::JSON::Decode(m_oAtmosphere, oConfig.sJsonAtmosphere);
}
catch (const ITAException& err)
{
throw err;
}
catch ( ... )
{
ITA_EXCEPT_INVALID_PARAMETER( "ART Simulator: Unhandled error while loading atmosphere." );
}
}
m_oEngine.eigenraySettings.rayTracing.maxReflectionOrder = 1; //Always expect exactly 2 eigenrays
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment