42 #ifdef OSSIM_ID_ENABLED 43 static const char OSSIM_ID[] =
"$Id: ossimImageCacheBase.cpp 2685 2011-06-07 16:24:41Z david.burken $";
62 m_numOfFramesVertical(0),
63 m_numOfFramesHorizontal(0),
71 <<
"ossimImageCacheBase::ossimImageCacheBase entered...\n";
72 #ifdef OSSIM_ID_ENABLED 74 <<
"OSSIM_ID: " << OSSIM_ID <<
"\n";
78 m_actualImageRect.makeNan();
116 static const char MODULE[] =
"ossimImageCacheBase::buildFrameEntryArray";
126 m_frame_width = frameWidth;
127 m_frame_height = frameHeight;
143 std::vector<ossimString> box_lat_lon;
144 tmpStr.
split(box_lat_lon,
"|");
146 if (box_lat_lon.size() > 2)
148 std::vector<ossimString> ll;
149 std::vector<ossimString> ur;
151 box_lat_lon[0].split(ll,
",");
152 box_lat_lon[1].split(ur,
",");
156 m_bBox_LL_Lat = ll[1].toFloat64();
157 m_bBox_UR_Lon = ur[0].toFloat64();
158 m_bBox_UR_Lat = ur[1].toFloat64();
160 checkLongitude(m_bBox_LL_Lon, m_bBox_UR_Lon);
171 m_fileNames.push_back(tmpStr);
172 std::vector<ossimString> frame_lat_lon = tmpStr.
split(
"|");
173 if (frame_lat_lon.size() > 2)
182 checkLongitude(ll_lon, ur_lon);
184 ossim_float64 bBox_lat_diff = std::fabs(m_bBox_UR_Lat - m_bBox_LL_Lat);
185 ossim_float64 bBox_lon_diff = std::fabs(m_bBox_UR_Lon - m_bBox_LL_Lon);
190 m_numOfFramesVertical =
static_cast<ossim_uint32>(bBox_lat_diff/lat_diff + 0.5);
191 m_numOfFramesHorizontal =
static_cast<ossim_uint32>(bBox_lon_diff/lon_diff + 0.5);
193 avgLon = std::fabs(bBox_lon_diff/m_numOfFramesHorizontal);
194 avgLat = std::fabs(bBox_lat_diff/m_numOfFramesVertical);
196 m_numberOfLines = m_numOfFramesVertical*m_frame_height;
197 m_numberOfSamples = m_numOfFramesHorizontal*m_frame_width;
202 <<
"\nscene height in degrees: " << bBox_lat_diff
203 <<
"\nscene width in degrees: " << bBox_lon_diff
204 <<
"\nframe height in degrees: " << lat_diff
205 <<
"\nframe width in degrees: " << lon_diff
206 <<
"\nframes vertical: " << m_numOfFramesVertical
207 <<
"\nframes horizontal: " << m_numOfFramesHorizontal
208 <<
"\nlines: " << m_numberOfLines
209 <<
"\nsamples: " << m_numberOfSamples <<
"\n";
219 m_fileNames.push_back(tmpStr);
229 m_frameEntryArray.resize(m_numOfFramesVertical);
230 for(index = 0; index < m_frameEntryArray.size(); ++index)
232 m_frameEntryArray[index].resize(m_numOfFramesHorizontal);
235 for(index = 0; index < m_fileNames.size(); ++index)
238 std::vector<ossimString> frameInfos = tmpStr.
split(
"|");
239 if (frameInfos.size() > 1)
249 checkLongitude(ll_lon, ur_lon);
251 ossim_float64 tmpColPostion = std::fabs(ll_lon - m_bBox_LL_Lon);
254 if (std::fabs(tmpFrameLon - avgLon) > 0.002)
260 ossim_float64 tmpRowPostion = std::fabs(m_bBox_UR_Lat - ur_lat);
263 if (std::fabs(tmpFrameLat - avgLat) > 0.002)
272 if (colNum >= m_numOfFramesHorizontal)
274 colNum = m_numOfFramesHorizontal-1;
277 if (rowNum >= m_numOfFramesVertical)
279 rowNum = m_numOfFramesVertical-1;
284 m_frameEntryArray[rowNum][colNum] = tempEntry;
319 return m_numberOfBands;
324 return m_numberOfBands;
329 if (reduced_res_level == 0)
331 return m_numberOfLines;
333 else if (theOverview.valid())
335 return theOverview->getNumberOfLines(reduced_res_level);
343 if (reduced_res_level == 0)
345 return m_numberOfSamples;
347 else if (theOverview.valid())
349 return theOverview->getNumberOfSamples(reduced_res_level);
357 m_actualImageRect =
ossimIrect(0,0,m_numberOfLines, m_numberOfSamples);
364 getNumberOfSamples(reduced_res_level) - 1,
365 getNumberOfLines(reduced_res_level) - 1);
382 entryList.push_back(0);
387 if (reduced_res_level == 0)
391 else if (theOverview.valid())
393 return theOverview->isValidRLevel(reduced_res_level);
403 vector<ossimFrameEntryData> result;
406 if(!isOpen())
return result;
413 clipRect.
ul().
y/m_frame_height,
414 clipRect.
lr().
x/m_frame_width,
415 clipRect.
lr().
y/m_frame_height);
417 for(
ossim_int32 row = frameRect.ul().y; row <= frameRect.lr().y; ++row)
419 for(
ossim_int32 col = frameRect.ul().x; col <= frameRect.lr().x; ++col)
443 const char* prefix)
const 453 const char* MODULE =
"ossimImageCacheBase::loadState";
457 CLOG <<
"Entering..." << endl;
465 CLOG <<
"Leaving..." << endl;
469 const char* lookup = 0;
479 CLOG <<
"Leaving..." << endl;
482 setCurrentEntry(entry);
503 theDecimationFactors.clear();
511 if (theGeometry.valid())
return theGeometry;
516 const char* prefix = 0;
522 ossimGpt ul(m_bBox_UR_Lat,m_bBox_LL_Lon);
523 ossimGpt ll(m_bBox_LL_Lat,m_bBox_LL_Lon);
524 ossimGpt ur(m_bBox_UR_Lat,m_bBox_UR_Lon);
525 ossimGpt lr(m_bBox_LL_Lat,m_bBox_UR_Lon);
527 double latInterval = fabs(ul.
latd() - lr.
latd())/ getNumberOfLines();
528 double lonInterval = fabs(ul.
lond() - ur.
lond())/ getNumberOfSamples();
572 getNumberOfInputBands(),
577 getNumberOfOutputBands(),
587 getNumberOfSamples(),
604 double deltaLatPerPixel = latInterval;
605 double deltaLonPerPixel = lonInterval;
609 tie.
lat = ul.
latd() - deltaLatPerPixel/2.0;
610 tie.
lon = ul.
lond() + deltaLonPerPixel/2.0;
639 ul.
latd()-(deltaLatPerPixel/2.0),
644 ul.
lond()+(deltaLonPerPixel/2.0),
649 "ossimEquDistCylProjection",
657 initImageParameters( theGeometry.get() );
virtual bool open()=0
Pure virtual open.
virtual ossim_uint32 getNumberOfInputBands() const
This method allows you to query the number of input bands.
static const char * DECIMAL_DEGREES_PER_PIXEL_LAT
static const char * DATUM_KW
double lond() const
Will convert the radian measure to degrees.
static const char * CENTRAL_MERIDIAN_KW
Represents serializable keyword/value map.
static const char * UL_LAT_KW
std::basic_ifstream< char > ifstream
Class for char input file streams.
bool isValidRLevel(ossim_uint32 reduced_res_level) const
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
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 getImageTileWidth() const
Returns the tile width of the image or 0 if the image is not tiled.
Protected structure that is only used internally by this class.
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 bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to load the state of an object from a keyword list.
std::istream & getline(std::istream &is, ossimString &str, char delim)
virtual ossim_uint32 getNumberOfOutputBands() const
This method allows one to query the number of output bands.
bool intersects(const ossimIrect &rect) const
double latd() const
Will convert the radian measure to degrees.
static const char * TYPE_KW
virtual ossim_uint32 getNumberOfSamples(ossim_uint32 reduced_res_level=0) const
Satisfies pure virtual requirement from ImageHandler class.
virtual ossim_uint32 getTileHeight() const
Returns the height of the output tile.
vector< ossimFrameEntryData > getIntersectingEntries(const ossimIrect &rect)
It is important to note that each frame is organized into an easting northing type orientation...
ossim_int32 toInt32() const
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
static const char * LR_LAT_KW
virtual ossimIrect getImageRectangle(ossim_uint32 reduced_res_level=0) const
static const char * TIE_POINT_XY_KW
void setActualImageRect()
Will shift the rect and clamp it so not to go outside the -180 to 180 degree range.
static const char * LL_LON_KW
virtual ossimRefPtr< ossimImageGeometry > getImageGeometry()
Populates the geometry object with image geometry information.
unsigned int ossim_uint32
static const char * NUMBER_OUTPUT_BANDS_KW
void setEntry(const ossimFilename &rootDirectory, const ossimFilename &pathToFrameFileFromRoot)
ossim_float64 toFloat64() const
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...
static const char * DECIMAL_DEGREES_PER_PIXEL_LON
static const char * LL_LAT_KW
const ossimIpt & lr() const
static ossimString downcase(const ossimString &aString)
ossimIrect clipToRect(const ossimIrect &rect) const
bool isOpen() const
Determines if its open if there eists a table of contents object.
virtual ossim_uint32 getImageTileHeight() const
Returns the tile width of the image or 0 if the image is not tiled.
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 ossim_uint32 getNumberOfLines(ossim_uint32 reduced_res_level=0) const
Satisfies pure virtual requirement from ImageHandler class.
static const char * ORIGIN_LATITUDE_KW
virtual void close()
Closes this image handler and deletes any allocated data.
ossimString toString(ossim_uint32 precision=15) const
This class defines an abstract Handler which all image handlers(loaders) should derive from...
bool buildFrameEntryArray(ossimFilename imageFile, ossim_uint32 frameWidth, ossim_uint32 frameHeight)
static const char * UL_LON_KW
virtual ~ossimImageCacheBase()
Destructor.
static const char * UR_LAT_KW
static const char * UR_LON_KW
virtual void establishDecimationFactors()
Virtual method determines the decimation factors at each resolution level.
static const char * TIE_POINT_LAT_KW
#define RTTI_DEF1(cls, name, b1)
virtual void getEntryList(std::vector< ossim_uint32 > &entryList) const
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
static const char * NUMBER_SAMPLES_KW
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 getTileWidth() const
Returns the width of the output tile.