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(); }
void ExecuteSelectAll(object o) { if (CurrentPolygon != null) { CurrentPolygon.SelectAll(); } FieldView.RefreshView(); }
void ExecuteDeselectAll(object o) { if (CurrentPolygon != null) { CurrentPolygon.DeselectAll(); } SelectedField = null; FieldView.RefreshView(); }
private void ZoomManager_ZoomChanged(object sender, System.EventArgs e) { NotifyPropertyChanged(() => Zoom); if (ZoomChanged != null) { ZoomChanged(this, new System.EventArgs()); } FieldView.RefreshView(); }
void ExecuteDeleteSelectedField(object o) { if (!ParentPresenter.MasterView.ShowInfoYesNoMessage("Confirm", "Are you sure to delete field")) { return; } deleteSelectedField(); FieldView.RefreshView(); }
private void afterAction(object sender, ActionDoneEventArgs arg) { var poly = arg.Result as IFieldPolygon; if (poly != null && SelectedField != null) { SelectedField.Polygon = poly; } FieldView.RefreshView(); }
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(); }
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(); }
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(); }
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(); }; }
void ExecuteSendToBottom(object o) { World.Fields.SendToBottom(SelectedField); NotifyPropertyChanged(() => SelectedFieldZOrder); FieldView.RefreshView(); }
void ExecuteBringToTop(object o) { World.Fields.BringToTop(SelectedField); NotifyPropertyChanged(() => SelectedFieldZOrder); FieldView.RefreshView(); }
void ExecuteMerge(object o) { CurrentPolygon.MergeSelected(); FieldView.RefreshView(); }
void ExecuteSplit(object o) { CurrentPolygon.SplitSelected(); FieldView.RefreshView(); }