Is it possible to create LineStyle with a border when Line is with dashes?
Line borders
Thanks you for your post.
Yes it's possible to create a line style with a variety of different dash patterns. The easiest way is to set the DashStyle property on the geopen you are using in your linestyle. Here is a list of the different types of dashes Map Suite supports out of the box.
wiki.thinkgeo.com/wiki/Think...eDashStyle
Here is some sample code that shows how to set the Dash Style.
myLineStyle.CenterPen.DashStyle = LineDashStyle.Dash;
myLineStyle.OuterPen.DashStyle = LineDashStyle.Dash;
myLineStyle.InnerPen.DashStyle = LineDashStyle.Dash;
If these Dash Styles aren't what you are looking for you can also create your own Dash Pattern and have the map control render it however you like. For for more information check out:
wiki.thinkgeo.com/wiki/Think...ashPattern
Yes, but I want that all dashes would be with border color, for example white dashes with black border.
I get it like this, but its bad
In that case you would leave your outerpen alone and just set the dash style on the Inner or Center pen. You can set the color and pattern for each geopen however you like so this would give you the result of a Black Border with a white dash going down the center of it.
I do it like this:
LineStyle ls = new LineStyle();
GeoPen InnerPen = new GeoPen(new GeoColor(255, GeoColor.SimpleColors.Black), 3);
InnerPen.DashPattern.Add(5);
InnerPen.DashPattern.Add(5);
ls.InnerPen = InnerPen;
GeoPen CenterPen = new GeoPen(new GeoColor(255, GeoColor.SimpleColors.Blue), 5);
CenterPen.DashPattern.Add(5);
CenterPen.DashPattern.Add(5);
ls.CenterPen = CenterPen;
And get this:
And I want it to be like this:
How to fix my code?
Having two different colors and spacing between the dashes is causing some issues using the regular line style. What I would recommend in this scenario if you need to look exactly like your image is to build a custom style. That way you have full control over everything and there is no magic happening on the dash pattern.
There are some samples on the wiki for building custom styles and a video as well I believe.
Thanks!
I use custom style but in DrawCore() function I call ls.Draw(...) so its draw bad, I dont know how to make my own Draw function.
The DrawCore is where you will put your code in your custom style. I would recommend you watch the video and presentation named "Extending Map Suite: Creating Custom Styles" at the following link:
gis.thinkgeo.com/Products/GI...fault.aspx
It will walk you though the steps of creating your own custom style.
Thanks!