SUMMARY OF CHANGES IN VERSION 4.9.3.
It's recommended to read / skim through it before you start dealing with new version.(still being updated)
1. Deprecated members removed from API.
In this version for the first time a significant number of obsolete API members were removed from Map class. Here is the list of members. Most of those members had been marked as deprecated for quite some time in the documentation. For each such member a substitute is recommended in the docs. Also the definitions aren't permanently removed from the source but excluded by conditional compilation, so if this move will cause too much trouble for the existing apps it can be reverted or a separate version of MapWinGIS with full API can be released. If you have issues with this decision please make you case in the discussions section.2. Demo application.
MapWinGIS is now shipped with demo application which is dubbed MapWindow Lite. Any functionality that this demo provides, can be easily incorporated in your own applications. The source code for the app is available here. The source also includes Legend control and GUI to set properties and labels for vector layers (from MapWindow 4). They can be easily reused in you own projects as well. Just checkout the source and start your own coding (only prerequisites are .NET framework 4.0 and MapWinGIS installed).3. 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", null)) { MessageBox.Show("Failed to open shapefile: " + sf.get_ErrorMsg(sf.LastErrorCode)); }
4. 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. Each 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 an important diagnostic info if that is indeed the case. Also such warnings can appear in the existing apps after migrating to v.4.9.3. It's not because new version works less stable, quite on contrary - now it simply reports all properly.5. Update of Visual C++ runtime:
The new version uses VC2010 runtime (the previous version had used VC2008 for a long time). The runtime should be deployed on the machines of users. It's included in the MapWinGIS installer. You can also create a custom installer for your app based on the updated MapWinGIS installation script.6. Update of GDAL library.
MapWinGIS 4.9.3 uses development version of GDAL 2.0 (which will certainly evolve into stable one after some time). The previous versions of MapWinGIS were linked against 1.xx versions of GDAL. Subjectively the move hardly brought any significant changes in performance / functionality, but GDAL 2.0 has somewhat different API (first of all GDALDatasource class is now used to open both raster and vector datasets) plus it's the version that will be developed further.7. Improved API for projection mismatch testing.
For the situations when layer is being added to the map with missing coordinate system / projectionif they differ from coordinate system / projection of the map the behaviour can be set:
a) globally, for all layers at once:
var gs = new GlobalSettings(); gs.ReprojectLayersOnAdding = true; gs.AllowLayersWithoutProjections = true; gs.AllowProjectionMismatch = false;
b) on layer to layer bases using events:
// adding handles for the events axMap1.ProjectionMismatch += axMap1_ProjectionMismatch; axMap1.LayerProjectionIsEmpty += axMap1_LayerProjectionIsEmpty; axMap1.LayerReprojected += axMap1_LayerReprojected; // actually handling themvoid axMap1_LayerProjectionIsEmpty(object sender, AxMapWinGIS._DMapEvents_LayerProjectionIsEmptyEvent e) { e.cancelAdding = tkMwBoolean.blnFalse; // accept layers without projection Debug.Print("Layer without projection was added: " + axMap1.get_LayerName(e.layerHandle)); } void axMap1_ProjectionMismatch(object sender, AxMapWinGIS._DMapEvents_ProjectionMismatchEvent e) { e.reproject = tkMwBoolean.blnTrue; // try to reproject on the fly Debug.Print("Layer with different projection; attempting reprojection: " + axMap1.get_LayerName(e.layerHandle)); } void axMap1_LayerReprojected(object sender, AxMapWinGIS._DMapEvents_LayerReprojectedEvent e) { Debug.Print("Reprojection results: " + e.success); }