Hi!

I wrote a basic rasterdata plugin for gdal using the raster driver api. It 
should provide custom rendered overviews in Quantum GIS, which is not working 
yet.
When loading the plugin in QGIS, it is displayed as VRT Format, which should 
not be because I never reference the VRT Dataset or anything related.

Also I noticed that the callstack when rendering an image in QGIS is far 
different from what I would expect:

>             gdal_RNDd.dll!RNDRasterBand::IRasterIO(GDALRWFlag eRWFlag, int 
> nXOff, int nYOff, int nXSize, int nYSize, void * pData, int nBufXSize, int 
> nBufYSize, GDALDataType eBufType, int nPixelSpace, int nLineSpace)  Line 107  
>                gdal111.dll!GDALRasterBand::RasterIO(GDALRWFlag eRWFlag, int 
> nXOff, int nYOff, int nXSize, int nYSize, void * pData, int nBufXSize, int 
> nBufYSize, GDALDataType eBufType, int nPixelSpace, int nLineSpace)  Line 261  
>                gdal_RNDd.dll!RNDDataset::IRasterIO(GDALRWFlag eRWFlag, int 
> nXOff, int nYOff, int nXSize, int nYSize, void * pData, int nBufXSize, int 
> nBufYSize, GDALDataType eBufType, int nBandCount, int * panBandMap, int 
> nPixelSpace, int nLineSpace, int nBandSpace)  Line 124 + 0x8b bytes
               gdal111.dll!GDALDataset::RasterIO(GDALRWFlag eRWFlag, int nXOff, 
int nYOff, int nXSize, int nYSize, void * pData, int nBufXSize, int nBufYSize, 
GDALDataType eBufType, int nBandCount, int * panBandMap, int nPixelSpace, int 
nLineSpace, int nBandSpace)  Line 1758 + 0xaa bytes
               gdal111.dll!GDALDatasetRasterIO(void * hDS, GDALRWFlag eRWFlag, 
int nXOff, int nYOff, int nXSize, int nYSize, void * pData, int nBufXSize, int 
nBufYSize, GDALDataType eBufType, int nBandCount, int * panBandMap, int 
nPixelSpace, int nLineSpace, int nBandSpace)  Line 1797
               gdal111.dll!GDALWarpOperation::WarpRegionToBuffer(int nDstXOff, 
int nDstYOff, int nDstXSize, int nDstYSize, void * pDataBuf, GDALDataType 
eBufDataType, int nSrcXOff, int nSrcYOff, int nSrcXSize, int nSrcYSize, double 
dfProgressBase, double dfProgressScale)  Line 1527 + 0xe0 bytes
               gdal111.dll!VRTWarpedDataset::ProcessBlock(int iBlockX, int 
iBlockY)  Line 1180 + 0xbe bytes
               gdal111.dll!VRTWarpedRasterBand::IReadBlock(int nBlockXOff, int 
nBlockYOff, void * pImage)  Line 1288 + 0x13 bytes
               gdal111.dll!GDALRasterBand::GetLockedBlockRef(int nXBlockOff, 
int nYBlockOff, int bJustInitialize)  Line 1243 + 0x50 bytes
               gdal111.dll!GDALRasterBand::IRasterIO(GDALRWFlag eRWFlag, int 
nXOff, int nYOff, int nXSize, int nYSize, void * pData, int nBufXSize, int 
nBufYSize, GDALDataType eBufType, int nPixelSpace, int nLineSpace)  Line 484 + 
0x1f bytes
               gdal111.dll!GDALRasterBand::RasterIO(GDALRWFlag eRWFlag, int 
nXOff, int nYOff, int nXSize, int nYSize, void * pData, int nBufXSize, int 
nBufYSize, GDALDataType eBufType, int nPixelSpace, int nLineSpace)  Line 261
               gdal111.dll!GDALRasterIO(void * hBand, GDALRWFlag eRWFlag, int 
nXOff, int nYOff, int nXSize, int nYSize, void * pData, int nBufXSize, int 
nBufYSize, GDALDataType eBufType, int nPixelSpace, int nLineSpace)  Line 288
                [....]

Notice that there are VRTWarpedDataset and VRTWarpedRasterBand functions 
involved which I never used anywhere in my driver source.
I would expect GDALRasterBand::RasterIO (second from bottom) to call my 
overridden implementation of RNDRasterBand::IrasterIO (top) directly instead of 
GDALRasterBand::IRasterIO (third from bottom) and all the functions in between.
Here are my class definitions for reference:

class RNDDataset : public GDALDataset
{
    friend class RNDRasterBand;

public:
    virtual ~RNDDataset ();

    virtual CPLErr GetGeoTransform ( double * padfTransform );
    virtual char const * GetProjectionRef();

    static int Identify ( GDALOpenInfo * openInfo );
    static GDALDataset * Open ( GDALOpenInfo * openInfo );

protected:
    RNDDataset ();

    virtual CPLErr IRasterIO ( GDALRWFlag eRWFlag,
        int nXOff, int nYOff, int nXSize, int nYSize,
        void * pData, int nBufXSize, int nBufYSize,
        GDALDataType eBufType,
        int nBandCount, int *panBandMap,
        int nPixelSpace, int nLineSpace, int nBandSpace );
}

class RNDRasterBand : public GDALRasterBand
{
    friend class RNDDataset;

public:
    virtual ~RNDRasterBand ();

    virtual GDALRasterBand * GetOverview ( int a_iOverview );
    virtual int GetOverviewCount ();
    virtual int HasArbitraryOverviews();

protected:
    RNDRasterBand ( RNDDataset * const a_poDS, int const a_nBand, 
GDALColorInterp const a_eColorInterp, int const a_iOverview );

    virtual CPLErr IReadBlock ( int a_nBlockXOff, int a_nBlockYOff, void * 
a_pImage );
    virtual CPLErr IRasterIO ( GDALRWFlag eRWFlag,
        int nXOff, int nYOff, int nXSize, int nYSize,
        void * pData, int nBufXSize, int nBufYSize,
        GDALDataType eBufType,
        int nPixelSpace, int nLineSpace );
}

Any advise what I'm missing?

Thank you,

David
_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to