OK, after a few days researching finally i solved my own question, and i'm going to share it for others!
First of all, sharpmap doesn't have a built in functionality to show the direction of streets, so we have to style the roads!
for drawing a small arrow on the roads you should use LineSymbolizer of vactor Style.
below is the code i have written to do this:
VectorStyle style = new VectorStyle();
var cls = new SharpMap.Rendering.Symbolizer.CachedLineSymbolizer();
//styling the road
cls.LineSymbolizeHandlers.Add(new SharpMap.Rendering.Symbolizer.PlainLineSymbolizeHandler { Line = new System.Drawing.Pen(Color.Gold, 3) });
//drawing the arrow
var wls = new SharpMap.Rendering.Symbolizer.WarpedLineSymbolizeHander
{
Pattern = getArrowedLine(),
Line = new System.Drawing.Pen(System.Drawing.Color.Gray, 2),
Interval = 70
};
cls.LineSymbolizeHandlers.Add(wls);
cls.ImmediateMode = true;
style.LineSymbolizer = cls;
and the getArrowdLine function:
private GraphicsPath getArrowedLine()
{
//creating the Arrow graphics like this ->
var gp = new GraphicsPath();
gp.AddLine(5, 2, 7, 0); // \
gp.AddLine(0, 0, 7, 0); // -----
gp.AddLine(5, -2, 7, 0);// /
//if you dont close the figure you will have continuesly arrows like this ->->->->->
//but if you close it, depend on interval you will have -> -> ->
gp.CloseFigure();
return gp;
}
I am surprised why sharpmap did not implement ArrowedLine (which is commonly used in maps) in their WarpedLineSymbolizer class!!!
Best Answer
You don't need to dissolve lines by name, as you can use the Merge connected lines to avoid duplicate labels option in the Rendering tab of Labels' options. This will reduce the number of labels, and helps to render long strings for roads composed from small segments.
There is also an option to add some extra characters to your labels to show the line direction. This option is in the Formatting tab of the Labels's option. Check for the Line direction symbol.