42 #ifdef OSSIM_ID_ENABLED 43 static const char OSSIM_ID[] =
"$Id: ossimRpfCacheTileSource.cpp 1361 2010-08-26 00:24:22Z david.burken $";
68 m_productType(OSSIM_PRODUCT_TYPE_UNKNOWN),
74 m_numOfFramesVertical(0),
75 m_numOfFramesHorizontal(0),
81 <<
"ossimRpfCacheTileSource::ossimRpfCacheTileSource entered...\n";
82 #ifdef OSSIM_ID_ENABLED 84 <<
"OSSIM_ID: " << OSSIM_ID <<
"\n";
192 static const char MODULE[] =
"ossimRpfCacheTileSource::buildFrameEntryArray";
212 std::vector<ossimString> box_lat_lon;
213 tmpStr.
split(box_lat_lon,
"|");
215 if (box_lat_lon.size() > 2)
217 std::vector<ossimString> ll;
218 std::vector<ossimString> ur;
220 box_lat_lon[0].split(ll,
",");
221 box_lat_lon[1].split(ur,
",");
249 std::vector<ossimString> frame_lat_lon = tmpStr.
split(
"|");
250 if (frame_lat_lon.size() > 2)
276 <<
"\nscene height in degrees: " << bBox_lat_diff
277 <<
"\nscene width in degrees: " << bBox_lon_diff
278 <<
"\nframe height in degrees: " << lat_diff
279 <<
"\nframe width in degrees: " << lon_diff
309 for(index = 0; index <
m_fileNames.size(); ++index)
312 std::vector<ossimString> frameInfos = tmpStr.
split(
"|");
313 if (frameInfos.size() > 1)
439 if(frames.size() > 0)
506 if (reduced_res_level == 0)
520 if (reduced_res_level == 0)
552 const char* prefix = 0;
640 double deltaLatPerPixel = latInterval;
641 double deltaLonPerPixel = lonInterval;
645 tie.
lat = ul.
latd() - deltaLatPerPixel/2.0;
646 tie.
lon = ul.
lond() + deltaLonPerPixel/2.0;
675 ul.
latd()-(deltaLatPerPixel/2.0),
680 ul.
lond()+(deltaLonPerPixel/2.0),
685 "ossimEquDistCylProjection",
732 entryList.push_back(0);
748 if (reduced_res_level == 0)
764 vector<ossimFrameEntryData> result;
767 if(!
isOpen())
return result;
778 for(
ossim_int32 row = frameRect.ul().y; row <= frameRect.lr().y; ++row)
780 for(
ossim_int32 col = frameRect.ul().x; col <= frameRect.lr().x; ++col)
800 const vector<ossimFrameEntryData>& framesInvolved,
805 idx < framesInvolved.size();
850 if(!compressionSection)
855 const vector<ossimRpfColorGrayscaleTable>& colorTable =
861 int numTables = (int)colorTable.size();
862 if ( numTables <= 0 )
871 tempRows[2] = (tempRows[1] + 256*256);
885 tempDelta.x + clipRect.
width()-1,
886 tempDelta.y + clipRect.
height()-1);
892 ossimIrect subFrameRect(offsetRect.ul().x/256,
893 offsetRect.ul().y/256,
894 (offsetRect.lr().x)/256,
895 (offsetRect.lr().y)/256);
907 for(row = lowerY; row <= upperY; ++row)
909 for(col = lowerX; col <= upperX; ++col)
914 for (i = 0; i < 256; i += 4)
916 for (j = 0; j < 256; j += 8)
929 ossim_uint16 val1 = (firstByte << 4) | (secondByte >> 4);
932 ossim_uint16 val2 = ((secondByte & 0x000F) << 8) | thirdByte;
943 const ossim_uint8* color1 = colorTable[0].getStartOfData(tableVal1);
944 const ossim_uint8* color2 = colorTable[0].getStartOfData(tableVal2);
947 tempRows[0][pixindex] = color1[0];
948 tempRows[1][pixindex] = color1[1];
949 tempRows[2][pixindex] = color1[2];
951 tempRows[0][pixindex+4] = color2[0];
952 tempRows[1][pixindex+4] = color2[1];
953 tempRows[2][pixindex+4] = color2[2];
966 frameRect.
ul().
y + tempRow,
967 frameRect.
ul().
x + tempCol + 255,
968 frameRect.
ul().
y + tempRow + 255);
995 if(!compressionSection)
1000 const vector<ossimRpfColorGrayscaleTable>& colorTable =
1006 int numTables = (int)colorTable.size();
1007 if ( numTables <= 0 )
1030 tempDelta.x + clipRect.
width()-1,
1031 tempDelta.y + clipRect.
height()-1);
1037 ossimIrect subFrameRect(offsetRect.ul().x/256,
1038 offsetRect.ul().y/256,
1039 (offsetRect.lr().x)/256,
1040 (offsetRect.lr().y)/256);
1047 for(row = subFrameRect.ul().y; row <= subFrameRect.lr().y; ++row)
1049 for(col = subFrameRect.ul().x; col <= subFrameRect.lr().x; ++col)
1054 for (i = 0; i < 256; i += 4)
1056 for (j = 0; j < 256; j += 8)
1069 ossim_uint16 val1 = (firstByte << 4) | (secondByte >> 4);
1072 ossim_uint16 val2 = ((secondByte & 0x000F) << 8) | thirdByte;
1082 const ossim_uint8* color1 = colorTable[0].getStartOfData(tableVal1);
1083 const ossim_uint8* color2 = colorTable[0].getStartOfData(tableVal2);
1086 tempRow[pixindex] = color1[0];
1087 tempRow[pixindex + 4] = color2[0];
1100 frameRect.
ul().
y + tRow,
1101 frameRect.
ul().
x + tCol + 255,
1102 frameRect.
ul().
y + tRow + 255);
1150 const char* prefix)
const 1160 const char* MODULE =
"ossimRpfCacheTileSource::loadState";
1164 CLOG <<
"Entering..." << endl;
1172 CLOG <<
"Leaving..." << endl;
1176 const char* lookup = 0;
1186 CLOG <<
"Leaving..." << endl;
1220 if(name ==
"file_type")
1252 const vector<ossimRpfColorGrayscaleTable>& colorTable =
1258 int numTables = (int)colorTable.size();
1260 ossim_uint32 numElements = (numTables > 0) ? colorTable[0].getNumberOfElements() : 0;
1277 for(idx = 0; idx < numElements;++idx)
1279 const ossim_uint8* startOfData = colorTable[0].getStartOfData(idx);
virtual bool open()=0
Pure virtual open.
void clear()
Erases the entire container.
std::vector< ossimString > m_fileNames
The size of the input frames.
virtual bool isSourceEnabled() const
Protected structure that is only used internally by this class.
virtual ossim_uint32 getTileWidth() const
Returns the width of the output tile.
void fillSubTileCib(const ossimRpfFrame &aFrame, const ossimIrect &tileRect, const ossimFrameEntryData &frameEntryData, ossimImageData *tile)
Will uncompress the CIB file using a VQ decompression algorithm.
ossimRefPtr< ossimImageGeometry > theGeometry
ossim_int32 LUT_ENTRY_TYPE
virtual ossim_uint32 getNumberOfSamples(ossim_uint32 reduced_res_level=0) const
Satisfies pure virtual requirement from ImageHandler class.
virtual ossimScalarType getOutputScalarType() const
This method allows you to query the scalar type of the output data.
ossimIrect m_actualImageRect
This holds the image bounds for the current entry.
static const char * DECIMAL_DEGREES_PER_PIXEL_LAT
virtual bool setCurrentEntry(ossim_uint32 entryIdx)
virtual ossim_uint32 getNumberOfBands() const
static const char * DATUM_KW
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
Gets a property for matching name.
ossimFilename theImageFile
virtual void setImageRectangle(const ossimIrect &rect)
const std::vector< ossimRpfCompressionOffsetTableData > & getTable() const
ossim_float64 m_bBox_LL_Lat
double lond() const
Will convert the radian measure to degrees.
static const char * CENTRAL_MERIDIAN_KW
void allocateForProduct()
Will allocate an internal buffer for the given product.
Represents serializable keyword/value map.
static const char * UL_LAT_KW
virtual void getEntryList(std::vector< ossim_uint32 > &entryList) const
static const ossimErrorCode OSSIM_OK
std::basic_ifstream< char > ifstream
Class for char input file streams.
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Attempts to initialize a transform and a projection given the KWL.
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.
bool almostEqual(T x, T y, T tolerance=FLT_EPSILON)
virtual ossim_uint32 getNumberOfLines(ossim_uint32 resLevel=0) const =0
Pure virtual, derived classes must implement.
virtual ossimRefPtr< ossimImageData > getTile(const ossimIrect &rect, ossim_uint32 resLevel=0)
Returns a pointer to an ossimImageDataObject given a rectangluar region of interest.
ossim_uint32 height() const
virtual ossimString getShortName() const
This method is defined in the base class ossimObject.
static const char * NUMBER_LINES_KW
static const char * TIE_POINT_LON_KW
static const char * NUMBER_INPUT_BANDS_KW
const ossimIpt & ul() const
static const char * LR_LON_KW
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.
virtual ossimDataObjectStatus getDataObjectStatus() const
std::istream & getline(std::istream &is, ossimString &str, char delim)
bool intersects(const ossimIrect &rect) const
unsigned short ossim_uint16
double latd() const
Will convert the radian measure to degrees.
static const char * TYPE_KW
virtual void initialize()
Initialize the data buffer.
virtual bool isValidRLevel(ossim_uint32 resLevel) const
Determines if the passed in reslution level is valid.
ossim_int32 toInt32() const
const vector< ossimRpfColorGrayscaleTable > & getColorGrayscaleTable() const
ossimRefPtr< ossimImageData > m_tile
This is the actual data returned from a getTile request.
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
virtual void loadTile(const void *src, const ossimIrect &src_rect, ossimInterleaveType il_type)
ossim_float64 m_bBox_UR_Lat
virtual ossim_uint32 getNumberOfOutputBands() const
This method allows one to query the number of output bands.
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
vector< ossimFrameEntryData > getIntersectingEntries(const ossimIrect &rect)
It is important to note that each frame is organized into an easting northing type orientation...
ossimRpfFrame * m_workFrame
virtual bool getOverviewTile(ossim_uint32 resLevel, ossimImageData *result)
Method to get an overview tile.
static ossimImageDataFactory * instance()
static const char * LR_LAT_KW
virtual bool setEntryToRender(ossim_uint32 index)
Sets the entry to render.
bool fillSubFrameBuffer(ossim_uint8 *buffer, ossim_uint32 spectralGroup, ossim_uint32 row, ossim_uint32 col) const
static const ossim_uint32 CIBCADRG_FRAME_HEIGHT
CONSTANT representing the height of a Frame.
virtual ~ossimRpfCacheTileSource()
Destructor.
virtual ossimDataObjectStatus validate() const
static const char * TIE_POINT_XY_KW
virtual ossimIrect getImageRectangle(ossim_uint32 reduced_res_level=0) const
virtual ossimString getLongName() const
This method is defined in the base class ossimObject.
bool buildFrameEntryArray(ossimFilename imageFile)
static const char * LL_LON_KW
virtual ossim_uint32 getImageTileHeight() const
Returns the tile width of the image or 0 if the image is not tiled.
ossim_uint32 m_numOfFramesHorizontal
ossimRpfCacheProductType m_productType
Holds the enumeration specifying the product type.
unsigned int ossim_uint32
bool isValidRLevel(ossim_uint32 reduced_res_level) const
static const char * NUMBER_OUTPUT_BANDS_KW
void setEntry(const ossimFilename &rootDirectory, const ossimFilename &pathToFrameFileFromRoot)
virtual ossimIrect getImageRectangle() const
static const char * DECIMAL_DEGREES_PER_PIXEL_LON
unsigned char * m_compressedBuffer
This is for storage of a single compressed buffer.
virtual ossimRefPtr< ossimImageGeometry > getImageGeometry()
Populates the geometry object with image geometry information.
static const char * LL_LAT_KW
virtual bool open()
Pure virtual open.
ossim_float64 m_bBox_LL_Lon
const ossimIpt & lr() const
static ossimString downcase(const ossimString &aString)
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 void establishDecimationFactors()
Virtual method determines the decimation factors at each resolution level.
Container class that holds both 2D transform and 3D projection information for an image Only one inst...
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to load the state of an object from a keyword list.
virtual ossim_uint32 getImageTileWidth() const
Returns the tile width of the image or 0 if the image is not tiled.
ossim_float64 m_bBox_UR_Lon
static const char * ORIGIN_LATITUDE_KW
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.
ossimRpfCacheTileSource()
Default constructor.
virtual void completeOpen()
Will complete the opening process.
ossimIpt m_tileSize
The size of the output tile.
std::vector< std::vector< ossimRpfFrameEntry > > m_frameEntryArray
ossimString toString(ossim_uint32 precision=15) const
ossimRefPtr< ossimImageHandler > theOverview
virtual void establishDecimationFactors()
Virtual method determines the decimation factors at each resolution level.
void setActualImageRect()
Will shift the rect and clamp it so not to go outside the -180 to 180 degree range.
This class defines an abstract Handler which all image handlers(loaders) should derive from...
static const ossim_uint32 CIBCADRG_FRAME_WIDTH
CONSTANT representing the width of a Frame.
unsigned char * m_uncompressedBuffer
This is used as a buffer to uncompress the data to.
void fillSubTileCadrg(const ossimRpfFrame &aFrame, const ossimIrect &tileRect, const ossimFrameEntryData &frameEntryData, ossimImageData *tile)
Will uncompress the CADRG file using a VQ decompression algorithm.
void checkLongitude(ossim_float64 &leftLon, const ossim_float64 &rightLon) const
Method to test for 180.0 <–> 180.00 and set leftLon to -180 if both left and right are 180...
virtual ossim_uint32 getNumberOfInputBands() const
This method allows you to query the number of input bands.
static const char * UL_LON_KW
static const char * UR_LAT_KW
static const char * UR_LON_KW
class ossimNBandLutDataObject
ossimFilename theOverviewFile
void fillTile(const ossimIrect &tileRect, const vector< ossimFrameEntryData > &framesInvolved, ossimImageData *tile)
This is a wrapper for the fill cib and fill cadrg.
virtual ossim_uint32 getNumberOfSamples(ossim_uint32 resLevel=0) const =0
Pure virtual, derived classes must implement.
virtual ossim_uint32 getTileHeight() const
Returns the height of the output tile.
static const char * TIE_POINT_LAT_KW
ossimRefPtr< ossimNBandLutDataObject > theLut
#define RTTI_DEF1(cls, name, b1)
const ossimRpfCompressionSection * getCompressionSection() const
virtual void close()
Closes this image handler and deletes any allocated data.
bool isOpen() const
Determines if its open if there eists a table of contents object.
static const char * NUMBER_SAMPLES_KW
unsigned char ossim_uint8
ossim_uint32 m_numOfFramesVertical
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.
virtual ossim_uint32 getNumberOfLines(ossim_uint32 reduced_res_level=0) const
Satisfies pure virtual requirement from ImageHandler class.
ossim_uint32 m_numberOfSamples
This will be computed based on the frames organized within the directory.
ossim_uint32 m_numberOfLines
This will be computed based on the frames organized within the directory.