Quantcast
Viewing all articles
Browse latest Browse all 2341

Updated Wiki: NotesVersion493

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. 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. Building from source.
MapWinGIS is now much easier to build from source. Basically you need to checkout trunk version of the code from the repository with TortoriseSvn or other SVN client and download precompiled GDAL SDK (about 40MB). That's it provided that you have VS2010 or higher with C++ installed. It's quite realistic to start debugging your own app after spending only half an hour on preparations. There are no hard-coded paths or huge dependencies like it was before. Some project settings were optimized so complete rebuild now takes around 30 seconds compared to 2 minutes just a year ago. Built-in wizards for adding API members to COM interfaces are working once again. All in all it's not particularly difficult to debug / fix / add some functionality even for people with little knowledge of C++/COM, bear in mind this option. Check building instructions. To start debugging your app set its path in Project -> Properties -> Debugging -> Command.

Viewing all articles
Browse latest Browse all 2341

Trending Articles



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