Out of curiosity, is there any Legend or Preview support built-in? It would be a handy feature to have and before I potentially 're-invent the wheel' I just wanted to make sure this wasn't already there.
Thanks,
Nelson
Out of curiosity, is there any Legend or Preview support built-in? It would be a handy feature to have and before I potentially 're-invent the wheel' I just wanted to make sure this wasn't already there.
Thanks,
Nelson
Nelson,
The “wheel” is not invented for now. :) We will properly build in the Legend in the future release. Could you let me know more about what the “Preview Support” means? I’m not very sure about that.
Thanks,
Ben
By preview support I also meant the legend. I have seen the line types referred to as previews in some applications but legend is generally a better way to refer to it.
Thanks, Ben
I see, thanks to let me know.
Any news on when this will be implemented?
Or, can someone who has built their own legend tell me how they went about it?
Thanks,
Shan
Essentially it ranges from not so bad to a real project. Mine was on the “real project” side. Basically for the point, line, and area style there is a .DrawSample sub routine that can be used. It accepts an Input of canvas which is essentially a GdiPlusGeoCanvas if you aren’t getting too creative. If you work with that you can generate a bitmap of a sample of the style. It’s up to you at that point how to implement it, which then becomes the “project”.
I hope that helps.
Thanks for sharing Nelson!
Shannaka,
Here just some codes explaining what Nelson means.
// Draw a PointStyle to a 100*100 bitMap
GdiPlusGeoCanvas gdiPlusGeoCanvas = new GdiPlusGeoCanvas();
Bitmap bitMap = new Bitmap(100, 100);
// As DrawSample() will just draw the style at the center of the canvas, it doesn't matter
// if we pass in a blank rectangleShape as world extent and Unknown as the Geography Unit.
// For almost all the other cases though, we need to specify the world extent and geography unit
gdiPlusGeoCanvas.BeginDrawing(bitMap, new RectangleShape(), GeographyUnit.Unknown);
PointStyle pointStyle = PointStyles.Capital1;
// You can also call pointStyle.Draw to draw it on a specific place
pointStyle.DrawSample(gdiPlusGeoCanvas);
gdiPlusGeoCanvas.EndDrawing();
// Save to disk and have a look at the result
bitMap.Save("c:\\test.bmp");
Also if you want to draw the legend directly on the map, you can create your own AdormentLayer and override the DrawCore method, do the drawing there.
class LegendAdormentLayer : AdornmentLayer
{
protected override void DrawCore(GeoCanvas canvas, Collection<SimpleCandidate> labelsInAllLayers)
{
// Draw the legend here.
}
}
Thanks,
Ben