List <Placemat> GetPlacematsOnBoundingRect(ref Rect boundingRect, ref List <IGraphElementModel> elementsOnBoundingRect, List <IPlacematModel> selectedPlacemats) { List <Placemat> placematsOnBoundingRect = new List <Placemat>(); foreach (IPlacematModel placemat in selectedPlacemats.Where(placemat => m_LeftOverElementModels.Contains(placemat))) { Placemat placematUI = placemat.GetUI <Placemat>(m_GraphView); if (placematUI != null && placematUI.layout.Overlaps(boundingRect)) { AdjustBoundingRect(ref boundingRect, placematUI.GetPosition()); placematsOnBoundingRect.Add(placematUI); elementsOnBoundingRect.Add(placemat); m_LeftOverElementModels.Remove(placemat); } } return(placematsOnBoundingRect); }
KeyValuePair <Rect, List <IGraphElementModel> > GetPlacematBoundingRect(ref List <Tuple <Rect, List <IGraphElementModel> > > boundingRects, Placemat placematUI, List <IPlacematModel> selectedPlacemats) { Rect boundingRect = placematUI.GetPosition(); List <IGraphElementModel> elementsOnBoundingRect = new List <IGraphElementModel>(); List <Placemat> placematsOnBoundingRect = GetPlacematsOnBoundingRect(ref boundingRect, ref elementsOnBoundingRect, selectedPlacemats); // Adjust the bounding rect with elements overlapping any of the placemats on the bounding rect AdjustPlacematBoundingRect(ref boundingRect, ref elementsOnBoundingRect, placematsOnBoundingRect); foreach (var otherRect in boundingRects.ToList()) { Rect otherBoundingRect = otherRect.Item1; List <IGraphElementModel> otherBoundingRectElements = otherRect.Item2; if (otherBoundingRectElements.Any(element => IsOnPlacemats(element.GetUI <GraphElement>(m_GraphView), placematsOnBoundingRect))) { AdjustBoundingRect(ref boundingRect, otherBoundingRect); elementsOnBoundingRect.AddRange(otherBoundingRectElements); boundingRects.Remove(otherRect); } } return(new KeyValuePair <Rect, List <IGraphElementModel> >(boundingRect, elementsOnBoundingRect)); }