public IDiagramModel CreateCopy(string containerId = null) { IContainerBase source = null; if (String.IsNullOrEmpty(containerId)) { source = this; } else if (_nodes.Contains(containerId)) { source = GetNode <IContainerNode>(containerId); } // cannot create copy for other if (source == null) { return(null); } var diagramModel = new DiagramModel { DiagramOptions = DiagramOptions }; var goCollection = new GoCollection { source as GoNode }; var copy = diagramModel.CopyFromCollection(goCollection); // _nodes is empty - overridden Add method seems not to be used in CopyFromCollection foreach (var node in diagramModel.GetAllChildren <IBaseNode>()) { diagramModel.AddNodeId(node); } return(diagramModel); }
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); }