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

ossimGdalDataset This is a gdal data set that wraps an ossim image handler. More...

#include <ossimGdalDataset.h>

Inheritance diagram for ossimGdalDataset:

Public Member Functions

 ossimGdalDataset ()
 default constructor More...
 
virtual ~ossimGdalDataset ()
 virtual destructor More...
 
bool open (const ossimFilename &file)
 open method. More...
 
void setImageHandler (ossimImageHandler *ih)
 Sets theImageHandler. More...
 
const ossimImageHandlergetImageHandler () const
 
ossimImageHandlergetImageHandler ()
 
void initGdalOverviewManager ()
 Calls gdal's oOvManager.Initialize. More...
 
void setGdalAcces (GDALAccess access)
 Set the access data member. More...
 

Static Public Member Functions

static GDALDataset * Open (GDALOpenInfo *)
 Open for static gdal driver. More...
 

Private Member Functions

void init ()
 Initializes this object from the image handler. More...
 

Private Attributes

ossimRefPtr< ossimImageHandlertheImageHandler
 

Friends

class ossimGdalDatasetRasterBand
 

Detailed Description

ossimGdalDataset This is a gdal data set that wraps an ossim image handler.

Note
Currently no write implemented.

Definition at line 30 of file ossimGdalDataset.h.

Constructor & Destructor Documentation

◆ ossimGdalDataset()

CPL_C_END ossimGdalDataset::ossimGdalDataset ( )

default constructor

Definition at line 34 of file ossimGdalDataset.cpp.

35  : theImageHandler(0)
36 {
37  if (!poOssimGdalDriver)
38  {
40  poDriver = poOssimGdalDriver;
41  }
42 
43  if (traceDebug())
44  {
46  << "ossimGdalDataset::ossimGdalDataset entered..."
47  << std::endl;
48 #ifdef OSSIM_ID_ENABLED
50  << "OSSIM_ID: "
51  << OSSIM_ID
52  << std::endl;
53 #endif
54  }
55 }
CPL_C_START void GDALRegister_ossimGdalDataset(void)
ossimRefPtr< ossimImageHandler > theImageHandler
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ ~ossimGdalDataset()

ossimGdalDataset::~ossimGdalDataset ( )
virtual

virtual destructor

Definition at line 57 of file ossimGdalDataset.cpp.

59 {
60  if (traceDebug())
61  {
63  << "ossimGdalDataset::~ossimGdalDataset "
64  << "\n"
65  << std::endl;
66  }
67 
68  if (theImageHandler.valid())
69  theImageHandler = 0;
70 }
bool valid() const
Definition: ossimRefPtr.h:75
ossimRefPtr< ossimImageHandler > theImageHandler
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

Member Function Documentation

◆ getImageHandler() [1/2]

const ossimImageHandler * ossimGdalDataset::getImageHandler ( ) const
Returns
Pointer(const) to the image handler or 0 if not set.

Definition at line 132 of file ossimGdalDataset.cpp.

References ossimRefPtr< T >::get(), and theImageHandler.

Referenced by ossimGdalOverviewBuilder::generateHfaStats(), and ossimGdalOverviewBuilder::getOutputFile().

133 {
134  return theImageHandler.get();
135 }
ossimRefPtr< ossimImageHandler > theImageHandler

◆ getImageHandler() [2/2]

ossimImageHandler * ossimGdalDataset::getImageHandler ( )
Returns
Pointer(not const) to the image handler or 0 if not set.

Definition at line 137 of file ossimGdalDataset.cpp.

References ossimRefPtr< T >::get(), and theImageHandler.

138 {
139  return theImageHandler.get();
140 }
ossimRefPtr< ossimImageHandler > theImageHandler

◆ init()

void ossimGdalDataset::init ( )
private

Initializes this object from the image handler.

Definition at line 153 of file ossimGdalDataset.cpp.

References ossimImageHandler::getImageRectangle(), ossimImageSource::getNumberOfOutputBands(), ossimIrect::height(), theImageHandler, and ossimIrect::width().

154 {
155  nRasterXSize = theImageHandler->getImageRectangle(0).width();
156  nRasterYSize = theImageHandler->getImageRectangle(0).height();
158  eAccess = GA_ReadOnly;
159 
160  if (traceDebug())
161  {
163  << "ossimGdalDataset::init DEBUG:"
164  << "\nWidth: " << nRasterXSize
165  << "\nHeight: " << nRasterYSize
166  << "\nBands: " << nBands << std::endl;
167  }
168 
169  for( int iBand = 0; iBand < nBands; ++iBand )
170  {
172  new ossimGdalDatasetRasterBand( this,
173  iBand+1,
174  theImageHandler.get());
175  SetBand( iBand+1, rb );
176  }
177 }
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
ossim_uint32 height() const
Definition: ossimIrect.h:487
virtual ossimIrect getImageRectangle(ossim_uint32 resLevel=0) const
Returns zero-based bounding rectangle of the image.
ossim_uint32 width() const
Definition: ossimIrect.h:500
ossimGdalDatasetRasterBand Represents a single band within the image.
ossimRefPtr< ossimImageHandler > theImageHandler
friend class ossimGdalDatasetRasterBand
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ initGdalOverviewManager()

void ossimGdalDataset::initGdalOverviewManager ( )

Calls gdal's oOvManager.Initialize.

This must be called if you are building overviews or the code will fail.

Definition at line 142 of file ossimGdalDataset.cpp.

References ossimString::c_str(), ossimImageHandler::getFilename(), theImageHandler, and ossimRefPtr< T >::valid().

143 {
145  sDescription = f.c_str();
146 
147  if (theImageHandler.valid())
148  {
149  oOvManager.Initialize( this, f.c_str() );
150  }
151 }
bool valid() const
Definition: ossimRefPtr.h:75
virtual const ossimFilename & getFilename() const
Returns the filename.
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string&#39;s contents...
Definition: ossimString.h:396
ossimRefPtr< ossimImageHandler > theImageHandler

◆ open()

bool ossimGdalDataset::open ( const ossimFilename file)

open method.

Parameters
fileThe file to open.
Returns
true on success, false on error.

Definition at line 72 of file ossimGdalDataset.cpp.

References ossimImageHandlerRegistry::instance(), ossimImageHandlerRegistry::open(), theImageHandler, and ossimRefPtr< T >::valid().

Referenced by ossimGdalOverviewBuilder::open().

73 {
75 
76  if ( !theImageHandler.valid() )
77  {
78  if (traceDebug())
79  {
81  << "ossimGdalDataset::open DEBUG:"
82  << "\nCould not open: " << file.c_str() << std::endl;
83  }
84  return false;
85  }
86 
87  if (traceDebug())
88  {
90  << "ossimGdalDataset::open DEBUG:"
91  << "\nOpened: " << file.c_str() << std::endl;
92  }
93 
94  init();
95  return true;
96 }
void init()
Initializes this object from the image handler.
virtual ossimImageHandler * open(const ossimFilename &fileName, bool trySuffixFirst=true, bool openOverview=true) const
open that takes a filename.
bool valid() const
Definition: ossimRefPtr.h:75
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string&#39;s contents...
Definition: ossimString.h:396
static ossimImageHandlerRegistry * instance()
ossimRefPtr< ossimImageHandler > theImageHandler
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ Open()

GDALDataset * ossimGdalDataset::Open ( GDALOpenInfo *  poOpenInfo)
static

Open for static gdal driver.

Definition at line 99 of file ossimGdalDataset.cpp.

101 {
102  if (traceDebug())
103  {
105  << "ossimGdalDataset::Open entered..."
106  << std::endl;
107  }
108 
109  ossimFilename f = poOpenInfo->pszFilename;
110  GDALDataset* ds = new ossimGdalDataset;
111  if ( ((ossimGdalDataset*)ds)->open(f) == true)
112  {
113  return ds;
114  }
115 
116  return 0;
117 }
ossimGdalDataset This is a gdal data set that wraps an ossim image handler.
ossimGdalDataset()
default constructor
bool open(const ossimFilename &file)
open method.
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ setGdalAcces()

void ossimGdalDataset::setGdalAcces ( GDALAccess  access)

Set the access data member.

Either GA_ReadOnly = 0, or GA_Update = 1

Definition at line 179 of file ossimGdalDataset.cpp.

180 {
181  eAccess = access;
182 }

◆ setImageHandler()

void ossimGdalDataset::setImageHandler ( ossimImageHandler ih)

Sets theImageHandler.

Parameters
ihPointer to image handler.

Definition at line 119 of file ossimGdalDataset.cpp.

Referenced by ossimGdalOverviewBuilder::setInputSource().

120 {
121  if (traceDebug())
122  {
124  << "ossimGdalDataset::setImageHandler entered..."
125  << std::endl;
126  }
127 
128  theImageHandler = ih;
129  init();
130 }
void init()
Initializes this object from the image handler.
ossimRefPtr< ossimImageHandler > theImageHandler
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

Friends And Related Function Documentation

◆ ossimGdalDatasetRasterBand

friend class ossimGdalDatasetRasterBand
friend

Definition at line 83 of file ossimGdalDataset.h.

Member Data Documentation

◆ theImageHandler

ossimRefPtr<ossimImageHandler> ossimGdalDataset::theImageHandler
private

Definition at line 85 of file ossimGdalDataset.h.

Referenced by getImageHandler(), init(), initGdalOverviewManager(), and open().


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