示例#1
0
        public void Split(Point p)
        {
            NodCanvasViewModel ncvm = LinjeRepository.MainRepository.NodCanvasRepository.AddNewCanvasNod(p);

            LinjeRepository.AddNewLinje(LinjeModel.Nod1, ncvm.NodCanvasModel);
            LinjeRepository.AddNewLinje(LinjeModel.Nod2, ncvm.NodCanvasModel);

            ncvm.Select();

            JustDelete();
        }
示例#2
0
        public static NodCanvasViewModel CopyNodKlassToNew(NodKlassModel nkm, NodCanvasRepository ncr)
        {
            NodCanvasModel     newNcm  = NodCanvasModel.CopyNod(nkm);
            NodCanvasViewModel newNcvm = new NodCanvasViewModel()
            {
                NodCanvasRepository = ncr,
                NodCanvasModel      = newNcm
            };

            return(newNcvm);
        }
示例#3
0
        public void EatNod(NodCanvasViewModel ncvm)
        {
            Set();

            foreach (LinjeModel l in ncvm.NodCanvasModel.LinjeListModel)
            {
                l.ReplaceNod(ncvm.NodCanvasModel, this.NodKlassModel);
                NodKlassModel.LinjeListModel.Add(l);
            }

            ncvm.Delete();
        }
示例#4
0
        public void LooseLinje(Point p)
        {
            if (IsSet())
            {
                NodCanvasViewModel ncvm = KlassViewModel.KlassRepository.MainRepository.NodCanvasRepository.AddNewCanvasNod(p);
                foreach (LinjeModel l in NodKlassModel.LinjeListModel)
                {
                    l.ReplaceNod(NodKlassModel, ncvm.NodCanvasModel);
                    ncvm.NodCanvasModel.LinjeListModel.Add(l);
                }

                ncvm.Select();
                UnSet();
            }
        }
示例#5
0
        public void EatNod(NodCanvasViewModel ncvm)
        {
            if (ncvm.HasLines())
            {
                LinjeModel share = LinjeModel.GetSharingLinje(this.NodCanvasModel, ncvm.NodCanvasModel);
                if (share != null)
                {
                    ncvm.NodCanvasModel.LinjeListModel.Remove(share);
                    share.LinjeViewModel.Delete();
                }

                foreach (LinjeModel l in ncvm.NodCanvasModel.LinjeListModel)
                {
                    l.ReplaceNod(ncvm.NodCanvasModel, this.NodCanvasModel);
                    NodCanvasModel.LinjeListModel.Add(l);
                }
            }

            ncvm.Delete();
        }