public void CopyIdAndStatus(GraphicMetaBase source) { if (this == source) { return; } base.CloneFrom(source); foreach (LineMeta line in Lines) { LineMeta lineMeta = null; try { lineMeta = source.Lines.First <LineMeta>(c => c.FromId == line.FromId && c.FromType == line.FromType && c.ToId == line.ToId && c.ToType == line.ToType); line.Associate_ID = lineMeta.Associate_ID; line.State = lineMeta.State; } catch { } } foreach (NodeMeta node in Nodes) { NodeMeta nodemeta = null; try { nodemeta = source.Nodes.First <NodeMeta>(c => c.SId == node.SId && c.DataType == node.DataType); node.State = nodemeta.State; } catch { } } }
//[IgnoreDataMember] //public LinkData Data { get; set; } public NodeMeta Clone() { NodeMeta result = new NodeMeta(); result.SId = SId; result.Text = Text; result.Left = Left; result.Top = Top; result.Left = Level; result.LineColor = LineColor; result.LinkTo = LinkTo; result.ParentId = ParentId; result.ParentType = ParentType; result.ReadOnly = ReadOnly; result.ShowTypes = ShowTypes; result.State = State; result.DataStatus = DataStatus; result.ImageUrl = ImageUrl; result.LinkUrl = LinkUrl; // result.Data = Data; result.DataType = DataType; result.Opacity = Opacity; result.Visible = Visible; return(result); }
/// <summary> /// Create a Line(Meta) to the Lines (a Line collection) /// </summary> /// <param name="from">Initial Node</param> /// <param name="to">End Node</param> /// <param name="assoc">Associate</param> /// <returns>return the new line created</returns> public LineMeta AddLine(NodeMeta from, NodeMeta to, string assoc) { if (from != null && to != null) { return(AddLine(from.SId, from.DataType, to.SId, to.DataType, assoc)); } return(null); }
public LineMeta AddLine(int fromID, ObjectType fromType, int toID, ObjectType toType, string assoc) { LineMeta line = new LineMeta() { LineMode = LineMode.Antrorse, LineColor = Color.FromArgb(255, 0, 0, 0), StrokePattern = StrokePattern.Solid, ReadOnly = true }; // GetNoteMeta(LinkData) to initial NodeMeta node = GetNoteMetaByInnerId(fromID, fromType); if (node != null) { line.FromId = node.SId; line.FromType = node.DataType; line.From = node; } // // GetNodeMeta(LinkData) to end node = GetNoteMetaByInnerId(toID, toType); if (node != null) { line.ToType = node.DataType; line.ToId = node.SId; line.To = node; } // // Appoint the associate for the new Line(Mete) line.Association = assoc; // // Push the new Line(Meta) into the Line collection Lines Lines.Add(line); return(line); }
//Properties //public List<NodeMeta> Data { get; set; } //protected NodeMeta GetMetaData(NodeMeta nm) //{ // return Data.FirstOrDefault((c) => { return c.DataType == nm.DataType && c.SId == nm.SId; }); //} //public override bool AddObject(NodeMeta data) //{ // if (null == data) return false; // _BindTag = false; // bool result = false; // result = Data.IndexOf(data) < 0; // if (result) // Data.Add(data); // return result; //} //public List<NodeMeta> GetAllMetaData() //{ // return new List<NodeMeta>(Data); //} /// <summary> /// ?need some desirable detail for the method /// </summary> /// <param name="meta"></param> public void MegerGraphic(GraphicMeta meta) { if (subject_id == 0) { subject_id = meta.subject_id; subject_type = meta.subject_type; title = meta.title; Version = meta.Version; base.note = meta.note; } //foreach (NodeMeta node in meta.Nodes) for (int index = meta.Nodes.Count - 1; index >= 0; index--) { NodeMeta node = meta.Nodes[index]; NodeMeta existNode = GetNoteMetaByInnerId(node.SId, node.DataType); if (existNode == null) { node.State = MetaState.New; Nodes.Add(node); //AddObject(meta.GetMetaData(node)); } else { node.Left = existNode.Left; node.Top = existNode.Top; meta.Nodes.RemoveAt(index); } } // //The line collection whose elements are copied to the new list named copyLines. // List <LineMeta> copyLines = new List <LineMeta>(Lines); //foreach (LineMeta line in meta.Lines) for (int index = meta.Lines.Count - 1; index >= 0; index--) { LineMeta line = meta.Lines[index]; bool lineExists = false; foreach (LineMeta l in copyLines) { if ((l.FromId == line.FromId && l.FromType == line.FromType && l.ToId == line.ToId && l.ToType == line.ToType) || (l.FromId == line.ToId && l.FromType == line.ToType && l.ToId == line.FromId && l.ToType == line.FromType) ) { lineExists = true; break; } } if (!lineExists) { line.State = MetaState.New; Lines.Add(line); } else { meta.Lines.RemoveAt(index); } } }
/// <summary> /// a virtual method for the subclasses to implement or extend it /// </summary> public virtual bool AddObject(NodeMeta data) { return(true); }
/// <summary> /// Add a Node(Meta) to the Nodes (a node collection) /// </summary> /// <param name="node">A NodeMeta</param> public void AddNode(NodeMeta node) { Nodes.Add(node); }