/// <summary> /// returns a random VectorStyle with symbols. /// </summary> /// <returns></returns> public IVectorStyle RandomVectorStyle() { IVectorStyle vs = RandomStyle.RandomVectorStyleNoSymbols(); vs.Symbol = RandomSymbol(); return(vs); }
/// <summary> /// little util wich just adds one vector layer to the map and assigns it a random theme. /// </summary> /// <param name="context"></param> /// <param name="m"></param> public static void SetupMap(HttpContext context, Map m) { var l = new VectorLayer( "Countries", new ShapeFile(context.Server.MapPath(ConfigurationManager.AppSettings["shpfilePath"]))); l.Style = RandomStyle.RandomVectorStyleNoSymbols(); l.Theme = new CustomTheme <IVectorStyle>( delegate { return(RandomStyle.RandomVectorStyleNoSymbols()); }); m.Layers.Add(l); FeatureDataTable labelData = new FeatureDataTable(); labelData.Columns.Add("Name", typeof(string)); FeatureDataRow r = labelData.NewRow(); r["Name"] = "My Lair"; r.Geometry = new Point(5, 5); labelData.AddRow(r); LabelLayer labelLayer = new LabelLayer("labelLayer") { DataSource = new GeometryFeatureProvider(labelData), Enabled = true, LabelColumn = "Name", Style = new LabelStyle { BackColor = new SolidBrush(Color.Black), ForeColor = Color.White, Halo = new Pen(Color.Yellow, 0.1F), CollisionDetection = false, Font = new Font("Arial", 10, GraphicsUnit.Point) } }; m.Layers.Add(labelLayer); }