private RectangleF GetAllCourseAreas()
{
RectangleF mergedRect = new RectangleF();
RectangleF mapBounds = mapDisplay.MapBounds;
bool first = true;
foreach (Id<Course> courseId in eventDB.AllCourseIds) {
RectangleF courseArea = GetCourseArea(courseId);
if (first)
mergedRect = courseArea;
else
mergedRect = RectangleF.Union(mergedRect, courseArea);
first = false;
}
// If there were no courses, then use the map bounds, otherwise intersect the map bounds with the merged courses.
if (first)
return mapBounds;
else
return RectangleF.Intersect(mergedRect, mapBounds);
}