예제 #1
0
        /// <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);
        }
예제 #2
0
        /// <summary>
        /// Change the position of this node, optionally dragging any
        /// attached vertices through the same transformation.
        /// </summary>
        /// <param name="newPosition"></param>
        /// <param name="dragVertices"></param>
        public void MoveTo(Vector newPosition, bool dragVertices = true, ElementCollection excludeElements = null)
        {
            Vector move = newPosition - Position;

            Position = newPosition;
            if (dragVertices)
            {
                foreach (Vertex v in Vertices)
                {
                    if (excludeElements == null || v.Element == null || !excludeElements.Contains(v.Element))
                    {
                        v.Position += move;
                    }
                }
            }
        }