bool ossimNitfFile::saveState(ossimKeywordlist& kwl, const ossimString& prefix)const { bool result = theNitfFileHeader.valid(); if(theNitfFileHeader.valid()) { theNitfFileHeader->saveState(kwl, prefix); } ossim_int32 n = theNitfFileHeader->getNumberOfImages(); for(ossim_int32 idx = 0; idx < n; ++idx) { ossimRefPtr<ossimNitfImageHeader> ih = getNewImageHeader(idx); ossimString newPrefix = prefix + "image" + ossimString::toString(idx) + "."; #if 1 ih->saveState(kwl, newPrefix); #else if ( (ih->getCategory().trim(ossimString(" ")) != "CLOUD") || (ih->getRepresentation().trim(ossimString(" ")) != "NODISPLY") ) { ih->saveState(kwl, newPrefix); } #endif } return result; }
std::ostream& ossimNitfFile::print(std::ostream& out, const std::string& prefix, bool printOverviews) const { if(theNitfFileHeader.valid()) { std::string pfx = prefix; pfx += "nitf."; theNitfFileHeader->print(out, pfx); ossim_int32 n = theNitfFileHeader->getNumberOfImages(); for(ossim_int32 idx = 0; idx < n; ++idx) { ossimNitfImageHeader* ih = getNewImageHeader(idx); if(ih) { bool printIt = true; if ( !printOverviews ) { // Check the IMAG field. ossim_float64 imag; ih->getDecimationFactor(imag); if ( !ossim::isnan(imag) ) { if ( imag < 1.0) { printIt = false; } } //--- // Now see if it's a cloud mask image. Do not print // cloud mask images if the printOverviews is false. //--- if ( printIt ) { if ( (ih->getCategory().trim(ossimString(" ")) == "CLOUD") && (ih->getRepresentation().trim(ossimString(" ")) == "NODISPLY") ) { printIt = false; } } } if (printIt) { // Add our prefix onto prefix. std::string s = pfx; s += "image"; s += ossimString::toString(idx); s += "."; ih->print(out, s); } delete ih; ih = 0; } } //--- // Check for RPF stuff: //--- ossimNitfTagInformation info; theNitfFileHeader->getTag(info, "RPFHDR"); if(info.getTagName() == "RPFHDR") { // Open of the a.toc. ossimRpfToc* toc = new ossimRpfToc; if ( toc->parseFile(getFilename()) == ossimErrorCodes::OSSIM_OK ) { pfx += "rpf."; toc->print(out, pfx, printOverviews); } delete toc; toc = 0; } } // matches: if(theNitfFileHeader.valid()) return out; }