Tuesday, 9 October 2012

New mg-desktop binaries

Coinciding with the recently released MapGuide Open Source 2.4, is a new release of mg-desktop.

This release "solves" the one remaining shortcoming of mg-desktop: The inability to display tiled maps. It turns out that in the process of wracking my brain trying to figure out how to fetch the required tiles given our current view extents and then stitch the resulting image together that I've sort of lost sight of the overall objective.

Ultimately, we just want to see the image of a map with tiled layers (don't we?). We don't necessarily have to do things exactly as how the AJAX and Fusion viewers do it if this is our main objective (which it is)

So in this respect, the solution has been sitting in front of me all this time. Simply use the RenderMap API, instead of RenderDynamicOverlay, as RenderMap includes the tiled layers as part of the final image at the small cost of  the background color being pre-filled into the image, making the resulting map image fully opaque, and making the pre-rendering hook feature of the viewer useless as the map image will completely obscure whatever custom rendering you've done beforehand. Still, this is not the ideal solution (hence the "solves" in quotes) as we should really be using the Tile Service APIs to do this, but is one that is workable for now.

There are some new viewer properties to control this behaviour. All the relevant properties are listed here:

  • ConvertTiledGroupsToNonTiled - This is the existing viewer property that will convert all tiled layers in the map to dynamic ones, allowing these layers to be visible under default viewer parameters. This property remains for compatibility purposes.
  • UseRenderMapIfTiledLayersExists - This is a new viewer property that will instruct the viewer to use the RenderMap API instead of RenderDynamicOverlay, if and only if the map contains tiled layers. If you have no need to do pre-map rendering, this is the property you should be setting to true
  • RespectFiniteDisplayScales - This is a new viewer property that will make all zooms "snap" to the nearest finite display scale in the runtime map, just like it does in the AJAX and Fusion viewers.
Because we can now finally view tiled maps, the legend component has been updated to properly omit checkboxes for such layers

The second major change is that this release marks the first availability of mg-desktop in 64-bit. However, this will only be available for the .net 4.0 (VC10) build of mg-desktop. The .net 2.0 (VC9) build will remain 32-bit. For the .net 4.0 builds of mg-desktop in this release, we are using the same dlls as the official release of MapGuide Open Source 2.4 as the build process to make the MGOS 2.4 installer also made this release of mg-desktop. The only difference to note is that the .net assemblies in mg-desktop are signed whereas the ones in MapGuide Open Source 2.4 are not.

On the nuget front, we've tweaked the structure of the nuget packages, which I'll go into more detail in a future dedicated post (as it relates to the release of MapGuide Open Source 2.4 as well). The brief gist for this post is that the CS-Map coordinate system dictionaries is now an optional content-only nuget package that you need to install in addition to the mg-desktop nuget package if you require these files. Also the nuget packages are split off into x86 and x64 variants. So be sure to install the package that matches the bitness of your application.

Finally, there are also several performance improvements to improve startup time. You can find all the gory details in the changelog.txt that's now included with the zip distributions and nuget packages.

Having addressed the tiled map issue, this will probably be the last significant release of mg-desktop for a while. But should there be any new developments in mg-desktop, you'll be the first to hear it right here.

No comments: