Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix overview writing and reduce warnings from released GDAL #66

Merged
merged 4 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 41 additions & 17 deletions gdal/keadriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
*
*/

#define GDAL_COMPILATION // required or linkage confusion on Windows...
#include "keaband.h" // for HAVE_64BITIMAGES

CPL_C_START
Expand All @@ -50,25 +51,48 @@ void GDALRegister_KEA()
"KEA Image Format (.kea)" );
poDriver->SetMetadataItem( GDAL_DMD_EXTENSION, "kea" );
poDriver->SetMetadataItem( GDAL_DMD_CREATIONDATATYPES,
"Byte Int16 UInt16 Int32 UInt32 "
"Byte Int8 Int16 UInt16 Int32 UInt32 "
#ifdef HAVE_64BITIMAGES
"Int64 UInt64 "
"Int64 UInt64 "
#endif
"Float32 Float64" );
poDriver->SetMetadataItem( GDAL_DMD_CREATIONOPTIONLIST, "\
<CreationOptionList> \
<Option name='IMAGEBLOCKSIZE' type='int' description='The size of each block for image data'/> \
<Option name='ATTBLOCKSIZE' type='int' description='The size of each block for attribute data'/> \
<Option name='MDC_NELMTS' type='int' description='Number of elements in the meta data cache'/> \
<Option name='RDCC_NELMTS' type='int' description='Number of elements in the raw data chunk cache'/> \
<Option name='RDCC_NBYTES' type='int' description='Total size of the raw data chunk cache, in bytes'/> \
<Option name='RDCC_W0' type='float' description='Preemption policy'/> \
<Option name='SIEVE_BUF' type='int' description='Sets the maximum size of the data sieve buffer'/> \
<Option name='META_BLOCKSIZE' type='int' description='Sets the minimum size of metadata block allocations'/> \
<Option name='DEFLATE' type='int' description='0 (no compression) to 9 (max compression)'/> \
<Option name='THEMATIC' type='boolean' description='If YES then all bands are set to thematic'/> \
</CreationOptionList>" );

"Float32 Float64" );
poDriver->SetMetadataItem(
GDAL_DMD_CREATIONOPTIONLIST,
CPLSPrintf(
"<CreationOptionList> "
"<Option name='IMAGEBLOCKSIZE' type='int' description='The size of "
"each block for image data' default='%d'/> "
"<Option name='ATTBLOCKSIZE' type='int' description='The size of "
"each block for attribute data' default='%d'/> "
"<Option name='MDC_NELMTS' type='int' description='Number of "
"elements in the meta data cache' default='%d'/> "
"<Option name='RDCC_NELMTS' type='int' description='Number of "
"elements in the raw data chunk cache' default='%d'/> "
"<Option name='RDCC_NBYTES' type='int' description='Total size of "
"the raw data chunk cache, in bytes' default='%d'/> "
"<Option name='RDCC_W0' type='float' min='0' max='1' "
"description='Preemption policy' default='%.2f'/> "
"<Option name='SIEVE_BUF' type='int' description='Sets the maximum "
"size of the data sieve buffer' default='%d'/> "
"<Option name='META_BLOCKSIZE' type='int' description='Sets the "
"minimum size of metadata block allocations' default='%d'/> "
"<Option name='DEFLATE' type='int' description='0 (no compression) "
"to 9 (max compression)' default='%d'/> "
"<Option name='THEMATIC' type='boolean' description='If YES then "
"all bands are set to thematic' default='NO'/> "
"</CreationOptionList>",
static_cast<int>(kealib::KEA_IMAGE_CHUNK_SIZE),
static_cast<int>(kealib::KEA_ATT_CHUNK_SIZE),
static_cast<int>(kealib::KEA_MDC_NELMTS),
static_cast<int>(kealib::KEA_RDCC_NELMTS),
static_cast<int>(kealib::KEA_RDCC_NBYTES), kealib::KEA_RDCC_W0,
static_cast<int>(kealib::KEA_SIEVE_BUF),
static_cast<int>(kealib::KEA_META_BLOCKSIZE), kealib::KEA_DEFLATE));
poDriver->SetMetadataItem(GDAL_DCAP_VIRTUALIO, "YES");
poDriver->SetMetadataItem(GDAL_DCAP_OPEN, "YES");
poDriver->SetMetadataItem(GDAL_DCAP_CREATE, "YES");
poDriver->SetMetadataItem(GDAL_DCAP_CREATECOPY, "YES");

// pointer to open function
poDriver->pfnOpen = KEADataset::Open;
// pointer to identify function
Expand Down
3 changes: 2 additions & 1 deletion gdal/keaoverview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ KEAOverview::KEAOverview(KEADataset *pDataset, int nSrcBand, GDALAccess eAccess,

KEAOverview::~KEAOverview()
{

// according to the docs, this is required
this->FlushCache();
}

// overridden implementation - calls readFromOverview instead
Expand Down
Loading