[gdal-dev] Interrupt long operation

Stefano Moratto stefano.moratto at gmail.com
Thu Feb 3 07:22:47 EST 2011


Frank,
            thank you for your suggestion.
I added a GDALProgressFunc as you suggested.
In order to prevent blocking  in the rasterio now I check a state variable
indicating when I have to stop the reading.
Since I call rasterio foreach line of the destination bitmap I have added a
simple check of the state variable (eg.: if (terminate) then return). Very
simple!! I should  have think about it by myself.
Now my app can browse without blocking the openstreetmap dataset.

Best regards.
Stefano

-
Dr.Eng. Stefano Moratto
stefano.moratto at gmail.com
stefano.moratto at csiat.it
http://www.csiat.it - Traffic Optimization Software


On Mon, Jan 31, 2011 at 5:39 PM, Frank Warmerdam <warmerdam at pobox.com>wrote:

> On 11-01-31 04:26 AM, Stefano Moratto wrote:
>
>> Hello,
>>           I need to interrupt a RasterIO  and warp calls before they have
>> been
>> ended.
>> The call is invoked in a background thread and  It may happen that the
>> user
>> changes the requested area in the main thread (GUI) (eg. a pan/scroll
>> operation).
>>
>
> Stefano,
>
> Algorithms which take a GDALProgressFunc are likely to be interruptable.
> Each time the progress function is invoked it has the opportunity to
> return an indicate that the operation has been cancelled by the user.
>
> So the warper can be canceled if you provide a customized progress
> function.  But RasterIO cannot since it has no progress function.
>
> If you want IO to be interruptible you would normally do it in modest
> sized chunks, though this can interfere with optimization of the IO in
> some cases.
>
> Best regards,
> --
>
> ---------------------------------------+--------------------------------------
> I set the clouds in motion - turn up   | Frank Warmerdam,
> warmerdam at pobox.com
> light and sound - activate the windows | http://pobox.com/~warmerdam<http://pobox.com/%7Ewarmerdam>
> and watch the world go round - Rush    | Geospatial Programmer for Rent
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>



-
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20110203/cad5dd30/attachment.html


More information about the gdal-dev mailing list