/// <summary> /// Create the specified graphicsList. /// </summary> /// <param name="graphicsList">Graphics list.</param> public static LW_Group Create(List <LW_Graphic> graphicsList = null) { LW_Group instance = CreateInstance <LW_Group>(); instance.Set(graphicsList); return(instance); }
internal override void CopyPropertiesFrom(LW_Element element) { if (element is LW_Group) { LW_Group group = element as LW_Group; bool groupMatches = m_GraphicsList != null && group.m_GraphicsList != null && m_GraphicsList.Count == group.m_GraphicsList.Count; if (groupMatches) { for (int i = 0; i < m_GraphicsList.Count; i++) { if (m_GraphicsList[i].GetType() != group.m_GraphicsList[i].GetType() || m_GraphicsList[i] == group.m_GraphicsList[i]) { groupMatches = false; break; } } } if (groupMatches) { for (int i = 0; i < m_GraphicsList.Count; i++) { m_GraphicsList[i].CopyPropertiesFrom(group.m_GraphicsList[i]); } } else { if (m_GraphicsList != null) { for (int i = 0; i < m_GraphicsList.Count; i++) { if (m_GraphicsList[i] != null) { LW_Utilities.SafeDestroy(m_GraphicsList[i]); } } m_GraphicsList = null; } if (group.m_GraphicsList != null) { if (m_GraphicsList == null) { m_GraphicsList = new List <LW_Graphic>(group.m_GraphicsList.Count); } else if (m_GraphicsList.Capacity < group.m_GraphicsList.Count) { m_GraphicsList.Capacity = group.m_GraphicsList.Count; } for (int i = 0; i < group.m_GraphicsList.Count; i++) { if (group.m_GraphicsList[i] != null) { LW_Graphic copiedElement = group.m_GraphicsList[i].Copy() as LW_Graphic; m_GraphicsList.Add(copiedElement); } } } } } base.CopyPropertiesFrom(element); }