/// <summary> /// Initialise a MultiElementVertex from a single elementvertex /// </summary> /// <param name="elementVertex"></param> public MultiElementVertex(ElementVertex elementVertex) { _Description = elementVertex.Description; _Elements = new ElementCollection(); _Vertices = new VertexCollection(); _Elements.Add(elementVertex.Element); _Vertices.Add(elementVertex.Vertex); }
/// <summary> /// Initialise a MultiElementVertex helper object combining the /// specified set of ElementVertices. /// </summary> /// <param name="elementVertices"></param> public MultiElementVertex(IList <ElementVertex> elementVertices) { _Description = elementVertices.CombinedValue(i => i.Description, "[Multi]"); _Elements = new ElementCollection(); _Vertices = new VertexCollection(); foreach (var elVert in elementVertices) { _Elements.Add(elVert.Element); _Vertices.Add(elVert.Vertex); } }
/// <summary> /// Get a collection of all elements connected to this node /// </summary> /// <param name="addTo">Add the elements to this collection, which will be returned as the result</param> /// <param name="undeletedOnly">If true, only elements that are not marked /// as deleted will be returned</param> /// <returns></returns> public ElementCollection GetConnectedElements(ElementCollection addTo, bool undeletedOnly = true, Element ignore = null) { foreach (Vertex v in Vertices) { if (v.Element != null && v.Element != ignore && !addTo.Contains(v.Element.GUID) && (!undeletedOnly || !v.Element.IsDeleted)) { addTo.Add(v.Element); } } return(addTo); }
/// <summary> /// Merge an element vertex into this object /// </summary> /// <param name="elVert"></param> public void Merge(ElementVertex elVert) { _Elements.Add(elVert.Element); _Vertices.Add(elVert.Vertex); }