diff --git a/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarData.cpp b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarData.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f3df75d8336c37dbc6f6eca2f2b7fac730ef35eb --- /dev/null +++ b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarData.cpp @@ -0,0 +1,194 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// "Copyright Centre for Remote Imaging, Sensing and Processing" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#include <AlosSarData.h> +#include <AlosSarRecordHeader.h> + +#include <AlosSarDataFileDescriptor.h> +#include <AlosSarSignalData.h> + +#include <ossim/base/ossimTrace.h> +#include <ossim/base/ossimKeywordlist.h> +#include <ossim/base/ossimKeywordNames.h> + +// Static trace for debugging +static ossimTrace traceDebug("ossimAlosSarData:debug"); + +namespace ossimplugins +{ + +const int AlosSarData::AlosSarDataFileDescriptorID = 1; +const int AlosSarData::AlosSarSignalDataID = 2; + +AlosSarData::AlosSarData() +{ + +} + +AlosSarData::~AlosSarData() +{ + ClearRecords(); +} + +std::ostream& operator<<(std::ostream& os, const AlosSarData& data) +{ + std::map<int, AlosSarRecord*>::const_iterator it = data._records.begin(); + while(it != data._records.end()) + { + (*it).second->Write(os); + ++it; + } + return os; + +} + +std::istream& operator>>(std::istream& is, AlosSarData& data) +{ + + data.ClearRecords(); + + AlosSarRecordHeader header; + + is>>header; + + AlosSarRecord* record = new AlosSarDataFileDescriptor; + if (record != NULL) + { + record->Read(is); + data._records[header.get_rec_seq()] = record; + } + else + { + char* buff = new char[header.get_length()-12]; + is.read(buff, header.get_length()-12); + delete buff; + } + + std::streampos filePosition; + + filePosition = is.tellg(); + is>>header; + + record = new AlosSarSignalData; + + if (record != NULL) + { + record->Read(is); + data._records[header.get_rec_seq()] = record; + std::cout << "Record sequence number = " << header.get_rec_seq() << std::endl; + } + is.seekg(filePosition); // Rewind file pointer to start of record + // Then, advance pointer to next record + is.seekg(static_cast<std::streamoff>(header.get_length()), std::ios::cur); + + return is; +} + + +AlosSarData::AlosSarData(const AlosSarData& rhs) +{ + std::map<int, AlosSarRecord*>::const_iterator it = rhs._records.begin(); + while(it != rhs._records.end()) + { + _records[(*it).first] = (*it).second->Clone(); + ++it; + } +} + +AlosSarData& AlosSarData::operator=(const AlosSarData& rhs) +{ + ClearRecords(); + std::map<int, AlosSarRecord*>::const_iterator it = rhs._records.begin(); + while(it != rhs._records.end()) + { + _records[(*it).first] = (*it).second->Clone(); + ++it; + } + + return *this; +} + +void AlosSarData::ClearRecords() +{ + std::map<int, AlosSarRecord*>::const_iterator it = _records.begin(); + while(it != _records.end()) + { + delete (*it).second; + ++it; + } + _records.clear(); +} + +bool AlosSarData::saveState(ossimKeywordlist& kwl, + const char* prefix) const +{ + + static const char MODULE[] = "AlosSarData::saveState"; + + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG)<< MODULE << " entered...\n"; + } + + bool result = true; + + char name[64]; + + /* + * Adding metadata necessary to the sensor model in the keywordlist + */ + const AlosSarDataFileDescriptor *datafiledesc = get_AlosSarDataFileDescriptor(); + if (datafiledesc != NULL) + { + kwl.add(prefix, "num_lines", datafiledesc->get_num_lines(),true); + kwl.add(prefix, "num_pix_in_line", datafiledesc->get_num_pix_in_line(),true); + // FIXME debug + std::cout << std::endl << "num_lines = " << datafiledesc->get_num_lines() << std::endl; + std::cout << std::endl << "num_pix_in_line = " << datafiledesc->get_num_pix_in_line() << std::endl; + } + else + { + result = false; + } + + const AlosSarSignalData *signalData = get_AlosSarSignalData(); + if (datafiledesc != NULL) + { + kwl.add(prefix, "pulse_repetition_frequency", signalData->get_pulse_repetition_frequency(),true); + // slant range to 1st data sample in metres + kwl.add(prefix, "slant_range_to_1st_data_sample", signalData->get_slant_range_to_1st_data_sample(),true); + // FIXME debug + std::cout << std::endl << "pulse_repetition_frequency = " << signalData->get_pulse_repetition_frequency() << std::endl; + std::cout << std::endl << "slant_range_to_1st_data_sample = " << signalData->get_slant_range_to_1st_data_sample() << std::endl; + } + else + { + result = false; + } + + + return result; +} + + +const AlosSarDataFileDescriptor * AlosSarData::get_AlosSarDataFileDescriptor() const +{ + return dynamic_cast<const AlosSarDataFileDescriptor*>(_records.find(AlosSarDataFileDescriptorID)->second); +} + +const AlosSarSignalData * AlosSarData::get_AlosSarSignalData() const +{ + // TODO: Check if _records[AlosSarSignalDataID] works + return dynamic_cast<const AlosSarSignalData*>(_records.find(AlosSarSignalDataID)->second); +} + +} diff --git a/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarData.h b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarData.h new file mode 100644 index 0000000000000000000000000000000000000000..5ae319c6140ad0858e50fae61f36077d8a2f3227 --- /dev/null +++ b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarData.h @@ -0,0 +1,99 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// "Copyright Centre for Remote Imaging, Sensing and Processing" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#ifndef AlosSarData_h +#define AlosSarData_h + +#include <iostream> +#include "AlosSarDataFileDescriptor.h" +#include "AlosSarSignalData.h" +#include <map> + +class ossimKeywordlist; + +namespace ossimplugins +{ + +class AlosSarPlatformPositionData; +class AlosSarMapProjectionData; +class AlosSarDataSetSummary; +class AlosSarFileDescriptor; +class AlosSarFacilityData; + +/** + * @ingroup AlosSarDataFile + * @brief This class is able to read the Leader file of the AlosSar file structure + */ +class AlosSarData +{ +public: + /** + * @brief Constructor + */ + AlosSarData(); + + /** + * @brief Destructor + */ + ~AlosSarData(); + + /** + * @brief This function write the AlosSarData in a stream + */ + friend std::ostream& operator<<(std::ostream& os, const AlosSarData& data); + + /** + * @brief This function read a AlosSarData from a stream + */ + friend std::istream& operator>>(std::istream& is, AlosSarData& data); + + /** + * @brief Copy constructor + */ + AlosSarData(const AlosSarData& rhs); + + /** + * @brief Copy operator + */ + AlosSarData& operator=(const AlosSarData& rhs); + + /** + * @brief Remove all the previous records from the AlosSarData + */ + void ClearRecords(); + + + /** + * @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; + + + const AlosSarDataFileDescriptor * get_AlosSarDataFileDescriptor() const; + const AlosSarSignalData * get_AlosSarSignalData() const; + +protected: + typedef std::map<int, AlosSarRecord*> RecordType; + RecordType _records; + + + static const int AlosSarDataFileDescriptorID; + static const int AlosSarSignalDataID; +private: + +}; +} +#endif diff --git a/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarDataFileDescriptor.cpp b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarDataFileDescriptor.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c313dc17c9aacce7a59400611a98edb1fb3da56d --- /dev/null +++ b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarDataFileDescriptor.cpp @@ -0,0 +1,80 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// "Copyright Centre for Remote Imaging, Sensing and Processing" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#include <AlosSarDataFileDescriptor.h> + + +namespace ossimplugins +{ + +AlosSarDataFileDescriptor::AlosSarDataFileDescriptor() : AlosSarRecord("sar_desc_rec") +{ +} + +AlosSarDataFileDescriptor::~AlosSarDataFileDescriptor() +{ +} + +std::ostream& operator<<(std::ostream& os, const AlosSarDataFileDescriptor& data) +{ + os<<"_num_lines:"<<data._num_lines<<std::endl; + os<<"_num_pix_in_line:"<<data._num_pix_in_line<<std::endl; + return os; +} + +std::istream& operator>>(std::istream& is, AlosSarDataFileDescriptor& data) +{ + char buf6[7]; + buf6[6] = '\0'; + + char buf168[169]; + buf168[168] = '\0'; + + char buf94[95]; + buf94[94] = '\0'; + + char buf8[9]; + buf8[8] = '\0'; + + is.read(buf168,168); + + is.read(buf6,6); + data._num_lines = atoi(buf6); + + is.read(buf94,94); + + int tmpval; + is.read(buf8,8); + tmpval = atoi(buf8); + data._num_pix_in_line = tmpval/8; // Assume data always in 8-byte complex format + + char buf432[433]; + buf432[432] = '\0'; + + is.read(buf432,432); + return is; +} + +AlosSarDataFileDescriptor::AlosSarDataFileDescriptor(const AlosSarDataFileDescriptor& rhs): + AlosSarRecord(rhs), + _num_lines(rhs._num_lines), + _num_pix_in_line(rhs._num_pix_in_line) +{ +} + +AlosSarDataFileDescriptor& AlosSarDataFileDescriptor::operator=(const AlosSarDataFileDescriptor& rhs) +{ + _num_lines = rhs._num_lines; + _num_pix_in_line = rhs._num_pix_in_line; + return *this; +} +} diff --git a/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarDataFileDescriptor.h b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarDataFileDescriptor.h new file mode 100644 index 0000000000000000000000000000000000000000..34f7804f58ef511fe8416ca4584cc1f03d79b1c6 --- /dev/null +++ b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarDataFileDescriptor.h @@ -0,0 +1,118 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// "Copyright Centre for Remote Imaging, Sensing and Processing" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#ifndef AlosSarDataFileDescriptor_h +#define AlosSarDataFileDescriptor_h + + +#include<iostream> +#include <cstdlib> +#include <AlosSarRecordHeader.h> +#include <AlosSarRecord.h> + +namespace ossimplugins +{ + +/** + * @ingroup SARLeaderAlosSarDataFileDescriptorRecord + * @brief This class is able to read the SAR leader file descriptor record of the leader file + */ +class AlosSarDataFileDescriptor : public AlosSarRecord +{ +public: + /** + * @brief Constructor + */ + AlosSarDataFileDescriptor(); + /** + * @brief Destructor + */ + ~AlosSarDataFileDescriptor(); + + /** + * @brief This function write the AlosSarDataFileDescriptor in a stream + */ + friend std::ostream& operator<<(std::ostream& os, const AlosSarDataFileDescriptor& data); + + /** + * @brief This function read a AlosSarDataFileDescriptor from a stream + */ + friend std::istream& operator>>(std::istream& is, AlosSarDataFileDescriptor& data); + + /** + * @brief Copy constructor + */ + AlosSarDataFileDescriptor(const AlosSarDataFileDescriptor& rhs); + + /** + * @brief Copy operator + */ + AlosSarDataFileDescriptor& operator=(const AlosSarDataFileDescriptor& rhs); + + /** + * @brief This function is able to create a new instance of the class + */ + AlosSarRecord* Instanciate() + { + return new AlosSarDataFileDescriptor(); + }; + + /** + * @brief This function is able to create a new instance of the class initialised with the data of the calling instance + */ + AlosSarRecord* Clone() + { + return new AlosSarDataFileDescriptor(*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; + }; + + + int get_num_pix_in_line() const + { + return _num_pix_in_line; + }; + + int get_num_lines() const + { + return _num_lines; + }; + +protected: + /** + * @brief num_pix_in_line + */ + int _num_pix_in_line; + /** + * @brief num_lines + */ + int _num_lines; + + +private: +}; +} +#endif diff --git a/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarDataSetSummary.cpp b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarDataSetSummary.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a98b1ee90b419a943119cadf1c52ceb60f79fcc3 --- /dev/null +++ b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarDataSetSummary.cpp @@ -0,0 +1,745 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// "Copyright Centre for Remote Imaging, Sensing and Processing" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#include <AlosSarDataSetSummary.h> + +namespace ossimplugins +{ + +AlosSarDataSetSummary::AlosSarDataSetSummary() : AlosSarRecord("dataset_sum_rec") +{ +} + +AlosSarDataSetSummary::~AlosSarDataSetSummary() +{ +} + +std::ostream& operator<<(std::ostream& os, const AlosSarDataSetSummary& data) +{ + os<<"seq_num:"<<data._seq_num<<std::endl; + + os<<"sar_chn:"<<data._sar_chn<<std::endl; + + os<<"scene_id:"<<data._scene_id.c_str()<<std::endl; + + os<<"scene_des:"<<data._scene_des.c_str()<<std::endl; + + os<<"inp_sctim:"<<data._inp_sctim.c_str()<<std::endl; + + os<<"asc_des:"<<data._asc_des.c_str()<<std::endl; + + os<<"pro_lat:"<<data._pro_lat<<std::endl; + + os<<"pro_long:"<<data._pro_long<<std::endl; + + os<<"pro_head:"<<data._pro_head<<std::endl; + + os<<"ellip_des:"<<data._ellip_des.c_str()<<std::endl; + + os<<"ellip_maj:"<<data._ellip_maj<<std::endl; + + os<<"ellip_min:"<<data._ellip_min<<std::endl; + os<<"earth_mass:"<<data._earth_mass<<std::endl; + os<<"grav_const:"<<data._grav_const<<std::endl; + os<<"ellip_j[0]:"<<data._ellip_j[0]<<std::endl; + os<<"ellip_j[1]:"<<data._ellip_j[1]<<std::endl; + os<<"ellip_j[2]:"<<data._ellip_j[2]<<std::endl; + os<<"terrain_h:"<<data._terrain_h<<std::endl; + os<<"sc_lin:"<<data._sc_lin<<std::endl; + os<<"sc_pix:"<<data._sc_pix<<std::endl; + os<<"scene_len:"<<data._scene_len<<std::endl; + os<<"scene_wid:"<<data._scene_wid<<std::endl; + os<<"nchn:"<<data._nchn<<std::endl; + os<<"mission_id:"<<data._mission_id.c_str()<<std::endl; + os<<"sensor_id:"<<data._sensor_id.c_str()<<std::endl; + os<<"orbit_num:"<<data._orbit_num.c_str()<<std::endl; + + os<<"plat_lat:"<<data._plat_lat<<std::endl; + + os<<"plat_long:"<<data._plat_long<<std::endl; + + os<<"plat_head:"<<data._plat_head<<std::endl; + + os<<"clock_ang:"<<data._clock_ang<<std::endl; + + os<<"incident_ang:"<<data._incident_ang<<std::endl; + + + os<<"wave_length:"<<data._wave_length<<std::endl; + + os<<"motion_comp:"<<data._motion_comp.c_str()<<std::endl; + + os<<"pulse_code:"<<data._pulse_code.c_str()<<std::endl; + + for (int i=0;i<5;i++) + { + os<<"ampl_coef["<<i<<"]:"<<data._ampl_coef[i]<<std::endl; + } + + for (int i=0;i<5;i++) + { + os<<"phas_coef["<<i<<"]:"<<data._phas_coef[i]<<std::endl; + } + + os<<"chirp_ext_ind:"<<data._chirp_ext_ind<<std::endl; + + os<<"fr:"<<data._fr<<std::endl; + + os<<"rng_gate:"<<data._rng_gate<<std::endl; + + os<<"rng_length:"<<data._rng_length<<std::endl; + + os<<"baseband_f:"<<data._baseband_f.c_str()<<std::endl; + + os<<"rngcmp_f:"<<data._rngcmp_f.c_str()<<std::endl; + + os<<"gn_polar:"<<data._gn_polar <<std::endl; + + os<<"gn_cross:"<<data._gn_cross <<std::endl; + + os<<"chn_bits:"<<data._chn_bits<<std::endl; + + os<<"quant_desc:"<<data._quant_desc.c_str()<<std::endl; + + os<<"i_bias:"<<data._i_bias<<std::endl; + + os<<"q_bias:"<<data._q_bias<<std::endl; + + os<<"iq_ratio:"<<data._iq_ratio<<std::endl; + + os<<"mech_sight:"<<data._mech_sight<<std::endl; + + os<<"fa:"<<data._fa<<std::endl; + + os<<"sat_bintim:"<<data._sat_bintim.c_str()<<std::endl; + + os<<"sat_clktim:"<<data._sat_clktim.c_str()<<std::endl; + + os<<"sat_clkinc:"<<data._sat_clkinc.c_str()<<std::endl; + + os<<"fac_id:"<<data._fac_id.c_str()<<std::endl; + + os<<"sys_id:"<<data._sys_id.c_str()<<std::endl; + + os<<"ver_id:"<<data._ver_id.c_str()<<std::endl; + + os<<"prod_type:"<<data._prod_type.c_str()<<std::endl; + + os<<"algor_id:"<<data._algor_id.c_str()<<std::endl; + + os<<"n_azilok:"<<data._n_azilok<<std::endl; + + os<<"n_rnglok:"<<data._n_rnglok<<std::endl; + + os<<"bnd_azilok:"<<data._bnd_azilok<<std::endl; + + os<<"bnd_rnglok:"<<data._bnd_rnglok<<std::endl; + + os<<"bnd_azi:"<<data._bnd_azi<<std::endl; + + os<<"bnd_rng:"<<data._bnd_rng<<std::endl; + + os<<"azi_weight:"<<data._azi_weight.c_str()<<std::endl; + + os<<"rng_weight:"<<data._rng_weight.c_str()<<std::endl; + + os<<"data_inpsrc:"<<data._data_inpsrc.c_str()<<std::endl; + + os<<"rng_res:" << data._rng_res << std::endl; + + os<<"azi_res:" << data._azi_res << std::endl; + + os<<"alt_dopcen[0]:"<<data._alt_dopcen[0]<<std::endl; + os<<"alt_dopcen[1]:"<<data._alt_dopcen[1]<<std::endl; + os<<"alt_dopcen[2]:"<<data._alt_dopcen[2]<<std::endl; + + os<<"crt_dopcen[0]:"<<data._crt_dopcen[0]<<std::endl; + os<<"crt_dopcen[1]:"<<data._crt_dopcen[1]<<std::endl; + os<<"crt_dopcen[2]:"<<data._crt_dopcen[2]<<std::endl; + + os<<"time_dir_pix:"<<data._time_dir_pix.c_str()<<std::endl; + + os<<"time_dir_lin:"<<data._time_dir_lin.c_str()<<std::endl; + + os<<"alt_rate[0]:"<<data._alt_rate[0]<<std::endl; + os<<"alt_rate[1]:"<<data._alt_rate[1]<<std::endl; + os<<"alt_rate[2]:"<<data._alt_rate[2]<<std::endl; + + os<<"crt_rate[0]:"<<data._crt_rate[0]<<std::endl; + os<<"crt_rate[1]:"<<data._crt_rate[1]<<std::endl; + os<<"crt_rate[2]:"<<data._crt_rate[2]<<std::endl; + + os<<"clutter_lock:"<<data._line_cont.c_str()<<std::endl; + + os<<"clutter_lock:"<<data._clutter_lock.c_str()<<std::endl; + + os<<"auto_focus:"<<data._auto_focus.c_str()<<std::endl; + + os<<"line_spacing:"<<data._line_spacing<<std::endl; + + os<<"pix_spacing:"<<data._pix_spacing<<std::endl; + + os<<"rngcmp_desg:"<<data._rngcmp_desg.c_str()<<std::endl; + + /** + * @Data from 1735 to 4096 to be added + */ + + return os; + +} + +std::istream& operator>>(std::istream& is, AlosSarDataSetSummary& data) +{ + char buf16[17]; + buf16[16]='\0'; + char buf32[33]; + buf32[32] = '\0'; + char buf8[9]; + buf8[8] = '\0'; + char buf4[5]; + buf4[4] = '\0'; + char buf2362[2363]; //data skip from 1735 to 4096// + buf2362[2362] = '\0'; //data skip from 1735 to 4096// + + is.read(buf4,4); + data._seq_num = atoi(buf4); + + is.read(buf4,4); + data._sar_chn = atoi(buf4); + + is.read(buf16,16); + data._scene_id = buf16; + + is.read(buf32,32); + data._scene_des = buf32; + + is.read(buf32,32); + data._inp_sctim = buf32; + + is.read(buf16,16); + data._asc_des = buf16; + + is.read(buf16,16); + data._pro_lat = atof(buf16); + + is.read(buf16,16); + data._pro_long = atof(buf16); + + is.read(buf16,16); + data._pro_head = atof(buf16); + + is.read(buf16,16); + data._ellip_des = buf16; + + is.read(buf16,16); + data._ellip_maj = atof(buf16); + + is.read(buf16,16); + data._ellip_min = atof(buf16); + + is.read(buf16,16); + data._earth_mass = atof(buf16); + + is.read(buf16,16); + data._grav_const = atof(buf16); + + is.read(buf16,16); + data._ellip_j[0] = atof(buf16); + is.read(buf16,16); + data._ellip_j[1] = atof(buf16); + is.read(buf16,16); + data._ellip_j[2] = atof(buf16); + + is.read(buf16,16); + + is.read(buf16,16); + data._terrain_h = atof(buf16); + + is.read(buf8,8); + data._sc_lin = atoi(buf8); + + is.read(buf8,8); + data._sc_pix = atoi(buf8); + + is.read(buf16,16); + data._scene_len = atof(buf16); + + is.read(buf16,16); + data._scene_wid = atof(buf16); + + is.read(buf16,16); + + is.read(buf4,4); + data._nchn = atoi(buf4); + + is.read(buf4,4); + + is.read(buf16,16); + data._mission_id = buf16; + + is.read(buf32,32); + data._sensor_id = buf32; + + is.read(buf8,8); + data._orbit_num = buf8; + + is.read(buf8,8); + data._plat_lat = atof(buf8); + + is.read(buf8,8); + data._plat_long = atof(buf8); + + is.read(buf8,8); + data._plat_head = atof(buf8); + + is.read(buf8,8); + data._clock_ang = atof(buf8); + + is.read(buf8,8); + data._incident_ang = atof(buf8); + + is.read(buf8,8); + + is.read(buf16,16); + data._wave_length = atof(buf16); + + is.read(buf8,2); + buf8[2] = '\0'; + data._motion_comp = buf8; + + is.read(buf16,16); + data._pulse_code = buf16; + + for (int i=0;i<5;i++) + { + is.read(buf16,16); + data._ampl_coef[i] = atof(buf16); + } + + for (int i=0;i<5;i++) + { + is.read(buf16,16); + data._phas_coef[i] = atof(buf16); + } + + is.read(buf8,8); + data._chirp_ext_ind = atoi(buf8); + + is.read(buf8,8); + + is.read(buf16,16); + data._fr = atof(buf16); + + is.read(buf16,16); + data._rng_gate = atof(buf16); + + is.read(buf16,16); + data._rng_length = atof(buf16); + + is.read(buf8,4); + buf8[4] = '\0'; + data._baseband_f = buf8; + + is.read(buf8,4); + buf8[4] = '\0'; + data._rngcmp_f = buf8; + + is.read(buf16,16); + data._gn_polar = atof(buf16); + + is.read(buf16,16); + data._gn_cross = atof(buf16); + + is.read(buf8,8); + data._chn_bits = atoi(buf8); + + is.read(buf16,12); + buf16[12] = '\0'; + data._quant_desc = buf16; + + is.read(buf16,16); + data._i_bias = atof(buf16); + + is.read(buf16,16); + data._q_bias = atof(buf16); + + is.read(buf16,16); + data._iq_ratio = atof(buf16); + + is.read(buf32,32); + + is.read(buf16,16); + + is.read(buf16,16); + data._mech_sight = atof(buf16); + + is.read(buf4,4); + + is.read(buf16,16); + data._fa = atof(buf16); + + is.read(buf16,16); + + is.read(buf16,16); + + is.read(buf16,16); + data._sat_bintim = buf16; + + is.read(buf32,32); + data._sat_clktim = buf32; + + is.read(buf8,8); + data._sat_clkinc = buf8; + + is.read(buf8,8); + + is.read(buf16,16); + data._fac_id = buf16; + + is.read(buf8,8); + data._sys_id = buf8; + + is.read(buf8,8); + data._ver_id = buf8; + + is.read(buf32,32); + + is.read(buf32,32); + data._prod_type = buf32; + + is.read(buf32,32); + data._algor_id = buf32; + + is.read(buf16,16); + data._n_azilok = atof(buf16); + + is.read(buf16,16); + data._n_rnglok = atof(buf16); + + is.read(buf16,16); + data._bnd_azilok = atof(buf16); + + is.read(buf16,16); + data._bnd_rnglok = atof(buf16); + + is.read(buf16,16); + data._bnd_azi = atof(buf16); + + is.read(buf16,16); + data._bnd_rng = atof(buf16); + + is.read(buf32,32); + data._azi_weight = buf32; + + is.read(buf32,32); + data._rng_weight = buf32; + + is.read(buf16,16); + data._data_inpsrc = buf16; + + is.read(buf16,16); + data._rng_res = atof(buf16); + + is.read(buf16,16); + data._azi_res = atof(buf16); + + is.read(buf32,32); + + is.read(buf16,16); + data._alt_dopcen[0] = atof(buf16); + is.read(buf16,16); + data._alt_dopcen[1] = atof(buf16); + is.read(buf16,16); + data._alt_dopcen[2] = atof(buf16); + + is.read(buf16,16); + + is.read(buf16,16); + data._crt_dopcen[0] = atof(buf16); + is.read(buf16,16); + data._crt_dopcen[1] = atof(buf16); + is.read(buf16,16); + data._crt_dopcen[2] = atof(buf16); + + is.read(buf8,8); + data._time_dir_pix = buf8; + + is.read(buf8,8); + data._time_dir_lin = buf8; + + is.read(buf16,16); + data._alt_rate[0] = atof(buf16); + is.read(buf16,16); + data._alt_rate[1] = atof(buf16); + is.read(buf16,16); + data._alt_rate[2] = atof(buf16); + + is.read(buf16,16); + + is.read(buf16,16); + data._crt_rate[0] = atof(buf16); + is.read(buf16,16); + data._crt_rate[1] = atof(buf16); + is.read(buf16,16); + data._crt_rate[2] = atof(buf16); + + is.read(buf16,16); + + is.read(buf8,8); + data._line_cont = buf8; + + is.read(buf4,4); + data._clutter_lock = buf4; + + is.read(buf4,4); + data._auto_focus = buf4; + + is.read(buf16,16); + data._line_spacing = atof(buf16); + + is.read(buf16,16); + data._pix_spacing = atof(buf16); + + is.read(buf16,16); + data._rngcmp_desg = buf16; + + /** + * @Data from 1735 to 4096 to be added + */ + + is.read(buf2362,2362); + + return is; +} + + +AlosSarDataSetSummary::AlosSarDataSetSummary(const AlosSarDataSetSummary& rhs): + AlosSarRecord(rhs), + _seq_num(rhs._seq_num), + _sar_chn(rhs._sar_chn), + _scene_id(rhs._scene_id), + _scene_des(rhs._scene_des), + _inp_sctim(rhs._inp_sctim), + _asc_des(rhs._asc_des), + _pro_lat(rhs._pro_lat), + _pro_long(rhs._pro_long), + _pro_head(rhs._pro_head), + _ellip_des(rhs._ellip_des), + _ellip_maj(rhs._ellip_maj), + _ellip_min(rhs._ellip_min), + _earth_mass(rhs._earth_mass), + _grav_const(rhs._grav_const), + _terrain_h(rhs._terrain_h), + _sc_lin(rhs._sc_lin), + _sc_pix(rhs._sc_pix), + _scene_len(rhs._scene_len), + _scene_wid(rhs._scene_wid), + _nchn(rhs._nchn), + _mission_id(rhs._mission_id), + _sensor_id(rhs._sensor_id), + _orbit_num(rhs._orbit_num), + _plat_lat(rhs._plat_lat), + _plat_long(rhs._plat_long), + _plat_head(rhs._plat_head), + _clock_ang(rhs._clock_ang), + _incident_ang(rhs._incident_ang), + _wave_length(rhs._wave_length), + _motion_comp(rhs._motion_comp), + _pulse_code(rhs._pulse_code), + _chirp_ext_ind(rhs._chirp_ext_ind), + _fr(rhs._fr), + _rng_gate(rhs._rng_gate), + _rng_length(rhs._rng_length), + _baseband_f(rhs._baseband_f), + _rngcmp_f(rhs._rngcmp_f), + _gn_polar(rhs._gn_polar), + _gn_cross(rhs._gn_cross), + _chn_bits(rhs._chn_bits), + _quant_desc(rhs._quant_desc), + _i_bias(rhs._i_bias), + _q_bias(rhs._q_bias), + _iq_ratio(rhs._iq_ratio), + _mech_sight(rhs._mech_sight), + _fa(rhs._fa), + _sat_bintim(rhs._sat_bintim), + _sat_clktim(rhs._sat_clktim), + _sat_clkinc(rhs._sat_clkinc), + _fac_id(rhs._fac_id), + _sys_id(rhs._sys_id), + _ver_id(rhs._ver_id), + _prod_type(rhs._prod_type), + _algor_id(rhs._algor_id), + _n_azilok(rhs._n_azilok), + _n_rnglok(rhs._n_rnglok), + _bnd_azilok(rhs._bnd_azilok), + _bnd_rnglok(rhs._bnd_rnglok), + _bnd_azi(rhs._bnd_azi), + _bnd_rng(rhs._bnd_rng), + _azi_weight(rhs._azi_weight), + _rng_weight(rhs._rng_weight), + _data_inpsrc(rhs._data_inpsrc), + _rng_res(rhs._rng_res), + _azi_res(rhs._azi_res), + _time_dir_pix(rhs._time_dir_pix), + _time_dir_lin(rhs._time_dir_lin), + _line_cont(rhs._line_cont), + _clutter_lock(rhs._clutter_lock), + _auto_focus(rhs._auto_focus), + _line_spacing(rhs._line_spacing), + _pix_spacing(rhs._pix_spacing), + _rngcmp_desg(rhs._rngcmp_desg) + +//to be added// + +{ + _ellip_j[0] = rhs._ellip_j[0]; + _ellip_j[1] = rhs._ellip_j[1]; + _ellip_j[2] = rhs._ellip_j[2]; + _ampl_coef[0] = rhs._ampl_coef[0]; + _ampl_coef[1] = rhs._ampl_coef[1]; + _ampl_coef[2] = rhs._ampl_coef[2]; + _ampl_coef[3] = rhs._ampl_coef[3]; + _ampl_coef[4] = rhs._ampl_coef[4]; + _phas_coef[0] = rhs._phas_coef[0]; + _phas_coef[1] = rhs._phas_coef[1]; + _phas_coef[2] = rhs._phas_coef[2]; + _phas_coef[3] = rhs._phas_coef[3]; + _phas_coef[4] = rhs._phas_coef[4]; + + _alt_dopcen[0] = rhs._alt_dopcen[0]; + _alt_dopcen[1] = rhs._alt_dopcen[1]; + _alt_dopcen[2] = rhs._alt_dopcen[2]; + + _crt_dopcen[0] = rhs._crt_dopcen[0]; + _crt_dopcen[1] = rhs._crt_dopcen[1]; + _crt_dopcen[2] = rhs._crt_dopcen[2]; + + _alt_rate[0] = rhs._alt_rate[0]; + _alt_rate[1] = rhs._alt_rate[1]; + _alt_rate[2] = rhs._alt_rate[2]; + _crt_rate[0] = rhs._crt_rate[0]; + _crt_rate[1] = rhs._crt_rate[1]; + _crt_rate[2] = rhs._crt_rate[2]; +} + +AlosSarDataSetSummary& AlosSarDataSetSummary::operator=(const AlosSarDataSetSummary& rhs) +{ + _seq_num = rhs._seq_num; + _sar_chn = rhs._sar_chn; + _scene_id = rhs._scene_id; + _scene_des = rhs._scene_des; + _inp_sctim = rhs._inp_sctim; + _asc_des = rhs._asc_des; + _pro_lat = rhs._pro_lat; + _pro_long = rhs._pro_long; + _pro_head = rhs._pro_head; + _ellip_des = rhs._ellip_des; + _ellip_maj = rhs._ellip_maj; + _ellip_min = rhs._ellip_min; + _earth_mass = rhs._earth_mass; + _grav_const = rhs._grav_const; + _terrain_h = rhs._terrain_h; + _sc_lin = rhs._sc_lin; + _sc_pix = rhs._sc_pix; + _scene_len = rhs._scene_len; + _scene_wid = rhs._scene_wid; + _nchn = rhs._nchn; + _mission_id = rhs._mission_id; + _sensor_id = rhs._sensor_id; + _orbit_num = rhs._orbit_num; + _plat_lat = rhs._plat_lat; + _plat_long = rhs._plat_long; + _plat_head = rhs._plat_head; + _clock_ang = rhs._clock_ang; + _incident_ang = rhs._incident_ang; + _wave_length = rhs._wave_length; + _motion_comp = rhs._motion_comp; + _pulse_code = rhs._pulse_code; + _chirp_ext_ind = rhs._chirp_ext_ind; + _fr = rhs._fr; + _rng_gate = rhs._rng_gate; + _rng_length = rhs._rng_length; + _baseband_f = rhs._baseband_f; + _rngcmp_f = rhs._rngcmp_f; + _gn_polar = rhs._gn_polar; + _gn_cross = rhs._gn_cross; + _chn_bits = rhs._chn_bits; + _quant_desc = rhs._quant_desc; + _i_bias = rhs._i_bias; + _q_bias = rhs._q_bias; + _iq_ratio = rhs._iq_ratio; + _mech_sight = rhs._mech_sight; + _fa = rhs._fa; + _sat_bintim = rhs._sat_bintim; + _sat_clktim = rhs._sat_clktim; + _sat_clkinc = rhs._sat_clkinc; + _fac_id = rhs._fac_id; + _sys_id = rhs._sys_id; + _ver_id = rhs._ver_id; + _prod_type = rhs._prod_type; + _algor_id = rhs._algor_id; + _n_azilok = rhs._n_azilok; + _n_rnglok = rhs._n_rnglok; + _bnd_azilok = rhs._bnd_azilok; + _bnd_rnglok = rhs._bnd_rnglok; + _bnd_azi = rhs._bnd_azi; + _bnd_rng = rhs._bnd_rng; + _azi_weight = rhs._azi_weight; + _rng_weight = rhs._rng_weight; + _data_inpsrc = rhs._data_inpsrc; + _rng_res = rhs._rng_res; + _azi_res = rhs._azi_res; + _time_dir_pix = rhs._time_dir_pix; + _time_dir_lin = rhs._time_dir_lin; + _line_cont = rhs._line_cont; + _clutter_lock = rhs._clutter_lock; + _auto_focus = rhs._auto_focus; + _line_spacing = rhs._line_spacing; + _pix_spacing = rhs._pix_spacing; + _rngcmp_desg = rhs._rngcmp_desg; + + _ellip_j[0] = rhs._ellip_j[0]; + _ellip_j[1] = rhs._ellip_j[1]; + _ellip_j[2] = rhs._ellip_j[2]; + _ampl_coef[0] = rhs._ampl_coef[0]; + _ampl_coef[1] = rhs._ampl_coef[1]; + _ampl_coef[2] = rhs._ampl_coef[2]; + _ampl_coef[3] = rhs._ampl_coef[3]; + _ampl_coef[4] = rhs._ampl_coef[4]; + _phas_coef[0] = rhs._phas_coef[0]; + _phas_coef[1] = rhs._phas_coef[1]; + _phas_coef[2] = rhs._phas_coef[2]; + _phas_coef[3] = rhs._phas_coef[3]; + _phas_coef[4] = rhs._phas_coef[4]; + + _alt_dopcen[0] = rhs._alt_dopcen[0]; + _alt_dopcen[1] = rhs._alt_dopcen[1]; + _alt_dopcen[2] = rhs._alt_dopcen[2]; + + _crt_dopcen[0] = rhs._crt_dopcen[0]; + _crt_dopcen[1] = rhs._crt_dopcen[1]; + _crt_dopcen[2] = rhs._crt_dopcen[2]; + + _alt_rate[0] = rhs._alt_rate[0]; + _alt_rate[1] = rhs._alt_rate[1]; + _alt_rate[2] = rhs._alt_rate[2]; + _crt_rate[0] = rhs._crt_rate[0]; + _crt_rate[1] = rhs._crt_rate[1]; + _crt_rate[2] = rhs._crt_rate[2]; + +//to be added// + + + return *this; +} +} diff --git a/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarDataSetSummary.h b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarDataSetSummary.h new file mode 100644 index 0000000000000000000000000000000000000000..36c76e6d4e7ea23571b26630e1e892b73eb71b81 --- /dev/null +++ b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarDataSetSummary.h @@ -0,0 +1,1011 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// "Copyright Centre for Remote Imaging, Sensing and Processing" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#ifndef AlosSarDataSetSummary_h +#define AlosSarDataSetSummary_h + +#include <iostream> +#include <cstdlib> +#include <AlosSarRecordHeader.h> +#include <AlosSarRecord.h> + +namespace ossimplugins +{ + +/** + * @ingroup AlosSarDataSetSummaryRecord + * @brief This class is able to read the SAR leader data set summary record of the leader file + */ +class AlosSarDataSetSummary : public AlosSarRecord +{ +public: + /** + * @brief Constructor + */ + AlosSarDataSetSummary(); + + /** + * @brief Destructor + */ + ~AlosSarDataSetSummary(); + + /** + * @brief This function write the AlosSarDataSetSummary in a stream + */ + friend std::ostream& operator<<(std::ostream& os, const AlosSarDataSetSummary& data); + + /** + * @brief This function read a AlosSarDataSetSummary from a stream + */ + friend std::istream& operator>>(std::istream& is, AlosSarDataSetSummary& data); + + /** + * @brief Copy constructor + */ + AlosSarDataSetSummary(const AlosSarDataSetSummary& rhs); + + /** + * @brief Copy operator + */ + AlosSarDataSetSummary& operator=(const AlosSarDataSetSummary& rhs); + + /** + * @brief This function is able to create a new instance of the class + */ + AlosSarRecord* Instanciate() + { + return new AlosSarDataSetSummary(); + }; + + /** + * @brief This function is able to create a new instance of the class initialised with the data of the calling instance + */ + AlosSarRecord* Clone() + { + return new AlosSarDataSetSummary(*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 Sequence number + */ + int get_seq_num() const + { + return _seq_num; + }; + /** + * @brief SAR channel indicator + */ + int get_sar_chn() const + { + return _sar_chn; + }; + /** + * @brief Scene identifier + */ + std::string get_scene_id() const + { + return _scene_id; + }; + /** + * @brief Scene designator + */ + std::string get_scene_des() const + { + return _scene_des; + }; + /** + * @brief Input scene centre time + */ + std::string get_inp_sctim() const + { + return _inp_sctim; + }; + /** + * @brief Ascending/descending + */ + std::string get_asc_des() const + { + return _asc_des; + }; + /** + * @brief Processed scene centre latitude + */ + double get_pro_lat() const + { + return _pro_lat; + }; + /** + * @brief Processed scene centre longitude + */ + double get_pro_long() const + { + return _pro_long; + }; + /** + * @brief Processed scene centre headng + */ + double get_pro_head() const + { + return _pro_head; + }; + /** + * @brief Ellipsoid designator + */ + std::string get_ellip_des() const + { + return _ellip_des; + }; + /** + * @brief Ellipsoid semi-major axis, km + */ + double get_ellip_maj() const + { + return _ellip_maj; + }; + /** + * @brief Ellipsoid semi_minor axis, km + */ + double get_ellip_min() const + { + return _ellip_min; + }; + /** + * @brief Earth's mass + */ + double get_earth_mass() const + { + return _earth_mass; + }; + /** + * @brief Gravitational constant + */ + double get_grav_const() const + { + return _grav_const; + }; + /** + * @brief Ellipsoid J2-4 parameters + */ + const double* get_ellip_j() const + { + return _ellip_j; + }; + + /** + * @brief Average terrain height, km + */ + double get_terrain_h() const + { + return _terrain_h; + }; + /** + * @brief Scene centre line number + */ + int get_sc_lin() const + { + return _sc_lin; + }; + /** + * @brief Scene centre pixel number + */ + int get_sc_pix() const + { + return _sc_pix; + }; + /** + * @brief Scene length, km + */ + double get_scene_len() const + { + return _scene_len; + }; + /** + * @brief Scene width, km + */ + double get_scene_wid() const + { + return _scene_wid; + }; + + /** + * @brief Number of SAR channels + */ + double get_nchn() const + { + return _nchn; + }; + + /** + * @brief Mission identifier + */ + std::string get_mission_id() const + { + return _mission_id; + }; + /** + * @brief Sensor identifier + */ + std::string get_sensor_id() const + { + return _sensor_id; + }; + /** + * @brief Orbit number + */ + std::string get_orbit_num() const + { + return _orbit_num; + }; + /** + * @brief Platform geodetic latitude + */ + double get_plat_lat() const + { + return _plat_lat; + }; + /** + * @brief Platform geodetic longitude + */ + double get_plat_long() const + { + return _plat_long; + }; + /** + * @brief Platform heading + */ + double get_plat_head() const + { + return _plat_head; + }; + /** + * @brief Sensor clock angle + */ + double get_clock_ang() const + { + return _clock_ang; + }; + /** + * @brief Incidence angle + */ + double get_incident_ang() const + { + return _incident_ang; + }; + + /** + * @brief Radar wave length + */ + double get_wave_length() const + { + return _wave_length; + }; + /** + * @brief Motion compensation indicator + */ + std::string get_motion_comp() const + { + return _motion_comp; + }; + /** + * @brief Range pulse code specifier + */ + std::string get_pulse_code() const + { + return _pulse_code; + }; + /** + * @brief Range chirp coefficients + */ + const double* get_ampl_coef() const + { + return _ampl_coef; + }; + /** + * @brief Range phase coefficients + */ + const double* get_phas_coef() const + { + return _phas_coef; + }; + /** + * @brief Chirp extraction index + */ + int get_chirp_ext_ind() const + { + return _chirp_ext_ind; + }; + + /** + * @brief Range sampling rate + */ + double get_fr() const + { + return _fr; + }; + /** + * @brief Range gate start time + */ + double get_rng_gate() const + { + return _rng_gate; + }; + /** + * @brief Range pulse length + */ + double get_rng_length() const + { + return _rng_length; + }; + /** + * @brief Baseband conversion flag + */ + std::string get_baseband_f() const + { + return _baseband_f; + }; + /** + * @brief Range compressed flag + */ + std::string get_rngcmp_f() const + { + return _rngcmp_f; + }; + /** + * @brief Like polarized gain + */ + double get_gn_polar() const + { + return _gn_polar; + }; + /** + * @brief Cross polarized gain + */ + double get_gn_cross() const + { + return _gn_cross; + }; + /** + * @brief Number of bits per channel + */ + int get_chn_bits() const + { + return _chn_bits; + }; + /** + * @brief Quantization descriptor + */ + std::string get_quant_desc() const + { + return _quant_desc; + }; + /** + * @brief I channel DC bias + */ + double get_i_bias() const + { + return _i_bias; + }; + /** + * @brief Q channel DC bias + */ + double get_q_bias() const + { + return _q_bias; + }; + /** + * @brief I/Q channel ratio + */ + double get_iq_ratio() const + { + return _iq_ratio; + }; + + + /** + * @brief Mechanical boresight + */ + double get_mech_sight() const + { + return _mech_sight; + }; + + /** + * @brief Nominal PRF, Hz + */ + double get_fa() const + { + return _fa; + }; + + /** + * @brief Satellite binary time + */ + std::string get_sat_bintim() const + { + return _sat_bintim; + }; + /** + * @brief Satellite clock time + */ + std::string get_sat_clktim() const + { + return _sat_clktim; + }; + /** + * @brief Satellite clock increment + */ + std::string get_sat_clkinc() const + { + return _sat_clkinc; + }; + + /** + * @brief Processing facility identifier + */ + std::string get_fac_id() const + { + return _fac_id; + }; + /** + * @brief Processing system identifier + */ + std::string get_sys_id() const + { + return _sys_id; + }; + /** + * @brief Processing version identifier + */ + std::string get_ver_id() const + { + return _ver_id; + }; + + /** + * @brief Product type specifier + */ + std::string get_prod_type() const + { + return _prod_type; + }; + /** + * @brief Processing algorithm identifier + */ + std::string get_algor_id() const + { + return _algor_id; + }; + /** + * @brief Number of azimuth looks + */ + double get_n_azilok() const + { + return _n_azilok; + }; + /** + * @brief Number of range looks + */ + double get_n_rnglok() const + { + return _n_rnglok; + }; + /** + * @brief Bandwidth per look in azimuth,Hz + */ + double get_bnd_azilok() const + { + return _bnd_azilok; + }; + /** + * @brief Bandwidth per look in range,Hz + */ + double get_bnd_rnglok() const + { + return _bnd_rnglok; + }; + /** + * @brief Total azimuth look bandwidth + */ + double get_bnd_azi() const + { + return _bnd_azi; + }; + /** + * @brief Total range look bandwidth + */ + double get_bnd_rng() const + { + return _bnd_rng; + }; + /** + * @brief Azimuth weighting designator + */ + std::string get_azi_weight() const + { + return _azi_weight; + }; + /** + * @brief Range weighting designator + */ + std::string get_rng_weight() const + { + return _rng_weight; + }; + /** + * @brief Data input source + */ + std::string get_data_inpsrc() const + { + return _data_inpsrc; + }; + /** + * @brief Range resolution, meter + */ + double get_rng_res() const + { + return _rng_res; + }; + /** + * @brief Azimuth resolution, meter + */ + double get_azi_res() const + { + return _azi_res; + }; + /** + * @brief Along track Doppler frequency terms + */ + const double* get_alt_dopcen() const + { + return _alt_dopcen; + }; + + /** + * @brief Cross track Doppler frequency terms + */ + const double* get_crt_dopcen() const + { + return _crt_dopcen; + }; + /** + * @brief Pixel time direction indicator + */ + std::string get_time_dir_pix() const + { + return _time_dir_pix; + }; + /** + * @brief Line time direction indicator + */ + std::string get_time_dir_lin() const + { + return _time_dir_lin; + }; + /** + * @brief Along track Doppler rate term + */ + const double* get_alt_rate() const + { + return _alt_rate; + }; + + /** + * @brief Cross track Doppler rate term + */ + const double* get_crt_rate() const + { + return _crt_rate; + }; + + /** + * @brief Line content indicator + */ + std::string get_line_cont() const + { + return _line_cont; + }; + /** + * @brief Clutter lock applied flag + */ + std::string get_clutter_lock() const + { + return _clutter_lock; + }; + /** + * @brief Auto-focus applied flag + */ + std::string get_auto_focus() const + { + return _auto_focus; + }; + /** + * @brief Line spacing, meters + */ + double get_line_spacing() const + { + return _line_spacing; + }; + /** + * @brief Pixel spacing, meters + */ + double get_pix_spacing() const + { + return _pix_spacing; + }; + /** + * @brief Range compression designator + */ + std::string get_rngcmp_desg() const + { + return _rngcmp_desg; + }; + + /** + * @Data from 1735 to 4096 to be added + */ + + +protected: + /** + * @brief Sequence number + */ + int _seq_num; + /** + * @brief SAR channel indicator + */ + int _sar_chn; + /** + * @brief Scene identifier + */ + std::string _scene_id; + /** + * @brief Scene designator + */ + std::string _scene_des; + /** + * @brief Input scene centre time + */ + std::string _inp_sctim; + /** + * @brief Ascending/descending + */ + std::string _asc_des; + /** + * @brief Processed scene centre latitude + */ + double _pro_lat; + /** + * @brief Processed scene centre longitude + */ + double _pro_long; + /** + * @brief Processed scene centre headng + */ + double _pro_head; + /** + * @brief Ellipsoid designator + */ + std::string _ellip_des; + /** + * @brief Ellipsoid semi-major axis, km + */ + double _ellip_maj; + /** + * @brief Ellipsoid semi_minor axis, km + */ + double _ellip_min; + /** + * @brief Earth's mass + */ + double _earth_mass; + /** + * @brief Gravitational constant + */ + double _grav_const; + /** + * @brief Ellipsoid J2-4 parameters + */ + double _ellip_j[3]; + + /** + * @brief Average terrain height, km + */ + double _terrain_h; + /** + * @brief Scene centre line number + */ + int _sc_lin; + /** + * @brief Scene centre pixel number + */ + int _sc_pix; + /** + * @brief Scene length, km + */ + double _scene_len; + /** + * @brief Scene width, km + */ + double _scene_wid; + + /** + * @brief Number of SAR channels + */ + double _nchn; + + /** + * @brief Mission identifier + */ + std::string _mission_id; + /** + * @brief Sensor identifier + */ + std::string _sensor_id; + /** + * @brief Orbit number + */ + std::string _orbit_num; + /** + * @brief Platform geodetic latitude + */ + double _plat_lat; + /** + * @brief Platform geodetic longitude + */ + double _plat_long; + /** + * @brief Platform heading + */ + double _plat_head; + /** + * @brief Sensor clock angle + */ + double _clock_ang; + /** + * @brief Incidence angle + */ + double _incident_ang; + + /** + * @brief Radar wave length + */ + double _wave_length; + /** + * @brief Motion compensation indicator + */ + std::string _motion_comp; + /** + * @brief Range pulse code specifier + */ + std::string _pulse_code; + /** + * @brief Range chirp coefficients + */ + double _ampl_coef[5]; + /** + * @brief Range phase coefficients + */ + double _phas_coef[5]; + /** + * @brief Chirp extraction index + */ + int _chirp_ext_ind; + + /** + * @brief Range sampling rate + */ + double _fr; + /** + * @brief Range gate start time + */ + double _rng_gate; + /** + * @brief Range pulse length + */ + double _rng_length; + /** + * @brief Baseband conversion flag + */ + std::string _baseband_f; + /** + * @brief Range compressed flag + */ + std::string _rngcmp_f; + /** + * @brief Like polarized gain + */ + double _gn_polar; + /** + * @brief Cross polarized gain + */ + double _gn_cross; + /** + * @brief Number of bits per channel + */ + int _chn_bits; + /** + * @brief Quantization descriptor + */ + std::string _quant_desc; + /** + * @brief I channel DC bias + */ + double _i_bias; + /** + * @brief Q channel DC bias + */ + double _q_bias; + /** + * @brief I/Q channel ratio + */ + double _iq_ratio; + /** + * @brief Mechanical boresight + */ + double _mech_sight; + /** + * @brief Nominal PRF, Hz + */ + double _fa; + /** + * @brief Satellite binary time + */ + std::string _sat_bintim; + /** + * @brief Satellite clock time + */ + std::string _sat_clktim; + /** + * @brief Satellite clock increment + */ + std::string _sat_clkinc; + + /** + * @brief Processing facility identifier + */ + std::string _fac_id; + /** + * @brief Processing system identifier + */ + std::string _sys_id; + /** + * @brief Processing version identifier + */ + std::string _ver_id; + /** + * @brief Product type specifier + */ + std::string _prod_type; + /** + * @brief Processing algorithm identifier + */ + std::string _algor_id; + /** + * @brief Number of azimuth looks + */ + double _n_azilok; + /** + * @brief Number of range looks + */ + double _n_rnglok; + /** + * @brief Bandwidth per look in azimuth,Hz + */ + double _bnd_azilok; + /** + * @brief Bandwidth per look in range,Hz + */ + double _bnd_rnglok; + /** + * @brief Total azimuth look bandwidth + */ + double _bnd_azi; + /** + * @brief Total range look bandwidth + */ + double _bnd_rng; + /** + * @brief Azimuth weighting designator + */ + std::string _azi_weight; + /** + * @brief Range weighting designator + */ + std::string _rng_weight; + /** + * @brief Data input source + */ + std::string _data_inpsrc; + /** + * @brief Range resolution, meter + */ + double _rng_res; + /** + * @brief Azimuth resolution, meter + */ + double _azi_res; + /** + * @brief Along track Doppler frequency terms + */ + double _alt_dopcen[3]; + /** + * @brief Cross track Doppler frequency terms + */ + double _crt_dopcen[3]; + /** + * @brief Pixel time direction indicator + */ + std::string _time_dir_pix; + /** + * @brief Line time direction indicator + */ + std::string _time_dir_lin; + /** + * @brief Along track Doppler rate term + */ + double _alt_rate[3]; + + /** + * @brief Cross track Doppler rate term + */ + double _crt_rate[3]; + + /** + * @brief Line content indicator + */ + std::string _line_cont; + /** + * @brief Clutter lock applied flag + */ + std::string _clutter_lock; + /** + * @brief Auto-focus applied flag + */ + std::string _auto_focus; + /** + * @brief Line spacing, meters + */ + double _line_spacing; + /** + * @brief Pixel spacing, meters + */ + double _pix_spacing; + /** + * @brief Range compression designator + */ + std::string _rngcmp_desg; + + /** + * @Data from 1735 to 4096 to be added + */ + +private: + +}; +} +#endif diff --git a/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarFacilityData.cpp b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarFacilityData.cpp new file mode 100644 index 0000000000000000000000000000000000000000..15c3f231ec704f1aabe7b2a72917bfc9f59313e6 --- /dev/null +++ b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarFacilityData.cpp @@ -0,0 +1,1167 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// "Copyright Centre for Remote Imaging, Sensing and Processing" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#include <AlosSarFacilityData.h> + +namespace ossimplugins +{ + +AlosSarFacilityData::AlosSarFacilityData() : AlosSarRecord("facility_data_rec") +{ +} + +AlosSarFacilityData::~AlosSarFacilityData() +{ +} + +std::ostream& operator<<(std::ostream& os, const AlosSarFacilityData& data) +{ + os<<"last_release_qc_date:"<<data._last_release_qc_date.c_str()<<std::endl; + + os<<"last_release_cal_date:"<<data._last_release_cal_date.c_str()<<std::endl; + + os<<"qa_summary_flag:"<<data._qa_summary_flag<<std::endl; + + os<<"prf_code_change_flag:"<<data._prf_code_change_flag<<std::endl; + + os<<"sampling_win_change_flag:"<<data._sampling_win_change_flag<<std::endl; + + os<<"cal_gain_change_flag:"<<data._cal_gain_change_flag<<std::endl; + + os<<"quirp_qu_flag:"<<data._quirp_qu_flag<<std::endl; + + os<<"inp_data_stat_flag:"<<data._inp_data_stat_flag<<std::endl; + + os<<"dopp_cent_conf_meas_flag:"<<data._dopp_cent_conf_meas_flag<<std::endl; + + os<<"dopp_cent_val_flag:"<<data._dopp_cent_val_flag<<std::endl; + + os<<"dopp_ambig_conf_meas_flag:"<<data._dopp_ambig_conf_meas_flag<<std::endl; + + os<<"outp_data_mean_flag:"<<data._outp_data_mean_flag<<std::endl; + + os<<"OGOB_flag:"<<data._OGOB_flag<<std::endl; + + os<<"PRF_changes:"<<data._PRF_changes<<std::endl; + + os<<"sampling_win_changes:"<<data._sampling_win_changes<<std::endl; + + os<<"cal_gain_changes:"<<data._cal_gain_changes<<std::endl; + + os<<"missing_lines:"<<data._missing_lines<<std::endl; + + os<<"rec_gain_changes:"<<data._rec_gain_changes<<std::endl; + + os<<"pulse_width_of_ACF_3db:"<<data._pulse_width_of_ACF_3db<<std::endl; + + os<<"first_side_lobe_lev_of_ACF:"<<data._first_side_lobe_lev_of_ACF<<std::endl; + + os<<"ISLR_of_ACF:"<<data._ISLR_of_ACF<<std::endl; + + os<<"dopp_cent_conf_meas:"<<data._dopp_cent_conf_meas<<std::endl; + + os<<"dopp_ambig_conf_meas:"<<data._dopp_ambig_conf_meas<<std::endl; + + os<<"inp_data_I_mean:"<<data._inp_data_I_mean<<std::endl; + + os<<"inp_data_Q_mean:"<<data._inp_data_Q_mean<<std::endl; + + os<<"inp_data_I_stddev:"<<data._inp_data_I_stddev<<std::endl; + + os<<"inp_data_Q_stddev:"<<data._inp_data_Q_stddev<<std::endl; + + os<<"cal_sys_gain:"<<data._cal_sys_gain<<std::endl; + + os<<"first_rec_gain_read:"<<data._first_rec_gain_read<<std::endl; + + os<<"dopp_ambig_num:"<<data._dopp_ambig_num<<std::endl; + + os<<"I_channel_bias_correction:"<<data._I_channel_bias_correction<<std::endl; + + os<<"Q_channel_bias_correction:"<<data._Q_channel_bias_correction<<std::endl; + + os<<"I_channel_gain_correction:"<<data._I_channel_gain_correction<<std::endl; + + os<<"Q_channel_gain_correction:"<<data._Q_channel_gain_correction<<std::endl; + + os<<"Q_channel_I_Q_correction:"<<data._Q_channel_I_Q_correction<<std::endl; + + os<<"noise_power:"<<data._noise_power<<std::endl; + + os<<"int_cal_utc:"<<data._int_cal_utc<<std::endl; + + os<<"num_valid_cal_pulses:"<<data._num_valid_cal_pulses<<std::endl; + + os<<"num_valid_noise_pulses:"<<data._num_valid_noise_pulses<<std::endl; + + os<<"num_valid_replicas:"<<data._num_valid_replicas<<std::endl; + + os<<"first_replica_sample:"<<data._first_replica_sample<<std::endl; + + os<<"mean_cal_pulse_power:"<<data._mean_cal_pulse_power<<std::endl; + + os<<"mean_noise_power:"<<data._mean_noise_power<<std::endl; + + os<<"range_comp_norm_fact:"<<data._range_comp_norm_fact<<std::endl; + + os<<"replica_power:"<<data._replica_power<<std::endl; + + os<<"first_range_pixel_mid_az_inc:"<<data._first_range_pixel_mid_az_inc<<std::endl; + + os<<"center_range_pix_mid_az_inc:"<<data._center_range_pix_mid_az_inc<<std::endl; + + os<<"last_range_pix_mid_az_inc:"<<data._last_range_pix_mid_az_inc<<std::endl; + + os<<"norm_ref_range_ro:"<<data._norm_ref_range_ro<<std::endl; + + os<<"antenna_elev_flag:"<<data._antenna_elev_flag<<std::endl; + + os<<"abs_cal_const_K:"<<data._abs_cal_const_K<<std::endl; + + os<<"upp_bound_K:"<<data._upp_bound_K<<std::endl; + + os<<"low_bound_K:"<<data._low_bound_K<<std::endl; + + os<<"proc_noise_scale_fact:"<<data._proc_noise_scale_fact<<std::endl; + + os<<"K_gen_date:"<<data._K_gen_date.c_str()<<std::endl; + + os<<"K_vers_num:"<<data._K_vers_num.c_str()<<std::endl; + + os<<"num_duplic_input_lines:"<<data._num_duplic_input_lines<<std::endl; + + os<<"estim_bit_error_rate:"<<data._estim_bit_error_rate<<std::endl; + + os<<"out_image_mean:"<<data._out_image_mean<<std::endl; + + os<<"out_image_std_dev:"<<data._out_image_std_dev<<std::endl; + + os<<"out_image_max_value:"<<data._out_image_max_value<<std::endl; + + os<<"time_raw_data_first_input:"<<data._time_raw_data_first_input.c_str()<<std::endl; + + os<<"time_asc_node_state_vectors:"<<data._time_asc_node_state_vectors.c_str()<<std::endl; + + os<<"asc_node_pos_X_comp:"<<data._asc_node_pos_X_comp.c_str()<<std::endl; + + os<<"asc_node_pos_Y_comp:"<<data._asc_node_pos_Y_comp.c_str()<<std::endl; + + os<<"asc_node_pos_Z_comp:"<<data._asc_node_pos_Z_comp.c_str()<<std::endl; + + os<<"asc_node_vel_X_comp:"<<data._asc_node_vel_X_comp.c_str()<<std::endl; + + os<<"asc_node_vel_Y_comp:"<<data._asc_node_vel_Y_comp.c_str()<<std::endl; + + os<<"asc_node_vel_Z_comp:"<<data._asc_node_vel_Z_comp.c_str()<<std::endl; + + os<<"out_pixel_bit_length:"<<data._out_pixel_bit_length<<std::endl; + + os<<"proc_gain_param_1:"<<data._proc_gain_param_1<<std::endl; + + os<<"proc_gain_param_2:"<<data._proc_gain_param_2<<std::endl; + + os<<"proc_gain_param_3:"<<data._proc_gain_param_3<<std::endl; + + os<<"peak_loc_cross_correl_fun:"<<data._peak_loc_cross_correl_fun<<std::endl; + + os<<"3_dB_width_CCF:"<<data._3_dB_width_CCF<<std::endl; + + os<<"first_side_lobe_level:"<<data._first_side_lobe_level<<std::endl; + + os<<"ISLR_CCF_between_last:"<<data._ISLR_CCF_between_last<<std::endl; + + os<<"peak_loc_CCF_betw_last:"<<data._peak_loc_CCF_betw_last<<std::endl; + + os<<"Roll_Tilt_Mode_flag:"<<data._Roll_Tilt_Mode_flag<<std::endl; + + os<<"raw_data_correction_flag:"<<data._raw_data_correction_flag<<std::endl; + + os<<"look_detecion_flag:"<<data._look_detecion_flag<<std::endl; + + os<<"doppler_ambiguity_estimat_flag:"<<data._doppler_ambiguity_estimat_flag<<std::endl; + + os<<"azimuth_baseband_convers_flag:"<<data._azimuth_baseband_convers_flag<<std::endl; + + os<<"samples_per_line_used:"<<data._samples_per_line_used<<std::endl; + + os<<"range_lines_skip_factor:"<<data._range_lines_skip_factor<<std::endl; + + os<<"time_of_inp_state_vectors:"<<data._time_of_inp_state_vectors.c_str()<<std::endl; + + os<<"inp_state_vect_pos_X_comp:"<<data._inp_state_vect_pos_X_comp.c_str()<<std::endl; + + os<<"inp_state_vect_pos_Y_comp:"<<data._inp_state_vect_pos_Y_comp.c_str()<<std::endl; + + os<<"inp_state_vect_pos_Z_comp:"<<data._inp_state_vect_pos_Z_comp.c_str()<<std::endl; + + os<<"inp_state_vect_vel_Vx_comp:"<<data._inp_state_vect_vel_Vx_comp.c_str()<<std::endl; + + os<<"inp_state_vect_vel_Vy_comp:"<<data._inp_state_vect_vel_Vy_comp.c_str()<<std::endl; + + os<<"inp_state_vect_vel_Vz_comp:"<<data._inp_state_vect_vel_Vz_comp.c_str()<<std::endl; + + os<<"inp_state_vector_type_flag:"<<data._inp_state_vector_type_flag<<std::endl; + + os<<"win_coeff_for_range_match:"<<data._win_coeff_for_range_match<<std::endl; + + os<<"win_coeff_for_azi_match:"<<data._win_coeff_for_azi_match<<std::endl; + + os<<"update_period_range_match:"<<data._update_period_range_match<<std::endl; + + os<<"look_scalar_gain_1:"<<data._look_scalar_gain_1<<std::endl; + + os<<"look_scalar_gain_2:"<<data._look_scalar_gain_2<<std::endl; + + os<<"look_scalar_gain_3:"<<data._look_scalar_gain_3<<std::endl; + + os<<"look_scalar_gain_4:"<<data._look_scalar_gain_4<<std::endl; + + os<<"look_scalar_gain_5:"<<data._look_scalar_gain_5<<std::endl; + + os<<"look_scalar_gain_6:"<<data._look_scalar_gain_6<<std::endl; + + os<<"look_scalar_gain_7:"<<data._look_scalar_gain_7<<std::endl; + + os<<"look_scalar_gain_8:"<<data._look_scalar_gain_8<<std::endl; + + os<<"samp_window_start_time_bias:"<<data._samp_window_start_time_bias<<std::endl; + + os<<"doppler_centroid_cubic_coeff:"<<data._doppler_centroid_cubic_coeff<<std::endl; + + os<<"PRF_code_first_range_line:"<<data._PRF_code_first_range_line<<std::endl; + + os<<"PRF_code_last_range_line:"<<data._PRF_code_last_range_line<<std::endl; + + os<<"samp_win_start_first:"<<data._samp_win_start_first<<std::endl; + + os<<"samp_win_start_last:"<<data._samp_win_start_last<<std::endl; + + os<<"cal_syst_gain_last_proc:"<<data._cal_syst_gain_last_proc<<std::endl; + + os<<"receiver_gain_last_proc:"<<data._receiver_gain_last_proc<<std::endl; + + os<<"first_processed_range_sample:"<<data._first_processed_range_sample<<std::endl; + + os<<"azimuth_FFT_IFFT_ratio:"<<data._azimuth_FFT_IFFT_ratio<<std::endl; + + os<<"num_azimuth_blocks_proc:"<<data._num_azimuth_blocks_proc<<std::endl; + + os<<"num_input_raw_data_lines:"<<data._num_input_raw_data_lines<<std::endl; + + os<<"initial_doppler_ambiguity_num:"<<data._initial_doppler_ambiguity_num<<std::endl; + + os<<"thresh_no_1_flag:"<<data._thresh_no_1_flag<<std::endl; + + os<<"thresh_no_2_flag:"<<data._thresh_no_2_flag<<std::endl; + + os<<"thresh_no_3_flag:"<<data._thresh_no_3_flag<<std::endl; + + os<<"thresh_no_4_flag:"<<data._thresh_no_4_flag<<std::endl; + + os<<"thresh_no_5_flag:"<<data._thresh_no_5_flag<<std::endl; + + os<<"thresh_no_6_flag:"<<data._thresh_no_6_flag<<std::endl; + + os<<"thresh_no_7_flag:"<<data._thresh_no_7_flag<<std::endl; + + os<<"thresh_no_8_flag:"<<data._thresh_no_8_flag<<std::endl; + + os<<"thresh_no_9_flag:"<<data._thresh_no_9_flag<<std::endl; + + os<<"thresh_no_10_flag:"<<data._thresh_no_10_flag<<std::endl; + + os<<"thresh_no_11_flag:"<<data._thresh_no_11_flag<<std::endl; + + os<<"sat_binary_time_of_first:"<<data._sat_binary_time_of_first<<std::endl; + + os<<"num_valid_pixels_per_range:"<<data._num_valid_pixels_per_range<<std::endl; + + os<<"num_range_samp_discarded:"<<data._num_range_samp_discarded<<std::endl; + + os<<"I_gain_imb_lower_bound:"<<data._I_gain_imb_lower_bound<<std::endl; + + os<<"I_gain_imb_upper_bound:"<<data._I_gain_imb_upper_bound<<std::endl; + + os<<"I_Q_quad_depar_lower_bound:"<<data._I_Q_quad_depar_lower_bound<<std::endl; + + os<<"I_Q_quad_depar_upper_bound:"<<data._I_Q_quad_depar_upper_bound<<std::endl; + + os<<"3_dB_look_bandwidth:"<<data._3_dB_look_bandwidth<<std::endl; + + os<<"3_dB_look_proc_dopp_bandw:"<<data._3_dB_look_proc_dopp_bandw<<std::endl; + + os<<"range_spread_loss_comp_flag:"<<data._range_spread_loss_comp_flag<<std::endl; + + os<<"datation_flag:"<<data._datation_flag<<std::endl; + + os<<"max_error_range_line_timing:"<<data._max_error_range_line_timing<<std::endl; + + os<<"form_num_range_line_used:"<<data._form_num_range_line_used<<std::endl; + + os<<"autom_look_scal_gain_flag:"<<data._autom_look_scal_gain_flag<<std::endl; + + os<<"max_value_look_scalar_gain:"<<data._max_value_look_scalar_gain<<std::endl; + + os<<"replica_norm_method_flag:"<<data._replica_norm_method_flag<<std::endl; + + os<<"coef_ground_range_1:"<<data._coef_ground_range_1<<std::endl; + + os<<"coef_ground_range_2:"<<data._coef_ground_range_2<<std::endl; + + os<<"coef_ground_range_3:"<<data._coef_ground_range_3<<std::endl; + + os<<"coef_ground_range_4:"<<data._coef_ground_range_4<<std::endl; + + os<<"coef_ant_elev_1:"<<data._coef_ant_elev_1<<std::endl; + + os<<"coef_ant_elev_2:"<<data._coef_ant_elev_2<<std::endl; + + os<<"coef_ant_elev_3:"<<data._coef_ant_elev_3<<std::endl; + + os<<"coef_ant_elev_4:"<<data._coef_ant_elev_4<<std::endl; + + os<<"coef_ant_elev_5:"<<data._coef_ant_elev_5<<std::endl; + + os<<"range_time_origin_ant:"<<data._range_time_origin_ant<<std::endl; + + return os; + +} + +std::istream& operator>>(std::istream& is, AlosSarFacilityData& data) +{ + char buf64[65]; + buf64[64] = '\0'; + char buf32[33]; + buf32[32] = '\0'; + char buf24[25]; + buf24[24]='\0'; + char buf22[23]; + buf22[22]='\0'; + char buf20[21]; + buf20[20]='\0'; + char buf16[17]; + buf16[16]='\0'; + char buf12[13]; + buf12[12] = '\0'; + char buf7[8]; + buf7[7] = '\0'; + char buf8[9]; + buf8[8] = '\0'; + char buf6[7]; + buf6[6] = '\0'; + char buf4[5]; + buf4[4] = '\0'; + char buf2[3]; + buf2[2] = '\0'; + char buf1[2]; + buf1[1] = '\0'; + + is.read(buf64,64); + data._name_of_facil_rec = buf64; + + is.read(buf6,6); + data._last_release_qc_date = buf6; + + is.read(buf2,2); + + is.read(buf6,6); + data._last_release_cal_date = buf6; + + is.read(buf4,4); + data._qa_summary_flag = atoi(buf4); + + is.read(buf4,4); + data._prf_code_change_flag = atoi(buf4); + + is.read(buf4,4); + data._sampling_win_change_flag = atoi(buf4); + + is.read(buf4,4); + data._cal_gain_change_flag = atoi(buf4); + + is.read(buf4,4); + data._quirp_qu_flag = atoi(buf4); + + is.read(buf4,4); + data._inp_data_stat_flag = atoi(buf4); + + is.read(buf4,4); + data._dopp_cent_conf_meas_flag = atoi(buf4); + + is.read(buf4,4); + data._dopp_cent_val_flag = atoi(buf4); + + is.read(buf4,4); + data._dopp_ambig_conf_meas_flag = atoi(buf4); + + is.read(buf4,4); + data._outp_data_mean_flag = atoi(buf4); + + is.read(buf4,4); + data._OGOB_flag = atoi(buf4); + + is.read(buf4,4); + data._PRF_changes = atoi(buf4); + + is.read(buf4,4); + data._sampling_win_changes = atoi(buf4); + + is.read(buf4,4); + data._cal_gain_changes = atoi(buf4); + + is.read(buf4,4); + data._missing_lines = atoi(buf4); + + is.read(buf4,4); + data._rec_gain_changes = atoi(buf4); + + is.read(buf16,16); + data._pulse_width_of_ACF_3db = atof(buf16); + + is.read(buf16,16); + data._first_side_lobe_lev_of_ACF = atof(buf16); + + is.read(buf16,16); + data._ISLR_of_ACF = atof(buf16); + + is.read(buf16,16); + data._dopp_cent_conf_meas = atof(buf16); + + is.read(buf16,16); + data._dopp_ambig_conf_meas = atof(buf16); + + is.read(buf16,16); + data._inp_data_I_mean = atof(buf16); + + is.read(buf16,16); + data._inp_data_Q_mean = atof(buf16); + + is.read(buf16,16); + data._inp_data_I_stddev = atof(buf16); + + is.read(buf16,16); + data._inp_data_Q_stddev = atof(buf16); + + is.read(buf16,16); + data._cal_sys_gain = atof(buf16); + + is.read(buf16,16); + data._first_rec_gain_read = atof(buf16); + + is.read(buf16,16); + data._dopp_ambig_num = atof(buf16); + + is.read(buf16,16); + + is.read(buf16,16); + data._I_channel_bias_correction = atof(buf16); + + is.read(buf16,16); + data._Q_channel_bias_correction = atof(buf16); + + is.read(buf16,16); + data._I_channel_gain_correction = atof(buf16); + + is.read(buf16,16); + data._Q_channel_gain_correction = atof(buf16); + + is.read(buf16,16); + data._Q_channel_I_Q_correction = atof(buf16); + + is.read(buf16,16); + + is.read(buf16,16); + data._noise_power = atof(buf16); + + is.read(buf16,16); + data._int_cal_utc = atoi(buf16); + + is.read(buf4,4); + data._num_valid_cal_pulses = atoi(buf4); + + is.read(buf4,4); + data._num_valid_noise_pulses = atoi(buf4); + + is.read(buf4,4); + data._num_valid_replicas = atoi(buf4); + + is.read(buf16,16); + data._first_replica_sample = atof(buf16); + + is.read(buf16,16); + data._mean_cal_pulse_power = atof(buf16); + + is.read(buf16,16); + data._mean_noise_power = atof(buf16); + + is.read(buf16,16); + data._range_comp_norm_fact = atof(buf16); + + is.read(buf16,16); + data._replica_power = atof(buf16); + + is.read(buf16,16); + data._first_range_pixel_mid_az_inc = atof(buf16); + + is.read(buf16,16); + data._center_range_pix_mid_az_inc = atof(buf16); + + is.read(buf16,16); + data._last_range_pix_mid_az_inc = atof(buf16); + + is.read(buf16,16); + data._norm_ref_range_ro = atof(buf16); + + is.read(buf12,12); + + is.read(buf4,4); + data._antenna_elev_flag = atoi(buf4); + + is.read(buf16,16); + data._abs_cal_const_K = atof(buf16); + + is.read(buf16,16); + data._upp_bound_K = atof(buf16); + + is.read(buf16,16); + data._low_bound_K = atof(buf16); + + is.read(buf16,16); + data._proc_noise_scale_fact = atof(buf16); + + is.read(buf6,6); + data._K_gen_date = buf6; + + is.read(buf4,4); + data._K_vers_num = buf4; + + is.read(buf4,4); + data._num_duplic_input_lines = atoi(buf4); + + is.read(buf16,16); + data._estim_bit_error_rate = atof(buf16); + + is.read(buf12,12); + + is.read(buf16,16); + data._out_image_mean = atof(buf16); + + is.read(buf16,16); + data._out_image_std_dev = atof(buf16); + + is.read(buf16,16); + data._out_image_max_value = atof(buf16); + + is.read(buf24,24); + data._time_raw_data_first_input = buf24; + + is.read(buf24,24); + data._time_asc_node_state_vectors = buf24; + + is.read(buf22,22); + data._asc_node_pos_X_comp = buf22; + + is.read(buf22,22); + data._asc_node_pos_Y_comp = buf22; + + is.read(buf22,22); + data._asc_node_pos_Z_comp = buf22; + + is.read(buf22,22); + data._asc_node_vel_X_comp = buf22; + + is.read(buf22,22); + data._asc_node_vel_Y_comp = buf22; + + is.read(buf22,22); + data._asc_node_vel_Z_comp = buf22; + + is.read(buf4,4); + data._out_pixel_bit_length = atoi(buf4); + + is.read(buf16,16); + data._proc_gain_param_1 = atof(buf16); + + is.read(buf16,16); + data._proc_gain_param_2 = atof(buf16); + + is.read(buf16,16); + data._proc_gain_param_3 = atof(buf16); + + is.read(buf4,4); + data._peak_loc_cross_correl_fun = atoi(buf4); + + is.read(buf16,16); + data._3_dB_width_CCF = atof(buf16); + + is.read(buf16,16); + data._first_side_lobe_level = atof(buf16); + + is.read(buf16,16); + data._ISLR_CCF_between_last = atof(buf16); + + is.read(buf4,4); + data._peak_loc_CCF_betw_last = atoi(buf4); + + is.read(buf4,4); + data._Roll_Tilt_Mode_flag = atoi(buf4); + + is.read(buf4,4); + data._raw_data_correction_flag = atoi(buf4); + + is.read(buf4,4); + data._look_detecion_flag = atoi(buf4); + + is.read(buf4,4); + data._doppler_ambiguity_estimat_flag = atoi(buf4); + + is.read(buf4,4); + data._azimuth_baseband_convers_flag = atoi(buf4); + + is.read(buf4,4); + data._samples_per_line_used = atoi(buf4); + + is.read(buf4,4); + data._range_lines_skip_factor = atoi(buf4); + + is.read(buf24,24); + data._time_of_inp_state_vectors = buf24; + + is.read(buf22,22); + data._inp_state_vect_pos_X_comp = buf22; + + is.read(buf22,22); + data._inp_state_vect_pos_Y_comp = buf22; + + is.read(buf22,22); + data._inp_state_vect_pos_Z_comp = buf22; + + is.read(buf22,22); + data._inp_state_vect_vel_Vx_comp = buf22; + + is.read(buf22,22); + data._inp_state_vect_vel_Vy_comp = buf22; + + is.read(buf22,22); + data._inp_state_vect_vel_Vz_comp = buf22; + + is.read(buf4,4); + data._inp_state_vector_type_flag = atoi(buf4); + + is.read(buf16,16); + data._win_coeff_for_range_match = atof(buf16); + + is.read(buf16,16); + data._win_coeff_for_azi_match = atof(buf16); + + is.read(buf4,4); + data._update_period_range_match = atoi(buf4); + + is.read(buf16,16); + data._look_scalar_gain_1 = atof(buf16); + + is.read(buf16,16); + data._look_scalar_gain_2 = atof(buf16); + + is.read(buf16,16); + data._look_scalar_gain_3 = atof(buf16); + + is.read(buf16,16); + data._look_scalar_gain_4 = atof(buf16); + + is.read(buf16,16); + data._look_scalar_gain_5 = atof(buf16); + + is.read(buf16,16); + data._look_scalar_gain_6 = atof(buf16); + + is.read(buf16,16); + data._look_scalar_gain_7 = atof(buf16); + + is.read(buf16,16); + data._look_scalar_gain_8 = atof(buf16); + + is.read(buf4,4); + data._samp_window_start_time_bias = atoi(buf4); + + is.read(buf22,22); + data._doppler_centroid_cubic_coeff = atof(buf22); + + is.read(buf4,4); + data._PRF_code_first_range_line = atoi(buf4); + + is.read(buf4,4); + data._PRF_code_last_range_line = atoi(buf4); + + is.read(buf4,4); + data._samp_win_start_first = atoi(buf4); + + is.read(buf4,4); + data._samp_win_start_last = atoi(buf4); + + is.read(buf4,4); + data._cal_syst_gain_last_proc = atoi(buf4); + + is.read(buf4,4); + data._receiver_gain_last_proc = atoi(buf4); + + is.read(buf4,4); + data._first_processed_range_sample = atoi(buf4); + + is.read(buf4,4); + data._azimuth_FFT_IFFT_ratio = atoi(buf4); + + is.read(buf4,4); + data._num_azimuth_blocks_proc = atoi(buf4); + + is.read(buf8,8); + data._num_input_raw_data_lines = atol(buf8); + + is.read(buf4,4); + data._initial_doppler_ambiguity_num = atoi(buf4); + + is.read(buf16,16); + data._thresh_no_1_flag = atof(buf16); + + is.read(buf16,16); + data._thresh_no_2_flag = atof(buf16); + + is.read(buf16,16); + data._thresh_no_3_flag = atof(buf16); + + is.read(buf16,16); + data._thresh_no_4_flag = atof(buf16); + + is.read(buf16,16); + data._thresh_no_5_flag = atof(buf16); + + is.read(buf16,16); + data._thresh_no_6_flag = atof(buf16); + + is.read(buf16,16); + data._thresh_no_7_flag = atof(buf16); + + is.read(buf16,16); + data._thresh_no_8_flag = atof(buf16); + + is.read(buf16,16); + data._thresh_no_9_flag = atof(buf16); + + is.read(buf16,16); + data._thresh_no_10_flag = atof(buf16); + + is.read(buf16,16); + data._thresh_no_11_flag = atof(buf16); + + is.read(buf16,16); + data._sat_binary_time_of_first = atol(buf16); + + is.read(buf4,4); + data._num_valid_pixels_per_range = atoi(buf4); + + is.read(buf4,4); + data._num_range_samp_discarded = atoi(buf4); + + is.read(buf16,16); + data._I_gain_imb_lower_bound = atof(buf16); + + is.read(buf16,16); + data._I_gain_imb_upper_bound = atof(buf16); + + is.read(buf16,16); + data._I_Q_quad_depar_lower_bound = atof(buf16); + + is.read(buf16,16); + data._I_Q_quad_depar_upper_bound = atof(buf16); + + is.read(buf16,16); + data._3_dB_look_bandwidth = atof(buf16); + + is.read(buf16,16); + data._3_dB_look_proc_dopp_bandw = atof(buf16); + + is.read(buf4,4); + data._range_spread_loss_comp_flag = atoi(buf4); + + is.read(buf1,1); + data._datation_flag = atoi(buf1); + + is.read(buf7,7); + data._max_error_range_line_timing = atoi(buf7); + + is.read(buf7,7); + data._form_num_range_line_used = atoi(buf7); + + is.read(buf1,1); + data._autom_look_scal_gain_flag = atoi(buf1); + + is.read(buf4,4); + data._max_value_look_scalar_gain = atoi(buf4); + + is.read(buf4,4); + data._replica_norm_method_flag = atoi(buf4); + + is.read(buf20,20); + data._coef_ground_range_1 = atof(buf20); + + is.read(buf20,20); + data._coef_ground_range_2 = atof(buf20); + + is.read(buf20,20); + data._coef_ground_range_3 = atof(buf20); + + is.read(buf20,20); + data._coef_ground_range_4 = atof(buf20); + + is.read(buf20,20); + data._coef_ant_elev_1 = atof(buf20); + + is.read(buf20,20); + data._coef_ant_elev_2 = atof(buf20); + + is.read(buf20,20); + data._coef_ant_elev_3 = atof(buf20); + + is.read(buf20,20); + data._coef_ant_elev_4 = atof(buf20); + + is.read(buf20,20); + data._coef_ant_elev_5 = atof(buf20); + + is.read(buf16,16); + data._range_time_origin_ant = atof(buf16); + + char buf10238[10238]; + is.read(buf10238,10238); + return is; +} + + +AlosSarFacilityData::AlosSarFacilityData(const AlosSarFacilityData& rhs): + AlosSarRecord(rhs), + _last_release_qc_date(rhs._last_release_qc_date), + _last_release_cal_date(rhs._last_release_cal_date), + _qa_summary_flag(rhs._qa_summary_flag), + _prf_code_change_flag(rhs._prf_code_change_flag), + _sampling_win_change_flag(rhs._sampling_win_change_flag), + _cal_gain_change_flag(rhs._cal_gain_change_flag), + _quirp_qu_flag(rhs._quirp_qu_flag), + _inp_data_stat_flag(rhs._inp_data_stat_flag), + _dopp_cent_conf_meas_flag(rhs._dopp_cent_conf_meas_flag), + _dopp_cent_val_flag(rhs._dopp_cent_val_flag), + _dopp_ambig_conf_meas_flag(rhs._dopp_ambig_conf_meas_flag), + _outp_data_mean_flag(rhs._outp_data_mean_flag), + _OGOB_flag(rhs._OGOB_flag), + _PRF_changes(rhs._PRF_changes), + _sampling_win_changes(rhs._sampling_win_changes), + _cal_gain_changes(rhs._cal_gain_changes), + _missing_lines(rhs._missing_lines), + _rec_gain_changes(rhs._rec_gain_changes), + _pulse_width_of_ACF_3db(rhs._pulse_width_of_ACF_3db), + _first_side_lobe_lev_of_ACF(rhs._first_side_lobe_lev_of_ACF), + _ISLR_of_ACF(rhs._ISLR_of_ACF), + _dopp_cent_conf_meas(rhs._dopp_cent_conf_meas), + _dopp_ambig_conf_meas(rhs._dopp_ambig_conf_meas), + _inp_data_I_mean(rhs._inp_data_I_mean), + _inp_data_Q_mean(rhs._inp_data_Q_mean), + _inp_data_I_stddev(rhs._inp_data_I_stddev), + _inp_data_Q_stddev(rhs._inp_data_Q_stddev), + _cal_sys_gain(rhs._cal_sys_gain), + _first_rec_gain_read(rhs._first_rec_gain_read), + _dopp_ambig_num(rhs._dopp_ambig_num), + _I_channel_bias_correction(rhs._I_channel_bias_correction), + _Q_channel_bias_correction(rhs._Q_channel_bias_correction), + _I_channel_gain_correction(rhs._I_channel_gain_correction), + _Q_channel_gain_correction(rhs._Q_channel_gain_correction), + _Q_channel_I_Q_correction(rhs._Q_channel_I_Q_correction), + _noise_power(rhs._noise_power), + _int_cal_utc(rhs._int_cal_utc), + _num_valid_cal_pulses(rhs._num_valid_cal_pulses), + _num_valid_noise_pulses(rhs._num_valid_noise_pulses), + _num_valid_replicas(rhs._num_valid_replicas), + _first_replica_sample(rhs._first_replica_sample), + _mean_cal_pulse_power(rhs._mean_cal_pulse_power), + _mean_noise_power(rhs._mean_noise_power), + _range_comp_norm_fact(rhs._range_comp_norm_fact), + _replica_power(rhs._replica_power), + _first_range_pixel_mid_az_inc(rhs._first_range_pixel_mid_az_inc), + _center_range_pix_mid_az_inc(rhs._center_range_pix_mid_az_inc), + _last_range_pix_mid_az_inc(rhs._last_range_pix_mid_az_inc), + _norm_ref_range_ro(rhs._norm_ref_range_ro), + _antenna_elev_flag(rhs._antenna_elev_flag), + _abs_cal_const_K(rhs._abs_cal_const_K), + _upp_bound_K(rhs._upp_bound_K), + _low_bound_K(rhs._low_bound_K), + _proc_noise_scale_fact(rhs._proc_noise_scale_fact), + _K_gen_date(rhs._K_gen_date), + _K_vers_num(rhs._K_vers_num), + _num_duplic_input_lines(rhs._num_duplic_input_lines), + _estim_bit_error_rate(rhs._estim_bit_error_rate), + _out_image_mean(rhs._out_image_mean), + _out_image_std_dev(rhs._out_image_std_dev), + _out_image_max_value(rhs._out_image_max_value), + _time_raw_data_first_input(rhs._time_raw_data_first_input), + _time_asc_node_state_vectors(rhs._time_asc_node_state_vectors), + _asc_node_pos_X_comp(rhs._asc_node_pos_X_comp), + _asc_node_pos_Y_comp(rhs._asc_node_pos_Y_comp), + _asc_node_pos_Z_comp(rhs._asc_node_pos_Z_comp), + _asc_node_vel_X_comp(rhs._asc_node_vel_X_comp), + _asc_node_vel_Y_comp(rhs._asc_node_vel_Y_comp), + _asc_node_vel_Z_comp(rhs._asc_node_vel_Z_comp), + _out_pixel_bit_length(rhs._out_pixel_bit_length), + _proc_gain_param_1(rhs._proc_gain_param_1), + _proc_gain_param_2(rhs._proc_gain_param_2), + _proc_gain_param_3(rhs._proc_gain_param_3), + _peak_loc_cross_correl_fun(rhs._peak_loc_cross_correl_fun), + _3_dB_width_CCF(rhs._3_dB_width_CCF), + _first_side_lobe_level(rhs._first_side_lobe_level), + _ISLR_CCF_between_last(rhs._ISLR_CCF_between_last), + _peak_loc_CCF_betw_last(rhs._peak_loc_CCF_betw_last), + _Roll_Tilt_Mode_flag(rhs._Roll_Tilt_Mode_flag), + _raw_data_correction_flag(rhs._raw_data_correction_flag), + _look_detecion_flag(rhs._look_detecion_flag), + _doppler_ambiguity_estimat_flag(rhs._doppler_ambiguity_estimat_flag), + _azimuth_baseband_convers_flag(rhs._azimuth_baseband_convers_flag), + _samples_per_line_used(rhs._samples_per_line_used), + _range_lines_skip_factor(rhs._range_lines_skip_factor), + _time_of_inp_state_vectors(rhs._time_of_inp_state_vectors), + _inp_state_vect_pos_X_comp(rhs._inp_state_vect_pos_X_comp), + _inp_state_vect_pos_Y_comp(rhs._inp_state_vect_pos_Y_comp), + _inp_state_vect_pos_Z_comp(rhs._inp_state_vect_pos_Z_comp), + _inp_state_vect_vel_Vx_comp(rhs._inp_state_vect_vel_Vx_comp), + _inp_state_vect_vel_Vy_comp(rhs._inp_state_vect_vel_Vy_comp), + _inp_state_vect_vel_Vz_comp(rhs._inp_state_vect_vel_Vz_comp), + _inp_state_vector_type_flag(rhs._inp_state_vector_type_flag), + _win_coeff_for_range_match(rhs._win_coeff_for_range_match), + _win_coeff_for_azi_match(rhs._win_coeff_for_azi_match), + _update_period_range_match(rhs._update_period_range_match), + _look_scalar_gain_1(rhs._look_scalar_gain_1), + _look_scalar_gain_2(rhs._look_scalar_gain_2), + _look_scalar_gain_3(rhs._look_scalar_gain_3), + _look_scalar_gain_4(rhs._look_scalar_gain_4), + _look_scalar_gain_5(rhs._look_scalar_gain_5), + _look_scalar_gain_6(rhs._look_scalar_gain_6), + _look_scalar_gain_7(rhs._look_scalar_gain_7), + _look_scalar_gain_8(rhs._look_scalar_gain_8), + _samp_window_start_time_bias(rhs._samp_window_start_time_bias), + _doppler_centroid_cubic_coeff(rhs._doppler_centroid_cubic_coeff), + _PRF_code_first_range_line(rhs._PRF_code_first_range_line), + _PRF_code_last_range_line(rhs._PRF_code_last_range_line), + _samp_win_start_first(rhs._samp_win_start_first), + _samp_win_start_last(rhs._samp_win_start_last), + _cal_syst_gain_last_proc(rhs._cal_syst_gain_last_proc), + _receiver_gain_last_proc(rhs._receiver_gain_last_proc), + _first_processed_range_sample(rhs._first_processed_range_sample), + _azimuth_FFT_IFFT_ratio(rhs._azimuth_FFT_IFFT_ratio), + _num_azimuth_blocks_proc(rhs._num_azimuth_blocks_proc), + _num_input_raw_data_lines(rhs._num_input_raw_data_lines), + _initial_doppler_ambiguity_num(rhs._initial_doppler_ambiguity_num), + _thresh_no_1_flag(rhs._thresh_no_1_flag), + _thresh_no_2_flag(rhs._thresh_no_2_flag), + _thresh_no_3_flag(rhs._thresh_no_3_flag), + _thresh_no_4_flag(rhs._thresh_no_4_flag), + _thresh_no_5_flag(rhs._thresh_no_5_flag), + _thresh_no_6_flag(rhs._thresh_no_6_flag), + _thresh_no_7_flag(rhs._thresh_no_7_flag), + _thresh_no_8_flag(rhs._thresh_no_8_flag), + _thresh_no_9_flag(rhs._thresh_no_9_flag), + _thresh_no_10_flag(rhs._thresh_no_10_flag), + _thresh_no_11_flag(rhs._thresh_no_11_flag), + _sat_binary_time_of_first(rhs._sat_binary_time_of_first), + _num_valid_pixels_per_range(rhs._num_valid_pixels_per_range), + _num_range_samp_discarded(rhs._num_range_samp_discarded), + _I_gain_imb_lower_bound(rhs._I_gain_imb_lower_bound), + _I_gain_imb_upper_bound(rhs._I_gain_imb_upper_bound), + _I_Q_quad_depar_lower_bound(rhs._I_Q_quad_depar_lower_bound), + _I_Q_quad_depar_upper_bound(rhs._I_Q_quad_depar_upper_bound), + _3_dB_look_bandwidth(rhs._3_dB_look_bandwidth), + _3_dB_look_proc_dopp_bandw(rhs._3_dB_look_proc_dopp_bandw), + _range_spread_loss_comp_flag(rhs._range_spread_loss_comp_flag), + _datation_flag(rhs._datation_flag), + _max_error_range_line_timing(rhs._max_error_range_line_timing), + _form_num_range_line_used(rhs._form_num_range_line_used), + _autom_look_scal_gain_flag(rhs._autom_look_scal_gain_flag), + _max_value_look_scalar_gain(rhs._max_value_look_scalar_gain), + _replica_norm_method_flag(rhs._replica_norm_method_flag), + _coef_ground_range_1(rhs._coef_ground_range_1), + _coef_ground_range_2(rhs._coef_ground_range_2), + _coef_ground_range_3(rhs._coef_ground_range_3), + _coef_ground_range_4(rhs._coef_ground_range_4), + _coef_ant_elev_1(rhs._coef_ant_elev_1), + _coef_ant_elev_2(rhs._coef_ant_elev_2), + _coef_ant_elev_3(rhs._coef_ant_elev_3), + _coef_ant_elev_4(rhs._coef_ant_elev_4), + _coef_ant_elev_5(rhs._coef_ant_elev_5), + _range_time_origin_ant(rhs._range_time_origin_ant) +{} + +AlosSarFacilityData& AlosSarFacilityData::operator=(const AlosSarFacilityData& rhs) +{ + _last_release_qc_date = rhs._last_release_qc_date; + _last_release_cal_date = rhs._last_release_cal_date; + _qa_summary_flag = rhs._qa_summary_flag; + _prf_code_change_flag = rhs._prf_code_change_flag; + _sampling_win_change_flag = rhs._sampling_win_change_flag; + _cal_gain_change_flag = rhs._cal_gain_change_flag; + _quirp_qu_flag = rhs._quirp_qu_flag; + _inp_data_stat_flag = rhs._inp_data_stat_flag; + _dopp_cent_conf_meas_flag = rhs._dopp_cent_conf_meas_flag; + _dopp_cent_val_flag = rhs._dopp_cent_val_flag; + _dopp_ambig_conf_meas_flag = rhs._dopp_ambig_conf_meas_flag; + _outp_data_mean_flag = rhs._outp_data_mean_flag; + _OGOB_flag = rhs._OGOB_flag; + _PRF_changes = rhs._PRF_changes; + _sampling_win_changes = rhs._sampling_win_changes; + _cal_gain_changes = rhs._cal_gain_changes; + _missing_lines = rhs._missing_lines; + _rec_gain_changes = rhs._rec_gain_changes; + _pulse_width_of_ACF_3db = rhs._pulse_width_of_ACF_3db; + _first_side_lobe_lev_of_ACF = rhs._first_side_lobe_lev_of_ACF; + _ISLR_of_ACF = rhs._ISLR_of_ACF; + _dopp_cent_conf_meas = rhs._dopp_cent_conf_meas; + _dopp_ambig_conf_meas = rhs._dopp_ambig_conf_meas; + _inp_data_I_mean = rhs._inp_data_I_mean; + _inp_data_Q_mean = rhs._inp_data_Q_mean; + _inp_data_I_stddev = rhs._inp_data_I_stddev; + _inp_data_Q_stddev = rhs._inp_data_Q_stddev; + _cal_sys_gain = rhs._cal_sys_gain; + _first_rec_gain_read = rhs._first_rec_gain_read; + _dopp_ambig_num = rhs._dopp_ambig_num; + _I_channel_bias_correction = rhs._I_channel_bias_correction; + _Q_channel_bias_correction = rhs._Q_channel_bias_correction; + _I_channel_gain_correction = rhs._I_channel_gain_correction; + _Q_channel_gain_correction = rhs._Q_channel_gain_correction; + _Q_channel_I_Q_correction = rhs._Q_channel_I_Q_correction; + _noise_power = rhs._noise_power; + _int_cal_utc = rhs._int_cal_utc; + _num_valid_cal_pulses = rhs._num_valid_cal_pulses; + _num_valid_noise_pulses = rhs._num_valid_noise_pulses; + _num_valid_replicas = rhs._num_valid_replicas; + _first_replica_sample = rhs._first_replica_sample; + _mean_cal_pulse_power = rhs._mean_cal_pulse_power; + _mean_noise_power = rhs._mean_noise_power; + _range_comp_norm_fact = rhs._range_comp_norm_fact; + _replica_power = rhs._replica_power; + _first_range_pixel_mid_az_inc = rhs._first_range_pixel_mid_az_inc; + _center_range_pix_mid_az_inc = rhs._center_range_pix_mid_az_inc; + _last_range_pix_mid_az_inc = rhs._last_range_pix_mid_az_inc; + _norm_ref_range_ro = rhs._norm_ref_range_ro; + _antenna_elev_flag = rhs._antenna_elev_flag; + _abs_cal_const_K = rhs._abs_cal_const_K; + _upp_bound_K = rhs._upp_bound_K; + _low_bound_K = rhs._low_bound_K; + _proc_noise_scale_fact = rhs._proc_noise_scale_fact; + _K_gen_date = rhs._K_gen_date; + _K_vers_num = rhs._K_vers_num; + _num_duplic_input_lines = rhs._num_duplic_input_lines; + _estim_bit_error_rate = rhs._estim_bit_error_rate; + _out_image_mean = rhs._out_image_mean; + _out_image_std_dev = rhs._out_image_std_dev; + _out_image_max_value = rhs._out_image_max_value; + _time_raw_data_first_input = rhs._time_raw_data_first_input; + _time_asc_node_state_vectors = rhs._time_asc_node_state_vectors; + _asc_node_pos_X_comp = rhs._asc_node_pos_X_comp; + _asc_node_pos_Y_comp = rhs._asc_node_pos_Y_comp; + _asc_node_pos_Z_comp = rhs._asc_node_pos_Z_comp; + _asc_node_vel_X_comp = rhs._asc_node_vel_X_comp; + _asc_node_vel_Y_comp = rhs._asc_node_vel_Y_comp; + _asc_node_vel_Z_comp = rhs._asc_node_vel_Z_comp; + _out_pixel_bit_length = rhs._out_pixel_bit_length; + _proc_gain_param_1 = rhs._proc_gain_param_1; + _proc_gain_param_2 = rhs._proc_gain_param_2; + _proc_gain_param_3 = rhs._proc_gain_param_3; + _peak_loc_cross_correl_fun = rhs._peak_loc_cross_correl_fun; + _3_dB_width_CCF = rhs._3_dB_width_CCF; + _first_side_lobe_level = rhs._first_side_lobe_level; + _ISLR_CCF_between_last = rhs._ISLR_CCF_between_last; + _peak_loc_CCF_betw_last = rhs._peak_loc_CCF_betw_last; + _Roll_Tilt_Mode_flag = rhs._Roll_Tilt_Mode_flag; + _raw_data_correction_flag = rhs._raw_data_correction_flag; + _look_detecion_flag = rhs._look_detecion_flag; + _doppler_ambiguity_estimat_flag = rhs._doppler_ambiguity_estimat_flag; + _azimuth_baseband_convers_flag = rhs._azimuth_baseband_convers_flag; + _samples_per_line_used = rhs._samples_per_line_used; + _range_lines_skip_factor = rhs._range_lines_skip_factor; + _time_of_inp_state_vectors = rhs._time_of_inp_state_vectors; + _inp_state_vect_pos_X_comp = rhs._inp_state_vect_pos_X_comp; + _inp_state_vect_pos_Y_comp = rhs._inp_state_vect_pos_Y_comp; + _inp_state_vect_pos_Z_comp = rhs._inp_state_vect_pos_Z_comp; + _inp_state_vect_vel_Vx_comp = rhs._inp_state_vect_vel_Vx_comp; + _inp_state_vect_vel_Vy_comp = rhs._inp_state_vect_vel_Vy_comp; + _inp_state_vect_vel_Vz_comp = rhs._inp_state_vect_vel_Vz_comp; + _inp_state_vector_type_flag = rhs._inp_state_vector_type_flag; + _win_coeff_for_range_match = rhs._win_coeff_for_range_match; + _win_coeff_for_azi_match = rhs._win_coeff_for_azi_match; + _update_period_range_match = rhs._update_period_range_match; + _look_scalar_gain_1 = rhs._look_scalar_gain_1; + _look_scalar_gain_2 = rhs._look_scalar_gain_2; + _look_scalar_gain_3 = rhs._look_scalar_gain_3; + _look_scalar_gain_4 = rhs._look_scalar_gain_4; + _look_scalar_gain_5 = rhs._look_scalar_gain_5; + _look_scalar_gain_6 = rhs._look_scalar_gain_6; + _look_scalar_gain_7 = rhs._look_scalar_gain_7; + _look_scalar_gain_8 = rhs._look_scalar_gain_8; + _samp_window_start_time_bias = rhs._samp_window_start_time_bias; + _doppler_centroid_cubic_coeff = rhs._doppler_centroid_cubic_coeff; + _PRF_code_first_range_line = rhs._PRF_code_first_range_line; + _PRF_code_last_range_line = rhs._PRF_code_last_range_line; + _samp_win_start_first = rhs._samp_win_start_first; + _samp_win_start_last = rhs._samp_win_start_last; + _cal_syst_gain_last_proc = rhs._cal_syst_gain_last_proc; + _receiver_gain_last_proc = rhs._receiver_gain_last_proc; + _first_processed_range_sample = rhs._first_processed_range_sample; + _azimuth_FFT_IFFT_ratio = rhs._azimuth_FFT_IFFT_ratio; + _num_azimuth_blocks_proc = rhs._num_azimuth_blocks_proc; + _num_input_raw_data_lines = rhs._num_input_raw_data_lines; + _initial_doppler_ambiguity_num = rhs._initial_doppler_ambiguity_num; + _thresh_no_1_flag = rhs._thresh_no_1_flag; + _thresh_no_2_flag = rhs._thresh_no_2_flag; + _thresh_no_3_flag = rhs._thresh_no_3_flag; + _thresh_no_4_flag = rhs._thresh_no_4_flag; + _thresh_no_5_flag = rhs._thresh_no_5_flag; + _thresh_no_6_flag = rhs._thresh_no_6_flag; + _thresh_no_7_flag = rhs._thresh_no_7_flag; + _thresh_no_8_flag = rhs._thresh_no_8_flag; + _thresh_no_9_flag = rhs._thresh_no_9_flag; + _thresh_no_10_flag = rhs._thresh_no_10_flag; + _thresh_no_11_flag = rhs._thresh_no_11_flag; + _sat_binary_time_of_first = rhs._sat_binary_time_of_first; + _num_valid_pixels_per_range = rhs._num_valid_pixels_per_range; + _num_range_samp_discarded = rhs._num_range_samp_discarded; + _I_gain_imb_lower_bound = rhs._I_gain_imb_lower_bound; + _I_gain_imb_upper_bound = rhs._I_gain_imb_upper_bound; + _I_Q_quad_depar_lower_bound = rhs._I_Q_quad_depar_lower_bound; + _I_Q_quad_depar_upper_bound = rhs._I_Q_quad_depar_upper_bound; + _3_dB_look_bandwidth = rhs._3_dB_look_bandwidth; + _3_dB_look_proc_dopp_bandw = rhs._3_dB_look_proc_dopp_bandw; + _range_spread_loss_comp_flag = rhs._range_spread_loss_comp_flag; + _datation_flag = rhs._datation_flag; + _max_error_range_line_timing = rhs._max_error_range_line_timing; + _form_num_range_line_used = rhs._form_num_range_line_used; + _autom_look_scal_gain_flag = rhs._autom_look_scal_gain_flag; + _max_value_look_scalar_gain = rhs._max_value_look_scalar_gain; + _replica_norm_method_flag = rhs._replica_norm_method_flag; + _coef_ground_range_1 = rhs._coef_ground_range_1; + _coef_ground_range_2 = rhs._coef_ground_range_2; + _coef_ground_range_3 = rhs._coef_ground_range_3; + _coef_ground_range_4 = rhs._coef_ground_range_4; + _coef_ant_elev_1 = rhs._coef_ant_elev_1; + _coef_ant_elev_2 = rhs._coef_ant_elev_2; + _coef_ant_elev_3 = rhs._coef_ant_elev_3; + _coef_ant_elev_4 = rhs._coef_ant_elev_4; + _coef_ant_elev_5 = rhs._coef_ant_elev_5; + _range_time_origin_ant = rhs._range_time_origin_ant; + + return *this; +} +} diff --git a/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarFacilityData.h b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarFacilityData.h new file mode 100644 index 0000000000000000000000000000000000000000..4b46d4f813692f198dbf21c6694f0306b20bbb3b --- /dev/null +++ b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarFacilityData.h @@ -0,0 +1,1808 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// "Copyright Centre for Remote Imaging, Sensing and Processing" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#ifndef AlosSarFacilityData_h +#define AlosSarFacilityData_h + +#include <iostream> +#include <cstdlib> +#include <AlosSarRecordHeader.h> +#include <AlosSarRecord.h> + +namespace ossimplugins +{ + +/** + * @ingroup AlosSarFacilityDataRecord + * @brief This class is able to read the SAR leader data set summary record of the leader file + */ +class AlosSarFacilityData : public AlosSarRecord +{ +public: + /** + * @brief Constructor + */ + AlosSarFacilityData(); + + /** + * @brief Destructor + */ + ~AlosSarFacilityData(); + + /** + * @brief This function write the AlosSarFacilityData in a stream + */ + friend std::ostream& operator<<(std::ostream& os, const AlosSarFacilityData& data); + + /** + * @brief This function read a AlosSarFacilityData from a stream + */ + friend std::istream& operator>>(std::istream& is, AlosSarFacilityData& data); + + /** + * @brief Copy constructor + */ + AlosSarFacilityData(const AlosSarFacilityData& rhs); + + /** + * @brief Copy operator + */ + AlosSarFacilityData& operator=(const AlosSarFacilityData& rhs); + + /** + * @brief This function is able to create a new instance of the class + */ + AlosSarRecord* Instanciate() + { + return new AlosSarFacilityData(); + }; + + /** + * @brief This function is able to create a new instance of the class initialised with the data of the calling instance + */ + AlosSarRecord* Clone() + { + return new AlosSarFacilityData(*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 name_of_facil_rec + */ + std::string get_name_of_facil_rec() const + { + return _name_of_facil_rec; + }; + + /** + * @brief last_release_qc_date + */ + std::string get_last_release_qc_date() const + { + return _last_release_qc_date; + }; + /** + * @brief last_release_cal_date + */ + std::string get_last_release_cal_date() const + { + return _last_release_cal_date; + }; + /** + * @brief qa_summary_flag + */ + int get_qa_summary_flag() const + { + return _qa_summary_flag; + }; + /** + * @brief prf_code_change_flag + */ + int get_prf_code_change_flag() const + { + return _prf_code_change_flag; + }; + /** + * @brief sampling_win_change_flag + */ + int get_sampling_win_change_flag() const + { + return _sampling_win_change_flag; + }; + /** + * @brief cal_gain_change_flag + */ + int get_cal_gain_change_flag() const + { + return _cal_gain_change_flag; + }; + /** + * @brief quirp_qu_flag + */ + int get_quirp_qu_flag() const + { + return _quirp_qu_flag; + }; + /** + * @brief inp_data_stat_flag + */ + int get_inp_data_stat_flag() const + { + return _inp_data_stat_flag; + }; + /** + * @brief dopp_cent_conf_meas_flag + */ + int get_dopp_cent_conf_meas_flag() const + { + return _dopp_cent_conf_meas_flag; + }; + /** + * @brief dopp_cent_val_flag + */ + int get_dopp_cent_val_flag() const + { + return _dopp_cent_val_flag; + }; + /** + * @brief dopp_ambig_conf_meas_flag + */ + int get_dopp_ambig_conf_meas_flag() const + { + return _dopp_ambig_conf_meas_flag; + }; + /** + * @brief outp_data_mean_flag + */ + int get_outp_data_mean_flag() const + { + return _outp_data_mean_flag; + }; + /** + * @brief OGOB_flag + */ + int get_OGOB_flag() + { + return _OGOB_flag; + }; + /** + * @brief PRF_changes + */ + int get_PRF_changes() + { + return _PRF_changes; + }; + /** + * @brief sampling_win_changes + */ + int get_sampling_win_changes() const + { + return _sampling_win_changes; + }; + /** + * @brief cal_gain_changes + */ + int get_cal_gain_changes() const + { + return _cal_gain_changes; + }; + /** + * @brief missing_lines + */ + int get_missing_lines() const + { + return _missing_lines; + }; + /** + * @brief rec_gain_changes + */ + int get_rec_gain_changes() const + { + return _rec_gain_changes; + }; + /** + * @brief pulse_width_of_ACF_3db + */ + double get_pulse_width_of_ACF_3db() + { + return _pulse_width_of_ACF_3db; + }; + /** + * @brief first_side_lobe_lev_of_ACF + */ + double get_first_side_lobe_lev_of_ACF() + { + return _first_side_lobe_lev_of_ACF; + }; + /** + * @brief ISLR_of_ACF + */ + double get_ISLR_of_ACF() + { + return _ISLR_of_ACF; + }; + /** + * @brief dopp_cent_conf_meas + */ + double get_dopp_cent_conf_meas() const + { + return _dopp_cent_conf_meas; + }; + /** + * @brief dopp_ambig_conf_meas + */ + double get_dopp_ambig_conf_meas() const + { + return _dopp_ambig_conf_meas; + }; + /** + * @brief inp_data_I_mean + */ + double get_inp_data_I_mean() + { + return _inp_data_I_mean; + }; + /** + * @brief inp_data_Q_mean + */ + double get_inp_data_Q_mean() + { + return _inp_data_Q_mean; + }; + /** + * @brief inp_data_I_stddev + */ + double get_inp_data_I_stddev() + { + return _inp_data_I_stddev; + }; + /** + * @brief inp_data_Q_stddev + */ + double get_inp_data_Q_stddev() + { + return _inp_data_Q_stddev; + }; + /** + * @brief cal_sys_gain + */ + double get_cal_sys_gain() const + { + return _cal_sys_gain; + }; + /** + * @brief first_rec_gain_read + */ + double get_first_rec_gain_read() const + { + return _first_rec_gain_read; + }; + /** + * @brief dopp_ambig_num + */ + double get_dopp_ambig_num() const + { + return _dopp_ambig_num; + }; + /** + * @brief I_channel_bias_correction + */ + double get_I_channel_bias_correction() + { + return _I_channel_bias_correction; + }; + /** + * @brief Q_channel_bias_correction + */ + double get_Q_channel_bias_correction() + { + return _Q_channel_bias_correction; + }; + /** + * @brief I_channel_gain_correction + */ + double get_I_channel_gain_correction() + { + return _I_channel_gain_correction; + }; + /** + * @brief Q_channel_gain_correction + */ + double get_Q_channel_gain_correction() + { + return _Q_channel_gain_correction; + }; + /** + * @brief Q_channel_I_Q_correction + */ + double get_Q_channel_I_Q_correction() + { + return _Q_channel_I_Q_correction; + }; + /** + * @brief noise_power + */ + double get_noise_power() const + { + return _noise_power; + }; + /** + * @brief int_cal_utc + */ + int get_int_cal_utc() const + { + return _int_cal_utc; + }; + /** + * @brief num_valid_cal_pulses + */ + int get_num_valid_cal_pulses() const + { + return _num_valid_cal_pulses; + }; + /** + * @brief num_valid_noise_pulses + */ + int get_num_valid_noise_pulses() const + { + return _num_valid_noise_pulses; + }; + /** + * @brief num_valid_replicas + */ + int get_num_valid_replicas() const + { + return _num_valid_replicas; + }; + /** + * @brief first_replica_sample + */ + double get_first_replica_sample() const + { + return _first_replica_sample; + }; + /** + * @brief mean_cal_pulse_power + */ + double get_mean_cal_pulse_power() const + { + return _mean_cal_pulse_power; + }; + /** + * @brief mean_noise_power + */ + double get_mean_noise_power() const + { + return _mean_noise_power; + }; + /** + * @brief range_comp_norm_fact + */ + double get_range_comp_norm_fact() const + { + return _range_comp_norm_fact; + }; + /** + * @brief replica_power + */ + double get_replica_power() const + { + return _replica_power; + }; + /** + * @brief first_range_pixel_mid_az_inc + */ + double get_first_range_pixel_mid_az_inc() const + { + return _first_range_pixel_mid_az_inc; + }; + /** + * @brief center_range_pix_mid_az_inc + */ + double get_center_range_pix_mid_az_inc() const + { + return _center_range_pix_mid_az_inc; + }; + /** + * @brief last_range_pix_mid_az_inc + */ + double get_last_range_pix_mid_az_inc() const + { + return _last_range_pix_mid_az_inc; + }; + /** + * @brief norm_ref_range_ro + */ + double get_norm_ref_range_ro() const + { + return _norm_ref_range_ro; + }; + /** + * @brief antenna_elev_flag + */ + int get_antenna_elev_flag() const + { + return _antenna_elev_flag; + }; + /** + * @brief abs_cal_const_K + */ + double get_abs_cal_const_K() + { + return _abs_cal_const_K; + }; + /** + * @brief upp_bound_K + */ + double get_upp_bound_K() + { + return _upp_bound_K; + }; + /** + * @brief low_bound_K + */ + double get_low_bound_K() + { + return _low_bound_K; + }; + /** + * @brief proc_noise_scale_fact + */ + double get_proc_noise_scale_fact() const + { + return _proc_noise_scale_fact; + }; + /** + * @brief K_gen_date + */ + std::string get_K_gen_date() + { + return _K_gen_date; + }; + /** + * @brief K_vers_num + */ + std::string get_K_vers_num() + { + return _K_vers_num; + }; + /** + * @brief num_duplic_input_lines + */ + int get_num_duplic_input_lines() const + { + return _num_duplic_input_lines; + }; + /** + * @brief estim_bit_error_rate + */ + double get_estim_bit_error_rate() const + { + return _estim_bit_error_rate; + }; + /** + * @brief out_image_mean + */ + double get_out_image_mean() const + { + return _out_image_mean; + }; + /** + * @brief out_image_std_dev + */ + double get_out_image_std_dev() const + { + return _out_image_std_dev; + }; + /** + * @brief out_image_max_value + */ + double get_out_image_max_value() const + { + return _out_image_max_value; + }; + /** + * @brief time_raw_data_first_input + */ + std::string get_time_raw_data_first_input() const + { + return _time_raw_data_first_input; + }; + /** + * @brief time_asc_node_state_vectors + */ + std::string get_time_asc_node_state_vectors() const + { + return _time_asc_node_state_vectors; + }; + /** + * @brief asc_node_pos_X_comp + */ + std::string get_asc_node_pos_X_comp() + { + return _asc_node_pos_X_comp; + }; + /** + * @brief asc_node_pos_Y_comp + */ + std::string get_asc_node_pos_Y_comp() + { + return _asc_node_pos_Y_comp; + }; + /** + * @brief asc_node_pos_Z_comp + */ + std::string get_asc_node_pos_Z_comp() + { + return _asc_node_pos_Z_comp; + }; + /** + * @brief asc_node_vel_X_comp + */ + std::string get_asc_node_vel_X_comp() + { + return _asc_node_vel_X_comp; + }; + /** + * @brief asc_node_vel_Y_comp + */ + std::string get_asc_node_vel_Y_comp() + { + return _asc_node_vel_Y_comp; + }; + /** + * @brief asc_node_vel_Z_comp + */ + std::string get_asc_node_vel_Z_comp() + { + return _asc_node_vel_Z_comp; + }; + /** + * @brief out_pixel_bit_length + */ + int get_out_pixel_bit_length() const + { + return _out_pixel_bit_length; + }; + /** + * @brief proc_gain_param_1 + */ + double get_proc_gain_param_1() + { + return _proc_gain_param_1; + }; + /** + * @brief proc_gain_param_2 + */ + double get_proc_gain_param_2() + { + return _proc_gain_param_2; + }; + /** + * @brief proc_gain_param_3 + */ + double get_proc_gain_param_3() + { + return _proc_gain_param_3; + }; + /** + * @brief peak_loc_cross_correl_fun + */ + int get_peak_loc_cross_correl_fun() const + { + return _peak_loc_cross_correl_fun; + }; + /** + * @brief 3_dB_width_CCF + */ + double get_3_dB_width_CCF() + { + return _3_dB_width_CCF; + }; + /** + * @brief first_side_lobe_level + */ + double get_first_side_lobe_level() const + { + return _first_side_lobe_level; + }; + /** + * @brief ISLR_CCF_between_last + */ + double get_ISLR_CCF_between_last() + { + return _ISLR_CCF_between_last; + }; + /** + * @brief peak_loc_CCF_betw_last + */ + int get_peak_loc_CCF_betw_last() + { + return _peak_loc_CCF_betw_last; + }; + /** + * @brief Roll_Tilt_Mode_flag + */ + int get_Roll_Tilt_Mode_flag() + { + return _Roll_Tilt_Mode_flag; + }; + /** + * @brief raw_data_correction_flag + */ + int get_raw_data_correction_flag() const + { + return _raw_data_correction_flag; + }; + /** + * @brief look_detecion_flag + */ + int get_look_detecion_flag() const + { + return _look_detecion_flag; + }; + /** + * @brief doppler_ambiguity_estimat_flag + */ + int get_doppler_ambiguity_estimat_flag() const + { + return _doppler_ambiguity_estimat_flag; + }; + /** + * @brief azimuth_baseband_convers_flag + */ + int get_azimuth_baseband_convers_flag() const + { + return _azimuth_baseband_convers_flag; + }; + /** + * @brief samples_per_line_used + */ + int get_samples_per_line_used() const + { + return _samples_per_line_used; + }; + /** + * @brief range_lines_skip_factor + */ + int get_range_lines_skip_factor() const + { + return _range_lines_skip_factor; + }; + /** + * @brief time_of_inp_state_vectors + */ + std::string get_time_of_inp_state_vectors() const + { + return _time_of_inp_state_vectors; + }; + /** + * @brief inp_state_vect_pos_X_comp + */ + std::string get_inp_state_vect_pos_X_comp() + { + return _inp_state_vect_pos_X_comp; + }; + /** + * @brief inp_state_vect_pos_Y_comp + */ + std::string get_inp_state_vect_pos_Y_comp() + { + return _inp_state_vect_pos_Y_comp; + }; + /** + * @brief inp_state_vect_pos_Z_comp + */ + std::string get_inp_state_vect_pos_Z_comp() + { + return _inp_state_vect_pos_Z_comp; + }; + /** + * @brief inp_state_vect_vel_Vx_comp + */ + std::string get_inp_state_vect_vel_Vx_comp() + { + return _inp_state_vect_vel_Vx_comp; + }; + /** + * @brief inp_state_vect_vel_Vy_comp + */ + std::string get_inp_state_vect_vel_Vy_comp() + { + return _inp_state_vect_vel_Vy_comp; + }; + /** + * @brief inp_state_vect_vel_Vz_comp + */ + std::string get_inp_state_vect_vel_Vz_comp() + { + return _inp_state_vect_vel_Vz_comp; + }; + /** + * @brief inp_state_vector_type_flag + */ + int get_inp_state_vector_type_flag() const + { + return _inp_state_vector_type_flag; + }; + /** + * @brief win_coeff_for_range_match + */ + double get_win_coeff_for_range_match() const + { + return _win_coeff_for_range_match; + }; + /** + * @brief win_coeff_for_azi_match + */ + double get_win_coeff_for_azi_match() const + { + return _win_coeff_for_azi_match; + }; + /** + * @brief update_period_range_match + */ + int get_update_period_range_match() const + { + return _update_period_range_match; + }; + /** + * @brief look_scalar_gain_1 + */ + double get_look_scalar_gain_1() + { + return _look_scalar_gain_1; + }; + /** + * @brief look_scalar_gain_2 + */ + double get_look_scalar_gain_2() + { + return _look_scalar_gain_2; + }; + /** + * @brief look_scalar_gain_3 + */ + double get_look_scalar_gain_3() + { + return _look_scalar_gain_3; + }; + /** + * @brief look_scalar_gain_4 + */ + double get_look_scalar_gain_4() + { + return _look_scalar_gain_4; + }; + /** + * @brief look_scalar_gain_5 + */ + double get_look_scalar_gain_5() + { + return _look_scalar_gain_5; + }; + /** + * @brief look_scalar_gain_6 + */ + double get_look_scalar_gain_6() + { + return _look_scalar_gain_6; + }; + /** + * @brief look_scalar_gain_7 + */ + double get_look_scalar_gain_7() + { + return _look_scalar_gain_7; + }; + /** + * @brief look_scalar_gain_8 + */ + double get_look_scalar_gain_8() + { + return _look_scalar_gain_8; + }; + /** + * @brief samp_window_start_time_bias + */ + int get_samp_window_start_time_bias() const + { + return _samp_window_start_time_bias; + }; + /** + * @brief doppler_centroid_cubic_coeff + */ + double get_doppler_centroid_cubic_coeff() const + { + return _doppler_centroid_cubic_coeff; + }; + /** + * @brief PRF_code_first_range_line + */ + int get_PRF_code_first_range_line() + { + return _PRF_code_first_range_line; + }; + /** + * @brief PRF_code_last_range_line + */ + int get_PRF_code_last_range_line() + { + return _PRF_code_last_range_line; + }; + /** + * @brief samp_win_start_first + */ + int get_samp_win_start_first() const + { + return _samp_win_start_first; + }; + /** + * @brief samp_win_start_last + */ + int get_samp_win_start_last() const + { + return _samp_win_start_last; + }; + /** + * @brief cal_syst_gain_last_proc + */ + int get_cal_syst_gain_last_proc() const + { + return _cal_syst_gain_last_proc; + }; + /** + * @brief receiver_gain_last_proc + */ + int get_receiver_gain_last_proc() const + { + return _receiver_gain_last_proc; + }; + /** + * @brief first_processed_range_sample + */ + int get_first_processed_range_sample() const + { + return _first_processed_range_sample; + }; + /** + * @brief azimuth_FFT_IFFT_ratio + */ + int get_azimuth_FFT_IFFT_ratio() + { + return _azimuth_FFT_IFFT_ratio; + }; + /** + * @brief num_azimuth_blocks_proc + */ + int get_num_azimuth_blocks_proc() const + { + return _num_azimuth_blocks_proc; + }; + /** + * @brief num_input_raw_data_lines + */ + int get_num_input_raw_data_lines() const + { + return _num_input_raw_data_lines; + }; + /** + * @brief initial_doppler_ambiguity_num + */ + int get_initial_doppler_ambiguity_num() const + { + return _initial_doppler_ambiguity_num; + }; + /** + * @brief thresh_no_1_flag + */ + double get_thresh_no_1_flag() + { + return _thresh_no_1_flag; + }; + /** + * @brief thresh_no_2_flag + */ + double get_thresh_no_2_flag() + { + return _thresh_no_2_flag; + }; + /** + * @brief thresh_no_3_flag + */ + double get_thresh_no_3_flag() + { + return _thresh_no_3_flag; + }; + /** + * @brief thresh_no_4_flag + */ + double get_thresh_no_4_flag() + { + return _thresh_no_4_flag; + }; + /** + * @brief thresh_no_5_flag + */ + double get_thresh_no_5_flag() + { + return _thresh_no_5_flag; + }; + /** + * @brief thresh_no_6_flag + */ + double get_thresh_no_6_flag() + { + return _thresh_no_6_flag; + }; + /** + * @brief thresh_no_7_flag + */ + double get_thresh_no_7_flag() + { + return _thresh_no_7_flag; + }; + /** + * @brief thresh_no_8_flag + */ + double get_thresh_no_8_flag() + { + return _thresh_no_8_flag; + }; + /** + * @brief thresh_no_9_flag + */ + double get_thresh_no_9_flag() + { + return _thresh_no_9_flag; + }; + /** + * @brief thresh_no_10_flag + */ + double get_thresh_no_10_flag() + { + return _thresh_no_10_flag; + }; + /** + * @brief thresh_no_11_flag + */ + double get_thresh_no_11_flag() + { + return _thresh_no_11_flag; + }; + /** + * @brief sat_binary_time_of_first + */ + int get_sat_binary_time_of_first() const + { + return _sat_binary_time_of_first; + }; + /** + * @brief num_valid_pixels_per_range + */ + int get_num_valid_pixels_per_range() const + { + return _num_valid_pixels_per_range; + }; + /** + * @brief num_range_samp_discarded + */ + int get_num_range_samp_discarded() const + { + return _num_range_samp_discarded; + }; + /** + * @brief I_gain_imb_lower_bound + */ + double get_I_gain_imb_lower_bound() + { + return _I_gain_imb_lower_bound; + }; + /** + * @brief I_gain_imb_upper_bound + */ + double get_I_gain_imb_upper_bound() + { + return _I_gain_imb_upper_bound; + }; + /** + * @brief I_Q_quad_depar_lower_bound + */ + double get_I_Q_quad_depar_lower_bound() + { + return _I_Q_quad_depar_lower_bound; + }; + /** + * @brief I_Q_quad_depar_upper_bound + */ + double get_I_Q_quad_depar_upper_bound() + { + return _I_Q_quad_depar_upper_bound; + }; + /** + * @brief 3_dB_look_bandwidth + */ + double get_3_dB_look_bandwidth() + { + return _3_dB_look_bandwidth; + }; + /** + * @brief 3_dB_look_proc_dopp_bandw + */ + double get_3_dB_look_proc_dopp_bandw() + { + return _3_dB_look_proc_dopp_bandw; + }; + /** + * @brief range_spread_loss_comp_flag + */ + int get_range_spread_loss_comp_flag() const + { + return _range_spread_loss_comp_flag; + }; + /** + * @brief datation_flag + */ + bool get_datation_flag() const + { + return _datation_flag; + }; + /** + * @brief max_error_range_line_timing + */ + int get_max_error_range_line_timing() const + { + return _max_error_range_line_timing; + }; + /** + * @brief form_num_range_line_used + */ + int get_form_num_range_line_used() const + { + return _form_num_range_line_used; + }; + /** + * @brief autom_look_scal_gain_flag + */ + bool get_autom_look_scal_gain_flag() const + { + return _autom_look_scal_gain_flag; + }; + /** + * @brief max_value_look_scalar_gain + */ + int get_max_value_look_scalar_gain() const + { + return _max_value_look_scalar_gain; + }; + /** + * @brief replica_norm_method_flag + */ + int get_replica_norm_method_flag() const + { + return _replica_norm_method_flag; + }; + /** + * @brief coef_ground_range_1 + */ + double get_coef_ground_range_1() const + { + return _coef_ground_range_1; + }; + /** + * @brief coef_ground_range_2 + */ + double get_coef_ground_range_2() const + { + return _coef_ground_range_2; + }; + /** + * @brief coef_ground_range_3 + */ + double get_coef_ground_range_3() const + { + return _coef_ground_range_3; + }; + /** + * @brief coef_ground_range_4 + */ + double get_coef_ground_range_4() const + { + return _coef_ground_range_4; + }; + /** + * @brief coef_ant_elev_1 + */ + double get_coef_ant_elev_1() const + { + return _coef_ant_elev_1; + }; + /** + * @brief coef_ant_elev_2 + */ + double get_coef_ant_elev_2() const + { + return _coef_ant_elev_2; + }; + /** + * @brief coef_ant_elev_3 + */ + double get_coef_ant_elev_3() const + { + return _coef_ant_elev_3; + }; + /** + * @brief coef_ant_elev_4 + */ + double get_coef_ant_elev_4() const + { + return _coef_ant_elev_4; + }; + /** + * @brief coef_ant_elev_5 + */ + double get_coef_ant_elev_5() const + { + return _coef_ant_elev_5; + }; + /** + * @brief range_time_origin_ant + */ + double get_range_time_origin_ant() const + { + return _range_time_origin_ant; + }; + + +protected: + + /** + * @brief last_release_qc_date + */ + std::string _name_of_facil_rec; + /** + * @brief last_release_qc_date + */ + std::string _last_release_qc_date; + /** + * @brief last_release_cal_date + */ + std::string _last_release_cal_date; + /** + * @brief qa_summary_flag + */ + int _qa_summary_flag; + /** + * @brief prf_code_change_flag + */ + int _prf_code_change_flag; + /** + * @brief sampling_win_change_flag + */ + int _sampling_win_change_flag; + /** + * @brief cal_gain_change_flag + */ + int _cal_gain_change_flag; + /** + * @brief quirp_qu_flag + */ + int _quirp_qu_flag; + /** + * @brief inp_data_stat_flag + */ + int _inp_data_stat_flag; + /** + * @brief dopp_cent_conf_meas_flag + */ + int _dopp_cent_conf_meas_flag; + /** + * @brief dopp_cent_val_flag + */ + int _dopp_cent_val_flag; + /** + * @brief dopp_ambig_conf_meas_flag + */ + int _dopp_ambig_conf_meas_flag; + /** + * @brief outp_data_mean_flag + */ + int _outp_data_mean_flag; + /** + * @brief OGOB_flag + */ + int _OGOB_flag; + /** + * @brief PRF_changes + */ + int _PRF_changes; + /** + * @brief sampling_win_changes + */ + int _sampling_win_changes; + /** + * @brief cal_gain_changes + */ + int _cal_gain_changes; + /** + * @brief missing_lines + */ + int _missing_lines; + /** + * @brief rec_gain_changes + */ + int _rec_gain_changes; + /** + * @brief pulse_width_of_ACF_3db + */ + double _pulse_width_of_ACF_3db; + /** + * @brief first_side_lobe_lev_of_ACF + */ + double _first_side_lobe_lev_of_ACF; + /** + * @brief ISLR_of_ACF + */ + double _ISLR_of_ACF; + /** + * @brief dopp_cent_conf_meas + */ + double _dopp_cent_conf_meas; + /** + * @brief dopp_ambig_conf_meas + */ + double _dopp_ambig_conf_meas; + /** + * @brief inp_data_I_mean + */ + double _inp_data_I_mean; + /** + * @brief inp_data_Q_mean + */ + double _inp_data_Q_mean; + /** + * @brief inp_data_I_stddev + */ + double _inp_data_I_stddev; + /** + * @brief inp_data_Q_stddev + */ + double _inp_data_Q_stddev; + /** + * @brief cal_sys_gain + */ + double _cal_sys_gain; + /** + * @brief first_rec_gain_read + */ + double _first_rec_gain_read; + /** + * @brief dopp_ambig_num + */ + double _dopp_ambig_num; + /** + * @brief I_channel_bias_correction + */ + double _I_channel_bias_correction; + /** + * @brief Q_channel_bias_correction + */ + double _Q_channel_bias_correction; + /** + * @brief I_channel_gain_correction + */ + double _I_channel_gain_correction; + /** + * @brief Q_channel_gain_correction + */ + double _Q_channel_gain_correction; + /** + * @brief Q_channel_I_Q_correction + */ + double _Q_channel_I_Q_correction; + /** + * @brief noise_power + */ + double _noise_power; + /** + * @brief int_cal_utc + */ + int _int_cal_utc; + /** + * @brief num_valid_cal_pulses + */ + int _num_valid_cal_pulses; + /** + * @brief num_valid_noise_pulses + */ + int _num_valid_noise_pulses; + /** + * @brief num_valid_replicas + */ + int _num_valid_replicas; + /** + * @brief first_replica_sample + */ + double _first_replica_sample; + /** + * @brief mean_cal_pulse_power + */ + double _mean_cal_pulse_power; + /** + * @brief mean_noise_power + */ + double _mean_noise_power; + /** + * @brief range_comp_norm_fact + */ + double _range_comp_norm_fact; + /** + * @brief replica_power + */ + double _replica_power; + /** + * @brief first_range_pixel_mid_az_inc + */ + double _first_range_pixel_mid_az_inc; + /** + * @brief center_range_pix_mid_az_inc + */ + double _center_range_pix_mid_az_inc; + /** + * @brief last_range_pix_mid_az_inc + */ + double _last_range_pix_mid_az_inc; + /** + * @brief norm_ref_range_ro + */ + double _norm_ref_range_ro; + /** + * @brief antenna_elev_flag + */ + int _antenna_elev_flag; + /** + * @brief abs_cal_const_K + */ + double _abs_cal_const_K; + /** + * @brief upp_bound_K + */ + double _upp_bound_K; + /** + * @brief low_bound_K + */ + double _low_bound_K; + /** + * @brief proc_noise_scale_fact + */ + double _proc_noise_scale_fact; + /** + * @brief K_gen_date + */ + std::string _K_gen_date; + /** + * @brief K_vers_num + */ + std::string _K_vers_num; + /** + * @brief num_duplic_input_lines + */ + int _num_duplic_input_lines; + /** + * @brief estim_bit_error_rate + */ + double _estim_bit_error_rate; + /** + * @brief out_image_mean + */ + double _out_image_mean; + /** + * @brief out_image_std_dev + */ + double _out_image_std_dev; + /** + * @brief out_image_max_value + */ + double _out_image_max_value; + /** + * @brief time_raw_data_first_input + */ + std::string _time_raw_data_first_input; + /** + * @brief time_asc_node_state_vectors + */ + std::string _time_asc_node_state_vectors; + /** + * @brief asc_node_pos_X_comp + */ + std::string _asc_node_pos_X_comp; + /** + * @brief asc_node_pos_Y_comp + */ + std::string _asc_node_pos_Y_comp; + /** + * @brief asc_node_pos_Z_comp + */ + std::string _asc_node_pos_Z_comp; + /** + * @brief asc_node_vel_X_comp + */ + std::string _asc_node_vel_X_comp; + /** + * @brief asc_node_vel_Y_comp + */ + std::string _asc_node_vel_Y_comp; + /** + * @brief asc_node_vel_Z_comp + */ + std::string _asc_node_vel_Z_comp; + /** + * @brief out_pixel_bit_length + */ + int _out_pixel_bit_length; + /** + * @brief proc_gain_param_1 + */ + double _proc_gain_param_1; + /** + * @brief proc_gain_param_2 + */ + double _proc_gain_param_2; + /** + * @brief proc_gain_param_3 + */ + double _proc_gain_param_3; + /** + * @brief peak_loc_cross_correl_fun + */ + int _peak_loc_cross_correl_fun; + /** + * @brief 3_dB_width_CCF + */ + double _3_dB_width_CCF; + /** + * @brief first_side_lobe_level + */ + double _first_side_lobe_level; + /** + * @brief ISLR_CCF_between_last + */ + double _ISLR_CCF_between_last; + /** + * @brief peak_loc_CCF_betw_last + */ + int _peak_loc_CCF_betw_last; + /** + * @brief Roll_Tilt_Mode_flag + */ + int _Roll_Tilt_Mode_flag; + /** + * @brief raw_data_correction_flag + */ + int _raw_data_correction_flag; + /** + * @brief look_detecion_flag + */ + int _look_detecion_flag; + /** + * @brief doppler_ambiguity_estimat_flag + */ + int _doppler_ambiguity_estimat_flag; + /** + * @brief azimuth_baseband_convers_flag + */ + int _azimuth_baseband_convers_flag; + /** + * @brief samples_per_line_used + */ + int _samples_per_line_used; + /** + * @brief range_lines_skip_factor + */ + int _range_lines_skip_factor; + /** + * @brief time_of_inp_state_vectors + */ + std::string _time_of_inp_state_vectors; + /** + * @brief inp_state_vect_pos_X_comp + */ + std::string _inp_state_vect_pos_X_comp; + /** + * @brief inp_state_vect_pos_Y_comp + */ + std::string _inp_state_vect_pos_Y_comp; + /** + * @brief inp_state_vect_pos_Z_comp + */ + std::string _inp_state_vect_pos_Z_comp; + /** + * @brief inp_state_vect_vel_Vx_comp + */ + std::string _inp_state_vect_vel_Vx_comp; + /** + * @brief inp_state_vect_vel_Vy_comp + */ + std::string _inp_state_vect_vel_Vy_comp; + /** + * @brief inp_state_vect_vel_Vz_comp + */ + std::string _inp_state_vect_vel_Vz_comp; + /** + * @brief inp_state_vector_type_flag + */ + int _inp_state_vector_type_flag; + /** + * @brief win_coeff_for_range_match + */ + double _win_coeff_for_range_match; + /** + * @brief win_coeff_for_azi_match + */ + double _win_coeff_for_azi_match; + /** + * @brief update_period_range_match + */ + int _update_period_range_match; + /** + * @brief look_scalar_gain_1 + */ + double _look_scalar_gain_1; + /** + * @brief look_scalar_gain_2 + */ + double _look_scalar_gain_2; + /** + * @brief look_scalar_gain_3 + */ + double _look_scalar_gain_3; + /** + * @brief look_scalar_gain_4 + */ + double _look_scalar_gain_4; + /** + * @brief look_scalar_gain_5 + */ + double _look_scalar_gain_5; + /** + * @brief look_scalar_gain_6 + */ + double _look_scalar_gain_6; + /** + * @brief look_scalar_gain_7 + */ + double _look_scalar_gain_7; + /** + * @brief look_scalar_gain_8 + */ + double _look_scalar_gain_8; + /** + * @brief samp_window_start_time_bias + */ + int _samp_window_start_time_bias; + /** + * @brief doppler_centroid_cubic_coeff + */ + double _doppler_centroid_cubic_coeff; + /** + * @brief PRF_code_first_range_line + */ + int _PRF_code_first_range_line; + /** + * @brief PRF_code_last_range_line + */ + int _PRF_code_last_range_line; + /** + * @brief samp_win_start_first + */ + int _samp_win_start_first; + /** + * @brief samp_win_start_last + */ + int _samp_win_start_last; + /** + * @brief cal_syst_gain_last_proc + */ + int _cal_syst_gain_last_proc; + /** + * @brief receiver_gain_last_proc + */ + int _receiver_gain_last_proc; + /** + * @brief first_processed_range_sample + */ + int _first_processed_range_sample; + /** + * @brief azimuth_FFT_IFFT_ratio + */ + int _azimuth_FFT_IFFT_ratio; + /** + * @brief num_azimuth_blocks_proc + */ + int _num_azimuth_blocks_proc; + /** + * @brief num_input_raw_data_lines + */ + int _num_input_raw_data_lines; + /** + * @brief initial_doppler_ambiguity_num + */ + int _initial_doppler_ambiguity_num; + /** + * @brief thresh_no_1_flag + */ + double _thresh_no_1_flag; + /** + * @brief thresh_no_2_flag + */ + double _thresh_no_2_flag; + /** + * @brief thresh_no_3_flag + */ + double _thresh_no_3_flag; + /** + * @brief thresh_no_4_flag + */ + double _thresh_no_4_flag; + /** + * @brief thresh_no_5_flag + */ + double _thresh_no_5_flag; + /** + * @brief thresh_no_6_flag + */ + double _thresh_no_6_flag; + /** + * @brief thresh_no_7_flag + */ + double _thresh_no_7_flag; + /** + * @brief thresh_no_8_flag + */ + double _thresh_no_8_flag; + /** + * @brief thresh_no_9_flag + */ + double _thresh_no_9_flag; + /** + * @brief thresh_no_10_flag + */ + double _thresh_no_10_flag; + /** + * @brief thresh_no_11_flag + */ + double _thresh_no_11_flag; + /** + * @brief sat_binary_time_of_first + */ + int _sat_binary_time_of_first; + /** + * @brief num_valid_pixels_per_range + */ + int _num_valid_pixels_per_range; + /** + * @brief num_range_samp_discarded + */ + int _num_range_samp_discarded; + /** + * @brief I_gain_imb_lower_bound + */ + double _I_gain_imb_lower_bound; + /** + * @brief I_gain_imb_upper_bound + */ + double _I_gain_imb_upper_bound; + /** + * @brief I_Q_quad_depar_lower_bound + */ + double _I_Q_quad_depar_lower_bound; + /** + * @brief I_Q_quad_depar_upper_bound + */ + double _I_Q_quad_depar_upper_bound; + /** + * @brief 3_dB_look_bandwidth + */ + double _3_dB_look_bandwidth; + /** + * @brief 3_dB_look_proc_dopp_bandw + */ + double _3_dB_look_proc_dopp_bandw; + /** + * @brief range_spread_loss_comp_flag + */ + int _range_spread_loss_comp_flag; + /** + * @brief datation_flag + */ + bool _datation_flag; + /** + * @brief max_error_range_line_timing + */ + int _max_error_range_line_timing; + /** + * @brief form_num_range_line_used + */ + int _form_num_range_line_used; + /** + * @brief autom_look_scal_gain_flag + */ + bool _autom_look_scal_gain_flag; + /** + * @brief max_value_look_scalar_gain + */ + int _max_value_look_scalar_gain; + /** + * @brief replica_norm_method_flag + */ + int _replica_norm_method_flag; + /** + * @brief coef_ground_range_1 + */ + double _coef_ground_range_1; + /** + * @brief coef_ground_range_2 + */ + double _coef_ground_range_2; + /** + * @brief coef_ground_range_3 + */ + double _coef_ground_range_3; + /** + * @brief coef_ground_range_4 + */ + double _coef_ground_range_4; + /** + * @brief coef_ant_elev_1 + */ + double _coef_ant_elev_1; + /** + * @brief coef_ant_elev_2 + */ + double _coef_ant_elev_2; + /** + * @brief coef_ant_elev_3 + */ + double _coef_ant_elev_3; + /** + * @brief coef_ant_elev_4 + */ + double _coef_ant_elev_4; + /** + * @brief coef_ant_elev_5 + */ + double _coef_ant_elev_5; + /** + * @brief range_time_origin_ant + */ + double _range_time_origin_ant; + +private: + +}; +} +#endif diff --git a/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarFileDescriptor.cpp b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarFileDescriptor.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b8dbcec9fbb19cc99297681621a59c751a3d0c3c --- /dev/null +++ b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarFileDescriptor.cpp @@ -0,0 +1,444 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// "Copyright Centre for Remote Imaging, Sensing and Processing" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#include <AlosSarFileDescriptor.h> + + +namespace ossimplugins +{ + +AlosSarFileDescriptor::AlosSarFileDescriptor() : AlosSarRecord("sar_desc_rec") +{ +} + +AlosSarFileDescriptor::~AlosSarFileDescriptor() +{ +} + +std::ostream& operator<<(std::ostream& os, const AlosSarFileDescriptor& data) +{ + os<<"ascii_flag:"<<data._ascii_flag.c_str()<<std::endl; + os<<"continuation_flag:"<<data._continuation_flag.c_str()<<std::endl; + os<<"format_doc:"<<data._format_doc.c_str()<<std::endl; + os<<"format_ver:"<<data._format_ver.c_str()<<std::endl; + os<<"design_rev:"<<data._design_rev.c_str()<<std::endl; + os<<"software_id:"<<data._software_id.c_str()<<std::endl; + os<<"file_num:"<<data._file_num<<std::endl; + os<<"file_name:"<<data._file_name.c_str()<<std::endl; + os<<"rec_seq:"<<data._rec_seq.c_str()<<std::endl; + os<<"seq_loc:"<<data._seq_loc<<std::endl; + os<<"seq_len:"<<data._seq_len<<std::endl; + os<<"rec_code:"<<data._rec_code.c_str()<<std::endl; + os<<"code_loc:"<<data._code_loc<<std::endl; + os<<"code_len:"<<data._code_len<<std::endl; + os<<"rec_len:"<<data._rec_len.c_str()<<std::endl; + os<<"rlen_loc:"<<data._rlen_loc<<std::endl; + os<<"rlen_len:"<<data._rlen_len<<std::endl; + os<<"n_dataset:"<<data._n_dataset<<std::endl; + os<<"l_dataset:"<<data._l_dataset<<std::endl; + os<<"n_map_proj:"<<data._n_map_proj<<std::endl; + os<<"l_map_proj:"<<data._l_map_proj<<std::endl; + os<<"n_plat_pos:"<<data._n_plat_pos<<std::endl; + os<<"l_plat_pos:"<<data._l_plat_pos<<std::endl; + os<<"n_att_data:"<<data._n_att_data<<std::endl; + os<<"l_att_data:"<<data._l_att_data<<std::endl; + os<<"n_radi_data:"<<data._n_radi_data<<std::endl; + os<<"l_radi_data:"<<data._l_radi_data<<std::endl; + os<<"n_radi_comp:"<<data._n_radi_comp<<std::endl; + os<<"l_radi_comp:"<<data._l_radi_comp<<std::endl; + os<<"n_qual_sum:"<<data._n_qual_sum<<std::endl; + os<<"l_qual_sum:"<<data._l_qual_sum<<std::endl; + os<<"n_data_his:"<<data._n_data_his<<std::endl; + os<<"l_data_his:"<<data._l_data_his<<std::endl; + os<<"n_rang_spec:"<<data._n_rang_spec<<std::endl; + os<<"l_rang_spec:"<<data._l_rang_spec<<std::endl; + os<<"n_dem_desc:"<<data._n_dem_desc<<std::endl; + os<<"l_dem_desc:"<<data._l_dem_desc<<std::endl; + os<<"n_radar_par:"<<data._n_radar_par<<std::endl; + os<<"l_radar_par:"<<data._l_radar_par<<std::endl; + os<<"n_anno_data:"<<data._n_anno_data<<std::endl; + os<<"l_anno_data:"<<data._l_anno_data<<std::endl; + os<<"n_det_proc:"<<data._n_det_proc<<std::endl; + os<<"l_det_proc:"<<data._l_det_proc<<std::endl; + os<<"n_cal:"<<data._n_cal<<std::endl; + os<<"l_cal:"<<data._l_cal<<std::endl; + os<<"n_gcp:"<<data._n_gcp<<std::endl; + os<<"l_gcp:"<<data._l_gcp<<std::endl; + os<<"n_fac_data:"<<data._n_fac_data<<std::endl; + os<<"l_fac_data:"<<data._l_fac_data<<std::endl; + os<<"n_fac_data2:"<<data._n_fac_data2<<std::endl; + os<<"l_fac_data2:"<<data._l_fac_data2<<std::endl; + os<<"n_fac_data3:"<<data._n_fac_data3<<std::endl; + os<<"l_fac_data3:"<<data._l_fac_data3<<std::endl; + os<<"n_fac_data4:"<<data._n_fac_data4<<std::endl; + os<<"l_fac_data4:"<<data._l_fac_data4<<std::endl; + os<<"n_fac_data5:"<<data._n_fac_data5<<std::endl; + os<<"l_fac_data5:"<<data._l_fac_data5<<std::endl; + os<<"n_fac_data6:"<<data._n_fac_data6<<std::endl; + os<<"l_fac_data6:"<<data._l_fac_data6<<std::endl; + os<<"n_fac_data7:"<<data._n_fac_data7<<std::endl; + os<<"l_fac_data7:"<<data._l_fac_data7<<std::endl; + os<<"n_fac_data8:"<<data._n_fac_data8<<std::endl; + os<<"l_fac_data8:"<<data._l_fac_data8<<std::endl; + os<<"n_fac_data9:"<<data._n_fac_data9<<std::endl; + os<<"l_fac_data9:"<<data._l_fac_data9<<std::endl; + os<<"n_fac_data10:"<<data._n_fac_data10<<std::endl; + os<<"l_fac_data10:"<<data._l_fac_data10<<std::endl; + os<<"n_fac_data11:"<<data._n_fac_data11<<std::endl; + os<<"l_fac_data11:"<<data._l_fac_data11<<std::endl; + return os; +} + +std::istream& operator>>(std::istream& is, AlosSarFileDescriptor& data) +{ + char buf2[3]; + buf2[2] = '\0'; + char buf12[13]; + buf12[12] = '\0'; + char buf16[17]; + buf16[16] = '\0'; + char buf4[5]; + buf4[4] = '\0'; + char buf6[7]; + buf6[6] = '\0'; + char buf8[9]; + buf8[8] = '\0'; + char buf64[65]; + buf64[64] = '\0'; + + char buf60[61]; + buf60[60] = '\0'; + + char buf146[147]; + buf146[146] = '\0'; + + is.read(buf2,2); + data._ascii_flag = buf2; + + is.read(buf2,2); + data._continuation_flag = buf2; + + is.read(buf12,12); + data._format_doc = buf12; + + is.read(buf2,2); + data._format_ver = buf2; + + is.read(buf2,2); + data._design_rev = buf2; + + is.read(buf12,12); + data._software_id = buf12; + + is.read(buf4,4); + data._file_num = atoi(buf4); + + is.read(buf16,16); + data._file_name = buf16; + + is.read(buf4,4); + data._rec_seq = buf4; + + is.read(buf8,8); + data._seq_loc = atoi(buf8); + + is.read(buf4,4); + data._seq_len = atoi(buf4); + + is.read(buf4,4); + data._rec_code = buf4; + + is.read(buf8,8); + data._code_loc = atoi(buf8); + + is.read(buf4,4); + data._code_len = atoi(buf4); + + is.read(buf4,4); + data._rec_len = buf4; + + is.read(buf8,8); + data._rlen_loc = atoi(buf8); + + is.read(buf4,4); + data._rlen_len = atoi(buf4); + + is.read(buf4,4); + + is.read(buf64,64); + + is.read(buf6,6); + data._n_dataset = atoi(buf6); + + is.read(buf6,6); + data._l_dataset = atoi(buf6); + + is.read(buf6,6); + data._n_map_proj = atoi(buf6); + + is.read(buf6,6); + data._l_map_proj = atoi(buf6); + + is.read(buf6,6); + data._n_plat_pos = atoi(buf6); + is.read(buf6,6); + data._l_plat_pos = atoi(buf6); + is.read(buf6,6); + data._n_att_data = atoi(buf6); + is.read(buf6,6); + data._l_att_data = atoi(buf6); + is.read(buf6,6); + data._n_radi_data = atoi(buf6); + is.read(buf6,6); + data._l_radi_data = atoi(buf6); + is.read(buf6,6); + data._n_radi_comp = atoi(buf6); + is.read(buf6,6); + data._l_radi_comp = atoi(buf6); + is.read(buf6,6); + data._n_qual_sum = atoi(buf6); + is.read(buf6,6); + data._l_qual_sum = atoi(buf6); + is.read(buf6,6); + data._n_data_his = atoi(buf6); + is.read(buf6,6); + data._l_data_his = atoi(buf6); + + + + is.read(buf6,6); + data._n_rang_spec = atoi(buf6); + is.read(buf6,6); + data._l_rang_spec = atoi(buf6); + is.read(buf6,6); + data._n_dem_desc = atoi(buf6); + is.read(buf6,6); + data._l_dem_desc = atoi(buf6); + is.read(buf6,6); + data._n_radar_par = atoi(buf6); + is.read(buf6,6); + data._l_radar_par = atoi(buf6); + is.read(buf6,6); + data._n_anno_data = atoi(buf6); + is.read(buf6,6); + data._l_anno_data = atoi(buf6); + is.read(buf6,6); + data._n_det_proc = atoi(buf6); + is.read(buf6,6); + data._l_det_proc = atoi(buf6); + is.read(buf6,6); + data._n_cal = atoi(buf6); + is.read(buf6,6); + data._l_cal = atoi(buf6); + is.read(buf6,6); + data._n_gcp = atoi(buf6); + is.read(buf6,6); + data._l_gcp = atoi(buf6); + is.read(buf60,60); + is.read(buf6,6); + data._n_fac_data = atoi(buf6); + is.read(buf8,8); + data._l_fac_data = atoi(buf8); + is.read(buf6,6); + data._n_fac_data2 = atoi(buf6); + is.read(buf8,8); + data._l_fac_data2 = atoi(buf8); + is.read(buf6,6); + data._n_fac_data3 = atoi(buf6); + is.read(buf8,8); + data._l_fac_data3 = atoi(buf8); + is.read(buf6,6); + data._n_fac_data4 = atoi(buf6); + is.read(buf8,8); + data._l_fac_data4 = atoi(buf8); + is.read(buf6,6); + data._n_fac_data5 = atoi(buf6); + is.read(buf8,8); + data._l_fac_data5 = atoi(buf8); + is.read(buf6,6); + data._n_fac_data6 = atoi(buf6); + is.read(buf8,8); + data._l_fac_data6 = atoi(buf8); + is.read(buf6,6); + data._n_fac_data7 = atoi(buf6); + is.read(buf8,8); + data._l_fac_data7 = atoi(buf8); + is.read(buf6,6); + data._n_fac_data8 = atoi(buf6); + is.read(buf8,8); + data._l_fac_data8 = atoi(buf8); + is.read(buf6,6); + data._n_fac_data9 = atoi(buf6); + is.read(buf8,8); + data._l_fac_data9 = atoi(buf8); + is.read(buf6,6); + data._n_fac_data10 = atoi(buf6); + is.read(buf8,8); + data._l_fac_data10 = atoi(buf8); + is.read(buf6,6); + data._n_fac_data11 = atoi(buf6); + is.read(buf8,8); + data._l_fac_data11 = atoi(buf8); + + is.read(buf146,146); + return is; +} + +AlosSarFileDescriptor::AlosSarFileDescriptor(const AlosSarFileDescriptor& rhs): + AlosSarRecord(rhs), + _ascii_flag(rhs._ascii_flag), + _continuation_flag(rhs._continuation_flag), + _format_doc(rhs._format_doc), + _format_ver(rhs._format_ver), + _design_rev(rhs._design_rev), + _software_id(rhs._software_id), + _file_num(rhs._file_num), + _file_name(rhs._file_name), + _rec_seq(rhs._rec_seq), + _seq_loc(rhs._seq_loc), + _seq_len(rhs._seq_len), + _rec_code(rhs._rec_code), + _code_loc(rhs._code_loc), + _code_len(rhs._code_len), + _rec_len(rhs._rec_len), + _rlen_loc(rhs._rlen_loc), + _rlen_len(rhs._rlen_len), + _n_dataset(rhs._n_dataset), + _l_dataset(rhs._l_dataset), + _n_map_proj(rhs._n_map_proj), + _l_map_proj(rhs._l_map_proj), + _n_plat_pos(rhs._n_plat_pos), + _l_plat_pos(rhs._l_plat_pos), + _n_att_data(rhs._n_att_data), + _l_att_data(rhs._l_att_data), + _n_radi_data(rhs._n_radi_data), + _l_radi_data(rhs._l_radi_data), + _n_radi_comp(rhs._n_radi_comp), + _l_radi_comp(rhs._l_radi_comp), + _n_qual_sum(rhs._n_qual_sum), + _l_qual_sum(rhs._l_qual_sum), + _n_data_his(rhs._n_data_his), + _l_data_his(rhs._l_data_his), + _n_rang_spec(rhs._n_rang_spec), + _l_rang_spec(rhs._l_rang_spec), + _n_dem_desc(rhs._n_dem_desc), + _l_dem_desc(rhs._l_dem_desc), + _n_radar_par(rhs._n_radar_par), + _l_radar_par(rhs._l_radar_par), + _n_anno_data(rhs._n_anno_data), + _l_anno_data(rhs._l_anno_data), + _n_det_proc(rhs._n_det_proc), + _l_det_proc(rhs._l_det_proc), + _n_cal(rhs._n_cal), + _l_cal(rhs._l_cal), + _n_gcp(rhs._n_gcp), + _l_gcp(rhs._l_gcp), + _n_fac_data(rhs._n_fac_data), + _l_fac_data(rhs._l_fac_data), + _n_fac_data2(rhs._n_fac_data2), + _l_fac_data2(rhs._l_fac_data2), + _n_fac_data3(rhs._n_fac_data3), + _l_fac_data3(rhs._l_fac_data3), + _n_fac_data4(rhs._n_fac_data4), + _l_fac_data4(rhs._l_fac_data4), + _n_fac_data5(rhs._n_fac_data5), + _l_fac_data5(rhs._l_fac_data5), + _n_fac_data6(rhs._n_fac_data6), + _l_fac_data6(rhs._l_fac_data6), + _n_fac_data7(rhs._n_fac_data7), + _l_fac_data7(rhs._l_fac_data7), + _n_fac_data8(rhs._n_fac_data8), + _l_fac_data8(rhs._l_fac_data8), + _n_fac_data9(rhs._n_fac_data9), + _l_fac_data9(rhs._l_fac_data9), + _n_fac_data10(rhs._n_fac_data10), + _l_fac_data10(rhs._l_fac_data10), + _n_fac_data11(rhs._n_fac_data11), + _l_fac_data11(rhs._l_fac_data11) + +{ +} + +AlosSarFileDescriptor& AlosSarFileDescriptor::operator=(const AlosSarFileDescriptor& rhs) +{ + _ascii_flag = rhs._ascii_flag; + _continuation_flag = rhs._continuation_flag; + _format_doc = rhs._format_doc; + _format_ver = rhs._format_ver; + _design_rev = rhs._design_rev; + _software_id = rhs._software_id; + _file_num = rhs._file_num; + _file_name = rhs._file_name; + _rec_seq = rhs._rec_seq; + _seq_loc = rhs._seq_loc; + _seq_len = rhs._seq_len; + _rec_code = rhs._rec_code; + _code_loc = rhs._code_loc; + _code_len = rhs._code_len; + _rec_len = rhs._rec_len; + _rlen_loc = rhs._rlen_loc; + _rlen_len = rhs._rlen_len; + _n_dataset = rhs._n_dataset; + _l_dataset = rhs._l_dataset; + _n_map_proj = rhs._n_map_proj; + _l_map_proj = rhs._l_map_proj; + _n_plat_pos = rhs._n_plat_pos; + _l_plat_pos = rhs._l_plat_pos; + _n_att_data = rhs._n_att_data; + _l_att_data = rhs._l_att_data; + _n_radi_data = rhs._n_radi_data; + _l_radi_data = rhs._l_radi_data; + _n_radi_comp = rhs._n_radi_comp; + _l_radi_comp = rhs._l_radi_comp; + _n_qual_sum = rhs._n_qual_sum ; + _l_qual_sum = rhs._l_qual_sum; + _n_data_his = rhs._n_data_his; + _l_data_his = rhs._l_data_his; + _n_rang_spec = rhs._n_rang_spec; + _l_rang_spec = rhs._l_rang_spec; + _n_dem_desc = rhs._n_dem_desc; + _l_dem_desc = rhs._l_dem_desc; + _n_radar_par = rhs._n_radar_par; + _l_radar_par = rhs._l_radar_par; + _n_anno_data = rhs._n_anno_data; + _l_anno_data = rhs._l_anno_data; + _n_det_proc = rhs._n_det_proc; + _l_det_proc = rhs._l_det_proc; + _n_cal = rhs._n_cal; + _l_cal = rhs._l_cal; + _n_gcp = rhs._n_gcp; + _l_gcp = rhs._l_gcp; + _n_fac_data = rhs._n_fac_data; + _l_fac_data = rhs._l_fac_data; + _n_fac_data2 = rhs._n_fac_data2; + _l_fac_data2 = rhs._l_fac_data2; + _n_fac_data3 = rhs._n_fac_data3; + _l_fac_data3 = rhs._l_fac_data3; + _n_fac_data4 = rhs._n_fac_data4; + _l_fac_data4 = rhs._l_fac_data4; + _n_fac_data5 = rhs._n_fac_data5; + _l_fac_data5 = rhs._l_fac_data5; + _n_fac_data6 = rhs._n_fac_data6; + _l_fac_data6 = rhs._l_fac_data6; + _n_fac_data7 = rhs._n_fac_data7; + _l_fac_data7 = rhs._l_fac_data7; + _n_fac_data8 = rhs._n_fac_data8; + _l_fac_data8 = rhs._l_fac_data8; + _n_fac_data9 = rhs._n_fac_data9; + _l_fac_data9 = rhs._l_fac_data9; + _n_fac_data10 = rhs._n_fac_data10; + _l_fac_data10 = rhs._l_fac_data10; + _n_fac_data11 = rhs._n_fac_data11; + _l_fac_data11 = rhs._l_fac_data11; + return *this; +} +} diff --git a/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarFileDescriptor.h b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarFileDescriptor.h new file mode 100644 index 0000000000000000000000000000000000000000..c47927c65ce50a65fcc29aac4fb9160301e22562 --- /dev/null +++ b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarFileDescriptor.h @@ -0,0 +1,878 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// "Copyright Centre for Remote Imaging, Sensing and Processing" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#ifndef AlosSarFileDescriptor_h +#define AlosSarFileDescriptor_h + +// TODO Rename to AlosSarLeaderFileDescriptor + +#include<iostream> +#include <cstdlib> +#include <AlosSarRecordHeader.h> +#include <AlosSarRecord.h> + +namespace ossimplugins +{ + +/** + * @ingroup SARLeaderAlosSarFileDescriptorRecord + * @brief This class is able to read the SAR leader file descriptor record of the leader file + */ +class AlosSarFileDescriptor : public AlosSarRecord +{ +public: + /** + * @brief Constructor + */ + AlosSarFileDescriptor(); + /** + * @brief Destructor + */ + ~AlosSarFileDescriptor(); + + /** + * @brief This function write the AlosSarFileDescriptor in a stream + */ + friend std::ostream& operator<<(std::ostream& os, const AlosSarFileDescriptor& data); + + /** + * @brief This function read a AlosSarFileDescriptor from a stream + */ + friend std::istream& operator>>(std::istream& is, AlosSarFileDescriptor& data); + + /** + * @brief Copy constructor + */ + AlosSarFileDescriptor(const AlosSarFileDescriptor& rhs); + + /** + * @brief Copy operator + */ + AlosSarFileDescriptor& operator=(const AlosSarFileDescriptor& rhs); + + /** + * @brief This function is able to create a new instance of the class + */ + AlosSarRecord* Instanciate() + { + return new AlosSarFileDescriptor(); + }; + + /** + * @brief This function is able to create a new instance of the class initialised with the data of the calling instance + */ + AlosSarRecord* Clone() + { + return new AlosSarFileDescriptor(*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 ASCII flag + */ + std::string get_ascii_flag() const + { + return _ascii_flag; + }; + + /** + * @brief Continuation flag + */ + std::string get_continuation_flag() const + { + return _continuation_flag; + }; + + + /** + * @brief Format control documentation + */ + std::string get_format_doc() const + { + return _format_doc; + }; + /** + * @brief Format doc version + */ + std::string get_format_ver() const + { + return _format_ver; + }; + /** + * @brief Format doc revision + */ + std::string get_design_rev() const + { + return _design_rev; + }; + /** + * @brief Software identifier + */ + std::string get_software_id() const + { + return _software_id; + }; + /** + * @brief File number + */ + int get_file_num() const + { + return _file_num ; + }; + /** + * @brief File name + */ + std::string get_file_name() const + { + return _file_name; + }; + /** + * @brief Record sequence/location flag + */ + std::string get_rec_seq() const + { + return _rec_seq; + }; + /** + * @brief Sequence number location + */ + int get_seq_loc() const + { + return _seq_loc; + }; + /** + * @brief Sequence number lenght + */ + int get_seq_len() const + { + return _seq_len; + }; + /** + * @brief Record code/location flag + */ + std::string get_rec_code() const + { + return _rec_code; + }; + /** + * @brief Record code location + */ + int get_code_loc() const + { + return _code_loc; + }; + /** + * @brief Record code length + */ + int get_code_len() const + { + return _code_len; + }; + /** + * @brief Record length/location flag + */ + std::string get_rec_len() const + { + return _rec_len; + }; + /** + * @brief Record lenght location + */ + int get_rlen_loc() const + { + return _rlen_loc; + }; + /** + * @brief Record length, bytes + */ + int get_rlen_len() const + { + return _rlen_len; + }; + /** + * @brief Number of dataset summ records + */ + int get_n_dataset() const + { + return _n_dataset; + }; + /** + * @brief Data set summary record length, bytes + */ + int get_l_dataset() const + { + return _l_dataset; + }; + /** + * @brief Number of map proj records + */ + int get_n_map_proj() const + { + return _n_map_proj; + }; + /** + * @brief Map projection record length, bytes + */ + int get_l_map_proj() const + { + return _l_map_proj; + }; + /** + * @brief Number of platform position records + */ + int get_n_plat_pos() const + { + return _n_plat_pos; + }; + /** + * @brief Platform position record length, bytes + */ + int get_l_plat_pos() const + { + return _l_plat_pos; + }; + /** + * @brief Number of attitude data records + */ + int get_n_att_data() const + { + return _n_att_data; + }; + /** + * @brief Attitude data record length, bytes + */ + int get_l_att_data() const + { + return _l_att_data; + }; + /** + * @brief Number of radiometric data records + */ + int get_n_radi_data() const + { + return _n_radi_data; + }; + /** + * @brief Radiometric data record length, bytes + */ + int get_l_radi_data() const + { + return _l_radi_data; + }; + /** + * @brief Number of radiometric compensation records + */ + int get_n_radi_comp() const + { + return _n_radi_comp; + }; + /** + * @brief Radiometric compensation record length, bytes + */ + int get_l_radi_comp() const + { + return _l_radi_comp; + }; + /** + * @brief Number of data quality summary records + */ + int get_n_qual_sum() const + { + return _n_qual_sum; + }; + /** + * @brief Data quality summary record length, bytes + */ + int get_l_qual_sum() const + { + return _l_qual_sum; + }; + /** + * @brief Number of data histogram records + */ + int get_n_data_his() const + { + return _n_data_his; + }; + /** + * @brief Data histogram record length, bytes + */ + int get_l_data_his() const + { + return _l_data_his; + }; + /** + * @brief Number of range spectra records + */ + int get_n_rang_spec() const + { + return _n_rang_spec ; + }; + /** + * @brief Range spectra record length, bytes + */ + int get_l_rang_spec() const + { + return _l_rang_spec; + }; + /** + * @brief Number of DEM descriptor records + */ + int get_n_dem_desc() const + { + return _n_dem_desc; + }; + /** + * @brief DEM desc record length, bytes + */ + int get_l_dem_desc() const + { + return _l_dem_desc; + }; + /** + * @brief Number of RADAR par records + */ + int get_n_radar_par() const + { + return _n_radar_par; + }; + /** + * @brief RADAR par record length, bytes + */ + int get_l_radar_par() const + { + return _l_radar_par; + }; + /** + * @brief Number of annotation data records + */ + int get_n_anno_data() const + { + return _n_anno_data; + }; + /** + * @brief Annotation data record length, bytes + */ + int get_l_anno_data() const + { + return _l_anno_data; + }; + /** + * @brief Number of processing parameter records + */ + int get_n_det_proc() const + { + return _n_det_proc; + }; + /** + * @brief Processing parameter record length, bytes + */ + int get_l_det_proc() const + { + return _l_det_proc; + }; + /** + * @brief Number of calibration records + */ + int get_n_cal() const + { + return _n_cal; + }; + /** + * @brief Calibration record length, bytes + */ + int get_l_cal() const + { + return _l_cal; + }; + /** + * @brief Number of GCP records + */ + int get_n_gcp() const + { + return _n_gcp; + }; + /** + * @brief GCP record length, bytes + */ + int get_l_gcp() const + { + return _l_gcp; + }; + /** + * @brief Number of facility data records + */ + int get_n_fac_data() const + { + return _n_fac_data; + }; + /** + * @brief Fac data record length, bytes + */ + int get_l_fac_data() const + { + return _l_fac_data; + }; + + /** + * @brief Number of facility data records + */ + int get_n_fac_data2() + { + return _n_fac_data; + }; + /** + * @brief Fac data record length, bytes + */ + int get_l_fac_data2() + { + return _l_fac_data; + }; + /** + * @brief Number of facility data records + */ + int get_n_fac_data3() + { + return _n_fac_data; + }; + /** + * @brief Fac data record length, bytes + */ + int get_l_fac_data3() + { + return _l_fac_data; + }; + /** + * @brief Number of facility data records + */ + int get_n_fac_data4() + { + return _n_fac_data; + }; + /** + * @brief Fac data record length, bytes + */ + int get_l_fac_data4() + { + return _l_fac_data; + }; + /** + * @brief Number of facility data records + */ + int get_n_fac_data5() + { + return _n_fac_data; + }; + /** + * @brief Fac data record length, bytes + */ + int get_l_fac_data5() + { + return _l_fac_data; + }; + /** + * @brief Number of facility data records + */ + int get_n_fac_data6() + { + return _n_fac_data; + }; + /** + * @brief Fac data record length, bytes + */ + int get_l_fac_data6() + { + return _l_fac_data; + }; + /** + * @brief Number of facility data records + */ + int get_n_fac_data7() + { + return _n_fac_data; + }; + /** + * @brief Fac data record length, bytes + */ + int get_l_fac_data7() + { + return _l_fac_data; + }; + /** + * @brief Number of facility data records + */ + int get_n_fac_data8() + { + return _n_fac_data; + }; + /** + * @brief Fac data record length, bytes + */ + int get_l_fac_data8() + { + return _l_fac_data; + }; + /** + * @brief Number of facility data records + */ + int get_n_fac_data9() + { + return _n_fac_data; + }; + /** + * @brief Fac data record length, bytes + */ + int get_l_fac_data9() + { + return _l_fac_data; + }; + /** + * @brief Number of facility data records + */ + int get_n_fac_data10() + { + return _n_fac_data; + }; + /** + * @brief Fac data record length, bytes + */ + int get_l_fac_data10() + { + return _l_fac_data; + }; + /** + * @brief Number of facility data records + */ + int get_n_fac_data11() + { + return _n_fac_data; + }; + /** + * @brief Fac data record length, bytes + */ + int get_l_fac_data11() + { + return _l_fac_data; + }; + +protected: + /** + * @brief ASCII flag + */ + std::string _ascii_flag; + + /** + * @brief Continuation flag + */ + std::string _continuation_flag; + + /** + * @brief Format control documentation + */ + std::string _format_doc; + /** + * @brief Format doc version + */ + std::string _format_ver; + /** + * @brief Format doc revision + */ + std::string _design_rev; + /** + * @brief Software identifier + */ + std::string _software_id; + /** + * @brief File number + */ + int _file_num; + /** + * @brief File name + */ + std::string _file_name; + /** + * @brief Record sequence/location flag + */ + std::string _rec_seq; + /** + * @brief Sequence number location + */ + int _seq_loc; + /** + * @brief Sequence number lenght + */ + int _seq_len; + /** + * @brief Record code/location flag + */ + std::string _rec_code; + /** + * @brief Record code location + */ + int _code_loc; + /** + * @brief Record code length + */ + int _code_len; + /** + * @brief Record length/location flag + */ + std::string _rec_len; + /** + * @brief Record lenght location + */ + int _rlen_loc; + /** + * @brief Record length, bytes + */ + int _rlen_len; + + + /** + * @brief Number of dataset summ records + */ + int _n_dataset; + /** + * @brief Data set summary record length, bytes + */ + int _l_dataset; + /** + * @brief Number of map proj records + */ + int _n_map_proj; + /** + * @brief Map projection record length, bytes + */ + int _l_map_proj; + /** + * @brief Number of platform position records + */ + int _n_plat_pos; + /** + * @brief Platform position record length, bytes + */ + int _l_plat_pos; + /** + * @brief Number of attitude data records + */ + int _n_att_data; + /** + * @brief Attitude data record length, bytes + */ + int _l_att_data; + /** + * @brief Number of radiometric data records + */ + int _n_radi_data; + /** + * @brief Radiometric data record length, bytes + */ + int _l_radi_data; + /** + * @brief Number of radiometric compensation records + */ + int _n_radi_comp; + /** + * @brief Radiometric compensation record length, bytes + */ + int _l_radi_comp; + /** + * @brief Number of data quality summary records + */ + int _n_qual_sum; + /** + * @brief Data quality summary record length, bytes + */ + int _l_qual_sum; + /** + * @brief Number of data histogram records + */ + int _n_data_his; + /** + * @brief Data histogram record length, bytes + */ + int _l_data_his; + /** + * @brief Number of range spectra records + */ + int _n_rang_spec; + /** + * @brief Range spectra record length, bytes + */ + int _l_rang_spec; + /** + * @brief Number of DEM descriptor records + */ + int _n_dem_desc; + /** + * @brief DEM desc record length, bytes + */ + int _l_dem_desc; + /** + * @brief Number of RADAR par records + */ + int _n_radar_par; + /** + * @brief RADAR par record length, bytes + */ + int _l_radar_par; + /** + * @brief Number of annotation data records + */ + int _n_anno_data; + /** + * @brief Annotation data record length, bytes + */ + int _l_anno_data; + /** + * @brief Number of processing parameter records + */ + int _n_det_proc; + /** + * @brief Processing parameter record length, bytes + */ + int _l_det_proc; + /** + * @brief Number of calibration records + */ + int _n_cal; + /** + * @brief Calibration record length, bytes + */ + int _l_cal; + /** + * @brief Number of GCP records + */ + int _n_gcp; + /** + * @brief GCP record length, bytes + */ + int _l_gcp; + + /** + * @brief Number of facility data records + */ + int _n_fac_data; + /** + * @brief Fac data record length, bytes + */ + int _l_fac_data; + + /** + * @brief Number of facility data records + */ + int _n_fac_data2; + /** + * @brief Fac data record length, bytes + */ + int _l_fac_data2; + + /** + * @brief Number of facility data records + */ + int _n_fac_data3; + /** + * @brief Fac data record length, bytes + */ + int _l_fac_data3; + + /** + * @brief Number of facility data records + */ + int _n_fac_data4; + /** + * @brief Fac data record length, bytes + */ + int _l_fac_data4; + + /** + * @brief Number of facility data records + */ + int _n_fac_data5; + /** + * @brief Fac data record length, bytes + */ + int _l_fac_data5; + + /** + * @brief Number of facility data records + */ + int _n_fac_data6; + /** + * @brief Fac data record length, bytes + */ + int _l_fac_data6; + + /** + * @brief Number of facility data records + */ + int _n_fac_data7; + /** + * @brief Fac data record length, bytes + */ + int _l_fac_data7; + + /** + * @brief Number of facility data records + */ + int _n_fac_data8; + /** + * @brief Fac data record length, bytes + */ + int _l_fac_data8; + + /** + * @brief Number of facility data records + */ + int _n_fac_data9; + /** + * @brief Fac data record length, bytes + */ + int _l_fac_data9; + + /** + * @brief Number of facility data records + */ + int _n_fac_data10; + /** + * @brief Fac data record length, bytes + */ + int _l_fac_data10; + + /** + * @brief Number of facility data records + */ + int _n_fac_data11; + /** + * @brief Fac data record length, bytes + */ + int _l_fac_data11; + +private: +}; +} +#endif diff --git a/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarLeader.cpp b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarLeader.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ac41dfa90b49e98eed87180e94fe9f6bfcd08466 --- /dev/null +++ b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarLeader.cpp @@ -0,0 +1,304 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// "Copyright Centre for Remote Imaging, Sensing and Processing" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#include <AlosSarLeader.h> +#include <AlosSarLeaderFactory.h> +#include <AlosSarRecordHeader.h> + +#include <AlosSarFileDescriptor.h> +#include <AlosSarDataSetSummary.h> +// #include <AlosSarMapProjectionData.h>// +#include <AlosSarFacilityData.h> + +#include <ossim/base/ossimTrace.h> +#include <ossim/base/ossimKeywordlist.h> +#include <ossim/base/ossimKeywordNames.h> + +// Static trace for debugging +static ossimTrace traceDebug("ossimAlosSarLeader:debug"); + +namespace ossimplugins +{ + +const int AlosSarLeader::AlosSarFacilityDataID = 17; +const int AlosSarLeader::AlosSarPlatformPositionDataID = 3; +// const int AlosSarLeader::AlosSarMapProjectionDataID = 3; // +const int AlosSarLeader::AlosSarDataSetSummaryID = 2; +const int AlosSarLeader::AlosSarFileDescriptorID = 1; + +AlosSarLeader::AlosSarLeader() +{ +} + +AlosSarLeader::~AlosSarLeader() +{ + ClearRecords(); +} + +std::ostream& operator<<(std::ostream& os, const AlosSarLeader& data) +{ + std::map<int, AlosSarRecord*>::const_iterator it = data._records.begin(); + while(it != data._records.end()) + { + (*it).second->Write(os); + ++it; + } + return os; + +} + +std::istream& operator>>(std::istream& is, AlosSarLeader& data) +{ + AlosSarLeaderFactory factory; + + data.ClearRecords(); + + AlosSarRecordHeader header; + bool eof = false; + while(!eof) + { + is>>header; + if(is.eof()) + { + eof = true; + } + else + { + AlosSarRecord* record = factory.Instanciate(header.get_rec_seq()); + if (record != NULL) + { + record->Read(is); + data._records[header.get_rec_seq()] = record; + } + else + { + char* buff = new char[header.get_length()-12]; + is.read(buff, header.get_length()-12); + delete buff; + } + } + } + return is; +} + + +AlosSarLeader::AlosSarLeader(const AlosSarLeader& rhs) +{ + std::map<int, AlosSarRecord*>::const_iterator it = rhs._records.begin(); + while(it != rhs._records.end()) + { + _records[(*it).first] = (*it).second->Clone(); + ++it; + } +} + +AlosSarLeader& AlosSarLeader::operator=(const AlosSarLeader& rhs) +{ + ClearRecords(); + std::map<int, AlosSarRecord*>::const_iterator it = rhs._records.begin(); + while(it != rhs._records.end()) + { + _records[(*it).first] = (*it).second->Clone(); + ++it; + } + + return *this; +} + +void AlosSarLeader::ClearRecords() +{ + std::map<int, AlosSarRecord*>::const_iterator it = _records.begin(); + while(it != _records.end()) + { + delete (*it).second; + ++it; + } + _records.clear(); +} + +bool AlosSarLeader::saveState(ossimKeywordlist& kwl, + const char* prefix) const +{ + + static const char MODULE[] = "AlosSarLeader::saveState"; + + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG)<< MODULE << " entered...\n"; + } + + bool result = true; + + char name[64]; + + //kwl.add(prefix, ossimKeywordNames::TYPE_KW, "ossimAlosPalsarModel", true); + /* + * Adding metadata necessary to the sensor model in the keywordlist + */ + const AlosSarFileDescriptor *leaderfiledesc = get_AlosSarFileDescriptor(); + if (leaderfiledesc != NULL) + { + kwl.add(prefix, "filename",leaderfiledesc->get_file_name().c_str(),true); + } + else + { + result = false; + } + + /* + * Adding metadata necessary to the sensor model in the keywordlist + */ + const AlosSarDataSetSummary *datasetSummary = get_AlosSarDataSetSummary(); + if ( (datasetSummary != NULL) && (result == true) ) + { + kwl.add(prefix, "inp_sctim",(datasetSummary->get_inp_sctim()).c_str(),true); + kwl.add(prefix, "ellip_maj", datasetSummary->get_ellip_maj(),true); + kwl.add(prefix, "ellip_min", datasetSummary->get_ellip_min(),true); + kwl.add(prefix, "sc_lin", datasetSummary->get_sc_lin(),true); + kwl.add(prefix, "sc_pix", datasetSummary->get_sc_pix(),true); + kwl.add(prefix, "wave_length", datasetSummary->get_wave_length(),true); + kwl.add(prefix, "fr", datasetSummary->get_fr(),true); + kwl.add(prefix, "fa", datasetSummary->get_fa(),true); + kwl.add(prefix, "time_dir_pix", (datasetSummary->get_time_dir_pix()).c_str(),true); + kwl.add(prefix, "time_dir_lin", (datasetSummary->get_time_dir_lin()).c_str(),true); + kwl.add(prefix, "line_spacing", datasetSummary->get_line_spacing(),true); + kwl.add(prefix, "pix_spacing", datasetSummary->get_pix_spacing(),true); + kwl.add(prefix, "nlooks_az", datasetSummary->get_n_azilok(),true); + kwl.add(prefix, "n_rnglok", datasetSummary->get_n_rnglok(),true); + kwl.add(prefix, "alt_dopcen[0]", datasetSummary->get_alt_dopcen()[0],true); + //FIXME check if those data are available +// kwl.add(prefix, "zero_dop_range_time_f_pixel", datasetSummary->get_zero_dop_range_time_f_pixel(),true); +// kwl.add(prefix, "zero_dop_range_time_c_pixel", datasetSummary->get_zero_dop_range_time_c_pixel(),true); +// kwl.add(prefix, "zero_dop_range_time_l_pixel", datasetSummary->get_zero_dop_range_time_l_pixel(),true); + } + else + { + result = false; + } + + // FIXME do not handle Alos map projection information for now... +// const AlosSarMapProjectionData *mapprojectiondata = get_AlosSarMapProjectionData(); +// if ( (mapprojectiondata != NULL) && (result == true) ) +// { +// kwl.add(prefix, "map_proj_des",(mapprojectiondata->get_map_proj_des()).c_str(),true); +// kwl.add(prefix, "num_lines",(double) mapprojectiondata->get_num_lines(),true); +// kwl.add(prefix, "num_pix",(double) mapprojectiondata->get_num_pix_in_line(),true); +// kwl.add(prefix, "first_line_first_pixel_lat",mapprojectiondata->get_first_line_first_pixel_lat(), true); +// kwl.add(prefix, "first_line_first_pixel_lon",mapprojectiondata->get_first_line_first_pixel_lon(), true); +// kwl.add(prefix, "first_line_last_pixel_lat",mapprojectiondata->get_first_line_last_pixel_lat(), true); +// kwl.add(prefix, "first_line_last_pixel_lon",mapprojectiondata->get_first_line_last_pixel_lon(), true); +// kwl.add(prefix, "last_line_first_pixel_lat",mapprojectiondata->get_last_line_first_pixel_lat(), true); +// kwl.add(prefix, "last_line_first_pixel_lon",mapprojectiondata->get_last_line_first_pixel_lon(), true); +// kwl.add(prefix, "last_line_last_pixel_lat",mapprojectiondata->get_last_line_last_pixel_lat(), true); +// kwl.add(prefix, "last_line_last_pixel_lon",mapprojectiondata->get_last_line_last_pixel_lon(), true); +// } +// else +// { +// result = false; +// } + + const AlosSarPlatformPositionData *platformposition = get_AlosSarPlatformPositionData(); + if ( (platformposition != NULL) && (result == true) ) + { + kwl.add(prefix, "neph", platformposition->get_ndata(),true); + kwl.add(prefix, "eph_year", platformposition->get_year(),true); + kwl.add(prefix, "eph_month", platformposition->get_month(),true); + kwl.add(prefix, "eph_day", platformposition->get_day(),true); + kwl.add(prefix, "eph_gmt_day", platformposition->get_gmt_day(),true); + kwl.add(prefix, "eph_sec", platformposition->get_gmt_sec(),true); + kwl.add(prefix, "eph_hr_angle", platformposition->get_hr_angle(),true); + kwl.add(prefix, "eph_int", platformposition->get_data_int(),true); + + for (int i=0;i<platformposition->get_ndata();i++) + { + sprintf(name,"eph%i_posX",i); + kwl.add(prefix, name,(platformposition->get_pos_vect()[i]).get_pos()[0],true); + sprintf(name,"eph%i_posY",i); + kwl.add(prefix, name,(platformposition->get_pos_vect()[i]).get_pos()[1],true); + sprintf(name,"eph%i_posZ",i); + kwl.add(prefix, name,(platformposition->get_pos_vect()[i]).get_pos()[2],true); + + sprintf(name,"eph%i_velX",i); + kwl.add(prefix, name,(platformposition->get_pos_vect()[i]).get_vel()[0],true); + sprintf(name,"eph%i_velY",i); + kwl.add(prefix, name,(platformposition->get_pos_vect()[i]).get_vel()[1],true); + sprintf(name,"eph%i_velZ",i); + kwl.add(prefix, name,(platformposition->get_pos_vect()[i]).get_vel()[2],true); + } + } + else + { + result = false; + } + /* + * Adding metadata necessary to the sensor model in the keywordlist + */ + const AlosSarFacilityData *facilitydata = get_AlosSarFacilityData(); + if ( (facilitydata != NULL) && (result == true) ) + { + kwl.add(prefix, "coef_ground_range_1",facilitydata->get_coef_ground_range_1(),true); + kwl.add(prefix, "coef_ground_range_2",facilitydata->get_coef_ground_range_2(),true); + kwl.add(prefix, "coef_ground_range_3",facilitydata->get_coef_ground_range_3(),true); + kwl.add(prefix, "coef_ground_range_4",facilitydata->get_coef_ground_range_4(),true); + } + else + { + result = false; + } + + + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) + << MODULE << " exit status = " << (result?"true":"false\n") + << std::endl; + } + + + return result; +} + +const AlosSarFacilityData * AlosSarLeader::get_AlosSarFacilityData() const +{ +// return const_cast<const AlosSarFacilityData*>(dynamic_cast<AlosSarFacilityData*>(_records[AlosSarFacilityDataID])); +// RecordType::const_iterator it = _records.find(AlosSarFacilityDataID)->second; +// return dynamic_cast<const AlosSarFacilityData*>(it.find(AlosSarFacilityDataID)); + return dynamic_cast<const AlosSarFacilityData*>(_records.find(AlosSarFacilityDataID)->second); +} +const AlosSarPlatformPositionData * AlosSarLeader::get_AlosSarPlatformPositionData() const +{ +// return (AlosSarPlatformPositionData*)_records[AlosSarPlatformPositionDataID]; + return dynamic_cast<const AlosSarPlatformPositionData*>(_records.find(AlosSarPlatformPositionDataID)->second); +} +/*const AlosSarMapProjectionData * AlosSarLeader::get_AlosSarMapProjectionData() const +{ +// return (AlosSarMapProjectionData*)_records[AlosSarMapProjectionDataID]; + return dynamic_cast<const AlosSarMapProjectionData*>(_records.find(AlosSarMapProjectionDataID)->second); +} + +*/ + +//no map projection data + +const AlosSarDataSetSummary * AlosSarLeader::get_AlosSarDataSetSummary() const +{ +// return (AlosSarDataSetSummary*)_records[AlosSarDataSetSummaryID]; + return dynamic_cast<const AlosSarDataSetSummary*>(_records.find(AlosSarDataSetSummaryID)->second); +} + +const AlosSarFileDescriptor * AlosSarLeader::get_AlosSarFileDescriptor() const +{ +// return (AlosSarFileDescriptor*)_records[AlosSarFileDescriptorID]; + return dynamic_cast<const AlosSarFileDescriptor*>(_records.find(AlosSarFileDescriptorID)->second); +} + +} diff --git a/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarLeader.h b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarLeader.h new file mode 100644 index 0000000000000000000000000000000000000000..619ec6cfc55774fa0692b628355da7d56d00db7a --- /dev/null +++ b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarLeader.h @@ -0,0 +1,107 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// "Copyright Centre for Remote Imaging, Sensing and Processing" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#ifndef AlosSarLeader_h +#define AlosSarLeader_h + +#include <iostream> +#include "AlosSarFileDescriptor.h" +#include "AlosSarDataSetSummary.h" +#include "AlosSarMapProjectionData.h" +#include "AlosSarPlatformPositionData.h" +#include "AlosSarFacilityData.h" +#include <map> + +class ossimKeywordlist; + +namespace ossimplugins +{ + +class AlosSarPlatformPositionData; +class AlosSarMapProjectionData; +class AlosSarDataSetSummary; +class AlosSarFileDescriptor; +class AlosSarFacilityData; + +/** + * @ingroup AlosSarLeaderFile + * @brief This class is able to read the Leader file of the AlosSar file structure + */ +class AlosSarLeader +{ +public: + /** + * @brief Constructor + */ + AlosSarLeader(); + + /** + * @brief Destructor + */ + ~AlosSarLeader(); + + /** + * @brief This function write the AlosSarLeader in a stream + */ + friend std::ostream& operator<<(std::ostream& os, const AlosSarLeader& data); + + /** + * @brief This function read a AlosSarLeader from a stream + */ + friend std::istream& operator>>(std::istream& is, AlosSarLeader& data); + + /** + * @brief Copy constructor + */ + AlosSarLeader(const AlosSarLeader& rhs); + + /** + * @brief Copy operator + */ + AlosSarLeader& operator=(const AlosSarLeader& rhs); + + /** + * @brief Remove all the previous records from the AlosSarLeader + */ + void ClearRecords(); + + + /** + * @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; + + + const AlosSarFacilityData * get_AlosSarFacilityData() const; + const AlosSarPlatformPositionData * get_AlosSarPlatformPositionData() const; +// const AlosSarMapProjectionData * get_AlosSarMapProjectionData() const; + const AlosSarDataSetSummary * get_AlosSarDataSetSummary() const; + const AlosSarFileDescriptor * get_AlosSarFileDescriptor() const; + +protected: + typedef std::map<int, AlosSarRecord*> RecordType; + RecordType _records; + + static const int AlosSarFacilityDataID; + static const int AlosSarPlatformPositionDataID; +// static const int AlosSarMapProjectionDataID; + static const int AlosSarDataSetSummaryID; + static const int AlosSarFileDescriptorID; +private: + +}; +} +#endif diff --git a/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarLeaderFactory.cpp b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarLeaderFactory.cpp new file mode 100644 index 0000000000000000000000000000000000000000..32b1ab219828037f1b2e0959f1b0209613848594 --- /dev/null +++ b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarLeaderFactory.cpp @@ -0,0 +1,38 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// "Copyright Centre for Remote Imaging, Sensing and Processing" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#include <AlosSarLeaderFactory.h> + +#include <AlosSarDataSetSummary.h> +#include <AlosSarFileDescriptor.h> +//#include <AlosSarMapProjectionData.h>// +#include <AlosSarPlatformPositionData.h> +#include <AlosSarFacilityData.h> + +namespace ossimplugins +{ + +AlosSarLeaderFactory::AlosSarLeaderFactory() +{ + RegisterRecord(17, new AlosSarFacilityData()); + RegisterRecord(3, new AlosSarPlatformPositionData()); +// RegisterRecord(3, new AlosSarMapProjectionData());// + RegisterRecord(2, new AlosSarDataSetSummary()); + RegisterRecord(1, new AlosSarFileDescriptor()); +} + +AlosSarLeaderFactory::~AlosSarLeaderFactory() +{ + +} + +} diff --git a/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarLeaderFactory.h b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarLeaderFactory.h new file mode 100644 index 0000000000000000000000000000000000000000..ae2d3a866eb4398494f3231c901c9bde624a1258 --- /dev/null +++ b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarLeaderFactory.h @@ -0,0 +1,46 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// "Copyright Centre for Remote Imaging, Sensing and Processing" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#ifndef AlosSarLeaderFactory_h +#define AlosSarLeaderFactory_h + + +#include <AlosSarRecordFactory.h> +#include <map> + +namespace ossimplugins +{ + +/** + * @ingroup AlosSarLeaderFile + * @brief This class is a facory able to construct Record base classes + */ +class AlosSarLeaderFactory : public AlosSarRecordFactory +{ +public: + /** + * @brief Contstructor + */ + AlosSarLeaderFactory(); + /** + * @brief Destructor + */ + ~AlosSarLeaderFactory(); + + +protected: + + +private: +}; +} +#endif diff --git a/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarMapProjectionData.cpp b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarMapProjectionData.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1f546626ae77295476f85528323aa406065671e7 --- /dev/null +++ b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarMapProjectionData.cpp @@ -0,0 +1,210 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// "Copyright Centre for Remote Imaging, Sensing and Processing" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#include <AlosSarMapProjectionData.h> + +namespace ossimplugins +{ + +AlosSarMapProjectionData::AlosSarMapProjectionData() : AlosSarRecord("map_proj_data_rec") +{ +} + +AlosSarMapProjectionData::~AlosSarMapProjectionData() +{ +} + +std::ostream& operator<<(std::ostream& os, const AlosSarMapProjectionData& data) +{ + os<<"map_proj_des:"<<data._map_proj_des.c_str()<<std::endl; + + os<<"num_pix_in_line:"<<data._num_pix_in_line<<std::endl; + + os<<"num_lines:"<<data._num_lines<<std::endl; + + os<<"nom_interpixel_dist:"<<data._nom_interpixel_dist<<std::endl; + + os<<"nom_interline_dist:"<<data._nom_interline_dist<<std::endl; + + os<<"orientation_at_center:"<<data._orientation_at_center<<std::endl; + + os<<"orbit_incl:"<<data._orbit_incl<<std::endl; + + os<<"asc_node_long:"<<data._asc_node_long<<std::endl; + + os<<"platform_heading:"<<data._platform_heading<<std::endl; + + os<<"name_of_ref_ellipsoid:"<<data._name_of_ref_ellipsoid.c_str()<<std::endl; + + os<<"semi_maj_axis:"<<data._semi_maj_axis<<std::endl; + + os<<"semi_min_axis:"<<data._semi_min_axis<<std::endl; + + os<<"first_line_first_pixel_lat:"<<data._first_line_first_pixel_lat<<std::endl; + + os<<"first_line_first_pixel_lon:"<<data._first_line_first_pixel_lon<<std::endl; + + os<<"first_line_last_pixel_lat:"<<data._first_line_last_pixel_lat<<std::endl; + + os<<"first_line_last_pixel_lon:"<<data._first_line_last_pixel_lon<<std::endl; + + os<<"last_line_last_pixel_lat:"<<data._last_line_last_pixel_lat<<std::endl; + + os<<"last_line_last_pixel_lon:"<<data._last_line_last_pixel_lon<<std::endl; + + os<<"last_line_first_pixel_lat:"<<data._last_line_first_pixel_lat<<std::endl; + + os<<"last_line_first_pixel_lon:"<<data._last_line_first_pixel_lon<<std::endl; + + return os; + +} + +std::istream& operator>>(std::istream& is, AlosSarMapProjectionData& data) +{ + char buf16[17]; + buf16[16]='\0'; + char buf32[33]; + buf32[32] = '\0'; + char buf8[9]; + buf8[8] = '\0'; + char buf4[5]; + buf4[4] = '\0'; + + is.read(buf16,16); + + is.read(buf32,32); + data._map_proj_des = buf32; + + is.read(buf16,16); + data._num_pix_in_line = atoi(buf16); + + is.read(buf16,16 ); + data._num_lines = atoi(buf16); + + is.read(buf16,16); + data._nom_interpixel_dist = atof(buf16); + + is.read(buf16,16); + data._nom_interline_dist = atof(buf16); + + is.read(buf16,16); + data._orientation_at_center = atof(buf16); + + is.read(buf16,16); + data._orbit_incl = atof(buf16); + + is.read(buf16,16); + data._asc_node_long = atof(buf16); + + is.read(buf16,16); + + is.read(buf16,16); + + is.read(buf16,16); + + is.read(buf16,16); + data._platform_heading = atof(buf16); + + is.read(buf32,32); + data._name_of_ref_ellipsoid = buf32; + + is.read(buf16,16); + data._semi_maj_axis = atof(buf16); + + is.read(buf16,16); + data._semi_min_axis = atof(buf16); + + char buf772[772]; + is.read(buf772,772); + + is.read(buf16,16); + data._first_line_first_pixel_lat = atof(buf16); + + is.read(buf16,16); + data._first_line_first_pixel_lon = atof(buf16); + + is.read(buf16,16); + data._first_line_last_pixel_lat = atof(buf16); + + is.read(buf16,16); + data._first_line_last_pixel_lon = atof(buf16); + + is.read(buf16,16); + data._last_line_last_pixel_lat = atof(buf16); + + is.read(buf16,16); + data._last_line_last_pixel_lon = atof(buf16); + + is.read(buf16,16); + data._last_line_first_pixel_lat = atof(buf16); + + is.read(buf16,16); + data._last_line_first_pixel_lon = atof(buf16); + + char buf420[420]; + is.read(buf420,420); + + return is; +} + + +AlosSarMapProjectionData::AlosSarMapProjectionData(const AlosSarMapProjectionData& rhs): + AlosSarRecord(rhs), + _map_proj_des(rhs._map_proj_des), + _num_pix_in_line(rhs._num_pix_in_line), + _num_lines(rhs._num_lines), + _nom_interpixel_dist(rhs._nom_interpixel_dist), + _nom_interline_dist(rhs._nom_interline_dist), + _orientation_at_center(rhs._orientation_at_center), + _orbit_incl(rhs._orbit_incl), + _asc_node_long(rhs._asc_node_long), + _platform_heading(rhs._platform_heading), + _name_of_ref_ellipsoid(rhs._name_of_ref_ellipsoid), + _semi_maj_axis(rhs._semi_maj_axis), + _semi_min_axis(rhs._semi_min_axis), + _first_line_first_pixel_lat(rhs._first_line_first_pixel_lat), + _first_line_first_pixel_lon(rhs._first_line_first_pixel_lon), + _first_line_last_pixel_lat(rhs._first_line_last_pixel_lat), + _first_line_last_pixel_lon(rhs._first_line_last_pixel_lon), + _last_line_last_pixel_lat(rhs._last_line_last_pixel_lat), + _last_line_last_pixel_lon(rhs._last_line_last_pixel_lon), + _last_line_first_pixel_lat(rhs._last_line_first_pixel_lat), + _last_line_first_pixel_lon(rhs._last_line_first_pixel_lon) + {} + +AlosSarMapProjectionData& AlosSarMapProjectionData::operator=(const AlosSarMapProjectionData& rhs) +{ + _map_proj_des = rhs._map_proj_des; + _num_pix_in_line = rhs._num_pix_in_line; + _num_lines = rhs._num_lines; + _nom_interpixel_dist = rhs._nom_interpixel_dist; + _nom_interline_dist = rhs._nom_interline_dist; + _orientation_at_center = rhs._orientation_at_center; + _orbit_incl = rhs._orbit_incl; + _asc_node_long = rhs._asc_node_long; + _platform_heading = rhs._platform_heading; + _name_of_ref_ellipsoid = rhs._name_of_ref_ellipsoid; + _semi_maj_axis = rhs._semi_maj_axis; + _semi_min_axis = rhs._semi_min_axis; + _first_line_first_pixel_lat = rhs._first_line_first_pixel_lat; + _first_line_first_pixel_lon = rhs._first_line_first_pixel_lon; + _first_line_last_pixel_lat = rhs._first_line_last_pixel_lat; + _first_line_last_pixel_lon = rhs._first_line_last_pixel_lon; + _last_line_last_pixel_lat = rhs._last_line_last_pixel_lat; + _last_line_last_pixel_lon = rhs._last_line_last_pixel_lon; + _last_line_first_pixel_lat = rhs._last_line_first_pixel_lat; + _last_line_first_pixel_lon = rhs._last_line_first_pixel_lon; + + return *this; +} +} diff --git a/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarMapProjectionData.h b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarMapProjectionData.h new file mode 100644 index 0000000000000000000000000000000000000000..4a4a042d5294e75fde99b4d3b56372f182265482 --- /dev/null +++ b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarMapProjectionData.h @@ -0,0 +1,321 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// "Copyright Centre for Remote Imaging, Sensing and Processing" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#ifndef AlosSarMapProjectionData_h +#define AlosSarMapProjectionData_h + +#include <iostream> +#include <cstdlib> +#include <AlosSarRecordHeader.h> +#include <AlosSarRecord.h> + +namespace ossimplugins +{ + +/** + * @ingroup AlosSarMapProjectionDataRecord + * @brief This class is able to read the SAR leader data set summary record of the leader file + */ +class AlosSarMapProjectionData : public AlosSarRecord +{ +public: + /** + * @brief Constructor + */ + AlosSarMapProjectionData(); + + /** + * @brief Destructor + */ + ~AlosSarMapProjectionData(); + + /** + * @brief This function write the AlosSarMapProjectionData in a stream + */ + friend std::ostream& operator<<(std::ostream& os, const AlosSarMapProjectionData& data); + + /** + * @brief This function read a AlosSarMapProjectionData from a stream + */ + friend std::istream& operator>>(std::istream& is, AlosSarMapProjectionData& data); + + /** + * @brief Copy constructor + */ + AlosSarMapProjectionData(const AlosSarMapProjectionData& rhs); + + /** + * @brief Copy operator + */ + AlosSarMapProjectionData& operator=(const AlosSarMapProjectionData& rhs); + + /** + * @brief This function is able to create a new instance of the class + */ + AlosSarRecord* Instanciate() + { + return new AlosSarMapProjectionData(); + }; + + /** + * @brief This function is able to create a new instance of the class initialised with the data of the calling instance + */ + AlosSarRecord* Clone() + { + return new AlosSarMapProjectionData(*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 map_proj_des + */ + std::string get_map_proj_des() const + { + return _map_proj_des; + }; + /** + * @brief num_pix_in_line + */ + int get_num_pix_in_line() const + { + return _num_pix_in_line; + }; + /** + * @brief num_lines + */ + int get_num_lines() const + { + return _num_lines; + }; + /** + * @brief nom_interpixel_dist + */ + double get_nom_interpixel_dist() const + { + return _nom_interpixel_dist; + }; + /** + * @brief nom_interline_dist + */ + double get_nom_interline_dist() const + { + return _nom_interline_dist; + }; + /** + * @brief orientation_at_center + */ + double get_orientation_at_center() const + { + return _orientation_at_center; + }; + /** + * @brief orbit_incl + */ + double get_orbit_incl() const + { + return _orbit_incl; + }; + /** + * @brief asc_node_long + */ + double get_asc_node_long() const + { + return _asc_node_long; + }; + /** + * @brief platform_heading + */ + double get_platform_heading() const + { + return _platform_heading; + }; + /** + * @brief name_of_ref_ellipsoid + */ + std::string get_name_of_ref_ellipsoid() const + { + return _name_of_ref_ellipsoid; + }; + /** + * @brief semi_maj_axis + */ + double get_semi_maj_axis() const + { + return _semi_maj_axis; + }; + /** + * @brief semi_min_axis + */ + double get_semi_min_axis() const + { + return _semi_min_axis; + }; + /** + * @brief first_line_first_pixel _lat + */ + double get_first_line_first_pixel_lat() const + { + return _first_line_first_pixel_lat; + }; + /** + * @brief first_line_first_pixel_lon + */ + double get_first_line_first_pixel_lon() const + { + return _first_line_first_pixel_lon; + }; + /** + * @brief first_line_last_pixel _lat + */ + double get_first_line_last_pixel_lat() const + { + return _first_line_last_pixel_lat; + }; + /** + * @brief first_line_last_pixel_lon + */ + double get_first_line_last_pixel_lon() const + { + return _first_line_last_pixel_lon; + }; + /** + * @brief last_line_last_pixel_lat + */ + double get_last_line_last_pixel_lat() const + { + return _last_line_last_pixel_lat; + }; + /** + * @brief last_line_last_pixel_lon + */ + double get_last_line_last_pixel_lon() const + { + return _last_line_last_pixel_lon; + }; + /** + * @brief last_line_first_pixel_lat + */ + double get_last_line_first_pixel_lat() const + { + return _last_line_first_pixel_lat; + }; + /** + * @brief last_line_first_pixel_lon + */ + double get_last_line_first_pixel_lon() const + { + return _last_line_first_pixel_lon; + }; + +protected: + /** + * @brief map_proj_des + */ + std::string _map_proj_des; + /** + * @brief num_pix_in_line + */ + int _num_pix_in_line; + /** + * @brief num_lines + */ + int _num_lines; + /** + * @brief nom_interpixel_dist + */ + double _nom_interpixel_dist; + /** + * @brief nom_interline_dist + */ + double _nom_interline_dist; + /** + * @brief orientation_at_center + */ + double _orientation_at_center; + /** + * @brief orbit_incl + */ + double _orbit_incl; + /** + * @brief asc_node_long + */ + double _asc_node_long; + /** + * @brief platform_heading + */ + double _platform_heading; + /** + * @brief name_of_ref_ellipsoid + */ + std::string _name_of_ref_ellipsoid; + /** + * @brief semi_maj_axis + */ + double _semi_maj_axis; + /** + * @brief semi_min_axis + */ + double _semi_min_axis; + /** + * @brief first_line_first_pixel_lat + */ + double _first_line_first_pixel_lat; + /** + * @brief first_line_first_pixel_lon + */ + double _first_line_first_pixel_lon; + /** + * @brief first_line_last_pixel_lat + */ + double _first_line_last_pixel_lat; + /** + * @brief first_line_last_pixel_lon + */ + double _first_line_last_pixel_lon; + /** + * @brief last_line_last_pixel_lat + */ + double _last_line_last_pixel_lat; + /** + * @brief last_line_last_pixel_lon + */ + double _last_line_last_pixel_lon; + /** + * @brief last_line_first_pixel_lat + */ + double _last_line_first_pixel_lat; + /** + * @brief last_line_first_pixel_lon + */ + double _last_line_first_pixel_lon; + + +private: + +}; +} +#endif diff --git a/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarPlatformPositionData.cpp b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarPlatformPositionData.cpp new file mode 100644 index 0000000000000000000000000000000000000000..80024f24d3b93575f65e34ada2f6fedcb0577649 --- /dev/null +++ b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarPlatformPositionData.cpp @@ -0,0 +1,254 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// "Copyright Centre for Remote Imaging, Sensing and Processing" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#include <AlosSarPlatformPositionData.h> + +namespace ossimplugins +{ + + +AlosSarPlatformPositionData::AlosSarPlatformPositionData() : AlosSarRecord("pos_data_rec") +{ +} + +AlosSarPlatformPositionData::~AlosSarPlatformPositionData() +{ +} + +std::ostream& operator<<(std::ostream& os, const AlosSarPlatformPositionData& data) +{ + os<<"orbit_ele_desg:"<<data._orbit_ele_desg.c_str()<<std::endl; + + for(int i=0;i<6;i++) + { + os<<"orbit_ele["<<i<<"]:"<<data._orbit_ele[i]<<std::endl; + } + + os<<"ndata:"<<data._ndata<<std::endl; + + os<<"year:"<<data._year<<std::endl; + + os<<"month:"<<data._month<<std::endl; + + os<<"day:"<<data._day<<std::endl; + + os<<"gmt_day:"<<data._gmt_day<<std::endl; + + os<<"gmt_sec:"<<data._gmt_sec<<std::endl; + + os<<"data_int:"<<data._data_int<<std::endl; + + os<<"ref_coord:"<<data._ref_coord.c_str()<<std::endl; + + os<<"hr_angle:"<<data._hr_angle<<std::endl; + + os<<"alt_poserr:"<<data._alt_poserr<<std::endl; + + os<<"crt_poserr:"<<data._crt_poserr<<std::endl; + + os<<"rad_poserr:"<<data._rad_poserr<<std::endl; + + os<<"alt_velerr:"<<data._alt_velerr<<std::endl; + + os<<"crt_velerr:"<<data._crt_velerr<<std::endl; + + os<<"rad_velerr:"<<data._rad_velerr<<std::endl; + + for (int i=0;i<64;i++) + { + os<<"pos_vect["<<i<<"]:"<<data._pos_vect[i]<<std::endl; + } + + return os; +} + +std::istream& operator>>(std::istream& is, AlosSarPlatformPositionData& data) +{ + char buf[1207]; + buf[1206] = '\0'; + + is.read(buf,32); + buf[32] = '\0'; + data._orbit_ele_desg = buf; + + for(int i=0;i<6;i++) + { + is.read(buf,16); + buf[16] = '\0'; + data._orbit_ele[i] = atof(buf); + } + + is.read(buf,4); + buf[4] = '\0'; + data._ndata = atoi(buf); + + is.read(buf,4); + buf[4] = '\0'; + data._year = atoi(buf); + + is.read(buf,4); + buf[4] = '\0'; + data._month = atoi(buf); + + is.read(buf,4); + buf[4] = '\0'; + data._day = atoi(buf); + + is.read(buf,4); + buf[4] = '\0'; + data._gmt_day = atoi(buf); + + is.read(buf,22); + buf[22] = '\0'; + data._gmt_sec = atof(buf); + + is.read(buf,22); + buf[22] = '\0'; + data._data_int = atof(buf); + + is.read(buf,64); + buf[64] = '\0'; + data._ref_coord = buf; + + is.read(buf,22); + buf[22] = '\0'; + data._hr_angle = atof(buf); + + is.read(buf,16); + buf[16] = '\0'; + data._alt_poserr = atof(buf); + + is.read(buf,16); + buf[16] = '\0'; + data._crt_poserr = atof(buf); + + is.read(buf,16); + buf[16] = '\0'; + data._rad_poserr = atof(buf); + + is.read(buf,16); + buf[16] = '\0'; + data._alt_velerr = atof(buf); + + is.read(buf,16); + buf[16] = '\0'; + data._crt_velerr = atof(buf); + + is.read(buf,16); + buf[16] = '\0'; + data._rad_velerr = atof(buf); + + for (int i=0;i<data._ndata;i++) + { + is>>data._pos_vect[i]; + } + + is.seekg(598, std::ios::cur); //skip the rest part of PlatformPostion// + is.seekg(12495744, std::ios::cur); //data skip ubtil facility11// + + return is; +} + +AlosSarPlatformPositionData::AlosSarPlatformPositionData(const AlosSarPlatformPositionData& rhs): + AlosSarRecord(rhs) +{ + _orbit_ele_desg = rhs._orbit_ele_desg; + + for(int i=0;i<6;i++) + { + _orbit_ele[i] = rhs._orbit_ele[i]; + } + + _ndata = rhs._ndata; + + _year = rhs._year; + + _month = rhs._month; + + _day = rhs._day; + + _gmt_day = rhs._gmt_day; + + _gmt_sec = rhs._gmt_sec; + + _data_int = rhs._data_int; + + _ref_coord = rhs._ref_coord; + + _hr_angle = rhs._hr_angle; + + _alt_poserr = rhs._alt_poserr; + + _crt_poserr = rhs._crt_poserr; + + _rad_poserr = rhs._rad_poserr; + + _alt_velerr = rhs._alt_velerr; + + _crt_velerr = rhs._crt_velerr; + + _rad_velerr = rhs._rad_velerr; + + for (int i=0;i<64;i++) + { + _pos_vect[i] = rhs._pos_vect[i]; + } + +} + +AlosSarPlatformPositionData& AlosSarPlatformPositionData::operator=(const AlosSarPlatformPositionData& rhs) +{ + _orbit_ele_desg = rhs._orbit_ele_desg; + + for(int i=0;i<6;i++) + { + _orbit_ele[i] = rhs._orbit_ele[i]; + } + + _ndata = rhs._ndata; + + _year = rhs._year; + + _month = rhs._month; + + _day = rhs._day; + + _gmt_day = rhs._gmt_day; + + _gmt_sec = rhs._gmt_sec; + + _data_int = rhs._data_int; + + _ref_coord = rhs._ref_coord; + + _hr_angle = rhs._hr_angle; + + _alt_poserr = rhs._alt_poserr; + + _crt_poserr = rhs._crt_poserr; + + _rad_poserr = rhs._rad_poserr; + + _alt_velerr = rhs._alt_velerr; + + _crt_velerr = rhs._crt_velerr; + + _rad_velerr = rhs._rad_velerr; + + for (int i=0;i<64;i++) + { + _pos_vect[i] = rhs._pos_vect[i]; + } + + return *this; +} +} diff --git a/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarPlatformPositionData.h b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarPlatformPositionData.h new file mode 100644 index 0000000000000000000000000000000000000000..26b93c132eeca2b48a5326d34135decc0603c83e --- /dev/null +++ b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarPlatformPositionData.h @@ -0,0 +1,297 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// "Copyright Centre for Remote Imaging, Sensing and Processing" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#ifndef AlosSarPlatformPositionData_h +#define AlosSarPlatformPositionData_h + +#include <iostream> +#include <AlosSarRecord.h> +#include <AlosSarRecordHeader.h> + +#include <AlosSarPositionVectorRecord.h> + +namespace ossimplugins +{ + +/** + * @ingroup PlatformPositionDataRecord + * @brief This class is able to read a Platform position data record + */ +class AlosSarPlatformPositionData : public AlosSarRecord +{ +public: + /** + * @brief Constructor + */ + AlosSarPlatformPositionData(); + + /** + * @brief Destructor + */ + ~AlosSarPlatformPositionData(); + + /** + * @brief Copy constructor + */ + AlosSarPlatformPositionData(const AlosSarPlatformPositionData& rhs); + + /** + * @brief Copy operator + */ + AlosSarPlatformPositionData& operator=(const AlosSarPlatformPositionData& rhs); + /** + * @brief This function write the AlosSar PlatformPositionData in a stream + */ + friend std::ostream& operator<<(std::ostream& os, const AlosSarPlatformPositionData& data); + + /** + * @brief This function read a AlosSar PlatformPositionData from a stream + */ + friend std::istream& operator>>(std::istream& is, AlosSarPlatformPositionData& data); + + /** + * @brief This function is able to create a new instance of the class + */ + AlosSarRecord* Instanciate() + { + return new AlosSarPlatformPositionData(); + }; + + /** + * @brief This function is able to create a new instance of the class initialised with the data of the calling instance + */ + AlosSarRecord* Clone() + { + return new AlosSarPlatformPositionData(*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 Orbital elements designator + */ + std::string get_orbit_ele_desg() const + { + return _orbit_ele_desg; + }; + /** + * @brief Orbital elements + */ + const double* get_orbit_ele() const + { + return _orbit_ele; + }; + /** + * @brief Number of data points + */ + int get_ndata() const + { + return _ndata; + }; + /** + * @brief Year of data point + */ + int get_year() const + { + return _year; + }; + /** + * @brief Month of data point + */ + int get_month() const + { + return _month; + }; + /** + * @brief Day of data point + */ + int get_day() const + { + return _day; + }; + /** + * @brief Day of year + */ + int get_gmt_day() const + { + return _gmt_day; + }; + /** + * @brief Seconds of day + */ + double get_gmt_sec() const + { + return _gmt_sec; + }; + /** + * @brief Data sampling interval + */ + double get_data_int() const + { + return _data_int; + }; + /** + * @brief Reference coordinate system + */ + std::string get_ref_coord() const + { + return _ref_coord; + }; + /** + * @brief Greenwich mean hour angle + */ + double get_hr_angle() const + { + return _hr_angle; + }; + /** + * @brief Along track position error + */ + double get_alt_poserr() const + { + return _alt_poserr; + }; + /** + * @brief Cross track position error + */ + double get_crt_poserr() const + { + return _crt_poserr; + }; + /** + * @brief Radial position error + */ + double get_rad_poserr() const + { + return _rad_poserr; + }; + /** + * @brief Along track velocity error + */ + double get_alt_velerr() const + { + return _alt_velerr; + }; + /** + * @brief Cross track velocity error + */ + double get_crt_velerr() const + { + return _crt_velerr; + }; + /** + * @brief Radial velocity error + */ + double get_rad_velerr() const + { + return _rad_velerr; + }; + /** + * @brief Data point position/velocity + */ + const AlosSarPositionVectorRecord* get_pos_vect() const + { + return _pos_vect; + }; + +protected: + /** + * @brief Orbital elements designator + */ + std::string _orbit_ele_desg; + /** + * @brief Orbital elements + */ + double _orbit_ele[6]; + /** + * @brief Number of data points + */ + int _ndata; + /** + * @brief Year of data point + */ + int _year; + /** + * @brief Month of data point + */ + int _month; + /** + * @brief Day of data point + */ + int _day; + /** + * @brief Day of year + */ + int _gmt_day; + /** + * @brief Seconds of day + */ + double _gmt_sec; + /** + * @brief Data sampling interval + */ + double _data_int; + /** + * @brief Reference coordinate system + */ + std::string _ref_coord; + /** + * @brief Greenwich mean hour angle + */ + double _hr_angle; + /** + * @brief Along track position error + */ + double _alt_poserr; + /** + * @brief Cross track position error + */ + double _crt_poserr; + /** + * @brief Radial position error + */ + double _rad_poserr; + /** + * @brief Along track velocity error + */ + double _alt_velerr; + /** + * @brief Cross track velocity error + */ + double _crt_velerr; + /** + * @brief Radial velocity error + */ + double _rad_velerr; + /** + * @brief Data point position/velocity + */ + AlosSarPositionVectorRecord _pos_vect[64]; + +private: +}; +} +#endif diff --git a/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarPositionVectorRecord.cpp b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarPositionVectorRecord.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e5b5f400d425ebe40f0512644dfbf4b2f102b018 --- /dev/null +++ b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarPositionVectorRecord.cpp @@ -0,0 +1,87 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// "Copyright Centre for Remote Imaging, Sensing and Processing" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#include <AlosSarPositionVectorRecord.h> + +namespace ossimplugins +{ + + +AlosSarPositionVectorRecord::AlosSarPositionVectorRecord() +{ +} + +AlosSarPositionVectorRecord::~AlosSarPositionVectorRecord() +{ +} + +std::ostream& operator<<(std::ostream& os, const AlosSarPositionVectorRecord& data) +{ + for (int i=0;i<3;i++) + { + os<<"pos["<<i<<"]:"<<data._pos[i]<<std::endl; + } + + for (int i=0;i<3;i++) + { + os<<"vel["<<i<<"]:"<<data._vel[i]<<std::endl; + } + return os; +} + +std::istream& operator>>(std::istream& is, AlosSarPositionVectorRecord& data) +{ + char buf[23]; + buf[22] = '\0'; + + for (int i=0;i<3;i++) + { + is.read(buf,22); + data._pos[i] = atof(buf); + } + + for (int i=0;i<3;i++) + { + is.read(buf,22); + data._vel[i] = atof(buf); + } + return is; +} + +AlosSarPositionVectorRecord::AlosSarPositionVectorRecord(const AlosSarPositionVectorRecord& rhs) +{ + for (int i=0;i<3;i++) + { + _pos[i] = rhs._pos[i]; + } + + for (int i=0;i<3;i++) + { + _vel[i] = rhs._vel[i]; + } +} + +AlosSarPositionVectorRecord& AlosSarPositionVectorRecord::operator=(const AlosSarPositionVectorRecord& rhs) +{ + for (int i=0;i<3;i++) + { + _pos[i] = rhs._pos[i]; + } + + for (int i=0;i<3;i++) + { + _vel[i] = rhs._vel[i]; + } + return *this; +} + +} diff --git a/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarPositionVectorRecord.h b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarPositionVectorRecord.h new file mode 100644 index 0000000000000000000000000000000000000000..5dc63376e8546354c706ec951cd0e88c6095b07f --- /dev/null +++ b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarPositionVectorRecord.h @@ -0,0 +1,89 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// "Copyright Centre for Remote Imaging, Sensing and Processing" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#ifndef AlosSarPositionVectorRecord_h +#define AlosSarPositionVectorRecord_h + +#include <iostream> +#include <cstdlib> +#include <AlosSarRecord.h> + +namespace ossimplugins +{ + +/** + * @ingroup PlatformPositionDataRecord + * @brief This class is able to read a position vector record + */ +class AlosSarPositionVectorRecord +{ +public: + /** + * @brief Constructor + */ + AlosSarPositionVectorRecord(); + + /** + * @brief Destructor + */ + ~AlosSarPositionVectorRecord(); + + /** + * @brief Copy constructor + */ + AlosSarPositionVectorRecord(const AlosSarPositionVectorRecord& rhs); + + /** + * @brief Copy operator + */ + AlosSarPositionVectorRecord& operator=(const AlosSarPositionVectorRecord& rhs); + /** + * @brief This function write the AlosSar PositionVectorRecord in a stream + */ + friend std::ostream& operator<<(std::ostream& os, const AlosSarPositionVectorRecord& data); + + /** + * @brief This function read a AlosSar PositionVectorRecord from a stream + */ + friend std::istream& operator>>(std::istream& is, AlosSarPositionVectorRecord& data); + + /** + * @brief Data point position (m) + */ + const double* get_pos() const + { + return _pos; + }; + + /** + * @brief Data point velocity (mm/s) + */ + const double* get_vel() const + { + return _vel; + }; + +protected: + /** + * @brief Data point position (m) + */ + double _pos[3]; + /** + * @brief Data point velocity (mm/s) + */ + double _vel[3]; +private: + + +}; +} +#endif diff --git a/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarRecord.cpp b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarRecord.cpp new file mode 100644 index 0000000000000000000000000000000000000000..deea347cc05f3f75e8ee3903e5e86c8a22c357be --- /dev/null +++ b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarRecord.cpp @@ -0,0 +1,33 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// "Copyright Centre for Remote Imaging, Sensing and Processing" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#include <AlosSarRecord.h> +#include <memory.h> + +namespace ossimplugins +{ + +AlosSarRecord::AlosSarRecord(std::string mnemonic): + _mnemonic(mnemonic) +{ +} + +AlosSarRecord::~AlosSarRecord() +{ +} + +AlosSarRecord::AlosSarRecord(const AlosSarRecord& rhs): + _mnemonic(rhs._mnemonic) +{ +} + +} diff --git a/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarRecord.h b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarRecord.h new file mode 100644 index 0000000000000000000000000000000000000000..46a4345cb59f7db374f8f5d7d6ab71859ca93ef9 --- /dev/null +++ b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarRecord.h @@ -0,0 +1,77 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// "Copyright Centre for Remote Imaging, Sensing and Processing" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#ifndef AlosSarRecord_h +#define AlosSarRecord_h + + +#include <AlosSarRecordHeader.h> +#include <iostream> + +namespace ossimplugins +{ + +/** + * @ingroup AlosSar + * @brief This class is the base class of all the record classes + */ +class AlosSarRecord +{ +public: + /** + * @brief Constructor + * @param mnemonic Name of the record + */ + AlosSarRecord(std::string mnemonic); + /** + * @brief Destructor + */ + ~AlosSarRecord(); + + /** + * @brief Copy constructor + */ + AlosSarRecord(const AlosSarRecord& rhs); + + /** + * @brief This function is able to create a new instance of the class + */ + virtual AlosSarRecord* Instanciate() =0; + + /** + * @brief This function is able to create a new instance of the class initialised with the data of the calling instance + */ + virtual AlosSarRecord* Clone()=0; + + /** + * @brief Read the class data from a stream + */ + virtual void Read(std::istream& is) =0; + + /** + * @brief Write the class to a stream + */ + virtual void Write(std::ostream& os)=0; + + std::string get_mnemonic() + { + return _mnemonic; + }; + +protected: + + std::string _mnemonic; + +private: +}; +} +#endif diff --git a/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarRecordFactory.cpp b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarRecordFactory.cpp new file mode 100644 index 0000000000000000000000000000000000000000..26af112b3b259e2ff9cdd33f07a103e64d07011a --- /dev/null +++ b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarRecordFactory.cpp @@ -0,0 +1,52 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// "Copyright Centre for Remote Imaging, Sensing and Processing" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#include <AlosSarRecordFactory.h> +#include <ossim/base/ossimTrace.h> + +// Static trace for debugging +static ossimTrace traceDebug("AlosSarRecordFactory:debug"); + +namespace ossimplugins +{ + +AlosSarRecordFactory::AlosSarRecordFactory() +{ +} + +AlosSarRecordFactory::~AlosSarRecordFactory() +{ +} + +AlosSarRecord* AlosSarRecordFactory::Instanciate(int id) +{ + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG)<< "Intanciate AlosPalsar record:" << id << "\n"; + } + AlosSarRecord* record = _availableRecords[id]; + if(record == NULL) + { + return NULL; + } + else + { + return record->Instanciate(); + } +} + +void AlosSarRecordFactory::RegisterRecord(int id, AlosSarRecord * record) +{ + _availableRecords[id] = record; +} + +} diff --git a/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarRecordFactory.h b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarRecordFactory.h new file mode 100644 index 0000000000000000000000000000000000000000..8647cc5aadf68f75d8e30554917607a3ee3f8a2e --- /dev/null +++ b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarRecordFactory.h @@ -0,0 +1,62 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// "Copyright Centre for Remote Imaging, Sensing and Processing" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#ifndef AlosSarRecordFactory_h +#define AlosSarRecordFactory_h + + +#include <AlosSarRecordHeader.h> +#include <AlosSarRecord.h> +#include <map> + +namespace ossimplugins +{ + +/** + * @ingroup AlosSar + * @brief This class is a facory able to construct Record base classes given the id of the record wanted + */ +class AlosSarRecordFactory +{ +public: + /** + * @brief Constructor + */ + AlosSarRecordFactory(); + /** + * @brief Destructor + */ + ~AlosSarRecordFactory(); + + /** + * @brief Add 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(int id, AlosSarRecord * record); + + /** + * @brief Instanciate a new Record + * @param id Id of the Record we want to instanciate + */ + AlosSarRecord* Instanciate(int id) ; +protected: + + /** + * @brief Contain all the available Records for the factory + */ + std::map<int, AlosSarRecord*> _availableRecords; + +private: +}; +} +#endif diff --git a/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarRecordHeader.cpp b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarRecordHeader.cpp new file mode 100644 index 0000000000000000000000000000000000000000..74113366bf9e7758101accdd4d2af05acff17ff1 --- /dev/null +++ b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarRecordHeader.cpp @@ -0,0 +1,83 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// "Copyright Centre for Remote Imaging, Sensing and Processing" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#include <AlosSarRecordHeader.h> + +namespace ossimplugins +{ + + +AlosSarRecordHeader::AlosSarRecordHeader() +{ +} + +AlosSarRecordHeader::~AlosSarRecordHeader() +{ +} + +std::ostream& operator<<(std::ostream& os, const AlosSarRecordHeader& data) +{ + os<<"record_sequence_number:"<<data._rec_seq<<std::endl; + os<<"first_record_sub-type:"<<(int)data._rec_sub1<<std::endl; + os<<"record_type_code:"<<(int)data._rec_type<<std::endl; + os<<"second_record_sub-type:"<<(int)data._rec_sub2<<std::endl; + os<<"third_record_sub-type:"<<(int)data._rec_sub3<<std::endl; + os<<"length:"<<data._length<<std::endl; + return os; +} + +std::istream& operator>>(std::istream& is, AlosSarRecordHeader& data) +{ + is.read((char*)&(data._rec_seq),4); // TODO Change dangerous C-style cast to static cast. + data.SwitchEndian(data._rec_seq); + is.read((char*)&(data._rec_sub1),1); + is.read((char*)&(data._rec_type),1); + is.read((char*)&(data._rec_sub2),1); + is.read((char*)&(data._rec_sub3),1); + is.read((char*)&(data._length),4); + data.SwitchEndian(data._length); + return is; +} + +AlosSarRecordHeader::AlosSarRecordHeader(const AlosSarRecordHeader& rhs): + _rec_seq(rhs._rec_seq), + _rec_sub1(rhs._rec_sub1), + _rec_type(rhs._rec_type), + _rec_sub2(rhs._rec_sub2), + _rec_sub3(rhs._rec_sub3) +{ +} + +AlosSarRecordHeader& AlosSarRecordHeader::operator=(const AlosSarRecordHeader& rhs) +{ + _rec_seq=rhs._rec_seq; + _rec_sub1=rhs._rec_sub1; + _rec_type=rhs._rec_type; + _rec_sub2=rhs._rec_sub2; + _rec_sub3=rhs._rec_sub3; + return *this; +} + +void AlosSarRecordHeader::SwitchEndian(unsigned int& value) +{ + char buffer[4]; + char res[4]; + + memcpy(buffer,&value,4); + res[0] = buffer[3]; + res[1] = buffer[2]; + res[2] = buffer[1]; + res[3] = buffer[0]; + + memcpy(&value,res,4); +} +} diff --git a/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarRecordHeader.h b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarRecordHeader.h new file mode 100644 index 0000000000000000000000000000000000000000..665b7010083faf07d98a8222e56364c2c72e0b85 --- /dev/null +++ b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarRecordHeader.h @@ -0,0 +1,141 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// "Copyright Centre for Remote Imaging, Sensing and Processing" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#ifndef AlosSarRecordHeader_h +#define AlosSarRecordHeader_h + +#include<iostream> +#include<cstring> + +namespace ossimplugins +{ + +/** + * @ingroup AlosSar + * @brief This class is able to read a record header + */ +class AlosSarRecordHeader +{ +public: + /** + * @brief Constructor + */ + AlosSarRecordHeader(); + + /** + * @brief Destructor + */ + ~AlosSarRecordHeader(); + + /** + * @brief Copy constructor + */ + AlosSarRecordHeader(const AlosSarRecordHeader& rhs); + + /** + * @brief Copy operator + */ + AlosSarRecordHeader& operator=(const AlosSarRecordHeader& rhs); + /** + * @brief This function write the RecordHeader in a stream + */ + friend std::ostream& operator<<(std::ostream& os, const AlosSarRecordHeader& data); + + /** + * @brief This function read a RecordHeader from a stream + */ + friend std::istream& operator>>(std::istream& is, AlosSarRecordHeader& data); + + /** + * @brief Record sequence number + */ + unsigned int get_rec_seq() + { + return _rec_seq; + }; + + /** + * @brief First record sub-type code + */ + unsigned char get_rec_sub1() + { + return _rec_sub1; + }; + + /** + * @brief Record type code + */ + unsigned char get_rec_type() + { + return _rec_type; + }; + + /** + * @brief Second record sub-type code + */ + unsigned char get_rec_sub2() + { + return _rec_sub2; + }; + + /** + * @brief Third record sub-type code + */ + unsigned char get_rec_sub3() + { + return _rec_sub3; + }; + + /** + * @brief Length of this record (in bytes) + */ + unsigned int get_length() + { + return _length; + }; +protected: + + /** + * @brief This function switch the LSB value and the MSB value of the parameter + */ + void SwitchEndian(unsigned int& value); + + /** + * @brief Record sequence number + */ + unsigned int _rec_seq; + /** + * @brief First record sub-type code + */ + unsigned char _rec_sub1; + /** + * @brief Record type code + */ + unsigned char _rec_type; + /** + * @brief Second record sub-type code + */ + unsigned char _rec_sub2; + /** + * @brief Third record sub-type code + */ + unsigned char _rec_sub3; + /** + * @brief Length of this record (in bytes) + */ + unsigned int _length; +private: + + +}; +} +#endif diff --git a/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarSignalData.cpp b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarSignalData.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ceb6d096f19ae7035111b39a23a9d47668e6bf40 --- /dev/null +++ b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarSignalData.cpp @@ -0,0 +1,143 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// "Copyright Centre for Remote Imaging, Sensing and Processing" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#include <AlosSarSignalData.h> +#include <ossim/base/ossimConstants.h> +#include <ossim/base/ossimEndian.h> + + +namespace ossimplugins +{ + +AlosSarSignalData::AlosSarSignalData() : AlosSarRecord("sar_sig_dat_rec") +{ +} + +AlosSarSignalData::~AlosSarSignalData() +{ +} + +std::ostream& operator<<(std::ostream& os, const AlosSarSignalData& data) +{ + os << "_pulse_repetition_frequency:" + << data._pulse_repetition_frequency << std::endl; + os << "_slant_range_to_1st_data_sample:" + << data._slant_range_to_1st_data_sample << std::endl; + + return os; +} + +std::istream& operator>>(std::istream& is, AlosSarSignalData& data) +{ + ossim_uint16 tmpuint16; + ossim_uint32 tmpuint32; + ossimEndian oe; + + std::cout << std::endl << "File pointer location = " << is.tellg() << std::endl; + std::cout << std::endl; + + is.read(reinterpret_cast<char*>(&tmpuint32), 4); + if (oe.getSystemEndianType() == OSSIM_LITTLE_ENDIAN) {oe.swap(tmpuint32);} + std::cout << "Data line number = " << tmpuint32 << std::endl; + + is.read(reinterpret_cast<char*>(&tmpuint32), 4); + if (oe.getSystemEndianType() == OSSIM_LITTLE_ENDIAN) {oe.swap(tmpuint32);} + std::cout << "Data record index = " << tmpuint32 << std::endl; + + is.read(reinterpret_cast<char*>(&tmpuint32), 4); + if (oe.getSystemEndianType() == OSSIM_LITTLE_ENDIAN) {oe.swap(tmpuint32);} + std::cout << "Actual count of left-fill pixels = " << tmpuint32 << std::endl; + + is.read(reinterpret_cast<char*>(&tmpuint32), 4); + if (oe.getSystemEndianType() == OSSIM_LITTLE_ENDIAN) {oe.swap(tmpuint32);} + std::cout << "Actual count of data pixels = " << tmpuint32 << std::endl; + + is.read(reinterpret_cast<char*>(&tmpuint32), 4); + if (oe.getSystemEndianType() == OSSIM_LITTLE_ENDIAN) {oe.swap(tmpuint32);} + std::cout << "Actual count of right-fill pixels = " << tmpuint32 << std::endl; + + is.read(reinterpret_cast<char*>(&tmpuint32), 4); + if (oe.getSystemEndianType() == OSSIM_LITTLE_ENDIAN) {oe.swap(tmpuint32);} + std::cout << "Sensor parameters update flag = " << tmpuint32 << std::endl; + + is.read(reinterpret_cast<char*>(&tmpuint32), 4); + if (oe.getSystemEndianType() == OSSIM_LITTLE_ENDIAN) {oe.swap(tmpuint32);} + std::cout << "Scene start year = " << tmpuint32 << std::endl; + + is.read(reinterpret_cast<char*>(&tmpuint32), 4); + if (oe.getSystemEndianType() == OSSIM_LITTLE_ENDIAN) {oe.swap(tmpuint32);} + std::cout << "Scene start day of year = " << tmpuint32 << std::endl; + + is.read(reinterpret_cast<char*>(&tmpuint32), 4); + if (oe.getSystemEndianType() == OSSIM_LITTLE_ENDIAN) {oe.swap(tmpuint32);} + std::cout << "Sensor acquisition milliseconds of day = " << tmpuint32 << std::endl; + + is.read(reinterpret_cast<char*>(&tmpuint16), 2); + if (oe.getSystemEndianType() == OSSIM_LITTLE_ENDIAN) {oe.swap(tmpuint16);} + std::cout << "SAR channel indicator = " << tmpuint16 << std::endl; + + is.read(reinterpret_cast<char*>(&tmpuint16), 2); + if (oe.getSystemEndianType() == OSSIM_LITTLE_ENDIAN) {oe.swap(tmpuint16);} + std::cout << "SAR channel code = " << tmpuint16 << std::endl; + + is.read(reinterpret_cast<char*>(&tmpuint16), 2); + if (oe.getSystemEndianType() == OSSIM_LITTLE_ENDIAN) {oe.swap(tmpuint16);} + std::cout << "Transmitted polarization = " << tmpuint16 << std::endl; + + is.read(reinterpret_cast<char*>(&tmpuint16), 2); + if (oe.getSystemEndianType() == OSSIM_LITTLE_ENDIAN) {oe.swap(tmpuint16);} + std::cout << "Received polarization = " << tmpuint16 << std::endl; + + is.read(reinterpret_cast<char*>(&tmpuint32), 4); + if (oe.getSystemEndianType() == OSSIM_LITTLE_ENDIAN) {oe.swap(tmpuint32);} + std::cout << "PRF (mHz) = " << tmpuint32 << std::endl; + data._pulse_repetition_frequency = static_cast<int>(tmpuint32); + + is.read(reinterpret_cast<char*>(&tmpuint32), 4); + if (oe.getSystemEndianType() == OSSIM_LITTLE_ENDIAN) {oe.swap(tmpuint32);} + std::cout << "Scan ID for SCAN SAR mode = " << tmpuint32 << std::endl; + + is.read(reinterpret_cast<char*>(&tmpuint16), 2); + if (oe.getSystemEndianType() == OSSIM_LITTLE_ENDIAN) {oe.swap(tmpuint16);} + std::cout << "Onboard range compressed flag = " << tmpuint16 << std::endl; + + is.seekg(50, std::ios_base::cur); + + is.read(reinterpret_cast<char*>(&tmpuint32), 4); + if (oe.getSystemEndianType() == OSSIM_LITTLE_ENDIAN) {oe.swap(tmpuint32);} + std::cout << "Slant range to 1st data sample (m) = " << tmpuint32 << std::endl; + data._slant_range_to_1st_data_sample = static_cast<int>(tmpuint32); + + is.read(reinterpret_cast<char*>(&tmpuint32), 4); + if (oe.getSystemEndianType() == OSSIM_LITTLE_ENDIAN) {oe.swap(tmpuint32);} + std::cout << "Data record window position = " << tmpuint32 << std::endl; + + std::cout << std::endl << "File pointer location = " << is.tellg() << std::endl; + std::cout << std::endl; + + return is; +} + +AlosSarSignalData::AlosSarSignalData(const AlosSarSignalData& rhs): + AlosSarRecord(rhs), + _pulse_repetition_frequency(rhs._pulse_repetition_frequency), + _slant_range_to_1st_data_sample(rhs._slant_range_to_1st_data_sample) +{ +} + +AlosSarSignalData& AlosSarSignalData::operator=(const AlosSarSignalData& rhs) +{ + _pulse_repetition_frequency = rhs._pulse_repetition_frequency; + _slant_range_to_1st_data_sample = rhs._slant_range_to_1st_data_sample; + return *this; +} +} diff --git a/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarSignalData.h b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarSignalData.h new file mode 100644 index 0000000000000000000000000000000000000000..e9aeeffa6ebd834120d3ff9fef7d6d419e8b7b4c --- /dev/null +++ b/Utilities/otbossimplugins/ossim/AlosPalsar/AlosSarSignalData.h @@ -0,0 +1,121 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// "Copyright Centre for Remote Imaging, Sensing and Processing" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#ifndef AlosSarSignalData_h +#define AlosSarSignalData_h + + +#include <iostream> +#include <cstdlib> +#include <AlosSarRecordHeader.h> +#include <AlosSarRecord.h> + +namespace ossimplugins +{ + +/** + * @ingroup SARDataAlosSarSignalDataRecord + * @brief This class is able to read the header of the Signal Data Records of the image file + */ +class AlosSarSignalData : public AlosSarRecord +{ +public: + /** + * @brief Constructor + */ + AlosSarSignalData(); + /** + * @brief Destructor + */ + ~AlosSarSignalData(); + + /** + * @brief This function writes AlosSarSignalData to a stream + */ + friend std::ostream& operator<<(std::ostream& os, const AlosSarSignalData& data); + + /** + * @brief This function reads to AlosSarSignalData from a stream + */ + friend std::istream& operator>>(std::istream& is, AlosSarSignalData& data); + + /** + * @brief Copy constructor + */ + AlosSarSignalData(const AlosSarSignalData& rhs); + + /** + * @brief Copy operator + */ + AlosSarSignalData& operator=(const AlosSarSignalData& rhs); + + /** + * @brief This function is able to create a new instance of the class + */ + AlosSarRecord* Instanciate() + { + return new AlosSarSignalData(); + }; + + /** + * @brief This function is able to create a new instance of the class initialised with the data of the calling instance + */ + AlosSarRecord* Clone() + { + return new AlosSarSignalData(*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; + }; + + + int get_pulse_repetition_frequency() const + { + return _pulse_repetition_frequency; + }; + + int get_slant_range_to_1st_data_sample() const + { + return _slant_range_to_1st_data_sample; + }; + + +protected: + + /** + * @brief pulse_repetition_frequency + */ + int _pulse_repetition_frequency; + + /** + * @brief slant_range_to_1st_data_sample + */ + int _slant_range_to_1st_data_sample; + +private: +}; + +} +#endif diff --git a/Utilities/otbossimplugins/ossim/ossimAlosPalsarModel.cpp b/Utilities/otbossimplugins/ossim/ossimAlosPalsarModel.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8c3cf6f0b7497c14efd7854c17363c7e46d00e96 --- /dev/null +++ b/Utilities/otbossimplugins/ossim/ossimAlosPalsarModel.cpp @@ -0,0 +1,789 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// "Copyright Centre for Remote Imaging, Sensing and Processing" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#include <ossimAlosPalsarModel.h> +#include <otb/GalileanEphemeris.h> +#include <otb/GeographicEphemeris.h> + +#include <otb/JSDDateTime.h> +#include <otb/GMSTDateTime.h> +#include <otb/CivilDateTime.h> + +#include <ossim/base/ossimTrace.h> +#include <otb/RefPoint.h> +#include <AlosPalsar/AlosSarLeader.h> +#include <AlosPalsar/AlosSarData.h> +#include <otb/SensorParams.h> +#include <otb/PlatformPosition.h> +#include <ossim/base/ossimKeywordNames.h> + + +// Static trace for debugging +static ossimTrace traceDebug("ossimAlosPalsarModel:debug"); + +#include <string> +#include <algorithm> + +namespace ossimplugins +{ + + +RTTI_DEF1(ossimAlosPalsarModel, "ossimAlosPalsarModel", ossimGeometricSarSensorModel); + +ossimAlosPalsarModel::ossimAlosPalsarModel(): + thePixelSpacing(0), + theAlosSarLeader(NULL) +{ +} + +ossimAlosPalsarModel::~ossimAlosPalsarModel() +{ +} + +ossimString ossimAlosPalsarModel::getClassName() const +{ + return ossimString("ossimAlosPalsarModel"); +} + +ossimObject* ossimAlosPalsarModel::dup() const +{ + return new ossimAlosPalsarModel(*this); +} + +double ossimAlosPalsarModel::getSlantRangeFromGeoreferenced(double col) const +{ + // TODO Add user warning and reference to ERS Model +} + +bool ossimAlosPalsarModel::InitSensorParams(const ossimKeywordlist &kwl, const char *prefix) +{ + const char* wave_length_str = kwl.find(prefix,"wave_length"); + double wave_length = atof(wave_length_str); + const char* fr_str = kwl.find(prefix,"fr"); + double fr = atof(fr_str)*1e6; + const char* fa_str = kwl.find(prefix,"fa"); + double fa = atof(fa_str); + + ossimString time_dir_pix = kwl.find(prefix,"time_dir_pix"); + time_dir_pix.upcase(); + //std::transform(time_dir_pix.begin(), time_dir_pix.end(), time_dir_pix.begin(), toupper); + ossimString time_dir_lin = kwl.find(prefix,"time_dir_lin"); + time_dir_lin.upcase(); + //std::transform(time_dir_lin.begin(), time_dir_lin.end(), time_dir_lin.begin(), toupper); + + //ellipsoid parameters + const char* ellip_maj_str = kwl.find(prefix,"ellip_maj"); + double ellip_maj = atof(ellip_maj_str) * 1000.0; // km -> m + const char* ellip_min_str = kwl.find(prefix,"ellip_min"); + double ellip_min = atof(ellip_min_str) * 1000.0; // km -> m + + const char* dopcen_str = kwl.find(prefix,"alt_dopcen[0]"); + double dopcen = atof(dopcen_str); + + if(_sensor != NULL) + { + delete _sensor; + } + + _sensor = new SensorParams(); + + /* + if(strcmp(time_dir_pix.c_str(), "INCREASE") == 0) + { + _sensor->set_col_direction(1); + } + else + { + _sensor->set_col_direction(-1); + } + */ + // WARNING: _col_direction hard-coded to 1, as level 1.0 image is not flipped. + _sensor->set_col_direction(1); + + // TODO: Have to verify whether the time direction indicator should be always positive + /* + if(strcmp(time_dir_lin.c_str(), "INCREASE") == 0) + { + _sensor->set_lin_direction(1); + } + else + { + _sensor->set_lin_direction(-1); + } + */ + _sensor->set_lin_direction(1); + + _sensor->set_sightDirection(SensorParams::Right) ; + + double nlooks_az = atof(kwl.find(prefix,"nlooks_az")); + _sensor->set_nAzimuthLook(nlooks_az); + double n_rnglok = atof(kwl.find(prefix,"n_rnglok")); + _sensor->set_nRangeLook(n_rnglok); + + _sensor->set_prf(fa/1000.); // For ALOS, the fa value in the leader file is in units of mHz + _sensor->set_sf(fr); + _sensor->set_rwl(wave_length); + + _sensor->set_semiMajorAxis(ellip_maj) ; + _sensor->set_semiMinorAxis(ellip_min) ; + + _sensor->set_dopcen(dopcen); + + return true; +} + +bool ossimAlosPalsarModel::open(const ossimFilename& file) +{ + static const char MODULE[] = "ossimAlosPalsarModel::open"; + + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) + << MODULE << " entered...\n" + << "file: " << file << "\n"; + } + + bool result = false; + ossimFilename leaFilename = file; + ossimFilename datFilename; + + /* + * Creation of the class allowing to store Leader file metadata + */ + if(theAlosSarLeader != NULL) + { + delete theAlosSarLeader; + theAlosSarLeader = NULL; + } + + theAlosSarLeader = new AlosSarLeader(); + theAlosSarData = new AlosSarData(); + + if ( leaFilename.exists() ) + { + result = isAlosPalsarLeader(leaFilename); + if (result == false) + { + leaFilename = findAlosPalsarLeader(file); + } + result = isAlosPalsarLeader(leaFilename); + + if (result == true) + { + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) + << leaFilename << " is AlosPalsar leader file..." + << std::endl + << "Begin reading Leader file" << std::endl; + } + /* + * Leader file data reading + */ + std::ifstream leaderFile(leaFilename, ios::in|ios::binary); + leaderFile>>*theAlosSarLeader; + leaderFile.close(); + + if(traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) + << "End reading Leader file" << std::endl; + } + + datFilename = findAlosPalsarData(leaFilename); + result = isAlosPalsarData(datFilename); + if (result == true) + { + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) + << datFilename << " is AlosPalsar data file..." + << std::endl + << "Begin reading Data file header" << std::endl; + } + /* + * Read header of data file for image size info + */ + std::ifstream dataFile(datFilename, ios::in|ios::binary); + dataFile>>*theAlosSarData; + dataFile.close(); + + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) + << "End reading Data file header" << std::endl; + } + } // matches: if ( result=isAlosPalsarData(datFilename) == true ) + + //To initialize the whole state, reusing saveState/loadState + //FIXME: This could be at the superclass level instead + ossimKeywordlist kwl; + saveState(kwl); + loadState(kwl); + + } // matches: if ( result=isAlosPalsarLeader(file) == True ) + + } // matches: if ( file.exists() ) + + if (traceDebug()) + { + this->print(ossimNotify(ossimNotifyLevel_DEBUG)); + + ossimNotify(ossimNotifyLevel_DEBUG) + << MODULE << " exit status = " << (result?"true":"false\n") + << std::endl; + } + + return result; + +} + + +bool ossimAlosPalsarModel::saveState(ossimKeywordlist& kwl, + const char* prefix) const +{ + static const char MODULE[] = "ossimAlosPalsarModel::saveState"; + + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG)<< MODULE << " entered...\n"; + } + + bool result; + + char name[64]; + + kwl.add(prefix, ossimKeywordNames::TYPE_KW, "ossimAlosPalsarModel", true); + + if (theAlosSarLeader == NULL) + { + std::cout << "Error: AlosSarLeader is NULL" << std::endl; + return false; + } + + result = theAlosSarLeader->saveState(kwl); + + if (result == true) + { + if (theAlosSarData == NULL) + { + std::cout << "Error: AlosSarData is NULL" << std::endl; + return false; + } + result = theAlosSarData->saveState(kwl); + } + + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) + << MODULE << " exit status = " << (result?"true":"false\n") + << std::endl; + } + + return result; +} + +bool ossimAlosPalsarModel::loadState (const ossimKeywordlist &kwl, const char *prefix) +{ + static const char MODULE[] = "ossimAlosPalsarModel::loadState"; + + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " entered...\n"; + } + + const char* lookup = 0; + ossimString s; + + // Check the type first. + lookup = kwl.find(prefix, ossimKeywordNames::TYPE_KW); + if (lookup) + { + s = lookup; + if (s != getClassName()) + { + return false; + } + } + + // Load the base class. +// bool result = ossimGeometricSarSensorModel::loadState(kwl, prefix); + bool result = false; + result = InitPlatformPosition(kwl, prefix); + if (!result) + { + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_WARN) + << MODULE + << "\nCan't init platform position \n"; + } + } + + if (result) + { + result = InitSensorParams(kwl, prefix); + if (!result) + { + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_WARN) + << MODULE + << "\nCan't init sensor parameters \n"; + } + } + } + + if (result) + { + result = InitRefPoint(kwl, prefix); + if (!result) + { + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_WARN) + << MODULE + << "\nCan't init ref point \n"; + } + } + } + +// Products georeferenced to ground range are not handled in AlosPalsarModel + _isProductGeoreferenced = false; +/* + if (result) + { + result = InitSRGR(kwl, prefix); + if (!result) + { + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_WARN) + << MODULE + << "\nCan't init ref point \n"; + } + } + } +*/ + + return result; +} + +bool ossimAlosPalsarModel::InitPlatformPosition(const ossimKeywordlist &kwl, const char *prefix) +{ + // const double PI = 3.14159265358979323846 ; + CivilDateTime ref_civil_date; + /* + * Ephemerisis reference date retrieval + */ + const char* eph_year_str = kwl.find(prefix,"eph_year"); + int eph_year = atoi(eph_year_str); + const char* eph_month_str = kwl.find(prefix,"eph_month"); + int eph_month = atoi(eph_month_str); + const char* eph_day_str = kwl.find(prefix,"eph_day"); + int eph_day = atoi(eph_day_str); + const char* eph_sec_str = kwl.find(prefix,"eph_sec"); + double eph_sec = atof(eph_sec_str); + + std::cout << "eph_year = " << eph_year_str << std::endl; + std::cout << "eph_month = " << eph_month_str << std::endl; + std::cout << eph_day_str << std::endl; + std::cout << eph_sec_str << std::endl; + + ref_civil_date.set_year(eph_year); + ref_civil_date.set_month(eph_month); + ref_civil_date.set_day(eph_day); + ref_civil_date.set_second((int)eph_sec); + ref_civil_date.set_decimal( eph_sec-(double)((int)eph_sec)); + + JSDDateTime ref_jsd_date(ref_civil_date); + + /* + * Ephemerisis time interval retrieval + */ + const char* eph_int_str = kwl.find(prefix, "eph_int"); + double eph_int = atof(eph_int_str); + /* + * Ephemerisis number retrieval + */ + const char* neph_str = kwl.find(prefix,"neph"); + int neph = atoi(neph_str); + + Ephemeris** ephemeris = new Ephemeris*[neph]; + + /* + * Ephemerisis retrieval + */ + for (int i=0;i<neph;i++) + { + double pos[3]; + double vit[3]; + char name[64]; + + + sprintf(name,"eph%i_posX",i); + const char* px_str = kwl.find(prefix,name); + pos[0] = atof(px_str); + + sprintf(name,"eph%i_posY",i); + const char* py_str = kwl.find(prefix,name); + pos[1] = atof(py_str); + + sprintf(name,"eph%i_posZ",i); + const char* pz_str = kwl.find(prefix,name); + pos[2] = atof(pz_str); + + + sprintf(name,"eph%i_velX",i); + const char* vx_str = kwl.find(prefix,name); + vit[0] = atof(vx_str); + + sprintf(name,"eph%i_velY",i); + const char* vy_str = kwl.find(prefix,name); + vit[1] = atof(vy_str); + + sprintf(name,"eph%i_velZ",i); + const char* vz_str = kwl.find(prefix,name); + vit[2] = atof(vz_str); + + /* + * Ephemerisis date + */ + JSDDateTime date(ref_jsd_date); + date.set_second(date.get_second() + i * eph_int); + date.NormDate(); + + GeographicEphemeris* eph = new GeographicEphemeris(date, pos, vit); + + ephemeris[i] = eph; + } + + /* + * Antenna position interpolator creation + */ + if (_platformPosition != NULL) + { + delete _platformPosition; + } + _platformPosition = new PlatformPosition(ephemeris,neph); + + /* + * Free of memory used by the ephemerisis list + */ + for (int i=0;i<neph;i++) + { + delete ephemeris[i]; + } + delete[] ephemeris; + + return true; +} + +bool ossimAlosPalsarModel::InitRefPoint(const ossimKeywordlist &kwl, const char *prefix) +{ + const char* sc_lin_str = kwl.find(prefix,"sc_lin"); + double sc_lin = atof(sc_lin_str); + + const char* sc_pix_str = kwl.find(prefix,"sc_pix"); + double sc_pix = atof(sc_pix_str); + + const char* inp_sctim_str = kwl.find(prefix,"inp_sctim"); + + // Not available for ALOS + //const char* rng_gate_str = kwl.find(prefix,"zero_dop_range_time_f_pixel"); + //double rng_gate = atof(rng_gate_str); + + if(_refPoint == NULL) + { + _refPoint = new RefPoint(); + } + + _refPoint->set_pix_col(sc_pix); + _refPoint->set_pix_line(sc_lin); + + char year_str[5]; + for (int i=0;i<4;i++) + { + year_str[i] = inp_sctim_str[i]; + } + year_str[4] = '\0'; + + char month_str[3]; + for (int i=4;i<6;i++) + { + month_str[i-4] = inp_sctim_str[i]; + } + month_str[2] = '\0'; + + char day_str[3]; + for (int i=6;i<8;i++) + { + day_str[i-6] = inp_sctim_str[i]; + } + day_str[2] = '\0'; + + char hour_str[3]; + for (int i=8;i<10;i++) + { + hour_str[i-8] = inp_sctim_str[i]; + } + hour_str[2] = '\0'; + + char min_str[3]; + for (int i=10;i<12;i++) + { + min_str[i-10] = inp_sctim_str[i]; + } + min_str[2] = '\0'; + + char sec_str[3]; + for (int i=12;i<14;i++) + { + sec_str[i-12] = inp_sctim_str[i]; + } + sec_str[2] = '\0'; + + char mili_str[4]; + for (int i=14;i<17;i++) + { + mili_str[i-14] = inp_sctim_str[i]; + } + mili_str[3] = '\0'; + + int year = atoi(year_str); + int month = atoi(month_str); + int day = atoi(day_str); + int hour = atoi(hour_str); + int min = atoi(min_str); + int sec = atoi(sec_str); + double mili = atof(mili_str); + + std::cout << "year/month/day = " << year << '/' << month << '/' << day << std::endl; + std::cout << "hour:min:sec = " << hour << ':' << min << ':' << sec << std::endl; + std::cout << "mili = " << mili << std::endl; + + CivilDateTime date(year, month, day, hour * 3600 + min * 60 + sec, mili/1000.0); + + if(_platformPosition != NULL) + { + Ephemeris * ephemeris = _platformPosition->Interpolate((JSDDateTime)date); + if (ephemeris == NULL) return false ; + _refPoint->set_ephemeris(ephemeris); + + delete ephemeris; + } + else + { + return false; + } + + double c = 2.99792458e+8; + + //double distance = (rng_gate*1e-3 + ((double)sc_pix)*_sensor->get_nRangeLook()/_sensor->get_sf()) * (c/2.0); + const char* slantRange = kwl.find(prefix, "slant_range_to_1st_data_sample"); + double distance = atof(slantRange) + static_cast<double>(sc_pix)*_sensor->get_nRangeLook()/_sensor->get_sf() * c/2.0; + + _refPoint->set_distance(distance); + + // in order to use ossimSensorModel::lineSampleToWorld + const char* nbCol_str = kwl.find(prefix,"num_pix_in_line"); + const char* nbLin_str = kwl.find(prefix,"num_lines"); + theImageSize.x = atoi(nbCol_str); + theImageSize.y = atoi(nbLin_str); + theImageClipRect = ossimDrect(0, 0, theImageSize.x-1, theImageSize.y-1); + +// AlosPalsarModel currently does not handle GCPs +/* Do not use GCPs for now + // Ground Control Points extracted from the model : corner points + std::list<ossimGpt> groundGcpCoordinates ; + std::list<ossimDpt> imageGcpCoordinates ; + // first line first pix + const char* lon_str = kwl.find("first_line_first_pixel_lon"); + double lon = atof(lon_str); + const char* lat_str = kwl.find("first_line_first_pixel_lat"); + double lat = atof(lat_str); + if (lon > 180.0) lon -= 360.0; + ossimDpt imageGCP1(0,0); + ossimGpt groundGCP1(lat, lon, 0.0); + groundGcpCoordinates.push_back(groundGCP1) ; + imageGcpCoordinates.push_back(imageGCP1) ; + // first line last pix + lon_str = kwl.find("first_line_last_pixel_lon"); + lon = atof(lon_str); + lat_str = kwl.find("first_line_last_pixel_lat"); + lat = atof(lat_str); + if (lon > 180.0) lon -= 360.0; + ossimDpt imageGCP2(theImageSize.x-1, 0); + ossimGpt groundGCP2(lat, lon, 0.0); + groundGcpCoordinates.push_back(groundGCP2) ; + imageGcpCoordinates.push_back(imageGCP2) ; + // last line last pix + lon_str = kwl.find("last_line_last_pixel_lon"); + lon = atof(lon_str); + lat_str = kwl.find("last_line_last_pixel_lat"); + lat = atof(lat_str); + if (lon > 180.0) lon -= 360.0; + ossimDpt imageGCP3(theImageSize.x-1,theImageSize.y-1); + ossimGpt groundGCP3(lat, lon, 0.0); + groundGcpCoordinates.push_back(groundGCP3) ; + imageGcpCoordinates.push_back(imageGCP3) ; + // last line first pix + lon_str = kwl.find("last_line_first_pixel_lon"); + lon = atof(lon_str); + lat_str = kwl.find("last_line_first_pixel_lat"); + lat = atof(lat_str); + if (lon > 180.0) lon -= 360.0; + ossimDpt imageGCP4(0,theImageSize.y-1); + ossimGpt groundGCP4(lat, lon, 0.0); + groundGcpCoordinates.push_back(groundGCP4) ; + imageGcpCoordinates.push_back(imageGCP4) ; + + // Default optimization + optimizeModel(groundGcpCoordinates, imageGcpCoordinates) ; +*/ + + return true; +} + +// Note: Products georeferenced to ground range are not handled in AlosPalsarModel +// therefore the following method will not be used +bool ossimAlosPalsarModel::InitSRGR(const ossimKeywordlist &kwl, const char *prefix) +{ + // TODO Add user warning and reference to ERS Model +} + +bool ossimAlosPalsarModel::isAlosPalsarLeader(const ossimFilename& file) const +{ + std::ifstream candidate(file, ios::in | ios::binary); + char alosFileName[16]; + + candidate.seekg(48); + if ( candidate.bad() or candidate.eof() ) + { + return false; + } + candidate.read(alosFileName, 16); + if ( candidate.bad() or candidate.eof() ) + { + return false; + } + candidate.close(); + + ossimString ersString(alosFileName); + + if ( ( ersString.find("AL1 ") == 0 ) && + ( ersString.find("PSR") == 4 ) && + ( ersString.find("SARL") == 8 ) ) + { + return true; + } + else + { + return false; + } + + return true; + +} + +ossimFilename ossimAlosPalsarModel::findAlosPalsarLeader(const ossimFilename& file) const +{ + ossimFilename leaFile = file; + ossimString imgPrefix("IMG"); + ossimString trlPrefix("TRL"); + ossimString volPrefix("VOL"); + ossimString leaPrefix("LED"); + + ossimString filename = file.fileNoExtension(); + ossimString prefix = filename.substr(0,3); + if ( (prefix == imgPrefix) || + (prefix == trlPrefix) || + (prefix == volPrefix) ) + { + // Find the 2nd dash from the end of the string + // since ALOS files are of the form + // <prefix>-ALPSRP<identifier>-H<n.n>__A + int dash2_pos = filename.rfind('-', filename.rfind('-')-1); + filename.replace(0, dash2_pos, leaPrefix); + + leaFile.setFile(filename); + if (leaFile.exists()) + { + return leaFile; + } + } + return file; +} + +bool ossimAlosPalsarModel::isAlosPalsarData(const ossimFilename& file) const +{ + std::ifstream candidate(file, ios::in | ios::binary); + char alosFileName[16]; + + candidate.seekg(48); + if ( candidate.bad() or candidate.eof() ) + { + return false; + } + candidate.read(alosFileName, 16); + if ( candidate.bad() or candidate.eof() ) + { + return false; + } + candidate.close(); + + ossimString ersString(alosFileName); + + if ( ( ersString.find("AL1 ") == 0 ) && + ( ersString.find("PSR") == 4 ) && + ( ersString.find("IMOP") == 8 ) ) + { + return true; + } + else + { + return false; + } + + return true; +} + +ossimFilename ossimAlosPalsarModel::findAlosPalsarData(const ossimFilename& file) const +{ + ossimFilename dataFile = file; + ossimString imgPrefix("IMG-HH"); // Assume the ALOS data always has at least the HH + ossimString trlPrefix("TRL"); + ossimString volPrefix("VOL"); + ossimString leaPrefix("LED"); + + ossimString filename = file.fileNoExtension(); + ossimString prefix = filename.substr(0,3); + if ( (prefix == leaPrefix) || + (prefix == trlPrefix) || + (prefix == volPrefix) ) + { + // Find the 2nd dash from the end of the string + // since ALOS files are of the form + // <prefix>-ALPSRP<identifier>-H<n.n>__A + int dash2_pos = filename.rfind('-', filename.rfind('-')-1); + filename.replace(0, dash2_pos, imgPrefix); + + dataFile.setFile(filename); + if (dataFile.exists()) + { + return dataFile; + } + } + return file; +} + +} // namespace ossimplugins diff --git a/Utilities/otbossimplugins/ossim/ossimAlosPalsarModel.h b/Utilities/otbossimplugins/ossim/ossimAlosPalsarModel.h new file mode 100644 index 0000000000000000000000000000000000000000..06423375a0b134cbcc1dcb940ec82afb93836a81 --- /dev/null +++ b/Utilities/otbossimplugins/ossim/ossimAlosPalsarModel.h @@ -0,0 +1,129 @@ +//---------------------------------------------------------------------------- +// +// "Copyright Centre National d'Etudes Spatiales" +// "Copyright Centre for Remote Imaging, Sensing and Processing" +// +// License: LGPL +// +// See LICENSE.txt file in the top level directory for more details. +// +//---------------------------------------------------------------------------- +// $Id$ + +#ifndef ossimAlosPalsarModel_H +#define ossimAlosPalsarModel_H + +#include <otb/JSDDateTime.h> +#include <ossimGeometricSarSensorModel.h> + +#include <ossim/projection/ossimMapProjection.h> +#include <ossim/base/ossimIpt.h> +#include <ossim/base/ossimFilename.h> +#include <ossim/base/ossimGpt.h> +#include <ossim/base/ossimDpt.h> + +#include <iostream> + +namespace ossimplugins +{ + +class PlatformPosition; +class SensorParams; +class RefPoint; +class AlosSarLeader; +class AlosSarData; + +/** + * @brief This class is able to direct localisation and indirect localisation using the AlosPalsar sensor model + * + */ +class ossimAlosPalsarModel : public ossimGeometricSarSensorModel +{ +public: + /** + * @brief Constructor + */ + ossimAlosPalsarModel(); + + /** + * @brief Destructor + */ + virtual ~ossimAlosPalsarModel(); + + /** + * @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) + * @param col Column coordinate of the image point + */ + virtual double getSlantRangeFromGeoreferenced(double col) const; + + /** + * @brief Method to instantiate model from the leader 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); + +protected: + virtual bool InitPlatformPosition(const ossimKeywordlist &kwl, const char *prefix); + virtual bool InitSensorParams(const ossimKeywordlist &kwl, const char *prefix); + virtual bool InitRefPoint(const ossimKeywordlist &kwl, const char *prefix); + /** + * @brief Initializes the Slant Range for each Ground Range data sets : theNumberSRGR,theSRGRCoeffset,_srgr_update,thePixelSpacing,_isProductGeoreferenced + */ + virtual bool InitSRGR(const ossimKeywordlist &kwl, const char *prefix); + +private: + /** + * @brief Pixel spacing + */ + double thePixelSpacing; + + /** + * @brief List of metadata contained in the Leader file + */ + AlosSarLeader *theAlosSarLeader; + + /** + * @brief List of metadata contained in the Data file + */ + AlosSarData *theAlosSarData; + + virtual bool isAlosPalsarLeader(const ossimFilename& file) const; + virtual ossimFilename findAlosPalsarLeader(const ossimFilename& file) const; + + virtual bool isAlosPalsarData(const ossimFilename& file) const; + virtual ossimFilename findAlosPalsarData(const ossimFilename& file) const; + + TYPE_DATA + +}; + +} +#endif