Mapsui: LineString with outline

Created on 25 Jul 2018  路  5Comments  路  Source: Mapsui/Mapsui

I try this :
feature = new Feature() {Geometry = new LineString(vertices)}
feature.Styles.Add(new VectorStyle
{
Line = { Color = Mapsui.Styles.Color.Red, Width = 4},
Fill = null,
Outline = { Color = Mapsui.Styles.Color.Black, Width = 3 }
});

But the outline it never display, I have the feeling this has not been implemented ...
What do you think ?

question

Most helpful comment

Ah, you want to really use this ;)

Than make it with a LineString, but with two VectorStyles like

````
feature.Styles.Add(new VectorStyle
{
Line = new Pen(Mapsui.Styles.Color.Black, lineWidth + 2 * 2),
});

feature.Styles.Add(new VectorStyle
{
Line = new Pen(color, lineWidth),
});
````

With this, the line is drawn two times: first with the outline color and a width of 2 pixel wider than the normal line and than on top of this the normal line with color and line width.

All 5 comments

That's correct. Lines don't have an outline. If you want to have an outline and a fill color, you should use polygons.

Thanks @charlenni but how I can transform my line to a "polygon line". I try it but it's not correct. I not get a line but some shape
IEnumerable vertices;
var feature = new Feature()
{
Geometry = new Polygon(new LinearRing(vertices))
};

feature.Styles.Add(new VectorStyle
{
Fill = new Brush(Mapsui.Styles.Color.Red),
Line = new Pen(color, lineWidth),
Outline = new Pen(Mapsui.Styles.Color.Black, 2)
});

How I can to do ?
Thanks

Ah, you want to really use this ;)

Than make it with a LineString, but with two VectorStyles like

````
feature.Styles.Add(new VectorStyle
{
Line = new Pen(Mapsui.Styles.Color.Black, lineWidth + 2 * 2),
});

feature.Styles.Add(new VectorStyle
{
Line = new Pen(color, lineWidth),
});
````

With this, the line is drawn two times: first with the outline color and a width of 2 pixel wider than the normal line and than on top of this the normal line with color and line width.

Thank you very much @charlenni, It's working :) !

Thank you for the feedback.

Could you than close this issue, please.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lukaszpitulski picture lukaszpitulski  路  8Comments

lukaszpitulski picture lukaszpitulski  路  3Comments

Kayumiy picture Kayumiy  路  9Comments

ricardoboss picture ricardoboss  路  5Comments

lukaszpitulski picture lukaszpitulski  路  3Comments