39 static const char NUMBER_SRGR_COEFFICIENTS_KW[] =
"sr_gr_coeffs_count";
40 static const char LOAD_FROM_PRODUCT_FILE_KW[] =
"load_from_product_file_flag";
41 static const char PRODUCT_XML_FILE_KW[] =
"product_xml_filename";
44 static ossimTrace traceDebug(
"ossimRadarSat2Model:debug");
46 RTTI_DEF1(ossimRadarSat2Model,
"ossimRadarSat2Model", ossimGeometricSarSensorModel);
62 _srgr_update(rhs._srgr_update),
63 _SrGr_R0(rhs._SrGr_R0)
85 double relativeGroundRange, slantRange = 0.0 ;
98 <<
"\n(col-_refPoint->get_pix_col()) " 101 <<
"\n relativeGroundRange : " << relativeGroundRange << endl;
109 for (
int i=0 ; i < static_cast<int>(
_SrGr_coeffs[numSet].size()); i++)
112 slantRange +=
_SrGr_coeffs[numSet][i]*pow(relativeGroundRange,i) ;
120 static const char MODULE[] =
"ossimRadarSat2Model::open";
145 <<
"product xml file: " << xmlFile <<
"\n";
166 <<
"isRadarSat2...\n";
171 <<
"beam_mode_mnemonic: " << s <<
"\n";
176 <<
"acquisition_type: " << s <<
"\n";
273 <<
"ul, ur, lr, ll " << ul <<
", " << ur
274 <<
", " << lr <<
" , " << ll << endl;
287 << MODULE <<
" exit status = " << (result?
"true":
"false\n")
297 std::ios_base::fmtflags f = out.flags();
299 out << setprecision(15) << setiosflags(ios::fixed)
300 <<
"\nossimRadarSat2Model class data members:\n" 301 <<
"_n_srgr: " <<
_n_srgr <<
"\n";
304 std::vector<double>::const_iterator i =
_srgr_update.begin();
307 out <<
"sr_gr_update_" << idx <<
": " << (*i) <<
"\n";
316 out <<
"sr_gr_r0_" << idx <<
": " << (*i) <<
"\n";
322 std::vector< std::vector<double> >::const_iterator i2 =
328 while ( i != (*i2).end() )
330 out <<
"sr_gr_coeffs_" << idx <<
"_" << idx2 <<
": " << (*i) <<
"\n";
352 const char* central_freq_str = kwl.
find(prefix,
"central_freq");
353 double central_freq = atof(central_freq_str);
354 const char* fr_str = kwl.
find(prefix,
"fr");
355 double fr = atof(fr_str);
356 const char* fa_str = kwl.
find(prefix,
"fa");
357 double fa = atof(fa_str);
360 const char* n_azilok_str = kwl.
find(prefix,
"n_azilok");
361 double n_azilok = atof(n_azilok_str);
362 const char* n_rnglok_str = kwl.
find(prefix,
"n_rnglok");
363 double n_rnglok = atof(n_rnglok_str);
366 const char* ellip_maj_str = kwl.
find(prefix,
"ellip_maj");
367 double ellip_maj = atof(ellip_maj_str) * 1000.0;
368 const char* ellip_min_str = kwl.
find(prefix,
"ellip_min");
369 double ellip_min = atof(ellip_min_str) * 1000.0;
378 const char* lineTimeOrdering_str = kwl.
find(prefix,
"lineTimeOrdering");
379 std::string lineTimeOrdering(lineTimeOrdering_str) ;
380 const char* pixelTimeOrdering_str = kwl.
find(prefix,
"pixelTimeOrdering");
381 std::string pixelTimeOrdering(pixelTimeOrdering_str) ;
387 const char* lookDirection_str = kwl.
find(prefix,
"lookDirection");
388 std::string lookDirection(lookDirection_str) ;
393 const double CLUM = 2.99792458e+8 ;
394 double wave_length = CLUM / central_freq ;
413 const char* neph_str = kwl.
find(prefix,
"neph");
414 int neph = atoi(neph_str);
417 for (
int i = 0; i < neph; ++i)
425 for (
int i=0;i<neph;i++)
432 sprintf(name,
"eph%i_date",i);
433 const char* date_str = kwl.
find(prefix,name);
435 sprintf(name,
"eph%i_posX",i);
436 const char* px_str = kwl.
find(prefix,name);
437 pos[0] = atof(px_str);
439 sprintf(name,
"eph%i_posY",i);
440 const char* py_str = kwl.
find(prefix,name);
441 pos[1] = atof(py_str);
443 sprintf(name,
"eph%i_posZ",i);
444 const char* pz_str = kwl.
find(prefix,name);
445 pos[2] = atof(pz_str);
448 sprintf(name,
"eph%i_velX",i);
449 const char* vx_str = kwl.
find(prefix,name);
450 vit[0] = atof(vx_str) ;
452 sprintf(name,
"eph%i_velY",i);
453 const char* vy_str = kwl.
find(prefix,name);
454 vit[1] = atof(vy_str) ;
456 sprintf(name,
"eph%i_velZ",i);
457 const char* vz_str = kwl.
find(prefix,name);
458 vit[2] = atof(vz_str) ;
463 std::string utcString(date_str);
497 for (
int i=0;i<neph;i++)
511 const char* nbCol_str = kwl.
find(prefix,
"nbCol");
512 const char* nbLin_str = kwl.
find(prefix,
"nbLin");
527 const char* zeroDopplerTimeFirstLine_str = kwl.
find(prefix,
"zeroDopplerTimeFirstLine");
528 std::string zeroDopplerTimeFirstLine(zeroDopplerTimeFirstLine_str);
543 if (ephemeris == 0)
return false ;
556 const char* slantRangeNearEdge_str = kwl.
find(prefix,
"slantRangeNearEdge");
557 double distance = atof(slantRangeNearEdge_str);
581 std::list<ossimGpt> groundGcpCoordinates ;
582 std::list<ossimDpt> imageGcpCoordinates ;
583 const char* nTiePoints_str = kwl.
find(prefix,
"nTiePoints");
584 int nTiePoints = atoi(nTiePoints_str);
586 for (
int k=0 ; k<nTiePoints ; k++) {
587 sprintf(name,
"cornersCol%i",k);
588 const char* i_str = kwl.
find(name);
590 sprintf(name,
"cornersLin%i",k);
591 const char* j_str = kwl.
find(name);
593 sprintf(name,
"cornersLon%i",k);
594 const char* lon_str = kwl.
find(name);
595 double lon = atof(lon_str);
596 sprintf(name,
"cornersLat%i",k);
597 const char* lat_str = kwl.
find(name);
598 double lat = atof(lat_str);
599 sprintf(name,
"cornersHeight%i",k);
600 const char* height_str = kwl.
find(name);
601 double height = atof(height_str);
604 ossimGpt groundGCP(lat ,lon , height);
605 groundGcpCoordinates.push_back(groundGCP) ;
606 imageGcpCoordinates.push_back(imageGCP) ;
618 const char* productType_str = kwl.
find(prefix,
"productType");
632 const char* SrGr_coeffs_number_str = kwl.
find(prefix,
"SrGr_coeffs_number");
633 _n_srgr = atoi(SrGr_coeffs_number_str);
639 std::vector<double> srgr_set ;
642 sprintf(name,
"SrGr_coeffs_%i_%i",i,j);
643 const char* coeff_str = kwl.
find(prefix,name);
644 double coeff = atof(coeff_str);
645 srgr_set.push_back(coeff);
649 sprintf(name,
"SrGr_R0_%i",i);
650 const char* SrGr_R0_str = kwl.
find(prefix,name);
651 _SrGr_R0.push_back(atof(SrGr_R0_str));
653 sprintf(name,
"SrGr_update_%i",i);
654 const char* SrGr_update_str = kwl.
find(prefix,name);
674 double min_delay = delays[0] ;
677 if (delays[i]<min_delay) {
679 min_delay = delays[i] ;
688 static const char MODULE[] =
"ossimRadarSat2Model::initSRGR";
710 "/product/imageGenerationParameters/slantRangeToGroundRange";
711 std::vector<ossimRefPtr<ossimXmlNode> > xnodes;
719 _n_srgr =
static_cast<int>(xnodes.size());
723 if (xnodes[i].valid())
747 std::vector<ossimString> vs;
749 std::vector<double> vd;
752 vd.push_back(vs[idx].toDouble());
763 << MODULE <<
" exit status = " << (result?
"true":
"false\n")
773 static const char MODULE[] =
"ossimRadarSat2Model::initPlatformPosition";
799 << MODULE <<
" exit status = " << (result?
"true":
"false\n")
809 static const char MODULE[] =
"ossimRadarSat2Model::initSensorParams";
833 << MODULE <<
" exit status = " << (result?
"true":
"false\n")
844 static const char MODULE[] =
"ossimRadarSat2Model::initRefPoint";
856 << MODULE <<
"null pointer error! exiting\n";
869 std::list<ossimGpt> groundGcpCoordinates;
870 std::list<ossimDpt> imageGcpCoordinates;
872 groundGcpCoordinates,
873 imageGcpCoordinates) == false )
878 << MODULE <<
"initTiePoint error! exiting\n";
905 << MODULE <<
"getZeroDopplerTimeFirstLine error! exiting\n";
937 << MODULE <<
" Interpolate error! exiting\n";
956 << MODULE <<
"getSlantRangeNearEdge error! exiting\n";
990 << MODULE <<
" exit status = true\n";
1000 static const char MODULE[] =
"ossimRadarSat2Model::initLut";
1008 std::vector<ossimRefPtr<ossimXmlNode> > xml_nodes;
1009 std::vector<ossimRefPtr<ossimXmlNode> >::iterator node;
1014 xpath =
"/product/imageAttributes/lookupTable";
1016 xmlDocument->
findNodes(xpath, xml_nodes);
1017 if(xml_nodes.size() == 0)
1023 << MODULE <<
" DEBUG:" 1024 <<
"\nCould not find: " << xpath
1030 node = xml_nodes.
begin();
1031 while (node != xml_nodes.end())
1033 if( (*node)->getAttributeValue(
"incidenceAngleCorrection") == incidenceAngleCorrectionName )
1038 if ( lutXmlFile.
exists() )
1044 if ( xmlLutDocument->
openFile(lutXmlFile) )
1046 std::vector<ossimRefPtr<ossimXmlNode> > xml_lutNodes;
1049 xpath =
"/lut/offset";
1050 xml_lutNodes.
clear();
1051 xmlLutDocument->
findNodes(xpath, xml_lutNodes);
1052 if(xml_lutNodes.size() == 0)
1058 << MODULE <<
" DEBUG:" 1059 <<
"\nCould not find: " << xpath
1067 xpath =
"/lut/gains";
1068 xml_lutNodes.
clear();
1069 xmlLutDocument->
findNodes(xpath, xml_lutNodes);
1070 if(xml_lutNodes.size() == 0)
1076 << MODULE <<
" DEBUG:" 1077 <<
"\nCould not find: " << xpath
1082 noise.
set_gain(xml_lutNodes[0]->getText());
1100 static const char MODULE[] =
"ossimRadarSat2Model::initRefNoiseLevel";
1103 std::vector<ossimRefPtr<ossimXmlNode> > xml_nodes;
1104 std::vector<ossimRefPtr<ossimXmlNode> > sub_nodes;
1105 std::vector<ossimRefPtr<ossimXmlNode> >::iterator node;
1116 xpath =
"/product/sourceAttributes/radarParameters/referenceNoiseLevel";
1118 xmlDocument->
findNodes(xpath, xml_nodes);
1119 if(xml_nodes.size() == 0)
1125 << MODULE <<
" DEBUG:" 1126 <<
"\nCould not find: " << xpath
1132 node = xml_nodes.
begin();
1133 while (node != xml_nodes.end())
1139 xpath =
"pixelFirstNoiseValue";
1140 (*node)->findChildNodes(xpath, sub_nodes);
1141 if (sub_nodes.size() == 0)
1147 << MODULE <<
" DEBUG:" 1148 <<
"\nCould not find: " << xpath
1157 (*node)->findChildNodes(xpath, sub_nodes);
1158 if (sub_nodes.size() == 0)
1164 << MODULE <<
" DEBUG:" 1165 <<
"\nCould not find: " << xpath
1173 xpath =
"numberOfNoiseLevelValues";
1174 (*node)->findChildNodes(xpath, sub_nodes);
1175 if (sub_nodes.size() == 0)
1181 << MODULE <<
" DEBUG:" 1182 <<
"\nCould not find: " << xpath
1190 xpath =
"noiseLevelValues";
1191 (*node)->findChildNodes(xpath, sub_nodes);
1192 if (sub_nodes.size() == 0)
1198 << MODULE <<
" DEBUG:" 1199 <<
"\nCould not find: " << xpath
1204 ev.
set_units( sub_nodes[0]->getAttributeValue(
"units") );
1207 std::vector<ossimString> s2;
1208 std::vector<ossim_float64> noiseLevelValues;
1210 noiseLevelValues.clear();
1211 s2 = sub_nodes[0]->getText().split(
" ");
1214 noiseLevelValues.push_back( s2[i].toFloat64() );
1238 const char* prefix)
const 1240 static const char MODULE[] =
"ossimRadarSat2Model::saveState";
1251 kwl.
add(prefix, NUMBER_SRGR_COEFFICIENTS_KW,
_n_srgr);
1318 << MODULE <<
" exit status = " << (result?
"true":
"false\n")
1328 static const char MODULE[] =
"ossimRadarSat2Model::loadState";
1335 const char* lookup = 0;
1350 lookup = kwl.
find(prefix, PRODUCT_XML_FILE_KW);
1356 lookup = kwl.
find(prefix, LOAD_FROM_PRODUCT_FILE_KW);
1380 lookup = kwl.
find(prefix, NUMBER_SRGR_COEFFICIENTS_KW);
1392 <<
"\nRequired keyword not found: " 1393 << NUMBER_SRGR_COEFFICIENTS_KW <<
"\n";
1419 lookup = kwl.
find(prefix, kw);
1431 <<
"\nRequired keyword not found: " 1440 lookup = kwl.
find(prefix, kw);
1452 <<
"\nRequired keyword not found: " 1472 lookup = kwl.
find(prefix, kw);
1484 <<
"\nRequired keyword not found: " 1512 << MODULE <<
" exit status = " << (result?
"true":
"false\n")
1520 const std::list<ossimGpt>& groundGcpCoordinates,
1521 const std::list<ossimDpt>& imageGcpCoordinates)
1523 static const char MODULE[] =
"ossimRadarSat2Model::setModelRefPoint";
1529 bool result =
false;
1532 (groundGcpCoordinates.size() == imageGcpCoordinates.size()) )
1538 std::list<ossimGpt>::const_iterator gi = groundGcpCoordinates.begin();
1539 std::list<ossimDpt>::const_iterator di = imageGcpCoordinates.begin();
1550 while( gi != groundGcpCoordinates.end() )
1557 if ( (deltaX <= deltaX2) && (deltaY <= deltaY2) )
1564 if ( (deltaX <= THRESHOLD) && (deltaY <= THRESHOLD) )
1586 << MODULE <<
" exit status = " << (result?
"true":
"false\n")
bool getZeroDopplerTimeFirstLine(const ossimXmlDocument *xdoc, ossimString &s) const
This class represent an ephemeris in Geographic coordinates system.
void clear()
Erases the entire container.
bool initPlatformPosition(const ossimXmlDocument *xdoc, const ossimRadarSat2ProductDoc &rsDoc)
ossimFilename _productXmlFile
bool open(const ossimFilename &file)
Method to intantial model from a file.
void set_sightDirection(SightDirection sight)
This class represents a date and time in the civil format.
bool createReplacementOCG()
Creates replacement coarse grid model if user requested via ossim preferences keyword "geometric_sar_...
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of the object from a keyword list.
static const ossimFilename NIL
This was taken from Wx widgets for performing touch and access date stamps.
RTTI_DEF1(ossimAlosPalsarModel, "ossimAlosPalsarModel", ossimGeometricSarSensorModel)
Represents serializable keyword/value map.
Ephemeris * get_ephemeris()
const char * find(const char *key) const
ossimFilename expand() const
Method to do file name expansion.
bool initSensorParams(const ossimXmlDocument *xdoc, const ossimRadarSat2ProductDoc &rsDoc)
std::vector< RadarSat2NoiseLevel > _noiseLevel
noise level values
const ossimDpt & ul() const
This class handles the referential point.
virtual bool InitSensorParams(const ossimKeywordlist &kwl, const char *prefix)
Initializes the Sensor Params from a projection keywordlist.
double get_distance() const
void set_lin_direction(int dir)
const ossimString & get_incidenceAngleCorrectionName() const
static ossimString toString(bool aValue)
Numeric to string methods.
virtual bool InitLut(const ossimXmlDocument *xmlDocument, RadarSat2NoiseLevel &noise)
int FindSRGRSetNumber(JSDDateTime date) const
Finds the SRGR data set which update time is the closest to the center scene time.
void set_incidenceAngleCorrectionName(const ossimString &value)
bool initTiePoints(const ossimXmlDocument *xdoc, std::list< ossimGpt > &gcp, std::list< ossimDpt > &icp) const
Method to initialize image tie points from RadarSat "product.xml" file.
Class to encapsulate parsing RadarSat2 product.xml file.
void split(std::vector< ossimString > &result, const ossimString &separatorList, bool skipBlankFields=false) const
Splits this string into a vector of strings (fields) using the delimiter list specified.
void set_second(int second)
bool getSatellite(const ossimXmlDocument *xdoc, ossimString &s) const
bool iso8601TimeStringToCivilDate(const std::string &dataString, CivilDateTime &outputDate)
Converts date string from ISO 8601 format to CivilDateTime.
This class handles the sensor parameters.
const ossimRefPtr< ossimXmlNode > & findFirstNode(const ossimString &rel_xpath) const
void set_pix_line(double pix_line)
static const char * TYPE_KW
void set_offset(const ossim_float64 &value)
ossimFilename _imageFilename
void set_pix_col(double pix_col)
bool _isProductGeoreferenced
True iff the product is ground range.
void set_semiMinorAxis(double value)
int get_lin_direction() const
This class allows for direct localisation and indirect localisation using the geometric model of SAR ...
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
virtual ossimObject * dup() const
Returns pointer to a new instance, copy of this.
ossimDpt theSubImageOffset
void add(const ossimFilename &f)
Add support data filename to the list:
const ossimString & getText() const
This class represents an ephemeris.
bool getAcquisitionType(const ossimXmlDocument *xdoc, ossimString &s) const
/product/sourceAttributes/radarParameters/acquisitionType
void set_decimal(double decimal)
bool isRadarSat2(const ossimXmlDocument *xdoc) const
Checks for node /product/sourceAttributes/satellite containing RADARSAT-2.
int _n_srgr
Slant Range FOR EACH Ground Range (SRGR) number of coefficients sets.
bool openFile(const ossimFilename &filename)
bool initSensorParams(const ossimXmlDocument *xdoc, SensorParams *sp) const
Method to initialize SensorParams object from RadarSat "product.xml" file.
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of the object from a keyword list.
void set_pixelFirstNoiseValue(const ossim_uint32 &value)
bool toBool() const
String to numeric methods.
std::string::iterator begin()
bool initGsd(const ossimXmlDocument *xdoc, ossimDpt &gsd) const
Method to initialize gsd from RadarSat "product.xml" file.
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save object state to a keyword list.
unsigned int ossim_uint32
ossimPolygon theBoundGndPolygon
virtual bool InitPlatformPosition(const ossimKeywordlist &kwl, const char *prefix)
Initializes the Platform Position from a projection keywordlist.
ossim_float64 toFloat64() const
void set_semiMajorAxis(double value)
virtual bool InitRefPoint(const ossimKeywordlist &kwl, const char *prefix)
Initializes the Reference Point from a projection keywordlist.
std::vector< double > _SrGr_R0
Slant Range FOR EACH Ground Range Projection reference point.
double get_second() const
virtual double getSlantRangeFromGeoreferenced(double col) const
This function associates an image column number to a slant range when the image is georeferenced (gro...
void set_gain(const ossimString &value)
static ossimString downcase(const ossimString &aString)
void set_numberOfNoiseLevelValues(const ossim_uint32 &value)
double get_pix_col() const
This class represents an Noise.
void set_nRangeLook(double look)
ossimRadarSat2Model()
default constructor
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save object state to a keyword list.
virtual bool InitSRGR(const ossimKeywordlist &kwl, const char *prefix)
Initializes the Slant Range to Ground Range data sets : _srgr_update,_SrGr_R0,_SrGr_coeffs_number,_SrGr_coeffs,_nbCol, _pixel_spacing.
int get_col_direction() const
void set_noiseLevelValues(const std::vector< ossim_float64 > &value)
virtual std::ostream & print(std::ostream &out) const
ossimDrect theImageClipRect
PlatformPosition * _platformPosition
Handle the position of the platform.
bool getBeamModeMnemonic(const ossimXmlDocument *xdoc, ossimString &s) const
/product/sourceAttributes/beamModeMnemonic
virtual std::ostream & print(std::ostream &out) const
bool getSlantRangeNearEdge(const ossimXmlDocument *xdoc, ossimString &s) const
bool getProductType(const ossimXmlDocument *xdoc, ossimString &s) const
bool initImageSize(const ossimXmlDocument *xdoc, ossimIpt &imageSize) const
Method to initialize image size from RadarSat "product.xml" file.
double get_decimal() const
This class allows for direct localisation and indirect localisation using the RadarSat2 sensor model...
void setGroundRect(const ossimGpt &ul, const ossimGpt &ur, const ossimGpt &lr, const ossimGpt &ll)
virtual void setErrorStatus() const
const ossimDpt & ur() const
bool initPlatformPosition(const ossimXmlDocument *xdoc, PlatformPosition *pos) const
Method to initialize PlatformPosition object from RadarSat "product.xml" file.
bool initSRGR(const ossimXmlDocument *xdoc, const ossimRadarSat2ProductDoc &rsDoc)
virtual void lineSampleToWorld(const ossimDpt &image_point, ossimGpt &gpt) const
ossimFilename dirCat(const ossimFilename &file) const
void set_units(const ossimString &value)
bool initRefPoint(const ossimXmlDocument *xdoc, const ossimRadarSat2ProductDoc &rsDoc)
Method to initialize RefPoint object from RadarSat "product.xml" file.
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string's contents...
std::vector< double > _srgr_update
Slant Range FOR EACH Ground Range coefficient sets update times.
void set_nAzimuthLook(double look)
virtual ~ossimRadarSat2Model()
Destructor.
virtual bool optimizeModel(const std::list< ossimGpt > &groundCoordinates, const std::list< ossimDpt > &imageCoordinates)
This function optimizes the model according to a list of Ground Control Points.
const ossimDpt & ll() const
static ossimSupportFilesList * instance()
std::vector< std::vector< double > > _SrGr_coeffs
Slant Range FOR EACH Ground Range Projection coefficients.
void findNodes(const ossimString &xpath, std::vector< ossimRefPtr< ossimXmlNode > > &nodelist) const
Appends any matching nodes to the list supplied (should be empty):
virtual ossimString getClassName() const
Method to return the class name.
void set_ephemeris(Ephemeris *ephemeris)
void set_col_direction(int dir)
bool setModelRefPoint(const std::list< ossimGpt > &groundGcpCoordinates, const std::list< ossimDpt > &imageGcpCoordinates)
Sets ossimSensorModel members theRefImgPt and theRefGndPt from tie points.
This class represents a date.
float distance(double lat1, double lon1, double lat2, double lon2, int units)
const ossimDpt & lr() const
void set_distance(double distance)
virtual bool InitRefNoiseLevel(const ossimXmlDocument *xmlDocument)
ossimFilename path() const
bool getImageId(const ossimXmlDocument *xdoc, ossimString &s) const
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
std::basic_ostream< char > ostream
Base class for char output streams.
void set_stepSize(const ossim_uint32 &value)