public Rect GetSiteBounds() { if (sorted == false) { Site.SortSites(sites); currentIndex = 0; sorted = true; } if (sites.Count == 0) { return(new Rect(0, 0, 0, 0)); } var xmin = float.MaxValue; var xmax = float.MinValue; foreach (var site in sites) { if (site.X < xmin) { xmin = site.X; } if (site.X > xmax) { xmax = site.X; } } // here's where we assume that the sites have been sorted on y: var ymin = sites[0].Y; var ymax = sites[sites.Count - 1].Y; return(new Rect(xmin, ymin, xmax - xmin, ymax - ymin)); }
public void SortList() { Site.SortSites(sites); sorted = true; }