Wednesday, 9 May 2012

A big shout out

Since Maestro 3.0, the user interface that you have seen was done that way because my favourite WinForms docking library DockPanelSuite was riddled with P/Invokes into Win32, rendering the library un-usable on Mono. We use this library in FDO Toolbox because the FDO .net wrapper was already windows-only so we could get away with it, but not for Maestro.

So as a result, I had no choice but to hack my own clunky pseudo-docking library that is driven by SplitContainers and TabControls. This worked to an extent, but as it turns out, those weird and crazy display problems with the Layer Definition editor (you've probably experienced it. Just try resizing the main window) is the result of bugs caused by this combination. The suggested solution in that link didn't work for me btw.

Rather than try to bolt on some bandaids to an already hacky UI which turns out to be composed of 2 components that don't like each other, I thought I'd take another look to see if there has been any effort to get DockPanelSuite working on Mono. Lo and behind, there was a saviour!

Mr Lex Li has made a patched version of DockPanelSuite with the offending P/Invokes patched out for Mono. What do we lose with these patched out P/Invoke calls? According to Lex, we lose the ability to drag and drop Dock Windows around to different areas of the main window. And you know what? We don't even use that feature! So I had to take a look at this patched DockPanelSuite.

10 minutes of UI refactoring later and behold! The new Maestro 5.0 main window!


And more importantly, here's how it looks on Mono (in Ubuntu)


The only problem I get on Mono at the moment is this big stack dump vomit from DockPanelSuite when Maestro exits, but it looks like a problem that can be worked around.

So a big shout out goes to Lex Li for finally making my original UI plans possible!

Tuesday, 1 May 2012

New mg-desktop binaries

It's been a while, but I've just uploaded some new mg-desktop binaries with some new features worthy of a new blog post.

More Controls


The Map Viewer library (OSGeo.MapGuide.Viewer.dll) has been fitted with some extra user controls which should look familiar to what you've used in the AJAX and Fusion web viewers.

Measure

The MgLineMeasureControl allows you to perform distance-based measurements by tracing the segments you wish to measure on the map. The updated MapViewerTest application demonstrates usage of this control.





Buffer

The MgBufferControl functions exactly like its AJAX and Fusion counterparts. Nothing more to say. If you've used the buffer tool in the AJAX and Fusion viewers, this control is exactly the same.



Query

The MgQueryControl is similar to the AJAX and Fusion counterpart.



The difference is that query results are displayed in a new window, with full data grid display of all attributes.



Zooming and Selection can work on multiple rows in the query result grid. Clicking zoom with multiple selected results will zoom to the aggregate bounding box of the selected features. Clicking select will replace the current map selection with your selected query results.

Profiling Support

This release of mg-desktop also merges the new Profiling feature in MapGuide Open Source 2.4 / AIMS 2013. The MapViewerTest application includes a Profile command which displays the same XML content for profiling results as the Site Administrator.


For this release (and future ones). I'll be putting up 2 flavours of mg-desktop:

  • One that targets .net Framework 2.0 and requires the Visual C++ 2008 redistributable
  • One that targets .net Framework 4.0 and requires the Visual C++ 2010 redistributable
This way you can choose the one that best matches your existing code and libraries, because not everyone is (or can be) on the latest and greatest framework/compiler.


Download mg-desktop

Sunday, 29 April 2012

About that Ubuntu support ...

When I announced the availability of the MapGuide Open Source 2.4 preview, it included Ubuntu 11.10 as a working platform.

You might be wondering if these same binaries also work with the just released Ubuntu 12.04 (Precise Pangolin). Well ...


Yes it does!

Friday, 27 April 2012

MapGuide Open Source 2.4: A comprehensive preview (part 1: The installer)

It's been a long time since the last official release of MapGuide Open Source. So I'd figure I start getting the wheels in motion by announcing the availability of a preview release of MapGuide Open Source 2.4.

Why preview release instead of something more official like a beta? Well there has been lots of changes on the installer front (which I am mostly covering for this post), so a preview release ensures that our installer changes are locked down and stable for the eventual beta/RC/final releases that follow. It'd be a bit embarrassing to release a beta with fubar installers now wouldn't it?

Windows Installer Changes

The installer changes were driven by the following changes since 2.2:

Because of these changes, the installer now requires the following pre-requisites:
Just like with previous .net versions. If you are using IIS configuration with .net, you must install the .net Framework 4.0 (and register ASP.net with IIS) before you run the installer.

If you are using IIS configuration, you must have FastCGI enabled/installed before you run the installer.

The installer will tell you of this important fact before you proceed regardless:



The old PostGIS FDO provider is no longer bundled with 2.4. You should all be using the PostgreSQL FDO provider now, because with 2.4 this will be your only choice.



We've had concerns from users about the new SVN metadata feature being potentially mandatory. Well you can disable it if you so please.



For 2.4, we've also given much thought to making MapGuide more friendly and accessible to new developers, so in this respect we've bundled the following samples with the installer:
  • .net Viewer Sample*
  • PHP Viewer Sample*
  • Java Viewer Sample*
  • .net Developer's Guide Samples*+
  • PHP Developer's Guide Samples*+
  • Java Developer's Guide Samples*+^


Also long missing since the 2.0.2 release, the MapGuide Developer's Guide is back! This time, in HTML form with lots of updated content (with updated API usage (and more .net/Java examples!) and also covering Fusion, OpenLayers and a bit of Maestro API).



New Windows Deployment Option: MgInstantSetup

Is the windows installer too restrictive for you? Want side-by-side installs of MapGuide with minimal configuration disruption and conflicts? For 2.4, we've also included a new zip distribution with the MgInstantSetup utility bundled in.

The zip basically contains the build output before it is packaged up into an msi, so it has a whole bunch of configuration files with templated placeholder tokens, which the MgInstantSetup utility will help fill the values in for you.


This utility does not make any registry settings and presuming you've filled in the values correctly will not result in conflicting services, virtual directories or port numbers.

Ubuntu Installer Changes

What's this? An improved installer experience for Ubuntu as well? See for yourself:



Based on your choice of FDO providers, the matching debs will be installed and the matching XML fragments will be put into providers.xml

Granted, that's all you will get in terms of interactivity and customization at the moment, but anything that makes installation more flexible is a good thing. Not full apt-get flexible, but small baby steps.

Stay tuned for Part 2, where I talk about the meat and potatoes: The new features.


* All these samples require the Sheboygan sample dataset to be loaded first before you can run them.

+ To run these samples you will have to load the respective MGP file found in the root directories of each of these samples.

^ You may notice that the Java Developer's Guide samples do not cover the whole API like the .net and PHP ones. For now, you should just take a look at the .net one given the syntactic similarity to Java.

Monday, 2 April 2012

Finally!

After 4 years, 8 Ubuntu releases and 2785823943 failed attempts to build the damn thing ...



Through meticulous trial and error, I've compiled a list of notes, gotchas and other miscellany needed to compile MapGuide Open Source 2.4 on Ubuntu 11.10, which will probably be the topic of a near-future blog post. For now, it's time to wipe the VM and start again. Just to be sure I wasn't lucky the first time round.

Friday, 17 February 2012

Scripting and Automating Maestro

Know some Python?

Want to build or customize functionality?

Included with the next release of Maestro, is the IronPython scripting engine, allowing you to script and automate the Maestro application.



A new IronPython Console tab appears the bottom. This is an interactive REPL console that lets you try and experiment with assorted pieces of python code. The whole .net framework libraries (and the Maestro API) are available for use from within the IronPython console.

Unfortunately, there are some .net concepts that do not translate cleanly or at all to Python. One major case is generics. A fair bit of the Maestro Application Services API (the internal API that's built on top of SharpDevelop Core) which drives most of the Maestro application and its addins uses generics. So trying to expose this API in its current form to IronPython would be clunky.

So to rectify this problem, a new Host Application class is being introduced which is accessible via the "app" global variable from the IronPython console. This class provides common functions for interacting with the application itself. For example, this code gets the names of the currently open connections:

connNames = app.GetConnectionNames()

Which we can then use to get the matching connection

conn = app.GetConnection(connNames[0])

"app" is the Host Application object I already mentioned. "conn" is the IServerConnection from the Maestro API. Given that this interface is the root interface of the Maestro API, you can now do any of the things you can do in the Maestro API as you would from a normal .net language.

So fetching a resource is now simply

resXml = app.GetResourceXml(conn, "Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition")

Or the long way

import clr
clr.AddReference("OSGeo.MapGuide.MaestroAPI")
from OSGeo.MapGuide.MaestroAPI import ResourceTypeRegistry
res = conn.ResourceService.GetResource("Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition")
resXml = ResourceTypeRegistry.SerializeAsString(res)

You can inspect these variables in two ways:

  1. Reflecting on the variable via the refl command (or reflw to display the result in a new window)
  2. Printing the actual variable value via the print command (or printw to display the result in a new window)
So reflecting the "resXml" variable (reflw resXml) looks like this:



While printing the "resXml" variable (printw resXml) looks like this:




So here's a taste of what you can do with the new scripting capabilities. I'm sure there's some scenarios where scripting would prove to be invaluable for automation and improving productivity.

Many thanks to Joe Socoloski's MIT-licensed IronTextBox for the backbone of this new feature.

Sunday, 12 February 2012

Viewing content changes in Maestro

Ever wondered what the * on that tab actually represents?


With the next release of Maestro, now you can actually find out


The View Changes command lets you see the XML content changes of the currently edited resource


You also have the opportunity to view the XML diff when you try to close an editor tab with unsaved changes



Now those of you with a keen eye may notice some false positives in the first 2 lines.
  • The XML prolog is missing the encoding attribute
  • The root element has its attributes specified in a different order.
It means our XML serialization code is somewhat imperfect, something that I wouldn't have known without a tool like this. Nevertheless, this new tool will let you make a more informed decision when you need to save a modified resource.

Many thanks to Michael Potter for the public domain implementation of the .net diff engine and UI which is the backbone of this new feature.