Friday, 31 August 2012

New mg-desktop binaries

(I think I'm just going to stick with this title from now on. Thinking up new blog titles for every significant mg-desktop announcement is just too hard :D)

So yeah, I've put up a new release of mg-desktop in .net 2.0 and .net 4.0 flavors. Before you go ahead and download the files and compile against this release, be prepared to fix a lot of compiler errors for your existing code, because there is a grand-sweeping API change across the board:

  • All classes^ in the mg-desktop API are now prefixed with "Mgd" instead of "Mg"
The reason for this breaking change is two fold:
  1. Consistency. If a class begins with "Mgd", you know it's a class from mg-desktop.
  2. This opens up the possibility of building applications that works against both mg-desktop and the official MapGuide API without the risk of conflicts due to naming collisions.  
So with that out of the way, this release is mainly performance-focused, with improvements in several areas:
  • We keep cached copies of resource contents in memory to avoid hitting the hard disk for each GetResourceContent() call. These cached copies are flushed out anytime a SetResource() call is made with a matching resource id.
  • The legend component now caches layer icons and other assorted information, to reduce the unnecessary extra fetching of Layer Definition documents
  • The legend component now constructs the layer and group nodes in a background thread, and are added to the tree afterwards in a single batch. No more clogging up the UI.
  • The viewer's tooltip behaviour now matches what you see in the AJAX and Fusion viewers. That is, the tooltip query is delayed, and will only get dispatched if there is no significant mouse pointer movement within the delay interval (configurable via a new TooltipDelayInterval viewer property). The viewer no longer fires off a new tooltip query on even the most minute of differences in mouse pointer positions.
  • Tooltip and selection behaviour now goes through the QueryMapFeatures API, instead of our own custom implementation, which was previously needed as QueryMapFeatures was not ported over to mg-desktop yet. This is just another case of keeping mg-desktop as close to the MapGuide Server as possible in terms of behaviour.
This release also now exposes pre and post map rendering events in the map viewer control. You can hook in custom rendering behavior before or after the map images is rendered onto the control as part of its paint routine. The sample AppLayout extension now includes a Pre/Post rendering sample that demonstrates rendering underlay and overlay text.

Also, I've not only updated the previously blogged sample code demonstrating mg-desktop, but these samples are now also included in the zip distribution with dead simple build instructions. No need to setup any complex post-build steps or things like that. That's all been done for you in the sample code projects. All you have to do is just drop the mg-desktop files into the expected directory and the samples will build without issues.

Unfortunately, I did want to be able to also say that the .net 4.0 build of mg-desktop is now also available as a NuGet package. But the NuGet gallery doesn't seem to like the size of my mg-desktop NuGet package (38MB) that I've tried to repeatedly upload with no success :-( Does anyone who's versed in NuGet know if packages of such sizes are even allowed? I don't think I can cut down the package size significantly without gimping some of the functionality. Any ideas? I'm all ears.

^ This does not cover the classes in the Map Viewer library. Only classes in OSGeo.MapGuide.Desktop.dll assembly are affected.


Tom Weir said...

It would appear ( ) that the max size of 30MB is a server-side limit.

You might want to try breaking the package into two parts with a dependency between the two.

Jackie Ng said...

Yeah, it looks that way. I guess I have no other choice.

Now to figure out a way to slice and dice this package without the individual parts being useless