MapWindow Developer Team : MapWindow Discussion Forum
I've added a bunch of geoprocessing functions to Shapefile class recently (Union, Clip, Difference,etc). Some of them can work for dozens of minutes in case of large datasets. Currently there is no civilized way to stop them, which is quite a problem for GIS Tools plug-in. A person will need to cal
[New feature] IStopExecution interface for ocx
Posted by: Sergei ()
Date: March 29, 2011 09:52AM

I've added a bunch of geoprocessing functions to Shapefile class recently (Union, Clip, Difference,etc). Some of them can work for dozens of minutes in case of large datasets. Currently there is no civilized way to stop them, which is quite a problem for GIS Tools plug-in. A person will need to call task manager and terminate process in case wrong settings were applied.

The possible solution:
to add IStopExecution interface with single member

bool StopFunction();

The user will create a new class and implements this interface then pass an instance of class to Shapefile.StopFunction property. Then in every geoprocessing method StopFunction will be called and the execution will be terminated in case 'true' is returned. On the client side StopFunction implementation can be like this: Application.DoEvents call and some check whether user hit the cancel button (returns true if it happened).

It would be good to use instance of ICallback to do it of course. But there is no way to check user's input in it as far as can I see. Also I can't modify the interface, as it will break the existing code.

The only other possibility:
user can implement both ICallback and IStopExecution interfaces in one class. Then pass an instance of class to GlobalCallback property. Internally I'll use QueryInterface to determine, whether IStopExecution interface is implemented and in case it is, use it in geoprocessing methods. Then I don't need to add Shapefile.StopFunction property. Similar functionality can be needed for Utils class for example, so probably no need to create too many new properties.

What do you think?

Thanks,
Sergei

Options: ReplyQuote
Re: [New feature] IStopExecution interface for ocx
Posted by: Sergei ()
Date: March 29, 2011 06:41PM

One more possibility is to use Threading in GIS Tools. I disregarded it for some reason ;) Thanks to Paul and Chris for advice. It appears to be the easiest way to implement it. If interface for stopping execution is needed (for VBA users for example), please, write it here.

Options: ReplyQuote


Sorry, only registered users may post in this forum.





Banner Exchange




GISCP.com




Send us your banner logo (160x120) for the space above, and add this MapWindow banner ad to your site:

Just paste this text in your page: