public static C1.Win.Map.VectorLayer LoadShpFile(string shpFile, string dbfFile, ProcessVectorItem processVector) { using (var shpStream = OpenFile(shpFile)) using (var dbfStream = OpenFile(dbfFile)) { var records = ShapeReader.Read(shpStream, dbfStream); var items = records.Select(record => { var vector = CreateVector(record); if (vector != null && processVector != null) { processVector(vector, record.Data); } return(vector); }); var layer = new C1.Win.Map.VectorLayer(); foreach (var item in items) { layer.Items.Add(item); } return(layer); } }
protected override void InitMap() { base.InitMap(); c1Map1.Viewport.Zoom = 1; _layer = new C1.Win.Map.VectorLayer(); c1Map1.Layers.Add(_layer); c1Map1.MouseUp += c1Map1_MouseUp; c1Map1.MouseDown += c1Map1_MouseDown; c1Map1.MouseMove += c1Map1_MouseMove; for (var i = 0; i < 10; i++) { AddMark(-80 + _rnd.Next(160), -80 + _rnd.Next(160)); } }
public static C1.Win.Map.VectorLayer LoadKmlFile(string filePath, ProcessVectorItem processVector) { using (var kmlStream = OpenFile(filePath)) { var records = KmlReader.Read(kmlStream); var items = records.Select(record => { var vector = CreateVector(record); if (vector != null && processVector != null) { processVector(vector, record.Data); } return(vector); }); var layer = new C1.Win.Map.VectorLayer(); foreach (var item in items) { layer.Items.Add(item); } return(layer); } }