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::AlosPalsarData Class Reference

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

#include <AlosPalsarData.h>

Public Member Functions

 AlosPalsarData ()
 Constructor. More...
 
virtual ~AlosPalsarData ()
 Destructor. More...
 
 AlosPalsarData (const AlosPalsarData &rhs)
 Copy constructor. More...
 
AlosPalsarDataoperator= (const AlosPalsarData &rhs)
 Copy operator. More...
 
void ClearRecords ()
 Remove all the previous records from the AlosPalsarData. More...
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 Method to save object state to a keyword list. More...
 
const AlosPalsarDataFileDescriptorget_AlosPalsarDataFileDescriptor () const
 
const AlosPalsarSignalDataget_AlosPalsarSignalData () const
 

Protected Types

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

Protected Attributes

RecordType _records
 

Static Protected Attributes

static const int AlosPalsarDataFileDescriptorID = 1
 
static const int AlosPalsarSignalDataID = 2
 

Friends

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

Detailed Description

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

Definition at line 32 of file AlosPalsarData.h.

Member Typedef Documentation

◆ RecordType

Definition at line 85 of file AlosPalsarData.h.

Constructor & Destructor Documentation

◆ AlosPalsarData() [1/2]

ossimplugins::AlosPalsarData::AlosPalsarData ( )

Constructor.

Definition at line 32 of file AlosPalsarData.cpp.

33 {
34 
35 }

◆ ~AlosPalsarData()

ossimplugins::AlosPalsarData::~AlosPalsarData ( )
virtual

Destructor.

Definition at line 37 of file AlosPalsarData.cpp.

References ClearRecords().

38 {
39  ClearRecords();
40 }
void ClearRecords()
Remove all the previous records from the AlosPalsarData.

◆ AlosPalsarData() [2/2]

ossimplugins::AlosPalsarData::AlosPalsarData ( const AlosPalsarData rhs)

Copy constructor.

Definition at line 97 of file AlosPalsarData.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::AlosPalsarData::ClearRecords ( )

Remove all the previous records from the AlosPalsarData.

Definition at line 120 of file AlosPalsarData.cpp.

References _records.

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

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_AlosPalsarDataFileDescriptor()

const AlosPalsarDataFileDescriptor * ossimplugins::AlosPalsarData::get_AlosPalsarDataFileDescriptor ( ) const

Definition at line 175 of file AlosPalsarData.cpp.

References _records, and AlosPalsarDataFileDescriptorID.

Referenced by saveState().

176 {
177  return dynamic_cast<const AlosPalsarDataFileDescriptor*>(_records.find(AlosPalsarDataFileDescriptorID)->second);
178 }
static const int AlosPalsarDataFileDescriptorID

◆ get_AlosPalsarSignalData()

const AlosPalsarSignalData * ossimplugins::AlosPalsarData::get_AlosPalsarSignalData ( ) const

Definition at line 180 of file AlosPalsarData.cpp.

References _records, and AlosPalsarSignalDataID.

Referenced by saveState().

181 {
182  // TODO: Check if _records[AlosPalsarSignalDataID] works
183  return dynamic_cast<const AlosPalsarSignalData*>(_records.find(AlosPalsarSignalDataID)->second);
184 }
static const int AlosPalsarSignalDataID

◆ operator=()

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

Copy operator.

Definition at line 107 of file AlosPalsarData.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 AlosPalsarData.

◆ saveState()

bool ossimplugins::AlosPalsarData::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 AlosPalsarData.cpp.

References ossimKeywordlist::add(), get_AlosPalsarDataFileDescriptor(), get_AlosPalsarSignalData(), ossimplugins::AlosPalsarDataFileDescriptor::get_num_lines(), ossimplugins::AlosPalsarDataFileDescriptor::get_num_pix_in_line(), ossimplugins::AlosPalsarSignalData::get_pulse_repetition_frequency(), ossimplugins::AlosPalsarSignalData::get_slant_range_to_1st_data_sample(), ossimNotify(), and ossimNotifyLevel_DEBUG.

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

133 {
134 
135  static const char MODULE[] = "AlosPalsarData::saveState";
136 
137  if (traceDebug())
138  {
139  ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " entered...\n";
140  }
141 
142  bool result = true;
143 
144  /*
145  * Adding metadata necessary to the sensor model in the keywordlist
146  */
147  const AlosPalsarDataFileDescriptor *datafiledesc = get_AlosPalsarDataFileDescriptor();
148  if (datafiledesc != NULL)
149  {
150  kwl.add(prefix, "num_lines", datafiledesc->get_num_lines(), true);
151  kwl.add(prefix, "num_pix_in_line", datafiledesc->get_num_pix_in_line(), true);
152  }
153  else
154  {
155  result = false;
156  }
157 
158  const AlosPalsarSignalData *signalData = get_AlosPalsarSignalData();
159  if (datafiledesc != NULL)
160  {
161  kwl.add(prefix, "pulse_repetition_frequency", signalData->get_pulse_repetition_frequency(), true);
162  // slant range to 1st data sample in metres
163  kwl.add(prefix, "slant_range_to_1st_data_sample", signalData->get_slant_range_to_1st_data_sample(), true);
164  }
165  else
166  {
167  result = false;
168  }
169 
170 
171  return result;
172 }
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
const AlosPalsarDataFileDescriptor * get_AlosPalsarDataFileDescriptor() const
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
const AlosPalsarSignalData * get_AlosPalsarSignalData() const

Friends And Related Function Documentation

◆ operator<<

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

This function write the AlosPalsarData in a stream.

Definition at line 42 of file AlosPalsarData.cpp.

43 {
44  std::map<int, AlosPalsarRecord*>::const_iterator it = data._records.begin();
45  while (it != data._records.end())
46  {
47  (*it).second->Write(os);
48  ++it;
49  }
50  return os;
51 
52 }

◆ operator>>

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

This function read a AlosPalsarData from a stream.

Definition at line 54 of file AlosPalsarData.cpp.

55 {
56 
57  data.ClearRecords();
58 
59  AlosPalsarRecordHeader header;
60 
61  is >> header;
62 
63  AlosPalsarRecord* record = new AlosPalsarDataFileDescriptor;
64  if (record != NULL)
65  {
66  record->Read(is);
67  data._records[header.get_rec_seq()] = record;
68  }
69  else
70  {
71  char* buff = new char[header.get_length()-12];
72  is.read(buff, header.get_length() - 12);
73  delete [] buff;
74  }
75 
76  std::streampos filePosition;
77 
78  filePosition = is.tellg();
79  is >> header;
80 
81  record = new AlosPalsarSignalData;
82 
83  if (record != NULL)
84  {
85  record->Read(is);
86  data._records[header.get_rec_seq()] = record;
87 // std::cout << "Record sequence number = " << header.get_rec_seq() << std::endl;
88  }
89  is.seekg(filePosition); // Rewind file pointer to start of record
90  // Then, advance pointer to next record
91  is.seekg(static_cast<std::streamoff>(header.get_length()), std::ios::cur);
92 
93  return is;
94 }

Member Data Documentation

◆ _records

RecordType ossimplugins::AlosPalsarData::_records
protected

◆ AlosPalsarDataFileDescriptorID

const int ossimplugins::AlosPalsarData::AlosPalsarDataFileDescriptorID = 1
staticprotected

Definition at line 89 of file AlosPalsarData.h.

Referenced by get_AlosPalsarDataFileDescriptor().

◆ AlosPalsarSignalDataID

const int ossimplugins::AlosPalsarData::AlosPalsarSignalDataID = 2
staticprotected

Definition at line 90 of file AlosPalsarData.h.

Referenced by get_AlosPalsarSignalData().


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