Ejemplo n.º 1
0
 public void AddAttribute(string attributeName, string value)
 {
     MapTree.AttributeSpec aSpec = Tree.GetAttributeSpec(attributeName);
     if (aSpec == null)
     {
         aSpec = new MapTree.AttributeSpec(Tree, attributeName);
     }
     MapNode.Attribute attribute = new Attribute(aSpec, value);
     AddAttribute(attribute);
 }
Ejemplo n.º 2
0
        public bool ContainsAttribute(MapTree.AttributeSpec attSpec)
        {
            if (attributeList != null)
            {
                foreach (Attribute att in attributeList)
                {
                    if (att.AttributeSpec == attSpec)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Returns the index of attribute. '-1' if not found.
        /// </summary>
        /// <param name="attributeName"></param>
        /// <returns></returns>
        public int FindAttributeIndex(MapTree.AttributeSpec attribute)
        {
            if (attributeList != null)
            {
                for (int i = 0; i < attributeList.Count; i++)
                {
                    if (attributeList[i].AttributeSpec == attribute)
                    {
                        return(i);
                    }
                }
            }

            return(-1);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Returns false if attribute not found
        /// </summary>
        /// <param name="aSpec">AttributeSpec</param>
        /// <param name="value">New value</param>
        /// <returns></returns>
        public bool UpdateAttribute(MapTree.AttributeSpec aSpec, string value)
        {
            if (attributeList != null)
            {
                for (int i = 0; i < attributeList.Count; i++)
                {
                    if (attributeList[i].AttributeSpec == aSpec)
                    {
                        UpdateAttribute(i, value);
                        return(true);
                    }
                }
            }

            return(false);
        }
Ejemplo n.º 5
0
        public bool GetAttribute(MapTree.AttributeSpec attSpec, out Attribute attribute)
        {
            if (attributeList != null)
            {
                foreach (Attribute att in attributeList)
                {
                    if (att.AttributeSpec == attSpec)
                    {
                        attribute = att;
                        return(true);
                    }
                }
            }

            attribute = Attribute.Empty;
            return(false);
        }
Ejemplo n.º 6
0
 public bool DeleteAttribute(MapTree.AttributeSpec attributeSpec)
 {
     return(DeleteAttribute(a => a.AttributeSpec == attributeSpec));
 }
Ejemplo n.º 7
0
 public Attribute(MapTree.AttributeSpec aspec, object val)
 {
     this.AttributeSpec = aspec;
     this.Value         = val;
 }