示例#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
        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);
        }
示例#3
0
        public void InsertPoint(DragablePoint insertMe, DragablePoint insertBeforeMe)
        {
            int index = 0;

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

            if (index >= 0)
            {
                Points.Insert(index, insertMe);
            }
        }
示例#4
0
 public void RemovePoint(DragablePoint point)
 {
     Points.Remove(point);
 }
示例#5
0
 public void AddPoint(DragablePoint point)
 {
     Points.Add(point);
 }