33 static ossimTrace traceExec (
"ossimIkonosRpcModel:exec");
34 static ossimTrace traceDebug (
"ossimIkonosRpcModel:debug");
38 static const char* MODEL_TYPE =
"ossimIkonosRpcModel";
39 static const char* META_DATA_FILE =
"meta_data_file";
40 static const char* RPC_DATA_FILE =
"rpc_data_file";
41 static const char* LINE_OFF_KW =
"LINE_OFF";
42 static const char* SAMP_OFF_KW =
"SAMP_OFF";
43 static const char* LAT_OFF_KW =
"LAT_OFF";
44 static const char* LONG_OFF_KW =
"LONG_OFF";
45 static const char* HEIGHT_OFF_KW =
"HEIGHT_OFF";
46 static const char* LINE_SCALE_KW =
"LINE_SCALE";
47 static const char* SAMP_SCALE_KW =
"SAMP_SCALE";
48 static const char* LAT_SCALE_KW =
"LAT_SCALE";
49 static const char* LONG_SCALE_KW =
"LONG_SCALE";
50 static const char* HEIGHT_SCALE_KW =
"HEIGHT_SCALE";
51 static const char* LINE_NUM_COEFF_KW =
"LINE_NUM_COEFF_";
52 static const char* LINE_DEN_COEFF_KW =
"LINE_DEN_COEFF_";
53 static const char* SAMP_NUM_COEFF_KW =
"SAMP_NUM_COEFF_";
54 static const char* SAMP_DEN_COEFF_KW =
"SAMP_DEN_COEFF_";
77 <<
"DEBUG ossimIkonosRpcModel Constructor #1: entering..." 88 if (!value || (strcmp(value,
"ossimIkonosRpcModel")))
93 <<
"DEBUG ossimIkonosRpcModel Constructor #1:" 94 <<
"\nFailed attempt to construct. sensor type \""<<value
95 <<
"\" does not match \"ossimIkonosRpcModel\"." << std::endl;
102 <<
"DEBUG ossimIkonosRpcModel Constructor #1: returning..." 111 value = kwl.
find(META_DATA_FILE);
118 <<
"DEBUG ossimIkonosRpcModel Constructor #1: returning..." 129 value = kwl.
find(RPC_DATA_FILE);
146 geom_file.
split(drivePart,
183 metadata.
split(drivePart,
189 init_rpc_geom.
merge(drivePart,
214 <<
"DEBUG ossimIkonosRpcModel finishConstruction(): entering..." 272 <<
"ossimIkonosRpcModel finishConstruction Caught Exception:\n" 273 << e.
what() << std::endl;
279 <<
"DEBUG ossimIkonosRpcModel finishConstruction(): returning..." 295 <<
"DEBUG ossimIkonosRpcModel::parseMetaData(data_file): entering..." 299 FILE* fptr = fopen (data_file,
"r");
306 <<
"ossimIkonosRpcModel::parseMetaData(data_file) DEBUG:" 307 <<
"\nCould not open Meta data file: " << data_file
308 <<
"\nreturning with error..." << std::endl;
315 char dummy[80], name[80];
326 strptr = strstr(
filebuf,
"\nSource Image ID:");
332 <<
"FATAL ossimIkonosRpcModel::parseMetaData(data_file): " 333 <<
"\n\tAborting construction. Error encountered parsing " 334 <<
"presumed meta-data file." << endl;
342 sscanf(strptr,
"%17c %s", dummy, name);
348 strptr = strstr(strptr,
"\nSensor:");
354 <<
"FATAL ossimIkonosRpcModel::parseMetaData(data_file): " 355 <<
"\n\tAborting construction. Error encountered parsing " 356 <<
"presumed meta-data file." << endl;
362 sscanf(strptr,
"%8c %s", dummy, name);
368 strptr = strstr(strptr,
"\nPixel Size X:");
374 <<
"FATAL ossimIkonosRpcModel::parseMetaData(data_file): " 375 <<
"\n\tAborting construction. Error encountered parsing " 376 <<
"presumed meta-data file." << endl;
384 sscanf(strptr,
"%14c %lf", dummy, &
theGSD.
samp);
385 strptr = strstr(strptr,
"\nPixel Size Y:");
391 <<
"FATAL ossimIkonosRpcModel::parseMetaData(data_file): " 392 <<
"\n\tAborting construction. Error encountered parsing " 393 <<
"presumed meta-data file." << endl;
400 sscanf(strptr,
"%14c %lf", dummy, &
theGSD.
line);
405 strptr = strstr(strptr,
"\nColumns:");
411 <<
"FATAL ossimIkonosRpcModel::parseMetaData(data_file): " 412 <<
"\n\tAborting construction. Error encountered parsing " 413 <<
"presumed meta-data file." << endl;
421 strptr = strstr(strptr,
"\nRows:");
427 <<
"FATAL ossimIkonosRpcModel::parseMetaData(data_file): " 428 <<
"\n\tAborting construction. Error encountered parsing " 429 <<
"presumed meta-data file." << endl;
441 <<
"DEBUG ossimIkonosRpcModel::parseMetaData(data_file): returning..." 459 <<
"DEBUG ossimIkonosRpcModel::parseHdrData(data_file): entering..." 468 <<
"ossimIkonosRpcModel::parseHdrData(data_file) WARN:" 469 <<
"\nrpc data file <" << data_file <<
">. "<<
"doesn't exist..." 475 FILE* fptr = fopen (data_file,
"r");
483 <<
"ossimIkonosRpcModel::parseHdrData(data_file) WARN:" 484 <<
"\nCould not open hdr data file <" << data_file <<
">. " 485 <<
"returning with error..." << std::endl;
504 strptr = strstr(
filebuf,
"\nPixel Size X:");
510 <<
"ossimIkonosRpcModel::parseHdrData(data_file):" 511 <<
"\n\tAborting construction. Error encountered parsing " 512 <<
"presumed hdr file." << endl;
520 sscanf(strptr,
"%14c %lf", dummy, &
theGSD.
samp);
521 strptr = strstr(strptr,
"\nPixel Size Y:");
527 <<
"ossimIkonosRpcModel::parseHdrData(data_file): " 528 <<
"\n\tAborting construction. Error encountered parsing " 529 <<
"presumed hdr file." << endl;
537 sscanf(strptr,
"%14c %lf", dummy, &
theGSD.
line);
542 strptr = strstr(strptr,
"\nColumns:");
548 <<
"ossimIkonosRpcModel::parseHdrData(data_file): " 549 <<
"\n\tAborting construction. Error encountered parsing " 550 <<
"presumed hdr file." << endl;
558 strptr = strstr(strptr,
"\nRows:");
564 <<
"ossimIkonosRpcModel::parseHdrData(data_file): " 565 <<
"\n\tAborting construction. Error encountered parsing " 566 <<
"presumed hdr file." << endl;
581 <<
"DEBUG ossimIkonosRpcModel::parseHdrData(data_file): returning..." 598 <<
"DEBUG ossimIkonosRpcModel::parseRpcData(data_file): entering..." 607 <<
"ossimIkonosRpcModel::parseRpcData(data_file) WARN:" 608 <<
"\nrpc data file <" << data_file <<
">. "<<
"doesn't exist..." 622 <<
"ERROR ossimIkonosRpcModel::parseRpcData(data_file): Could not open RPC data file <" << data_file <<
">. " <<
"Aborting..." << std::endl;
625 <<
"returning with error..." << std::endl;
635 keyword = LINE_OFF_KW;
636 buf = kwl.
find(keyword);
640 <<
"\nAborting construction. Error looking up keyword: " 641 << keyword << std::endl;
646 keyword = SAMP_OFF_KW;
647 buf = kwl.
find(keyword);
651 <<
"\nAborting construction. Error looking up keyword: " 652 << keyword << std::endl;
657 keyword = LAT_OFF_KW;
658 buf = kwl.
find(keyword);
662 <<
"\nAborting construction. Error looking up keyword: " 663 << keyword << std::endl;
669 keyword = LONG_OFF_KW;
670 buf = kwl.
find(keyword);
674 <<
"\nAborting construction. Error looking up keyword: " 675 << keyword << std::endl;
680 keyword = HEIGHT_OFF_KW;
681 buf = kwl.
find(keyword);
685 <<
"\nAborting construction. Error looking up keyword: " 686 << keyword << std::endl;
692 keyword = LINE_SCALE_KW;
693 buf = kwl.
find(keyword);
697 <<
"\nAborting construction. Error looking up keyword: " 698 << keyword << std::endl;
703 keyword = SAMP_SCALE_KW;
704 buf = kwl.
find(keyword);
708 <<
"\nAborting construction. Error looking up keyword: " 709 << keyword << std::endl;
714 keyword = LAT_SCALE_KW;
715 buf = kwl.
find(keyword);
719 <<
"\nAborting construction. Error looking up keyword: " 720 << keyword << std::endl;
732 keyword = LONG_SCALE_KW;
733 buf = kwl.
find(keyword);
737 <<
"\nAborting construction. Error looking up keyword: " 738 << keyword << std::endl;
743 keyword = HEIGHT_SCALE_KW;
744 buf = kwl.
find(keyword);
748 <<
"\nAborting construction. Error looking up keyword: " 749 << keyword << std::endl;
757 for(
int i=1; i<=20; i++)
759 sprintf(kwbuf,
"%s%d", LINE_NUM_COEFF_KW, i);
760 buf = kwl.
find(keyword);
764 <<
"\nAborting construction. Error looking up keyword: " 765 << keyword << std::endl;
771 sprintf(kwbuf,
"%s%d", LINE_DEN_COEFF_KW, i);
772 buf = kwl.
find(keyword);
776 <<
"\nAborting construction. Error looking up keyword: " 777 << keyword << std::endl;
782 sprintf(kwbuf,
"%s%d", SAMP_NUM_COEFF_KW, i);
783 buf = kwl.
find(keyword);
787 <<
"\nAborting construction. Error looking up keyword: " 788 << keyword << std::endl;
793 sprintf(kwbuf,
"%s%d", SAMP_DEN_COEFF_KW, i);
794 buf = kwl.
find(keyword);
798 <<
"\nAborting construction. Error looking up keyword: " 799 << keyword << std::endl;
825 "//**************************************************************\n" 826 "// Template for Ikonos RPC geometry keywordlist\n" 828 "// NOTE: It is preferable to select the full RPC geometry KWL \n" 829 "// that should have been created with the first use of the\n" 830 "// derived model type ossimIkonosRpcModel. Using this KWL \n" 831 "// implies that an initial geometry is being constructed \n" 832 "// with all adjustable parameters initialized to 0. \n" 833 "//**************************************************************\n" 835 os << META_DATA_FILE <<
": <string>\n" 836 << RPC_DATA_FILE <<
": <string>\n" << endl;
843 const char* prefix)
const 891 if ( tiff->
open(filename) )
904 <<
"WARNING: ossimIkonosMetaData::open returned false.\n" 916 rpcfile +=
"_rpc.txt";
936 filename.
split(drivePart,
942 init_rpc_geom.
merge(drivePart,
962 <<
"return status: " << (result?
"true\n":
"false\n")
963 <<
"DEBUG ossimIkonosRpcModel parseTiffFile: returning..." 977 in.read((
char*)nitfFile, 4);
980 nitfFile+4) ==
"NITF");
PolynomialType thePolyType
double theSampNumCoef[20]
ossimFilename noExtension() const
std::basic_filebuf< char > filebuf
Class for char file buffers.
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
saveState Fulfills ossimObject base-class pure virtuals.
Represents serializable keyword/value map.
std::basic_ifstream< char > ifstream
Class for char input file streams.
const char * find(const char *key) const
void split(ossimString &drivePart, ossimString &pathPart, ossimString &filePart, ossimString &extPart) const
virtual void updateModel()
ossim_float64 hgt
Height in meters above the ellipsiod.
ossimRefPtr< ossimIkonosMetaData > theSupportData
static const char * TYPE_KW
virtual ~ossimIkonosRpcModel()
double theSampDenCoef[20]
double theLineNumCoef[20]
bool parseTiffFile(const ossimFilename &filename)
void computeGsd()
This method computes the ground sample distance(gsd) and sets class attributes theGSD and theMeanGSD ...
virtual const char * what() const
Returns the error message.
bool isNitf(const ossimFilename &filename)
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
saveState Fulfills ossimObject base-class pure virtuals.
const ossimFilename INIT_RPC_GEOM_FILENAME("rpc_init.geom")
ossimPolygon theBoundGndPolygon
virtual void lineSampleHeightToWorld(const ossimDpt &image_point, const double &heightEllipsoid, ossimGpt &worldPoint) const
void parseRpcData(const ossimFilename &rpcdata)
ossimErrorCode theErrorStatus
void parseMetaData(const ossimFilename &metadata)
static void writeGeomTemplate(ostream &os)
ossimDrect theImageClipRect
virtual bool parseFile(const ossimFilename &file)
virtual ossimErrorCode getErrorStatus() const
RTTI_DEF1(ossimIkonosRpcModel, "ossimIkonosRpcModel", ossimRpcModel)
virtual bool open(const ossimFilename &image_file)
Returns true if the image_file can be opened and is a valid tiff file.
void merge(const ossimString &drivePart, const ossimString &pathPart, const ossimString &filePart, const ossimString &extPart)
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string's contents...
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
loadState Fulfills ossimObject base-class pure virtuals.
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
loadState Fulfills ossimObject base-class pure virtuals.
double theLineDenCoef[20]
void finishConstruction()
ossimFilename & setExtension(const ossimString &e)
Sets the extension of a file name.
bool parseHdrData(const ossimFilename &data_file)
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
std::basic_ostream< char > ostream
Base class for char output streams.