public void RemovePoint(LfDragablePointViewModel point) { if (LocalModelObject == null) { return; } PointVms.Remove(point); LocalModelObject.RemovePoint(point.ModelObject); InvalidateAll(); ParentVm.OnPropertyChanged(""); }
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); }
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); }