Are there any examples showing how to do custom line styles? I have a railroad layer that I would like to look similar to the railway1 or railway2 GeoStyle, but I want the color to be blue. Is this possible?
Are there any examples showing how to do custom line styles? I have a railroad layer that I would like to look similar to the railway1 or railway2 GeoStyle, but I want the color to be blue. Is this possible?
Hi Serena,
Thanks for the posts, I guess you can try the code as following to create a similar railway line style, please check it out:
private static LineStyle CreateRailWayLineStyle()
{
// parameters
GeoColor innerColor = GeoColor.SimpleColors.White;
float innerWidth = 3f;
GeoColor outerColor = GeoColor.SimpleColors.Black;
float outerWidth = 5f;
GeoColor centerColor = GeoColor.SimpleColors.Orange;
float centerWidth = 8f;
float centerDashPattern1 = 1f;
float centerDashpattern2 = 4f;
// generate
LineStyle lineStyle = new LineStyle();
lineStyle.InnerPen = new GeoPen(innerColor, innerWidth);
lineStyle.OuterPen = new GeoPen(outerColor, outerWidth);
lineStyle.CenterPen = new GeoPen(centerColor, centerWidth);
lineStyle.CenterPen.DashPattern.Add(centerDashPattern1);
lineStyle.CenterPen.DashPattern.Add(centerDashpattern2);
return lineStyle;
}
Thanks,
Johnny
Then how to user LineStyle CreateRailWayLineStyle() ?
Hi Tran,
Please view our samples for the detail.
Normally you should want to set the LineStyle which generated by CreateRailWayLineStyle function to yourlayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle.
Regards,
Don