private void gMapControl1_Load(object sender, EventArgs e) { gMapControl1.MapProvider = GoogleMapProvider.Instance; GMaps.Instance.Mode = AccessMode.ServerOnly; gMapControl1.SetPositionByKeywords("Cali, Colombia."); gMapControl1.ShowCenter = false; Random r = new Random(); for (int i = 0; i < program.GroupList.Count; i++) { Municipality s = program.Locat.MunicipalityList.Find(b => b.Name.Equals(program.GroupList.ElementAt(i).Municipality)); if (s == null) { // MessageBox.Show(program.GroupList.ElementAt(i).Municipality); } if (s != null) { double x = r.NextDouble() * (s.x1 - s.x2) + s.x2; double y = r.NextDouble() * (s.y1 - s.y2) + s.y2; //if (program.GroupList.ElementAt(i).Region.Equals("Centro Oriente")) // { GMapMarker marker = new GMarkerGoogle(new PointLatLng(y, x), GMarkerGoogleType.red_pushpin); markers.Markers.Add(marker); //} } } gMapControl1.Overlays.Add(markers); }
public void paintGMap_filter2(List <InvestigationGroup> ig_list, GMarkerGoogleType gmarker_type) { Random r = new Random(); List <InvestigationGroup> ig_municipalities = new List <InvestigationGroup>(); for (int i = 0; i < ig_list.Count(); i++) { Municipality s = program.Locat.MunicipalityList.Find(b => b.Name.Equals(ig_list.ElementAt(i).Municipality)); if (s == null) { MessageBox.Show(ig_list.ElementAt(i).Municipality); } else { double x = r.NextDouble() * (s.x1 - s.x2) + s.x2; double y = r.NextDouble() * (s.y1 - s.y2) + s.y2; GMapMarker marker = new GMarkerGoogle(new PointLatLng(y, x), gmarker_type); markers.Markers.Add(marker); } } }
public static List <Municipality> generarLocaciones() { List <Municipality> temporalList = new List <Municipality>(); try { StreamReader sr = new StreamReader(@"C:\Users\Sara\Source\Repos\GMaps-.NET\WindowsFormsApp1\WindowsFormsApp1\Datos\ubicacionesMunicipios.txt"); String line; int c = 0; while ((line = sr.ReadLine()) != null) { String[] atributos = line.Split(';'); String nombre = atributos[0]; String cooY1 = atributos[1]; String cooX1 = atributos[2]; String cooY2 = atributos[3]; String cooX2 = atributos[4]; Municipality mun = new Municipality(nombre, cooY1, cooX1, cooY2, cooX2); //Add element to the municipalityList temporalList.Add(mun); c++; } //MessageBox.Show(temporalList.Count()+""); sr.Close(); } catch (Exception e) { Console.WriteLine("Exception: " + e.Message); } return(temporalList); }