public static List <Rectangle> FilterData(List <Rectangle> rectangleList) { int i = 1; List <Rectangle> rectangleListOut = new List <Rectangle>(); foreach (Rectangle rect in rectangleList) { lmp.Add(new MyPoint(i++, rect.X, rect.Y)); } huinya(); K = CenterList.Count(); kmean(); Pen myPen = new Pen(Color.Red, 8); foreach (var list in doublelist) { int xx = 0; int yy = 0; foreach (var point in list) { xx += point.x; yy += point.y; } rectangleListOut.Add(new Rectangle(xx / list.Count, yy / list.Count, 64, 128)); } return(rectangleListOut); }
private async Task SetCenterList() { CenterDataService centerDataService = new CenterDataService(new EntityFramework.TimetableManagerDbContext()); CenterList = await centerDataService.GetCentersAsync(); CenterList.ForEach(e => { CenterNameList.Add(e.CenterName); }); }
private void comboBoxcenter_SelectionChanged(object sender, SelectionChangedEventArgs e) { string center = comboBoxcenter.SelectedItem.ToString(); CenterList.ForEach(e => { if (e.CenterName.Equals(center)) { BuildingNameList.Clear(); e.Buildings.ForEach(b => { BuildingNameList.Add(b.BuildingName); }); } }); }
private void CenterComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (CenterComboBox.SelectedItem == null) { return; } string center = CenterComboBox.SelectedItem.ToString(); CenterList.ForEach(e => { if (e.CenterName.Equals(center)) { BuildingNameList.Clear(); e.Buildings.ForEach(b => { BuildingNameList.Add(b.BuildingName); }); } }); }