Exemple #1
0
        public override DiagramEntity Clone()
        {
            DiagramKeyMatrix obj = new DiagramKeyMatrix();

            obj.Copy(this);
            return(obj);
        }
Exemple #2
0
        public override void Copy(DiagramEntity obj)
        {
            base.Copy(obj);
            DiagramKeyMatrix k = (DiagramKeyMatrix)obj;

            this.ParentContainer = (obj.ParentContainer);
            this.ContentModified = k.ContentModified;
            this.Rows            = k.Rows;
            this.Cols            = k.Cols;
            this.RowSpacing      = k.RowSpacing;
            this.ColSpacing      = k.ColSpacing;
            // this.Matrix = k.Matrix;

            this.Entities.Clear();
            for (int i = 0; i < k.Entities.Count; i++)
            {
                //k.Entities[i].Clone()
                DiagramEntity entity = k.Entities[i].Clone();
                entity.OnEntityPropertiesChanged      += new EventEntityPropertiesChanged(OnSubEntityPropertiesChanged);
                entity.OnEntityPropertiesBeforeChange += new DiagramEntity.EventEntityPropertiesBeforeChange(OnSubEntityPropertiesWillChange);
                this.Entities.Add(entity);
            }
        }
Exemple #3
0
        public override bool isEqual(DiagramEntity key)
        {
            if (!(key is DiagramKeyMatrix))
            {
                return(false);
            }
            if (!base.isEqual(key))
            {
                return(false);
            }

            DiagramKeyMatrix     k        = (DiagramKeyMatrix)key;
            List <DiagramEntity> entities = this.Entities;
            List <DiagramEntity> items    = k.Entities;

            List <object> mineCopies = new List <object>();

            for (int i = 0; i < entities.Count; i++)
            {
                mineCopies.Add(entities[i]);
            }

            for (int i = 0; i < items.Count; i++)
            {
                object obj = findSameItem(items[i], mineCopies);
                if (obj != null)
                {
                    mineCopies.Remove(obj);
                }
            }
            if (mineCopies.Count > 0)
            {
                return(false);
            }
            return(true);
        }
Exemple #4
0
        private object findSameItem(object obj, List <object> items)
        {
            if (obj is DiagramKeyArea)
            {
                DiagramKeyArea c = (DiagramKeyArea)obj;
                for (int i = 0; i < items.Count; i++)
                {
                    if (!(items[i] is DiagramKeyArea))
                    {
                        continue;
                    }
                    DiagramKeyArea d = (DiagramKeyArea)items[i];
                    if (c.isEqual(d))
                    {
                        return(d);
                    }
                }
            }
            else if (obj is DiagramKeyMatrix)
            {
                DiagramKeyMatrix c = (DiagramKeyMatrix)obj;
                for (int i = 0; i < items.Count; i++)
                {
                    if (!(items[i] is DiagramKeyMatrix))
                    {
                        continue;
                    }
                    DiagramKeyMatrix d = (DiagramKeyMatrix)items[i];
                    if (c.isEqual(d))
                    {
                        return(d);
                    }
                }
            }
            else if (obj is DiagramKeySlideH)
            {
                DiagramKeySlideH c = (DiagramKeySlideH)obj;
                for (int i = 0; i < items.Count; i++)
                {
                    if (!(items[i] is DiagramKeySlideH))
                    {
                        continue;
                    }
                    DiagramKeySlideH d = (DiagramKeySlideH)items[i];
                    if (c.isEqual(d))
                    {
                        return(d);
                    }
                }
            }
            else if (obj is DiagramKeySlideV)
            {
                DiagramKeySlideV c = (DiagramKeySlideV)obj;
                for (int i = 0; i < items.Count; i++)
                {
                    if (!(items[i] is DiagramKeySlideV))
                    {
                        continue;
                    }
                    DiagramKeySlideV d = (DiagramKeySlideV)items[i];
                    if (c.isEqual(d))
                    {
                        return(d);
                    }
                }
            }

            return(null);
        }