diff --git a/Modules/Radiometry/Simulation/include/otbSailModel.h b/Modules/Radiometry/Simulation/include/otbSailModel.h index 288d0d7030f876381a374b5ae6923aace4de0f7e..88bb5cd4f4417992660089f82cab8d29db8d6a9a 100644 --- a/Modules/Radiometry/Simulation/include/otbSailModel.h +++ b/Modules/Radiometry/Simulation/include/otbSailModel.h @@ -25,6 +25,8 @@ #include "otbSpectralResponse.h" #include "otbDataSpecP5B.h" #include "otbSimulationStep2Base.h" +#include "otbSoilDataBase.h" +#include <string> namespace otb { @@ -100,6 +102,18 @@ class OTBSimulation_EXPORT SailModel : public SimulationStep2Base itkSetMacro(PSI, double); itkGetMacro(PSI, double); + /** Use an external soil file */ + itkSetMacro(UseSoilFile, bool); + itkGetMacro(UseSoilFile, bool); + + /** External soil file name */ + itkSetMacro(SoilFileName, std::string); + itkGetMacro(SoilFileName, std::string); + + /** Index of the soil in the external soil file */ + itkSetMacro(SoilIndex, size_t); + itkGetMacro(SoilIndex, size_t); + /** Get the computed fcover */ itkGetMacro(FCoverView, double); @@ -139,7 +153,7 @@ class OTBSimulation_EXPORT SailModel : public SimulationStep2Base /** Volscatt */ void Volscatt(const double tts, const double tto, const double psi, const double ttl, VectorType &result); - private: +private: SailModel(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented @@ -152,6 +166,10 @@ class OTBSimulation_EXPORT SailModel : public SimulationStep2Base double m_TTO; //observer zenith angle double m_PSI; //azimuth double m_FCoverView; //fCover in the viewing direction + bool m_UseSoilFile; //use a soil file instead of DataSpecP5B + std::string m_SoilFileName; //the soil file to use + size_t m_SoilIndex; //which soil in the soil file + soildata::SoilDataBase m_SoilDataBase; }; }// end namespace otb diff --git a/Modules/Radiometry/Simulation/include/otbSoilDataBase.h b/Modules/Radiometry/Simulation/include/otbSoilDataBase.h new file mode 100644 index 0000000000000000000000000000000000000000..1c28f87395b6c5c394cfabac184f7804426197a5 --- /dev/null +++ b/Modules/Radiometry/Simulation/include/otbSoilDataBase.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) + * + * This file is part of Orfeo Toolbox + * + * https://www.orfeo-toolbox.org/ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef otbSoilDataBase_h +#define otbSoilDataBase_h + +#include <vector> +#include <unordered_map> + +namespace otb +{ + +namespace soildata +{ +//wavelength in nm +using WavelenghtType = unsigned int; +using SoilData = std::unordered_map<WavelenghtType, double>; +using SoilDataBase = std::vector<SoilData>; + +void ParseSoilFile(std::string SoilFileName, SoilDataBase& db); +} + +} + +#endif /* otbSoilDataBase_h */ diff --git a/Modules/Radiometry/Simulation/test/CMakeLists.txt b/Modules/Radiometry/Simulation/test/CMakeLists.txt index fc44b849a94be0157179642837bd8d185e86ca35..21a40a96fda5936a0b1aae4242f59546bf690991 100644 --- a/Modules/Radiometry/Simulation/test/CMakeLists.txt +++ b/Modules/Radiometry/Simulation/test/CMakeLists.txt @@ -53,6 +53,7 @@ otbSailReflVTest.cxx otbSatelliteRSRNew.cxx otbSailReflHTest.cxx otbFilterFunctionValues.cxx +otbSoilDBTest.cxx ) add_executable(otbSimulationTestDriver ${OTBSimulationTests}) @@ -318,3 +319,5 @@ otb_add_test(NAME raTuFilterFunctionValuesTest COMMAND otbSimulationTestDriver 0.05 # user step 0.2 0.5 0.3 0.9 0.8 # vector ) + +otb_add_test(NAME siTvSoilDataParseFile COMMAND otbSimulationTestDriver otbSoilDataBaseParseFile) diff --git a/Modules/Radiometry/Simulation/test/otbSimulationTestDriver.cxx b/Modules/Radiometry/Simulation/test/otbSimulationTestDriver.cxx index 854e8b8b25d77b803b8dee10beda90e2c3df17cb..8ae63e04d0381f176bda436767d79e7b74c4f49d 100644 --- a/Modules/Radiometry/Simulation/test/otbSimulationTestDriver.cxx +++ b/Modules/Radiometry/Simulation/test/otbSimulationTestDriver.cxx @@ -50,4 +50,5 @@ void RegisterTests() REGISTER_TEST(otbSailReflHTest); REGISTER_TEST(otbFilterFunctionValuesSpectralResponseTest); REGISTER_TEST(otbFilterFunctionValuesTest); + REGISTER_TEST(otbSoilDataBaseParseFile); } diff --git a/Modules/Radiometry/Simulation/test/otbSoilDBTest.cxx b/Modules/Radiometry/Simulation/test/otbSoilDBTest.cxx new file mode 100644 index 0000000000000000000000000000000000000000..34e245d320629d332246547943cc3738a5855931 --- /dev/null +++ b/Modules/Radiometry/Simulation/test/otbSoilDBTest.cxx @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) + * + * This file is part of Orfeo Toolbox + * + * https://www.orfeo-toolbox.org/ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include "otbMacro.h" + +#include "otbSoilDataBase.h" + +#include <iostream> + +int otbSoilDataBaseParseFile(int argc, char * argv[]) +{ + + + return EXIT_FAILURE; +}