예제 #1
0
        /// <summary>
        /// Removes attribute specified by its id from all the vertices.
        /// </summary>
        /// <param name="id">Specifies the attribute to be removed</param>
        public void RemoveAttribute(string id)
        {
            AttributeInfos.Remove(id);

            foreach (Vertex vertex in Vertices)
            {
                vertex.Attributes.Remove(id);
            }
        }
예제 #2
0
        // ==================================================================================================
        // UNIFORM / VERTEX MANIPULATION
        // ==================================================================================================

        /// <summary>
        /// Adds new attribute for all vertices.
        /// </summary>
        /// <param name="attributeInfo">Structure describing the attribute</param>
        public void AddAttribute(AttributeInfo attributeInfo)
        {
            AttributeInfos.Add(attributeInfo.Id, attributeInfo);

            // Ensure that all vertices will have this attribute.
            foreach (Vertex vertex in Vertices)
            {
                var newVariable = attributeInfo.CreateNewVariable();
                newVariable.PropertyChanged += OnAttributeChange;
                vertex.Attributes.Add(attributeInfo.Id, newVariable);
            }
        }