示例#1
0
 protected Node(Node node)
 {
     m_name       = node.Name;
     m_tag        = node.Tag;
     m_owner      = node.Owner;
     m_attributes = node.Attributes;
 }
示例#2
0
 public virtual void PreVisit(IGroupNode group)
 {
     System.Console.WriteLine(currentIndentation
     + "A Drawable of type "
     + group.GetType().ToString()
     + " with name: " + group.Name);
     currentIndentation += indentIncrement;
 }
示例#3
0
        public void Write(IGroupNode rootNode, string filePath)
        {
            XmlDocument document = new XmlDocument();

            AddDeclarationToXmlDocument(document);
            document.AppendChild(rootNode.ToXmlNodeWithChildNode(document));
            document.Save(filePath);
        }
示例#4
0
        /// <summary>
        /// 在指定的文件路径写入文件
        /// </summary>
        /// <param name="filePath"></param>
        public void Write(IGroupNode rootNode, string filePath)
        {
            string directory = System.IO.Path.GetDirectoryName(System.IO.Path.GetFullPath(filePath));

            if (!System.IO.Directory.Exists(directory))
            {
                System.IO.Directory.CreateDirectory(directory);
            }
            m_xmlWriter.Write(rootNode, filePath);
        }
示例#5
0
 public void Read(string filePath)
 {
     if (filePath == null)
     {
         m_items      = m_nodeFactory.CreateGroupNodeFromData(new Internal.ReadArgs());
         m_items.Name = DEFAULT_NAME;
     }
     else
     {
         m_items = new SimpleXmlManager(m_nodeFactory).Read(filePath, Name) as IGroupNode;
     }
 }
示例#6
0
        public void TestAddOrDelete()
        {
            string     inputPath  = "CreateAndReadFile.xml";
            string     outputPath = "AddOrDeleteFile.xml";
            Document   doc        = Document.ReadAllFrom(inputPath);
            IGroupNode groupNode  = doc.Data.Items.LastChild as IGroupNode;

            groupNode.Add(new ContentNode()
            {
                Content = "测试值",
            });
            doc.Write(outputPath);
        }
示例#7
0
        public IItemsLayer AddItemsLayerAtSelectedNode()
        {
            IGroupNode node = SelectedNode;

            if (node is IGroup group)
            {
                return(group.AddItemsLayer());
            }
            else if (node is ILayer)
            {
                return(node.ParentNode?.AddItemsLayer());
            }
            else
            {
                return(AddItemsLayer());
            }
        }
示例#8
0
 public IGroupNode FindTopMatchingChild(Func <IGroupNode, bool> nodeTester)
 {
     for (int i = ChildNodes.Count - 1; i >= 0; i--)
     {
         IGroupNode child = ChildNodes[i];
         if (nodeTester(child))
         {
             return(child);
         }
         IGroupNode match = child.FindTopMatchingChild(nodeTester);
         if (match != null)
         {
             return(match);
         }
     }
     return(null);
 }
示例#9
0
 private void Reload(int from, int to)
 {
     IGroupNode[] old = (IGroupNode[])SubGroups;
     if (Field.Count != old.Length)
     {
         IGroupNode[] @new = new IGroupNode[Field.Count];
         Array.Copy(old, @new, Math.Min(old.Length, @new.Length));
         for (int i = old.Length; i < Field.Count; ++i)
         {
             @new[i] = ChildCtor(i);
         }
         SubGroups = @new;
         PropertyChanged?.Invoke(this, IGroupNode.SubGroupsChanged);
         old = @new;
     }
     for (int i = from; i < to; ++i)
     {
         ChildReloader(i, old[i]);
     }
 }
示例#10
0
        public IGroup AddGroupAtSelectedNode(int maxGroupLevels)
        {
            IGroupNode node = SelectedNode;

            if (node is ILayer)
            {
                node = node.ParentNode;
            }
            while (node != null && node.NumAncestors >= maxGroupLevels)
            {
                node = node.ParentNode;
            }
            if (node is IGroup group)
            {
                return(group?.AddGroup());
            }
            else
            {
                return(AddGroup());
            }
        }
示例#11
0
 public virtual void PostVisit(IGroupNode group)
 {
     currentIndentation = currentIndentation.Substring(0,
         currentIndentation.Length - indentIncrement.Length);
 }
示例#12
0
 public virtual void PreVisit(IGroupNode group)
 {
     System.Console.WriteLine(currentIndentation
     + "Drawable Name: " + group.Name);
     currentIndentation += indentIncrement;
 }
示例#13
0
文件: Group.cs 项目: SAASTN/TopoPad
 public void AddChild(IGroupNode child)
 {
     m_ChildNodes.Add(child);
     child.ParentNode = this;
 }
示例#14
0
 public void PreVisit(IGroupNode group)
 {
     System.Console.WriteLine(currentIndentation + "A Group node of type " + group.GetType().ToString() + " with name: " + group.Name);
     currentIndentation += indentIncrement;
 }
示例#15
0
 public void PostVisit(IGroupNode group)
 {
     currentIndentation = currentIndentation.Substring(0, currentIndentation.Length - indentIncrement.Length);
 }
示例#16
0
 public GroupNodeChangedEventArgs(IGroupNode node)
 {
     Node = node;
 }
示例#17
0
 public void Close()
 {
     Release();
     m_items = null;
 }
示例#18
0
文件: Group.cs 项目: SAASTN/TopoPad
 public void RemoveChild(IGroupNode child)
 {
     m_ChildNodes.Remove(child);
     child.ParentNode = null;
 }