Example #1
0
 public LfDragablePointViewModel(
     TreeViewViewModel treeParent,
     CompoundObjectViewModel parentVm,
     MainViewModel mainVm,
     LfPolygonViewModel parent,
     LfDragablePoint modelObject,
     bool enabled = true) :
     base(treeParent, parentVm, mainVm, enabled)
 {
     MainVm      = mainVm;
     Parent      = parent;
     ModelObject = modelObject;
     IsSelected  = false;
 }
Example #2
0
        public void InsertPoint(LfDragablePoint insertMe, LfDragablePoint insertBeforeMe)
        {
            int index = 0;

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

            if (index >= 0)
            {
                Points.Insert(index, insertMe);
            }
        }
Example #3
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);
        }
Example #4
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);
        }
Example #5
0
 public void RemovePoint(LfDragablePoint point)
 {
     Points.Remove(point);
 }
Example #6
0
 public void AddPoint(LfDragablePoint point)
 {
     Points.Add(point);
 }