OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Leader.cpp
Go to the documentation of this file.
1 //----------------------------------------------------------------------------
2 //
3 // "Copyright Centre National d'Etudes Spatiales"
4 //
5 // License: LGPL
6 //
7 // See LICENSE.txt file in the top level directory for more details.
8 //
9 //----------------------------------------------------------------------------
10 // $Id$
11 
12 #include <RadarSat/Leader/Leader.h>
15 
18 
27 
28 
29 namespace ossimplugins
30 {
31 
32 const int Leader::RadiometricDataID = 9;
34 const int Leader::AttitudeDataID = 8;
35 const int Leader::PlatformPositionDataID = 7;
36 const int Leader::ProcessingParametersID = 6;
39 const int Leader::DataQualityID = 3;
40 const int Leader::DataSetSummaryID = 2;
41 const int Leader::FileDescriptorID = 1;
42 
44 {
45 }
46 
48 {
49  ClearRecords();
50 }
51 
53 {
54  std::map<int, RadarSatRecord*>::const_iterator it = data._records.begin();
55  while(it != data._records.end())
56  {
57  (*it).second->Write(os);
58  ++it;
59  }
60  return os;
61 
62 }
63 
65 {
66  LeaderFactory factory;
67 
68  data.ClearRecords();
69 
70  RadarSatRecordHeader header;
71  bool eof = false;
72  while(!eof)
73  {
74  is>>header;
75  if(is.eof())
76  {
77  eof = true;
78  }
79  else
80  {
81  RadarSatRecord* record;
82  if ( (header.get_rec_seq() == 2) && (header.get_length() == 8960) )
83  {
84  record = factory.Instanciate(header.get_rec_seq() + 5); // case of SCN, SCW
85  if (record != NULL)
86  {
87  record->Read(is);
88  data._records[header.get_rec_seq() + 5] = record;
89  }
90  else
91  {
92  char* buff = new char[header.get_length()-12];
93  is.read(buff, header.get_length()-12);
94  delete[] buff;
95  }
96  }
97  else
98  {
99  record = factory.Instanciate(header.get_rec_seq());
100  if (record != NULL)
101  {
102  record->Read(is);
103  data._records[header.get_rec_seq()] = record;
104  }
105  else
106  {
107  char* buff = new char[header.get_length()-12];
108  is.read(buff, header.get_length()-12);
109  delete[] buff;
110  }
111  }
112  }
113  }
114  return is;
115 }
116 
118 {
119  std::map<int, RadarSatRecord*>::const_iterator it = rhs._records.begin();
120  while(it != rhs._records.end())
121  {
122  _records[(*it).first] = (*it).second->Clone();
123  ++it;
124  }
125 }
126 
128 {
129  ClearRecords();
130  std::map<int, RadarSatRecord*>::const_iterator it = rhs._records.begin();
131  while(it != rhs._records.end())
132  {
133  _records[(*it).first] = (*it).second->Clone();
134  ++it;
135  }
136 
137  return *this;
138 }
139 
141 {
142  std::map<int, RadarSatRecord*>::const_iterator it = _records.begin();
143  while(it != _records.end())
144  {
145  delete (*it).second;
146  ++it;
147  }
148  _records.clear();
149 }
150 
152 {
154 }
155 
157 {
159 }
160 
162 {
164 }
165 
167 {
169 }
170 
172 {
174 }
175 
177 {
179 }
180 
182 {
184 }
185 
187 {
189 }
190 
192 {
194 }
195 
197 {
199 }
200 }
This class is able to read the SAR leader file descriptor record of the leader file.
static const int RadiometricDataID
Definition: Leader.h:94
This class is able to read a data histogram record - Processed data.
FileDescriptor * get_FileDescriptor()
Definition: Leader.cpp:196
RadarSatRecord * Instanciate(int id)
Instanciates a new Record.
~Leader()
Destructor.
Definition: Leader.cpp:47
static const int DataHistogramSignalDataID
Definition: Leader.h:100
This class is able to read a data quality record.
Definition: DataQuality.h:29
DataHistogramProcessedData * get_DataHistogramProcessedData()
Definition: Leader.cpp:176
static const int AttitudeDataID
Definition: Leader.h:96
This class is able to read a Platform position data record.
Leader()
Constructor.
Definition: Leader.cpp:43
static const int DataQualityID
Definition: Leader.h:101
static const int RadiometricCompensationDataID
Definition: Leader.h:95
This class is the base class of all the record classes.
virtual void Read(std::istream &is)=0
Reads the class data from a stream.
This class is able to read a data histogram record - Signal data.
Leader & operator=(const Leader &rhs)
Copy operator.
Definition: Leader.cpp:127
std::ostream & operator<<(std::ostream &os, const AlosPalsarData &data)
static const int ProcessingParametersID
Definition: Leader.h:98
PlatformPositionData * get_PlatformPositionData()
Definition: Leader.cpp:166
This class is able to read a radiometric data record.
This class is a factory able to construct Record base classes.
Definition: LeaderFactory.h:25
This class is able to read a Radiometric Compensation data record.
DataQuality * get_DataQuality()
Definition: Leader.cpp:186
std::istream & operator>>(std::istream &is, AlosPalsarData &data)
AttitudeData * get_AttitudeData()
Definition: Leader.cpp:161
static const int DataHistogramProcessedDataID
Definition: Leader.h:99
ProcessingParameters * get_ProcessingParameters()
Definition: Leader.cpp:171
This class is able to read a Detailed processing parameters record.
std::basic_istream< char > istream
Base class for char input streams.
Definition: ossimIosFwd.h:20
static const int DataSetSummaryID
Definition: Leader.h:102
DataHistogramSignalData * get_DataHistogramSignalData()
Definition: Leader.cpp:181
This class is able to read the SAR leader data set summary record of the leader file.
static const int FileDescriptorID
Definition: Leader.h:103
This class is able to read a record header.
DataSetSummary * get_DataSetSummary()
Definition: Leader.cpp:191
void ClearRecords()
Removes all the previous records from the Leader.
Definition: Leader.cpp:140
RadiometricCompensationData * get_RadiometricCompensationData()
Definition: Leader.cpp:156
static const int PlatformPositionDataID
Definition: Leader.h:97
This class is able to read a Attitude data record.
Definition: AttitudeData.h:28
RadiometricData * get_RadiometricData()
Definition: Leader.cpp:151
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23
std::map< int, RadarSatRecord * > _records
Definition: Leader.h:92
This class is able to read the leader file of the RadarSat file structure.
Definition: Leader.h:43