void ossimNitfFileHeaderV2_0::initializeDisplayLevels(std::istream& in) { // we will need to temporarily save the get pointer since // initializeDisplayLevels changes it. std::streampos saveTheGetPointer = in.tellg(); std::vector<ossimNitfImageOffsetInformation>::iterator imageOffsetList = theImageOffsetList.begin(); // allocate temporary space to store image headers ossimNitfImageHeader* imageHeader = allocateImageHeader(); // clear the list theDisplayInformationList.clear(); theImageRect = ossimDrect(0,0,0,0); if(!imageHeader) { return; } ossim_uint32 idx = 0; while(imageOffsetList != theImageOffsetList.end()) { // position the get pointer in the input // stream to the start of the image header in.seekg((*imageOffsetList).theImageHeaderOffset, std::ios::beg); // get the data imageHeader->parseStream(in); // create a union of rects. The result should be the image rect. ossimDrect tempRect = imageHeader->getImageRect(); if((tempRect.width() > 1) && (tempRect.height() > 1)) { theImageRect = theImageRect.combine(tempRect); } insertIntoDisplayInfoList(ossimNitfDisplayInfo(ossimString("IM"), imageHeader->getDisplayLevel(), idx)); ++imageOffsetList; ++idx; } delete imageHeader; imageHeader = 0; // finally we reset the saved get state back // to its original position in.seekg(saveTheGetPointer, std::ios::beg); }
ossimNitfImageHeader* ossimNitfFileHeaderV2_1::getNewImageHeader(ossim_uint32 imageNumber, std::istream& in)const { ossimNitfImageHeader *result = 0; if( (getNumberOfImages() > 0) && (imageNumber < theImageOffsetList.size()) ) { result = allocateImageHeader(); in.seekg(theImageOffsetList[imageNumber].theImageHeaderOffset, ios::beg); result->parseStream(in); } else { #if 0 ossimNotify(ossimNotifyLevel_FATAL) << "FATAL ossimNitfFileHeaderV2_1::getNewImageHeader: " << "\nNo images in file or image number (" << imageNumber << ") is out of range!\n"; #endif } return result; }