Example #1
0
        void ExecuteCommandSelectPolygonPoint(object o)
        {
            var point = zoomManager.RecalcZoomDiv(FieldView.GetCurrentMousePos());

            if (SelectedField != null)
            {
                SelectedField.Polygon.DeselectAll();
            }
            if (SelectedField != null && SelectedField.Polygon.Select(point))//this means that it has selected point of current field
            {
                FieldView.RefreshView();
                return;
            }
            SelectedField = null;
            foreach (var field in World.Fields.OrderByDescending(r => r.ZOrder))
            {
                if (field.Polygon.Select(point))
                {
                    SelectedField = field;
                    break;
                }
                else if (field.Polygon.IsInPoly(point))
                {
                    SelectedField = field;
                    SelectedField.Polygon.SelectAll();
                    break;
                }
            }

            FieldView.RefreshView();
        }
Example #2
0
 void ExecuteSelectAll(object o)
 {
     if (CurrentPolygon != null)
     {
         CurrentPolygon.SelectAll();
     }
     FieldView.RefreshView();
 }
Example #3
0
 void ExecuteDeselectAll(object o)
 {
     if (CurrentPolygon != null)
     {
         CurrentPolygon.DeselectAll();
     }
     SelectedField = null;
     FieldView.RefreshView();
 }
Example #4
0
 private void ZoomManager_ZoomChanged(object sender, System.EventArgs e)
 {
     NotifyPropertyChanged(() => Zoom);
     if (ZoomChanged != null)
     {
         ZoomChanged(this, new System.EventArgs());
     }
     FieldView.RefreshView();
 }
Example #5
0
        void ExecuteDeleteSelectedField(object o)
        {
            if (!ParentPresenter.MasterView.ShowInfoYesNoMessage("Confirm", "Are you sure to delete field"))
            {
                return;
            }

            deleteSelectedField();

            FieldView.RefreshView();
        }
Example #6
0
        private void afterAction(object sender, ActionDoneEventArgs arg)
        {
            var poly = arg.Result as IFieldPolygon;

            if (poly != null && SelectedField != null)
            {
                SelectedField.Polygon = poly;
            }


            FieldView.RefreshView();
        }
Example #7
0
 void ExecuteDelete(object o)
 {
     if (CurrentPolygon.PointsCount - CurrentPolygon.SelectedPointsCount >= 3)
     {
         CurrentPolygon.RemoveSelected();
         FieldView.RefreshView();
     }
     else
     {
         if (ParentPresenter.MasterView.ShowInfoYesNoMessage("Are you sure", "This operation will delete field"))
         {
             deleteSelectedField();
         }
     }
     FieldView.RefreshView();
 }
Example #8
0
        void ExecuteAddNewImmediately(object o)
        {
            if (CurrentPolygon != null)
            {
                CurrentPolygon.DeselectAll();
            }

            var hSize    = 20;
            var location = FieldView.GetCurrentMousePos();
            var polygon  = new FieldPolygon();

            polygon.AddPoint(new Vector2(location.X - hSize, location.Y - hSize));
            polygon.AddPoint(new Vector2(location.X + hSize, location.Y - hSize));
            polygon.AddPoint(new Vector2(location.X + hSize, location.Y + hSize));
            polygon.AddPoint(new Vector2(location.X - hSize, location.Y + hSize));
            commitPoly(polygon);
            FieldView.RefreshView();
        }
Example #9
0
        void ExecuteCommandSelectPolygonPointMany(object o)
        {
            // todo rewrite
            var point = zoomManager.RecalcZoomDiv(FieldView.GetCurrentMousePos());

            if (SelectedField != null)//this means that it has selected point of current field
            {
                var poly = SelectedField.Polygon;
                if (poly.IsNearToSelected(point))
                {
                    deselect(point);
                    FieldView.RefreshView();
                    return;
                }
                else if (poly.Select(point))
                {
                    FieldView.RefreshView();
                    return;
                }
            }

            if (SelectedField != null)
            {
                SelectedField.Polygon.DeselectAll();
            }

            foreach (var field in World.Fields)
            {
                if (field == SelectedField)
                {
                    continue;
                }
                if (field.Polygon.Select(point))
                {
                    SelectedField = field;
                    break;
                }
            }

            FieldView.RefreshView();
        }
Example #10
0
        void ExecuteAddNew(object o)
        {
            if (CurrentPolygon != null)
            {
                CurrentPolygon.DeselectAll();
            }


            _currentClickableAction             = new NewFieldClickAction();
            _currentClickableAction.ActionDone += (sender, args) =>
            {
                var poly = args.Result as IFieldPolygon;
                if (poly == null)
                {
                    return;
                }
                commitPoly(poly);

                FieldView.RefreshView();
            };
        }
Example #11
0
 void ExecuteSendToBottom(object o)
 {
     World.Fields.SendToBottom(SelectedField);
     NotifyPropertyChanged(() => SelectedFieldZOrder);
     FieldView.RefreshView();
 }
Example #12
0
 void ExecuteBringToTop(object o)
 {
     World.Fields.BringToTop(SelectedField);
     NotifyPropertyChanged(() => SelectedFieldZOrder);
     FieldView.RefreshView();
 }
Example #13
0
 void ExecuteMerge(object o)
 {
     CurrentPolygon.MergeSelected();
     FieldView.RefreshView();
 }
Example #14
0
 void ExecuteSplit(object o)
 {
     CurrentPolygon.SplitSelected();
     FieldView.RefreshView();
 }