/// <summary> /// Extracts style information. /// </summary> /// <param name="text"></param> /// <param name="layer"></param> /// <returns></returns> public static Text2DStyle From(Text2D text, int layer) { Text2DStyle newStyle = new Text2DStyle(); newStyle.Color = text.Color; newStyle.MaxZoom = text.MaxZoom; newStyle.MinZoom = text.MinZoom; newStyle.HaloColor = text.HaloColor; newStyle.HaloRadius = text.HaloRadius; newStyle.Size = text.Size; newStyle.Layer = layer; newStyle.Font = text.Font; return newStyle; }
/// <summary> /// Sets style information. /// </summary> /// <param name="text"></param> public void Set(Text2D text) { text.MaxZoom = this.MaxZoom; text.MinZoom = this.MinZoom; text.HaloColor = this.HaloColor; text.HaloRadius = this.HaloRadius; text.Size = this.Size; text.Font = this.Font; }
/// <summary> /// Adds a new style and returns it's index. /// </summary> /// <param name="text"></param> /// <param name="layer"></param> /// <returns></returns> public ushort AddStyle(Text2D text, int layer) { Text2DStyle newStyle = Text2DStyle.From(text, layer); int indexOf = this.TextStyles.IndexOf(newStyle); if (indexOf < 0) { // the style is not found yet. indexOf = this.TextStyles.Count; this.TextStyles.Add(newStyle); } return (ushort)indexOf; }