Map Busy Indicator

Feb 2, 2011 at 7:43 PM
Edited Feb 2, 2011 at 7:43 PM

Is there a function to indicate that the map is busy doing something. In my map the cursor remains at the Zoom In mode but the map is busy doing it's stuff. This would not doubt confuse a user because they cannot tell what is happening. If the map is busy doing something, is ther a way to montor this?

Developer
Feb 2, 2011 at 8:20 PM

There isn't any great built in busy-monitoring, mainly because with an extensible system and a very large underlying framework, exactly what behaviors constitute "busy" for the map are hard to determine.  However, if you can pin down exactly what it is that is making your map go into a busy state, controling the Map.Cursor property is fairly straight forward.  If it is consistently zooming that is causing a busy state, then you can inherit from the FunctionZoom tool, remove the default FunctionZoom MapFunction from the Map.MapFunctions list, then add your derived class.  In your class, override the OnMouseWheel code.  First record what the Map.Cursor currently is and cache it in a local variable.  Then, set the map cursor to busy.  Next perform the base.OnMouseWheel, then afterwards, set the cursor back to the cached value.  You can use type checking against the class of FunctionZoom or else check for the function with the name of "Zoom" or whatever it is in order to identify the default function that needs to be replaced.

It sounds complicated, but it's only a few lines of code and you could get the functionality you want.  If it is panning that is causing delays, or the click-zoom, then you can use the same strategy, but simply override the MouseUp behavior in the appropriate MapFunction classes.  You do not necessarily need to modify any source code in DotSpatial, since your inherited classes can be part of your project, instead of DotSpatial.  You may even still be able to use the Map.FunctionMode enumeration as normal, since your inherited versions should still pass the necessary tests used by the enumeration when you change the MapFunctionMode.

Ted