public void Test_Click(object sender, EventArgs e) { MapFunctions.Clear(gmap); GMapOverlay Heatmaps = new GMapOverlay("Heatmaps"); List <PointLatLng> schiebroek_points = new List <PointLatLng>(); MapFunctions.UpdateMap(gmap); }
private void PolygonErase_Click(object sender, EventArgs e) //clear all settings and polygon overlays { MapFunctions.Clear(gmap); Heatmaps.Clear(); foreach (int i in checkedListBox1.CheckedIndices) { checkedListBox1.SetItemCheckState(i, CheckState.Unchecked); } Deel.Checked = false; manual2.Checked = false; testbox.Checked = false; manualdeel.Checked = false; }
//The dropdown menu for year private void DropdownYear_SelectedIndexChanged(object sender, EventArgs e) { object LocationIndex = DropdownYear.SelectedItem; MapFunctions.Clear(gmap); if (DropdownCrime.SelectedIndex != -1 && DropdownYear.SelectedIndex != -1 && (manual2.Checked || manualdeel.Checked)) { AreaFunctions.DrawAreas(gmap, checkedListBox1, RotterdamInstance, testbox, Deel, manual2, manualdeel, Heatmaps, DictionairContainer.ChangeName(DropdownCrime.SelectedItem.ToString()), DropdownYear.SelectedItem.ToString()); } else if ((DropdownCrime.SelectedIndex != -1 && DropdownYear.SelectedIndex != -1)) { AreaFunctions.CheckAll(gmap, RotterdamInstance, testbox, Deel, Heatmaps, DictionairContainer.ChangeName(DropdownCrime.SelectedItem.ToString()), DropdownYear.SelectedItem.ToString()); } }
//The checklistbox where you can choose manual areas or manual borough private void checkedListBox1_SelectedIndexChanged(object sender, EventArgs e) { if (manual2.Checked == false && (testbox.Checked == false || testbox.Checked == true) && (Deel.Checked == false || Deel.Checked == true) && manualdeel.Checked == false) { if (checkedListBox1.CheckedIndices.Count > 0) { manual2.Checked = true; testbox.Checked = false; Deel.Checked = false; } } MapFunctions.Clear(gmap); AreaFunctions.DrawAreas(gmap, checkedListBox1, RotterdamInstance, testbox, Deel, manual2, manualdeel, Heatmaps, DictionairContainer.ChangeName(DropdownCrime.SelectedItem.ToString()), DropdownYear.SelectedItem.ToString()); }
//The all borough checkbox private void Deel_CheckedChanged(object sender, EventArgs e) { MapFunctions.Clear(gmap); Heatmaps.Clear(); if (Deel.Checked) { foreach (int i in checkedListBox1.CheckedIndices) { checkedListBox1.SetItemCheckState(i, CheckState.Unchecked); } manualdeel.Checked = false; manual2.Checked = false; testbox.Checked = false; AreaFunctions.CheckAll(gmap, RotterdamInstance, testbox, Deel, Heatmaps, DictionairContainer.ChangeName(DropdownCrime.SelectedItem.ToString()), DropdownYear.SelectedItem.ToString()); } }
//The manual area checkbox private void checkBox3_CheckedChanged_2(object sender, EventArgs e) { MapFunctions.Clear(gmap); Heatmaps.Clear(); if (manual2.Checked) { testbox.Checked = false; Deel.Checked = false; manualdeel.Checked = false; } else { foreach (int i in checkedListBox1.CheckedIndices) { checkedListBox1.SetItemCheckState(i, CheckState.Unchecked); } } }
//This function is used to select and draw all polygon with type 'Wijk' or 'Deelgemeente' at once. public static void CheckAll(NET.WindowsForms.GMapControl gmap, Rotterdam Rdam, CheckBox wijkbox, CheckBox deelgembox, GMapOverlay Heatmaps, string selectedTable, string Year) { //Clears the map beforehand MapFunctions.Clear(gmap); Heatmaps.Clear(); //If 'all areas' is selected. if (wijkbox.Checked) { //Checks every borough in the Rotterdam instance foreach (Borough gebied in Rdam.Deelgemeenten) { //Checks every polygon in the Rotterdam instance foreach (GMapPolygon polygon in Rdam.Polygons) { //If the polygon name is the name as the borough name and the type equals to "Wijk", add the polygon to the heatmap if (polygon.Name == gebied.Name && gebied.Type == "Wijk") { Heatmaps.Polygons.Add(addFill(polygon, gebied.Name, selectedTable, Year)); } } } } //else... else { foreach (Borough gebied in Rdam.Deelgemeenten) { string new_name = gebied.Name; foreach (GMapPolygon polygon in Rdam.Polygons) { if (polygon.Name == gebied.Name && gebied.Type == "Deelgemeente") { Heatmaps.Polygons.Add(addFill(polygon, gebied.Name, selectedTable, Year)); } } } } //Adds newly created Heatmaps, which contains all the added polygons to the gmap.Overlay gmap.Overlays.Add(Heatmaps); //Updates the map MapFunctions.UpdateMap(gmap); }
public static void Warp(NET.WindowsForms.GMapControl gmap, object item, Rotterdam Rdam, GMapOverlay Heatmaps, string selectedTable, string Year) //checks dropdown for selected area, and pans to its coords { object LocationIndex = item; MapFunctions.Clear(gmap); Heatmaps.Clear(); switch (Convert.ToString(LocationIndex)) { case "Charlois": MapFunctions.PanMapCoord(gmap, 51.88507425958, 4.47864532470703, 14); break; case "Delfshaven": MapFunctions.PanMapCoord(gmap, 51.9106025028462, 4.43856239318848, 13); break; case "Feijenoord": MapFunctions.PanMapCoord(gmap, 51.8986875968913, 4.50267791748047, 13); break; case "Schiebroek": MapFunctions.PanMapCoord(gmap, 51.9588652250502, 4.48688507080078, 13); break; case "Hoek_van_Holland": MapFunctions.PanMapCoord(gmap, 51.9681731085283, 4.16072845458984, 12); break; case "Hoogvliet": MapFunctions.PanMapCoord(gmap, 51.8669520608064, 4.36723709106445, 13); break; case "IJsselmonde": MapFunctions.PanMapCoord(gmap, 51.8883587884291, 4.54473495483398, 13); break; case "Kralingen": MapFunctions.PanMapCoord(gmap, 51.9287071072723, 4.51297760009766, 13); break; case "Noord": MapFunctions.PanMapCoord(gmap, 51.9337348683824, 4.46843147277832, 14); break; case "Overschie": MapFunctions.PanMapCoord(gmap, 51.9461695415817, 4.43881988525391, 13); break; case "Pernis": MapFunctions.PanMapCoord(gmap, 51.8876436292015, 4.38830852508545, 15); break; case "Prins_Alexander": MapFunctions.PanMapCoord(gmap, 51.9612452655421, 4.5428466796875, 14); break; case "Rozenburg": MapFunctions.PanMapCoord(gmap, 51.9186498950804, 4.22698974609375, 13); break; case "Stadscentrum": MapFunctions.PanMapCoord(gmap, 51.9162146522532, 4.47752952575684, 14); break; } foreach (Borough deelgemeente in Rdam.Deelgemeenten) { string new_check = item.ToString().ToLower(); foreach (GMapPolygon polygon in Rdam.Polygons) { if (deelgemeente.Name.Contains("2")) { string new_check2 = new_check + "2"; if (deelgemeente.InDeelgemeente == new_check2 && deelgemeente.Type == "Wijk" && item.ToString().ToLower() == deelgemeente.InDeelgemeente) { Heatmaps.Polygons.Add(AreaFunctions.addFill(deelgemeente.Polygon, deelgemeente.Name, selectedTable, Year)); } } if (deelgemeente.Name.Contains("1")) { string new_check1 = new_check + "1"; if (deelgemeente.InDeelgemeente == new_check1 && deelgemeente.Type == "Wijk" && item.ToString().ToLower() == deelgemeente.InDeelgemeente) { Heatmaps.Polygons.Add(AreaFunctions.addFill(deelgemeente.Polygon, deelgemeente.Name, selectedTable, Year)); } } if (item.ToString().ToLower() == deelgemeente.InDeelgemeente && deelgemeente.Type == "Wijk" && polygon.Name == deelgemeente.Name) //Je kan hieraan toevoegen: && gebied.Type == "Wijk" of "Deelgemeente" { Heatmaps.Polygons.Add(AreaFunctions.addFill(deelgemeente.Polygon, deelgemeente.Name, selectedTable, Year)); } } } gmap.Overlays.Add(Heatmaps); MapFunctions.UpdateMap(gmap); }
//This function is called when you select 'Manual area' or 'Manual borough' and this function checks which areas are checked and draws them. public static void DrawAreas(NET.WindowsForms.GMapControl gmap, CheckedListBox checkedListBox1, Rotterdam Rdam, CheckBox wijkbox, CheckBox deelgembox, CheckBox manualareabox, CheckBox manualdeelbox, GMapOverlay Heatmaps, string selectedTable, string Year) { MapFunctions.Clear(gmap); Heatmaps.Clear(); //if the 'All areas' is checked if (manualareabox.Checked) { //Checks which areas from the checkboxlist are checked foreach (string Check in checkedListBox1.CheckedItems) { string new_check = Check.ToLower(); foreach (Borough wijk in Rdam.Deelgemeenten) { if (wijk.Name.Contains("3")) { string new_check3 = new_check + "3"; if (wijk.Name == new_check3 && wijk.Type == "Wijk") { Heatmaps.Polygons.Add(addFill(wijk.Polygon, wijk.Name, selectedTable, Year)); } } if (wijk.Name.Contains("2")) { string new_check2 = new_check + "2"; if (wijk.Name == new_check2 && wijk.Type == "Wijk") { Heatmaps.Polygons.Add(addFill(wijk.Polygon, wijk.Name, selectedTable, Year)); } } if (wijk.Name.Contains("1")) { string new_check1 = new_check + "1"; if (wijk.Name == new_check1 && wijk.Type == "Wijk") { Heatmaps.Polygons.Add(addFill(wijk.Polygon, wijk.Name, selectedTable, Year)); } } if (wijk.InDeelgemeente.ToLower() == new_check) { Debug.Write("1"); Heatmaps.Polygons.Add(addFill(wijk.Polygon, wijk.Name, selectedTable, Year)); } } } } //else... else if (manualdeelbox.Checked) { foreach (string Check in checkedListBox1.CheckedItems) { string new_check = Check.ToLower(); foreach (Borough deelgemeente in Rdam.Deelgemeenten) { if (deelgemeente.Name.Contains("2")) { string new_check2 = new_check + "2"; if (deelgemeente.Name == new_check2 && deelgemeente.Type == "Deelgemeente") { Heatmaps.Polygons.Add(addFill(deelgemeente.Polygon, deelgemeente.Name, selectedTable, Year)); } } if (deelgemeente.Name.Contains("1")) { string new_check1 = new_check + "1"; if (deelgemeente.Name == new_check1 && deelgemeente.Type == "Deelgemeente") { Heatmaps.Polygons.Add(addFill(deelgemeente.Polygon, deelgemeente.Name, selectedTable, Year)); } } if (new_check == deelgemeente.Name && deelgemeente.Type == "Deelgemeente") //Je kan hieraan toevoegen: && gebied.Type == "Wijk" of "Deelgemeente" { Heatmaps.Polygons.Add(addFill(deelgemeente.Polygon, deelgemeente.Name, selectedTable, Year)); } } } } gmap.Overlays.Add(Heatmaps); MapFunctions.UpdateMap(gmap); }