OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Member Functions | Protected Types | Protected Attributes | Static Protected Attributes | Friends | List of all members
ossimplugins::AlosPalsarLeader Class Reference

This class is able to read the Leader file of the AlosPalsar file structure. More...

#include <AlosPalsarLeader.h>

Public Member Functions

 AlosPalsarLeader ()
 Constructor. More...
 
virtual ~AlosPalsarLeader ()
 Destructor. More...
 
 AlosPalsarLeader (const AlosPalsarLeader &rhs)
 Copy constructor. More...
 
AlosPalsarLeaderoperator= (const AlosPalsarLeader &rhs)
 Copy operator. More...
 
void ClearRecords ()
 Remove all the previous records from the AlosPalsarLeader. More...
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 Method to save object state to a keyword list. More...
 
const AlosPalsarFacilityDataget_AlosPalsarFacilityData () const
 
const AlosPalsarRadiometricDataget_AlosPalsarRadiometricData () const
 
const AlosPalsarPlatformPositionDataget_AlosPalsarPlatformPositionData () const
 
const AlosPalsarDataSetSummaryget_AlosPalsarDataSetSummary () const
 
const AlosPalsarFileDescriptorget_AlosPalsarFileDescriptor () const
 

Protected Types

typedef std::map< int, AlosPalsarRecord * > RecordType
 

Protected Attributes

RecordType _records
 

Static Protected Attributes

static const int AlosPalsarFacilityDataID = 17
 
static const int AlosPalsarRadiometricDataID = 5
 
static const int AlosPalsarPlatformPositionDataID = 3
 
static const int AlosPalsarDataSetSummaryID = 2
 
static const int AlosPalsarFileDescriptorID = 1
 

Friends

std::ostream & operator<< (std::ostream &os, const AlosPalsarLeader &data)
 This function write the AlosPalsarLeader in a stream. More...
 
std::istream & operator>> (std::istream &is, AlosPalsarLeader &data)
 This function read a AlosPalsarLeader from a stream. More...
 

Detailed Description

This class is able to read the Leader file of the AlosPalsar file structure.

Definition at line 41 of file AlosPalsarLeader.h.

Member Typedef Documentation

◆ RecordType

Definition at line 98 of file AlosPalsarLeader.h.

Constructor & Destructor Documentation

◆ AlosPalsarLeader() [1/2]

ossimplugins::AlosPalsarLeader::AlosPalsarLeader ( )

Constructor.

Definition at line 38 of file AlosPalsarLeader.cpp.

39 {
40 }

◆ ~AlosPalsarLeader()

ossimplugins::AlosPalsarLeader::~AlosPalsarLeader ( )
virtual

Destructor.

Definition at line 42 of file AlosPalsarLeader.cpp.

References ClearRecords().

43 {
44  ClearRecords();
45 }
void ClearRecords()
Remove all the previous records from the AlosPalsarLeader.

◆ AlosPalsarLeader() [2/2]

ossimplugins::AlosPalsarLeader::AlosPalsarLeader ( const AlosPalsarLeader rhs)

Copy constructor.

Definition at line 97 of file AlosPalsarLeader.cpp.

References _records.

98 {
99  std::map<int, AlosPalsarRecord*>::const_iterator it = rhs._records.begin();
100  while (it != rhs._records.end())
101  {
102  _records[(*it).first] = (*it).second->Clone();
103  ++it;
104  }
105 }

Member Function Documentation

◆ ClearRecords()

void ossimplugins::AlosPalsarLeader::ClearRecords ( )

Remove all the previous records from the AlosPalsarLeader.

Definition at line 120 of file AlosPalsarLeader.cpp.

References _records.

Referenced by operator=(), ossimplugins::operator>>(), and ~AlosPalsarLeader().

121 {
122  std::map<int, AlosPalsarRecord*>::const_iterator it = _records.begin();
123  while (it != _records.end())
124  {
125  delete(*it).second;
126  ++it;
127  }
128  _records.clear();
129 }

◆ get_AlosPalsarDataSetSummary()

const AlosPalsarDataSetSummary * ossimplugins::AlosPalsarLeader::get_AlosPalsarDataSetSummary ( ) const

Definition at line 316 of file AlosPalsarLeader.cpp.

References _records, and AlosPalsarDataSetSummaryID.

Referenced by saveState().

317 {
318  return dynamic_cast<const AlosPalsarDataSetSummary*>(_records.find(AlosPalsarDataSetSummaryID)->second);
319 }
static const int AlosPalsarDataSetSummaryID

◆ get_AlosPalsarFacilityData()

const AlosPalsarFacilityData * ossimplugins::AlosPalsarLeader::get_AlosPalsarFacilityData ( ) const

Definition at line 289 of file AlosPalsarLeader.cpp.

References _records, and AlosPalsarFacilityDataID.

290 {
291 // return const_cast<const AlosPalsarFacilityData*>(dynamic_cast<AlosPalsarFacilityData*>(_records[AlosPalsarFacilityDataID]));
292 // RecordType::const_iterator it = _records.find(AlosPalsarFacilityDataID)->second;
293 // return dynamic_cast<const AlosPalsarFacilityData*>(it.find(AlosPalsarFacilityDataID));
294  return dynamic_cast<const AlosPalsarFacilityData*>(_records.find(AlosPalsarFacilityDataID)->second);
295 }
static const int AlosPalsarFacilityDataID

◆ get_AlosPalsarFileDescriptor()

const AlosPalsarFileDescriptor * ossimplugins::AlosPalsarLeader::get_AlosPalsarFileDescriptor ( ) const

Definition at line 321 of file AlosPalsarLeader.cpp.

References _records, and AlosPalsarFileDescriptorID.

Referenced by saveState().

322 {
323  return dynamic_cast<const AlosPalsarFileDescriptor*>(_records.find(AlosPalsarFileDescriptorID)->second);
324 }
static const int AlosPalsarFileDescriptorID

◆ get_AlosPalsarPlatformPositionData()

const AlosPalsarPlatformPositionData * ossimplugins::AlosPalsarLeader::get_AlosPalsarPlatformPositionData ( ) const

Definition at line 302 of file AlosPalsarLeader.cpp.

References _records, and AlosPalsarPlatformPositionDataID.

Referenced by saveState().

303 {
304  return dynamic_cast<const AlosPalsarPlatformPositionData*>(_records.find(AlosPalsarPlatformPositionDataID)->second);
305 }
static const int AlosPalsarPlatformPositionDataID

◆ get_AlosPalsarRadiometricData()

const AlosPalsarRadiometricData * ossimplugins::AlosPalsarLeader::get_AlosPalsarRadiometricData ( ) const

Definition at line 297 of file AlosPalsarLeader.cpp.

References _records, and AlosPalsarRadiometricDataID.

Referenced by saveState().

298 {
299  return dynamic_cast<const AlosPalsarRadiometricData*>(_records.find(AlosPalsarRadiometricDataID)->second);
300 }
static const int AlosPalsarRadiometricDataID

◆ operator=()

AlosPalsarLeader & ossimplugins::AlosPalsarLeader::operator= ( const AlosPalsarLeader rhs)

Copy operator.

Definition at line 107 of file AlosPalsarLeader.cpp.

References _records, and ClearRecords().

108 {
109  ClearRecords();
110  std::map<int, AlosPalsarRecord*>::const_iterator it = rhs._records.begin();
111  while (it != rhs._records.end())
112  {
113  _records[(*it).first] = (*it).second->Clone();
114  ++it;
115  }
116 
117  return *this;
118 }
void ClearRecords()
Remove all the previous records from the AlosPalsarLeader.

◆ saveState()

bool ossimplugins::AlosPalsarLeader::saveState ( ossimKeywordlist kwl,
const char *  prefix = 0 
) const
virtual

Method to save object state to a keyword list.

Parameters
kwlKeyword list to save to.
prefixadded to keys when saved.
Returns
true on success, false on error.

Definition at line 131 of file AlosPalsarLeader.cpp.

References ossimKeywordlist::add(), get_AlosPalsarDataSetSummary(), get_AlosPalsarFileDescriptor(), get_AlosPalsarPlatformPositionData(), get_AlosPalsarRadiometricData(), ossimplugins::AlosPalsarDataSetSummary::get_alt_dopcen(), ossimplugins::AlosPalsarRadiometricData::get_calibration_factor(), ossimplugins::AlosPalsarDataSetSummary::get_crt_dopcen(), ossimplugins::AlosPalsarPlatformPositionData::get_data_int(), ossimplugins::AlosPalsarPlatformPositionData::get_day(), ossimplugins::AlosPalsarDataSetSummary::get_dopcen_range(), ossimplugins::AlosPalsarDataSetSummary::get_ellip_maj(), ossimplugins::AlosPalsarDataSetSummary::get_ellip_min(), ossimplugins::AlosPalsarDataSetSummary::get_fa(), ossimplugins::AlosPalsarFileDescriptor::get_file_name(), ossimplugins::AlosPalsarDataSetSummary::get_fr(), ossimplugins::AlosPalsarPlatformPositionData::get_gmt_day(), ossimplugins::AlosPalsarPlatformPositionData::get_gmt_sec(), ossimplugins::AlosPalsarPlatformPositionData::get_hr_angle(), ossimplugins::AlosPalsarDataSetSummary::get_inp_sctim(), ossimplugins::AlosPalsarDataSetSummary::get_line_spacing(), ossimplugins::AlosPalsarPlatformPositionData::get_month(), ossimplugins::AlosPalsarDataSetSummary::get_n_azilok(), ossimplugins::AlosPalsarDataSetSummary::get_n_rnglok(), ossimplugins::AlosPalsarPlatformPositionData::get_ndata(), ossimplugins::AlosPalsarDataSetSummary::get_pix_spacing(), ossimplugins::AlosPalsarPlatformPositionData::get_pos_vect(), ossimplugins::AlosPalsarDataSetSummary::get_sc_lin(), ossimplugins::AlosPalsarDataSetSummary::get_sc_pix(), ossimplugins::AlosPalsarDataSetSummary::get_time_dir_lin(), ossimplugins::AlosPalsarDataSetSummary::get_time_dir_pix(), ossimplugins::AlosPalsarDataSetSummary::get_wave_length(), ossimplugins::AlosPalsarPlatformPositionData::get_year(), ossimNotify(), and ossimNotifyLevel_DEBUG.

Referenced by ossimplugins::ossimAlosPalsarModel::saveState().

133 {
134 
135  static const char MODULE[] = "AlosPalsarLeader::saveState";
136 
137  if (traceDebug())
138  {
139  ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " entered...\n";
140  }
141 
142  bool result = true;
143 
144  char name[64];
145 
146  //kwl.add(prefix, ossimKeywordNames::TYPE_KW, "ossimAlosPalsarModel", true);
147  /*
148  * Adding metadata necessary to the sensor model in the keywordlist
149  */
150  const AlosPalsarFileDescriptor *leaderfiledesc = get_AlosPalsarFileDescriptor();
151  if (leaderfiledesc != NULL)
152  {
153  kwl.add(prefix, "filename", leaderfiledesc->get_file_name().c_str(), true);
154  }
155  else
156  {
157  result = false;
158  }
159 
160  /*
161  * Adding metadata necessary to the sensor model in the keywordlist
162  */
163  const AlosPalsarDataSetSummary *datasetSummary = get_AlosPalsarDataSetSummary();
164  if ((datasetSummary != NULL) && (result == true))
165  {
166  kwl.add(prefix, "inp_sctim", (datasetSummary->get_inp_sctim()).c_str(), true);
167  kwl.add(prefix, "ellip_maj", datasetSummary->get_ellip_maj(), true);
168  kwl.add(prefix, "ellip_min", datasetSummary->get_ellip_min(), true);
169  kwl.add(prefix, "sc_lin", datasetSummary->get_sc_lin(), true);
170  kwl.add(prefix, "sc_pix", datasetSummary->get_sc_pix(), true);
171  kwl.add(prefix, "wave_length", datasetSummary->get_wave_length(), true);
172  kwl.add(prefix, "fr", datasetSummary->get_fr(), true);
173  kwl.add(prefix, "fa", datasetSummary->get_fa(), true);
174  kwl.add(prefix, "time_dir_pix", (datasetSummary->get_time_dir_pix()).c_str(), true);
175  kwl.add(prefix, "time_dir_lin", (datasetSummary->get_time_dir_lin()).c_str(), true);
176  kwl.add(prefix, "line_spacing", datasetSummary->get_line_spacing(), true);
177  kwl.add(prefix, "pix_spacing", datasetSummary->get_pix_spacing(), true);
178  kwl.add(prefix, "nlooks_az", datasetSummary->get_n_azilok(), true);
179  kwl.add(prefix, "n_rnglok", datasetSummary->get_n_rnglok(), true);
180  kwl.add(prefix, "alt_dopcen[0]", datasetSummary->get_alt_dopcen()[0], true);
181  kwl.add(prefix, "crt_dopcen[0]", datasetSummary->get_crt_dopcen()[0], true);
182  kwl.add(prefix, "crt_dopcen[1]", datasetSummary->get_crt_dopcen()[1], true);
183  kwl.add(prefix, "dopcen_range[0]", datasetSummary->get_dopcen_range()[0], true);
184  kwl.add(prefix, "dopcen_range[1]", datasetSummary->get_dopcen_range()[1], true);
185  //FIXME check if those data are available
186 // kwl.add(prefix, "zero_dop_range_time_f_pixel", datasetSummary->get_zero_dop_range_time_f_pixel(),true);
187 // kwl.add(prefix, "zero_dop_range_time_c_pixel", datasetSummary->get_zero_dop_range_time_c_pixel(),true);
188 // kwl.add(prefix, "zero_dop_range_time_l_pixel", datasetSummary->get_zero_dop_range_time_l_pixel(),true);
189  }
190  else
191  {
192  result = false;
193  }
194 
195  // FIXME do not handle Alos map projection information for now...
196 // const AlosPalsarMapProjectionData *mapprojectiondata = get_AlosPalsarMapProjectionData();
197 // if ( (mapprojectiondata != NULL) && (result == true) )
198 // {
199 // kwl.add(prefix, "map_proj_des",(mapprojectiondata->get_map_proj_des()).c_str(),true);
200 // kwl.add(prefix, "num_lines",(double) mapprojectiondata->get_num_lines(),true);
201 // kwl.add(prefix, "num_pix",(double) mapprojectiondata->get_num_pix_in_line(),true);
202 // kwl.add(prefix, "first_line_first_pixel_lat",mapprojectiondata->get_first_line_first_pixel_lat(), true);
203 // kwl.add(prefix, "first_line_first_pixel_lon",mapprojectiondata->get_first_line_first_pixel_lon(), true);
204 // kwl.add(prefix, "first_line_last_pixel_lat",mapprojectiondata->get_first_line_last_pixel_lat(), true);
205 // kwl.add(prefix, "first_line_last_pixel_lon",mapprojectiondata->get_first_line_last_pixel_lon(), true);
206 // kwl.add(prefix, "last_line_first_pixel_lat",mapprojectiondata->get_last_line_first_pixel_lat(), true);
207 // kwl.add(prefix, "last_line_first_pixel_lon",mapprojectiondata->get_last_line_first_pixel_lon(), true);
208 // kwl.add(prefix, "last_line_last_pixel_lat",mapprojectiondata->get_last_line_last_pixel_lat(), true);
209 // kwl.add(prefix, "last_line_last_pixel_lon",mapprojectiondata->get_last_line_last_pixel_lon(), true);
210 // }
211 // else
212 // {
213 // result = false;
214 // }
215 
216  const AlosPalsarPlatformPositionData *platformposition = get_AlosPalsarPlatformPositionData();
217  if ((platformposition != NULL) && (result == true))
218  {
219  kwl.add(prefix, "neph", platformposition->get_ndata(), true);
220  kwl.add(prefix, "eph_year", platformposition->get_year(), true);
221  kwl.add(prefix, "eph_month", platformposition->get_month(), true);
222  kwl.add(prefix, "eph_day", platformposition->get_day(), true);
223  kwl.add(prefix, "eph_gmt_day", platformposition->get_gmt_day(), true);
224  kwl.add(prefix, "eph_sec", platformposition->get_gmt_sec(), true);
225  kwl.add(prefix, "eph_hr_angle", platformposition->get_hr_angle(), true);
226  kwl.add(prefix, "eph_int", platformposition->get_data_int(), true);
227 
228  for (int i = 0; i < platformposition->get_ndata(); i++)
229  {
230  sprintf(name, "eph%i_posX", i);
231  kwl.add(prefix, name, (platformposition->get_pos_vect()[i]).get_pos()[0], true);
232  sprintf(name, "eph%i_posY", i);
233  kwl.add(prefix, name, (platformposition->get_pos_vect()[i]).get_pos()[1], true);
234  sprintf(name, "eph%i_posZ", i);
235  kwl.add(prefix, name, (platformposition->get_pos_vect()[i]).get_pos()[2], true);
236 
237  sprintf(name, "eph%i_velX", i);
238  kwl.add(prefix, name, (platformposition->get_pos_vect()[i]).get_vel()[0], true);
239  sprintf(name, "eph%i_velY", i);
240  kwl.add(prefix, name, (platformposition->get_pos_vect()[i]).get_vel()[1], true);
241  sprintf(name, "eph%i_velZ", i);
242  kwl.add(prefix, name, (platformposition->get_pos_vect()[i]).get_vel()[2], true);
243  }
244  }
245  else
246  {
247  result = false;
248  }
249 
250  const AlosPalsarRadiometricData *radiometricdata = get_AlosPalsarRadiometricData();
251  if ((radiometricdata != NULL) && (result == true))
252  {
253  kwl.add(prefix, "calibration_factor", radiometricdata->get_calibration_factor(), true);
254  }
255  else
256  {
257  result = false;
258  }
259 
260  // FIXME Do not handle Palsar facility-related data for now...
261  // The current code corresponds to the ERS facility-related data
262  // which is completely different from that for PALSAR
263  /*
264  const AlosPalsarFacilityData *facilitydata = get_AlosPalsarFacilityData();
265  if ((facilitydata != NULL) && (result == true))
266  {
267  kwl.add(prefix, "coef_ground_range_1", facilitydata->get_coef_ground_range_1(), true);
268  kwl.add(prefix, "coef_ground_range_2", facilitydata->get_coef_ground_range_2(), true);
269  kwl.add(prefix, "coef_ground_range_3", facilitydata->get_coef_ground_range_3(), true);
270  kwl.add(prefix, "coef_ground_range_4", facilitydata->get_coef_ground_range_4(), true);
271  }
272  else
273  {
274  result = false;
275  }
276  */
277 
278  if (traceDebug())
279  {
281  << MODULE << " exit status = " << (result ? "true" : "false\n")
282  << std::endl;
283  }
284 
285 
286  return result;
287 }
const AlosPalsarDataSetSummary * get_AlosPalsarDataSetSummary() const
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
const AlosPalsarRadiometricData * get_AlosPalsarRadiometricData() const
const AlosPalsarPlatformPositionData * get_AlosPalsarPlatformPositionData() const
const AlosPalsarFileDescriptor * get_AlosPalsarFileDescriptor() const
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const AlosPalsarLeader data 
)
friend

This function write the AlosPalsarLeader in a stream.

Definition at line 47 of file AlosPalsarLeader.cpp.

48 {
49  std::map<int, AlosPalsarRecord*>::const_iterator it = data._records.begin();
50  while (it != data._records.end())
51  {
52  (*it).second->Write(os);
53  ++it;
54  }
55  return os;
56 
57 }

◆ operator>>

std::istream& operator>> ( std::istream &  is,
AlosPalsarLeader data 
)
friend

This function read a AlosPalsarLeader from a stream.

Definition at line 59 of file AlosPalsarLeader.cpp.

60 {
61  AlosPalsarLeaderFactory factory;
62 
63  data.ClearRecords();
64 
65  AlosPalsarRecordHeader header;
66  bool eof = false;
67  while (!eof)
68  {
69  is >> header;
70  if (is.eof())
71  {
72  eof = true;
73  }
74  else
75  {
76  AlosPalsarRecord* record = factory.Instanciate(header.get_rec_seq());
77  if (record != NULL)
78  {
79  record->Read(is);
80  data._records[header.get_rec_seq()] = record;
81  }
82  else
83  {
84  if (header.get_length() > 12)
85  {
86  char* buff = new char[header.get_length()-12];
87  is.read(buff, header.get_length() - 12);
88  delete [] buff;
89  }
90  }
91  }
92  }
93  return is;
94 }

Member Data Documentation

◆ _records

RecordType ossimplugins::AlosPalsarLeader::_records
protected

◆ AlosPalsarDataSetSummaryID

const int ossimplugins::AlosPalsarLeader::AlosPalsarDataSetSummaryID = 2
staticprotected

Definition at line 105 of file AlosPalsarLeader.h.

Referenced by get_AlosPalsarDataSetSummary().

◆ AlosPalsarFacilityDataID

const int ossimplugins::AlosPalsarLeader::AlosPalsarFacilityDataID = 17
staticprotected

Definition at line 101 of file AlosPalsarLeader.h.

Referenced by get_AlosPalsarFacilityData().

◆ AlosPalsarFileDescriptorID

const int ossimplugins::AlosPalsarLeader::AlosPalsarFileDescriptorID = 1
staticprotected

Definition at line 106 of file AlosPalsarLeader.h.

Referenced by get_AlosPalsarFileDescriptor().

◆ AlosPalsarPlatformPositionDataID

const int ossimplugins::AlosPalsarLeader::AlosPalsarPlatformPositionDataID = 3
staticprotected

Definition at line 103 of file AlosPalsarLeader.h.

Referenced by get_AlosPalsarPlatformPositionData().

◆ AlosPalsarRadiometricDataID

const int ossimplugins::AlosPalsarLeader::AlosPalsarRadiometricDataID = 5
staticprotected

Definition at line 102 of file AlosPalsarLeader.h.

Referenced by get_AlosPalsarRadiometricData().


The documentation for this class was generated from the following files: