Example #1
0
        /// <summary>
        /// VIRTUAL: Serializes the current Node to XML Serialized copy. Must be overriden to implement custom members.
        /// </summary>
        /// <param name="p_Parent"></param>
        /// <returns></returns>
        public virtual Xml.XmlTreeNode SerializeToXML(Xml.XmlTreeNode p_Parent)
        {
            Xml.XmlTreeNode v_Out = new Xml.XmlTreeNode(Xml.SerializationUtils.GetFullTypeName(this), p_Parent);

            v_Out.AddParameter("Name", this.Name);
            v_Out.AddParameter("X", this.X.ToString());
            v_Out.AddParameter("Y", this.Y.ToString());
            v_Out.AddParameter("Width", this.Width.ToString());
            v_Out.AddParameter("Height", this.Height.ToString());
            v_Out.AddParameter("Comment", this.Comment.ToString());
            v_Out.AddParameter("CanBeSelected", this.CanBeSelected.ToString());
            return(v_Out);
        }
Example #2
0
        /// <summary>
        /// VIRTUAL: Serializes the current Node to XML Serialized copy. Must be overriden to implement custom members.
        /// </summary>
        /// <param name="p_Parent"></param>
        /// <returns></returns>
        public virtual Xml.XmlTreeNode SerializeToXML(Xml.XmlTreeNode p_Parent)
        {
            Xml.XmlTreeNode v_Out = new Xml.XmlTreeNode(Xml.SerializationUtils.GetFullTypeName(this), p_Parent);

            v_Out.AddParameter("Name", this.Name);
            v_Out.AddParameter("X", this.X.ToString());
            v_Out.AddParameter("Y", this.Y.ToString());
            v_Out.AddParameter("Width", this.Width.ToString());
            v_Out.AddParameter("Height", this.Height.ToString());
            v_Out.AddParameter("Comment", this.Comment.ToString());
            v_Out.AddParameter("CanBeSelected", this.CanBeSelected.ToString());
            return v_Out;
        }
Example #3
0
 public override NodeGraphControl.Xml.XmlTreeNode SerializeToXML(NodeGraphControl.Xml.XmlTreeNode p_Parent)
 {
     NodeGraphControl.Xml.XmlTreeNode v_Out = base.SerializeToXML(p_Parent);
     v_Out.AddParameter("Value", Value.ToString(System.Globalization.CultureInfo.GetCultureInfo("en-us")));
     return(v_Out);
 }
Example #4
0
        /// <summary>
        /// SERIALIZATION: Serializes current object and all of its children to an XML Node
        /// </summary>
        /// <param name="p_Parent">Parent XML Node used in serialization</param>
        /// <returns>the XML serialized copy of the object</returns>
        public XmlTreeNode SerializeToXML(XmlTreeNode p_Parent)
        {
            XmlTreeNode v_Out = new XmlTreeNode(Xml.SerializationUtils.GetFullTypeName(this),p_Parent);
            v_Out.AddParameter("ViewX", ViewX.ToString());
            v_Out.AddParameter("ViewY", ViewY.ToString());
            v_Out.AddParameter("ViewZoom", ViewZoom.ToString(System.Globalization.CultureInfo.GetCultureInfo("en-us")));

            // Process Nodes
            XmlTreeNode v_NodeCollection = v_Out.AddChild("NodeGraphNodeCollection");
            foreach (NodeGraphNode i_Node in this.NodeCollection)
            {
                v_NodeCollection.AddChild(i_Node.SerializeToXML(v_NodeCollection));
            }

            // Process Links

            XmlTreeNode v_LinksCollection = v_Out.AddChild("NodeGraphLinkCollection");
            foreach (NodeGraphLink i_Link in this.Links)
            {
                v_LinksCollection.AddChild(i_Link.SerializeToXML(v_LinksCollection));
            }

            return v_Out;
        }
Example #5
0
        /// <summary>
        /// CLIPBOARD: Copies the selection as a list of Nodes into ClipBoard.
        /// </summary>
        public void CopySelectionToClipboard()
        {
            XmlTree v_ClipboardCopy = new XmlTree("NodeGraphCopy");
            XmlTreeNode v_NodeRoot = v_ClipboardCopy.m_rootNode.AddChild("Nodes");
            XmlTreeNode v_LinksRoot = v_ClipboardCopy.m_rootNode.AddChild("Links");
            // Nodes
            foreach (NodeGraphNode i_Node in this.m_SelectedItems)
            {
                v_NodeRoot.AddChild(i_Node.SerializeToXML(v_ClipboardCopy.m_rootNode));
            }
            // Links

            XmlTreeNode v_CurrentLink;

            foreach (NodeGraphLink i_Link in this.m_Links)
            {
                // if the node is connecting copied nodes
                if (this.m_SelectedItems.Contains(i_Link.Input.Parent) && this.m_SelectedItems.Contains(i_Link.Output.Parent))
                {
                    v_CurrentLink = new XmlTreeNode("ToBeRelinked", v_LinksRoot);
                    v_CurrentLink.AddParameter("InputNodeId", this.GetSelectionNodeIndex(i_Link.Input.Parent).ToString());
                    v_CurrentLink.AddParameter("InputNodeConnectorIdx", i_Link.Input.Parent.GetConnectorIndex(i_Link.Input).ToString());
                    v_CurrentLink.AddParameter("OutputNodeId", this.GetSelectionNodeIndex(i_Link.Output.Parent).ToString());
                    v_CurrentLink.AddParameter("OutputNodeConnectorIdx", i_Link.Output.Parent.GetConnectorIndex(i_Link.Output).ToString());
                    v_LinksRoot.AddChild(v_CurrentLink);
                }

            }

            Clipboard.Clear();
            string v_TempPath = Path.GetTempPath() + "NodeGraphClipboard.xml";
            v_ClipboardCopy.SaveXML(v_TempPath);
            System.Collections.Specialized.StringCollection v_ClipBoardContent = new System.Collections.Specialized.StringCollection();
            v_ClipBoardContent.Add(v_TempPath);
            Clipboard.SetFileDropList(v_ClipBoardContent);
        }
Example #6
0
        /// <summary>
        /// SERIALIZATION: Creates a XML Serialized copy of the link
        /// </summary>
        /// <param name="p_XmlParentTreeNode"></param>
        /// <returns></returns>
        public XmlTreeNode SerializeToXML(XmlTreeNode p_XmlParentTreeNode)
        {
            XmlTreeNode v_Out = new XmlTreeNode(SerializationUtils.GetFullTypeName(this),p_XmlParentTreeNode);

            NodeGraphView v_View = Input.Parent.ParentView;
            NodeGraphNode v_InputNode = Input.Parent;
            NodeGraphNode v_OutputNode = Output.Parent;

            v_Out.AddParameter("InputNodeId", v_View.GetNodeIndex(v_InputNode).ToString());
            v_Out.AddParameter("OutputNodeId", v_View.GetNodeIndex(v_OutputNode).ToString());
            v_Out.AddParameter("InputNodeConnectorIdx",v_InputNode.GetConnectorIndex(Input).ToString());
            v_Out.AddParameter("OutputNodeConnectorIdx", v_OutputNode.GetConnectorIndex(Output).ToString());

            return v_Out;
        }