Esempio n. 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);
        }
Esempio n. 2
0
 public void RemovePoint(DragablePointViewModel point)
 {
     PointVms.Remove(point);
     PolygonObject.RemovePoint(point.ModelObject);
     OnPropertyChanged("ClosedPointVms");
     OnPropertyChanged("Points");
     OnPropertyChanged("");
     Parent.OnPropertyChanged("");
 }
Esempio n. 3
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);
        }