private void lstLayers_SelectionChanged(object sender, SelectionChangedEventArgs e) { var selected = lstLayers.SelectedItem as LayerViewModel; grpLayer.IsEnabled = (selected != null); if (selected != null && selected is VectorLayerViewModel) { var vector = selected as VectorLayerViewModel; if (vector.Symbol != null) { var info = vector.Symbol.Tag as SymbolInfo; var control = new PointOptionsControl(info); control.ValuesChanged += ctl => { vector.Symbol = MapSymbolGenerator.GetSymbol(ctl); }; grpLayer.Content = control; } else { grpLayer.Content = new VectorOptionsControl(vector); } } else { grpLayer.Content = null; } }
public ILayer Create(string layerName, string connectionInfo) { var generator = new XYFileMapPointSetGenerator(connectionInfo); var points = generator.GeneratePoints(false); var table = new FeatureDataTable(); table.Columns.Add(new DataColumn("Label", typeof(string))); table.Columns.Add(new DataColumn("SiteID", typeof(int))); table.Columns.Add(new DataColumn("SiteVisitID", typeof(int))); table.Columns.Add(new DataColumn("MaterialID", typeof(int))); foreach (MapPoint mp in points) { var row = table.NewRow(); row.Geometry = new Point(mp.Longitude, mp.Latitude); row["Label"] = mp.Label; row["SiteID"] = mp.SiteID; row["SiteVisitID"] = mp.SiteVisitID; row["MaterialID"] = mp.MaterialID; table.AddRow(row); } string labelLayerName = string.Format("{0} Labels", points.Name); var shapeFileLayer = new VectorLayer(points.Name, new GeometryFeatureProvider(table)) { SmoothingMode = SmoothingMode.AntiAlias, Style = { Symbol = MapSymbolGenerator.GetSymbolForPointSet(points), PointSize = points.Size } }; return(shapeFileLayer); }