Quantcast
Channel: MapWinGIS ActiveX Map and GIS Component
Viewing all articles
Browse latest Browse all 2341

Updated Wiki: NotesVersion493

$
0
0
HERE IS SUMMARY OF IMPORTANT CHANGES IN VERSION 4.9.3. IT'S RECOMMENDED TO READ THIS BEFORE YOU START DEALING WITH THE NEW VERSION.
1. Application callback.
New GlobalSettings.ApplicationCallback property was added. Callback object assigned to this property intercepts errors in all MapWinGIS classes so there is no longer needed to assign GlobalCallback to individual instances. In some cases errors are reported to application callback ONLY so there is strong recommendation to use it in ANY MapWinGIS application, however small it may be. Here is the simplest implementation of callback in C#:

// simplest implementation of callbackpublicclass MyCallback : ICallback
{
    publicvoid Progress(string KeyOfSender, int Percent, string Message)
    {
        Debug.Print("{0}: {1}", Message, Percent);
    }
    publicvoid Error(string KeyOfSender, string ErrorMsg)
    {
        Debug.Print("MapWinGIS error: ", ErrorMsg);
    }
}

// let's assign this callback as early as possible during app's execution:var gs = new GlobalSettings();
gs.ApplicationCallback = new MyCallback();

The use of application callback doesn't abolish o.get_ErrorMsg(o.LastErrorCode) scheme to report error message to GUI, for example:

var sf = new Shapefile();
if (!sf.Open(@"d:\my_data.shp")) {
     MessageBox.Show("Failed to open shapefile: " + sf.get_ErrorMsg(sf.LastErrorCode));
}
2. Reporting of GDAL errors.
As you probably know MapWinGIS heavy relies on GDAL library (raster datasource, OGR datasource, projections, etc.). Now it's possible to see all the error messages that GDAL library reports. The messages are reported to application callback described above. Every such message is prefixed with "GDAL_WARNING:". The presence of such errors doesn't necessarily mean that the app doesn't work correctly, but it's important diagnostic info if that is the case. Also naturally such warning can appear in the existing apps, it's not because MapWinGIS started to worse, quite on contrary - now it simply reports all properly.

Viewing all articles
Browse latest Browse all 2341

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>