For most users, the GETLEGENDIMAGE operation in MapGuide is usually for constructing the icons you see in the legend, like so:
But if you look beyond the 16x16 pixel box, you will find (like I just did) that this operation is an ideal way to "preview" a given style rule for a Layer Definition.
So much so, that the next beta of Maestro 5.0 will now use GETLEGENDIMAGE for previews in all style editor dialogs (except for labels), replacing the existing "simulated" preview that used System.Drawing APIs to approximate what the resulting style would look like.
We say approximate, because MapGuide has dedicated components for Rendering and Stylization that would be painstaking to fully replicate with System.Drawing APIs. Remember that Maestro is a fully managed .net application, so we can't just tap into unmanaged libraries willy-nilly, unless the feature in question is deemed to be windows-only, like the Local Connection feature introduced in Maestro 4.0.
Take for example, a polygon style with a pre-defined pattern.
Or a line styles with composite lines, something where our simulated previewing mechanism definitely breaks down.
So GETLEGENDIMAGE can be trusted to show the correct style (which is sort of its intended purpose, now that I think of it), so we can now exploit this function for maximum payoff:
Previewing Symbol Definitions!
You don't have to house a reference to a Symbol Definition inside a Layer Definition in order to preview it. Symbol Definitions can now be previewed on their own!
Now things aren't fully rosy yet. The top level previews are still done with the imperfect System.Drawing method
And composite styles are still as meaningless as ever.
And things will probably stay that way for now. The reason is simple. If we wholesale replaced this method of previewing with the GETLEGENDIMAGE approach, each style rule in that Layer Definition would require a GETLEGENDIMAGE request to be sent.
And if we've learned anything about one of the main pain points of Fusion in the past, it's that a MapGuide Server doesn't like to be bombarded with 100s of GETLEGENDIMAGE requests at once. So we're sticking with the imperfect preview method for this case, on the assumption that if you want to see what the style really looks like, you would bring up the style editor dialog for that rule to see for yourself.
I may revisit this problem again in the future if we ever do get support for requesting a set of legend images in a single batch but until then, if you ever want to see the actual style, just simply fire up its style editor dialog.
Work Opportunity at Autodesk Support
6 days ago