Using outline when drawing a point

Topics: SharpMap v2.0
Nov 10, 2011 at 11:17 AM

Hi all!

Having trouble getting an outline when drawing a point.

This is my code:

VectorStyle style = new VectorStyle();
                    style.PointColor = this.colorAscending;
                    style.PointSize = pointSize;
                    style.EnableOutline = true;
                    style.Outline = new Pen(Color.YellowGreen, 20f);
                    return style;


...am I missing something?

Coordinator
Nov 10, 2011 at 12:22 PM

Enable Outline applies to lineal geometries only.

You can always render your however fancy symbol beforehand and assign it to the Symbol property of your vector style.

Or you try to setup a PointSymbolizer (see SharpMap.Rendering.Symbolizer namespace and ExampleCodeSnipplets project for samples)

Hth FObermaier

Nov 10, 2011 at 12:29 PM
Edited Nov 10, 2011 at 12:49 PM

@FObermaier - Ok thanks!

EDIT:

I ended up using a PointSymbolizer:

VectorStyle style = new VectorStyle();
style.PointSymbolizer = SharpMap.Rendering.Symbolizer.PathPointSymbolizer.CreateCircle(new Pen(Color.White, 1f), this.colorAscending, pointSize);
                    return style;

Worked perfect :)

/Claus


May 6, 2014 at 12:07 PM
Hi !.

How can I do that in Sharpmap 0.9?. I can't find SharpMap.Rendering.Symbolizer.

I just need to draw some points with differents colors. I read something about using Symbol propertie in the VectorLayer Style, but I couldn't create the Bitmap.

My code in Sharpmap 1.1.0:
SharpMap.Styles.VectorStyle style = new SharpMap.Styles.VectorStyle();
style.PointSymbolizer = SharpMap.Rendering.Symbolizer.PathPointSymbolizer.CreateCircle(new Pen(layer.OutlineColor.HasValue ? layer.OutlineColor.Value : Color.Transparent, 1), new SolidBrush(layer.BackgroundColor.HasValue ? layer.BackgroundColor.Value : Color.Transparent), 5f);
How can I do that in Sharpmap 0.9 ?.
Coordinator
May 6, 2014 at 3:56 PM
var bmp = new System.Drawing.Bitmap(24, 24);
using(var g = System.Drawing.Graphics.FromBitmap(bmp))
{
    g.DrawEllipse(Pens.Red, ....)
    g.FillEllipse(Brushes.Black, ....)
}
May 6, 2014 at 4:55 PM
Thanks FObermaier!. It's worked perfect.