/// <summary> /// Extracts style information. /// </summary> /// <param name="line"></param> /// <returns></returns> public static Line2DStyle From(Line2D line, int layer) { Line2DStyle newStyle = new Line2DStyle(); newStyle.Color = line.Color; newStyle.Dashes = line.Dashes; newStyle.LineJoin = line.LineJoin; newStyle.MaxZoom = line.MaxZoom; newStyle.MinZoom = line.MinZoom; newStyle.Width = line.Width; newStyle.Layer = layer; return newStyle; }
/// <summary> /// Sets the style information. /// </summary> /// <param name="line"></param> public void Set(Line2D line) { line.Color = this.Color; line.Dashes = this.Dashes; line.LineJoin = this.LineJoin; line.MaxZoom = this.MaxZoom; line.MinZoom = this.MinZoom; line.Width = this.Width; }
/// <summary> /// Adds a new style and returns it's index. /// </summary> /// <param name="line"></param> /// <param name="layer"></param> /// <returns></returns> public ushort AddStyle(Line2D line, int layer) { Line2DStyle newStyle = Line2DStyle.From(line, layer); int indexOf = this.LineStyles.IndexOf(newStyle); if (indexOf < 0) { // the style is not found yet. indexOf = this.LineStyles.Count; this.LineStyles.Add(newStyle); } return (ushort)indexOf; }