diff --git a/Utilities/otbossim/src/ossim/imaging/ossimImageHandlerSarFactory.cpp b/Utilities/otbossim/src/ossim/imaging/ossimImageHandlerSarFactory.cpp index 2c16cf50165191811126dfb8a2a60a32585baa38..a254e8a94d67926b733cbc41358c82de2dff94a1 100644 --- a/Utilities/otbossim/src/ossim/imaging/ossimImageHandlerSarFactory.cpp +++ b/Utilities/otbossim/src/ossim/imaging/ossimImageHandlerSarFactory.cpp @@ -13,7 +13,7 @@ // #include <ossim/imaging/ossimRadarSat2TileSource.h> // #include <ossim/imaging/ossimTerraSarTileSource.h> //#include <ossim/imaging/ossimCosmoSkymedTileSource.h> -#include <ossim/imaging/ossimEnvisatAsarTileSource.h> +//#include <ossim/imaging/ossimEnvisatAsarTileSource.h> // #include <ossim/imaging/ossimErsSarTileSource.h> @@ -89,18 +89,18 @@ ossimImageHandler* ossimImageHandlerSarFactory::open(const ossimFilename& fileNa // delete result; // Envisat ASAR - if(traceDebug()) - { - ossimNotify(ossimNotifyLevel_DEBUG) - << "trying EnvisatAsar" - << std::endl; - } - result = new ossimEnvisatAsarTileSource; - if(result->open(copyFilename)) - { - return result; - } - delete result; +// if(traceDebug()) +// { +// ossimNotify(ossimNotifyLevel_DEBUG) +// << "trying EnvisatAsar" +// << std::endl; +// } +// result = new ossimEnvisatAsarTileSource; +// if(result->open(copyFilename)) +// { +// return result; +// } +// delete result; // Radarsat 2 // if(traceDebug()) @@ -202,18 +202,18 @@ ossimImageHandler* ossimImageHandlerSarFactory::open(const ossimKeywordlist& kwl // } // delete result; - if(traceDebug()) - { - ossimNotify(ossimNotifyLevel_DEBUG) - << "trying EnvisatAsar" - << std::endl; - } - result = new ossimEnvisatAsarTileSource(); - if(result->loadState(kwl, prefix)) - { - return result; - } - delete result; +// if(traceDebug()) +// { +// ossimNotify(ossimNotifyLevel_DEBUG) +// << "trying EnvisatAsar" +// << std::endl; +// } +// result = new ossimEnvisatAsarTileSource(); +// if(result->loadState(kwl, prefix)) +// { +// return result; +// } +// delete result; // if(traceDebug()) // { @@ -260,10 +260,10 @@ ossimObject* ossimImageHandlerSarFactory::createObject(const ossimString& typeNa // { // return new ossimTerraSarTileSource(); // } - if(STATIC_TYPE_NAME(ossimEnvisatAsarTileSource) == typeName) - { - return new ossimEnvisatAsarTileSource(); - } +// if(STATIC_TYPE_NAME(ossimEnvisatAsarTileSource) == typeName) +// { +// return new ossimEnvisatAsarTileSource(); +// } /*if(STATIC_TYPE_NAME(ossimCosmoSkymedTileSource) == typeName) { return new ossimCosmoSkymedTileSource(); @@ -336,7 +336,7 @@ void ossimImageHandlerSarFactory::getTypeNameList(std::vector<ossimString>& type { typeList.push_back(STATIC_TYPE_NAME(ossimRadarSatTileSource)); // typeList.push_back(STATIC_TYPE_NAME(ossimTerraSarTileSource)); - typeList.push_back(STATIC_TYPE_NAME(ossimEnvisatAsarTileSource)); +// typeList.push_back(STATIC_TYPE_NAME(ossimEnvisatAsarTileSource)); //typeList.push_back(STATIC_TYPE_NAME(ossimCosmoSkymedTileSource)); // typeList.push_back(STATIC_TYPE_NAME(ossimErsSarTileSource)); // typeList.push_back(STATIC_TYPE_NAME(ossimRadarSat2TileSource)); diff --git a/Utilities/otbossim/src/ossim/projection/ossimSensorModelFactory.cpp b/Utilities/otbossim/src/ossim/projection/ossimSensorModelFactory.cpp index 607e2a1e94a87efcdd1ce1eb3369e07678dd7802..fffd0d52f9743245889f505a97a6d207f6210ea1 100644 --- a/Utilities/otbossim/src/ossim/projection/ossimSensorModelFactory.cpp +++ b/Utilities/otbossim/src/ossim/projection/ossimSensorModelFactory.cpp @@ -50,7 +50,7 @@ static ossimTrace traceDebug = ossimTrace("ossimSensorModelFactory:debug"); #include <ossim/support_data/ossimFfL7.h> #include <ossim/support_data/ossimFfL5.h> #include <ossim/projection/ossimRadarSatModel.h> -#include <ossim/projection/ossimEnvisatAsarModel.h> +//#include <ossim/projection/ossimEnvisatAsarModel.h> // #include <ossim/projection/ossimTerraSarModel.h> //#include <ossim/projection/ossimCosmoSkymedModel.h> // #include <ossim/projection/ossimRadarSat2Model.h> @@ -202,10 +202,10 @@ ossimSensorModelFactory::createProjection(const ossimString &name) const { return new ossimRadarSatModel; } - if (name == STATIC_TYPE_NAME(ossimEnvisatAsarModel)) - { - return new ossimEnvisatAsarModel; - } +// if (name == STATIC_TYPE_NAME(ossimEnvisatAsarModel)) +// { +// return new ossimEnvisatAsarModel; +// } // if (name == STATIC_TYPE_NAME(ossimTerraSarModel)) // { // return new ossimTerraSarModel; @@ -273,7 +273,7 @@ ossimSensorModelFactory::getTypeNameList(std::vector<ossimString>& typeList) // typeList.push_back(STATIC_TYPE_NAME(ossimRadarSat2Model)); // typeList.push_back(STATIC_TYPE_NAME(ossimTerraSarModel)); // typeList.push_back(STATIC_TYPE_NAME(ossimCosmoSkymedModel)); - typeList.push_back(STATIC_TYPE_NAME(ossimEnvisatAsarModel)); +// typeList.push_back(STATIC_TYPE_NAME(ossimEnvisatAsarModel)); // typeList.push_back(STATIC_TYPE_NAME(ossimErsSarModel)); typeList.push_back(STATIC_TYPE_NAME(ossimTileMapModel)); //*** diff --git a/Utilities/otbossimplugins/ossim/EnvisatAsar/AntennaElevationPatterns.cpp b/Utilities/otbossimplugins/ossim/EnvisatAsar/AntennaElevationPatterns.cpp new file mode 100644 index 0000000000000000000000000000000000000000..21304b5b330157cfa7718800c16b7ea375c53983 --- /dev/null +++ b/Utilities/otbossimplugins/ossim/EnvisatAsar/AntennaElevationPatterns.cpp @@ -0,0 +1,96 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#include <EnvisatAsar/AntennaElevationPatterns.h> + +namespace ossimplugins +{ +AntennaElevationPatterns::AntennaElevationPatterns() : EnvisatAsarRecord("AntennaElevationPatterns_rec") +{ +} + +AntennaElevationPatterns::~AntennaElevationPatterns() +{ +} + + +std::ostream& operator<<(std::ostream& os, const AntennaElevationPatterns& data) +{ + os<<"zero_doppler_time:"<<data._zero_doppler_time.c_str()<<std::endl; + + os<<"attach_flag:"<<data._attach_flag<<std::endl; + + os<<"swath:"<<data._swath.c_str()<<std::endl; + + for (int i = 0; i<33; i++) { + os<<"elevation pattern:"<<data._elevation_pattern[i]<<std::endl; + } + + return os; + +} + +std::istream& operator>>(std::istream& is, AntennaElevationPatterns& data) +{ + char buf16[17]; + buf16[16]='\0'; + char buf12[13]; + buf12[12] = '\0'; + char buf3[4]; + buf3[3] = '\0'; + char buf2[3]; + buf2[2] = '\0'; + char buf1[1]; + + is.read(buf12,12); + data._zero_doppler_time = buf12; + + is.read((char*)&(data._attach_flag),1); + + is.read(buf3,3); + data._swath = buf3; + + for (int i = 0; i<33; i++) { + is.read((char*)&(data._elevation_pattern[i]),4); + data.SwitchEndian(data._elevation_pattern[i]); + } + + is.read(buf16,14); + + return is; + +} + +AntennaElevationPatterns::AntennaElevationPatterns(const AntennaElevationPatterns& rhs): + EnvisatAsarRecord(rhs), + _zero_doppler_time(rhs._zero_doppler_time), + _attach_flag(rhs._attach_flag), + _swath(rhs._swath) + { + for (int i = 0; i<33; i++) { + _elevation_pattern[i] = rhs._elevation_pattern[i]; + } + } + + +AntennaElevationPatterns& AntennaElevationPatterns::operator=(const AntennaElevationPatterns& rhs) +{ + _zero_doppler_time = rhs._zero_doppler_time; + _attach_flag = rhs._attach_flag; + _swath = rhs._swath; + + for (int i = 0; i<33; i++) { + _elevation_pattern[i] = rhs._elevation_pattern[i]; + } + + return *this; +} +} diff --git a/Utilities/otbossimplugins/ossim/EnvisatAsar/AntennaElevationPatterns.h b/Utilities/otbossimplugins/ossim/EnvisatAsar/AntennaElevationPatterns.h new file mode 100644 index 0000000000000000000000000000000000000000..2b4fe1e999d42abc2e62b5e5fad36b5f866939be --- /dev/null +++ b/Utilities/otbossimplugins/ossim/EnvisatAsar/AntennaElevationPatterns.h @@ -0,0 +1,145 @@ + +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#ifndef AntennaElevationPatterns_h +#define AntennaElevationPatterns_h + +#include <iostream> +#include <EnvisatAsar/EnvisatAsarRecord.h> + +namespace ossimplugins +{ +/** + * @ingroup AntennaElevationPatternsRecord + * @brief This class is able to read the ASAR AntennaElevationPatterns record + */ +class AntennaElevationPatterns : public EnvisatAsarRecord +{ +public: + /** + * @brief Constructor + */ + AntennaElevationPatterns(); + + /** + * @brief Destructor + */ + ~AntennaElevationPatterns(); + + /** + * @brief This function writes the AntennaElevationPatterns in a stream + */ + friend std::ostream& operator<<(std::ostream& os, const AntennaElevationPatterns& data); + + /** + * @brief This function reads a AntennaElevationPatterns from a stream + */ + friend std::istream& operator>>(std::istream& is, AntennaElevationPatterns& data); + + /** + * @brief Copy constructor + */ + AntennaElevationPatterns(const AntennaElevationPatterns& rhs); + + /** + * @brief Copy operator + */ + AntennaElevationPatterns& operator=(const AntennaElevationPatterns& rhs); + + /** + * @brief This function is able to create a new instance of the class + */ + EnvisatAsarRecord* Instanciate() + { + return new AntennaElevationPatterns(); + }; + + /** + * @brief This function is able to create a new instance of the class initialised with the data of the calling instance + */ + EnvisatAsarRecord* Clone() + { + return new AntennaElevationPatterns(*this); + }; + + /** + * @brief Reads the class data from a stream + */ + void Read(std::istream& is) + { + is>>*this; + }; + + /** + * @brief Writes the class to a stream + */ + void Write(std::ostream& os) + { + os<<*this; + }; + + + /** + * @brief zero_doppler_time + */ + std::string get_zero_doppler_time() + { + return _zero_doppler_time; + }; + /** + * @brief attach_flag + */ + bool get_attach_flag() + { + return _attach_flag; + }; + /** + * @brief swath + */ + std::string get_swath() + { + return _swath; + }; + /** + * @brief Elevation Pattern + */ + float * get_elevation_pattern() + { + return _elevation_pattern; + }; + + + /** + * @brief zero_doppler_time + */ + std::string _zero_doppler_time; + /** + * @brief attach_flag + */ + bool _attach_flag; + /** + * @brief swath + */ + std::string _swath; + /** + * @brief Elevation Pattern + */ + float _elevation_pattern[33]; + + +private: + +}; +} +#endif + + diff --git a/Utilities/otbossimplugins/ossim/EnvisatAsar/ChirpParameters.cpp b/Utilities/otbossimplugins/ossim/EnvisatAsar/ChirpParameters.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3697d9b8e2bb08dca90120577337698dccd89864 --- /dev/null +++ b/Utilities/otbossimplugins/ossim/EnvisatAsar/ChirpParameters.cpp @@ -0,0 +1,199 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#include <EnvisatAsar/ChirpParameters.h> + +namespace ossimplugins +{ +ChirpParameters::ChirpParameters() : EnvisatAsarRecord("ChirpParameters_rec") +{ +} + +ChirpParameters::~ChirpParameters() +{ +} + + +std::ostream& operator<<(std::ostream& os, const ChirpParameters& data) +{ + os<<"zero_doppler_time:"<<data._zero_doppler_time.c_str()<<std::endl; + + os<<"attach_flag:"<<data._attach_flag<<std::endl; + + os<<"swath:"<<data._swath.c_str()<<std::endl; + + os<<"polar:"<<data._polar.c_str()<<std::endl; + + os<<"chirp_width:"<<data._chirp_width<<std::endl; + + os<<"chirp_sidelobe:"<<data._chirp_sidelobe<<std::endl; + + os<<"chirp_islr:"<<data._chirp_islr<<std::endl; + + os<<"chirp_peak_loc:"<<data._chirp_peak_loc<<std::endl; + + os<<"re_chirp_power:"<<data._re_chirp_power<<std::endl; + + os<<"elev_chirp_power:"<<data._elev_chirp_power<<std::endl; + + os<<"chirp_quality_flag:"<<data._chirp_quality_flag<<std::endl; + + os<<"ref_chirp_power:"<<data._ref_chirp_power<<std::endl; + + os<<"normalisation_source:"<<data._normalisation_source.c_str()<<std::endl; + + for (int i = 0 ; i<352; i++) { + os<<"cal_pulse_info["<<i<<"]:"<<data._cal_pulse_info[i]<<std::endl; + } + + return os; + +} + +std::istream& operator>>(std::istream& is, ChirpParameters& data) +{ + char buf64[65]; + buf64[64] = '\0'; + char buf32[33]; + buf32[32] = '\0'; + char buf27[28]; + buf27[27] = '\0'; + char buf20[21]; + buf20[20] = '\0'; + char buf16[17]; + buf16[16]='\0'; + char buf15[16]; + buf15[15] = '\0'; + char buf14[15]; + buf14[14] = '\0'; + char buf13[14]; + buf13[13] = '\0'; + char buf12[13]; + buf12[12] = '\0'; + char buf11[12]; + buf11[11] = '\0'; + char buf10[11]; + buf10[10] = '\0'; + char buf9[10]; + buf9[9] = '\0'; + char buf8[9]; + buf8[8] = '\0'; + char buf7[8]; + buf7[7] = '\0'; + char buf6[7]; + buf6[6] = '\0'; + char buf5[6]; + buf5[5] = '\0'; + char buf4[5]; + buf4[4] = '\0'; + char buf3[4]; + buf3[3] = '\0'; + char buf2[3]; + buf2[2] = '\0'; + char buf1[1]; + + is.read(buf12,12); + data._zero_doppler_time = buf12; + + is.read((char*)&(data._attach_flag),1); + + is.read(buf3,3); + data._swath = buf3; + + is.read(buf3,3); + data._polar = buf3; + + is.read((char*)&(data._chirp_width),4); + data.SwitchEndian(data._chirp_width); + + is.read((char*)&(data._chirp_sidelobe),4); + data.SwitchEndian(data._chirp_sidelobe); + + is.read((char*)&(data._chirp_islr),4); + data.SwitchEndian(data._chirp_islr); + + is.read((char*)&(data._chirp_peak_loc),4); + data.SwitchEndian(data._chirp_peak_loc); + + is.read((char*)&(data._re_chirp_power),4); + data.SwitchEndian(data._re_chirp_power); + + is.read((char*)&(data._elev_chirp_power),4); + data.SwitchEndian(data._elev_chirp_power); + + is.read((char*)&(data._chirp_quality_flag),1); + data.SwitchEndian(data._chirp_quality_flag); + + is.read((char*)&(data._ref_chirp_power),4); + data.SwitchEndian(data._ref_chirp_power); + + is.read(buf7,7); + data._normalisation_source = buf7; + + is.read(buf4,4); + + for (int i = 0; i<352; i++) { + is.read((char*)&(data._cal_pulse_info[i]),4); + data.SwitchEndian(data._cal_pulse_info[i]); + } + + is.read(buf16,16); + + return is; + +} + +ChirpParameters::ChirpParameters(const ChirpParameters& rhs): + EnvisatAsarRecord(rhs), + _zero_doppler_time(rhs._zero_doppler_time), + _attach_flag(rhs._attach_flag), + _swath(rhs._swath), + _polar(rhs._polar), + _chirp_width(rhs._chirp_width), + _chirp_sidelobe(rhs._chirp_sidelobe), + _chirp_islr(rhs._chirp_islr), + _chirp_peak_loc(rhs._chirp_peak_loc), + _re_chirp_power(rhs._re_chirp_power), + _elev_chirp_power(rhs._elev_chirp_power), + _chirp_quality_flag(rhs._chirp_quality_flag), + _ref_chirp_power(rhs._ref_chirp_power), + _normalisation_source(rhs._normalisation_source) + { + for (int i = 0; i<352; i++) { + _cal_pulse_info[i] = rhs._cal_pulse_info[i]; + } + } + + +ChirpParameters& ChirpParameters::operator=(const ChirpParameters& rhs) +{ + _zero_doppler_time = rhs._zero_doppler_time; + _attach_flag = rhs._attach_flag; + _swath = rhs._swath; + _polar = rhs._polar; + _chirp_width = rhs._chirp_width; + _chirp_sidelobe = rhs._chirp_sidelobe; + _chirp_islr = rhs._chirp_islr; + _chirp_peak_loc = rhs._chirp_peak_loc; + _re_chirp_power = rhs._re_chirp_power; + _elev_chirp_power = rhs._elev_chirp_power; + _chirp_quality_flag = rhs._chirp_quality_flag; + _ref_chirp_power = rhs._ref_chirp_power; + _normalisation_source = rhs._normalisation_source; + + for (int i = 0; i<352; i++) { + _cal_pulse_info[i] = rhs._cal_pulse_info[i]; + } + + return *this; +} +} + diff --git a/Utilities/otbossimplugins/ossim/EnvisatAsar/ChirpParameters.h b/Utilities/otbossimplugins/ossim/EnvisatAsar/ChirpParameters.h new file mode 100644 index 0000000000000000000000000000000000000000..ac14a5fc85e22b86d260b75b6c43c0d36a4fe674 --- /dev/null +++ b/Utilities/otbossimplugins/ossim/EnvisatAsar/ChirpParameters.h @@ -0,0 +1,253 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#ifndef ChirpParameters_h +#define ChirpParameters_h + +#include <iostream> +#include <EnvisatAsar/EnvisatAsarRecord.h> + +namespace ossimplugins +{ +/** + * @ingroup ChirpParametersRecord + * @brief This class is able to read the ASAR ChirpParameters record + */ +class ChirpParameters : public EnvisatAsarRecord +{ +public: + /** + * @brief Constructor + */ + ChirpParameters(); + + /** + * @brief Destructor + */ + ~ChirpParameters(); + + /** + * @brief This function writes the ChirpParameters in a stream + */ + friend std::ostream& operator<<(std::ostream& os, const ChirpParameters& data); + + /** + * @brief This function reads a ChirpParameters from a stream + */ + friend std::istream& operator>>(std::istream& is, ChirpParameters& data); + + /** + * @brief Copy constructor + */ + ChirpParameters(const ChirpParameters& rhs); + + /** + * @brief Copy operator + */ + ChirpParameters& operator=(const ChirpParameters& rhs); + + /** + * @brief This function is able to create a new instance of the class + */ + EnvisatAsarRecord* Instanciate() + { + return new ChirpParameters(); + }; + + /** + * @brief This function is able to create a new instance of the class initialised with the data of the calling instance + */ + EnvisatAsarRecord* Clone() + { + return new ChirpParameters(*this); + }; + + /** + * @brief Reads the class data from a stream + */ + void Read(std::istream& is) + { + is>>*this; + }; + + /** + * @brief Writes the class to a stream + */ + void Write(std::ostream& os) + { + os<<*this; + }; + + + /** + * @brief zero_doppler_time + */ + std::string get_zero_doppler_time() + { + return _zero_doppler_time; + }; + /** + * @brief attach_flag + */ + bool get_attach_flag() + { + return _attach_flag; + }; + /** + * @brief swath + */ + std::string get_swath() + { + return _swath; + }; + /** + * @brief polar + */ + std::string get_polar() + { + return _polar; + }; + /** + * @brief chirp_width + */ + float get_chirp_width() + { + return _chirp_width; + }; + /** + * @brief chirp_sidelobe + */ + float get_chirp_sidelobe() + { + return _chirp_sidelobe; + }; + /** + * @brief chirp_islr + */ + float get_chirp_islr() + { + return _chirp_islr; + }; + /** + * @brief chirp_peak_loc + */ + float get_chirp_peak_loc() + { + return _chirp_peak_loc; + }; + /** + * @brief re_chirp_power + */ + float get_re_chirp_power() + { + return _re_chirp_power; + }; + /** + * @brief elev_chirp_power + */ + float get_elev_chirp_power() + { + return _elev_chirp_power; + }; + /** + * @brief chirp_quality_flag + */ + bool get_chirp_quality_flag() + { + return _chirp_quality_flag; + }; + /** + * @brief ref_chirp_power + */ + float get_ref_chirp_power() + { + return _ref_chirp_power; + }; + /** + * @brief normalisation_source + */ + std::string get_normalisation_source() + { + return _normalisation_source; + }; + /** + * @brief cal_pulse_info[352] + */ + float* get_cal_pulse_info() + { + return _cal_pulse_info; + }; + + + /** + * @brief zero_doppler_time + */ + std::string _zero_doppler_time; + /** + * @brief attach_flag + */ + bool _attach_flag; + /** + * @brief swath + */ + std::string _swath; + /** + * @brief polar + */ + std::string _polar; + /** + * @brief chirp_width + */ + float _chirp_width; + /** + * @brief chirp_sidelobe + */ + float _chirp_sidelobe; + /** + * @brief chirp_islr + */ + float _chirp_islr; + /** + * @brief chirp_peak_loc + */ + float _chirp_peak_loc; + /** + * @brief re_chirp_power + */ + float _re_chirp_power; + /** + * @brief elev_chirp_power + */ + float _elev_chirp_power; + /** + * @brief chirp_quality_flag + */ + bool _chirp_quality_flag; + /** + * @brief ref_chirp_power + */ + float _ref_chirp_power; + /** + * @brief normalisation_source + */ + std::string _normalisation_source; + /** + * @brief cal_pulse_info[352] + */ + float _cal_pulse_info[352]; + +private: + +}; +} +#endif + + diff --git a/Utilities/otbossimplugins/ossim/EnvisatAsar/DopplerCentroidParameters.cpp b/Utilities/otbossimplugins/ossim/EnvisatAsar/DopplerCentroidParameters.cpp new file mode 100644 index 0000000000000000000000000000000000000000..baae112ef84e6429c2459877a224c6f33337f249 --- /dev/null +++ b/Utilities/otbossimplugins/ossim/EnvisatAsar/DopplerCentroidParameters.cpp @@ -0,0 +1,158 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#include <EnvisatAsar/DopplerCentroidParameters.h> + +namespace ossimplugins +{ +DopplerCentroidParameters::DopplerCentroidParameters() : EnvisatAsarRecord("DopplerCentroidParameters_rec") +{ +} + +DopplerCentroidParameters::~DopplerCentroidParameters() +{ +} + + +std::ostream& operator<<(std::ostream& os, const DopplerCentroidParameters& data) +{ + os<<"zero_doppler_time:"<<data._zero_doppler_time.c_str()<<std::endl; + + os<<"attach_flag:"<<data._attach_flag<<std::endl; + + os<<"slant_range_time:"<<data._slant_range_time<<std::endl; + + os<<"dop_coef[0]:"<<data._dop_coef[0]<<std::endl; + os<<"dop_coef[1]:"<<data._dop_coef[1]<<std::endl; + os<<"dop_coef[2]:"<<data._dop_coef[2]<<std::endl; + os<<"dop_coef[3]:"<<data._dop_coef[3]<<std::endl; + os<<"dop_coef[4]:"<<data._dop_coef[4]<<std::endl; + + os<<"dop_conf:"<<data._dop_conf<<std::endl; + + os<<"dop_conf_below_thresh_flag:"<<data._dop_conf_below_thresh_flag<<std::endl; + + os<<"delta_dopp_coeff[0]:"<<data._delta_dopp_coeff[0]<<std::endl; + os<<"delta_dopp_coeff[1]:"<<data._delta_dopp_coeff[1]<<std::endl; + os<<"delta_dopp_coeff[2]:"<<data._delta_dopp_coeff[2]<<std::endl; + os<<"delta_dopp_coeff[3]:"<<data._delta_dopp_coeff[3]<<std::endl; + os<<"delta_dopp_coeff[4]:"<<data._delta_dopp_coeff[4]<<std::endl; + + return os; + +} + +std::istream& operator>>(std::istream& is, DopplerCentroidParameters& data) +{ + char buf64[65]; + buf64[64] = '\0'; + char buf32[33]; + buf32[32] = '\0'; + char buf27[28]; + buf27[27] = '\0'; + char buf20[21]; + buf20[20] = '\0'; + char buf16[17]; + buf16[16]='\0'; + char buf15[16]; + buf15[15] = '\0'; + char buf14[15]; + buf14[14] = '\0'; + char buf13[14]; + buf13[13] = '\0'; + char buf12[13]; + buf12[12] = '\0'; + char buf11[12]; + buf11[11] = '\0'; + char buf10[11]; + buf10[10] = '\0'; + char buf9[10]; + buf9[9] = '\0'; + char buf8[9]; + buf8[8] = '\0'; + char buf7[8]; + buf7[7] = '\0'; + char buf6[7]; + buf6[6] = '\0'; + char buf5[6]; + buf5[5] = '\0'; + char buf4[5]; + buf4[4] = '\0'; + char buf3[4]; + buf3[3] = '\0'; + char buf2[3]; + buf2[2] = '\0'; + char buf1[1]; + + is.read(buf12,12); + data._zero_doppler_time = buf12; + + is.read((char*)&(data._attach_flag),1); + + is.read((char*)&(data._slant_range_time),4); + data.SwitchEndian(data._slant_range_time); + + for (int i = 0; i <5; i++) { + is.read((char*)&(data._dop_coef[i]),4); + data.SwitchEndian(data._dop_coef[i]); + } + + is.read((char*)&(data._dop_conf),4); + data.SwitchEndian(data._dop_conf); + + is.read((char*)&(data._dop_conf_below_thresh_flag),1); + + for (int i = 0; i <5; i++) { + is.read((char*)&(data._delta_dopp_coeff[i]),2); + data.SwitchEndian(data._delta_dopp_coeff[i]); + } + + is.read(buf3,3); + + return is; + +} + +DopplerCentroidParameters::DopplerCentroidParameters(const DopplerCentroidParameters& rhs): + EnvisatAsarRecord(rhs), + _zero_doppler_time(rhs._zero_doppler_time), + _attach_flag(rhs._attach_flag), + _slant_range_time(rhs._slant_range_time), + _dop_conf(rhs._dop_conf), + _dop_conf_below_thresh_flag(rhs._dop_conf_below_thresh_flag) + { + for (int i = 0; i <5; i++) { + _dop_coef[i] = rhs._dop_coef[i]; + } + for (int i = 0; i <5; i++) { + _delta_dopp_coeff[i] = rhs._delta_dopp_coeff[i]; + } + } + + +DopplerCentroidParameters& DopplerCentroidParameters::operator=(const DopplerCentroidParameters& rhs) +{ + _zero_doppler_time = rhs._zero_doppler_time; + _attach_flag = rhs._attach_flag; + _slant_range_time = rhs._slant_range_time; + _dop_conf = rhs._dop_conf; + _dop_conf_below_thresh_flag = rhs._dop_conf_below_thresh_flag; + + for (int i = 0; i <5; i++) { + _dop_coef[i] = rhs._dop_coef[i]; + } + for (int i = 0; i <5; i++) { + _delta_dopp_coeff[i] = rhs._delta_dopp_coeff[i]; + } + + return *this; +} +} diff --git a/Utilities/otbossimplugins/ossim/EnvisatAsar/DopplerCentroidParameters.h b/Utilities/otbossimplugins/ossim/EnvisatAsar/DopplerCentroidParameters.h new file mode 100644 index 0000000000000000000000000000000000000000..2056664d4d7f6ff6bd1700da3843722d05052be4 --- /dev/null +++ b/Utilities/otbossimplugins/ossim/EnvisatAsar/DopplerCentroidParameters.h @@ -0,0 +1,175 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#ifndef DopplerCentroidParameters_h +#define DopplerCentroidParameters_h + +#include <iostream> +#include <EnvisatAsar/EnvisatAsarRecord.h> + +namespace ossimplugins +{ +/** + * @ingroup DopplerCentroidParametersRecord + * @brief This class is able to read the ASAR DopplerCentroidParameters record + */ +class DopplerCentroidParameters : public EnvisatAsarRecord +{ +public: + /** + * @brief Constructor + */ + DopplerCentroidParameters(); + + /** + * @brief Destructor + */ + ~DopplerCentroidParameters(); + + /** + * @brief This function writes the DopplerCentroidParameters in a stream + */ + friend std::ostream& operator<<(std::ostream& os, const DopplerCentroidParameters& data); + + /** + * @brief This function reads a DopplerCentroidParameters from a stream + */ + friend std::istream& operator>>(std::istream& is, DopplerCentroidParameters& data); + + /** + * @brief Copy constructor + */ + DopplerCentroidParameters(const DopplerCentroidParameters& rhs); + + /** + * @brief Copy operator + */ + DopplerCentroidParameters& operator=(const DopplerCentroidParameters& rhs); + + /** + * @brief This function is able to create a new instance of the class + */ + EnvisatAsarRecord* Instanciate() + { + return new DopplerCentroidParameters(); + }; + + /** + * @brief This function is able to create a new instance of the class initialised with the data of the calling instance + */ + EnvisatAsarRecord* Clone() + { + return new DopplerCentroidParameters(*this); + }; + + /** + * @brief Reads the class data from a stream + */ + void Read(std::istream& is) + { + is>>*this; + }; + + /** + * @brief Writes the class to a stream + */ + void Write(std::ostream& os) + { + os<<*this; + }; + + + /** + * @brief zero_doppler_time + */ + std::string get_zero_doppler_time() + { + return _zero_doppler_time; + }; + /** + * @brief attach_flag + */ + bool get_attach_flag() + { + return _attach_flag; + }; + /** + * @brief slant_range_time + */ + float get_slant_range_time() + { + return _slant_range_time; + }; + /** + * @brief dop_coef[5] + */ + float* get_dop_coef() + { + return _dop_coef; + }; + /** + * @brief dop_conf + */ + float get_dop_conf() + { + return _dop_conf; + }; + /** + * @brief dop_conf_below_thresh_flag + */ + bool get_dop_conf_below_thresh_flag() + { + return _dop_conf_below_thresh_flag; + }; + /** + * @brief delta_dopp_coeff[5] + */ + signed short * get_delta_dopp_coeff() + { + return _delta_dopp_coeff; + }; + + /** + * @brief zero_doppler_time + */ + std::string _zero_doppler_time; + /** + * @brief attach_flag + */ + bool _attach_flag; + /** + * @brief slant_range_time + */ + float _slant_range_time; + /** + * @brief dop_coef[5] + */ + float _dop_coef[5]; + /** + * @brief dop_conf + */ + float _dop_conf; + /** + * @brief dop_conf_below_thresh_flag + */ + bool _dop_conf_below_thresh_flag; + /** + * @brief delta_dopp_coeff[5] + */ + signed short _delta_dopp_coeff[5]; + +private: + +}; +} +#endif + + diff --git a/Utilities/otbossimplugins/ossim/EnvisatAsar/EnvisatAsarData.cpp b/Utilities/otbossimplugins/ossim/EnvisatAsar/EnvisatAsarData.cpp new file mode 100644 index 0000000000000000000000000000000000000000..efd00a3e21cb38a79f7a41220765f1519c47099c --- /dev/null +++ b/Utilities/otbossimplugins/ossim/EnvisatAsar/EnvisatAsarData.cpp @@ -0,0 +1,283 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#include <EnvisatAsar/EnvisatAsarData.h> +#include <EnvisatAsar/EnvisatAsarDataFactory.h> + +#include <EnvisatAsar/sph.h> +#include <EnvisatAsar/mph.h> +#include <EnvisatAsar/SQ_ADSR.h> +#include <EnvisatAsar/MainProcessingParameters.h> +#include <EnvisatAsar/SRGRConversionParameters.h> +#include <EnvisatAsar/DopplerCentroidParameters.h> +#include <EnvisatAsar/ChirpParameters.h> +#include <EnvisatAsar/AntennaElevationPatterns.h> +#include <EnvisatAsar/GeolocationGrid.h> + +namespace ossimplugins +{ + +EnvisatAsarData::EnvisatAsarData() +{ +} + +EnvisatAsarData::~EnvisatAsarData() +{ + ClearRecords(); +} + +std::ostream& operator<<(std::ostream& os, const EnvisatAsarData& data) +{ + std::list<EnvisatAsarRecord*>::const_iterator it = data._records.begin(); + while(it != data._records.end()) + { + (*it)->Write(os); + ++it; + } + return os; + +} + +std::istream& operator>>(std::istream& is, EnvisatAsarData& data) +{ + EnvisatAsarDataFactory factory; + + if (sizeof(int)!=4) std::cout << "EnvisatAsarData WARNING : (int) not coded over 32 bits, metadata might not be byte swapped correctly"<< std::endl ; + if (sizeof(float)!=4) std::cout << "EnvisatAsarData WARNING : (float) not coded over 32 bits, metadata might not be byte swapped correctly"<< std::endl ; + if (sizeof(double)!=8) std::cout << "EnvisatAsarData WARNING : (double) not coded over 64 bits, metadata might not be byte swapped correctly"<< std::endl ; + + data.ClearRecords(); + + // read the first record (MPH) + EnvisatAsarRecord* mph_record = factory.Instanciate("MPH"); + mph_record->Read(is); + data._records.push_back(mph_record); + + // read the second record (sph) and update it with the mph (number of dsd) + EnvisatAsarRecord* sph_record = factory.Instanciate("SPH"); + ((sph*)sph_record)->update_sph_from_mph(*((mph *)mph_record)); + sph_record->Read(is); + data._records.push_back(sph_record); + + std::vector<dsd> dsd_vector = ((sph*)sph_record)->get_dsd_vector(); + + // For each dsd, check if present in the file and in the record factory. + // If true, instanciate it and add to the EnvisatAsarRecord list. + std::vector<dsd>::iterator it = dsd_vector.begin(); + while(it != dsd_vector.end()) + { + std::string str = (it->get_ds_name()); + + if ( (it->get_ds_size()) != 0) + { + for (int i = 0; i<(it->get_num_dsr()); i++) + { + EnvisatAsarRecord* record = factory.Instanciate(str); + if (record != NULL) + { + is.seekg((it->get_ds_offset())+ i*(it->get_dsr_size())); + record->Read(is); + data._records.push_back(record); + } + } + } + ++it; + } + + return is; +} + + +EnvisatAsarData::EnvisatAsarData(const EnvisatAsarData& rhs) +{ + std::list<EnvisatAsarRecord*>::const_iterator it = rhs._records.begin(); + while(it != rhs._records.end()) + { + _records.push_back((*it)->Clone()); + ++it; + } +} + +EnvisatAsarData& EnvisatAsarData::operator=(const EnvisatAsarData& rhs) +{ + ClearRecords(); + std::list<EnvisatAsarRecord*>::const_iterator it = rhs._records.begin(); + while(it != rhs._records.end()) + { + _records.push_back((*it)->Clone()); + ++it; + } + + return *this; +} + +void EnvisatAsarData::ClearRecords() +{ + std::list<EnvisatAsarRecord*>::const_iterator it = _records.begin(); + while(it != _records.end()) + { + delete (*it); + ++it; + } + _records.clear(); +} +mph * EnvisatAsarData::get_mph() +{ + std::list<EnvisatAsarRecord*>::const_iterator it = _records.begin(); + while(it != _records.end()) + { + if ((*it)->get_mnemonic().compare("mph_rec") == 0) return (mph*)(*it); + ++it; + } + return NULL; +} +sph * EnvisatAsarData::get_sph() +{ + std::list<EnvisatAsarRecord*>::const_iterator it = _records.begin(); + while(it != _records.end()) + { + if ((*it)->get_mnemonic().compare("sph_rec") == 0) return (sph*)(*it); + ++it; + } + return NULL; +} + +SQ_ADSR * EnvisatAsarData::get_SQ_ADSR() +{ + std::list<EnvisatAsarRecord*>::const_iterator it = _records.begin(); + while(it != _records.end()) + { + if ((*it)->get_mnemonic().compare("SQ_ADSR_rec") == 0) return (SQ_ADSR*)(*it); + ++it; + } + return NULL; +} +MainProcessingParameters * EnvisatAsarData::get_MainProcessingParameters() +{ + std::list<EnvisatAsarRecord*>::const_iterator it = _records.begin(); + while(it != _records.end()) + { + if ((*it)->get_mnemonic().compare("MainProcessingParameters_rec") == 0) return (MainProcessingParameters*)(*it); + ++it; + } + return NULL; +} +DopplerCentroidParameters * EnvisatAsarData::get_DopplerCentroidParameters() +{ + std::list<EnvisatAsarRecord*>::const_iterator it = _records.begin(); + while(it != _records.end()) + { + if ((*it)->get_mnemonic().compare("DopplerCentroidParameters_rec") == 0) return (DopplerCentroidParameters*)(*it); + ++it; + } + return NULL; +} +SRGRConversionParameters * EnvisatAsarData::get_SRGRConversionParameters(int pos) +{ + std::list<EnvisatAsarRecord*>::const_iterator it = _records.begin(); + int cpt = 0; + while(it != _records.end()) + { + if ((*it)->get_mnemonic().compare("SRGRConversionParameters_rec") == 0) + { + if (cpt == pos) { + return (SRGRConversionParameters*)(*it); + } + else cpt++; + } + ++it; + } + return NULL; +} +ChirpParameters * EnvisatAsarData::get_ChirpParameters() +{ + std::list<EnvisatAsarRecord*>::const_iterator it = _records.begin(); + while(it != _records.end()) + { + if ((*it)->get_mnemonic().compare("ChirpParameters_rec") == 0) return (ChirpParameters*)(*it); + ++it; + } + return NULL; +} +AntennaElevationPatterns * EnvisatAsarData::get_AntennaElevationPatterns() +{ + std::list<EnvisatAsarRecord*>::const_iterator it = _records.begin(); + while(it != _records.end()) + { + if ((*it)->get_mnemonic().compare("AntennaElevationPatterns_rec") == 0) return (AntennaElevationPatterns*)(*it); + ++it; + } + return NULL; +} + +// Return the first Geolocation Grid Record +//GeolocationGrid * EnvisatAsarData::get_GeolocationGrid() +//{ +// std::list<EnvisatAsarRecord*>::const_iterator it = _records.begin(); +// while(it != _records.end()) +// { +// std::string str = (*it)->get_mnemonic(); +// if ((*it)->get_mnemonic().compare("GeolocationGrid_rec") == 0) +// { +// return (GeolocationGrid*)(*it); +// } +// ++it; +// } +// return NULL; +//} + +// Return the num_ds Geolocation Grid Record +GeolocationGrid * EnvisatAsarData::get_GeolocationGrid(int num_ds) +{ + std::list<EnvisatAsarRecord*>::const_iterator it = _records.begin(); + + int total_num_ds = 0; + while(it != _records.end()) + { + std::string str = (*it)->get_mnemonic(); + if ((*it)->get_mnemonic().compare("GeolocationGrid_rec") == 0) total_num_ds += 1; + ++it; + } + + int cpt = 0; + it = _records.begin(); + while(it != _records.end()) + { + std::string str = (*it)->get_mnemonic(); + if ((*it)->get_mnemonic().compare("GeolocationGrid_rec") == 0) + { + if ((cpt == num_ds) || (cpt == total_num_ds-1)) return (GeolocationGrid*)(*it); + cpt +=1; + + } + ++it; + } + return NULL; +} + + +int EnvisatAsarData::get_num_ds(EnvisatAsarRecord * record) +{ + if (record == NULL) return 0; + std::list<EnvisatAsarRecord*>::const_iterator it = _records.begin(); + int cpt = 0; + while(it != _records.end()) + { + std::string str = (*it)->get_mnemonic(); + if ((*it)->get_mnemonic().compare(record->get_mnemonic()) == 0) + { + cpt++; + } + ++it; + } + return cpt; +} +} diff --git a/Utilities/otbossimplugins/ossim/EnvisatAsar/EnvisatAsarData.h b/Utilities/otbossimplugins/ossim/EnvisatAsar/EnvisatAsarData.h new file mode 100644 index 0000000000000000000000000000000000000000..9ea2187094e53dee0cf2363409ccb39c90b844f4 --- /dev/null +++ b/Utilities/otbossimplugins/ossim/EnvisatAsar/EnvisatAsarData.h @@ -0,0 +1,92 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#ifndef EnvisatAsarData_h +#define EnvisatAsarData_h + +#include <iostream> +#include "sph.h" +#include "mph.h" +#include "SQ_ADSR.h" +#include "MainProcessingParameters.h" +#include "AntennaElevationPatterns.h" +#include "DopplerCentroidParameters.h" +#include "SRGRConversionParameters.h" +#include "ChirpParameters.h" +#include "GeolocationGrid.h" +#include <map> +#include <list> +#include <vector> + +namespace ossimplugins +{ +/** + * @ingroup EnvisatAsarDataFile + * @brief This class is able to read the Envisat file structure + */ +class EnvisatAsarData +{ +public: + /** + * @brief Constructor + */ + EnvisatAsarData(); + + /** + * @brief Destructor + */ + ~EnvisatAsarData(); + + /** + * @brief This function writes the EnvisatAsarData in a stream + */ + friend std::ostream& operator<<(std::ostream& os, const EnvisatAsarData& data); + + /** + * @brief This function reads a EnvisatAsarData from a stream + */ + friend std::istream& operator>>(std::istream& is, EnvisatAsarData& data); + + /** + * @brief Copy constructor + */ + EnvisatAsarData(const EnvisatAsarData& rhs); + + /** + * @brief Copy operator + */ + EnvisatAsarData& operator=(const EnvisatAsarData& rhs); + + /** + * @brief Removes all the previous records from the EnvisatAsarData + */ + void ClearRecords(); + + mph * get_mph(); + sph * get_sph(); + SQ_ADSR * get_SQ_ADSR(); + MainProcessingParameters * get_MainProcessingParameters(); + AntennaElevationPatterns * get_AntennaElevationPatterns(); + DopplerCentroidParameters * get_DopplerCentroidParameters(); + SRGRConversionParameters * get_SRGRConversionParameters(int pos = 0); + ChirpParameters * get_ChirpParameters(); + GeolocationGrid * get_GeolocationGrid(int num_ds = 0); + + int get_num_ds(EnvisatAsarRecord * record); + +protected: + std::list<EnvisatAsarRecord*> _records; + +private: + +}; +} +#endif diff --git a/Utilities/otbossimplugins/ossim/EnvisatAsar/EnvisatAsarDataFactory.cpp b/Utilities/otbossimplugins/ossim/EnvisatAsar/EnvisatAsarDataFactory.cpp new file mode 100644 index 0000000000000000000000000000000000000000..64a27c938a2a40741b34a6b32047c71a1b796323 --- /dev/null +++ b/Utilities/otbossimplugins/ossim/EnvisatAsar/EnvisatAsarDataFactory.cpp @@ -0,0 +1,49 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#include <EnvisatAsar/EnvisatAsarDataFactory.h> +#include <EnvisatAsar/EnvisatAsarData.h> + +#include <EnvisatAsar/sph.h> +#include <EnvisatAsar/mph.h> +#include <EnvisatAsar/SQ_ADSR.h> +#include <EnvisatAsar/MainProcessingParameters.h> +#include <EnvisatAsar/SRGRConversionParameters.h> +#include <EnvisatAsar/DopplerCentroidParameters.h> +#include <EnvisatAsar/ChirpParameters.h> +#include <EnvisatAsar/AntennaElevationPatterns.h> +#include <EnvisatAsar/GeolocationGrid.h> + +namespace ossimplugins +{ + +EnvisatAsarDataFactory::EnvisatAsarDataFactory() +{ + RegisterRecord("MPH" , new mph()); + RegisterRecord("SPH" , new sph()); + RegisterRecord("MDS1 SQ ADS " , new SQ_ADSR()); + RegisterRecord("MDS2 SQ ADS " , new SQ_ADSR()); + RegisterRecord("MAIN PROCESSING PARAMS ADS " , new MainProcessingParameters()); + RegisterRecord("DOP CENTROID COEFFS ADS " , new DopplerCentroidParameters()); + RegisterRecord("SR GR ADS " , new SRGRConversionParameters()); + RegisterRecord("CHIRP PARAMS ADS " , new ChirpParameters()); + RegisterRecord("MDS1 ANTENNA ELEV PATT ADS " , new AntennaElevationPatterns()); + RegisterRecord("MDS2 ANTENNA ELEV PATT ADS " , new AntennaElevationPatterns()); + RegisterRecord("GEOLOCATION GRID ADS " , new GeolocationGrid()); +} + +EnvisatAsarDataFactory::~EnvisatAsarDataFactory() +{ + +} + +} + diff --git a/Utilities/otbossimplugins/ossim/EnvisatAsar/EnvisatAsarDataFactory.h b/Utilities/otbossimplugins/ossim/EnvisatAsar/EnvisatAsarDataFactory.h new file mode 100644 index 0000000000000000000000000000000000000000..4bb6d24595f02f19392cee7db509b2ceffd1eea4 --- /dev/null +++ b/Utilities/otbossimplugins/ossim/EnvisatAsar/EnvisatAsarDataFactory.h @@ -0,0 +1,44 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#ifndef EnvisatAsarDataFactory_h +#define EnvisatAsarDataFactory_h + + +#include <EnvisatAsar/EnvisatAsarRecordFactory.h> +#include <map> + +namespace ossimplugins +{ +/** + * @ingroup EnvisatAsarDataFile + * @brief This class is a factory able to construct Record base classes + */ +class EnvisatAsarDataFactory : public EnvisatAsarRecordFactory +{ +public: + /** + * @brief Constructor + */ + EnvisatAsarDataFactory(); + /** + * @brief Destructor + */ + ~EnvisatAsarDataFactory(); + + +protected: + + +private: +}; +} +#endif diff --git a/Utilities/otbossimplugins/ossim/EnvisatAsar/EnvisatAsarRecord.cpp b/Utilities/otbossimplugins/ossim/EnvisatAsar/EnvisatAsarRecord.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a374f4814c0249519f864a33f6434412b8194e44 --- /dev/null +++ b/Utilities/otbossimplugins/ossim/EnvisatAsar/EnvisatAsarRecord.cpp @@ -0,0 +1,30 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#include <EnvisatAsar/EnvisatAsarRecord.h> +#include <memory.h> + +namespace ossimplugins +{ +EnvisatAsarRecord::EnvisatAsarRecord(std::string mnemonic): + _mnemonic(mnemonic) +{ +} + +EnvisatAsarRecord::~EnvisatAsarRecord() +{ +} + +EnvisatAsarRecord::EnvisatAsarRecord(const EnvisatAsarRecord& rhs): + _mnemonic(rhs._mnemonic) +{ +} +} diff --git a/Utilities/otbossimplugins/ossim/EnvisatAsar/EnvisatAsarRecord.h b/Utilities/otbossimplugins/ossim/EnvisatAsar/EnvisatAsarRecord.h new file mode 100644 index 0000000000000000000000000000000000000000..9b3d7938527373256e7ac9091e9a255c498ee146 --- /dev/null +++ b/Utilities/otbossimplugins/ossim/EnvisatAsar/EnvisatAsarRecord.h @@ -0,0 +1,109 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#ifndef EnvisatAsarRecord_h +#define EnvisatAsarRecord_h + +#include <iostream> +#include <cstdlib> +#include <cstring> +#include <ossim/base/ossimCommon.h> + +namespace ossimplugins +{ +/** + * @ingroup EnvisatAsar + * @brief This class is the base class of all the Envisat ASAR record classes + */ + + + + +class EnvisatAsarRecord +{ +public: + /** + * @brief Constructor + * @param mnemonic Name of the record + */ + EnvisatAsarRecord(std::string mnemonic); + /** + * @brief Destructor + */ + ~EnvisatAsarRecord(); + + /** + * @brief Copy constructor + */ + EnvisatAsarRecord(const EnvisatAsarRecord& rhs); + + /** + * @brief This function is able to create a new instance of the class + */ + virtual EnvisatAsarRecord* Instanciate() =0; + + /** + * @brief This function is able to create a new instance of the class initialised with the data of the calling instance + */ + virtual EnvisatAsarRecord* Clone()=0; + + /** + * @brief Reads the class data from a stream + */ + virtual void Read(std::istream& is) =0; + + /** + * @brief Writes the class to a stream + */ + virtual void Write(std::ostream& os)=0; + + /** + * @brief Returns the mnemonic of the record + */ + std::string get_mnemonic() + { + return _mnemonic; + }; + + + +protected: + /** + * @brief This function switches the LSB value and the MSB value of the parameter + */ + template<typename T> + void SwitchEndian(T &value) { + + char *buffer; + char *res; + int nb_octets = sizeof(T); + + if (ossim::byteOrder() == OSSIM_LITTLE_ENDIAN) { + buffer = (char* )malloc(nb_octets); + res = (char* )malloc(nb_octets); + + memcpy(buffer,&value,nb_octets); + + for (int i=0; i<nb_octets/2; i++) { + res[i] = buffer[nb_octets-1-i]; + res[nb_octets-1-i] = buffer[i]; + } + memcpy(&value,res,nb_octets); + } + } + + + std::string _mnemonic; + +private: +}; +} +#endif diff --git a/Utilities/otbossimplugins/ossim/EnvisatAsar/EnvisatAsarRecordFactory.cpp b/Utilities/otbossimplugins/ossim/EnvisatAsar/EnvisatAsarRecordFactory.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f4d0bce8146d2eeef46adae7e439f248499797a2 --- /dev/null +++ b/Utilities/otbossimplugins/ossim/EnvisatAsar/EnvisatAsarRecordFactory.cpp @@ -0,0 +1,41 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#include <EnvisatAsar/EnvisatAsarRecordFactory.h> + +namespace ossimplugins +{ +EnvisatAsarRecordFactory::EnvisatAsarRecordFactory() +{ +} + +EnvisatAsarRecordFactory::~EnvisatAsarRecordFactory() +{ +} + +EnvisatAsarRecord* EnvisatAsarRecordFactory::Instanciate(std::string id) +{ + EnvisatAsarRecord* record = _availableRecords[id]; + if(record == NULL) + { + return NULL; + } + else + { + return record->Instanciate(); + } +} + +void EnvisatAsarRecordFactory::RegisterRecord(std::string id, EnvisatAsarRecord * record) +{ + _availableRecords[id] = record; +} +} diff --git a/Utilities/otbossimplugins/ossim/EnvisatAsar/EnvisatAsarRecordFactory.h b/Utilities/otbossimplugins/ossim/EnvisatAsar/EnvisatAsarRecordFactory.h new file mode 100644 index 0000000000000000000000000000000000000000..be93dc9cdcd4fd0712a5b66226e8376330e77529 --- /dev/null +++ b/Utilities/otbossimplugins/ossim/EnvisatAsar/EnvisatAsarRecordFactory.h @@ -0,0 +1,60 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#ifndef EnvisatAsarRecordFactory_h +#define EnvisatAsarRecordFactory_h + +#include <EnvisatAsar/EnvisatAsarRecord.h> +#include <map> +#include <string> + +namespace ossimplugins +{ + +/** + * @ingroup EnvisatAsar + * @brief This class is a factory able to construct Record base classes given the id of the record wanted + */ +class EnvisatAsarRecordFactory +{ +public: + /** + * @brief Constructor + */ + EnvisatAsarRecordFactory(); + /** + * @brief Destructor + */ + ~EnvisatAsarRecordFactory(); + + /** + * @brief Adds a new Record type available in this factory + * @param record Record to add in the factory + * @param id Id of the new avalaible Record + */ + void RegisterRecord(std::string id, EnvisatAsarRecord * record); + + /** + * @brief Instanciatse a new Record + * @param id Id of the Record we want to instanciate + */ + EnvisatAsarRecord* Instanciate(std::string id); + +protected: + /** + * @brief Contains all the available Records for the factory + */ + std::map<std::string, EnvisatAsarRecord*> _availableRecords; + +private: +}; +} +#endif diff --git a/Utilities/otbossimplugins/ossim/EnvisatAsar/GeolocationGrid.cpp b/Utilities/otbossimplugins/ossim/EnvisatAsar/GeolocationGrid.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0d170085ef7dbbf8fad368ab65fc583df448e004 --- /dev/null +++ b/Utilities/otbossimplugins/ossim/EnvisatAsar/GeolocationGrid.cpp @@ -0,0 +1,217 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#include <EnvisatAsar/GeolocationGrid.h> + +namespace ossimplugins +{ +GeolocationGrid::GeolocationGrid() : EnvisatAsarRecord("GeolocationGrid_rec") +{ +} + +GeolocationGrid::~GeolocationGrid() +{ +} + + +std::ostream& operator<<(std::ostream& os, const GeolocationGrid& data) +{ + os<<"first_zero_doppler_time_day:"<<data._first_zero_doppler_time_day<<std::endl; + + os<<"first_zero_doppler_time_sec:"<<data._first_zero_doppler_time_sec<<std::endl; + + os<<"first_zero_doppler_time_microsec:"<<data._first_zero_doppler_time_microsec<<std::endl; + + os<<"attach_flag:"<<data._attach_flag<<std::endl; + + os<<"line_num:"<<data._line_num<<std::endl; + + os<<"num_lines:"<<data._num_lines<<std::endl; + + os<<"sub_sat_track:"<<data._sub_sat_track<<std::endl; + + for (int i = 0; i<11; i++) { + os<<"samp_numbers["<<i<<"]:"<<data._samp_numbers[i]<<std::endl; + } + + for (int i = 0; i<11; i++) { + os<<"slant_range_times["<<i<<"]:"<<data._slant_range_times[i]<<std::endl; + } + + for (int i = 0; i<11; i++) { + os<<"angles["<<i<<"]:"<<data._angles[i]<<std::endl; + } + + for (int i = 0; i<11; i++) { + os<<"lats["<<i<<"]:"<<data._lats[i]<<std::endl; + } + + for (int i = 0; i<11; i++) { + os<<"longs["<<i<<"]:"<<data._longs[i]<<std::endl; + } + + os<<"last_zero_doppler_time:"<<data._last_zero_doppler_time.c_str()<<std::endl; + + os<<"last_line_tie_points:"<<data._last_line_tie_points.c_str()<<std::endl; + + return os; + +} + +std::istream& operator>>(std::istream& is, GeolocationGrid& data) +{ + char buf220[221]; + buf220[220] = '\0'; + char buf32[33]; + buf32[32] = '\0'; + char buf27[28]; + buf27[27] = '\0'; + char buf20[21]; + buf20[20] = '\0'; + char buf16[17]; + buf16[16]='\0'; + char buf15[16]; + buf15[15] = '\0'; + char buf14[15]; + buf14[14] = '\0'; + char buf13[14]; + buf13[13] = '\0'; + char buf12[13]; + buf12[12] = '\0'; + char buf11[12]; + buf11[11] = '\0'; + char buf10[11]; + buf10[10] = '\0'; + char buf9[10]; + buf9[9] = '\0'; + char buf8[9]; + buf8[8] = '\0'; + char buf7[8]; + buf7[7] = '\0'; + char buf6[7]; + buf6[6] = '\0'; + char buf5[6]; + buf5[5] = '\0'; + char buf4[5]; + buf4[4] = '\0'; + char buf3[4]; + buf3[3] = '\0'; + char buf2[3]; + buf2[2] = '\0'; + char buf1[1]; + + is.read((char*)&(data._first_zero_doppler_time_day),4); + data.SwitchEndian(data._first_zero_doppler_time_day); + + is.read((char*)&(data._first_zero_doppler_time_sec),4); + data.SwitchEndian(data._first_zero_doppler_time_sec); + + is.read((char*)&(data._first_zero_doppler_time_microsec),4); + data.SwitchEndian(data._first_zero_doppler_time_microsec); + + is.read((char*)&(data._attach_flag),1); + + is.read((char*)&(data._line_num),4); + data.SwitchEndian(data._line_num); + + is.read((char*)&(data._num_lines),4); + data.SwitchEndian(data._num_lines); + + is.read((char*)&(data._sub_sat_track),4); + data.SwitchEndian(data._sub_sat_track); + + for (int i = 0; i<11; i++) { + is.read((char*)&(data._samp_numbers[i]),4); + data.SwitchEndian(data._samp_numbers[i]); + } + + for (int i = 0; i<11; i++) { + is.read((char*)&(data._slant_range_times[i]),4); + data.SwitchEndian(data._slant_range_times[i]); + } + + for (int i = 0; i<11; i++) { + is.read((char*)&(data._angles[i]),4); + data.SwitchEndian(data._angles[i]); + } + + for (int i = 0; i<11; i++) { + is.read((char*)&(data._lats[i]),4); + data.SwitchEndian(data._lats[i]); + } + + for (int i = 0; i<11; i++) { + is.read((char*)&(data._longs[i]),4); + data.SwitchEndian(data._longs[i]); + } + + is.read(buf32,22); + + is.read(buf12,12); + data._last_zero_doppler_time = buf12; + + is.read(buf220,220); + data._last_line_tie_points = buf220; + + is.read(buf32,22); + + return is; + +} + +GeolocationGrid::GeolocationGrid(const GeolocationGrid& rhs): + EnvisatAsarRecord(rhs), + _first_zero_doppler_time_day(rhs._first_zero_doppler_time_day), + _first_zero_doppler_time_sec(rhs._first_zero_doppler_time_sec), + _first_zero_doppler_time_microsec(rhs._first_zero_doppler_time_microsec), + _attach_flag(rhs._attach_flag), + _line_num(rhs._line_num), + _num_lines(rhs._num_lines), + _sub_sat_track(rhs._sub_sat_track), + _last_zero_doppler_time(rhs._last_zero_doppler_time), + _last_line_tie_points(rhs._last_line_tie_points) + { + + for (int i = 0; i<11; i++) { + _samp_numbers[i] = rhs._samp_numbers[i]; + _slant_range_times[i] = rhs._slant_range_times[i]; + _angles[i] = rhs._angles[i]; + _lats[i] = rhs._lats[i]; + _longs[i] = rhs._longs[i]; + } + + + } + + +GeolocationGrid& GeolocationGrid::operator=(const GeolocationGrid& rhs) +{ + _first_zero_doppler_time_day = rhs._first_zero_doppler_time_day; + _first_zero_doppler_time_sec = rhs._first_zero_doppler_time_sec; + _first_zero_doppler_time_microsec = rhs._first_zero_doppler_time_microsec; + _attach_flag = rhs._attach_flag; + _line_num = rhs._line_num; + _num_lines = rhs._num_lines; + _sub_sat_track = rhs._sub_sat_track; + _last_zero_doppler_time = rhs._last_zero_doppler_time; + _last_line_tie_points = rhs._last_line_tie_points; + + for (int i = 0; i<11; i++) { + _samp_numbers[i] = rhs._samp_numbers[i]; + _slant_range_times[i] = rhs._slant_range_times[i]; + _angles[i] = rhs._angles[i]; + _lats[i] = rhs._lats[i]; + _longs[i] = rhs._longs[i]; + } + + return *this; +} +} diff --git a/Utilities/otbossimplugins/ossim/EnvisatAsar/GeolocationGrid.h b/Utilities/otbossimplugins/ossim/EnvisatAsar/GeolocationGrid.h new file mode 100644 index 0000000000000000000000000000000000000000..2defefeeec0ab0bedb231c08c2e5ab27301356e5 --- /dev/null +++ b/Utilities/otbossimplugins/ossim/EnvisatAsar/GeolocationGrid.h @@ -0,0 +1,253 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#ifndef GeolocationGrid_h +#define GeolocationGrid_h + +#include <iostream> +#include <EnvisatAsar/EnvisatAsarRecord.h> + +namespace ossimplugins +{ +/** + * @ingroup GeolocationGridRecord + * @brief This class is able to read the ASAR GeolocationGrid record + */ +class GeolocationGrid : public EnvisatAsarRecord +{ +public: + /** + * @brief Constructor + */ + GeolocationGrid(); + + /** + * @brief Destructor + */ + ~GeolocationGrid(); + + /** + * @brief This function writes the GeolocationGrid in a stream + */ + friend std::ostream& operator<<(std::ostream& os, const GeolocationGrid& data); + + /** + * @brief This function reads a GeolocationGrid from a stream + */ + friend std::istream& operator>>(std::istream& is, GeolocationGrid& data); + + /** + * @brief Copy constructor + */ + GeolocationGrid(const GeolocationGrid& rhs); + + /** + * @brief Copy operator + */ + GeolocationGrid& operator=(const GeolocationGrid& rhs); + + /** + * @brief This function is able to create a new instance of the class + */ + EnvisatAsarRecord* Instanciate() + { + return new GeolocationGrid(); + }; + + /** + * @brief This function is able to create a new instance of the class initialised with the data of the calling instance + */ + EnvisatAsarRecord* Clone() + { + return new GeolocationGrid(*this); + }; + + /** + * @brief Reads the class data from a stream + */ + void Read(std::istream& is) + { + is>>*this; + }; + + /** + * @brief Writes the class to a stream + */ + void Write(std::ostream& os) + { + os<<*this; + }; + + /** + * @brief first_zero_doppler_time day + */ + int get_first_zero_doppler_time_day() + { + return _first_zero_doppler_time_day; + }; + /** + * @brief first_zero_doppler_time second + */ + unsigned int get_first_zero_doppler_time_sec() + { + return _first_zero_doppler_time_sec; + }; + /** + * @brief first_zero_doppler_time micro sec + */ + unsigned int get_first_zero_doppler_time_microsec() + { + return _first_zero_doppler_time_microsec; + }; + /** + * @brief attach_flag + */ + bool get_attach_flag() + { + return _attach_flag; + }; + /** + * @brief line_num + */ + unsigned int get_line_num() + { + return _line_num; + }; + /** + * @brief num_lines + */ + unsigned int get_num_lines() + { + return _num_lines; + }; + /** + * @brief sub_sat_track + */ + float get_sub_sat_track() + { + return _sub_sat_track; + }; + /** + * @brief samp_numbvers + */ + unsigned int * get_samp_numbers() + { + return _samp_numbers; + }; + /** + * @brief slant_range_times + */ + float * get_slant_range_times() + { + return _slant_range_times; + }; + /** + * @brief angles + */ + float * get_angles() + { + return _angles; + }; + /** + * @brief lats + */ + int * get_lats() + { + return _lats; + }; + /** + * @brief longs + */ + int * get_longs() + { + return _longs; + }; + /** + * @brief last_zero_doppler_time + */ + std::string get_last_zero_doppler_time() + { + return _last_zero_doppler_time; + }; + /** + * @brief last_line_tie_points + */ + std::string get_last_line_tie_points() + { + return _last_line_tie_points; + }; + + + /** + * @brief first_zero_doppler_time day + */ + int _first_zero_doppler_time_day; + /** + * @brief first_zero_doppler_time sec + */ + unsigned int _first_zero_doppler_time_sec; + /** + * @brief first_zero_doppler_time microsec + */ + unsigned int _first_zero_doppler_time_microsec; + /** + * @brief attach_flag + */ + bool _attach_flag; + /** + * @brief line_num + */ + unsigned int _line_num; + /** + * @brief num_lines + */ + unsigned int _num_lines; + /** + * @brief sub_sat_track + */ + float _sub_sat_track; + /** + * @brief samp_numbers + */ + unsigned int _samp_numbers[11]; + /** + * @brief slant_range_times[11] + */ + float _slant_range_times[11]; + /** + * @brief angles[11] + */ + float _angles[11]; + /** + * @brief lats[11] + */ + int _lats[11]; + /** + * @brief longs[11] + */ + int _longs[11]; + /** + * @brief last_zero_doppler_time + */ + std::string _last_zero_doppler_time; + /** + * @brief last_line_tie_points + */ + std::string _last_line_tie_points; + + +private: + +}; +} +#endif + + diff --git a/Utilities/otbossimplugins/ossim/EnvisatAsar/MainProcessingParameters.cpp b/Utilities/otbossimplugins/ossim/EnvisatAsar/MainProcessingParameters.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6f9a89798eabc986769142b87b4092da259861c7 --- /dev/null +++ b/Utilities/otbossimplugins/ossim/EnvisatAsar/MainProcessingParameters.cpp @@ -0,0 +1,989 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#include <EnvisatAsar/MainProcessingParameters.h> + +namespace ossimplugins +{ + +MainProcessingParameters::MainProcessingParameters() : EnvisatAsarRecord("MainProcessingParameters_rec") +{ +} + +MainProcessingParameters::~MainProcessingParameters() +{ +} + +std::ostream& operator<<(std::ostream& os, const MainProcessingParameters& data) +{ + os<<"first_zero_doppler_time:"<<data._first_zero_doppler_time.c_str()<<std::endl; + + os<<"attach_flag:"<<data._attach_flag<<std::endl; + + os<<"last_zero_doppler_time:"<<data._last_zero_doppler_time.c_str()<<std::endl; + + os<<"work_order_id:"<<data._work_order_id.c_str()<<std::endl; + + os<<"time_diff:"<<data._time_diff<<std::endl; + + os<<"swath_num:"<<data._swath_num.c_str()<<std::endl; + + os<<"range_spacing:"<<data._range_spacing<<std::endl; + + os<<"azimut_spacing:"<<data._azimut_spacing<<std::endl; + + os<<"line_time_interval:"<<data._line_time_interval<<std::endl; + + os<<"num_output_lines:"<<data._num_output_lines<<std::endl; + + os<<"num_samples_per_line:"<<data._num_samples_per_line<<std::endl; + + os<<"data_type:"<<data._data_type.c_str()<<std::endl; + + os<<"num_range_lines_per_burst:"<<data._num_range_lines_per_burst<<std::endl; + + os<<"time_diff_zero_doppler:"<<data._time_diff_zero_doppler<<std::endl; + + os<<"data_analysis_flag:"<<data._data_analysis_flag<<std::endl; + + os<<"ant_elev_coor_flag:"<<data._ant_elev_coor_flag<<std::endl; + + os<<"chirp_extract_flag:"<<data._chirp_extract_flag<<std::endl; + + os<<"srgr_flag:"<<data._srgr_flag<<std::endl; + + os<<"dop_cen_flag:"<<data._dop_cen_flag<<std::endl; + + os<<"dop_amb_flag:"<<data._dop_amb_flag<<std::endl; + + os<<"range_spread_comp_flag:"<<data._range_spread_comp_flag<<std::endl; + + os<<"detected_flag:"<<data._detected_flag<<std::endl; + + os<<"look_sum_flag:"<<data._look_sum_flag<<std::endl; + + os<<"rms_equal_flag:"<<data._rms_equal_flag<<std::endl; + + os<<"ant_scal_flag:"<<data._ant_scal_flag<<std::endl; + + os<<"vga_com_echo_flag:"<<data._vga_com_echo_flag<<std::endl; + + os<<"vga_com_cal_flag:"<<data._vga_com_cal_flag<<std::endl; + + os<<"vga_com_nom_time_flag:"<<data._vga_com_nom_time_flag<<std::endl; + + os<<"gm_rng_comp_inv_filter_flag:"<<data._gm_rng_comp_inv_filter_flag<<std::endl; + + os<<"raw_data_analysis:"<<data._raw_data_analysis.c_str()<<std::endl; + + os<<"start_time_mds1:"<<data._start_time_mds1.c_str()<<std::endl; + + os<<"start_time_mds2:"<<data._start_time_mds2.c_str()<<std::endl; + + os<<"parameter_code:"<<data._parameter_code.c_str()<<std::endl; + + os<<"errors_counters:"<<data._errors_counters.c_str()<<std::endl; + + os<<"image_parameters 1:"<<data._image_parameters1.c_str()<<std::endl; + + os<<"prf_values[0]:"<<data._prf_values[0]<<std::endl; + + os<<"image_parameters 1:"<<data._image_parameters2.c_str()<<std::endl; + + os<<"first_proc_range_samp:"<<data._first_proc_range_samp<<std::endl; + + os<<"range_ref:"<<data._range_ref<<std::endl; + + os<<"range_samp_rate:"<<data._range_samp_rate<<std::endl; + + os<<"radar_freq:"<<data._radar_freq<<std::endl; + + os<<"num_looks_range:"<<data._num_looks_range<<std::endl; + + os<<"filter_range:"<<data._filter_range.c_str()<<std::endl; + + os<<"filter_coef_range:"<<data._filter_coef_range<<std::endl; + + os<<"bandwidth:"<<data._bandwidth.c_str()<<std::endl; + + os<<"nominal_chirp:"<<data._nominal_chirp.c_str()<<std::endl; + + os<<"num_lines_proc:"<<data._num_lines_proc<<std::endl; + + os<<"num_look_az:"<<data._num_look_az<<std::endl; + + os<<"look_bw_az:"<<data._look_bw_az<<std::endl; + + os<<"to_bw_az:"<<data._to_bw_az<<std::endl; + + os<<"filter_az:"<<data._filter_az.c_str()<<std::endl; + + os<<"filter_coef_az:"<<data._filter_coef_az<<std::endl; + + os<<"az_fm_rate[0]:"<<data._az_fm_rate[0]<<std::endl; + os<<"az_fm_rate[1]:"<<data._az_fm_rate[1]<<std::endl; + os<<"az_fm_rate[2]:"<<data._az_fm_rate[2]<<std::endl; + + os<<"ax_fm_origin:"<<data._ax_fm_origin<<std::endl; + + os<<"dop_amb_coef:"<<data._dop_amb_coef<<std::endl; + + os<<"calibration_factors:"<<data._calibration_factors.c_str()<<std::endl; + + os<<"noise_estimation:"<<data._noise_estimation.c_str()<<std::endl; + + os<<"output_statistics:"<<data._output_statistics.c_str()<<std::endl; + + os<<"avg_scene_height_ellpsoid:"<<data._avg_scene_height_ellpsoid<<std::endl; + + os<<"echo_comp:"<<data._echo_comp.c_str()<<std::endl; + + os<<"echo_comp_ratio:"<<data._echo_comp_ratio.c_str()<<std::endl; + + os<<"init_cal_comp:"<<data._init_cal_comp.c_str()<<std::endl; + + os<<"init_cal_ratio:"<<data._init_cal_ratio.c_str()<<std::endl; + + os<<"per_cal_comp:"<<data._per_cal_comp.c_str()<<std::endl; + + os<<"per_cal_ratio:"<<data._per_cal_ratio.c_str()<<std::endl; + + os<<"noise_comp:"<<data._noise_comp.c_str()<<std::endl; + + os<<"noise_comp_ratio:"<<data._noise_comp_ratio.c_str()<<std::endl; + + os<<"beam_overlap[0]:"<<data._beam_overlap[0]<<std::endl; + os<<"beam_overlap[1]:"<<data._beam_overlap[1]<<std::endl; + os<<"beam_overlap[2]:"<<data._beam_overlap[2]<<std::endl; + os<<"beam_overlap[3]:"<<data._beam_overlap[3]<<std::endl; + + os<<"lines_per_burst[0]:"<<data._lines_per_burst[0]<<std::endl; + os<<"lines_per_burst[1]:"<<data._lines_per_burst[1]<<std::endl; + os<<"lines_per_burst[2]:"<<data._lines_per_burst[2]<<std::endl; + os<<"lines_per_burst[3]:"<<data._lines_per_burst[3]<<std::endl; + os<<"lines_per_burst[4]:"<<data._lines_per_burst[4]<<std::endl; + + os<<"time_first_SS1_echo:"<<data._time_first_SS1_echo.c_str()<<std::endl; + + os<<"state_vector_time_1:"<<data._state_vector_time_1_day<<std::endl; + + os<<"state_vector_time_1:"<<data._state_vector_time_1_sec<<std::endl; + + os<<"state_vector_time_1:"<<data._state_vector_time_1_microsec<<std::endl; + + os<<"x_pos_1:"<<data._x_pos_1<<std::endl; + + os<<"y_pos_1:"<<data._y_pos_1<<std::endl; + + os<<"z_pos_1:"<<data._z_pos_1<<std::endl; + + os<<"x_vel_1:"<<data._x_vel_1<<std::endl; + + os<<"y_vel_1:"<<data._y_vel_1<<std::endl; + + os<<"z_vel_1:"<<data._z_vel_1<<std::endl; + + os<<"state_vector_time_2:"<<data._state_vector_time_2_day<<std::endl; + + os<<"state_vector_time_2:"<<data._state_vector_time_2_sec<<std::endl; + + os<<"state_vector_time_2:"<<data._state_vector_time_2_microsec<<std::endl; + + os<<"x_pos_2:"<<data._x_pos_2<<std::endl; + + os<<"y_pos_2:"<<data._y_pos_2<<std::endl; + + os<<"z_pos_2:"<<data._z_pos_2<<std::endl; + + os<<"x_vel_2:"<<data._x_vel_2<<std::endl; + + os<<"y_vel_2:"<<data._y_vel_2<<std::endl; + + os<<"z_vel_2:"<<data._z_vel_2<<std::endl; + + os<<"state_vector_time_3:"<<data._state_vector_time_3_day<<std::endl; + + os<<"state_vector_time_3:"<<data._state_vector_time_3_sec<<std::endl; + + os<<"state_vector_time_3:"<<data._state_vector_time_3_microsec<<std::endl; + + os<<"x_pos_3:"<<data._x_pos_3<<std::endl; + + os<<"y_pos_3:"<<data._y_pos_3<<std::endl; + + os<<"z_pos_3:"<<data._z_pos_3<<std::endl; + + os<<"x_vel_3:"<<data._x_vel_3<<std::endl; + + os<<"y_vel_3:"<<data._y_vel_3<<std::endl; + + os<<"z_vel_3:"<<data._z_vel_3<<std::endl; + + os<<"state_vector_time_4:"<<data._state_vector_time_4_day<<std::endl; + + os<<"state_vector_time_4:"<<data._state_vector_time_4_sec<<std::endl; + + os<<"state_vector_time_4:"<<data._state_vector_time_4_microsec<<std::endl; + + os<<"x_pos_4:"<<data._x_pos_4<<std::endl; + + os<<"y_pos_4:"<<data._y_pos_4<<std::endl; + + os<<"z_pos_4:"<<data._z_pos_4<<std::endl; + + os<<"x_vel_4:"<<data._x_vel_4<<std::endl; + + os<<"y_vel_4:"<<data._y_vel_4<<std::endl; + + os<<"z_vel_4:"<<data._z_vel_4<<std::endl; + + os<<"state_vector_time_5:"<<data._state_vector_time_5_day<<std::endl; + + os<<"state_vector_time_5:"<<data._state_vector_time_5_sec<<std::endl; + + os<<"state_vector_time_5:"<<data._state_vector_time_5_microsec<<std::endl; + + os<<"x_pos_5:"<<data._x_pos_5<<std::endl; + + os<<"y_pos_5:"<<data._y_pos_5<<std::endl; + + os<<"z_pos_5:"<<data._z_pos_5<<std::endl; + + os<<"x_vel_5:"<<data._x_vel_5<<std::endl; + + os<<"y_vel_5:"<<data._y_vel_5<<std::endl; + + os<<"z_vel_5:"<<data._z_vel_5<<std::endl; + + return os; + +} + +std::istream& operator>>(std::istream& is, MainProcessingParameters& data) +{ + char buf64[65]; + buf64[64] = '\0'; + char buf32[33]; + buf32[32] = '\0'; + char buf27[28]; + buf27[27] = '\0'; + char buf20[21]; + buf20[20] = '\0'; + char buf16[17]; + buf16[16]='\0'; + char buf15[16]; + buf15[15] = '\0'; + char buf14[15]; + buf14[14] = '\0'; + char buf13[14]; + buf13[13] = '\0'; + char buf12[13]; + buf12[12] = '\0'; + char buf11[12]; + buf11[11] = '\0'; + char buf10[11]; + buf10[10] = '\0'; + char buf9[10]; + buf9[9] = '\0'; + char buf8[9]; + buf8[8] = '\0'; + char buf7[8]; + buf7[7] = '\0'; + char buf6[7]; + buf6[6] = '\0'; + char buf5[6]; + buf5[5] = '\0'; + char buf4[5]; + buf4[4] = '\0'; + char buf3[4]; + buf3[3] = '\0'; + char buf2[3]; + buf2[2] = '\0'; + char buf1[1]; + + int * var_long; + + is.read(buf12,12); + data._first_zero_doppler_time = buf12; + + is.read((char*)&(data._attach_flag),1); + + is.read(buf12,12); + data._last_zero_doppler_time = buf12; + + is.read(buf12,12); + data._work_order_id = buf12; + + is.read((char*)&(data._time_diff),4); + data.SwitchEndian(data._time_diff); + + is.read(buf3,3); + data._swath_num = buf3; + + is.read((char*)&(data._range_spacing),4); + data.SwitchEndian(data._range_spacing); + + is.read((char*)&(data._azimut_spacing),4); + data.SwitchEndian(data._azimut_spacing); + + is.read((char*)&(data._line_time_interval),4); + data.SwitchEndian(data._line_time_interval); + + is.read((char*)&(data._num_output_lines),4); + data.SwitchEndian(data._num_output_lines); + + is.read((char*)&(data._num_samples_per_line),4); + data.SwitchEndian(data._num_samples_per_line); + + is.read(buf5,5); + data._data_type = buf5; + + is.read((char*)&(data._num_range_lines_per_burst),4); + data.SwitchEndian(data._num_range_lines_per_burst); + + is.read((char*)&(data._time_diff_zero_doppler),4); + data.SwitchEndian(data._time_diff_zero_doppler); + + is.read(buf64,43); + + is.read((char*)&(data._data_analysis_flag),1); + + is.read((char*)&(data._ant_elev_coor_flag),1); + + is.read((char*)&(data._chirp_extract_flag),1); + + is.read((char*)&(data._srgr_flag),1); + + is.read((char*)&(data._dop_cen_flag),1); + + is.read((char*)&(data._dop_amb_flag),1); + + is.read((char*)&(data._range_spread_comp_flag),1); + + is.read((char*)&(data._detected_flag),1); + + is.read((char*)&(data._look_sum_flag),1); + + is.read((char*)&(data._rms_equal_flag),1); + + is.read((char*)&(data._ant_scal_flag),1); + + is.read((char*)&(data._vga_com_echo_flag),1); + + is.read((char*)&(data._vga_com_cal_flag),1); + + is.read((char*)&(data._vga_com_nom_time_flag),1); + + is.read((char*)&(data._gm_rng_comp_inv_filter_flag),1); + + is.read(buf6,6); + + char buf184[185]; + buf184[184] = '\0'; + is.read(buf184,184); + data._raw_data_analysis = buf184; + + is.read(buf32,32); + + is.read(buf20,20); + data._start_time_mds1 = buf20; + + is.read(buf20,20); + data._start_time_mds2 = buf20; + + char buf120[121]; + buf120[120] = '\0'; + is.read(buf120,120); + data._parameter_code = buf120; + + is.read(buf64,60); + + is.read(buf64,40); + buf64[40] = '\0'; + data._errors_counters = buf64; + + is.read(buf32,26); + + is.read(buf64,60); + buf64[60] = '\0'; + data._image_parameters1 = buf64; + + for (int i = 0; i<5; i++) + { + is.read((char*)&(data._prf_values[i]),4); + data.SwitchEndian(data._prf_values[i]); + } + + char buf190[191]; + buf190[190] = '\0'; + is.read(buf190,190); + data._image_parameters2 = buf190; + + is.read(buf64,62); + + is.read((char*)&(data._first_proc_range_samp),4); + data.SwitchEndian(data._first_proc_range_samp); + + is.read((char*)&(data._range_ref),4); + data.SwitchEndian(data._range_ref); + + is.read((char*)&(data._range_samp_rate),4); + data.SwitchEndian(data._range_samp_rate); + + is.read((char*)&(data._radar_freq),4); + data.SwitchEndian(data._radar_freq); + + is.read((char*)&(data._num_looks_range),2); + data.SwitchEndian(data._num_looks_range); + + is.read(buf7,7); + data._filter_range = buf7; + + is.read((char*)&(data._filter_coef_range),4); + data.SwitchEndian(data._filter_coef_range); + + is.read(buf64,40); + buf64[40] = '\0'; + data._bandwidth = buf64; + + char buf160[161]; + buf160[160] = '\0'; + is.read(buf160,160); + data._nominal_chirp = buf160; + + is.read(buf64,60); + + is.read((char*)&(data._num_lines_proc),4); + data.SwitchEndian(data._num_lines_proc); + + is.read((char*)&(data._num_look_az),2); + data.SwitchEndian(data._num_look_az); + + is.read((char*)&(data._look_bw_az),4); + data.SwitchEndian(data._look_bw_az); + + is.read((char*)&(data._to_bw_az),4); + data.SwitchEndian(data._to_bw_az); + + is.read(buf7,7); + data._filter_az = buf7; + + is.read((char*)&(data._filter_coef_az),4); + data.SwitchEndian(data._filter_coef_az); + + for (int i = 0; i <3; i++) { + is.read((char*)&(data._az_fm_rate[i]),4); + data.SwitchEndian(data._az_fm_rate[i]); + } + + is.read((char*)&(data._ax_fm_origin),4); + data.SwitchEndian(data._ax_fm_origin); + + is.read((char*)&(data._dop_amb_coef),4); + data.SwitchEndian(data._dop_amb_coef); + + char buf128[129]; + buf128[128] = '\0'; + is.read(buf128,68); + + is.read(buf16,16); + data._calibration_factors = buf16; + + is.read(buf64,40); + buf64[40]='\0'; + data._noise_estimation = buf64; + + is.read(buf64,64); + + is.read(buf12,12); + + is.read(buf32,32); + data._output_statistics = buf32; + + is.read((char*)&(data._avg_scene_height_ellpsoid),4); + data.SwitchEndian(data._avg_scene_height_ellpsoid); + + is.read(buf64,48); + + is.read(buf4,4); + data._echo_comp = buf4; + + is.read(buf3,3); + data._echo_comp_ratio = buf3; + + is.read(buf4,4); + data._init_cal_comp = buf4; + + is.read(buf3,3); + data._init_cal_ratio = buf3; + + is.read(buf4,4); + data._per_cal_comp = buf4; + + is.read(buf3,3); + data._per_cal_ratio = buf3; + + is.read(buf4,4); + data._noise_comp = buf4; + + is.read(buf3,3); + data._noise_comp_ratio = buf3; + + is.read(buf64,64); + + for (int i=0;i<4;i++) + { + is.read((char*)&(data._beam_overlap[i]),4); + data.SwitchEndian(data._beam_overlap[i]); + } + for (int i=0;i<4;i++) + { + is.read((char*)&(data._beam_param[i]),4); + data.SwitchEndian(data._beam_param[i]); + } + for (int i=0;i<5;i++) + { + is.read((char*)&(data._lines_per_burst[i]),4); + data.SwitchEndian(data._lines_per_burst[i]); + } + + is.read(buf12,12); + data._time_first_SS1_echo = buf12; + + is.read(buf16,16); + + is.read((char*)&(data._state_vector_time_1_day),4); + data.SwitchEndian(data._state_vector_time_1_day); + + is.read((char*)&(data._state_vector_time_1_sec),4); + data.SwitchEndian(data._state_vector_time_1_sec); + + is.read((char*)&(data._state_vector_time_1_microsec),4); + data.SwitchEndian(data._state_vector_time_1_microsec); + + is.read((char*)&(data._x_pos_1),4); + data.SwitchEndian(data._x_pos_1); + + is.read((char*)&(data._y_pos_1),4); + data.SwitchEndian(data._y_pos_1); + + is.read((char*)&(data._z_pos_1),4); + data.SwitchEndian(data._z_pos_1); + + is.read((char*)&(data._x_vel_1),4); + data.SwitchEndian(data._x_vel_1); + + is.read((char*)&(data._y_vel_1),4); + data.SwitchEndian(data._y_vel_1); + + is.read((char*)&(data._z_vel_1),4); + data.SwitchEndian(data._z_vel_1); + + is.read((char*)&(data._state_vector_time_2_day),4); + data.SwitchEndian(data._state_vector_time_2_day); + + is.read((char*)&(data._state_vector_time_2_sec),4); + data.SwitchEndian(data._state_vector_time_2_sec); + + is.read((char*)&(data._state_vector_time_2_microsec),4); + data.SwitchEndian(data._state_vector_time_2_microsec); + + is.read((char*)&(data._x_pos_2),4); + data.SwitchEndian(data._x_pos_2); + + is.read((char*)&(data._y_pos_2),4); + data.SwitchEndian(data._y_pos_2); + + is.read((char*)&(data._z_pos_2),4); + data.SwitchEndian(data._z_pos_2); + + is.read((char*)&(data._x_vel_2),4); + data.SwitchEndian(data._x_vel_2); + + is.read((char*)&(data._y_vel_2),4); + data.SwitchEndian(data._y_vel_2); + + is.read((char*)&(data._z_vel_2),4); + data.SwitchEndian(data._z_vel_2); + + is.read((char*)&(data._state_vector_time_3_day),4); + data.SwitchEndian(data._state_vector_time_3_day); + + is.read((char*)&(data._state_vector_time_3_sec),4); + data.SwitchEndian(data._state_vector_time_3_sec); + + is.read((char*)&(data._state_vector_time_3_microsec),4); + data.SwitchEndian(data._state_vector_time_3_microsec); + + is.read((char*)&(data._x_pos_3),4); + data.SwitchEndian(data._x_pos_3); + + is.read((char*)&(data._y_pos_3),4); + data.SwitchEndian(data._y_pos_3); + + is.read((char*)&(data._z_pos_3),4); + data.SwitchEndian(data._z_pos_3); + + is.read((char*)&(data._x_vel_3),4); + data.SwitchEndian(data._x_vel_3); + + is.read((char*)&(data._y_vel_3),4); + data.SwitchEndian(data._y_vel_3); + + is.read((char*)&(data._z_vel_3),4); + data.SwitchEndian(data._z_vel_3); + + is.read((char*)&(data._state_vector_time_4_day),4); + data.SwitchEndian(data._state_vector_time_4_day); + + is.read((char*)&(data._state_vector_time_4_sec),4); + data.SwitchEndian(data._state_vector_time_4_sec); + + is.read((char*)&(data._state_vector_time_4_microsec),4); + data.SwitchEndian(data._state_vector_time_4_microsec); + + is.read((char*)&(data._x_pos_4),4); + data.SwitchEndian(data._x_pos_4); + + is.read((char*)&(data._y_pos_4),4); + data.SwitchEndian(data._y_pos_4); + + is.read((char*)&(data._z_pos_4),4); + data.SwitchEndian(data._z_pos_4); + + is.read((char*)&(data._x_vel_4),4); + data.SwitchEndian(data._x_vel_4); + + is.read((char*)&(data._y_vel_4),4); + data.SwitchEndian(data._y_vel_4); + + is.read((char*)&(data._z_vel_4),4); + data.SwitchEndian(data._z_vel_4); + + is.read((char*)&(data._state_vector_time_5_day),4); + data.SwitchEndian(data._state_vector_time_5_day); + + is.read((char*)&(data._state_vector_time_5_sec),4); + data.SwitchEndian(data._state_vector_time_5_sec); + + is.read((char*)&(data._state_vector_time_5_microsec),4); + data.SwitchEndian(data._state_vector_time_5_microsec); + + is.read((char*)&(data._x_pos_5),4); + data.SwitchEndian(data._x_pos_5); + + is.read((char*)&(data._y_pos_5),4); + data.SwitchEndian(data._y_pos_5); + + is.read((char*)&(data._z_pos_5),4); + data.SwitchEndian(data._z_pos_5); + + is.read((char*)&(data._x_vel_5),4); + data.SwitchEndian(data._x_vel_5); + + is.read((char*)&(data._y_vel_5),4); + data.SwitchEndian(data._y_vel_5); + + is.read((char*)&(data._z_vel_5),4); + data.SwitchEndian(data._z_vel_5); + + is.read(buf64,64); + +return is; + +} + +MainProcessingParameters::MainProcessingParameters(const MainProcessingParameters& rhs): + EnvisatAsarRecord(rhs), + _first_zero_doppler_time(rhs._first_zero_doppler_time), + _attach_flag(rhs._attach_flag), + _last_zero_doppler_time(rhs._last_zero_doppler_time), + _work_order_id(rhs._work_order_id), + _time_diff(rhs._time_diff), + _swath_num(rhs._swath_num), + _range_spacing(rhs._range_spacing), + _azimut_spacing(rhs._azimut_spacing), + _line_time_interval(rhs._line_time_interval), + _num_output_lines(rhs._num_output_lines), + _num_samples_per_line(rhs._num_samples_per_line), + _data_type(rhs._data_type), + _num_range_lines_per_burst(rhs._num_range_lines_per_burst), + _time_diff_zero_doppler(rhs._time_diff_zero_doppler), + _data_analysis_flag(rhs._data_analysis_flag), + _ant_elev_coor_flag(rhs._ant_elev_coor_flag), + _chirp_extract_flag(rhs._chirp_extract_flag), + _srgr_flag(rhs._srgr_flag), + _dop_cen_flag(rhs._dop_cen_flag), + _dop_amb_flag(rhs._dop_amb_flag), + _range_spread_comp_flag(rhs._range_spread_comp_flag), + _detected_flag(rhs._detected_flag), + _look_sum_flag(rhs._look_sum_flag), + _rms_equal_flag(rhs._rms_equal_flag), + _ant_scal_flag(rhs._ant_scal_flag), + _vga_com_echo_flag(rhs._vga_com_echo_flag), + _vga_com_cal_flag(rhs._vga_com_cal_flag), + _vga_com_nom_time_flag(rhs._vga_com_nom_time_flag), + _gm_rng_comp_inv_filter_flag(rhs._gm_rng_comp_inv_filter_flag), + _raw_data_analysis(rhs._raw_data_analysis), + _start_time_mds1(rhs._start_time_mds1), + _start_time_mds2(rhs._start_time_mds2), + _parameter_code(rhs._parameter_code), + _errors_counters(rhs._errors_counters), + _image_parameters1(rhs._image_parameters1), + _image_parameters2(rhs._image_parameters2), + _first_proc_range_samp(rhs._first_proc_range_samp), + _range_ref(rhs._range_ref), + _range_samp_rate(rhs._range_samp_rate), + _radar_freq(rhs._radar_freq), + _num_looks_range(rhs._num_looks_range), + _filter_range(rhs._filter_range), + _filter_coef_range(rhs._filter_coef_range), + _bandwidth(rhs._bandwidth), + _nominal_chirp(rhs._nominal_chirp), + _num_lines_proc(rhs._num_lines_proc), + _num_look_az(rhs._num_look_az), + _look_bw_az(rhs._look_bw_az), + _to_bw_az(rhs._to_bw_az), + _filter_az(rhs._filter_az), + _filter_coef_az(rhs._filter_coef_az), + _ax_fm_origin(rhs._ax_fm_origin), + _dop_amb_coef(rhs._dop_amb_coef), + _calibration_factors(rhs._calibration_factors), + _noise_estimation(rhs._noise_estimation), + _output_statistics(rhs._output_statistics), + _avg_scene_height_ellpsoid(rhs._avg_scene_height_ellpsoid), + _echo_comp(rhs._echo_comp), + _echo_comp_ratio(rhs._echo_comp_ratio), + _init_cal_comp(rhs._init_cal_comp), + _init_cal_ratio(rhs._init_cal_ratio), + _per_cal_comp(rhs._per_cal_comp), + _per_cal_ratio(rhs._per_cal_ratio), + _noise_comp(rhs._noise_comp), + _noise_comp_ratio(rhs._noise_comp_ratio), + _time_first_SS1_echo(rhs._time_first_SS1_echo), + _state_vector_time_1_day(rhs._state_vector_time_1_day), + _state_vector_time_1_sec(rhs._state_vector_time_1_sec), + _state_vector_time_1_microsec(rhs._state_vector_time_1_microsec), + _x_pos_1(rhs._x_pos_1), + _y_pos_1(rhs._y_pos_1), + _z_pos_1(rhs._z_pos_1), + _x_vel_1(rhs._x_vel_1), + _y_vel_1(rhs._y_vel_1), + _z_vel_1(rhs._z_vel_1), + _state_vector_time_2_day(rhs._state_vector_time_2_day), + _state_vector_time_2_sec(rhs._state_vector_time_2_sec), + _state_vector_time_2_microsec(rhs._state_vector_time_2_microsec), + _x_pos_2(rhs._x_pos_2), + _y_pos_2(rhs._y_pos_2), + _z_pos_2(rhs._z_pos_2), + _x_vel_2(rhs._x_vel_2), + _y_vel_2(rhs._y_vel_2), + _z_vel_2(rhs._z_vel_2), + _state_vector_time_3_day(rhs._state_vector_time_3_day), + _state_vector_time_3_sec(rhs._state_vector_time_3_sec), + _state_vector_time_3_microsec(rhs._state_vector_time_3_microsec), + _x_pos_3(rhs._x_pos_3), + _y_pos_3(rhs._y_pos_3), + _z_pos_3(rhs._z_pos_3), + _x_vel_3(rhs._x_vel_3), + _y_vel_3(rhs._y_vel_3), + _z_vel_3(rhs._z_vel_3), + _state_vector_time_4_day(rhs._state_vector_time_4_day), + _state_vector_time_4_sec(rhs._state_vector_time_4_sec), + _state_vector_time_4_microsec(rhs._state_vector_time_4_microsec), + _x_pos_4(rhs._x_pos_4), + _y_pos_4(rhs._y_pos_4), + _z_pos_4(rhs._z_pos_4), + _x_vel_4(rhs._x_vel_4), + _y_vel_4(rhs._y_vel_4), + _z_vel_4(rhs._z_vel_4), + _state_vector_time_5_day(rhs._state_vector_time_5_day), + _state_vector_time_5_sec(rhs._state_vector_time_5_sec), + _state_vector_time_5_microsec(rhs._state_vector_time_5_microsec), + _x_pos_5(rhs._x_pos_5), + _y_pos_5(rhs._y_pos_5), + _z_pos_5(rhs._z_pos_5), + _x_vel_5(rhs._x_vel_5), + _y_vel_5(rhs._y_vel_5), + _z_vel_5(rhs._z_vel_5) +{ + _az_fm_rate[0] = rhs._az_fm_rate[0]; + _az_fm_rate[1] = rhs._az_fm_rate[1]; + _az_fm_rate[2] = rhs._az_fm_rate[2]; + + _prf_values[0] = rhs._prf_values[0]; + _prf_values[1] = rhs._prf_values[1]; + _prf_values[2] = rhs._prf_values[2]; + _prf_values[3] = rhs._prf_values[3]; + _prf_values[4] = rhs._prf_values[4]; + + _beam_overlap[0]= rhs._beam_overlap[0]; + _beam_overlap[1]= rhs._beam_overlap[1]; + _beam_overlap[2]= rhs._beam_overlap[2]; + _beam_overlap[3]= rhs._beam_overlap[3]; + + _beam_param[0]= rhs._beam_param[0]; + _beam_param[1]= rhs._beam_param[1]; + _beam_param[2]= rhs._beam_param[2]; + _beam_param[3]= rhs._beam_param[3]; + + _lines_per_burst[0] =rhs._lines_per_burst[0]; + _lines_per_burst[1] =rhs._lines_per_burst[1]; + _lines_per_burst[2] =rhs._lines_per_burst[2]; + _lines_per_burst[3] =rhs._lines_per_burst[3]; + _lines_per_burst[4] =rhs._lines_per_burst[4]; +} + + +MainProcessingParameters& MainProcessingParameters::operator=(const MainProcessingParameters& rhs) +{ + _first_zero_doppler_time = rhs._first_zero_doppler_time; + _attach_flag = rhs._attach_flag; + _last_zero_doppler_time = rhs._last_zero_doppler_time; + _work_order_id = rhs._work_order_id; + _time_diff = rhs._time_diff; + _swath_num = rhs._swath_num; + _range_spacing = rhs._range_spacing; + _azimut_spacing = rhs._azimut_spacing; + _line_time_interval = rhs._line_time_interval; + _num_output_lines = rhs._num_output_lines; + _num_samples_per_line = rhs._num_samples_per_line; + _data_type = rhs._data_type; + _num_range_lines_per_burst = rhs._num_range_lines_per_burst; + _time_diff_zero_doppler = rhs._time_diff_zero_doppler; + _data_analysis_flag = rhs._data_analysis_flag; + _ant_elev_coor_flag = rhs._ant_elev_coor_flag; + _chirp_extract_flag = rhs._chirp_extract_flag; + _srgr_flag = rhs._srgr_flag; + _dop_cen_flag = rhs._dop_cen_flag; + _dop_amb_flag = rhs._dop_amb_flag; + _range_spread_comp_flag = rhs._range_spread_comp_flag; + _detected_flag = rhs._detected_flag; + _look_sum_flag = rhs._look_sum_flag; + _rms_equal_flag = rhs._rms_equal_flag; + _ant_scal_flag = rhs._ant_scal_flag; + _vga_com_echo_flag = rhs._vga_com_echo_flag; + _vga_com_cal_flag = rhs._vga_com_cal_flag; + _vga_com_nom_time_flag = rhs._vga_com_nom_time_flag; + _gm_rng_comp_inv_filter_flag = rhs._gm_rng_comp_inv_filter_flag; + _raw_data_analysis = rhs._raw_data_analysis; + _start_time_mds1 = rhs._start_time_mds1; + _start_time_mds2 = rhs._start_time_mds2; + _parameter_code = rhs._parameter_code; + _errors_counters = rhs._errors_counters; + _image_parameters1 = rhs._image_parameters1; + _image_parameters2 = rhs._image_parameters2; + _first_proc_range_samp = rhs._first_proc_range_samp; + _range_ref = rhs._range_ref; + _range_samp_rate = rhs._range_samp_rate; + _radar_freq = rhs._radar_freq; + _num_looks_range = rhs._num_looks_range; + _filter_range = rhs._filter_range; + _filter_coef_range = rhs._filter_coef_range; + _bandwidth = rhs._bandwidth; + _nominal_chirp = rhs._nominal_chirp; + _num_lines_proc = rhs._num_lines_proc; + _num_look_az = rhs._num_look_az; + _look_bw_az = rhs._look_bw_az; + _to_bw_az = rhs._to_bw_az; + _filter_az = rhs._filter_az; + _filter_coef_az = rhs._filter_coef_az; + _ax_fm_origin = rhs._ax_fm_origin; + _dop_amb_coef = rhs._dop_amb_coef; + _calibration_factors = rhs._calibration_factors; + _noise_estimation = rhs._noise_estimation; + _output_statistics = rhs._output_statistics; + _avg_scene_height_ellpsoid = rhs._avg_scene_height_ellpsoid; + _echo_comp = rhs._echo_comp; + _echo_comp_ratio = rhs._echo_comp_ratio; + _init_cal_comp = rhs._init_cal_comp; + _init_cal_ratio = rhs._init_cal_ratio; + _per_cal_comp = rhs._per_cal_comp; + _per_cal_ratio = rhs._per_cal_ratio; + _noise_comp = rhs._noise_comp; + _noise_comp_ratio = rhs._noise_comp_ratio; + _time_first_SS1_echo = rhs._time_first_SS1_echo; + _state_vector_time_1_day = rhs._state_vector_time_1_day; + _state_vector_time_1_sec = rhs._state_vector_time_1_sec; + _state_vector_time_1_microsec = rhs._state_vector_time_1_microsec; + _x_pos_1 = rhs._x_pos_1; + _y_pos_1 = rhs._y_pos_1; + _z_pos_1 = rhs._z_pos_1; + _x_vel_1 = rhs._x_vel_1; + _y_vel_1 = rhs._y_vel_1; + _z_vel_1 = rhs._z_vel_1; + _state_vector_time_2_day = rhs._state_vector_time_2_day; + _state_vector_time_2_sec = rhs._state_vector_time_2_sec; + _state_vector_time_2_microsec = rhs._state_vector_time_2_microsec; + _x_pos_2 = rhs._x_pos_2; + _y_pos_2 = rhs._y_pos_2; + _z_pos_2 = rhs._z_pos_2; + _x_vel_2 = rhs._x_vel_2; + _y_vel_2 = rhs._y_vel_2; + _z_vel_2 = rhs._z_vel_2; + _state_vector_time_3_day = rhs._state_vector_time_3_day; + _state_vector_time_3_sec = rhs._state_vector_time_3_sec; + _state_vector_time_3_microsec = rhs._state_vector_time_3_microsec; + _x_pos_3 = rhs._x_pos_3; + _y_pos_3 = rhs._y_pos_3; + _z_pos_3 = rhs._z_pos_3; + _x_vel_3 = rhs._x_vel_3; + _y_vel_3 = rhs._y_vel_3; + _z_vel_3 = rhs._z_vel_3; + _state_vector_time_4_day = rhs._state_vector_time_4_day; + _state_vector_time_4_sec = rhs._state_vector_time_4_sec; + _state_vector_time_4_microsec = rhs._state_vector_time_4_microsec; + _x_pos_4 = rhs._x_pos_4; + _y_pos_4 = rhs._y_pos_4; + _z_pos_4 = rhs._z_pos_4; + _x_vel_4 = rhs._x_vel_4; + _y_vel_4 = rhs._y_vel_4; + _z_vel_4 = rhs._z_vel_4; + _state_vector_time_5_day = rhs._state_vector_time_5_day; + _state_vector_time_5_sec = rhs._state_vector_time_5_sec; + _state_vector_time_5_microsec = rhs._state_vector_time_5_microsec; + _x_pos_5 = rhs._x_pos_5; + _y_pos_5 = rhs._y_pos_5; + _z_pos_5 = rhs._z_pos_5; + _x_vel_5 = rhs._x_vel_5; + _y_vel_5 = rhs._y_vel_5; + _z_vel_5 = rhs._z_vel_5; + + _az_fm_rate[0] = rhs._az_fm_rate[0]; + _az_fm_rate[1] = rhs._az_fm_rate[1]; + _az_fm_rate[2] = rhs._az_fm_rate[2]; + + _prf_values[0] = rhs._prf_values[0]; + _prf_values[1] = rhs._prf_values[1]; + _prf_values[2] = rhs._prf_values[2]; + _prf_values[3] = rhs._prf_values[3]; + _prf_values[4] = rhs._prf_values[4]; + + _beam_overlap[0]= rhs._beam_overlap[0]; + _beam_overlap[1]= rhs._beam_overlap[1]; + _beam_overlap[2]= rhs._beam_overlap[2]; + _beam_overlap[3]= rhs._beam_overlap[3]; + + _beam_param[0]= rhs._beam_param[0]; + _beam_param[1]= rhs._beam_param[1]; + _beam_param[2]= rhs._beam_param[2]; + _beam_param[3]= rhs._beam_param[3]; + + _lines_per_burst[0] =rhs._lines_per_burst[0]; + _lines_per_burst[1] =rhs._lines_per_burst[1]; + _lines_per_burst[2] =rhs._lines_per_burst[2]; + _lines_per_burst[3] =rhs._lines_per_burst[3]; + _lines_per_burst[4] =rhs._lines_per_burst[4]; + + return *this; +} + +} diff --git a/Utilities/otbossimplugins/ossim/EnvisatAsar/MainProcessingParameters.h b/Utilities/otbossimplugins/ossim/EnvisatAsar/MainProcessingParameters.h new file mode 100644 index 0000000000000000000000000000000000000000..c2f713fb41fd89d343b2801a86eab24083efd4ea --- /dev/null +++ b/Utilities/otbossimplugins/ossim/EnvisatAsar/MainProcessingParameters.h @@ -0,0 +1,1383 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#ifndef MainProcessingParameters_h +#define MainProcessingParameters_h + +#include <iostream> +#include <sstream> +#include <EnvisatAsar/EnvisatAsarRecord.h> + +namespace ossimplugins +{ +/** + * @ingroup MainProcessingParametersRecord + * @brief This class is able to read the ASAR MainProcessingParameters record + */ +class MainProcessingParameters : public EnvisatAsarRecord +{ +public: + /** + * @brief Constructor + */ + MainProcessingParameters(); + + /** + * @brief Destructor + */ + ~MainProcessingParameters(); + + /** + * @brief This function writes the MainProcessingParameters in a stream + */ + friend std::ostream& operator<<(std::ostream& os, const MainProcessingParameters& data); + + /** + * @brief This function reads a MainProcessingParameters from a stream + */ + friend std::istream& operator>>(std::istream& is, MainProcessingParameters& data); + + /** + * @brief Copy constructor + */ + MainProcessingParameters(const MainProcessingParameters& rhs); + + /** + * @brief Copy operator + */ + MainProcessingParameters& operator=(const MainProcessingParameters& rhs); + + /** + * @brief This function is able to create a new instance of the class + */ + EnvisatAsarRecord* Instanciate() + { + return new MainProcessingParameters(); + }; + + /** + * @brief This function is able to create a new instance of the class initialised with the data of the calling instance + */ + EnvisatAsarRecord* Clone() + { + return new MainProcessingParameters(*this); + }; + + /** + * @brief Reads the class data from a stream + */ + void Read(std::istream& is) + { + is>>*this; + }; + + /** + * @brief Writes the class to a stream + */ + void Write(std::ostream& os) + { + os<<*this; + }; + + + /** + * @brief first_zero_doppler_time + */ + std::string get_first_zero_doppler_time() + { + return _first_zero_doppler_time; + }; + /** + * @brief attach_flag + */ + bool get_attach_flag() + { + return _attach_flag; + }; + /** + * @brief last_zero_doppler_time + */ + std::string get_last_zero_doppler_time() + { + return _last_zero_doppler_time; + }; + /** + * @brief work_order_id + */ + std::string get_work_order_id() + { + return _work_order_id; + }; + /** + * @brief time_diff + */ + float get_time_diff() + { + return _time_diff; + }; + /** + * @brief swath_num + */ + std::string get_swath_num() + { + return _swath_num; + }; + /** + * @brief range_spacing + */ + float get_range_spacing() + { + return _range_spacing; + }; + /** + * @brief azimut_spacing + */ + float get_azimut_spacing() + { + return _azimut_spacing; + }; + /** + * @brief line_time_interval + */ + float get_line_time_interval() + { + return _line_time_interval; + }; + /** + * @brief num_output_lines + */ + unsigned int get_num_output_lines() + { + return _num_output_lines; + }; + /** + * @brief num_samples_per_line + */ + unsigned int get_num_samples_per_line() + { + return _num_samples_per_line; + }; + /** + * @brief data_type + */ + std::string get_data_type() + { + return _data_type; + }; + /** + * @brief num_range_lines_per_burst + */ + unsigned int get_num_range_lines_per_burst() + { + return _num_range_lines_per_burst; + }; + /** + * @brief time_diff_zero_doppler + */ + float get_time_diff_zero_doppler() + { + return _time_diff_zero_doppler; + }; + /** + * @brief data_analysis_flag + */ + bool get_data_analysis_flag() + { + return _data_analysis_flag; + }; + /** + * @brief ant_elev_coor_flag + */ + bool get_ant_elev_coor_flag() + { + return _ant_elev_coor_flag; + }; + /** + * @brief chirp_extract_flag + */ + bool get_chirp_extract_flag() + { + return _chirp_extract_flag; + }; + /** + * @brief srgr_flag + */ + bool get_srgr_flag() + { + return _srgr_flag; + }; + /** + * @brief dop_cen_flag + */ + bool get_dop_cen_flag() + { + return _dop_cen_flag; + }; + /** + * @brief dop_amb_flag + */ + bool get_dop_amb_flag() + { + return _dop_amb_flag; + }; + /** + * @brief range_spread_comp_flag + */ + bool get_range_spread_comp_flag() + { + return _range_spread_comp_flag; + }; + /** + * @brief detected_flag + */ + bool get_detected_flag() + { + return _detected_flag; + }; + /** + * @brief look_sum_flag + */ + bool get_look_sum_flag() + { + return _look_sum_flag; + }; + /** + * @brief rms_equal_flag + */ + bool get_rms_equal_flag() + { + return _rms_equal_flag; + }; + /** + * @brief ant_scal_flag + */ + bool get_ant_scal_flag() + { + return _ant_scal_flag; + }; + /** + * @brief vga_com_echo_flag + */ + bool get_vga_com_echo_flag() + { + return _vga_com_echo_flag; + }; + /** + * @brief vga_com_cal_flag + */ + bool get_vga_com_cal_flag() + { + return _vga_com_cal_flag; + }; + /** + * @brief vga_com_nom_time_flag + */ + bool get_vga_com_nom_time_flag() + { + return _vga_com_nom_time_flag; + }; + /** + * @brief gm_rng_comp_inv_filter_flag + */ + bool get_gm_rng_comp_inv_filter_flag() + { + return _gm_rng_comp_inv_filter_flag; + }; + /** + * @brief raw_data_analysis + */ + std::string get_raw_data_analysis() + { + return _raw_data_analysis; + }; + /** + * @brief start_time_mds1 + */ + std::string get_start_time_mds1() + { + return _start_time_mds1; + }; + /** + * @brief start_time_mds2 + */ + std::string get_start_time_mds2() + { + return _start_time_mds2; + }; + /** + * @brief parameter_code + */ + std::string get_parameter_code() + { + return _parameter_code; + }; + /** + * @brief errors_counters + */ + std::string get_errors_counters() + { + return _errors_counters; + }; + /** + * @brief image_parameters block1 + */ + std::string get_image_parameters1() + { + return _image_parameters1; + }; + /** + * @brief prf_values[5] + */ + float* get_prf_values() + { + return _prf_values; + }; + /** + * @brief prf (i.e prf_values[0]) + */ + float get_prf() + { + return _prf_values[0]; + }; + /** + * @brief image_parameters block2 + */ + std::string get_image_parameters2() + { + return _image_parameters2; + }; + /** + * @brief first_proc_range_samp + */ + unsigned int get_first_proc_range_samp() + { + return _first_proc_range_samp; + }; + /** + * @brief range_ref + */ + float get_range_ref() + { + return _range_ref; + }; + /** + * @brief range_samp_rate + */ + float get_range_samp_rate() + { + return _range_samp_rate; + }; + /** + * @brief radar_freq + */ + float get_radar_freq() + { + return _radar_freq; + }; + /** + * @brief num_looks_range + */ + unsigned short get_num_looks_range() + { + return _num_looks_range; + }; + /** + * @brief filter_range + */ + std::string get_filter_range() + { + return _filter_range; + }; + /** + * @brief filter_coef_range + */ + float get_filter_coef_range() + { + return _filter_coef_range; + }; + /** + * @brief bandwidth + */ + std::string get_bandwidth() + { + return _bandwidth; + }; + /** + * @brief nominal_chirp + */ + std::string get_nominal_chirp() + { + return _nominal_chirp; + }; + /** + * @brief num_lines_proc + */ + unsigned int get_num_lines_proc() + { + return _num_lines_proc; + }; + /** + * @brief num_look_az + */ + unsigned short get_num_look_az() + { + return _num_look_az; + }; + /** + * @brief look_bw_az + */ + float get_look_bw_az() + { + return _look_bw_az; + }; + /** + * @brief to_bw_az + */ + float get_to_bw_az() + { + return _to_bw_az; + }; + /** + * @brief filter_az + */ + std::string get_filter_az() + { + return _filter_az; + }; + /** + * @brief filter_coef_az + */ + float get_filter_coef_az() + { + return _filter_coef_az; + }; + /** + * @brief az_fm_rate[3] + */ + float* get_az_fm_rate() + { + return _az_fm_rate; + }; + /** + * @brief ax_fm_origin + */ + float get_ax_fm_origin() + { + return _ax_fm_origin; + }; + /** + * @brief dop_amb_coef + */ + float get_dop_amb_coef() + { + return _dop_amb_coef; + }; + /** + * @brief calibration_factors + */ + std::string get_calibration_factors() + { + return _calibration_factors; + }; + /** + * @brief noise_estimation + */ + std::string get_noise_estimation() + { + return _noise_estimation; + }; + /** + * @brief output_statistics + */ + std::string get_output_statistics() + { + return _output_statistics; + }; + /** + * @brief avg_scene_height_ellpsoid + */ + float get_avg_scene_height_ellpsoid() + { + return _avg_scene_height_ellpsoid; + }; + /** + * @brief echo_comp + */ + std::string get_echo_comp() + { + return _echo_comp; + }; + /** + * @brief echo_comp_ratio + */ + std::string get_echo_comp_ratio() + { + return _echo_comp_ratio; + }; + /** + * @brief init_cal_comp + */ + std::string get_init_cal_comp() + { + return _init_cal_comp; + }; + /** + * @brief init_cal_ratio + */ + std::string get_init_cal_ratio() + { + return _init_cal_ratio; + }; + /** + * @brief per_cal_comp + */ + std::string get_per_cal_comp() + { + return _per_cal_comp; + }; + /** + * @brief per_cal_ratio + */ + std::string get_per_cal_ratio() + { + return _per_cal_ratio; + }; + /** + * @brief noise_comp + */ + std::string get_noise_comp() + { + return _noise_comp; + }; + /** + * @brief noise_comp_ratio + */ + std::string get_noise_comp_ratio() + { + return _noise_comp_ratio; + }; + /** + * @brief beam_overlap[4] + */ + unsigned int* get_beam_overlap() + { + return _beam_overlap; + }; + /** + * @brief beam_param[4] + */ + float* get_beam_param() + { + return _beam_param; + }; + /** + * @brief lines_per_burst[5] + */ + unsigned int* get_lines_per_burst() + { + return _lines_per_burst; + }; + /** + * @brief time_first_SS1_echo + */ + std::string get_time_first_SS1_echo() + { + return _time_first_SS1_echo; + }; + /** + * @brief state_vector_time_1 day + */ + int get_state_vector_time_1_day() + { + return _state_vector_time_1_day; + }; + /** + * @brief state_vector_time_1 sec + */ + unsigned int get_state_vector_time_1_sec() + { + return _state_vector_time_1_sec; + }; + /** + * @brief state_vector_time_1 microsec + */ + unsigned int get_state_vector_time_1_microsec() + { + return _state_vector_time_1_microsec; + }; + /** + * @brief x_pos_1 + */ + int get_x_pos_1() + { + return _x_pos_1; + }; + /** + * @brief y_pos_1 + */ + int get_y_pos_1() + { + return _y_pos_1; + }; + /** + * @brief z_pos_1 + */ + int get_z_pos_1() + { + return _z_pos_1; + }; + /** + * @brief x_vel_1 + */ + int get_x_vel_1() + { + return _x_vel_1; + }; + /** + * @brief y_vel_1 + */ + int get_y_vel_1() + { + return _y_vel_1; + }; + /** + * @brief z_vel_1 + */ + int get_z_vel_1() + { + return _z_vel_1; + }; + /** + * @brief state_vector_time_2 day + */ + int get_state_vector_time_2_day() + { + return _state_vector_time_2_day; + }; + /** + * @brief state_vector_time_2 sec + */ + unsigned int get_state_vector_time_2_sec() + { + return _state_vector_time_2_sec; + }; + /** + * @brief state_vector_time_1 microsec + */ + unsigned int get_state_vector_time_2_microsec() + { + return _state_vector_time_2_microsec; + }; + /** + * @brief x_pos_2 + */ + int get_x_pos_2() + { + return _x_pos_2; + }; + /** + * @brief y_pos_2 + */ + int get_y_pos_2() + { + return _y_pos_2; + }; + /** + * @brief z_pos_2 + */ + int get_z_pos_2() + { + return _z_pos_2; + }; + /** + * @brief x_vel_2 + */ + int get_x_vel_2() + { + return _x_vel_2; + }; + /** + * @brief y_vel_2 + */ + int get_y_vel_2() + { + return _y_vel_2; + }; + /** + * @brief z_vel_2 + */ + int get_z_vel_2() + { + return _z_vel_2; + }; + /** + * @brief state_vector_time_3 day + */ + int get_state_vector_time_3_day() + { + return _state_vector_time_3_day; + }; + /** + * @brief state_vector_time_3 sec + */ + unsigned int get_state_vector_time_3_sec() + { + return _state_vector_time_3_sec; + }; + /** + * @brief state_vector_time_3 microsec + */ + unsigned int get_state_vector_time_3_microsec() + { + return _state_vector_time_3_microsec; + }; + /** + * @brief x_pos_3 + */ + int get_x_pos_3() + { + return _x_pos_3; + }; + /** + * @brief y_pos_3 + */ + int get_y_pos_3() + { + return _y_pos_3; + }; + /** + * @brief z_pos_3 + */ + int get_z_pos_3() + { + return _z_pos_3; + }; + /** + * @brief x_vel_3 + */ + int get_x_vel_3() + { + return _x_vel_3; + }; + /** + * @brief y_vel_3 + */ + int get_y_vel_3() + { + return _y_vel_3; + }; + /** + * @brief z_vel_3 + */ + int get_z_vel_3() + { + return _z_vel_3; + }; + /** + * @brief state_vector_time_4 day + */ + int get_state_vector_time_4_day() + { + return _state_vector_time_4_day; + }; + /** + * @brief state_vector_time_1 sec + */ + unsigned int get_state_vector_time_4_sec() + { + return _state_vector_time_4_sec; + }; + /** + * @brief state_vector_time_4 microsec + */ + unsigned int get_state_vector_time_4_microsec() + { + return _state_vector_time_4_microsec; + }; + /** + * @brief x_pos_4 + */ + int get_x_pos_4() + { + return _x_pos_4; + }; + /** + * @brief y_pos_4 + */ + int get_y_pos_4() + { + return _y_pos_4; + }; + /** + * @brief z_pos_4 + */ + int get_z_pos_4() + { + return _z_pos_4; + }; + /** + * @brief x_vel_4 + */ + int get_x_vel_4() + { + return _x_vel_4; + }; + /** + * @brief y_vel_4 + */ + int get_y_vel_4() + { + return _y_vel_4; + }; + /** + * @brief z_vel_4 + */ + int get_z_vel_4() + { + return _z_vel_4; + }; + /** + * @brief state_vector_time_5 day + */ + int get_state_vector_time_5_day() + { + return _state_vector_time_5_day; + }; + /** + * @brief state_vector_time_5 sec + */ + unsigned int get_state_vector_time_5_sec() + { + return _state_vector_time_5_sec; + }; + /** + * @brief state_vector_time_5 microsec + */ + unsigned int get_state_vector_time_5_microsec() + { + return _state_vector_time_5_microsec; + }; + /** + * @brief x_pos_5 + */ + int get_x_pos_5() + { + return _x_pos_5; + }; + /** + * @brief y_pos_5 + */ + int get_y_pos_5() + { + return _y_pos_5; + }; + /** + * @brief z_pos_5 + */ + int get_z_pos_5() + { + return _z_pos_5; + }; + /** + * @brief x_vel_5 + */ + int get_x_vel_5() + { + return _x_vel_5; + }; + /** + * @brief y_vel_5 + */ + int get_y_vel_5() + { + return _y_vel_5; + }; + /** + * @brief z_vel_5 + */ + int get_z_vel_5() + { + return _z_vel_5; + }; + + /** + * @brief first_zero_doppler_time + */ + std::string _first_zero_doppler_time; + /** + * @brief attach_flag + */ + bool _attach_flag; + /** + * @brief last_zero_doppler_time + */ + std::string _last_zero_doppler_time; + /** + * @brief work_order_id + */ + std::string _work_order_id; + /** + * @brief time_diff + */ + float _time_diff; + /** + * @brief swath_num + */ + std::string _swath_num; + /** + * @brief range_spacing + */ + float _range_spacing; + /** + * @brief azimut_spacing + */ + float _azimut_spacing; + /** + * @brief line_time_interval + */ + float _line_time_interval; + /** + * @brief num_output_lines + */ + unsigned int _num_output_lines; + /** + * @brief num_samples_per_line + */ + unsigned int _num_samples_per_line; + /** + * @brief data_type + */ + std::string _data_type; + /** + * @brief num_range_lines_per_burst + */ + unsigned int _num_range_lines_per_burst; + /** + * @brief time_diff_zero_doppler + */ + float _time_diff_zero_doppler; + /** + * @brief data_analysis_flag + */ + bool _data_analysis_flag; + /** + * @brief ant_elev_coor_flag + */ + bool _ant_elev_coor_flag; + /** + * @brief chirp_extract_flag + */ + bool _chirp_extract_flag; + /** + * @brief srgr_flag + */ + bool _srgr_flag; + /** + * @brief dop_cen_flag + */ + bool _dop_cen_flag; + /** + * @brief dop_amb_flag + */ + bool _dop_amb_flag; + /** + * @brief range_spread_comp_flag + */ + bool _range_spread_comp_flag; + /** + * @brief detected_flag + */ + bool _detected_flag; + /** + * @brief look_sum_flag + */ + bool _look_sum_flag; + /** + * @brief rms_equal_flag + */ + bool _rms_equal_flag; + /** + * @brief ant_scal_flag + */ + bool _ant_scal_flag; + /** + * @brief vga_com_echo_flag + */ + bool _vga_com_echo_flag; + /** + * @brief vga_com_cal_flag + */ + bool _vga_com_cal_flag; + /** + * @brief vga_com_nom_time_flag + */ + bool _vga_com_nom_time_flag; + /** + * @brief gm_rng_comp_inv_filter_flag + */ + bool _gm_rng_comp_inv_filter_flag; + /** + * @brief raw_data_analysis + */ + std::string _raw_data_analysis; + /** + * @brief start_time_mds1 + */ + std::string _start_time_mds1; + /** + * @brief start_time_mds2 + */ + std::string _start_time_mds2; + /** + * @brief parameter_code + */ + std::string _parameter_code; + /** + * @brief errors_counters + */ + std::string _errors_counters; + /** + * @brief image_parameters block 1 + */ + std::string _image_parameters1; + /** + * @brief PRF + */ + float _prf_values[5]; + /** + * @brief image_parameters block 2 + */ + std::string _image_parameters2; + /** + * @brief first_proc_range_samp + */ + unsigned int _first_proc_range_samp; + /** + * @brief range_ref + */ + float _range_ref; + /** + * @brief range_samp_rate + */ + float _range_samp_rate; + /** + * @brief radar_freq + */ + float _radar_freq; + /** + * @brief num_looks_range + */ + unsigned short _num_looks_range; + /** + * @brief filter_range + */ + std::string _filter_range; + /** + * @brief filter_coef_range + */ + float _filter_coef_range; + /** + * @brief bandwidth + */ + std::string _bandwidth; + /** + * @brief nominal_chirp + */ + std::string _nominal_chirp; + /** + * @brief num_lines_proc + */ + unsigned int _num_lines_proc; + /** + * @brief num_look_az + */ + unsigned short _num_look_az; + /** + * @brief look_bw_az + */ + float _look_bw_az; + /** + * @brief to_bw_az + */ + float _to_bw_az; + /** + * @brief filter_az + */ + std::string _filter_az; + /** + * @brief filter_coef_az + */ + float _filter_coef_az; + /** + * @brief az_fm_rate[3] + */ + float _az_fm_rate[3]; + /** + * @brief ax_fm_origin + */ + float _ax_fm_origin; + /** + * @brief dop_amb_coef + */ + float _dop_amb_coef; + /** + * @brief calibration_factors + */ + std::string _calibration_factors; + /** + * @brief noise_estimation + */ + std::string _noise_estimation; + /** + * @brief output_statistics + */ + std::string _output_statistics; + /** + * @brief avg_scene_height_ellpsoid + */ + float _avg_scene_height_ellpsoid; + /** + * @brief echo_comp + */ + std::string _echo_comp; + /** + * @brief echo_comp_ratio + */ + std::string _echo_comp_ratio; + /** + * @brief init_cal_comp + */ + std::string _init_cal_comp; + /** + * @brief init_cal_ratio + */ + std::string _init_cal_ratio; + /** + * @brief per_cal_comp + */ + std::string _per_cal_comp; + /** + * @brief per_cal_ratio + */ + std::string _per_cal_ratio; + /** + * @brief noise_comp + */ + std::string _noise_comp; + /** + * @brief noise_comp_ratio + */ + std::string _noise_comp_ratio; + /** + * @brief beam_overlap[4] + */ + unsigned int _beam_overlap[4]; + /** + * @brief beam_overlap[4] + */ + float _beam_param[4]; + /** + * @brief lines_per_burst[5] + */ + unsigned int _lines_per_burst[5]; + /** + * @brief time_first_SS1_echo + */ + std::string _time_first_SS1_echo; + /** + * @brief state_vector_time_1_day + */ + int _state_vector_time_1_day; + /** + * @brief state_vector_time_1_sec + */ + unsigned int _state_vector_time_1_sec; + /** + * @brief state_vector_time_1_microsec + */ + unsigned int _state_vector_time_1_microsec; + /** + * @brief x_pos_1 + */ + int _x_pos_1; + /** + * @brief y_pos_1 + */ + int _y_pos_1; + /** + * @brief z_pos_1 + */ + int _z_pos_1; + /** + * @brief x_vel_1 + */ + int _x_vel_1; + /** + * @brief y_vel_1 + */ + int _y_vel_1; + /** + * @brief z_vel_1 + */ + int _z_vel_1; + /** + * @brief state_vector_time_2_day + */ + int _state_vector_time_2_day; + /** + * @brief state_vector_time_2_sec + */ + unsigned int _state_vector_time_2_sec; + /** + * @brief state_vector_time_2_microsec + */ + unsigned int _state_vector_time_2_microsec; + /** + * @brief x_pos_2 + */ + int _x_pos_2; + /** + * @brief y_pos_2 + */ + int _y_pos_2; + /** + * @brief z_pos_2 + */ + int _z_pos_2; + /** + * @brief x_vel_2 + */ + int _x_vel_2; + /** + * @brief y_vel_2 + */ + int _y_vel_2; + /** + * @brief z_vel_2 + */ + int _z_vel_2; + /** + * @brief state_vector_time_3_day + */ + int _state_vector_time_3_day; + /** + * @brief state_vector_time_3_sec + */ + unsigned int _state_vector_time_3_sec; + /** + * @brief state_vector_time_3_microsec + */ + unsigned int _state_vector_time_3_microsec; + /** + * @brief x_pos_3 + */ + int _x_pos_3; + /** + * @brief y_pos_3 + */ + int _y_pos_3; + /** + * @brief z_pos_3 + */ + int _z_pos_3; + /** + * @brief x_vel_3 + */ + int _x_vel_3; + /** + * @brief y_vel_3 + */ + int _y_vel_3; + /** + * @brief z_vel_3 + */ + int _z_vel_3; + /** + * @brief state_vector_time_4_day + */ + int _state_vector_time_4_day; + /** + * @brief state_vector_time_4_sec + */ + unsigned int _state_vector_time_4_sec; + /** + * @brief state_vector_time_4_microsec + */ + unsigned int _state_vector_time_4_microsec; + /** + * @brief x_pos_4 + */ + int _x_pos_4; + /** + * @brief y_pos_4 + */ + int _y_pos_4; + /** + * @brief z_pos_4 + */ + int _z_pos_4; + /** + * @brief x_vel_4 + */ + int _x_vel_4; + /** + * @brief y_vel_4 + */ + int _y_vel_4; + /** + * @brief z_vel_4 + */ + int _z_vel_4; + /** + * @brief state_vector_time_5_day + */ + int _state_vector_time_5_day; + /** + * @brief state_vector_time_5_sec + */ + unsigned int _state_vector_time_5_sec; + /** + * @brief state_vector_time_5_microsec + */ + unsigned int _state_vector_time_5_microsec; + /** + * @brief x_pos_5 + */ + int _x_pos_5; + /** + * @brief y_pos_5 + */ + int _y_pos_5; + /** + * @brief z_pos_5 + */ + int _z_pos_5; + /** + * @brief x_vel_5 + */ + int _x_vel_5; + /** + * @brief y_vel_5 + */ + int _y_vel_5; + /** + * @brief z_vel_5 + */ + int _z_vel_5; + + +private: + +}; +} +#endif + + diff --git a/Utilities/otbossimplugins/ossim/EnvisatAsar/SQ_ADSR.cpp b/Utilities/otbossimplugins/ossim/EnvisatAsar/SQ_ADSR.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0c0add21e140630d84b99bf3735dee116f034714 --- /dev/null +++ b/Utilities/otbossimplugins/ossim/EnvisatAsar/SQ_ADSR.cpp @@ -0,0 +1,364 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#include <EnvisatAsar/SQ_ADSR.h> + +namespace ossimplugins +{ +SQ_ADSR::SQ_ADSR() : EnvisatAsarRecord("sq_adsr_rec") +{ +} + +SQ_ADSR::~SQ_ADSR() +{ +} + + + +std::ostream& operator<<(std::ostream& os, const SQ_ADSR& data) +{ + os<<"zero_doppler_time:"<<data._zero_doppler_time.c_str()<<std::endl; + + os<<"attach_flag:"<<data._attach_flag<<std::endl; + + os<<"input_mean_flag:"<<data._input_mean_flag<<std::endl; + + os<<"input_std_dev_flag:"<<data._input_std_dev_flag<<std::endl; + + os<<"input_gaps_flag:"<<data._input_gaps_flag<<std::endl; + + os<<"input_missing_lines_flag:"<<data._input_missing_lines_flag<<std::endl; + + os<<"dop_cen_flag:"<<data._dop_cen_flag<<std::endl; + + os<<"dop_amb_flag:"<<data._dop_amb_flag<<std::endl; + + os<<"output_mean_flag:"<<data._output_mean_flag<<std::endl; + + os<<"output_std_dev_flag:"<<data._output_std_dev_flag<<std::endl; + + os<<"chirp_flag:"<<data._chirp_flag<<std::endl; + + os<<"missing_data_set_flag:"<<data._missing_data_set_flag<<std::endl; + + os<<"invalid_downlink_flag:"<<data._invalid_downlink_flag<<std::endl; + + os<<"thres_chirp_broadening:"<<data._thres_chirp_broadening<<std::endl; + + os<<"thresh_chirp_sidelobe:"<<data._thresh_chirp_sidelobe<<std::endl; + + os<<"thresh_chirp_islr:"<<data._thresh_chirp_islr<<std::endl; + + os<<"thresh_input_mean:"<<data._thresh_input_mean<<std::endl; + + os<<"exp_input_mean:"<<data._exp_input_mean<<std::endl; + + os<<"thresh_input_std_dev:"<<data._thresh_input_std_dev<<std::endl; + + os<<"exp_input_std_dev:"<<data._exp_input_std_dev<<std::endl; + + os<<"thresh_dop_cen:"<<data._thresh_dop_cen<<std::endl; + + os<<"thresh_dop_amb:"<<data._thresh_dop_amb<<std::endl; + + os<<"thresh_output_mean:"<<data._thresh_output_mean<<std::endl; + + os<<"exp_output_mean:"<<data._exp_output_mean<<std::endl; + + os<<"thresh_output_std_dev:"<<data._thresh_output_std_dev<<std::endl; + + os<<"exp_output_std_dev:"<<data._exp_output_std_dev<<std::endl; + + os<<"thresh_input_missing_lines:"<<data._thresh_input_missing_lines<<std::endl; + + os<<"thresh_input_gaps:"<<data._thresh_input_gaps<<std::endl; + + os<<"lines_per_gaps:"<<data._lines_per_gaps<<std::endl; + + os<<"input_mean[0]:"<<data._input_mean[0]<<std::endl; + os<<"input_mean[1]:"<<data._input_mean[1]<<std::endl; + + os<<"input_std_dev[0]:"<<data._input_std_dev[0]<<std::endl; + os<<"input_std_dev[1]:"<<data._input_std_dev[1]<<std::endl; + + os<<"num_gaps:"<<data._num_gaps<<std::endl; + + os<<"num_missing_lines:"<<data._num_missing_lines<<std::endl; + + os<<"output_mean[0]:"<<data._output_mean[0]<<std::endl; + os<<"output_mean[1]:"<<data._output_mean[1]<<std::endl; + + os<<"output_std_dev[0]:"<<data._output_std_dev[0]<<std::endl; + os<<"output_std_dev[1]:"<<data._output_std_dev[1]<<std::endl; + + os<<"tot_errors:"<<data._tot_errors<<std::endl; + + return os; + +} + +std::istream& operator>>(std::istream& is, SQ_ADSR& data) +{ + char buf64[65]; + buf64[64] = '\0'; + char buf32[33]; + buf32[32] = '\0'; + char buf27[28]; + buf27[27] = '\0'; + char buf20[21]; + buf20[20] = '\0'; + char buf16[17]; + buf16[16]='\0'; + char buf15[16]; + buf15[15] = '\0'; + char buf14[15]; + buf14[14] = '\0'; + char buf13[14]; + buf13[13] = '\0'; + char buf12[13]; + buf12[12] = '\0'; + char buf11[12]; + buf11[11] = '\0'; + char buf10[11]; + buf10[10] = '\0'; + char buf9[10]; + buf9[9] = '\0'; + char buf8[9]; + buf8[8] = '\0'; + char buf7[8]; + buf7[7] = '\0'; + char buf6[7]; + buf6[6] = '\0'; + char buf5[6]; + buf5[5] = '\0'; + char buf4[5]; + buf4[4] = '\0'; + char buf3[4]; + buf3[3] = '\0'; + char buf2[3]; + buf2[2] = '\0'; + char buf1[1]; + + is.read(buf12,12); + data._zero_doppler_time = buf12; + + is.read((char*)&(data._attach_flag),1); + + is.read((char*)&(data._input_mean_flag),1); + + is.read((char*)&(data._input_std_dev_flag),1); + + is.read((char*)&(data._input_gaps_flag),1); + + is.read((char*)&(data._input_missing_lines_flag),1); + + is.read((char*)&(data._dop_cen_flag),1); + + is.read((char*)&(data._dop_amb_flag),1); + + is.read((char*)&(data._output_mean_flag),1); + + is.read((char*)&(data._output_std_dev_flag),1); + + is.read((char*)&(data._chirp_flag),1); + + is.read((char*)&(data._missing_data_set_flag),1); + + is.read((char*)&(data._invalid_downlink_flag),1); + + is.read(buf7,7); + + is.read((char*)&(data._thres_chirp_broadening),4); + data.SwitchEndian(data._thres_chirp_broadening); + + is.read((char*)&(data._thresh_chirp_sidelobe),4); + data.SwitchEndian(data._thresh_chirp_sidelobe); + + is.read((char*)&(data._thresh_chirp_islr),4); + data.SwitchEndian(data._thresh_chirp_islr); + + is.read((char*)&(data._thresh_input_mean),4); + data.SwitchEndian(data._thresh_input_mean); + + is.read((char*)&(data._exp_input_mean),4); + data.SwitchEndian(data._exp_input_mean); + + is.read((char*)&(data._thresh_input_std_dev),4); + data.SwitchEndian(data._thresh_input_std_dev); + + is.read((char*)&(data._exp_input_std_dev),4); + data.SwitchEndian(data._exp_input_std_dev); + + is.read((char*)&(data._thresh_dop_cen),4); + data.SwitchEndian(data._thresh_dop_cen); + + is.read((char*)&(data._thresh_dop_amb),4); + data.SwitchEndian(data._thresh_dop_amb); + + is.read((char*)&(data._thresh_output_mean),4); + data.SwitchEndian(data._thresh_output_mean); + + is.read((char*)&(data._exp_output_mean),4); + data.SwitchEndian(data._exp_output_mean); + + is.read((char*)&(data._thresh_output_std_dev),4); + data.SwitchEndian(data._thresh_output_std_dev); + + is.read((char*)&(data._exp_output_std_dev),4); + data.SwitchEndian(data._exp_output_std_dev); + + is.read((char*)&(data._thresh_input_missing_lines),4); + data.SwitchEndian(data._thresh_input_missing_lines); + + is.read((char*)&(data._thresh_input_gaps),4); + data.SwitchEndian(data._thresh_input_gaps); + + is.read((char*)&(data._lines_per_gaps),4); + data.SwitchEndian(data._lines_per_gaps); + + is.read(buf15,15); + + is.read((char*)&(data._input_mean[0]),4); + data.SwitchEndian(data._input_mean[0]); + + is.read((char*)&(data._input_mean[1]),4); + data.SwitchEndian(data._input_mean[1]); + + is.read((char*)&(data._input_std_dev[0]),4); + data.SwitchEndian(data._input_std_dev[0]); + is.read((char*)&(data._input_std_dev[1]),4); + data.SwitchEndian(data._input_std_dev[1]); + + is.read((char*)&(data._num_gaps),4); + data.SwitchEndian(data._num_gaps); + + is.read((char*)&(data._num_missing_lines),4); + data.SwitchEndian(data._num_missing_lines); + + is.read((char*)&(data._output_mean[0]),4); + data.SwitchEndian(data._output_mean[0]); + is.read((char*)&(data._output_mean[1]),4); + data.SwitchEndian(data._output_mean[1]); + + is.read((char*)&(data._output_std_dev[0]),4); + data.SwitchEndian(data._output_std_dev[0]); + + is.read((char*)&(data._output_std_dev[1]),4); + data.SwitchEndian(data._output_std_dev[1]); + + is.read((char*)&(data._tot_errors),4); + data.SwitchEndian(data._tot_errors); + + is.read(buf16,16); + + return is; + +} + +SQ_ADSR::SQ_ADSR(const SQ_ADSR& rhs): + EnvisatAsarRecord(rhs), + _zero_doppler_time(rhs._zero_doppler_time), + _attach_flag(rhs._attach_flag), + _input_mean_flag(rhs._input_mean_flag), + _input_std_dev_flag(rhs._input_std_dev_flag), + _input_gaps_flag(rhs._input_gaps_flag), + _input_missing_lines_flag(rhs._input_missing_lines_flag), + _dop_cen_flag(rhs._dop_cen_flag), + _dop_amb_flag(rhs._dop_amb_flag), + _output_mean_flag(rhs._output_mean_flag), + _output_std_dev_flag(rhs._output_std_dev_flag), + _chirp_flag(rhs._chirp_flag), + _missing_data_set_flag(rhs._missing_data_set_flag), + _invalid_downlink_flag(rhs._invalid_downlink_flag), + _thres_chirp_broadening(rhs._thres_chirp_broadening), + _thresh_chirp_sidelobe(rhs._thresh_chirp_sidelobe), + _thresh_chirp_islr(rhs._thresh_chirp_islr), + _thresh_input_mean(rhs._thresh_input_mean), + _exp_input_mean(rhs._exp_input_mean), + _thresh_input_std_dev(rhs._thresh_input_std_dev), + _exp_input_std_dev(rhs._exp_input_std_dev), + _thresh_dop_cen(rhs._thresh_dop_cen), + _thresh_dop_amb(rhs._thresh_dop_amb), + _thresh_output_mean(rhs._thresh_output_mean), + _exp_output_mean(rhs._exp_output_mean), + _thresh_output_std_dev(rhs._thresh_output_std_dev), + _exp_output_std_dev(rhs._exp_output_std_dev), + _thresh_input_missing_lines(rhs._thresh_input_missing_lines), + _thresh_input_gaps(rhs._thresh_input_gaps), + _lines_per_gaps(rhs._lines_per_gaps), + _num_gaps(rhs._num_gaps), + _num_missing_lines(rhs._num_missing_lines), + _tot_errors(rhs._tot_errors) +{ + _input_mean[0] = rhs._input_mean[0]; + _input_mean[1] = rhs._input_mean[1]; + + _input_std_dev[0] = rhs._input_std_dev[0]; + _input_std_dev[1] = rhs._input_std_dev[1]; + + _output_mean[0] = rhs._output_mean[0]; + _output_mean[1] = rhs._output_mean[1]; + + _output_std_dev[0] = rhs._output_std_dev[0]; + _output_std_dev[1] = rhs._output_std_dev[1]; + +} + +SQ_ADSR& SQ_ADSR::operator=(const SQ_ADSR& rhs) +{ + _zero_doppler_time = rhs._zero_doppler_time; + _attach_flag = rhs._attach_flag; + _input_mean_flag = rhs._input_mean_flag; + _input_std_dev_flag = rhs._input_std_dev_flag; + _input_gaps_flag = rhs._input_gaps_flag; + _input_missing_lines_flag = rhs._input_missing_lines_flag; + _dop_cen_flag = rhs._dop_cen_flag; + _dop_amb_flag = rhs._dop_amb_flag; + _output_mean_flag = rhs._output_mean_flag; + _output_std_dev_flag = rhs._output_std_dev_flag; + _chirp_flag = rhs._chirp_flag; + _missing_data_set_flag = rhs._missing_data_set_flag; + _invalid_downlink_flag = rhs._invalid_downlink_flag; + _thres_chirp_broadening = rhs._thres_chirp_broadening; + _thresh_chirp_sidelobe = rhs._thresh_chirp_sidelobe; + _thresh_chirp_islr = rhs._thresh_chirp_islr; + _thresh_input_mean = rhs._thresh_input_mean; + _exp_input_mean = rhs._exp_input_mean; + _thresh_input_std_dev = rhs._thresh_input_std_dev; + _exp_input_std_dev = rhs._exp_input_std_dev; + _thresh_dop_cen = rhs._thresh_dop_cen; + _thresh_dop_amb = rhs._thresh_dop_amb; + _thresh_output_mean = rhs._thresh_output_mean; + _exp_output_mean = rhs._exp_output_mean; + _thresh_output_std_dev = rhs._thresh_output_std_dev; + _exp_output_std_dev = rhs._exp_output_std_dev; + _thresh_input_missing_lines = rhs._thresh_input_missing_lines; + _thresh_input_gaps = rhs._thresh_input_gaps; + _lines_per_gaps = rhs._lines_per_gaps; + _num_gaps = rhs._num_gaps; + _num_missing_lines = rhs._num_missing_lines; + _tot_errors = rhs._tot_errors; + + _input_mean[0] = rhs._input_mean[0]; + _input_mean[1] = rhs._input_mean[1]; + + _input_std_dev[0] = rhs._input_std_dev[0]; + _input_std_dev[1] = rhs._input_std_dev[1]; + + _output_mean[0] = rhs._output_mean[0]; + _output_mean[1] = rhs._output_mean[1]; + + _output_std_dev[0] = rhs._output_std_dev[0]; + _output_std_dev[1] = rhs._output_std_dev[1]; + + return *this; +} +} diff --git a/Utilities/otbossimplugins/ossim/EnvisatAsar/SQ_ADSR.h b/Utilities/otbossimplugins/ossim/EnvisatAsar/SQ_ADSR.h new file mode 100644 index 0000000000000000000000000000000000000000..a71c295d8a72654dbb131ede934771fdf61690f1 --- /dev/null +++ b/Utilities/otbossimplugins/ossim/EnvisatAsar/SQ_ADSR.h @@ -0,0 +1,496 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#ifndef SQ_ADSR_h +#define SQ_ADSR_h + +#include <iostream> +#include <EnvisatAsar/EnvisatAsarRecord.h> + +namespace ossimplugins +{ +/** + * @ingroup SQ_ADSRRecord + * @brief This class is able to read the ASAR SQ_ADSR record + */ +class SQ_ADSR : public EnvisatAsarRecord +{ +public: + /** + * @brief Constructor + */ + SQ_ADSR(); + + /** + * @brief Destructor + */ + ~SQ_ADSR(); + + /** + * @brief This function write the SQ_ADSR in a stream + */ + friend std::ostream& operator<<(std::ostream& os, const SQ_ADSR& data); + + /** + * @brief This function read a SQ_ADSR from a stream + */ + friend std::istream& operator>>(std::istream& is, SQ_ADSR& data); + + /** + * @brief Copy constructor + */ + SQ_ADSR(const SQ_ADSR& rhs); + + /** + * @brief Copy operator + */ + SQ_ADSR& operator=(const SQ_ADSR& rhs); + + /** + * @brief This function is able to create a new instance of the class + */ + EnvisatAsarRecord* Instanciate() + { + return new SQ_ADSR(); + }; + + /** + * @brief This function is able to create a new instance of the class initialised with the data of the calling instance + */ + EnvisatAsarRecord* Clone() + { + return new SQ_ADSR(*this); + }; + + /** + * @brief Reads the class data from a stream + */ + void Read(std::istream& is) + { + is>>*this; + }; + + /** + * @brief Writes the class to a stream + */ + void Write(std::ostream& os) + { + os<<*this; + }; + + + /** + * @brief zero_doppler_time + */ + std::string get_zero_doppler_time() + { + return _zero_doppler_time; + }; + /** + * @brief attach_flag + */ + bool get_attach_flag() + { + return _attach_flag; + }; + /** + * @brief input_mean_flag + */ + bool get_input_mean_flag() + { + return _input_mean_flag; + }; + /** + * @brief input_std_dev_flag + */ + bool get_input_std_dev_flag() + { + return _input_std_dev_flag; + }; + /** + * @brief input_gaps_flag + */ + bool get_input_gaps_flag() + { + return _input_gaps_flag; + }; + /** + * @brief input_missing_lines_flag + */ + bool get_input_missing_lines_flag() + { + return _input_missing_lines_flag; + }; + /** + * @brief dop_cen_flag + */ + bool get_dop_cen_flag() + { + return _dop_cen_flag; + }; + /** + * @brief dop_amb_flag + */ + bool get_dop_amb_flag() + { + return _dop_amb_flag; + }; + /** + * @brief output_mean_flag + */ + bool get_output_mean_flag() + { + return _output_mean_flag; + }; + /** + * @brief output_std_dev_flag + */ + bool get_output_std_dev_flag() + { + return _output_std_dev_flag; + }; + /** + * @brief chirp_flag + */ + bool get_chirp_flag() + { + return _chirp_flag; + }; + /** + * @brief missing_data_set_flag + */ + bool get_missing_data_set_flag() + { + return _missing_data_set_flag; + }; + /** + * @brief invalid_downlink_flag + */ + bool get_invalid_downlink_flag() + { + return _invalid_downlink_flag; + }; + /** + * @brief thres_chirp_broadening + */ + float get_thres_chirp_broadening() + { + return _thres_chirp_broadening; + }; + /** + * @brief thresh_chirp_sidelobe + */ + float get_thresh_chirp_sidelobe() + { + return _thresh_chirp_sidelobe; + }; + /** + * @brief thresh_chirp_islr + */ + float get_thresh_chirp_islr() + { + return _thresh_chirp_islr; + }; + /** + * @brief thresh_input_mean + */ + float get_thresh_input_mean() + { + return _thresh_input_mean; + }; + /** + * @brief exp_input_mean + */ + float get_exp_input_mean() + { + return _exp_input_mean; + }; + /** + * @brief thresh_input_std_dev + */ + float get_thresh_input_std_dev() + { + return _thresh_input_std_dev; + }; + /** + * @brief exp_input_std_dev + */ + float get_exp_input_std_dev() + { + return _exp_input_std_dev; + }; + /** + * @brief thresh_dop_cen + */ + float get_thresh_dop_cen() + { + return _thresh_dop_cen; + }; + /** + * @brief thresh_dop_amb + */ + float get_thresh_dop_amb() + { + return _thresh_dop_amb; + }; + /** + * @brief thresh_output_mean + */ + float get_thresh_output_mean() + { + return _thresh_output_mean; + }; + /** + * @brief exp_output_mean + */ + float get_exp_output_mean() + { + return _exp_output_mean; + }; + /** + * @brief thresh_output_std_dev + */ + float get_thresh_output_std_dev() + { + return _thresh_output_std_dev; + }; + /** + * @brief exp_output_std_dev + */ + float get_exp_output_std_dev() + { + return _exp_output_std_dev; + }; + /** + * @brief thresh_input_missing_lines + */ + float get_thresh_input_missing_lines() + { + return _thresh_input_missing_lines; + }; + /** + * @brief thresh_input_gaps + */ + float get_thresh_input_gaps() + { + return _thresh_input_gaps; + }; + /** + * @brief lines_per_gaps + */ + unsigned int get_lines_per_gaps() + { + return _lines_per_gaps; + }; + /** + * @brief input_mean[2] + */ + float* get_input_mean() + { + return _input_mean; + }; + /** + * @brief input_std_dev[2] + */ + float* get_input_std_dev() + { + return _input_std_dev; + }; + /** + * @brief num_gaps + */ + float get_num_gaps() + { + return _num_gaps; + }; + /** + * @brief num_missing_lines + */ + float get_num_missing_lines() + { + return _num_missing_lines; + }; + /** + * @brief output_mean[2] + */ + float* get_output_mean() + { + return _output_mean; + }; + /** + * @brief output_std_dev[2] + */ + float* get_output_std_dev() + { + return _output_std_dev; + }; + /** + * @brief tot_errors + */ + unsigned int get_tot_errors() + { + return _tot_errors; + }; + + + /** + * @brief zero_doppler_time + */ + std::string _zero_doppler_time; + /** + * @brief attach_flag + */ + bool _attach_flag; + /** + * @brief input_mean_flag + */ + bool _input_mean_flag; + /** + * @brief input_std_dev_flag + */ + bool _input_std_dev_flag; + /** + * @brief input_gaps_flag + */ + bool _input_gaps_flag; + /** + * @brief input_missing_lines_flag + */ + bool _input_missing_lines_flag; + /** + * @brief dop_cen_flag + */ + bool _dop_cen_flag; + /** + * @brief dop_amb_flag + */ + bool _dop_amb_flag; + /** + * @brief output_mean_flag + */ + bool _output_mean_flag; + /** + * @brief output_std_dev_flag + */ + bool _output_std_dev_flag; + /** + * @brief chirp_flag + */ + bool _chirp_flag; + /** + * @brief missing_data_set_flag + */ + bool _missing_data_set_flag; + /** + * @brief invalid_downlink_flag + */ + bool _invalid_downlink_flag; + /** + * @brief thres_chirp_broadening + */ + float _thres_chirp_broadening; + /** + * @brief thresh_chirp_sidelobe + */ + float _thresh_chirp_sidelobe; + /** + * @brief thresh_chirp_islr + */ + float _thresh_chirp_islr; + /** + * @brief thresh_input_mean + */ + float _thresh_input_mean; + /** + * @brief exp_input_mean + */ + float _exp_input_mean; + /** + * @brief thresh_input_std_dev + */ + float _thresh_input_std_dev; + /** + * @brief exp_input_std_dev + */ + float _exp_input_std_dev; + /** + * @brief thresh_dop_cen + */ + float _thresh_dop_cen; + /** + * @brief thresh_dop_amb + */ + float _thresh_dop_amb; + /** + * @brief thresh_output_mean + */ + float _thresh_output_mean; + /** + * @brief exp_output_mean + */ + float _exp_output_mean; + /** + * @brief thresh_output_std_dev + */ + float _thresh_output_std_dev; + /** + * @brief exp_output_std_dev + */ + float _exp_output_std_dev; + /** + * @brief thresh_input_missing_lines + */ + float _thresh_input_missing_lines; + /** + * @brief thresh_input_gaps + */ + float _thresh_input_gaps; + /** + * @brief lines_per_gaps + */ + unsigned int _lines_per_gaps; + /** + * @brief input_mean[2] + */ + float _input_mean[2]; + /** + * @brief input_std_dev[2] + */ + float _input_std_dev[2]; + /** + * @brief num_gaps + */ + float _num_gaps; + /** + * @brief num_missing_lines + */ + float _num_missing_lines; + /** + * @brief output_mean[2] + */ + float _output_mean[2]; + /** + * @brief output_std_dev[2] + */ + float _output_std_dev[2]; + /** + * @brief tot_errors + */ + unsigned int _tot_errors; + + +private: + +}; +} +#endif + + diff --git a/Utilities/otbossimplugins/ossim/EnvisatAsar/SRGRConversionParameters.cpp b/Utilities/otbossimplugins/ossim/EnvisatAsar/SRGRConversionParameters.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e64065c742998670c2732cc007e37bd84a24b54a --- /dev/null +++ b/Utilities/otbossimplugins/ossim/EnvisatAsar/SRGRConversionParameters.cpp @@ -0,0 +1,110 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ +#include <EnvisatAsar/SRGRConversionParameters.h> + +namespace ossimplugins +{ + +SRGRConversionParameters::SRGRConversionParameters() : EnvisatAsarRecord("SRGRConversionParameters_rec") +{ +} + +SRGRConversionParameters::~SRGRConversionParameters() +{ +} + +std::ostream& operator<<(std::ostream& os, const SRGRConversionParameters& data) +{ + os<<"first_zero_doppler_time_day:"<<data._first_zero_doppler_time_day<<std::endl; + + os<<"first_zero_doppler_time_sec:"<<data._first_zero_doppler_time_sec<<std::endl; + + os<<"first_zero_doppler_time_microsec:"<<data._first_zero_doppler_time_microsec<<std::endl; + + os<<"attach_flag:"<<data._attach_flag<<std::endl; + + os<<"_slant_range_time:"<<data._slant_range_time<<std::endl; + + os<<"_ground_range_origin:"<<data._ground_range_origin<<std::endl; + + for (int i = 0; i<5; i++) { + os<<"_srgr_coef[i]:"<<data._srgr_coef[i]<<std::endl; + } + + return os; + +} + +std::istream& operator>>(std::istream& is, SRGRConversionParameters& data) +{ + char buf14[15]; + buf14[14] = '\0'; + char buf12[13]; + buf12[12] = '\0'; + + + is.read((char*)&(data._first_zero_doppler_time_day),4); + data.SwitchEndian(data._first_zero_doppler_time_day); + + is.read((char*)&(data._first_zero_doppler_time_sec),4); + data.SwitchEndian(data._first_zero_doppler_time_sec); + + is.read((char*)&(data._first_zero_doppler_time_microsec),4); + data.SwitchEndian(data._first_zero_doppler_time_microsec); + + is.read((char*)&(data._attach_flag),1); + + is.read((char*)&(data._slant_range_time),4); + data.SwitchEndian(data._slant_range_time); + + is.read((char*)&(data._ground_range_origin),4); + data.SwitchEndian(data._ground_range_origin); + + for (int i = 0; i<5; i++) { + is.read((char*)&(data._srgr_coef[i]),4); + data.SwitchEndian(data._srgr_coef[i]); + } + + is.read(buf14,14); + + return is; +} + + +SRGRConversionParameters::SRGRConversionParameters(const SRGRConversionParameters& rhs): + EnvisatAsarRecord(rhs), + _first_zero_doppler_time_day(rhs._first_zero_doppler_time_day), + _first_zero_doppler_time_sec(rhs._first_zero_doppler_time_sec), + _first_zero_doppler_time_microsec(rhs._first_zero_doppler_time_microsec), + _attach_flag(rhs._attach_flag), + _slant_range_time(rhs._slant_range_time), + _ground_range_origin(rhs._ground_range_origin) +{ + for (int i = 0; i<5; i++) { + _srgr_coef[i] = rhs._srgr_coef[i]; + } +} + +SRGRConversionParameters& SRGRConversionParameters::operator=(const SRGRConversionParameters& rhs) +{ + _first_zero_doppler_time_day = rhs._first_zero_doppler_time_day; + _first_zero_doppler_time_sec = rhs._first_zero_doppler_time_sec; + _first_zero_doppler_time_microsec = rhs._first_zero_doppler_time_microsec; + _attach_flag = rhs._attach_flag; + _slant_range_time = rhs._slant_range_time; + + for (int i = 0; i<5; i++) { + _srgr_coef[i] = rhs._srgr_coef[i]; + } + + return *this; +} +} diff --git a/Utilities/otbossimplugins/ossim/EnvisatAsar/SRGRConversionParameters.h b/Utilities/otbossimplugins/ossim/EnvisatAsar/SRGRConversionParameters.h new file mode 100644 index 0000000000000000000000000000000000000000..beccd5f51783966a598be28db7da14c898c58128 --- /dev/null +++ b/Utilities/otbossimplugins/ossim/EnvisatAsar/SRGRConversionParameters.h @@ -0,0 +1,177 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#ifndef SRGRConversionParameters_h +#define SRGRConversionParameters_h + +#include <iostream> +#include <EnvisatAsar/EnvisatAsarRecord.h> + +namespace ossimplugins +{ + +/** + * @ingroup SRGRConversionParametersRecord + * @brief This class is able to read the ASAR SRGRConversionParameters record + */ +class SRGRConversionParameters : public EnvisatAsarRecord +{ +public: + /** + * @brief Constructor + */ + SRGRConversionParameters(); + + /** + * @brief Destructor + */ + ~SRGRConversionParameters(); + + /** + * @brief This function writes the SRGRConversionParameters in a stream + */ + friend std::ostream& operator<<(std::ostream& os, const SRGRConversionParameters& data); + + /** + * @brief This function reads a SRGRConversionParameters from a stream + */ + friend std::istream& operator>>(std::istream& is, SRGRConversionParameters& data); + + /** + * @brief Copy constructor + */ + SRGRConversionParameters(const SRGRConversionParameters& rhs); + + /** + * @brief Copy operator + */ + SRGRConversionParameters& operator=(const SRGRConversionParameters& rhs); + + /** + * @brief This function is able to create a new instance of the class + */ + EnvisatAsarRecord* Instanciate() + { + return new SRGRConversionParameters(); + }; + + /** + * @brief This function is able to create a new instance of the class initialised with the data of the calling instance + */ + EnvisatAsarRecord* Clone() + { + return new SRGRConversionParameters(*this); + }; + + /** + * @brief Reads the class data from a stream + */ + void Read(std::istream& is) + { + is>>*this; + }; + + /** + * @brief Writes the class to a stream + */ + void Write(std::ostream& os) + { + os<<*this; + }; + + + /** + * @brief first_zero_doppler_time day + */ + int get_first_zero_doppler_time_day() + { + return _first_zero_doppler_time_day; + }; + /** + * @brief first_zero_doppler_time second + */ + unsigned int get_first_zero_doppler_time_sec() + { + return _first_zero_doppler_time_sec; + }; + /** + * @brief first_zero_doppler_time micro sec + */ + unsigned int get_first_zero_doppler_time_microsec() + { + return _first_zero_doppler_time_microsec; + }; + /** + * @brief attach_flag + */ + bool get_attach_flag() + { + return _attach_flag; + }; + /** + * @brief input_mean_flag + */ + float get_slant_range_time() + { + return _slant_range_time; + }; + /** + * @brief input_std_dev_flag + */ + float get_ground_range_origin() + { + return _ground_range_origin; + }; + /** + * @brief input_gaps_flag + */ + float* get_srgr_coef() + { + return _srgr_coef; + }; + + /** + * @brief first_zero_doppler_time day + */ + int _first_zero_doppler_time_day; + /** + * @brief first_zero_doppler_time sec + */ + unsigned int _first_zero_doppler_time_sec; + /** + * @brief first_zero_doppler_time microsec + */ + unsigned int _first_zero_doppler_time_microsec; + /** + * @brief attach_flag + */ + bool _attach_flag; + /** + * @brief input_mean_flag + */ + float _slant_range_time; + /** + * @brief input_std_dev_flag + */ + float _ground_range_origin; + /** + * @brief input_gaps_flag + */ + float _srgr_coef[5]; + + +private: + +}; +} +#endif + + diff --git a/Utilities/otbossimplugins/ossim/EnvisatAsar/dsd.cpp b/Utilities/otbossimplugins/ossim/EnvisatAsar/dsd.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0926eb808661596cce592625935c9dc5aaea191e --- /dev/null +++ b/Utilities/otbossimplugins/ossim/EnvisatAsar/dsd.cpp @@ -0,0 +1,157 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#include <EnvisatAsar/dsd.h> + +namespace ossimplugins +{ +dsd::dsd() : EnvisatAsarRecord("dsd_rec") +{ +} + +dsd::~dsd() +{ +} + +std::ostream& operator<<(std::ostream& os, const dsd& data) +{ + os<<"ds_name:"<<data._ds_name.c_str()<<std::endl; + os<<"ds_type:"<<data._ds_type.c_str()<<std::endl; + os<<"filename:"<<data._filename.c_str()<<std::endl; + os<<"ds_offset:"<<data._ds_offset<<std::endl; + os<<"ds_size:"<<data._ds_size<<std::endl; + os<<"num_dsr:"<<data._num_dsr<<std::endl; + os<<"dsr_size:"<<data._dsr_size<<std::endl; + + return os; +} + +std::istream& operator>>(std::istream& is, dsd& data) +{ + char buf64[65]; + buf64[64] = '\0'; + char buf32[33]; + buf32[32] = '\0'; + char buf28[29]; + buf28[28] = '\0'; + char buf27[28]; + buf27[27] = '\0'; + char buf20[21]; + buf20[20] = '\0'; + char buf16[17]; + buf16[16]='\0'; + char buf15[16]; + buf15[15] = '\0'; + char buf14[15]; + buf14[14] = '\0'; + char buf13[14]; + buf13[13] = '\0'; + char buf12[13]; + buf12[12] = '\0'; + char buf11[12]; + buf11[11] = '\0'; + char buf10[11]; + buf10[10] = '\0'; + char buf9[10]; + buf9[9] = '\0'; + char buf8[9]; + buf8[8] = '\0'; + char buf7[8]; + buf7[7] = '\0'; + char buf6[7]; + buf6[6] = '\0'; + char buf5[6]; + buf5[5] = '\0'; + char buf4[5]; + buf4[4] = '\0'; + char buf3[4]; + buf3[3] = '\0'; + char buf2[3]; + buf2[2] = '\0'; + char buf1[1]; + + is.read(buf9,9); + + is.read(buf28,28); + data._ds_name = buf28; + + is.read(buf10,10); + + is.read(buf1,1); + data._ds_type = buf1; + + is.read(buf11,11); + + is.read(buf64,62); + buf64[62] = '\0'; + data._filename = buf64; + + is.read(buf12,12); + + is.read(buf27,21); + buf27[21] = '\0'; + data._ds_offset = atof(buf27); + + is.read(buf16,16); + + is.read(buf27,21); + buf27[21] = '\0'; + data._ds_size = atof(buf27); + + is.read(buf16,16); + + is.read(buf11,11); + data._num_dsr = atol(buf11); + + is.read(buf10,10); + + is.read(buf11,11); + data._dsr_size = atol(buf11); + + is.read(buf64,41); + + return is; + +} + std::string _ds_name; + std::string _ds_type; + std::string _filename; + double _ds_offset; + double _ds_size; + int _num_dsr; + int _dsr_size; + +dsd::dsd(const dsd& rhs): + EnvisatAsarRecord(rhs), + _ds_name(rhs._ds_name), + _ds_type(rhs._ds_type), + _filename(rhs._filename), + _ds_offset(rhs._ds_offset), + _ds_size(rhs._ds_size), + _num_dsr(rhs._num_dsr), + _dsr_size(rhs._dsr_size) + { + } + + +dsd& dsd::operator=(const dsd& rhs) +{ + _ds_name = rhs._ds_name; + _ds_type = rhs._ds_type; + _filename = rhs._filename; + _ds_offset = rhs._ds_offset; + _ds_size = rhs._ds_size; + _num_dsr = rhs._num_dsr; + _dsr_size = rhs._dsr_size; + + return *this; +} +} diff --git a/Utilities/otbossimplugins/ossim/EnvisatAsar/dsd.h b/Utilities/otbossimplugins/ossim/EnvisatAsar/dsd.h new file mode 100644 index 0000000000000000000000000000000000000000..ce7ca9aa15448d1e204ac161dd3946974c261e95 --- /dev/null +++ b/Utilities/otbossimplugins/ossim/EnvisatAsar/dsd.h @@ -0,0 +1,175 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#ifndef dsd_h +#define dsd_h + +#include <iostream> +#include <EnvisatAsar/EnvisatAsarRecord.h> + +namespace ossimplugins +{ +/** + * @ingroup dsdRecord + * @brief This class is able to read the ASAR dsd record + */ +class dsd : public EnvisatAsarRecord +{ +public: + /** + * @brief Constructor + */ + dsd(); + + /** + * @brief Destructor + */ + ~dsd(); + + /** + * @brief This function write the dsd in a stream + */ + friend std::ostream& operator<<(std::ostream& os, const dsd& data); + + /** + * @brief This function read a dsd from a stream + */ + friend std::istream& operator>>(std::istream& is, dsd& data); + + /** + * @brief Copy constructor + */ + dsd(const dsd& rhs); + + /** + * @brief Copy operator + */ + dsd& operator=(const dsd& rhs); + + /** + * @brief This function is able to create a new instance of the class + */ + EnvisatAsarRecord* Instanciate() + { + return new dsd(); + }; + + /** + * @brief This function is able to create a new instance of the class initialised with the data of the calling instance + */ + EnvisatAsarRecord* Clone() + { + return new dsd(*this); + }; + + /** + * @brief Read the class data from a stream + */ + void Read(std::istream& is) + { + is>>*this; + }; + + /** + * @brief Write the class to a stream + */ + void Write(std::ostream& os) + { + os<<*this; + }; + + + /** + * @brief Data set Name + */ + std::string get_ds_name() + { + return _ds_name; + } + /** + * @brief Data set Type + */ + std::string get_ds_type() + { + return _ds_type; + } + /** + * @brief Data set Filename + */ + std::string get_filename() + { + return _filename; + } + /** + * @brief Data set Offset + */ + double get_ds_offset() + { + return _ds_offset; + } + /** + * @brief Data set Size + */ + double get_ds_size() + { + return _ds_size; + } + /** + * @brief Number of data set record + */ + int get_num_dsr() + { + return _num_dsr; + } + /** + * @brief Data set record size + */ + int get_dsr_size() + { + return _dsr_size; + } + + /** + * @brief Data set Name + */ + std::string _ds_name; + /** + * @brief Data set Type + */ + std::string _ds_type; + /** + * @brief Data set Filename + */ + std::string _filename; + /** + * @brief Data set Offset + */ + double _ds_offset; + /** + * @brief Data set Size + */ + double _ds_size; + /** + * @brief Number of data set record + */ + int _num_dsr; + /** + * @brief Data set record size + */ + int _dsr_size; + +private: + +}; +} +#endif + + diff --git a/Utilities/otbossimplugins/ossim/EnvisatAsar/mph.cpp b/Utilities/otbossimplugins/ossim/EnvisatAsar/mph.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3706acdcb3e3778a4583d34faba1da4918b9d6ff --- /dev/null +++ b/Utilities/otbossimplugins/ossim/EnvisatAsar/mph.cpp @@ -0,0 +1,819 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#include <EnvisatAsar/mph.h> + +namespace ossimplugins +{ +mph::mph() : EnvisatAsarRecord("mph_rec") +{ +} + +mph::~mph() +{ +} + +std::ostream& operator<<(std::ostream& os, const mph& data) +{ + os<<"product_name:"<<data._product_name.c_str()<<std::endl; + + os<<"product:"<<data._product.c_str()<<std::endl; + + os<<"proc_stage_title:"<<data._proc_stage_title.c_str()<<std::endl; + + os<<"proc_stage:"<<data._proc_stage.c_str()<<std::endl; + + os<<"ref_doc_title:"<<data._ref_doc_title.c_str()<<std::endl; + + os<<"ref_doc:"<<data._ref_doc.c_str()<<std::endl; + + os<<"acq_stat_id_title:"<<data._acq_stat_id_title.c_str()<<std::endl; + + os<<"acq_station:"<<data._acq_station.c_str()<<std::endl; + + os<<"proc_center_title:"<<data._proc_center_title.c_str()<<std::endl; + + os<<"proc_center:"<<data._proc_center.c_str()<<std::endl; + + os<<"proc_time_title:"<<data._proc_time_title.c_str()<<std::endl; + + os<<"proc_time:"<<data._proc_time.c_str()<<std::endl; + + os<<"soft_version_title:"<<data._soft_version_title.c_str()<<std::endl; + + os<<"soft_version:"<<data._soft_version.c_str()<<std::endl; + + os<<"sensing_start_title:"<<data._sensing_start_title.c_str()<<std::endl; + + os<<"sensing_start:"<<data._sensing_start.c_str()<<std::endl; + + os<<"sensing_stop_title:"<<data._sensing_stop_title.c_str()<<std::endl; + + os<<"sensing_stop:"<<data._sensing_stop.c_str()<<std::endl; + + os<<"phase_title:"<<data._phase_title.c_str()<<std::endl; + + os<<"phase:"<<data._phase.c_str()<<std::endl; + + os<<"cycle_title:"<<data._cycle_title.c_str()<<std::endl; + + os<<"cycle:"<<data._cycle.c_str()<<std::endl; + + os<<"relative_orbit_title:"<<data._relative_orbit_title.c_str()<<std::endl; + + os<<"rel_orbit:"<<data._rel_orbit.c_str()<<std::endl; + + os<<"absolute_orbit_title:"<<data._absolute_orbit_title.c_str()<<std::endl; + + os<<"abs_orbit:"<<data._abs_orbit.c_str()<<std::endl; + + os<<"state_vector_time_title:"<<data._state_vector_time_title.c_str()<<std::endl; + + os<<"state_vector_time:"<<data._state_vector_time.c_str()<<std::endl; + + os<<"delta_ut1_title:"<<data._delta_ut1_title.c_str()<<std::endl; + + os<<"delta_ut1:"<<data._delta_ut1.c_str()<<std::endl; + + os<<"delta_ut1_units:"<<data._delta_ut1_units.c_str()<<std::endl; + + os<<"x_position_title:"<<data._x_position_title.c_str()<<std::endl; + + os<<"x_position:"<<data._x_position.c_str()<<std::endl; + + os<<"x_position_units:"<<data._x_position_units.c_str()<<std::endl; + + os<<"y_position_title:"<<data._y_position_title.c_str()<<std::endl; + + os<<"y_position:"<<data._y_position.c_str()<<std::endl; + + os<<"y_position_units:"<<data._y_position_units.c_str()<<std::endl; + + os<<"z_position_title:"<<data._z_position_title.c_str()<<std::endl; + + os<<"z_position:"<<data._z_position.c_str()<<std::endl; + + os<<"z_position_units:"<<data._z_position_units.c_str()<<std::endl; + + os<<"x_velocity_title:"<<data._x_velocity_title.c_str()<<std::endl; + + os<<"x_velocity:"<<data._x_velocity.c_str()<<std::endl; + + os<<"x_velocity_units:"<<data._x_velocity_units.c_str()<<std::endl; + + os<<"y_velocity_title:"<<data._y_velocity_title.c_str()<<std::endl; + + os<<"y_velocity:"<<data._y_velocity.c_str()<<std::endl; + + os<<"y_velocity_units:"<<data._y_velocity_units.c_str()<<std::endl; + + os<<"z_velocity_title:"<<data._z_velocity_title.c_str()<<std::endl; + + os<<"z_velocity:"<<data._z_velocity.c_str()<<std::endl; + + os<<"z_velocity_units:"<<data._z_velocity_units.c_str()<<std::endl; + + os<<"vector_source_title:"<<data._vector_source_title.c_str()<<std::endl; + + os<<"vector_source:"<<data._vector_source.c_str()<<std::endl; + + os<<"spare_4:"<<data._spare_4.c_str()<<std::endl; + + os<<"utc_sbt_time_title:"<<data._utc_sbt_time_title.c_str()<<std::endl; + + os<<"utc_sbt_time:"<<data._utc_sbt_time.c_str()<<std::endl; + + os<<"sat_binary_time_title:"<<data._sat_binary_time_title.c_str()<<std::endl; + + os<<"sat_binary_time:"<<data._sat_binary_time.c_str()<<std::endl; + + os<<"clock_step_title:"<<data._clock_step_title.c_str()<<std::endl; + + os<<"clock_step:"<<data._clock_step.c_str()<<std::endl; + + os<<"clock_step_units:"<<data._clock_step_units.c_str()<<std::endl; + + os<<"leap_utc_title:"<<data._leap_utc_title.c_str()<<std::endl; + + os<<"leap_utc:"<<data._leap_utc.c_str()<<std::endl; + + os<<"leap_sign_title:"<<data._leap_sign_title.c_str()<<std::endl; + + os<<"leap_sign:"<<data._leap_sign.c_str()<<std::endl; + + os<<"leap_err_title:"<<data._leap_err_title.c_str()<<std::endl; + + os<<"leap_err:"<<data._leap_err.c_str()<<std::endl; + + os<<"product_err_title:"<<data._product_err_title.c_str()<<std::endl; + + os<<"product_err:"<<data._product_err.c_str()<<std::endl; + + os<<"total_size_title:"<<data._total_size_title.c_str()<<std::endl; + + os<<"tot_size:"<<data._tot_size.c_str()<<std::endl; + + os<<"total_size_units:"<<data._total_size_units.c_str()<<std::endl; + + os<<"sph_size_title:"<<data._sph_size_title.c_str()<<std::endl; + + os<<"sph_size:"<<data._sph_size.c_str()<<std::endl; + + os<<"sph_size_units:"<<data._sph_size_units.c_str()<<std::endl; + + os<<"number_of_dsd_title:"<<data._number_of_dsd_title.c_str()<<std::endl; + + os<<"num_dsd:"<<data._num_dsd<<std::endl; + + os<<"size_of_dsd_title:"<<data._size_of_dsd_title.c_str()<<std::endl; + + os<<"dsd_size:"<<data._dsd_size<<std::endl; + + os<<"size_of_dsd_units:"<<data._size_of_dsd_units.c_str()<<std::endl; + + os<<"number_of_ds_att_title:"<<data._number_of_ds_att_title.c_str()<<std::endl; + + os<<"num_data_sets:"<<data._num_data_sets<<std::endl; + + return os; + +} + +std::istream& operator>>(std::istream& is, mph& data) +{ + char buf64[65]; + buf64[64] = '\0'; + char buf32[33]; + buf32[32] = '\0'; + char buf27[28]; + buf27[27]='\0'; + char buf16[17]; + buf16[16]='\0'; + char buf15[16]; + buf15[15] = '\0'; + char buf14[15]; + buf14[14] = '\0'; + char buf13[14]; + buf13[13] = '\0'; + char buf12[13]; + buf12[12] = '\0'; + char buf11[12]; + buf11[11] = '\0'; + char buf10[11]; + buf10[10] = '\0'; + char buf9[10]; + buf9[9] = '\0'; + char buf8[9]; + buf8[8] = '\0'; + char buf7[8]; + buf7[7] = '\0'; + char buf6[7]; + buf6[6] = '\0'; + char buf5[6]; + buf5[5] = '\0'; + char buf4[5]; + buf4[4] = '\0'; + char buf3[4]; + buf3[3] = '\0'; + char buf2[3]; + buf2[2] = '\0'; + char buf1[1]; + + + is.read(buf8,8); + data._product_name = buf8; + + is.read(buf1,1); + + is.read(buf64,62); + buf64[62]='\0'; + data._product = buf64; + + is.read(buf1,1); + + is.read(buf1,1); + + is.read(buf16,11); + buf16[11]='\0'; + data._proc_stage_title = buf16; + + is.read(buf1,1); + data._proc_stage = buf1; + + is.read(buf1,1); + + is.read(buf8,8); + data._ref_doc_title = buf8; + + is.read(buf1,1); + + is.read(buf32,23); + buf32[23]='\0'; + data._ref_doc = buf32; + + is.read(buf1,1); + + is.read(buf1,1); + + is.read(buf64,40); + + is.read(buf1,1); + + is.read(buf32,20); + buf32[20]='\0'; + data._acq_stat_id_title = buf32; + + is.read(buf1,1); + + is.read(buf32,20); + buf32[20]='\0'; + data._acq_station = buf32; + + is.read(buf1,1); + + is.read(buf1,1); + + is.read(buf16,12); + buf16[12]='\0'; + data._proc_center_title = buf16; + + is.read(buf1,1); + + is.read(buf8,6); + buf8[6]='\0'; + data._proc_center = buf8; + + is.read(buf1,1); + + is.read(buf1,1); + + is.read(buf16,10); + buf16[10]='\0'; + data._proc_time_title = buf16; + + is.read(buf1,1); + + is.read(buf32,27); + buf32[27]='\0'; + data._proc_time = buf32; + + is.read(buf1,1); + + is.read(buf1,1); + + is.read(buf16,13); + buf16[13]='\0'; + data._soft_version_title = buf16; + + is.read(buf1,1); + + is.read(buf16,14); + buf16[14]='\0'; + data._soft_version = buf16; + + is.read(buf1,1); + + is.read(buf1,1); + + is.read(buf64,40); + + is.read(buf1,1); + + is.read(buf16,14); + buf16[14]='\0'; + data._sensing_start_title = buf16; + + is.read(buf1,1); + + is.read(buf32,27); + buf32[27]='\0'; + data._sensing_start = buf32; + + is.read(buf1,1); + + is.read(buf1,1); + + is.read(buf16,13); + buf16[13]='\0'; + data._sensing_stop_title = buf16; + + is.read(buf1,1); + + is.read(buf32,27); + buf32[27]='\0'; + data._sensing_stop = buf32; + + is.read(buf1,1); + + is.read(buf1,1); + + is.read(buf64,40); + + is.read(buf1,1); + + is.read(buf6,6); + data._phase_title = buf6; + + is.read(buf1,1); + data._phase = buf1; + + is.read(buf1,1); + + is.read(buf6,6); + data._cycle_title = buf6; + + is.read(buf4,4); + data._cycle = buf4; + + is.read(buf1,1); + + is.read(buf10,10); + data._relative_orbit_title = buf10; + + is.read(buf6,6); + data._rel_orbit = buf6; + + is.read(buf1,1); + + is.read(buf10,10); + data._absolute_orbit_title = buf10; + + is.read(buf6,6); + data._abs_orbit = buf6; + + is.read(buf1,1); + + is.read(buf32,18); + buf32[18]='\0'; + data._state_vector_time_title = buf32; + + is.read(buf1,1); + + is.read(buf27,27); + data._state_vector_time = buf27; + + is.read(buf1,1); + + is.read(buf1,1); + + is.read(buf10,10); + data._delta_ut1_title = buf10; + + is.read(buf8,8); + data._delta_ut1 = buf8; + + is.read(buf4,3); + buf4[3]='\0'; + data._delta_ut1_units = buf4; + + is.read(buf1,1); + + is.read(buf11,11); + data._x_position_title = buf11; + + is.read(buf12,12); + data._x_position = buf12; + + is.read(buf3,3); + data._x_position_units = buf3; + + is.read(buf1,1); + + is.read(buf11,11); + data._y_position_title = buf11; + + is.read(buf12,12); + data._y_position = buf12; + + is.read(buf3,3); + data._y_position_units = buf3; + + is.read(buf1,1); + + is.read(buf11,11); + data._z_position_title = buf11; + + is.read(buf12,12); + data._z_position = buf12; + + is.read(buf3,3); + data._z_position_units = buf3; + + is.read(buf1,1); + + is.read(buf11,11); + data._x_velocity_title = buf11; + + is.read(buf12,12); + data._x_velocity = buf12; + + is.read(buf8,5); + buf8[5] = '\0'; + data._x_velocity_units = buf8; + + is.read(buf1,1); + + is.read(buf11,11); + data._y_velocity_title = buf11; + + is.read(buf12,12); + data._y_velocity = buf12; + + is.read(buf8,5); + buf8[5] = '\0'; + data._y_velocity_units = buf8; + + is.read(buf1,1); + + is.read(buf11,11); + data._z_velocity_title = buf11; + + is.read(buf12,12); + data._z_velocity = buf12; + + is.read(buf8,5); + buf8[5] = '\0'; + data._z_velocity_units = buf8; + + is.read(buf1,1); + + is.read(buf16,14); + buf16[14] = '\0'; + data._vector_source_title = buf16; + + is.read(buf1,1); + + is.read(buf2,2); + data._vector_source = buf2; + + is.read(buf1,1); + + is.read(buf1,1); + + is.read(buf64,40); + buf64[40] = '\0'; + data._spare_4 = buf64; + + is.read(buf1,1); + + is.read(buf16,13); + buf16[13] = '\0'; + data._utc_sbt_time_title = buf16; + + is.read(buf1,1); + + is.read(buf27,27); + data._utc_sbt_time = buf27; + + is.read(buf1,1); + + is.read(buf1,1); + + is.read(buf16,16); + data._sat_binary_time_title = buf16; + + is.read(buf11,11); + data._sat_binary_time = buf11; + + is.read(buf1,1); + + is.read(buf11,11); + data._clock_step_title = buf11; + + is.read(buf11,11); + data._clock_step = buf11; + + is.read(buf4,4); + data._clock_step_units = buf4; + + is.read(buf1,1); + + is.read(buf32,32); + + is.read(buf1,1); + + is.read(buf10,9); + buf10[9] = '\0'; + data._leap_utc_title = buf10; + + is.read(buf1,1); + + is.read(buf27,27); + data._leap_utc = buf27; + + is.read(buf1,1); + + is.read(buf1,1); + + is.read(buf10,10); + data._leap_sign_title = buf10; + + is.read(buf4,4); + data._leap_sign = buf4; + + is.read(buf1,1); + + is.read(buf10,9); + buf10[9] = '\0'; + data._leap_err_title = buf10; + + is.read(buf1,1); + data._leap_err = buf1; + + is.read(buf1,1); + + is.read(buf64,40); + + is.read(buf1,1); + + is.read(buf12,12); + data._product_err_title = buf12; + + is.read(buf1,1); + data._product_err = buf1; + + is.read(buf1,1); + + is.read(buf10,9); + buf10[9] = '\0'; + data._total_size_title = buf10; + + is.read(buf32,21); + buf32[21] = '\0'; + data._tot_size = buf32; + + is.read(buf7,7); + data._total_size_units = buf7; + + is.read(buf1,1); + + is.read(buf10,9); + buf10[9] = '\0'; + data._sph_size_title = buf10; + + is.read(buf11,11); + data._sph_size = buf11; + + is.read(buf8,7); + buf8[7] = '\0'; + data._sph_size_units = buf8; + + is.read(buf1,1); + + is.read(buf8,8); + data._number_of_dsd_title = buf8; + + is.read(buf11,11); + data._num_dsd = atoi(buf11); + + is.read(buf1,1); + + is.read(buf10,9); + buf10[9] = '\0'; + data._size_of_dsd_title = buf10; + + is.read(buf11,11); + data._dsd_size = atoi(buf11); + + is.read(buf8,7); + buf8[7] = '\0'; + data._size_of_dsd_units = buf8; + + is.read(buf1,1); + + is.read(buf16,14); + buf16[14] = '\0'; + data._number_of_ds_att_title = buf16; + + is.read(buf11,11); + data._num_data_sets = atoi(buf11); + + is.read(buf1,1); + + is.read(buf64,40); + + is.read(buf1,1); + + return is; +} + + +mph::mph(const mph& rhs): + EnvisatAsarRecord(rhs), + _product_name(rhs._product_name), + _product(rhs._product), + _proc_stage_title(rhs._proc_stage_title), + _proc_stage(rhs._proc_stage), + _ref_doc_title(rhs._ref_doc_title), + _ref_doc(rhs._ref_doc), + _acq_stat_id_title(rhs._acq_stat_id_title), + _acq_station(rhs._acq_station), + _proc_center_title(rhs._proc_center_title), + _proc_center(rhs._proc_center), + _proc_time_title(rhs._proc_time_title), + _proc_time(rhs._proc_time), + _soft_version_title(rhs._soft_version_title), + _soft_version(rhs._soft_version), + _sensing_start_title(rhs._sensing_start_title), + _sensing_start(rhs._sensing_start), + _sensing_stop_title(rhs._sensing_stop_title), + _sensing_stop(rhs._sensing_stop), + _phase_title(rhs._phase_title), + _phase(rhs._phase), + _cycle_title(rhs._cycle_title), + _cycle(rhs._cycle), + _relative_orbit_title(rhs._relative_orbit_title), + _rel_orbit(rhs._rel_orbit), + _absolute_orbit_title(rhs._absolute_orbit_title), + _abs_orbit(rhs._abs_orbit), + _state_vector_time_title(rhs._state_vector_time_title), + _state_vector_time(rhs._state_vector_time), + _delta_ut1_title(rhs._delta_ut1_title), + _delta_ut1(rhs._delta_ut1), + _delta_ut1_units(rhs._delta_ut1_units), + _x_position_title(rhs._x_position_title), + _x_position(rhs._x_position), + _x_position_units(rhs._x_position_units), + _y_position_title(rhs._y_position_title), + _y_position(rhs._y_position), + _y_position_units(rhs._y_position_units), + _z_position_title(rhs._z_position_title), + _z_position(rhs._z_position), + _z_position_units(rhs._z_position_units), + _x_velocity_title(rhs._x_velocity_title), + _x_velocity(rhs._x_velocity), + _x_velocity_units(rhs._x_velocity_units), + _y_velocity_title(rhs._y_velocity_title), + _y_velocity(rhs._y_velocity), + _y_velocity_units(rhs._y_velocity_units), + _z_velocity_title(rhs._z_velocity_title), + _z_velocity(rhs._z_velocity), + _z_velocity_units(rhs._z_velocity_units), + _vector_source_title(rhs._vector_source_title), + _vector_source(rhs._vector_source), + _spare_4(rhs._spare_4), + _utc_sbt_time_title(rhs._utc_sbt_time_title), + _utc_sbt_time(rhs._utc_sbt_time), + _sat_binary_time_title(rhs._sat_binary_time_title), + _sat_binary_time(rhs._sat_binary_time), + _clock_step_title(rhs._clock_step_title), + _clock_step(rhs._clock_step), + _clock_step_units(rhs._clock_step_units), + _leap_utc_title(rhs._leap_utc_title), + _leap_utc(rhs._leap_utc), + _leap_sign_title(rhs._leap_sign_title), + _leap_sign(rhs._leap_sign), + _leap_err_title(rhs._leap_err_title), + _leap_err(rhs._leap_err), + _product_err_title(rhs._product_err_title), + _product_err(rhs._product_err), + _total_size_title(rhs._total_size_title), + _tot_size(rhs._tot_size), + _total_size_units(rhs._total_size_units), + _sph_size_title(rhs._sph_size_title), + _sph_size(rhs._sph_size), + _sph_size_units(rhs._sph_size_units), + _number_of_dsd_title(rhs._number_of_dsd_title), + _num_dsd(rhs._num_dsd), + _size_of_dsd_title(rhs._size_of_dsd_title), + _dsd_size(rhs._dsd_size), + _size_of_dsd_units(rhs._size_of_dsd_units), + _number_of_ds_att_title(rhs._number_of_ds_att_title), + _num_data_sets(rhs._num_data_sets) + {} + + +mph& mph::operator=(const mph& rhs) +{ + _product_name = rhs._product_name; + _product = rhs._product; + _proc_stage_title = rhs._proc_stage_title; + _proc_stage = rhs._proc_stage; + _ref_doc_title = rhs._ref_doc_title; + _ref_doc = rhs._ref_doc; + _acq_stat_id_title = rhs._acq_stat_id_title; + _acq_station = rhs._acq_station; + _proc_center_title = rhs._proc_center_title; + _proc_center = rhs._proc_center; + _proc_time_title = rhs._proc_time_title; + _proc_time = rhs._proc_time; + _soft_version_title = rhs._soft_version_title; + _soft_version = rhs._soft_version; + _sensing_start_title = rhs._sensing_start_title; + _sensing_start = rhs._sensing_start; + _sensing_stop_title = rhs._sensing_stop_title; + _sensing_stop = rhs._sensing_stop; + _phase_title = rhs._phase_title; + _phase = rhs._phase; + _cycle_title = rhs._cycle_title; + _cycle = rhs._cycle; + _relative_orbit_title = rhs._relative_orbit_title; + _rel_orbit = rhs._rel_orbit; + _absolute_orbit_title = rhs._absolute_orbit_title; + _abs_orbit = rhs._abs_orbit; + _state_vector_time_title = rhs._state_vector_time_title; + _state_vector_time = rhs._state_vector_time; + _delta_ut1_title = rhs._delta_ut1_title; + _delta_ut1 = rhs._delta_ut1; + _delta_ut1_units = rhs._delta_ut1_units; + _x_position_title = rhs._x_position_title; + _x_position = rhs._x_position; + _x_position_units = rhs._x_position_units; + _y_position_title = rhs._y_position_title; + _y_position = rhs._y_position; + _y_position_units = rhs._y_position_units; + _z_position_title = rhs._z_position_title; + _z_position = rhs._z_position; + _z_position_units = rhs._z_position_units; + _x_velocity_title = rhs._x_velocity_title; + _x_velocity = rhs._x_velocity; + _x_velocity_units = rhs._x_velocity_units; + _y_velocity_title = rhs._y_velocity_title; + _y_velocity = rhs._y_velocity; + _y_velocity_units = rhs._y_velocity_units; + _z_velocity_title = rhs._z_velocity_title; + _z_velocity = rhs._z_velocity; + _z_velocity_units = rhs._z_velocity_units; + _vector_source_title = rhs._vector_source_title; + _vector_source = rhs._vector_source; + _spare_4 = rhs._spare_4; + _utc_sbt_time_title = rhs._utc_sbt_time_title; + _utc_sbt_time = rhs._utc_sbt_time; + _sat_binary_time_title = rhs._sat_binary_time_title; + _sat_binary_time = rhs._sat_binary_time; + _clock_step_title = rhs._clock_step_title; + _clock_step = rhs._clock_step; + _clock_step_units = rhs._clock_step_units; + _leap_utc_title = rhs._leap_utc_title; + _leap_utc = rhs._leap_utc; + _leap_sign_title = rhs._leap_sign_title; + _leap_sign = rhs._leap_sign; + _leap_err_title = rhs._leap_err_title; + _leap_err = rhs._leap_err; + _product_err_title = rhs._product_err_title; + _product_err = rhs._product_err; + _total_size_title = rhs._total_size_title; + _tot_size = rhs._tot_size; + _total_size_units = rhs._total_size_units; + _sph_size_title = rhs._sph_size_title; + _sph_size = rhs._sph_size; + _sph_size_units = rhs._sph_size_units; + _number_of_dsd_title = rhs._number_of_dsd_title; + _num_dsd = rhs._num_dsd; + _size_of_dsd_title = rhs._size_of_dsd_title; + _dsd_size = rhs._dsd_size; + _size_of_dsd_units = rhs._size_of_dsd_units; + _number_of_ds_att_title = rhs._number_of_ds_att_title; + _num_data_sets = rhs._num_data_sets; + + return *this; +} +} diff --git a/Utilities/otbossimplugins/ossim/EnvisatAsar/mph.h b/Utilities/otbossimplugins/ossim/EnvisatAsar/mph.h new file mode 100644 index 0000000000000000000000000000000000000000..c56e6aab658f6d185ee7d9e0e4ec6c543c4d22ea --- /dev/null +++ b/Utilities/otbossimplugins/ossim/EnvisatAsar/mph.h @@ -0,0 +1,989 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#ifndef mph_h +#define mph_h + +#include <iostream> +#include <EnvisatAsar/EnvisatAsarRecord.h> + +namespace ossimplugins +{ + +/** + * @ingroup mphRecord + * @brief This class is able to read the ASAR mph record of the leader file + */ +class mph : public EnvisatAsarRecord +{ +public: + /** + * @brief Constructor + */ + mph(); + + /** + * @brief Destructor + */ + ~mph(); + + /** + * @brief This function write the mph in a stream + */ + friend std::ostream& operator<<(std::ostream& os, const mph& data); + + /** + * @brief This function read a mph from a stream + */ + friend std::istream& operator>>(std::istream& is, mph& data); + + /** + * @brief Copy constructor + */ + mph(const mph& rhs); + + /** + * @brief Copy operator + */ + mph& operator=(const mph& rhs); + + /** + * @brief This function is able to create a new instance of the class + */ + EnvisatAsarRecord* Instanciate() + { + return new mph(); + }; + + /** + * @brief This function is able to create a new instance of the class initialised with the data of the calling instance + */ + EnvisatAsarRecord* Clone() + { + return new mph(*this); + }; + + /** + * @brief Read the class data from a stream + */ + void Read(std::istream& is) + { + is>>*this; + }; + + /** + * @brief Write the class to a stream + */ + void Write(std::ostream& os) + { + os<<*this; + }; + + /** + * @brief product_name + */ + std::string get_product_name() + { + return _product_name; + }; + /** + * @brief product + */ + std::string get_product() + { + return _product; + }; + /** + * @brief proc_stage_title + */ + std::string get_proc_stage_title() + { + return _proc_stage_title; + }; + /** + * @brief proc_stage + */ + std::string get_proc_stage() + { + return _proc_stage; + }; + /** + * @brief ref_doc_title + */ + std::string get_ref_doc_title() + { + return _ref_doc_title; + }; + /** + * @brief ref_doc + */ + std::string get_ref_doc() + { + return _ref_doc; + }; + /** + * @brief acq_stat_id_title + */ + std::string get_acq_stat_id_title() + { + return _acq_stat_id_title; + }; + /** + * @brief acq_station + */ + std::string get_acq_station() + { + return _acq_station; + }; + /** + * @brief proc_center_title + */ + std::string get_proc_center_title() + { + return _proc_center_title; + }; + /** + * @brief proc_center + */ + std::string get_proc_center() + { + return _proc_center; + }; + /** + * @brief proc_time_title + */ + std::string get_proc_time_title() + { + return _proc_time_title; + }; + /** + * @brief proc_time + */ + std::string get_proc_time() + { + return _proc_time; + }; + /** + * @brief soft_version_title + */ + std::string get_soft_version_title() + { + return _soft_version_title; + }; + /** + * @brief soft_version + */ + std::string get_soft_version() + { + return _soft_version; + }; + /** + * @brief sensing_start_title + */ + std::string get_sensing_start_title() + { + return _sensing_start_title; + }; + /** + * @brief sensing_start + */ + std::string get_sensing_start() + { + return _sensing_start; + }; + /** + * @brief sensing_stop_title + */ + std::string get_sensing_stop_title() + { + return _sensing_stop_title; + }; + /** + * @brief sensing_stop + */ + std::string get_sensing_stop() + { + return _sensing_stop; + }; + /** + * @brief phase_title + */ + std::string get_phase_title() + { + return _phase_title; + }; + /** + * @brief phase + */ + std::string get_phase() + { + return _phase; + }; + /** + * @brief cycle_title + */ + std::string get_cycle_title() + { + return _cycle_title; + }; + /** + * @brief cycle + */ + std::string get_cycle() + { + return _cycle; + }; + /** + * @brief relative_orbit_title + */ + std::string get_relative_orbit_title() + { + return _relative_orbit_title; + }; + /** + * @brief rel_orbit + */ + std::string get_rel_orbit() + { + return _rel_orbit; + }; + /** + * @brief absolute_orbit_title + */ + std::string get_absolute_orbit_title() + { + return _absolute_orbit_title; + }; + /** + * @brief abs_orbit + */ + std::string get_abs_orbit() + { + return _abs_orbit; + }; + /** + * @brief state_vector_time_title + */ + std::string get_state_vector_time_title() + { + return _state_vector_time_title; + }; + /** + * @brief state_vector_time + */ + std::string get_state_vector_time() + { + return _state_vector_time; + }; + /** + * @brief delta_ut1_title + */ + std::string get_delta_ut1_title() + { + return _delta_ut1_title; + }; + /** + * @brief delta_ut1 + */ + std::string get_delta_ut1() + { + return _delta_ut1; + }; + /** + * @brief delta_ut1_units + */ + std::string get_delta_ut1_units() + { + return _delta_ut1_units; + }; + /** + * @brief x_position_title + */ + std::string get_x_position_title() + { + return _x_position_title; + }; + /** + * @brief x_position + */ + std::string get_x_position() + { + return _x_position; + }; + /** + * @brief x_position_units + */ + std::string get_x_position_units() + { + return _x_position_units; + }; + /** + * @brief y_position_title + */ + std::string get_y_position_title() + { + return _y_position_title; + }; + /** + * @brief y_position + */ + std::string get_y_position() + { + return _y_position; + }; + /** + * @brief y_position_units + */ + std::string get_y_position_units() + { + return _y_position_units; + }; + /** + * @brief z_position_title + */ + std::string get_z_position_title() + { + return _z_position_title; + }; + /** + * @brief z_position + */ + std::string get_z_position() + { + return _z_position; + }; + /** + * @brief z_position_units + */ + std::string get_z_position_units() + { + return _z_position_units; + }; + /** + * @brief x_velocity_title + */ + std::string get_x_velocity_title() + { + return _x_velocity_title; + }; + /** + * @brief x_velocity + */ + std::string get_x_velocity() + { + return _x_velocity; + }; + /** + * @brief x_velocity_units + */ + std::string get_x_velocity_units() + { + return _x_velocity_units; + }; + /** + * @brief y_velocity_title + */ + std::string get_y_velocity_title() + { + return _y_velocity_title; + }; + /** + * @brief y_velocity + */ + std::string get_y_velocity() + { + return _y_velocity; + }; + /** + * @brief y_velocity_units + */ + std::string get_y_velocity_units() + { + return _y_velocity_units; + }; + /** + * @brief z_velocity_title + */ + std::string get_z_velocity_title() + { + return _z_velocity_title; + }; + /** + * @brief z_velocity + */ + std::string get_z_velocity() + { + return _z_velocity; + }; + /** + * @brief z_velocity_units + */ + std::string get_z_velocity_units() + { + return _z_velocity_units; + }; + /** + * @brief vector_source_title + */ + std::string get_vector_source_title() + { + return _vector_source_title; + }; + /** + * @brief vector_source + */ + std::string get_vector_source() + { + return _vector_source; + }; + /** + * @brief spare_4 + */ + std::string get_spare_4() + { + return _spare_4; + }; + /** + * @brief utc_sbt_time_title + */ + std::string get_utc_sbt_time_title() + { + return _utc_sbt_time_title; + }; + /** + * @brief utc_sbt_time + */ + std::string get_utc_sbt_time() + { + return _utc_sbt_time; + }; + /** + * @brief sat_binary_time_title + */ + std::string get_sat_binary_time_title() + { + return _sat_binary_time_title; + }; + /** + * @brief sat_binary_time + */ + std::string get_sat_binary_time() + { + return _sat_binary_time; + }; + /** + * @brief clock_step_title + */ + std::string get_clock_step_title() + { + return _clock_step_title; + }; + /** + * @brief clock_step + */ + std::string get_clock_step() + { + return _clock_step; + }; + /** + * @brief clock_step_units + */ + std::string get_clock_step_units() + { + return _clock_step_units; + }; + /** + * @brief leap_utc_title + */ + std::string get_leap_utc_title() + { + return _leap_utc_title; + }; + /** + * @brief leap_utc + */ + std::string get_leap_utc() + { + return _leap_utc; + }; + /** + * @brief leap_sign_title + */ + std::string get_leap_sign_title() + { + return _leap_sign_title; + }; + /** + * @brief leap_sign + */ + std::string get_leap_sign() + { + return _leap_sign; + }; + /** + * @brief leap_err_title + */ + std::string get_leap_err_title() + { + return _leap_err_title; + }; + /** + * @brief leap_err + */ + std::string get_leap_err() + { + return _leap_err; + }; + /** + * @brief product_err_title + */ + std::string get_product_err_title() + { + return _product_err_title; + }; + /** + * @brief product_err + */ + std::string get_product_err() + { + return _product_err; + }; + /** + * @brief total_size_title + */ + std::string get_total_size_title() + { + return _total_size_title; + }; + /** + * @brief tot_size + */ + std::string get_tot_size() + { + return _tot_size; + }; + /** + * @brief total_size_units + */ + std::string get_total_size_units() + { + return _total_size_units; + }; + /** + * @brief sph_size_title + */ + std::string get_sph_size_title() + { + return _sph_size_title; + }; + /** + * @brief sph_size + */ + std::string get_sph_size() + { + return _sph_size; + }; + /** + * @brief sph_size_units + */ + std::string get_sph_size_units() + { + return _sph_size_units; + }; + /** + * @brief number_of_dsd_title + */ + std::string get_number_of_dsd_title() + { + return _number_of_dsd_title; + }; + /** + * @brief num_dsd + */ + int get_num_dsd() + { + return _num_dsd; + }; + /** + * @brief size_of_dsd_title + */ + std::string get_size_of_dsd_title() + { + return _size_of_dsd_title; + }; + /** + * @brief dsd_size + */ + int get_dsd_size() + { + return _dsd_size; + }; + /** + * @brief size_of_dsd_units + */ + std::string get_size_of_dsd_units() + { + return _size_of_dsd_units; + }; + /** + * @brief number_of_ds_att_title + */ + std::string get_number_of_ds_att_title() + { + return _number_of_ds_att_title; + }; + /** + * @brief num_data_sets + */ + int get_num_data_sets() + { + return _num_data_sets; + }; + /** + * @brief Check mph validity + */ + bool is_valid() + { + if ((_product_name.compare("PRODUCT=") == 0) && (_number_of_dsd_title.compare("NUM_DSD=") == 0)) + { + return true; + } else return false; + }; + + + /** + * @brief product_name + */ + std::string _product_name; + /** + * @brief product + */ + std::string _product; + /** + * @brief proc_stage_title + */ + std::string _proc_stage_title; + /** + * @brief proc_stage + */ + std::string _proc_stage; + /** + * @brief ref_doc_title + */ + std::string _ref_doc_title; + /** + * @brief ref_doc + */ + std::string _ref_doc; + /** + * @brief acq_stat_id_title + */ + std::string _acq_stat_id_title; + /** + * @brief acq_station + */ + std::string _acq_station; + /** + * @brief proc_center_title + */ + std::string _proc_center_title; + /** + * @brief proc_center + */ + std::string _proc_center; + /** + * @brief proc_time_title + */ + std::string _proc_time_title; + /** + * @brief proc_time + */ + std::string _proc_time; + /** + * @brief soft_version_title + */ + std::string _soft_version_title; + /** + * @brief soft_version + */ + std::string _soft_version; + /** + * @brief sensing_start_title + */ + std::string _sensing_start_title; + /** + * @brief sensing_start + */ + std::string _sensing_start; + /** + * @brief sensing_stop_title + */ + std::string _sensing_stop_title; + /** + * @brief sensing_stop + */ + std::string _sensing_stop; + /** + * @brief phase_title + */ + std::string _phase_title; + /** + * @brief phase + */ + std::string _phase; + /** + * @brief cycle_title + */ + std::string _cycle_title; + /** + * @brief cycle + */ + std::string _cycle; + /** + * @brief relative_orbit_title + */ + std::string _relative_orbit_title; + /** + * @brief rel_orbit + */ + std::string _rel_orbit; + /** + * @brief absolute_orbit_title + */ + std::string _absolute_orbit_title; + /** + * @brief abs_orbit + */ + std::string _abs_orbit; + /** + * @brief state_vector_time_title + */ + std::string _state_vector_time_title; + /** + * @brief state_vector_time + */ + std::string _state_vector_time; + /** + * @brief delta_ut1_title + */ + std::string _delta_ut1_title; + /** + * @brief delta_ut1 + */ + std::string _delta_ut1; + /** + * @brief delta_ut1_units + */ + std::string _delta_ut1_units; + /** + * @brief x_position_title + */ + std::string _x_position_title; + /** + * @brief x_position + */ + std::string _x_position; + /** + * @brief x_position_units + */ + std::string _x_position_units; + /** + * @brief y_position_title + */ + std::string _y_position_title; + /** + * @brief y_position + */ + std::string _y_position; + /** + * @brief y_position_units + */ + std::string _y_position_units; + /** + * @brief z_position_title + */ + std::string _z_position_title; + /** + * @brief z_position + */ + std::string _z_position; + /** + * @brief z_position_units + */ + std::string _z_position_units; + /** + * @brief x_velocity_title + */ + std::string _x_velocity_title; + /** + * @brief x_velocity + */ + std::string _x_velocity; + /** + * @brief x_velocity_units + */ + std::string _x_velocity_units; + /** + * @brief y_velocity_title + */ + std::string _y_velocity_title; + /** + * @brief y_velocity + */ + std::string _y_velocity; + /** + * @brief y_velocity_units + */ + std::string _y_velocity_units; + /** + * @brief z_velocity_title + */ + std::string _z_velocity_title; + /** + * @brief z_velocity + */ + std::string _z_velocity; + /** + * @brief z_velocity_units + */ + std::string _z_velocity_units; + /** + * @brief vector_source_title + */ + std::string _vector_source_title; + /** + * @brief vector_source + */ + std::string _vector_source; + /** + * @brief spare_4 + */ + std::string _spare_4; + /** + * @brief utc_sbt_time_title + */ + std::string _utc_sbt_time_title; + /** + * @brief utc_sbt_time + */ + std::string _utc_sbt_time; + /** + * @brief sat_binary_time_title + */ + std::string _sat_binary_time_title; + /** + * @brief sat_binary_time + */ + std::string _sat_binary_time; + /** + * @brief clock_step_title + */ + std::string _clock_step_title; + /** + * @brief clock_step + */ + std::string _clock_step; + /** + * @brief clock_step_units + */ + std::string _clock_step_units; + /** + * @brief leap_utc_title + */ + std::string _leap_utc_title; + /** + * @brief leap_utc + */ + std::string _leap_utc; + /** + * @brief leap_sign_title + */ + std::string _leap_sign_title; + /** + * @brief leap_sign + */ + std::string _leap_sign; + /** + * @brief leap_err_title + */ + std::string _leap_err_title; + /** + * @brief leap_err + */ + std::string _leap_err; + /** + * @brief product_err_title + */ + std::string _product_err_title; + /** + * @brief product_err + */ + std::string _product_err; + /** + * @brief total_size_title + */ + std::string _total_size_title; + /** + * @brief tot_size + */ + std::string _tot_size; + /** + * @brief total_size_units + */ + std::string _total_size_units; + /** + * @brief sph_size_title + */ + std::string _sph_size_title; + /** + * @brief sph_size + */ + std::string _sph_size; + /** + * @brief sph_size_units + */ + std::string _sph_size_units; + /** + * @brief number_of_dsd_title + */ + std::string _number_of_dsd_title; + /** + * @brief num_dsd + */ + int _num_dsd; + /** + * @brief size_of_dsd_title + */ + std::string _size_of_dsd_title; + /** + * @brief dsd_size + */ + int _dsd_size; + /** + * @brief size_of_dsd_units + */ + std::string _size_of_dsd_units; + /** + * @brief number_of_ds_att_title + */ + std::string _number_of_ds_att_title; + /** + * @brief num_data_sets + */ + int _num_data_sets; + +private: + +}; +} +#endif + + diff --git a/Utilities/otbossimplugins/ossim/EnvisatAsar/sph.cpp b/Utilities/otbossimplugins/ossim/EnvisatAsar/sph.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ad965fe4466b243981a7fef5dbb9d555284167f1 --- /dev/null +++ b/Utilities/otbossimplugins/ossim/EnvisatAsar/sph.cpp @@ -0,0 +1,786 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#include <EnvisatAsar/sph.h> +#include <EnvisatAsar/mph.h> + +namespace ossimplugins +{ +sph::sph() : EnvisatAsarRecord("sph_rec") +{ + this->_num_dsd = 18; + this->_size_dsd = 280; +} + +sph::sph(const mph& data) : EnvisatAsarRecord("sph_rec") +{ + this->_num_dsd = data._num_dsd ; + this->_size_dsd = data._dsd_size; +} + +sph::~sph() +{ +} + + +std::ostream& operator<<(std::ostream& os, const sph& data) +{ + os<<"sph_desc_title:"<<data._sph_desc_title.c_str()<<std::endl; + + os<<"sph_desc:"<<data._sph_desc.c_str()<<std::endl; + + os<<"strip_cont_ind_title:"<<data._strip_cont_ind_title.c_str()<<std::endl; + + os<<"strip_cont_ind std::string:"<<data._strip_cont_ind.c_str()<<std::endl; + + os<<"slice_pos_title:"<<data._slice_pos_title.c_str()<<std::endl; + + os<<"slice_position:"<<data._slice_position.c_str()<<std::endl; + + os<<"num_slices_title:"<<data._num_slices_title.c_str()<<std::endl; + + os<<"num_slices:"<<data._num_slices.c_str()<<std::endl; + + os<<"first_line_time_title:"<<data._first_line_time_title.c_str()<<std::endl; + + os<<"first_line_time:"<<data._first_line_time.c_str()<<std::endl; + + os<<"last_line_time_title:"<<data._last_line_time_title.c_str()<<std::endl; + + os<<"last_line_time:"<<data._last_line_time.c_str()<<std::endl; + + os<<"first_near_lat_title:"<<data._first_near_lat_title.c_str()<<std::endl; + + os<<"first_near_lat:"<<data._first_near_lat.c_str()<<std::endl; + + os<<"first_near_lat_units:"<<data._first_near_lat_units.c_str()<<std::endl; + + os<<"first_near_long_title:"<<data._first_near_long_title.c_str()<<std::endl; + + os<<"first_near_long:"<<data._first_near_long.c_str()<<std::endl; + + os<<"first_near_long_units:"<<data._first_near_long_units.c_str()<<std::endl; + + os<<"first_mid_lat_title:"<<data._first_mid_lat_title.c_str()<<std::endl; + + os<<"first_mid_lat:"<<data._first_mid_lat.c_str()<<std::endl; + + os<<"first_mid_lat_units:"<<data._first_mid_lat_units.c_str()<<std::endl; + + os<<"first_mid_long_title:"<<data._first_mid_long_title.c_str()<<std::endl; + + os<<"first_mid_long:"<<data._first_mid_long.c_str()<<std::endl; + + os<<"first_mid_long_units:"<<data._first_mid_long_units.c_str()<<std::endl; + + os<<"first_far_lat_title:"<<data._first_far_lat_title.c_str()<<std::endl; + + os<<"first_far_lat:"<<data._first_far_lat.c_str()<<std::endl; + + os<<"first_far_lat_units:"<<data._first_far_lat_units.c_str()<<std::endl; + + os<<"first_far_long_title:"<<data._first_far_long_title.c_str()<<std::endl; + + os<<"first_far_long:"<<data._first_far_long.c_str()<<std::endl; + + os<<"first_far_long_units:"<<data._first_far_long_units.c_str()<<std::endl; + + os<<"last_near_lat_title:"<<data._last_near_lat_title.c_str()<<std::endl; + + os<<"last_near_lat:"<<data._last_near_lat.c_str()<<std::endl; + + os<<"last_near_lat_units:"<<data._last_near_lat_units.c_str()<<std::endl; + + os<<"last_near_long_title:"<<data._last_near_long_title.c_str()<<std::endl; + + os<<"last_near_long:"<<data._last_near_long.c_str()<<std::endl; + + os<<"last_near_long_units:"<<data._last_near_long_units.c_str()<<std::endl; + + os<<"last_mid_lat_title:"<<data._last_mid_lat_title.c_str()<<std::endl; + + os<<"last_mid_lat:"<<data._last_mid_lat.c_str()<<std::endl; + + os<<"last_mid_lat_units:"<<data._last_mid_lat_units.c_str()<<std::endl; + + os<<"last_mid_long_title:"<<data._last_mid_long_title.c_str()<<std::endl; + + os<<"last_mid_long:"<<data._last_mid_long.c_str()<<std::endl; + + os<<"last_mid_long_units:"<<data._last_mid_long_units.c_str()<<std::endl; + + os<<"last_far_lat_title:"<<data._last_far_lat_title.c_str()<<std::endl; + + os<<"last_far_lat:"<<data._last_far_lat.c_str()<<std::endl; + + os<<"last_far_lat_units:"<<data._last_far_lat_units.c_str()<<std::endl; + + os<<"last_far_long_title:"<<data._last_far_long_title.c_str()<<std::endl; + + os<<"last_far_long:"<<data._last_far_long.c_str()<<std::endl; + + os<<"last_far_long_units:"<<data._last_far_long_units.c_str()<<std::endl; + + os<<"swath_title:"<<data._swath_title.c_str()<<std::endl; + + os<<"swath:"<<data._swath.c_str()<<std::endl; + + os<<"pass_title:"<<data._pass_title.c_str()<<std::endl; + + os<<"pass:"<<data._pass.c_str()<<std::endl; + + os<<"sample_type_title:"<<data._sample_type_title.c_str()<<std::endl; + + os<<"sample_type:"<<data._sample_type.c_str()<<std::endl; + + os<<"algo_title:"<<data._algo_title.c_str()<<std::endl; + + os<<"algorithm:"<<data._algorithm.c_str()<<std::endl; + + os<<"mds1_tx_rx_polar_title:"<<data._mds1_tx_rx_polar_title.c_str()<<std::endl; + + os<<"mds1_tx_rx_polar:"<<data._mds1_tx_rx_polar.c_str()<<std::endl; + + os<<"mds2_tx_rx_polar_title:"<<data._mds2_tx_rx_polar_title.c_str()<<std::endl; + + os<<"mds2_tx_rx_polar:"<<data._mds2_tx_rx_polar.c_str()<<std::endl; + + os<<"compression_title:"<<data._compression_title.c_str()<<std::endl; + + os<<"compression:"<<data._compression.c_str()<<std::endl; + + os<<"azimut_looks_title:"<<data._azimut_looks_title.c_str()<<std::endl; + + os<<"azimut_looks:"<<data._azimut_looks.c_str()<<std::endl; + + os<<"range_looks_title:"<<data._range_looks_title.c_str()<<std::endl; + + os<<"range_looks:"<<data._range_looks.c_str()<<std::endl; + + os<<"range_spacing_title:"<<data._range_spacing_title.c_str()<<std::endl; + + os<<"range_spacing:"<<data._range_spacing.c_str()<<std::endl; + + os<<"range_spacing_unit:"<<data._range_spacing_unit.c_str()<<std::endl; + + os<<"azimut_spacing_title:"<<data._azimut_spacing_title.c_str()<<std::endl; + + os<<"azimut_spacing:"<<data._azimut_spacing.c_str()<<std::endl; + + os<<"azimut_spacing_unit:"<<data._azimut_spacing_unit.c_str()<<std::endl; + + os<<"line_time_interval_title:"<<data._line_time_interval_title.c_str()<<std::endl; + + os<<"line_time_interval:"<<data._line_time_interval.c_str()<<std::endl; + + os<<"line_time_interv_units:"<<data._line_time_interv_units.c_str()<<std::endl; + + os<<"line_length_title:"<<data._line_length_title.c_str()<<std::endl; + + os<<"line_length:"<<data._line_length.c_str()<<std::endl; + + os<<"line_length_units:"<<data._line_length_units.c_str()<<std::endl; + + os<<"data_type_title:"<<data._data_type_title.c_str()<<std::endl; + + os<<"data_type:"<<data._data_type.c_str()<<std::endl; + + return os; + +} + +std::istream& operator>>(std::istream& is, sph& data) +{ + char buf64[65]; + buf64[64] = '\0'; + char buf32[33]; + buf32[32] = '\0'; + char buf27[28]; + buf27[27] = '\0'; + char buf16[17]; + buf16[16]='\0'; + char buf15[16]; + buf15[15] = '\0'; + char buf14[15]; + buf14[14] = '\0'; + char buf13[14]; + buf13[13] = '\0'; + char buf12[13]; + buf12[12] = '\0'; + char buf11[12]; + buf11[11] = '\0'; + char buf10[11]; + buf10[10] = '\0'; + char buf9[10]; + buf9[9] = '\0'; + char buf8[9]; + buf8[8] = '\0'; + char buf7[8]; + buf7[7] = '\0'; + char buf6[7]; + buf6[6] = '\0'; + char buf5[6]; + buf5[5] = '\0'; + char buf4[5]; + buf4[4] = '\0'; + char buf3[4]; + buf3[3] = '\0'; + char buf2[3]; + buf2[2] = '\0'; + char buf1[1]; + + + is.read(buf15,15); + data._sph_desc_title = buf15; + + is.read(buf1,1); + + is.read(buf32,28); + buf32[28] = '\0'; + data._sph_desc = buf32; + + is.read(buf1,1); + + is.read(buf1,1); + + is.read(buf32,31); + buf32[31] = '\0'; + data._strip_cont_ind_title = buf32; + + is.read(buf4,4); + data._strip_cont_ind = buf4; + + is.read(buf1,1); + + is.read(buf15,15); + data._slice_pos_title = buf15; + + is.read(buf4,4); + data._slice_position = buf4; + + is.read(buf1,1); + + is.read(buf11,11); + data._num_slices_title = buf11; + + is.read(buf4,4); + data._num_slices = buf4; + + is.read(buf1,1); + + is.read(buf16,16); + data._first_line_time_title = buf16; + + is.read(buf1,1); + + is.read(buf27,27); + data._first_line_time = buf27; + + is.read(buf1,1); + + is.read(buf1,1); + + is.read(buf15,15); + data._last_line_time_title = buf15; + + is.read(buf1,1); + + is.read(buf27,27); + data._last_line_time = buf27; + + is.read(buf1,1); + + is.read(buf1,1); + + is.read(buf15,15); + data._first_near_lat_title = buf15; + + is.read(buf11,11); + data._first_near_lat = buf11; + + is.read(buf10,10); + data._first_near_lat_units = buf10; + + is.read(buf1,1); + + is.read(buf16,16); + data._first_near_long_title = buf16; + + is.read(buf11,11); + data._first_near_long = buf11; + + is.read(buf10,10); + data._first_near_long_units = buf10; + + is.read(buf1,1); + + is.read(buf14,14); + data._first_mid_lat_title = buf14; + + is.read(buf11,11); + data._first_mid_lat = buf11; + + is.read(buf10,10); + data._first_mid_lat_units = buf10; + + is.read(buf1,1); + + is.read(buf15,15); + data._first_mid_long_title = buf15; + + is.read(buf11,11); + data._first_mid_long = buf11; + + is.read(buf10,10); + data._first_mid_long_units = buf10; + + is.read(buf1,1); + + is.read(buf14,14); + data._first_far_lat_title = buf14; + + is.read(buf11,11); + data._first_far_lat = buf11; + + is.read(buf10,10); + data._first_far_lat_units = buf10; + + is.read(buf1,1); + + is.read(buf15,15); + data._first_far_long_title = buf15; + + is.read(buf11,11); + data._first_far_long = buf11; + + is.read(buf10,10); + data._first_far_long_units = buf10; + + is.read(buf1,1); + + is.read(buf14,14); + data._last_near_lat_title = buf14; + + is.read(buf11,11); + data._last_near_lat = buf11; + + is.read(buf10,10); + data._last_near_lat_units = buf10; + + is.read(buf1,1); + + is.read(buf15,15); + data._last_near_long_title = buf15; + + is.read(buf11,11); + data._last_near_long = buf11; + + is.read(buf10,10); + data._last_near_long_units = buf10; + + is.read(buf1,1); + + is.read(buf13,13); + data._last_mid_lat_title = buf13; + + is.read(buf11,11); + data._last_mid_lat = buf11; + + is.read(buf10,10); + data._last_mid_lat_units = buf10; + + is.read(buf1,1); + + is.read(buf14,14); + data._last_mid_long_title = buf14; + + is.read(buf11,11); + data._last_mid_long = buf11; + + is.read(buf10,10); + data._last_mid_long_units = buf10; + + is.read(buf1,1); + + is.read(buf13,13); + data._last_far_lat_title = buf13; + + is.read(buf11,11); + data._last_far_lat = buf11; + + is.read(buf10,10); + data._last_far_lat_units = buf10; + + is.read(buf1,1); + + is.read(buf14,14); + data._last_far_long_title = buf14; + + is.read(buf11,11); + data._last_far_long = buf11; + + is.read(buf10,10); + data._last_far_long_units = buf10; + + is.read(buf1,1); + + is.read(buf64,35); + + is.read(buf1,1); + + is.read(buf6,6); + data._swath_title = buf6; + + is.read(buf1,1); + + is.read(buf3,3); + data._swath = buf3; + + is.read(buf1,1); + + is.read(buf1,1); + + is.read(buf5,5); + data._pass_title = buf5; + + is.read(buf1,1); + + is.read(buf10,10); + data._pass = buf10; + + is.read(buf1,1); + + is.read(buf1,1); + + is.read(buf12,12); + data._sample_type_title = buf12; + + is.read(buf1,1); + + is.read(buf8,8); + data._sample_type = buf8; + + is.read(buf1,1); + + is.read(buf1,1); + + is.read(buf10,10); + data._algo_title = buf10; + + is.read(buf1,1); + + is.read(buf7,7); + data._algorithm = buf7; + + is.read(buf1,1); + + is.read(buf1,1); + + is.read(buf32,17); + buf32[17] = '\0'; + data._mds1_tx_rx_polar_title = buf32; + + is.read(buf1,1); + + is.read(buf3,3); + data._mds1_tx_rx_polar = buf3; + + is.read(buf1,1); + + is.read(buf1,1); + + is.read(buf32,17); + buf32[17] = '\0'; + data._mds2_tx_rx_polar_title = buf32; + + is.read(buf1,1); + + is.read(buf3,3); + data._mds2_tx_rx_polar = buf3; + + is.read(buf1,1); + + is.read(buf1,1); + + is.read(buf12,12); + data._compression_title = buf12; + + is.read(buf1,1); + + is.read(buf5,5); + data._compression = buf5; + + is.read(buf1,1); + + is.read(buf1,1); + + is.read(buf14,14); + data._azimut_looks_title = buf14; + + is.read(buf4,4); + data._azimut_looks = buf4; + + is.read(buf1,1); + + is.read(buf12,12); + data._range_looks_title = buf12; + + is.read(buf4,4); + data._range_looks = buf4; + + is.read(buf1,1); + + is.read(buf14,14); + data._range_spacing_title = buf14; + + is.read(buf15,15); + data._range_spacing = buf15; + + is.read(buf3,3); + data._range_spacing_unit = buf3; + + is.read(buf1,1); + + is.read(buf16,16); + data._azimut_spacing_title = buf16; + + is.read(buf15,15); + data._azimut_spacing = buf15; + + is.read(buf3,3); + data._azimut_spacing_unit = buf3; + + is.read(buf1,1); + + is.read(buf32,19); + buf32[19] = '\0'; + data._line_time_interval_title = buf32; + + is.read(buf15,15); + data._line_time_interval = buf15; + + is.read(buf3,3); + data._line_time_interv_units = buf3; + + is.read(buf1,1); + + is.read(buf12,12); + data._line_length_title = buf12; + + is.read(buf6,6); + data._line_length = buf6; + + is.read(buf9,9); + data._line_length_units = buf9; + + is.read(buf1,1); + + is.read(buf10,10); + data._data_type_title = buf10; + + is.read(buf1,1); + + is.read(buf5,5); + data._data_type = buf5; + + is.read(buf1,1); + + is.read(buf1,1); + + is.read(buf64,50); + + is.read(buf1,1); + + for (int i = 0; i<data._num_dsd; i++) + { + dsd dsd_rec; + is>>dsd_rec; + data._dsd_vector.push_back(dsd_rec); + } + + //char *buffer = (char* )malloc(data._num_dsd*data._size_dsd); + //is.read(buffer, data._num_dsd*data._size_dsd); + +return is; +} + + +sph::sph(const sph& rhs): + EnvisatAsarRecord(rhs), + _sph_desc_title(rhs._sph_desc_title), + _sph_desc(rhs._sph_desc), + _strip_cont_ind_title(rhs._strip_cont_ind_title), + _strip_cont_ind(rhs._strip_cont_ind), + _slice_pos_title(rhs._slice_pos_title), + _slice_position(rhs._slice_position), + _num_slices_title(rhs._num_slices_title), + _num_slices(rhs._num_slices), + _first_line_time_title(rhs._first_line_time_title), + _first_line_time(rhs._first_line_time), + _last_line_time_title(rhs._last_line_time_title), + _last_line_time(rhs._last_line_time), + _first_near_lat_title(rhs._first_near_lat_title), + _first_near_lat(rhs._first_near_lat), + _first_near_lat_units(rhs._first_near_lat_units), + _first_near_long_title(rhs._first_near_long_title), + _first_near_long(rhs._first_near_long), + _first_near_long_units(rhs._first_near_long_units), + _first_mid_lat_title(rhs._first_mid_lat_title), + _first_mid_lat(rhs._first_mid_lat), + _first_mid_lat_units(rhs._first_mid_lat_units), + _first_mid_long_title(rhs._first_mid_long_title), + _first_mid_long(rhs._first_mid_long), + _first_mid_long_units(rhs._first_mid_long_units), + _first_far_lat_title(rhs._first_far_lat_title), + _first_far_lat(rhs._first_far_lat), + _first_far_lat_units(rhs._first_far_lat_units), + _first_far_long_title(rhs._first_far_long_title), + _first_far_long(rhs._first_far_long), + _first_far_long_units(rhs._first_far_long_units), + _last_near_lat_title(rhs._last_near_lat_title), + _last_near_lat(rhs._last_near_lat), + _last_near_lat_units(rhs._last_near_lat_units), + _last_near_long_title(rhs._last_near_long_title), + _last_near_long(rhs._last_near_long), + _last_near_long_units(rhs._last_near_long_units), + _last_mid_lat_title(rhs._last_mid_lat_title), + _last_mid_lat(rhs._last_mid_lat), + _last_mid_lat_units(rhs._last_mid_lat_units), + _last_mid_long_title(rhs._last_mid_long_title), + _last_mid_long(rhs._last_mid_long), + _last_mid_long_units(rhs._last_mid_long_units), + _last_far_lat_title(rhs._last_far_lat_title), + _last_far_lat(rhs._last_far_lat), + _last_far_lat_units(rhs._last_far_lat_units), + _last_far_long_title(rhs._last_far_long_title), + _last_far_long(rhs._last_far_long), + _last_far_long_units(rhs._last_far_long_units), + _swath_title(rhs._swath_title), + _swath(rhs._swath), + _pass_title(rhs._pass_title), + _pass(rhs._pass), + _sample_type_title(rhs._sample_type_title), + _sample_type(rhs._sample_type), + _algo_title(rhs._algo_title), + _algorithm(rhs._algorithm), + _mds1_tx_rx_polar_title(rhs._mds1_tx_rx_polar_title), + _mds1_tx_rx_polar(rhs._mds1_tx_rx_polar), + _mds2_tx_rx_polar_title(rhs._mds2_tx_rx_polar_title), + _mds2_tx_rx_polar(rhs._mds2_tx_rx_polar), + _compression_title(rhs._compression_title), + _compression(rhs._compression), + _azimut_looks_title(rhs._azimut_looks_title), + _azimut_looks(rhs._azimut_looks), + _range_looks_title(rhs._range_looks_title), + _range_looks(rhs._range_looks), + _range_spacing_title(rhs._range_spacing_title), + _range_spacing(rhs._range_spacing), + _range_spacing_unit(rhs._range_spacing_unit), + _azimut_spacing_title(rhs._azimut_spacing_title), + _azimut_spacing(rhs._azimut_spacing), + _azimut_spacing_unit(rhs._azimut_spacing_unit), + _line_time_interval_title(rhs._line_time_interval_title), + _line_time_interval(rhs._line_time_interval), + _line_time_interv_units(rhs._line_time_interv_units), + _line_length_title(rhs._line_length_title), + _line_length(rhs._line_length), + _line_length_units(rhs._line_length_units), + _data_type_title(rhs._data_type_title), + _data_type(rhs._data_type) + {} + + +sph& sph::operator=(const sph& rhs) +{ + _sph_desc_title = rhs._sph_desc_title; + _sph_desc = rhs._sph_desc; + _strip_cont_ind_title = rhs._strip_cont_ind_title; + _strip_cont_ind = rhs._strip_cont_ind; + _slice_pos_title = rhs._slice_pos_title; + _slice_position = rhs._slice_position; + _num_slices_title = rhs._num_slices_title; + _num_slices = rhs._num_slices; + _first_line_time_title = rhs._first_line_time_title; + _first_line_time = rhs._first_line_time; + _last_line_time_title = rhs._last_line_time_title; + _last_line_time = rhs._last_line_time; + _first_near_lat_title = rhs._first_near_lat_title; + _first_near_lat = rhs._first_near_lat; + _first_near_lat_units = rhs._first_near_lat_units; + _first_near_long_title = rhs._first_near_long_title; + _first_near_long = rhs._first_near_long; + _first_near_long_units = rhs._first_near_long_units; + _first_mid_lat_title = rhs._first_mid_lat_title; + _first_mid_lat = rhs._first_mid_lat; + _first_mid_lat_units = rhs._first_mid_lat_units; + _first_mid_long_title = rhs._first_mid_long_title; + _first_mid_long = rhs._first_mid_long; + _first_mid_long_units = rhs._first_mid_long_units; + _first_far_lat_title = rhs._first_far_lat_title; + _first_far_lat = rhs._first_far_lat; + _first_far_lat_units = rhs._first_far_lat_units; + _first_far_long_title = rhs._first_far_long_title; + _first_far_long = rhs._first_far_long; + _first_far_long_units = rhs._first_far_long_units; + _last_near_lat_title = rhs._last_near_lat_title; + _last_near_lat = rhs._last_near_lat; + _last_near_lat_units = rhs._last_near_lat_units; + _last_near_long_title = rhs._last_near_long_title; + _last_near_long = rhs._last_near_long; + _last_near_long_units = rhs._last_near_long_units; + _last_mid_lat_title = rhs._last_mid_lat_title; + _last_mid_lat = rhs._last_mid_lat; + _last_mid_lat_units = rhs._last_mid_lat_units; + _last_mid_long_title = rhs._last_mid_long_title; + _last_mid_long = rhs._last_mid_long; + _last_mid_long_units = rhs._last_mid_long_units; + _last_far_lat_title = rhs._last_far_lat_title; + _last_far_lat = rhs._last_far_lat; + _last_far_lat_units = rhs._last_far_lat_units; + _last_far_long_title = rhs._last_far_long_title; + _last_far_long = rhs._last_far_long; + _last_far_long_units = rhs._last_far_long_units; + _swath_title = rhs._swath_title; + _swath = rhs._swath; + _pass_title = rhs._pass_title; + _pass = rhs._pass; + _sample_type_title = rhs._sample_type_title; + _sample_type = rhs._sample_type; + _algo_title = rhs._algo_title; + _algorithm = rhs._algorithm; + _mds1_tx_rx_polar_title = rhs._mds1_tx_rx_polar_title; + _mds1_tx_rx_polar = rhs._mds1_tx_rx_polar; + _mds2_tx_rx_polar_title = rhs._mds2_tx_rx_polar_title; + _mds2_tx_rx_polar = rhs._mds2_tx_rx_polar; + _compression_title = rhs._compression_title; + _compression = rhs._compression; + _azimut_looks_title = rhs._azimut_looks_title; + _azimut_looks = rhs._azimut_looks; + _range_looks_title = rhs._range_looks_title; + _range_looks = rhs._range_looks; + _range_spacing_title = rhs._range_spacing_title; + _range_spacing = rhs._range_spacing; + _range_spacing_unit = rhs._range_spacing_unit; + _azimut_spacing_title = rhs._azimut_spacing_title; + _azimut_spacing = rhs._azimut_spacing; + _azimut_spacing_unit = rhs._azimut_spacing_unit; + _line_time_interval_title = rhs._line_time_interval_title; + _line_time_interval = rhs._line_time_interval; + _line_time_interv_units = rhs._line_time_interv_units; + _line_length_title = rhs._line_length_title; + _line_length = rhs._line_length; + _line_length_units = rhs._line_length_units; + _data_type_title = rhs._data_type_title; + _data_type = rhs._data_type; + + return *this; +} +} diff --git a/Utilities/otbossimplugins/ossim/EnvisatAsar/sph.h b/Utilities/otbossimplugins/ossim/EnvisatAsar/sph.h new file mode 100644 index 0000000000000000000000000000000000000000..19b45a85006fc6cc2c6cc0b06d7da1dbe3377741 --- /dev/null +++ b/Utilities/otbossimplugins/ossim/EnvisatAsar/sph.h @@ -0,0 +1,1016 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#ifndef sph_h +#define sph_h + +#include <iostream> +#include <vector> +#include <EnvisatAsar/EnvisatAsarRecord.h> +#include <EnvisatAsar/mph.h> +#include <EnvisatAsar/dsd.h> + +namespace ossimplugins +{ +/** + * @ingroup sphRecord + * @brief This class is able to read the SAR sph record of the ASAR file + */ +class sph : public EnvisatAsarRecord +{ +public: + /** + * @brief Constructor + */ + sph(); + + /** + * @brief Constructor Using an mph record to initialize num_dsd and dsd_size + */ + sph(const mph& data); + /** + * @brief Destructor + */ + ~sph(); + + /** + * @brief This function write the sph in a stream + */ + friend std::ostream& operator<<(std::ostream& os, const sph& data); + + /** + * @brief This function read a sph from a stream + */ + friend std::istream& operator>>(std::istream& is, sph& data); + + /** + * @brief Copy constructor + */ + sph(const sph& rhs); + + /** + * @brief Copy operator + */ + sph& operator=(const sph& rhs); + + /** + * @brief This function is able to create a new instance of the class + */ + EnvisatAsarRecord* Instanciate() + { + return new sph(); + }; + + /** + * @brief This function is able to create a new instance of the class initialised with the data of the calling instance + */ + EnvisatAsarRecord* Clone() + { + return new sph(*this); + }; + + /** + * @brief Read the class data from a stream + */ + void Read(std::istream& is) + { + is>>*this; + }; + + /** + * @brief Write the class to a stream + */ + void Write(std::ostream& os) + { + os<<*this; + }; + + /** + * @brief sph_desc_title + */ + std::string get_sph_desc_title() + { + return _sph_desc_title; + }; + /** + * @brief sph_desc + */ + std::string get_sph_desc() + { + return _sph_desc; + }; + /** + * @brief strip_cont_ind_title + */ + std::string get_strip_cont_ind_title() + { + return _strip_cont_ind_title; + }; + /** + * @brief strip_cont_ind + */ + std::string get_strip_cont_ind() + { + return _strip_cont_ind; + }; + /** + * @brief slice_pos_title + */ + std::string get_slice_pos_title() + { + return _slice_pos_title; + }; + /** + * @brief slice_position + */ + std::string get_slice_position() + { + return _slice_position; + }; + /** + * @brief num_slices_title + */ + std::string get_num_slices_title() + { + return _num_slices_title; + }; + /** + * @brief num_slices + */ + std::string get_num_slices() + { + return _num_slices; + }; + /** + * @brief first_line_time_title + */ + std::string get_first_line_time_title() + { + return _first_line_time_title; + }; + /** + * @brief first_line_time + */ + std::string get_first_line_time() + { + return _first_line_time; + }; + /** + * @brief last_line_time_title + */ + std::string get_last_line_time_title() + { + return _last_line_time_title; + }; + /** + * @brief last_line_time + */ + std::string get_last_line_time() + { + return _last_line_time; + }; + /** + * @brief first_near_lat_title + */ + std::string get_first_near_lat_title() + { + return _first_near_lat_title; + }; + /** + * @brief first_near_lat + */ + std::string get_first_near_lat() + { + return _first_near_lat; + }; + /** + * @brief first_near_lat_units + */ + std::string get_first_near_lat_units() + { + return _first_near_lat_units; + }; + /** + * @brief first_near_long_title + */ + std::string get_first_near_long_title() + { + return _first_near_long_title; + }; + /** + * @brief first_near_long + */ + std::string get_first_near_long() + { + return _first_near_long; + }; + /** + * @brief first_near_long_units + */ + std::string get_first_near_long_units() + { + return _first_near_long_units; + }; + /** + * @brief first_mid_lat_title + */ + std::string get_first_mid_lat_title() + { + return _first_mid_lat_title; + }; + /** + * @brief first_mid_lat + */ + std::string get_first_mid_lat() + { + return _first_mid_lat; + }; + /** + * @brief first_mid_lat_units + */ + std::string get_first_mid_lat_units() + { + return _first_mid_lat_units; + }; + /** + * @brief first_mid_long_title + */ + std::string get_first_mid_long_title() + { + return _first_mid_long_title; + }; + /** + * @brief first_mid_long + */ + std::string get_first_mid_long() + { + return _first_mid_long; + }; + /** + * @brief first_mid_long_units + */ + std::string get_first_mid_long_units() + { + return _first_mid_long_units; + }; + /** + * @brief first_far_lat_title + */ + std::string get_first_far_lat_title() + { + return _first_far_lat_title; + }; + /** + * @brief first_far_lat + */ + std::string get_first_far_lat() + { + return _first_far_lat; + }; + /** + * @brief first_far_lat_units + */ + std::string get_first_far_lat_units() + { + return _first_far_lat_units; + }; + /** + * @brief first_far_long_title + */ + std::string get_first_far_long_title() + { + return _first_far_long_title; + }; + /** + * @brief first_far_long + */ + std::string get_first_far_long() + { + return _first_far_long; + }; + /** + * @brief first_far_long_units + */ + std::string get_first_far_long_units() + { + return _first_far_long_units; + }; + /** + * @brief last_near_lat_title + */ + std::string get_last_near_lat_title() + { + return _last_near_lat_title; + }; + /** + * @brief last_near_lat + */ + std::string get_last_near_lat() + { + return _last_near_lat; + }; + /** + * @brief last_near_lat_units + */ + std::string get_last_near_lat_units() + { + return _last_near_lat_units; + }; + /** + * @brief last_near_long_title + */ + std::string get_last_near_long_title() + { + return _last_near_long_title; + }; + /** + * @brief last_near_long + */ + std::string get_last_near_long() + { + return _last_near_long; + }; + /** + * @brief last_near_long_units + */ + std::string get_last_near_long_units() + { + return _last_near_long_units; + }; + /** + * @brief last_mid_lat_title + */ + std::string get_last_mid_lat_title() + { + return _last_mid_lat_title; + }; + /** + * @brief last_mid_lat + */ + std::string get_last_mid_lat() + { + return _last_mid_lat; + }; + /** + * @brief last_mid_lat_units + */ + std::string get_last_mid_lat_units() + { + return _last_mid_lat_units; + }; + /** + * @brief last_mid_long_title + */ + std::string get_last_mid_long_title() + { + return _last_mid_long_title; + }; + /** + * @brief last_mid_long + */ + std::string get_last_mid_long() + { + return _last_mid_long; + }; + /** + * @brief last_mid_long_units + */ + std::string get_last_mid_long_units() + { + return _last_mid_long_units; + }; + /** + * @brief last_far_lat_title + */ + std::string get_last_far_lat_title() + { + return _last_far_lat_title; + }; + /** + * @brief last_far_lat + */ + std::string get_last_far_lat() + { + return _last_far_lat; + }; + /** + * @brief last_far_lat_units + */ + std::string get_last_far_lat_units() + { + return _last_far_lat_units; + }; + /** + * @brief last_far_long_title + */ + std::string get_last_far_long_title() + { + return _last_far_long_title; + }; + /** + * @brief last_far_long + */ + std::string get_last_far_long() + { + return _last_far_long; + }; + /** + * @brief last_far_long_units + */ + std::string get_last_far_long_units() + { + return _last_far_long_units; + }; + /** + * @brief swath_title + */ + std::string get_swath_title() + { + return _swath_title; + }; + /** + * @brief swath + */ + std::string get_swath() + { + return _swath; + }; + /** + * @brief pass_title + */ + std::string get_pass_title() + { + return _pass_title; + }; + /** + * @brief pass + */ + std::string get_pass() + { + return _pass; + }; + /** + * @brief sample_type_title + */ + std::string get_sample_type_title() + { + return _sample_type_title; + }; + /** + * @brief sample_type + */ + std::string get_sample_type() + { + return _sample_type; + }; + /** + * @brief algo_title + */ + std::string get_algo_title() + { + return _algo_title; + }; + /** + * @brief algorithm + */ + std::string get_algorithm() + { + return _algorithm; + }; + /** + * @brief mds1_tx_rx_polar_title + */ + std::string get_mds1_tx_rx_polar_title() + { + return _mds1_tx_rx_polar_title; + }; + /** + * @brief mds1_tx_rx_polar + */ + std::string get_mds1_tx_rx_polar() + { + return _mds1_tx_rx_polar; + }; + /** + * @brief mds2_tx_rx_polar_title + */ + std::string get_mds2_tx_rx_polar_title() + { + return _mds2_tx_rx_polar_title; + }; + /** + * @brief mds2_tx_rx_polar + */ + std::string get_mds2_tx_rx_polar() + { + return _mds2_tx_rx_polar; + }; + /** + * @brief compression_title + */ + std::string get_compression_title() + { + return _compression_title; + }; + /** + * @brief compression + */ + std::string get_compression() + { + return _compression; + }; + /** + * @brief azimut_looks_title + */ + std::string get_azimut_looks_title() + { + return _azimut_looks_title; + }; + /** + * @brief azimut_looks + */ + std::string get_azimut_looks() + { + return _azimut_looks; + }; + /** + * @brief range_looks_title + */ + std::string get_range_looks_title() + { + return _range_looks_title; + }; + /** + * @brief range_looks + */ + std::string get_range_looks() + { + return _range_looks; + }; + /** + * @brief range_spacing_title + */ + std::string get_range_spacing_title() + { + return _range_spacing_title; + }; + /** + * @brief range_spacing + */ + std::string get_range_spacing() + { + return _range_spacing; + }; + /** + * @brief range_spacing_unit + */ + std::string get_range_spacing_unit() + { + return _range_spacing_unit; + }; + /** + * @brief azimut_spacing_title + */ + std::string get_azimut_spacing_title() + { + return _azimut_spacing_title; + }; + /** + * @brief azimut_spacing + */ + std::string get_azimut_spacing() + { + return _azimut_spacing; + }; + /** + * @brief azimut_spacing_unit + */ + std::string get_azimut_spacing_unit() + { + return _azimut_spacing_unit; + }; + /** + * @brief line_time_interval_title + */ + std::string get_line_time_interval_title() + { + return _line_time_interval_title; + }; + /** + * @brief line_time_interval + */ + std::string get_line_time_interval() + { + return _line_time_interval; + }; + /** + * @brief line_time_interv_units + */ + std::string get_line_time_interv_units() + { + return _line_time_interv_units; + }; + /** + * @brief line_length_title + */ + std::string get_line_length_title() + { + return _line_length_title; + }; + /** + * @brief line_length + */ + std::string get_line_length() + { + return _line_length; + }; + /** + * @brief line_length_units + */ + std::string get_line_length_units() + { + return _line_length_units; + }; + /** + * @brief data_type_title + */ + std::string get_data_type_title() + { + return _data_type_title; + }; + /** + * @brief data_type + */ + std::string get_data_type() + { + return _data_type; + }; + /** + * @brief data_type + */ + std::vector<dsd> get_dsd_vector() + { + return _dsd_vector; + } + + /** + * @brief update DSD number and dsd size from a mph record + */ + bool update_sph_from_mph( mph& mph_rec) + { + _num_dsd = mph_rec._num_dsd; + _size_dsd = mph_rec._dsd_size; + + return 1; + }; + + +protected: + /** + * @brief Number of Data Set Descriptors (DSD) + */ + long _num_dsd; + + /** + * @brief Size of each Data Set Descriptors (DSD) + */ + long _size_dsd; + + /** + * @brief sph_desc_title + */ + std::string _sph_desc_title; + /** + * @brief sph_desc + */ + std::string _sph_desc; + /** + * @brief strip_cont_ind_title + */ + std::string _strip_cont_ind_title; + /** + * @brief strip_cont_ind + */ + std::string _strip_cont_ind; + /** + * @brief slice_pos_title + */ + std::string _slice_pos_title; + /** + * @brief slice_position + */ + std::string _slice_position; + /** + * @brief num_slices_title + */ + std::string _num_slices_title; + /** + * @brief num_slices + */ + std::string _num_slices; + /** + * @brief first_line_time_title + */ + std::string _first_line_time_title; + /** + * @brief first_line_time + */ + std::string _first_line_time; + /** + * @brief last_line_time_title + */ + std::string _last_line_time_title; + /** + * @brief last_line_time + */ + std::string _last_line_time; + /** + * @brief first_near_lat_title + */ + std::string _first_near_lat_title; + /** + * @brief first_near_lat + */ + std::string _first_near_lat; + /** + * @brief first_near_lat_units + */ + std::string _first_near_lat_units; + /** + * @brief first_near_long_title + */ + std::string _first_near_long_title; + /** + * @brief first_near_long + */ + std::string _first_near_long; + /** + * @brief first_near_long_units + */ + std::string _first_near_long_units; + /** + * @brief first_mid_lat_title + */ + std::string _first_mid_lat_title; + /** + * @brief first_mid_lat + */ + std::string _first_mid_lat; + /** + * @brief first_mid_lat_units + */ + std::string _first_mid_lat_units; + /** + * @brief first_mid_long_title + */ + std::string _first_mid_long_title; + /** + * @brief first_mid_long + */ + std::string _first_mid_long; + /** + * @brief first_mid_long_units + */ + std::string _first_mid_long_units; + /** + * @brief first_far_lat_title + */ + std::string _first_far_lat_title; + /** + * @brief first_far_lat + */ + std::string _first_far_lat; + /** + * @brief first_far_lat_units + */ + std::string _first_far_lat_units; + /** + * @brief first_far_long_title + */ + std::string _first_far_long_title; + /** + * @brief first_far_long + */ + std::string _first_far_long; + /** + * @brief first_far_long_units + */ + std::string _first_far_long_units; + /** + * @brief last_near_lat_title + */ + std::string _last_near_lat_title; + /** + * @brief last_near_lat + */ + std::string _last_near_lat; + /** + * @brief last_near_lat_units + */ + std::string _last_near_lat_units; + /** + * @brief last_near_long_title + */ + std::string _last_near_long_title; + /** + * @brief last_near_long + */ + std::string _last_near_long; + /** + * @brief last_near_long_units + */ + std::string _last_near_long_units; + /** + * @brief last_mid_lat_title + */ + std::string _last_mid_lat_title; + /** + * @brief last_mid_lat + */ + std::string _last_mid_lat; + /** + * @brief last_mid_lat_units + */ + std::string _last_mid_lat_units; + /** + * @brief last_mid_long_title + */ + std::string _last_mid_long_title; + /** + * @brief last_mid_long + */ + std::string _last_mid_long; + /** + * @brief last_mid_long_units + */ + std::string _last_mid_long_units; + /** + * @brief last_far_lat_title + */ + std::string _last_far_lat_title; + /** + * @brief last_far_lat + */ + std::string _last_far_lat; + /** + * @brief last_far_lat_units + */ + std::string _last_far_lat_units; + /** + * @brief last_far_long_title + */ + std::string _last_far_long_title; + /** + * @brief last_far_long + */ + std::string _last_far_long; + /** + * @brief last_far_long_units + */ + std::string _last_far_long_units; + /** + * @brief swath_title + */ + std::string _swath_title; + /** + * @brief swath + */ + std::string _swath; + /** + * @brief pass_title + */ + std::string _pass_title; + /** + * @brief pass + */ + std::string _pass; + /** + * @brief sample_type_title + */ + std::string _sample_type_title; + /** + * @brief sample_type + */ + std::string _sample_type; + /** + * @brief algo_title + */ + std::string _algo_title; + /** + * @brief algorithm + */ + std::string _algorithm; + /** + * @brief mds1_tx_rx_polar_title + */ + std::string _mds1_tx_rx_polar_title; + /** + * @brief mds1_tx_rx_polar + */ + std::string _mds1_tx_rx_polar; + /** + * @brief mds2_tx_rx_polar_title + */ + std::string _mds2_tx_rx_polar_title; + /** + * @brief mds2_tx_rx_polar + */ + std::string _mds2_tx_rx_polar; + /** + * @brief compression_title + */ + std::string _compression_title; + /** + * @brief compression + */ + std::string _compression; + /** + * @brief azimut_looks_title + */ + std::string _azimut_looks_title; + /** + * @brief azimut_looks + */ + std::string _azimut_looks; + /** + * @brief range_looks_title + */ + std::string _range_looks_title; + /** + * @brief range_looks + */ + std::string _range_looks; + /** + * @brief range_spacing_title + */ + std::string _range_spacing_title; + /** + * @brief range_spacing + */ + std::string _range_spacing; + /** + * @brief range_spacing_unit + */ + std::string _range_spacing_unit; + /** + * @brief azimut_spacing_title + */ + std::string _azimut_spacing_title; + /** + * @brief azimut_spacing + */ + std::string _azimut_spacing; + /** + * @brief azimut_spacing_unit + */ + std::string _azimut_spacing_unit; + /** + * @brief line_time_interval_title + */ + std::string _line_time_interval_title; + /** + * @brief line_time_interval + */ + std::string _line_time_interval; + /** + * @brief line_time_interv_units + */ + std::string _line_time_interv_units; + /** + * @brief line_length_title + */ + std::string _line_length_title; + /** + * @brief line_length + */ + std::string _line_length; + /** + * @brief line_length_units + */ + std::string _line_length_units; + /** + * @brief data_type_title + */ + std::string _data_type_title; + /** + * @brief data_type + */ + std::string _data_type; + /** + * @brief DSD records + */ + std::vector<dsd> _dsd_vector; + +private: + +}; +} +#endif diff --git a/Utilities/otbossimplugins/ossim/ossimEnvisatAsarModel.cpp b/Utilities/otbossimplugins/ossim/ossimEnvisatAsarModel.cpp index ceba52f41595545327d9b9d44f200b5e2e32b8ae..553362127046d2dc803c3e02e54d9e82b6cc1df1 100644 --- a/Utilities/otbossimplugins/ossim/ossimEnvisatAsarModel.cpp +++ b/Utilities/otbossimplugins/ossim/ossimEnvisatAsarModel.cpp @@ -9,6 +9,9 @@ //---------------------------------------------------------------------------- // $Id$ +#include <ossim/base/ossimTrace.h> +#include <ossim/base/ossimKeywordNames.h> + #include <ossimEnvisatAsarModel.h> #include <otb/GalileanEphemeris.h> #include <otb/GeographicEphemeris.h> @@ -30,14 +33,34 @@ namespace ossimplugins RTTI_DEF1(ossimEnvisatAsarModel, "ossimEnvisatAsarModel", ossimGeometricSarSensorModel); +// Static trace for debugging +static ossimTrace traceDebug("ossimEnvisatAsarModel:debug"); + ossimEnvisatAsarModel::ossimEnvisatAsarModel(): _n_srgr(0), - _pixel_spacing(0) + _pixel_spacing(0), + _EnvisatAsarData(NULL) { } + + ossimEnvisatAsarModel::~ossimEnvisatAsarModel() { + if(_EnvisatAsarData != NULL) + { + delete _EnvisatAsarData; + } +} + +ossimString ossimEnvisatAsarModel::getClassName() const +{ + return ossimString("ossimEnvisatAsarModel"); +} + +ossimObject* ossimEnvisatAsarModel::dup() const +{ + return new ossimEnvisatAsarModel(*this); } double ossimEnvisatAsarModel::getSlantRangeFromGeoreferenced(double col) const @@ -63,6 +86,281 @@ double ossimEnvisatAsarModel::getSlantRangeFromGeoreferenced(double col) const return slantRange ; } + +bool ossimEnvisatAsarModel::open(const ossimFilename& file) +{ + bool retValue = true; + + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) << "ossimEnvisatAsarTileSource::open(filename) DEBUG: entered..." << std::endl + << "Attempting to open file " << file << std::endl; + } + + /* + * Creation of the class allowing to store EnvisatAsarData file metadata + */ + if (_EnvisatAsarData != NULL) + { + delete _EnvisatAsarData; + _EnvisatAsarData = NULL; + } + + /* + * Opening and test of the file + */ + ossimFilename Filename = file; + ifstream dataFile(Filename, ios::in | ios::binary); + if (dataFile.eof()) + { + dataFile.close(); + retValue = false; + } + else + { + mph mph_rec; + dataFile >> mph_rec; + + // test if it is an ENVISAT Data file + if (mph_rec.is_valid()) + { + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) << "Begin reading EnvisatAsar file" << std::endl; + } + /* + * Reading EnvisatAsarData file data + */ + dataFile.seekg(0); + _EnvisatAsarData = new EnvisatAsarData(); + dataFile >> *_EnvisatAsarData; + dataFile.close(); + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) << "End reading EnvisatAsar file" << std::endl; + } + } + else + { + dataFile.close(); + retValue = false; + } + } + + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) << "ossimEnvisatAsarTileSource::open() DEBUG: returning..." << std::endl; + } + + return retValue; +} + + +bool ossimEnvisatAsarModel::saveState(ossimKeywordlist& kwl, + const char* prefix) const +{ + char name[64]; + + kwl.add(prefix, ossimKeywordNames::TYPE_KW, "ossimEnvisatAsarModel", true); + + /* + * Adding metadata necessary to the sensor model into the keywordlist + * Data derived from the SPH record + */ + sph* sph_rec = _EnvisatAsarData->get_sph(); + if(sph_rec != NULL) + { + kwl.add(prefix, "pixel_spacing", sph_rec->get_range_spacing().c_str(), true ); + kwl.add(prefix, "line_time_interval", sph_rec->get_line_time_interval().c_str(), true ); + } + else + { + return false; + } + /* + * Adding metadata necessary to the sensor model into the keywordlist + * Data derived from the Main Processing Parameters record + */ + MainProcessingParameters* MPP_rec = _EnvisatAsarData->get_MainProcessingParameters(); + if(MPP_rec != NULL) + { + kwl.add(prefix, "num_pix", (double)MPP_rec->get_num_samples_per_line(), true ); + kwl.add(prefix, "num_lines", (double)MPP_rec->get_num_output_lines(), true ); + kwl.add(prefix, "wave_length", MPP_rec->get_radar_freq(), true ); + kwl.add(prefix, "range_sampling_rate", MPP_rec->get_range_samp_rate(), true ); + kwl.add(prefix, "prf", MPP_rec->get_prf(), true ); + kwl.add(prefix, "avg_scene_height", MPP_rec->get_avg_scene_height_ellpsoid(), true ); + kwl.add(prefix, "is_groundrange", MPP_rec->get_srgr_flag(), true ); + kwl.add(prefix, "state_vector_time_1_day", (double)MPP_rec->get_state_vector_time_1_day(), true ); + kwl.add(prefix, "state_vector_time_1_sec", (double)MPP_rec->get_state_vector_time_1_sec(), true ); + kwl.add(prefix, "state_vector_time_1_microsec", (double)MPP_rec->get_state_vector_time_1_microsec(), true ); + kwl.add(prefix, "x_pos_1", (double)MPP_rec->get_x_pos_1(), true ); + kwl.add(prefix, "y_pos_1", (double)MPP_rec->get_y_pos_1(), true ); + kwl.add(prefix, "z_pos_1", (double)MPP_rec->get_z_pos_1(), true ); + kwl.add(prefix, "x_vel_1", (double)MPP_rec->get_x_vel_1(), true ); + kwl.add(prefix, "y_vel_1", (double)MPP_rec->get_y_vel_1(), true ); + kwl.add(prefix, "z_vel_1", (double)MPP_rec->get_z_vel_1(), true ); + kwl.add(prefix, "state_vector_time_2_day",(double) MPP_rec->get_state_vector_time_2_day(), true ); + kwl.add(prefix, "state_vector_time_2_sec", (double)MPP_rec->get_state_vector_time_2_sec(), true ); + kwl.add(prefix, "state_vector_time_2_microsec", (double)MPP_rec->get_state_vector_time_2_microsec(), true ); + kwl.add(prefix, "x_pos_2", (double)MPP_rec->get_x_pos_2(), true ); + kwl.add(prefix, "y_pos_2", (double)MPP_rec->get_y_pos_2(), true ); + kwl.add(prefix, "z_pos_2", (double)MPP_rec->get_z_pos_2(), true ); + kwl.add(prefix, "x_vel_2", (double)MPP_rec->get_x_vel_2(), true ); + kwl.add(prefix, "y_vel_2", (double)MPP_rec->get_y_vel_2(), true ); + kwl.add(prefix, "z_vel_2", (double)MPP_rec->get_z_vel_2(), true ); + kwl.add(prefix, "state_vector_time_3_day", (double)MPP_rec->get_state_vector_time_3_day(), true ); + kwl.add(prefix, "state_vector_time_3_sec", (double)MPP_rec->get_state_vector_time_3_sec(), true ); + kwl.add(prefix, "state_vector_time_3_microsec", (double)MPP_rec->get_state_vector_time_3_microsec(), true ); + kwl.add(prefix, "x_pos_3", (double)MPP_rec->get_x_pos_3(), true ); + kwl.add(prefix, "y_pos_3", (double)MPP_rec->get_y_pos_3(), true ); + kwl.add(prefix, "z_pos_3", (double)MPP_rec->get_z_pos_3(), true ); + kwl.add(prefix, "x_vel_3", (double)MPP_rec->get_x_vel_3(), true ); + kwl.add(prefix, "y_vel_3", (double)MPP_rec->get_y_vel_3(), true ); + kwl.add(prefix, "z_vel_3", (double)MPP_rec->get_z_vel_3(), true ); + kwl.add(prefix, "state_vector_time_4_day", (double)MPP_rec->get_state_vector_time_4_day(), true ); + kwl.add(prefix, "state_vector_time_4_sec", (double)MPP_rec->get_state_vector_time_4_sec(), true ); + kwl.add(prefix, "state_vector_time_4_microsec", (double)MPP_rec->get_state_vector_time_4_microsec(), true ); + kwl.add(prefix, "x_pos_4", (double)MPP_rec->get_x_pos_4(), true ); + kwl.add(prefix, "y_pos_4", (double)MPP_rec->get_y_pos_4(), true ); + kwl.add(prefix, "z_pos_4", (double)MPP_rec->get_z_pos_4(), true ); + kwl.add(prefix, "x_vel_4", (double)MPP_rec->get_x_vel_4(), true ); + kwl.add(prefix, "y_vel_4", (double)MPP_rec->get_y_vel_4(), true ); + kwl.add(prefix, "z_vel_4", (double)MPP_rec->get_z_vel_4(), true ); + kwl.add(prefix, "state_vector_time_5_day", (double)MPP_rec->get_state_vector_time_5_day(), true ); + kwl.add(prefix, "state_vector_time_5_sec", (double)MPP_rec->get_state_vector_time_5_sec(), true ); + kwl.add(prefix, "state_vector_time_5_microsec", (double)MPP_rec->get_state_vector_time_5_microsec(), true ); + kwl.add(prefix, "x_pos_5", (double)MPP_rec->get_x_pos_5(), true ); + kwl.add(prefix, "y_pos_5",(double) MPP_rec->get_y_pos_5(), true ); + kwl.add(prefix, "z_pos_5", (double)MPP_rec->get_z_pos_5(), true ); + kwl.add(prefix, "x_vel_5", (double)MPP_rec->get_x_vel_5(), true ); + kwl.add(prefix, "y_vel_5", (double)MPP_rec->get_y_vel_5(), true ); + kwl.add(prefix, "z_vel_5", (double)MPP_rec->get_z_vel_5(), true ); + } + else + { + return false; + } + /* + * Adding metadata necessary to the sensor model into the keywordlist + * Data derived from the Geolocation Grid record - Reference Point + */ + GeolocationGrid* GG_rec = _EnvisatAsarData->get_GeolocationGrid(0); + if(GG_rec != NULL) + { + kwl.add(prefix, "first_zero_doppler_time_day", (double)GG_rec->get_first_zero_doppler_time_day(), true ); + kwl.add(prefix, "first_zero_doppler_time_sec", (double)GG_rec->get_first_zero_doppler_time_sec(), true ); + kwl.add(prefix, "first_zero_doppler_time_microsec", (double)GG_rec->get_first_zero_doppler_time_microsec(), true ); + kwl.add(prefix, "line_num", (double)GG_rec->get_line_num(), true ); + kwl.add(prefix, "samp_num", (double)(GG_rec->get_samp_numbers())[0], true ); + kwl.add(prefix, "slant_range_time", (double)(GG_rec->get_slant_range_times())[0], true ); + } + else + { + return false; + } + /* + * Adding metadata necessary to the sensor model into the keywordlist + * Data derived from the Geolocation Grid record - Corners + */ + GG_rec = _EnvisatAsarData->get_GeolocationGrid(0); + if(GG_rec != NULL) + { + kwl.add(prefix, "UL_line", (double)GG_rec->get_line_num(), true ); + kwl.add(prefix, "UL_col", (double)(GG_rec->get_samp_numbers())[0], true ); + kwl.add(prefix, "UL_lat", (double)(GG_rec->get_lats())[0], true ); + kwl.add(prefix, "UL_lon", (double)(GG_rec->get_longs())[0], true ); + kwl.add(prefix, "UR_line", (double)GG_rec->get_line_num(), true ); + kwl.add(prefix, "UR_col", (double)(GG_rec->get_samp_numbers())[10], true ); + kwl.add(prefix, "UR_lat", (double)(GG_rec->get_lats())[10], true ); + kwl.add(prefix, "UR_lon", (double)(GG_rec->get_longs())[10], true ); + } + else + { + return false; + } + GG_rec = _EnvisatAsarData->get_GeolocationGrid(10); + if(GG_rec != NULL) + { + kwl.add(prefix, "LL_line", (double)GG_rec->get_line_num(), true ); + kwl.add(prefix, "LL_col", (double)(GG_rec->get_samp_numbers())[0], true ); + kwl.add(prefix, "LL_lat", (double)(GG_rec->get_lats())[0], true ); + kwl.add(prefix, "LL_lon", (double)(GG_rec->get_longs())[0], true ); + kwl.add(prefix, "LR_line", (double)GG_rec->get_line_num(), true ); + kwl.add(prefix, "LR_col", (double)(GG_rec->get_samp_numbers())[10], true ); + kwl.add(prefix, "LR_lat", (double)(GG_rec->get_lats())[10], true ); + kwl.add(prefix, "LR_lon", (double)(GG_rec->get_longs())[10], true ); + } + else + { + return false; + } + + /* + * Adding metadata necessary to the sensor model into the keywordlist + */ + int n_srgr = 0; + SRGRConversionParameters * SRGRParameters = _EnvisatAsarData->get_SRGRConversionParameters(0); + if(SRGRParameters != NULL) + { + n_srgr = _EnvisatAsarData->get_num_ds(SRGRParameters); + + for (int i=0;i<n_srgr;i++) + { + SRGRConversionParameters * SRGR = _EnvisatAsarData->get_SRGRConversionParameters(i); + + sprintf(name,"srgr_update_day%i",i); + kwl.add(prefix, name, (double)SRGR->get_first_zero_doppler_time_day(),true); + + sprintf(name,"srgr_update_sec%i",i); + kwl.add(prefix, name, (double)SRGR->get_first_zero_doppler_time_sec(),true); + + sprintf(name,"srgr_update_microsec%i",i); + kwl.add(prefix, name, (double)SRGR->get_first_zero_doppler_time_microsec(),true); + + sprintf(name,"srgr_coef%iA",i); + kwl.add(prefix, name,(double)SRGR->get_ground_range_origin(),true); + + sprintf(name,"srgr_coef%iB",i); + kwl.add(prefix, name,(double)SRGR->get_srgr_coef()[0],true); + sprintf(name,"srgr_coef%iC",i); + kwl.add(prefix, name,(double)SRGR->get_srgr_coef()[1],true); + sprintf(name,"srgr_coef%iD",i); + kwl.add(prefix, name,(double)SRGR->get_srgr_coef()[2],true); + sprintf(name,"srgr_coef%iE",i); + kwl.add(prefix, name,(double)SRGR->get_srgr_coef()[3]*1e10,true); + sprintf(name,"srgr_coef%iF",i); + kwl.add(prefix, name,(double)SRGR->get_srgr_coef()[4]*1e10,true); + } + } + + kwl.add(prefix, "n_srgr" , n_srgr,true); + + return true; +} + +bool ossimEnvisatAsarModel::loadState (const ossimKeywordlist &kwl, + const char *prefix) +{ + InitSensorParams(kwl, prefix); + InitPlatformPosition(kwl, prefix); + InitRefPoint(kwl, prefix); + InitSRGR(kwl, prefix); + +} +std::ostream& ossimEnvisatAsarModel::print(std::ostream& out) const +{ + static const char MODULE[] = "ossimplugins::ossimEnvisatAsarModel::print"; + // Capture the original flags. + std::ios_base::fmtflags f = out.flags(); + + out << setprecision(15) << setiosflags(ios::fixed) + << "\nossimEnvisatAsarModel data members:\n" + << "Nothing for now..."; + + return out; +} + bool ossimEnvisatAsarModel::InitSensorParams(const ossimKeywordlist &kwl, const char *prefix) { const double CLUM = 2.99792458e+8; diff --git a/Utilities/otbossimplugins/ossim/ossimEnvisatAsarModel.h b/Utilities/otbossimplugins/ossim/ossimEnvisatAsarModel.h index 7e82be818dbb35bae00a8d27bc20b95ed93cd98b..5de457f42eec8940a905b479d2a8abfd7f712cf3 100644 --- a/Utilities/otbossimplugins/ossim/ossimEnvisatAsarModel.h +++ b/Utilities/otbossimplugins/ossim/ossimEnvisatAsarModel.h @@ -19,6 +19,7 @@ #include <ossim/base/ossimFilename.h> #include <ossim/base/ossimGpt.h> #include <ossim/base/ossimDpt.h> +#include <EnvisatAsar/EnvisatAsarData.h> #include <iostream> @@ -44,7 +45,18 @@ public: /** * @brief Destructor */ - ~ossimEnvisatAsarModel(); + virtual ~ossimEnvisatAsarModel(); + + /** + * @brief Method to return the class name. + * @return The name of this class. + */ + virtual ossimString getClassName() const; + + /** + * @brief Returns pointer to a new instance, copy of this. + */ + virtual ossimObject* dup() const; /** * @brief This function associates an image column number to a slant range when the image is georeferenced (ground projected) @@ -52,6 +64,37 @@ public: */ virtual double getSlantRangeFromGeoreferenced(double col) const; + /** + * @brief Method to intantial model from a file. + * + * @param file + * + * @return true on success, false on error. + */ + bool open(const ossimFilename& file); + + /** + * @brief Method to save object state to a keyword list. + * @param kwl Keyword list to save to. + * @param prefix added to keys when saved. + * @return true on success, false on error. + */ + virtual bool saveState(ossimKeywordlist& kwl, + const char* prefix=0) const; + + /** + * @brief Method to the load (recreate) the state of the object from a + * keyword list. Return true if ok or false on error. + * @return true if load OK, false on error + */ + virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=0); + + /*! + * METHOD: print() + * Fulfills base-class pure virtual. Dumps contents of object to ostream. + */ + virtual std::ostream& print(std::ostream& out) const; + protected: /** @@ -84,6 +127,12 @@ private: */ std::vector<double> FindSRGRSetNumber(JSDDateTime date) const; TYPE_DATA + + /** + * @brief List of metadata contained in the Data file + */ + EnvisatAsarData * _EnvisatAsarData; + }; } diff --git a/Utilities/otbossimplugins/ossim/ossimPluginProjectionFactory.cpp b/Utilities/otbossimplugins/ossim/ossimPluginProjectionFactory.cpp index 3090037c484ee5b7ba9df21fe5c659e730a232d2..92fd8e82de4ea1b302db7561e2a12ef333ceeba2 100644 --- a/Utilities/otbossimplugins/ossim/ossimPluginProjectionFactory.cpp +++ b/Utilities/otbossimplugins/ossim/ossimPluginProjectionFactory.cpp @@ -43,7 +43,7 @@ ossimProjection* ossimPluginProjectionFactory::createProjection( ossimRefPtr<ossimRadarSat2Model> model = new ossimRadarSat2Model(); if ( model->open(filename) ) { - result = model.get(); + result = model.get(); } else { @@ -78,6 +78,18 @@ ossimProjection* ossimPluginProjectionFactory::createProjection( } } + if (!result) + { + ossimRefPtr<ossimEnvisatAsarModel> model = new ossimEnvisatAsarModel(); + if (model->open(filename)) + { + result = model.get(); + } + else + { + model = 0; + } + } return result.release(); } @@ -112,6 +124,10 @@ ossimProjection* ossimPluginProjectionFactory::createProjection( { return new ossimErsSarModel; } + else if (name == STATIC_TYPE_NAME(ossimEnvisatAsarModel)) + { + return new ossimEnvisatAsarModel; + } return 0; } @@ -149,6 +165,14 @@ ossimProjection* ossimPluginProjectionFactory::createProjection( result = 0; } } + else if (type == "ossimEnvisatAsarModel") + { + result = new ossimEnvisatAsarModel(); + if ( !result->loadState(kwl, prefix) ) + { + result = 0; + } + } } return result.release();