public override IEventResult OnMouseDown(IMouseButtonEventArgs e) { if (_step == Step.Step1_SpecifyCenter) { if (e.IsLeftPressed) { _circle = Drawing.AppendEntity(new Circle(), DBObjectState.Unconfirmed); _circle.center = this.Pointer.CurrentSnapPoint; _circle.radius = 0; _circle.LayerId = this.document.currentLayerId; _circle.Color = this.document.currentColor; _step = Step.Step2_SpecityRadius; } } else if (_step == Step.Step2_SpecityRadius) { if (e.IsLeftPressed) { _circle.radius = (_circle.center - this.Pointer.CurrentSnapPoint).Length; _circle.LayerId = this.document.currentLayerId; _circle.Color = this.document.currentColor; _mgr.FinishCurrentCommand(); } } return(EventResult.Handled); }
public override IEventResult OnMouseDown(IMouseButtonEventArgs e) { switch (_step) { case Step.Step1_SpecifyBasePoint: if (e.IsLeftPressed) { _currXline = presenter.AppendEntity(new Xline(), DBObjectState.Unconfirmed); _currXline.basePoint = this.Pointer.CurrentSnapPoint; _currXline.LayerId = this.document.currentLayerId; _currXline.Color = this.document.currentColor; this.GotoStep(Step.Step2_SpecifyOtherPoint); } break; case Step.Step2_SpecifyOtherPoint: if (e.IsLeftPressed) { CADVector dir = (this.Pointer.CurrentSnapPoint - _currXline.basePoint).normalized; if (dir.X != 0 || dir.Y != 0) { _currXline.direction = dir; _currXline.LayerId = this.document.currentLayerId; _currXline.Color = this.document.currentColor; _xlines.Add(_currXline); _currXline = Drawing.AppendEntity((Xline)_currXline.Clone(), DBObjectState.Unconfirmed); _currXline.Draw(); //_currXline = _currXline.Clone() as Xline; } } break; } return(EventResult.Handled); }
public override IEventResult OnMouseDown(IMouseButtonEventArgs e) { if (_step == Step.Step1_SpecifyStartPoint) { if (e.IsLeftPressed) { _currLine = Drawing.AppendEntity(new Line(), DBObjectState.Unconfirmed); _currLine.startPoint = this.Pointer.CurrentSnapPoint; _currLine.endPoint = this.Pointer.CurrentSnapPoint; _currLine.LayerId = this.document.currentLayerId; _currLine.Color = this.document.currentColor; // _pointInput.Message = "指定下一点: "; _step = Step.Step2_SpecifyEndPoint; _currLine.Draw(); } } else if (_step == Step.Step2_SpecifyEndPoint) { if (e.IsLeftPressed) { _currLine.endPoint = this.Pointer.CurrentSnapPoint; _currLine.LayerId = this.document.currentLayerId; _currLine.Color = this.document.currentColor; _lines.Add(_currLine); _currLine = Drawing.AppendEntity(new Line(), DBObjectState.Unconfirmed); _currLine.startPoint = this.Pointer.CurrentSnapPoint; _currLine.endPoint = this.Pointer.CurrentSnapPoint; _currLine.LayerId = this.document.currentLayerId; _currLine.Color = this.document.currentColor; _currLine.Draw(); } } return(EventResult.Handled); }