SharpMapV0.9 to V2 Merging Issues

Topics: SharpMap v2.0
Jun 9, 2011 at 2:25 PM
Edited Jun 9, 2011 at 2:26 PM

Which class or construct can be used to replace a BoundingBox?

Jun 9, 2011 at 3:02 PM


Hth FObermaier

Jun 14, 2011 at 8:53 AM
Edited Jun 14, 2011 at 9:00 AM

I used to override the Render method of a layer to draw a legend on top of the layer.. How can I do this in V2?

Jun 15, 2011 at 7:46 AM

here is what I did:

First I added to a namespace SharpMap.Rendering.Decorations

public interface IMapDecoration
        /// <summary>
        /// Name of the map decoration
        /// </summary>
        String Name { get; }

        /// <summary>
        /// The bounds of the map decoration
        /// </summary>
        Rectangle2D Bounds { get; }

        /// <summary>
        /// The location of the map decoration
        /// </summary>
        Point2D Location { get; set; }

        /// <summary>
        /// The size of the map decoration
        /// </summary>
        Size2D Size { get; set; }

        /// <summary>
        /// Value indicating whether the Decoration should be displayed or not
        /// </summary>
        Boolean Enabled { get; set; }


and some implementations (Legend, NorthArrow)

2nd I added a MapDecorationRenderer class that is responsible for creating render objects (see BasicGeometryRenderer'2) and registered that to the renderer cache

3rd I added a wired the MapDecorationRendering mechanism to the MapPresenter

  • RenderAllMapDecorations();
  • RenderMapDecoration();
  • OnMapDecorationsRendering();
  • OnMapDecorationRendering();
  • OnMapDecorationRendered();
  • OnMapDecorationsRendered();

I need to cleanup the code before I can add it.

For the time being it may be sufficient if you override OnRenderedAllLayers for the MapPresenter in Presentation.WinForms and add some GdiRenderObjects viw ViewControl.ShowRenderedObjects(IEnumerable<GdiRenderObject>);