19 #include <cpl_string.h> 21 static GDALDriver *poMEMTiledDriver = NULL;
27 GByte *pabyData, GDALDataType eType,
28 int nPixelOffset,
int nLineOffset,
29 int bAssumeOwnership )
32 return (GDALRasterBandH)
34 nLineOffset, bAssumeOwnership );
47 int bAssumeOwnership )
68 CPLDebug(
"MEM",
"~MEMTiledRasterBand(%p)",
this );
71 CPLDebug(
"MEM",
"~MEMTiledRasterBand() - free raw data." );
90 <<
"MEMTiledRasterBand::IReadBlock DEBUG: entered..." 91 <<
"\nnBlockXSize: " << nBlockXSize
92 <<
"\nnBlockYSize: " << nBlockYSize
93 <<
"\nnBlockXOff: " << nBlockXSize
94 <<
"\nnBlockYOff: " << nBlockYSize
112 ul.x + nBlockXSize - 1,
113 ul.y + nBlockYSize - 1);
118 <<
"\nrequestRect: " << requestRect
119 <<
"\nbufferRect: " << bufferRect
124 if(requestRect.height() > 1)
127 <<
"MEMTiledRasterBand::IReadBlock WARN!" 128 <<
"\nOnly one scanline block reads allowed" << endl;
137 bool loadBuffer =
false;
139 if ( (requestRect.completely_within(bufferRect) ==
false) ||
150 <<
"\nscanlineTile: " << scanlineTile
168 <<
"\ntileOrigin: " << tileOrigin << endl;
203 <<
"nBlockYOff: " << nBlockYOff
204 <<
"\ntheDataset->theData->getImageRectangle()" 216 copyNulls(pImage, nBlockYSize * nBlockXSize);
220 int nWordSize = GDALGetDataTypeSize( eDataType ) / 8;
221 CPLAssert( nBlockXOff == 0 );
223 if( nPixelOffset == nWordSize )
226 bufferRect.
width() * BPP +
227 (ul.x - bufferRect.
ul().
x) * BPP;
234 nPixelOffset * nBlockXSize);
239 <<
"MEMTiledRasterBand::IReadBlock WARN!" 240 <<
"\nUnhandled wordsize..." 248 for(
int iPixel = 0; iPixel < nBlockXSize; iPixel++ )
250 memcpy( (GByte *) pImage+ iPixel*nWordSize,
251 pabyCur + iPixel*nPixelOffset,
311 theJustCreatedFlag(false),
312 theSetNoDataValueFlag(
true)
323 theJustCreatedFlag(false),
324 theSetNoDataValueFlag(
true)
347 <<
"MEMTiledDataset::create DEBUG: entered..." 364 int nWordSize = GDALGetDataTypeSize(gdalType) / 8;
369 papBandData = (GByte **) CPLCalloc(
sizeof(
void *),nBands);
371 for( band = 0; band < nBands; band++ )
373 papBandData[band] = (GByte *) VSICalloc( nWordSize, tw * th );
376 poDriver = poMEMTiledDriver;
382 nRasterXSize = bounds.
width();
383 nRasterYSize = bounds.
height();
389 <<
"\nnRasterXSize" << nRasterXSize
390 <<
"\nnRasterYSize" << nRasterYSize
415 for( band = 0; band < nBands; band++ )
436 CPLFree( papBandData );
447 <<
"MEMTiledDataset::create DEBUG: exited..." 465 GDALDriver *poDriver;
467 if( poMEMTiledDriver == NULL )
469 poMEMTiledDriver = poDriver =
new GDALDriver();
471 poDriver->SetDescription(
"MEM TILED" );
472 poDriver->SetMetadataItem( GDAL_DMD_LONGNAME,
473 "In Memory Raster OSSIM tile bridge" );
475 poDriver->pfnOpen = MEMDataset::Open;
476 poDriver->pfnCreate = MEMDataset::Create;
478 GetGDALDriverManager()->RegisterDriver( poDriver );
548 T* p =
static_cast<T*
>(pImage);
551 for (
int i = 0; i < count; ++i)
virtual ossimRefPtr< ossimImageData > getTile(const ossimIrect &rect, ossim_uint32 resLevel=0)
bool theSetNoDataValueFlag
DRB - 20081020 If true (default) the no data value will be set to null pixel value.
virtual ossim_uint32 getWidth() const
virtual ossim_uint32 getTileWidth() const
Returns the default processing tile width.
GDALRasterBandH MEMTiledCreateRasterBand(GDALDataset *poDS, int nBand, GByte *pabyData, GDALDataType eType, int nPixelOffset, int nLineOffset, int bAssumeOwnership)
Represents serializable keyword/value map.
MEMTiledRasterBand(GDALDataset *poDS, int nBand, GByte *pabyData, GDALDataType eType, int nPixelOffset, int nLineOffset, int bAssumeOwnership)
virtual void setToStartOfSequence()
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
ossim_uint32 height() const
ossimIrect theAreaOfInterest
const ossimIpt & ul() const
virtual ossimDataObjectStatus getDataObjectStatus() const
void setNoDataValueFlag(bool flag)
DRB - 20081020 If true (default) the no data value will be set to null pixel value.
unsigned short ossim_uint16
virtual ~MEMTiledRasterBand()
virtual void initialize()
Initialize the data buffer.
MEMTiledDataset * theDataset
virtual ossimObject * dup() const
virtual void loadTile(const void *src, const ossimIrect &src_rect, ossimInterleaveType il_type)
virtual void setHeight(ossim_uint32 height)
static ossimImageDataFactory * instance()
virtual ossimScalarType getOutputScalarType() const
This will be used to query the output pixel type of the tile source.
void create(ossimImageSourceSequencer *iface)
virtual ossimDataObjectStatus validate() const
signed short ossim_sint16
virtual ossimIrect getBoundingRect(ossim_uint32 resLevel=0) const
This will return the bounding rect of the source.
unsigned int ossim_uint32
virtual const ossim_float64 * getNullPix() const
32 bit normalized floating point
virtual void setWidth(ossim_uint32 width)
virtual ossimIrect getImageRectangle() const
virtual ossimRefPtr< ossimImageData > create(ossimSource *owner, ossimScalarType scalar, ossim_uint32 bands=1) const
ossim_uint32 width() const
virtual CPLErr IReadBlock(int, int, void *)
virtual void setOrigin(const ossimIpt &origin)
virtual ossim_uint32 getScalarSizeInBytes() const
virtual double getNullPixelValue(ossim_uint32 band=0) const
Each band has a null pixel associated with it.
void GDALRegister_MEMTiled()
virtual ossimScalarType getScalarType() const
virtual void makeBlank()
Initializes data to null pixel values.
64 bit normalized floating point
16 bit unsigned integer (11 bits used)
ossim_int64 getNumberOfTilesHorizontal() const
virtual ossim_uint32 getTileHeight() const
Returns the default processing tile height.
ossimImageSourceSequencer * theInterface
virtual const void * getBuf() const
friend class MEMTiledRasterBand
GDALDataType toGdal(ossimScalarType) const
virtual CPLErr IWriteBlock(int, int, void *)
unsigned char ossim_uint8
ossimRefPtr< ossimImageData > theData
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
void copyNulls(void *pImage, int count) const
Copies null values to pImage.