private void getAllIDEAMRegionGroups() { foreach (Station s in stations) { bool inside = false; foreach (Region r in regions) { double[] lonlat = new double[] { s.longitude, s.latitude }; if (MapTools.isPointInPolygon(lonlat, r.vertices)) { inside = true; var group = stationsByRegion.Find(x => x.name == r.name); group.stationcodes.Add(s.code); //break; } } //for the ones that fall outside if (!inside) { var groupOut = stationsByRegion.Find(x => x.name == "outside"); groupOut.stationcodes.Add(s.code); //break; } } }
private void getRegionGroups() { foreach (int code in activeStationCodes) { bool inside = false; //get the ref station details Station s = stations.Find(x => x.code == code); if (s == null) { s = new Station(); } foreach (Region r in regions) { double[] lonlat = new double[] { s.longitude, s.latitude }; if (MapTools.isPointInPolygon(lonlat, r.vertices)) { inside = true; var group = stationsByRegion.Find(x => x.name == r.name); group.stationcodes.Add(s.code); //break; } } //for the ones that fall outside if (!inside) { var groupOut = stationsByRegion.Find(x => x.name == "outside"); groupOut.stationcodes.Add(s.code); //break; } } }
private void getCityRegionName() { foreach (City c in cities) { foreach (Region r in regions) { if (MapTools.isPointInPolygon(c.location, r.vertices)) { //add the region group name to city c.regionName = r.name; break; } } } }
private string findRegion(City c) { string region = "undefined"; foreach (Region r in regions) { if (MapTools.isPointInPolygon(c.location, r.vertices)) { //add the region group name to city region = r.name; break; } } return(region); }