Example #1
0
        public DragablePointViewModel InsertPoint(Point insertMe, DragablePointViewModel insertBeforeMe)
        {
            DragablePoint          np       = new DragablePoint(1, insertMe.X - PosX, insertMe.Y - PosY);
            DragablePointViewModel newPoint = new DragablePointViewModel(MainVm, this, np);

            int index = 0;

            if (insertBeforeMe != null)
            {
                index = PointVms.IndexOf(insertBeforeMe);
            }

            if (index >= 0)
            {
                PointVms.Insert(index, newPoint);
            }

            if (insertBeforeMe != null)
            {
                PolygonObject.InsertPoint(newPoint.ModelObject, insertBeforeMe.ModelObject);
            }
            else
            {
                PolygonObject.InsertPoint(newPoint.ModelObject, null);
            }

            OnPropertyChanged("");
            Parent.OnPropertyChanged("");

            return(newPoint);
        }
Example #2
0
        public LfDragablePointViewModel InsertPoint(Point insertMe, LfDragablePointViewModel insertBeforeMe)
        {
            if (LocalModelObject == null)
            {
                return(null);
            }

            LfDragablePoint          np       = new LfDragablePoint(GetFreeVertexIndex(), insertMe.X, insertMe.Y);
            LfDragablePointViewModel newPoint = new LfDragablePointViewModel(this, ParentVm, MainVm, this, np);

            int index = 0;

            if (insertBeforeMe != null)
            {
                index = PointVms.IndexOf(insertBeforeMe);
            }

            if (index >= 0)
            {
                PointVms.Insert(index, newPoint);
            }

            if (insertBeforeMe != null)
            {
                LocalModelObject.InsertPoint(newPoint.ModelObject, insertBeforeMe.ModelObject);
            }
            else
            {
                LocalModelObject.InsertPoint(newPoint.ModelObject, null);
            }

            InvalidateAll();
            ParentVm.OnPropertyChanged("");

            return(newPoint);
        }