Chen Fu wrote:
> Hi
>
> I browsed the source code for a solution to refresh
> cache.
>
> I notice a statement in gvraster.c
>
> gtk_signal_connect( GTK_OBJECT(raster), "changed",
> gv_raster_changed, NULL );
>
> gv_raster_changed will call gv_raster_flush_cache
> which delete all cache content.
>
> I used a vrt file to wrap splitted images together
> just alike the former large one. Then I add a button
> on the OpenEV toolbar. When user press it, it send
> command to processes in other pc on cluster. Those
> processes operate on the part of image it own. After
> the process done, each pc on cluster return a message
> to OpenEv. When OpenEv received all reply, it call
> gv_raster_changed to erase the cache in memory.
>
> gtk_signal_connect in my eye register a callback
> function to "changed" event. But how can it send such
> a message "changed" then (maybe in python )? I am a
> Windows programmer, know very little of gtk. sorry...
>
> Hope you can give me some hint. Thank you!
The changed signal needs to be sent on GvRaster objects, and
can be sent by calling the changed() method on a GvRaster.
The existing "refresh" icon on the icon bar (the up arrow)
can already do this and uses the following Python.
def refresh_cb(self, *args):
self.make_active()
try:
layer = self.viewarea.active_layer()
for isource in range(4):
raster = layer.get_data(isource)
if raster is not None:
raster.changed()
except:
gvutils.warning('The refresh from disk operation can only be\n'+\
'applied to raster layers. Select a raster\n'+\
'layer for this view in the layers dialog.')
pass
It would likely be better for your application if you could
force only specific regions to marked as changed, but I don't
think this is currently possible from Python. If you find you
need it I can add it at some point.
Best regards,
-
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam@...
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent
|