14 #include <gdal_priv.h> 26 "ossimGdalOverviewBuilder",
29 static const char* OVR_TYPE[] = {
"unknown",
42 theOverviewType(ossimGdalOverviewTiffAverage),
44 theGenerateHfaStatsFlag(false)
149 std::vector<ossimString>& typeList)
const 166 <<
"ossimGdalOverviewBuilder::execute entered..." 184 <<
"Source image file and overview file cannot be the same!" 195 cerr <<
" generateHfaStats failed..." << endl;
232 while (minBound > stopDim)
234 minBound = minBound / 2;
238 if (numberOfLevels == 0)
250 for (idx = 0; idx <
theLevels.size(); ++idx)
252 levelDecimationFactor[idx] =
theLevels[idx];
257 levelDecimationFactor[0] = 2;
258 for(idx = 1; idx < static_cast<ossim_uint32>(numberOfLevels); ++idx)
260 levelDecimationFactor[idx] = levelDecimationFactor[idx-1]*2;
267 <<
"ossimGdalOverviewBuilder::execute DEBUG:" 268 <<
"\noverviewFilename: " << overviewFile
269 <<
"\npszResampling: " << pszResampling
270 <<
"\nnumberOfLevels: " << numberOfLevels
272 for(idx = 0; idx < static_cast<ossim_uint32>(numberOfLevels); ++idx)
275 <<
"levelDecimationFactor[" 276 << idx <<
"]: " << levelDecimationFactor[idx]
281 CPLErr eErr = CE_None;
286 CPLSetConfigOption(
"USE_RRD",
"YES");
291 levelDecimationFactor,
298 <<
"Overview building failed." << std::endl;
301 if ( levelDecimationFactor )
303 delete [] levelDecimationFactor;
304 levelDecimationFactor = 0;
307 if (eErr == CE_None )
315 <<
"Wrote file: " << overviewFile << std::endl;
323 if (property.
valid() ==
false)
333 property->valueToString(value);
338 <<
"ossimGdalOverviewBuilder::setProperty DEBUG:" 342 std::vector<ossimString> v1 = value.
split(
",");
350 <<
"level[" << i <<
"]: " << level << std::endl;
354 else if ( s ==
"generate-hfa-stats" )
361 std::vector<ossimString>& propertyNames)
const 364 propertyNames.push_back(
ossimString(
"generate-hfa-stats"));
369 out <<
"ossimGdalOverviewBuilder::print" 371 <<
"\noverview_type: " 400 if (sourceImageFile.
empty())
406 GDALDriverH hDriver = GDALGetDriverByName(
"HFA" );
415 GDALDatasetH hOutDS = 0;
418 char** papszCreateOptions = 0;
419 GDALProgressFunc pfnProgress = GDALTermProgress;
422 s += sourceImageFile.
file();
424 papszCreateOptions = CSLAddString( papszCreateOptions,
"AUX=YES");
425 papszCreateOptions = CSLAddString( papszCreateOptions,
"STATISTICS=YES");
426 papszCreateOptions = CSLAddString( papszCreateOptions, s.
c_str() );
428 hOutDS = GDALCreateCopy( hDriver,
436 CSLDestroy( papszCreateOptions );
void initGdalOverviewManager()
Calls gdal's oOvManager.Initialize.
bool open(const ossimFilename &file)
Open that takes a file name.
virtual bool setOverviewType(const ossimString &type)
Sets the overview output type.
ossimFilename theOutputFile
static const ossimFilename NIL
This was taken from Wx widgets for performing touch and access date stamps.
ossimString getExtensionFromType() const
ossimGdalOverviewType theOverviewType
std::vector< ossim_int32 > theLevels
virtual bool execute()
Builds the overviews.
void setImageHandler(ossimImageHandler *ih)
Sets theImageHandler.
ossim_uint32 height() const
ossimGdalDataset * theDataset
bool theGenerateHfaStatsFlag
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 void setProperty(ossimRefPtr< ossimProperty > property)
Method to set properties.
virtual bool setInputSource(ossimImageHandler *imageSource)
Sets the input to the builder.
const ossimImageHandler * getImageHandler() const
ossimGdalOverviewBuilder Class to build overviews from the GDAL library.
virtual ~ossimGdalOverviewBuilder()
virtual destructor
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const
Method to populate the list of property names.
virtual std::ostream & print(std::ostream &out) const
print method.
virtual ossim_uint32 getOverviewStopDimension() const
Get the overview stop dimension.
void setGdalAcces(GDALAccess access)
Set the access data member.
ossimGdalOverviewBuilder()
default constructor
virtual const ossimFilename & getFilename() const
Returns the filename.
ossimString getGdalResamplingType() const
unsigned int ossim_uint32
virtual bool canConnectMyInputTo(ossim_int32 index, const ossimConnectableObject *obj) const
static ossimString downcase(const ossimString &aString)
ossimGdalDataset This is a gdal data set that wraps an ossim image handler.
ossim_uint32 width() const
bool generateHfaStats() const
This class defines an abstract Handler which all image handlers(loaders) should derive from...
virtual void setOutputFile(const ossimFilename &file)
Sets the output filename.
virtual void getTypeNameList(std::vector< ossimString > &typeList) const
Method to populate class supported types.
virtual ossimObject * getObject()
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string's contents...
virtual ossimFilename getOutputFile() const
Returns the output.
ossimFilename file() const
virtual ossimIrect getBoundingRect(ossim_uint32 resLevel=0) const
Returns zero-based bounding rectangle of the image.
bool open(const ossimFilename &file)
open method.
virtual ossimString getOverviewType() const
Gets the overview type.
ossimFilename & setExtension(const ossimString &e)
Sets the extension of a file name.
RTTI_DEF1(ossimGdalOverviewBuilder, "ossimGdalOverviewBuilder", ossimOverviewBuilderBase)
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
std::basic_ostream< char > ostream
Base class for char output streams.