예제 #1
0
파일: GraphicMeta.cs 프로젝트: windygu/zcgl
 public void CloneFrom(GraphicMeta source)
 {
     if (this == source)
     {
         return;
     }
     base.CloneFrom(source as GraphicMetaBase);
     //foreach (NodeMeta item in source.GetAllMetaData())
     //{
     //    AddObject(item);
     //}
 }
예제 #2
0
파일: GraphicMeta.cs 프로젝트: windygu/zcgl
        //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);
                }
            }
        }