Пример #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);
        }
Пример #2
0
        private void BuildPoints()
        {
            PointVms.Clear();

            PointVms.Add(Parent.GetTrianglePoint(ModelObject.V1));
            PointVms.Add(Parent.GetTrianglePoint(ModelObject.V2));
            PointVms.Add(Parent.GetTrianglePoint(ModelObject.V3));
        }
Пример #3
0
 public void RemovePoint(DragablePointViewModel point)
 {
     PointVms.Remove(point);
     PolygonObject.RemovePoint(point.ModelObject);
     OnPropertyChanged("ClosedPointVms");
     OnPropertyChanged("Points");
     OnPropertyChanged("");
     Parent.OnPropertyChanged("");
 }
Пример #4
0
        public void RemovePoint(LfDragablePointViewModel point)
        {
            if (LocalModelObject == null)
            {
                return;
            }

            PointVms.Remove(point);
            LocalModelObject.RemovePoint(point.ModelObject);

            InvalidateAll();
            ParentVm.OnPropertyChanged("");
        }
Пример #5
0
        public DragablePointViewModel AddPoint(Point point)
        {
            DragablePoint          np       = new DragablePoint(1, point.X, point.Y);
            DragablePointViewModel newPoint = new DragablePointViewModel(MainVm, this, np);

            PointVms.Add(newPoint);
            PolygonObject.AddPoint(newPoint.ModelObject);

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

            return(newPoint);
        }
Пример #6
0
        public LfDragablePointViewModel AddPoint(Point point)
        {
            if (LocalModelObject == null)
            {
                return(null);
            }

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

            PointVms.Add(newPoint);
            LocalModelObject.AddPoint(newPoint.ModelObject);

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

            return(newPoint);
        }
Пример #7
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);
        }