[gdal-dev] RE: progressive rendering
Tamas Szekeres
szekerest at gmail.com
Sat Aug 30 11:49:55 EDT 2008
Hi All,
Upon thinking about the issues I've been come up with previously, I
consider the following approach could be implemented easily either at
driver or at SWIG interface level. Requires a new class to be
implemented by the async IO supported drivers and a new additional
method should be added to the GDALDataset and GDALRasterBand.
The user could implement the async IO by using the following pseudo sequence:
<Code>
GDALDataset *ds = GDALOpen( name, Access.GA_ReadOnly );
// create an IO context for the asynchronous operation
// the diver will initiate the transfer from the server and set:
ctx->status to IO_PENDING
// the diver will store the internal state of the transfer in the ctx object.
// GDALRasterBand may also implement the similar method by using the
proper arguments.
GDALRasterIOContext *ctx = ds->CreateRasterIOContext(GF_Read, xOff,
yOff, xSize, ySize, buf_xSize, buf_ySize,
buf_dataType, bandCount, bandMap, pixelSpace, lineSpace, bandSpace);
while (ctx->status != IO_COMPLETE)
{
// Update the buffer with the next stage of data. The driver is allowed to
// modify the buffer within ReadNextBlock only.
// ReadNextBlock will wait until the next displayable stage will arrive.
ctx->ReadNextBlock(buffer);
// update the view by using ctx->xOff, ctx->yOff, ctx->xSize, ctx->ySize
....
// the user have pressed the cancel button in the user interface thread.
if (bCancel)
{
// the driver will close the transfer from the server
ctx->CancelIO();
break;
}
}
// The GDALRasterIOContext destructor will close the transfer if needed
</Code>
Best regards,
Tamas
More information about the gdal-dev
mailing list