Exemplo n.º 1
0
        public void Store(Stream file, String loc)
        {
            bool oldskips = this.SkipsUndoManager;

            this.SkipsUndoManager = true;
            this.Location         = loc;
            int lastslash = loc.LastIndexOf("\\");

            if (lastslash >= 0)
            {
                this.Name = loc.Substring(lastslash + 1);
            }
            else
            {
                this.Name = loc;
            }
            this.IsModified       = false;
            this.SkipsUndoManager = oldskips;

            GoXmlWriter xw = new GoXmlWriter();

            InitReaderWriter(xw);
            xw.NodesGeneratedFirst = true;
            xw.Objects             = this;
            xw.Generate(file);
        }
        public XmlDocument ContainerToXmlDocument(IContainerBase containerBase)
        {
            GoXmlWriter writer = new GoXmlWriter();

            RegisterTransformers(writer);

            // containerBase can be Document or GoNode
            var diagramModel = containerBase as IDiagramModel;

            if (diagramModel != null)
            {
                writer.Objects = (IEnumerable)diagramModel;
            }
            else // containerBase is IContainerBaseNode
            {
                writer.Objects = containerBase.GetDirectChildren <IBaseNode>();
            }

            writer.RootElementName = ElementName;
            var xmlDoc = writer.Generate();

            xmlDoc.DocumentElement.SetAttribute(LocationX, containerBase.Location.X.ToString());
            xmlDoc.DocumentElement.SetAttribute(LocationY, containerBase.Location.Y.ToString());
            return(xmlDoc);
        }
Exemplo n.º 3
0
        public void StoreXml(FileStream ofile)
        {
            GoXmlWriter xw = new GoXmlWriter();

            InitReaderWriter(xw);
            xw.NodesGeneratedFirst = true;
            xw.Objects             = this;
            xw.Generate(ofile);
        }
        public XmlDocument DiagramModelToXmlDocument(IDiagramModel diagramModel)
        {
            GoXmlWriter writer = new GoXmlWriter();

            RegisterTransformers(writer);
            writer.Objects = (IEnumerable)diagramModel;
            var xmlDoc = writer.Generate();

            xmlDoc.DocumentElement.SetAttribute(IsLayouted, diagramModel.IsLayouted.ToString());
            return(xmlDoc);
        }
Exemplo n.º 5
0
        public FormDiagram(List <string[]> pre_data, List <KeyValuePair <int, float> > time_sequence)
        {
            InitializeComponent();

            this.Text = Application.ProductName + " - Precedence Diagram";

            rawData     = pre_data;
            indexNumber = time_sequence.Count;

            nodes = new GoBasicNode[indexNumber];
            links = new GoLink[rawData.Count];

            timeSeq = time_sequence;
            createDiagram(rawData);

            #region Graph Data Test

            #region Adding Transformer

            GoBasicNode             node = new GoBasicNode();
            GoXmlBindingTransformer x    = new GoXmlBindingTransformer("node", node);
            x.IdAttributeUsedForSharedObjects = true;
            x.TreeStructured      = true;
            x.TreeLinkPrototype   = new GoLink();
            x.TreeLinksToChildren = true;
            x.AddBinding("label", "Text");
            x.AddBinding("parent", "TreeParentNode");

            #endregion

            GoXmlWriter w = new GoXmlWriter();
            w.AddTransformer(x);
            w.Objects = goViewDiagram.Document;
            using (StreamWriter writer = new StreamWriter("output.xml"))
            {
                w.Generate(writer);
            }
            #endregion
        }
Exemplo n.º 6
0
        public void StoreA(Stream file, String loc, GraphView view)
        {
            /*bool oldskips = this.SkipsUndoManager;
             * this.SkipsUndoManager = true;
             * this.Location = loc;
             * int lastslash = loc.LastIndexOf("\\");
             * if (lastslash >= 0)
             *  this.Name = loc.Substring(lastslash + 1);
             * else
             *  this.Name = loc;
             * this.IsModified = false;
             * this.SkipsUndoManager = oldskips;*/

            GoXmlWriter wrt = new GoXmlWriter();

            InitReaderWriterA(wrt);

            // need to select root node(s)
            GoCollection coll = new GoCollection();

            coll.Add(view.Document.FindNode("Start"));
            wrt.Objects = coll;
            wrt.Generate(file);
        }