/// <summary> /// Allocates a new quad tree based on the current section parameters /// </summary> public static GridRectangle SectionBounds(Viking.UI.Controls.SectionViewerControl Parent, int SectionNumber) { GridRectangle bounds = new GridRectangle(); //Figure out the new boundaries for our quad-tree if(!Parent.Section.VolumeViewModel.SectionViewModels.ContainsKey(SectionNumber)) return new GridRectangle(); SectionViewModel SectionView = Parent.Section.VolumeViewModel.SectionViewModels[SectionNumber]; bounds = Parent.SectionBounds(SectionView.section); if (SectionView.ReferenceSectionAbove != null) { bounds = GridRectangle.Union(bounds, Parent.SectionBounds(SectionView.ReferenceSectionAbove)); } if (SectionView.ReferenceSectionBelow != null) { bounds = GridRectangle.Union(bounds, Parent.SectionBounds(SectionView.ReferenceSectionBelow)); } return bounds; }