/// <summary> /// Combines two drawables into one group. Sets the group for both /// </summary> /// <param name="left">Left drawable of edge</param> /// <param name="right">Right drawable of edge</param> public void CombineIntoGroup(IDrawable left, IDrawable right) { // If drawable is already in group, use that group if (right is MetaNoun) { right.CombineIntoGroup(left); left.Group = (MetaNoun)right; return; } IDrawableGroup group = null; //Create new group if (left.Group == null && right.Group == null) { group = new MetaNoun(left, right); } // Use drawable group else if (left.Group == null) { group = right.Group; group.CombineIntoGroup(left); } // Use this group else { group = left.Group; var oldGroup = right.Group; group.CombineIntoGroup(right); right.Group.Dispose(); } // Set to both same group left.Group = group; right.Group = group; }