42 #ifdef OSSIM_ID_ENABLED 43 static const char OSSIM_ID[] =
"$Id: ossimCibCadrgTileSource.cpp 23021 2014-12-04 20:57:16Z dburken $";
53 theCompressedBuffer(0),
54 theUncompressedBuffer(0),
56 theNumberOfSamples(0),
58 theTableOfContents(0),
60 theEntryNumberToRender(1),
61 theProductType(OSSIM_PRODUCT_TYPE_UNKNOWN),
63 theSkipEmptyCheck(false)
68 <<
"ossimCibCadrgTileSource::ossimCibCadrgTileSource entered...\n";
69 #ifdef OSSIM_ID_ENABLED 71 <<
"OSSIM_ID: " << OSSIM_ID <<
"\n";
136 <<
"ossimCibCadrgTileSource::open(): Entered....." 156 if(scaleList.size() > 0)
158 std::vector<ossim_uint32> entryList;
160 if(entryList.size() > 0)
225 <<
"ossimCibCadrgTileSource::open(): Leaving at line " << __LINE__
226 <<
" result=" << (result?
"true":
"false") << std::endl;
311 if(frames.size() > 0)
379 if (reduced_res_level == 0)
393 if (reduced_res_level == 0)
478 for(scaleIdx = 0; scaleIdx < scaleList.size(); ++scaleIdx)
482 for(entryIdx = 0; entryIdx < eList.size(); ++entryIdx)
484 entryList.push_back(eList[entryIdx]);
556 if (reduced_res_level == 0)
572 vector<ossimString> result;
578 for(
ossim_int32 index = 0; index < upperBound; ++index)
591 if( ( std::find(scale.
begin(), scale.
end(),
':') != scale.
end() )
593 (scale[scale.
size()-1]==
'M'))
597 if(find(result.begin(), result.end(), scale) == result.end())
609 <<
"ossimCibCadrgTileSource::getProductScaleList DEBUG:" 612 std::vector<ossimString>::const_iterator i = result.begin();
614 while (i != result.end())
617 <<
"scale[" << index <<
"]: " << (*i) << endl;
628 vector<ossim_int32> result;
634 for(
ossim_int32 index = 0; index < upperBound; ++index)
646 if( bIsEmpty ==
false )
650 if(scale==productScale)
662 <<
"ossimCibCadrgTileSource::getProductEntryList DEBUG:" 665 std::vector<ossim_int32>::const_iterator i = result.begin();
667 while (i != result.end())
670 <<
"scale[" << index <<
"]: " << (*i) << endl;
682 vector<ossimFrameEntryData> result;
685 if(!
isOpen())
return result;
699 for(
ossim_int32 row = frameRect.ul().y; row <= frameRect.lr().y; ++row)
701 for(
ossim_int32 col = frameRect.ul().x; col <= frameRect.lr().x; ++col)
707 if(tempEntry.exists())
725 const vector<ossimFrameEntryData>& framesInvolved,
730 idx < framesInvolved.size();
775 if(!compressionSection)
780 const vector<ossimRpfColorGrayscaleTable>& colorTable =
786 int numTables = (int)colorTable.size();
787 if ( numTables <= 0 )
796 tempRows[2] = (tempRows[1] + 256*256);
810 tempDelta.x + clipRect.
width()-1,
811 tempDelta.y + clipRect.
height()-1);
817 ossimIrect subFrameRect(offsetRect.ul().x/256,
818 offsetRect.ul().y/256,
819 (offsetRect.lr().x)/256,
820 (offsetRect.lr().y)/256);
832 for(row = lowerY; row <= upperY; ++row)
834 for(col = lowerX; col <= upperX; ++col)
839 for (i = 0; i < 256; i += 4)
841 for (j = 0; j < 256; j += 8)
854 ossim_uint16 val1 = (firstByte << 4) | (secondByte >> 4);
857 ossim_uint16 val2 = ((secondByte & 0x000F) << 8) | thirdByte;
868 const ossim_uint8* color1 = colorTable[0].getStartOfData(tableVal1);
869 const ossim_uint8* color2 = colorTable[0].getStartOfData(tableVal2);
872 tempRows[0][pixindex] = color1[0];
873 tempRows[1][pixindex] = color1[1];
874 tempRows[2][pixindex] = color1[2];
876 tempRows[0][pixindex+4] = color2[0];
877 tempRows[1][pixindex+4] = color2[1];
878 tempRows[2][pixindex+4] = color2[2];
891 frameRect.
ul().
y + tempRow,
892 frameRect.
ul().
x + tempCol + 255,
893 frameRect.
ul().
y + tempRow + 255);
920 if(!compressionSection)
925 const vector<ossimRpfColorGrayscaleTable>& colorTable =
931 int numTables = (int)colorTable.size();
932 if ( numTables <= 0 )
955 tempDelta.x + clipRect.
width()-1,
956 tempDelta.y + clipRect.
height()-1);
962 ossimIrect subFrameRect(offsetRect.ul().x/256,
963 offsetRect.ul().y/256,
964 (offsetRect.lr().x)/256,
965 (offsetRect.lr().y)/256);
972 for(row = subFrameRect.ul().y; row <= subFrameRect.lr().y; ++row)
974 for(col = subFrameRect.ul().x; col <= subFrameRect.lr().x; ++col)
979 for (i = 0; i < 256; i += 4)
981 for (j = 0; j < 256; j += 8)
994 ossim_uint16 val1 = (firstByte << 4) | (secondByte >> 4);
997 ossim_uint16 val2 = ((secondByte & 0x000F) << 8) | thirdByte;
1007 const ossim_uint8* color1 = colorTable[0].getStartOfData(tableVal1);
1008 const ossim_uint8* color2 = colorTable[0].getStartOfData(tableVal2);
1011 tempRow[pixindex] = color1[0];
1012 tempRow[pixindex + 4] = color2[0];
1025 frameRect.
ul().
y + tRow,
1026 frameRect.
ul().
x + tCol + 255,
1027 frameRect.
ul().
y + tRow + 255);
1080 vector<ossim_int32> indexProducts;
1082 if(products.size() > 0)
1086 if(indexProducts.size()>0)
1109 const char* prefix)
const 1124 const char* MODULE =
"ossimCibCadrgTileSource::loadState";
1128 CLOG <<
"Entering..." << endl;
1136 CLOG <<
"Leaving..." << endl;
1140 const char* lookup = 0;
1150 CLOG <<
"Leaving..." << endl;
1214 if(name ==
"file_type")
1232 propertyNames.push_back(
"file_type");
1259 for(wi = 0; ((wi < w)&&(!found)); ++wi)
1261 for(hi = 0; ((hi < h)&&(!found)); ++hi)
1275 const vector<ossimRpfColorGrayscaleTable>& colorTable =
1281 int numTables = (int)colorTable.size();
1283 ossim_uint32 numElements = (numTables > 0) ? colorTable[0].getNumberOfElements() : 0;
1300 for(idx = 0; idx < numElements;++idx)
1302 const ossim_uint8* startOfData = colorTable[0].getStartOfData(idx);
1340 for(wi = 0; ((wi < w)&&(!found)); ++wi)
1342 for(hi = 0; ((hi < h)&&(!found)); ++hi)
virtual bool open()=0
Pure virtual open.
void clear()
Erases the entire container.
ossimString getProductScale() const
virtual bool isSourceEnabled() const
virtual ossim_uint32 getNumberOfOutputBands() const
This method allows one to query the number of output bands.
const ossimRpfTocEntry * findFirstFrame()
This will search each entry in the table and look for a certain entry.
ossimRefPtr< ossimImageGeometry > theGeometry
ossim_int32 LUT_ENTRY_TYPE
ossim_uint32 getNumberOfEntries() const
static ossimString upcase(const ossimString &aString)
ossim_uint32 theNumberOfLines
This will be computed based on the frames organized within the directory.
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to load the state of an object from a keyword list.
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
Gets a property for matching name.
virtual ossim_uint32 getNumberOfBands() const
ossimFilename theImageFile
virtual void setImageRectangle(const ossimIrect &rect)
vector< ossimString > getProductScaleList() const
This retrieves all product scales that are within the Table of contents.
void allocateForProduct()
Will allocate an internal buffer for the given product.
const std::vector< ossimRpfCompressionOffsetTableData > & getTable() const
Represents serializable keyword/value map.
virtual ossim_uint32 getImageTileWidth() const
Returns the tile width of the image or 0 if the image is not tiled.
static const ossimErrorCode OSSIM_OK
std::basic_ifstream< char > ifstream
Class for char input file streams.
const char * find(const char *key) const
std::vector< ossimDpt > theDecimationFactors
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from a keyword list.
ossimRpfToc * theTableOfContents
Will own a table of contents.
virtual ossim_uint32 getNumberOfLines(ossim_uint32 resLevel=0) const =0
Pure virtual, derived classes must implement.
ossimString getProductType() const
virtual ossim_uint32 getTileHeight() const
Returns the height of the output tile.
void fillTile(const ossimIrect &tileRect, const vector< ossimFrameEntryData > &framesInvolved, ossimImageData *tile)
This is a wrapper for the fill cib and fill cadrg.
ossim_uint32 getNumberOfFramesVertical() const
ossimCibCadrgTileSource()
Default constructor.
ossim_uint32 height() const
ossim_uint32 getNumberOfSamples() const
ossimString getScale() const
virtual ossimScalarType getOutputScalarType() const
This method allows you to query the scalar type of the output data.
ossimRefPtr< ossimImageGeometry > getImageGeometry() const
Returns the image geometry object associated with this tile source or NULL if non defined...
void fillSubTileCib(const ossimRpfFrame &aFrame, const ossimIrect &tileRect, const ossimFrameEntryData &frameEntryData, ossimImageData *tile)
Will uncompress the CIB file using a VQ decompression algorithm.
virtual void setTocEntryToRender(const ossimRpfTocEntry *entry)
Sets the entry to be renderer.
const ossimIpt & ul() const
virtual ossimDataObjectStatus getDataObjectStatus() const
ossimString getSecurityClassification() const
void updatePropertiesToFirstValidFrame()
const ossimRpfCoverageSection & getCoverage() const
bool intersects(const ossimIrect &rect) const
const ossimRpfHeader * getRpfHeader() const
unsigned short ossim_uint16
unsigned char * theCompressedBuffer
This is for storage of a single compressed buffer.
bool theSkipEmptyCheck
If true during the call to open(), the RPF file is opened even if all the frame files are missing...
Protected structure that is only used internally by this class.
const ossimRpfBoundaryRectRecord & getBoundaryInformation() const
virtual void getEntryList(std::vector< ossim_uint32 > &entryList) const
virtual ossim_uint32 getCurrentEntry() const
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save the state of an object to a keyword list.
std::string::iterator end()
virtual void initialize()
Initialize the data buffer.
virtual const ossimRpfTocEntry * getCurrentTocEntry() const
virtual bool setEntryToRender(ossim_uint32 index)
Sets the entry to render.
virtual bool isValidRLevel(ossim_uint32 resLevel) const
Determines if the passed in reslution level is valid.
virtual ossimString getLongName() const
This method is defined in the base class ossimObject.
ossim_int32 toInt32() const
virtual bool setCurrentEntry(ossim_uint32 entryIdx)
bool isOpen() const
Determines if its open if there eists a table of contents object.
void push_back(char c)
Equivalent to insert(end(), c).
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const
const vector< ossimRpfColorGrayscaleTable > & getColorGrayscaleTable() const
const ossimRpfTocEntry * theEntryToRender
This is the actual frame file to render.
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
virtual void loadTile(const void *src, const ossimIrect &src_rect, ossimInterleaveType il_type)
virtual bool open()
Pure virtual open.
virtual bool getOverviewTile(ossim_uint32 resLevel, ossimImageData *result)
Method to get an overview tile.
static ossimImageDataFactory * instance()
unsigned char * theUncompressedBuffer
This is used as a buffer to uncompress the data to.
static const ossim_uint32 CIBCADRG_FRAME_HEIGHT
CONSTANT representing the height of a Frame.
bool fillSubFrameBuffer(ossim_uint8 *buffer, ossim_uint32 spectralGroup, ossim_uint32 row, ossim_uint32 col) const
virtual ossimIrect getImageRectangle(ossim_uint32 reduced_res_level=0) const
virtual ossimDataObjectStatus validate() const
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const
Gets a list of property names available.
std::string::size_type size() const
bool isGeographicRectNull() const
virtual ossim_uint32 getImageTileHeight() const
Returns the tile width of the image or 0 if the image is not tiled.
vector< ossimFrameEntryData > getIntersectingEntries(const ossimIrect &rect)
It is important to note that each frame is organized into an easting northing type orientation...
std::string::iterator begin()
unsigned int ossim_uint32
ossimRpfFrame * theWorkFrame
ossimString trim(const ossimString &valueToTrim=ossimString(" \\)) const
this will strip lead and trailing character passed in.
ossimCibCadrgProductType theProductType
Holds the enumeration specifying the product type.
virtual ossim_uint32 getNumberOfInputBands() const
This method allows you to query the number of input bands.
const ossimRpfTocEntry * getTocEntry(ossim_uint32 index) const
virtual ossimIrect getImageRectangle() const
virtual ossimRefPtr< ossimImageGeometry > getImageGeometry()
Populates the geometry object with image geometry information.
virtual ossim_uint32 getNumberOfSamples(ossim_uint32 reduced_res_level=0) const
Satisfies pure virtual requirement from ImageHandler class.
const ossimIpt & lr() const
virtual void close()
Deletes the overview and clears the valid image vertices.
virtual ossimRefPtr< ossimImageData > create(ossimSource *owner, ossimScalarType scalar, ossim_uint32 bands=1) const
ossim_uint32 width() const
void initImageParameters(ossimImageGeometry *geom) const
Convenience method to set things needed in the image geometry from the image handler.
ossimIrect clipToRect(const ossimIrect &rect) const
virtual ~ossimCibCadrgTileSource()
Destructor.
ossimErrorCode parseFile(const ossimFilename &fileName, bool keepFileHeader=false)
Parses a.toc file.
ossimRefPtr< ossimImageData > theTile
This is the actual data returned from a getTile request.
CIB/CADRG formats are encoded the same except that the CIB is a grey scale image and the CADRG is a c...
ossim_uint32 getNumberOfFramesHorizontal() const
virtual ossim_uint32 getTileWidth() const
Returns the width of the output tile.
vector< ossim_int32 > getProductEntryList(const ossimString &productScale) const
Using the product scales from getProductScaleList() you can pass each string in so you can get all as...
virtual ossimRefPtr< ossimImageGeometry > getExternalImageGeometry() const
Returns the image geometry object associated with this tile source or NULL if non defined...
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
ossimErrorCode parseFile(const ossimFilename &filename, bool minimalParse=false)
virtual void makeBlank()
Initializes data to null pixel values.
virtual void close()
Closes this image handler and deletes any allocated data.
virtual void completeOpen()
Will complete the opening process.
static const ossim_uint32 CIBCADRG_FRAME_WIDTH
CONSTANT representing the width of a Frame.
ossimRefPtr< ossimImageHandler > theOverview
ossim_int32 theEntryNumberToRender
This will be the entry number that we are currently rendering.
ossim_uint32 getNumberOfLines() const
This class defines an abstract Handler which all image handlers(loaders) should derive from...
void setSkipEmptyCheck(bool bSkipEmptyCheck=false)
Changes the way the open() routine functions slightly.
virtual const ossimRpfToc * getToc() const
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string's contents...
class ossimNBandLutDataObject
ossimFilename theOverviewFile
virtual ossim_uint32 getNumberOfSamples(ossim_uint32 resLevel=0) const =0
Pure virtual, derived classes must implement.
virtual ossim_uint32 getNumberOfLines(ossim_uint32 reduced_res_level=0) const
Satisfies pure virtual requirement from ImageHandler class.
bool isValidRLevel(ossim_uint32 reduced_res_level) const
void fillSubTileCadrg(const ossimRpfFrame &aFrame, const ossimIrect &tileRect, const ossimFrameEntryData &frameEntryData, ossimImageData *tile)
Will uncompress the CADRG file using a VQ decompression algorithm.
ossimRefPtr< ossimNBandLutDataObject > theLut
ossim_uint32 theNumberOfSamples
This will be computed based on the frames organized within the directory.
bool getEntry(long row, long col, ossimRpfFrameEntry &result) const
#define RTTI_DEF1(cls, name, b1)
virtual ossimString getShortName() const
This method is defined in the base class ossimObject.
const ossimRpfCompressionSection * getCompressionSection() const
virtual ossim_int32 getCurrentEntryIndex() const
Returns -1 if invalid.
virtual ossimRefPtr< ossimImageData > getTile(const ossimIrect &rect, ossim_uint32 resLevel=0)
Returns a pointer to an ossimImageDataObject given a rectangluar region of interest.
ossim_int32 getTocEntryIndex(const ossimRpfTocEntry *entry)
Returns -1 if not found.
const ossimFilename & getFullPath() const
unsigned char ossim_uint8
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save the state of an object to a keyword list.