using System; using System.Collections.Generic; using System.Linq; using System.Text; using ThinkGeo.MapSuite.Core; using System.Collections.ObjectModel; using System.Drawing; namespace ThinkGeo_CustomClassMethods.Classes { public class BlinkingTextStyle : TextStyle { private Collection candidates; string textColumnName1; GeoFont textFont1; GeoSolidBrush textSolidBrush1; GeoPen haloPen1; float xOffset1; float yOffset1; float rotateAngle1; public BlinkingTextStyle(string textColumnName, GeoFont textFont, GeoSolidBrush textSolidBrush,GeoPen haloPen, float xOffset, float yOffset, float rotateAngle) { textColumnName1 = textColumnName; textFont1 = textFont; textSolidBrush1 = textSolidBrush; haloPen1 = haloPen; xOffset1 = xOffset; yOffset1 = yOffset; rotateAngle1 = rotateAngle; candidates = new Collection(); } protected override void DrawCore(IEnumerable features, GeoCanvas canvas, System.Collections.ObjectModel.Collection labelsInThisLayer, System.Collections.ObjectModel.Collection labelsInAllLayers) { foreach (var feature in features) { PointShape location = (PointShape)feature.GetShape(); ScreenPointF locationInScreen = ExtentHelper.ToScreenCoordinate(canvas.CurrentWorldExtent, location, canvas.Width, canvas.Height); Collection textPathInScreen = new Collection { locationInScreen }; //canvas.DrawText(feature.ColumnValues["Name"], textFont1, GetFillBrush(), textPathInScreen, DrawingLevel); canvas.DrawText(feature.ColumnValues["Name"], textFont1, GetFillBrush(),haloPen1, textPathInScreen, DrawingLevel,xOffset1,yOffset1,rotateAngle1); } } public Collection FillBrushes { get { return candidates; } } private GeoBrush GetFillBrush() { Random random = new Random(); int index = random.Next(candidates.Count); return candidates[index]; } } }