OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Member Functions | Protected Member Functions | Private Attributes | Friends | List of all members
ossimGdalDatasetRasterBand Class Reference

ossimGdalDatasetRasterBand Represents a single band within the image. More...

#include <ossimGdalDataset.h>

Inheritance diagram for ossimGdalDatasetRasterBand:

Public Member Functions

 ossimGdalDatasetRasterBand (ossimGdalDataset *ds, int band, ossimImageHandler *ih)
 Constructor that takes a ossimGdalDataset, band and image handler. More...
 
virtual ~ossimGdalDatasetRasterBand ()
 virtual destructor More...
 
virtual double GetNoDataValue (int *pbSuccess=0)
 This returns 0 right now and should probably be implemented if anything serious is to be done with this data set with the gdal library. More...
 

Protected Member Functions

virtual CPLErr IReadBlock (int nBlockXOff, int nBlockYOff, void *pImage)
 Read block method. More...
 

Private Attributes

ossimRefPtr< ossimImageHandlertheImageHandler
 

Friends

class ossimGdalDataset
 

Detailed Description

ossimGdalDatasetRasterBand Represents a single band within the image.

Definition at line 92 of file ossimGdalDataset.h.

Constructor & Destructor Documentation

◆ ossimGdalDatasetRasterBand()

ossimGdalDatasetRasterBand::ossimGdalDatasetRasterBand ( ossimGdalDataset ds,
int  band,
ossimImageHandler ih 
)

Constructor that takes a ossimGdalDataset, band and image handler.

Parameters
dsThe parent data set.
bandThe "ONE" based band.
ihThe pointer to the image handler.

Definition at line 184 of file ossimGdalDataset.cpp.

187  : GDALPamRasterBand(),
188  theImageHandler(ih)
189 
190 {
191  if (traceDebug())
192  {
194  << "ossimGdalDatasetRasterBand::ossimGdalDatasetRasterBand entered..."
195  << "band: " << band
196  << std::endl;
197  }
198  if (!ih)
199  {
200  return;
201  }
202 
203  poDS = ds;
204  nBand = band;
205 
206  nRasterXSize = theImageHandler->getImageRectangle(0).width();
207  nRasterYSize = theImageHandler->getImageRectangle(0).height();
208 
209  // eAccess = GA_ReadOnly;
210  eAccess = GA_Update;
211 
212  ossimGdalType gt;
213  eDataType = gt.toGdal(theImageHandler->getOutputScalarType());
214 
215  nBlockXSize = theImageHandler->getTileWidth();
216  nBlockYSize = theImageHandler->getTileHeight();
217 
218  // ESH 06/2009: Prevent divide by zero.
219  nBlockXSize = (nBlockXSize==0) ? 1 : nBlockXSize;
220  nBlockYSize = (nBlockYSize==0) ? 1 : nBlockYSize;
221 
222  nBlocksPerRow = nRasterXSize / nBlockXSize;
223  nBlocksPerColumn = nRasterYSize / nBlockYSize;
224  if (nRasterXSize % nBlockXSize) ++nBlocksPerRow;
225  if (nRasterYSize % nBlockYSize) ++nBlocksPerColumn;
226 
227  nBlockReads = 0;
228  bForceCachedIO = false;
229 }
ossim_uint32 height() const
Definition: ossimIrect.h:487
virtual ossim_uint32 getTileHeight() const
Returns the default processing tile height.
virtual ossim_uint32 getTileWidth() const
Returns the default processing tile width.
virtual ossimIrect getImageRectangle(ossim_uint32 resLevel=0) const
Returns zero-based bounding rectangle of the image.
ossim_uint32 width() const
Definition: ossimIrect.h:500
ossimRefPtr< ossimImageHandler > theImageHandler
virtual ossimScalarType getOutputScalarType() const
This will be used to query the output pixel type of the tile source.
GDALDataType toGdal(ossimScalarType) const
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ ~ossimGdalDatasetRasterBand()

ossimGdalDatasetRasterBand::~ossimGdalDatasetRasterBand ( )
virtual

virtual destructor

Definition at line 231 of file ossimGdalDataset.cpp.

232 {
233 }

Member Function Documentation

◆ GetNoDataValue()

double ossimGdalDatasetRasterBand::GetNoDataValue ( int *  pbSuccess = 0)
virtual

This returns 0 right now and should probably be implemented if anything serious is to be done with this data set with the gdal library.

Definition at line 268 of file ossimGdalDataset.cpp.

270 {
271  if (traceDebug())
272  {
274  << "ossimGdalDatasetRasterBand::GetNoDataValue entered..."
275  << "\n"
276  << std::endl;
277  }
278 
279  return 0.0;
280 }
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ IReadBlock()

CPLErr ossimGdalDatasetRasterBand::IReadBlock ( int  nBlockXOff,
int  nBlockYOff,
void *  pImage 
)
protectedvirtual

Read block method.

Parameters
nBlockXOffX Block offset, "0" being upper left sample of image, 1 being sample at nBlockXOff * nBlockXSize and so on.
nBlockYOffYBlock offset, "0" being upper left sample of image, 1 being sample at nBlockYOff * nBlockYSize and so on.
pImageBuffer to put image data in. Must be at least: pixel_size_in_bytes * nBlockXSize * nBlockYSize
Returns
CE_None on success, CE_Failure on failure.

Definition at line 235 of file ossimGdalDataset.cpp.

References ossimDataObject::getDataObjectStatus(), ossimImageSource::getTile(), OSSIM_FULL, OSSIM_PARTIAL, theImageHandler, ossimImageData::unloadBand(), ossimRefPtr< T >::valid(), ossimIpt::x, and ossimIpt::y.

238 {
239  if ( !theImageHandler.valid() || !pImage)
240  {
241  return CE_Failure;
242  }
243 
244  ossimIpt startPt(nBlockXOff*nBlockXSize, nBlockYOff*nBlockYSize);
245 // ossimIpt endPt( min(startPt.x+nBlockXSize-1, nRasterXSize-1),
246 // min(startPt.y+nBlockYSize-1, nRasterYSize-1));
247  ossimIpt endPt( startPt.x+nBlockXSize-1,
248  startPt.y+nBlockYSize-1);
249  ossimIrect rect( startPt, endPt);
250 
252 
253  if (id.valid())
254  {
255  if( (id->getDataObjectStatus() == OSSIM_FULL) ||
257  {
258  id->unloadBand(pImage, rect, nBand-1);
259  return CE_None;
260  }
261  }
262 
263  memset(pImage, 0, nBlockXSize * nBlockYSize);
264 
265  return CE_None;
266 }
bool valid() const
Definition: ossimRefPtr.h:75
virtual ossimDataObjectStatus getDataObjectStatus() const
virtual void unloadBand(void *dest, ossim_uint32 src_band, ossim_uint32 dest_band, const ossimIrect &dest_rect, ossimInterleaveType il_type=OSSIM_BSQ, OverwriteBandRule ow_type=NULL_RULE) const
This routine is designed for overwriting a selected band of the destination buffer &#39;dest&#39; by an indep...
ossimRefPtr< ossimImageHandler > theImageHandler
virtual ossimRefPtr< ossimImageData > getTile(const ossimIpt &origin, ossim_uint32 resLevel=0)

Friends And Related Function Documentation

◆ ossimGdalDataset

friend class ossimGdalDataset
friend

Definition at line 94 of file ossimGdalDataset.h.

Member Data Documentation

◆ theImageHandler

ossimRefPtr<ossimImageHandler> ossimGdalDatasetRasterBand::theImageHandler
private

Definition at line 138 of file ossimGdalDataset.h.

Referenced by IReadBlock().


The documentation for this class was generated from the following files: