/// <summary> /// Adds to boundary. /// </summary> /// <param name="item">The item.</param> private void addToBoundary(CompositeShape <T, TBoundary, TExtents> item) { if (IsBaseShape()) { _boundary.Reset(item.Boundary); } else { _boundary.Add(item.Boundary); } }
/// <summary> /// Removes the first occurrence of a specific object from the <see cref="T:System.Collections.Generic.List`1" />. /// </summary> /// <param name="item">The object to remove from the <see cref="T:System.Collections.Generic.List`1" />. The value can be null for reference types.</param> /// <returns>true if <paramref name="item" /> is successfully removed; otherwise, false. This method also returns false if <paramref name="item" /> was not found in the <see cref="T:System.Collections.Generic.List`1" />.</returns> public new bool Remove(CompositeShape <T, TBoundary, TExtents> item) { if (!base.Remove(item)) { return(false); } removeFromBoundary(item); updateExtents(); return(true); }
/// <summary> /// Removes from boundary. /// </summary> /// <param name="item">The item.</param> private void removeFromBoundary(CompositeShape <T, TBoundary, TExtents> item) { // Simple removal if last shape if (Count == 1 && Contains(item)) { _boundary.Clear(); } else { _boundary.Remove(item.Boundary); } }
/// <summary> /// Inserts an element into the <see cref="T:System.Collections.Generic.List`1" /> at the specified index. /// </summary> /// <param name="index">The zero-based index at which <paramref name="item" /> should be inserted.</param> /// <param name="item">The object to insert. The value can be null for reference types.</param> public new void Insert(int index, CompositeShape <T, TBoundary, TExtents> item) { addToBoundary(item); base.Insert(index, item); _extents.Add(item.Extents); }
/// <summary> /// Adds an object to the end of the <see cref="T:System.Collections.Generic.List`1" />. /// </summary> /// <param name="item">The object to be added to the end of the <see cref="T:System.Collections.Generic.List`1" />. The value can be null for reference types.</param> public new void Add(CompositeShape <T, TBoundary, TExtents> item) { addToBoundary(item); base.Add(item); _extents.Add(item.Extents); }