/// <summary> /// 内接于圆还是外切于圆 /// 输入结束事件响应 /// </summary> private void OnIcInputReturn(DynInputCtrl sender, DynInputResult result) { DynInputResult <string> ret = result as DynInputResult <string>; if (ret != null && ret.status == DynInputStatus.OK) { if (ret.value.Trim().ToUpper() == "I") { _option = Option.InscribedInCircle; } else { _option = Option.CircumscribedAboutCircle; } _step = Step.Step3_SpecifyPointCenter; } else { _mgr.CancelCurrentCommand(); } sender.finish -= this.OnIcInputReturn; sender.cancel -= this.OnIcInputReturn; }
private void OnOffsetDistanceInputReturn(DynInputCtrl sender, DynInputResult result) { DynInputResult <double> ret = result as DynInputResult <double>; if (ret != null && ret.status == DynInputStatus.OK) { _offsetDis = Math.Abs(ret.value); if (_currEntity != null) { this.pointer.mode = Pointer.Mode.Locate; _step = Step.Step3_SpecifyOffsetSide; } else { _step = Step.Step2_SelectObject; this.pointer.mode = Pointer.Mode.Select; } } else { _mgr.CancelCurrentCommand(); } sender.finish -= this.OnOffsetDistanceInputReturn; sender.cancel -= this.OnOffsetDistanceInputReturn; }
private void OnPointInputReturn(DynInputCtrl sender, DynInputResult retult) { DynInputResult <LitMath.Vector2> xyRet = retult as DynInputResult <LitMath.Vector2>; if (xyRet == null || xyRet.status == DynInputStatus.Cancel) { if (_lines.Count > 0) { _mgr.FinishCurrentCommand(); } else { _mgr.CancelCurrentCommand(); } return; } _pointInput.Message = "指定下一点: "; this.dynamicInputer.StartInput(_pointInput); switch (_step) { case Step.Step1_SpecifyStartPoint: { _currLine = new Line(); _currLine.startPoint = xyRet.value; _currLine.endPoint = xyRet.value; _currLine.layerId = this.document.currentLayerId; _currLine.color = this.document.currentColor; _step = Step.Step2_SpecifyEndPoint; } break; case Step.Step2_SpecifyEndPoint: { _currLine.endPoint = xyRet.value; _currLine.layerId = this.document.currentLayerId; _currLine.color = this.document.currentColor; _lines.Add(_currLine); _currLine = new Line(); _currLine.startPoint = xyRet.value; _currLine.endPoint = xyRet.value; _currLine.layerId = this.document.currentLayerId; _currLine.color = this.document.currentColor; } break; } }
private void OnPointInputReturn(DynInputCtrl sender, DynInputResult retult) { DynInputResult <LitMath.Vector2> xyRet = retult as DynInputResult <LitMath.Vector2>; if (xyRet != null && xyRet.status == DynInputStatus.OK) { switch (_step) { case Step.Step1_SpecifyBasePoint: { _currXline = new Ray(); _currXline.basePoint = xyRet.value; _currXline.layerId = this.document.currentLayerId; _currXline.color = this.document.currentColor; this.GotoStep(Step.Step2_SpecifyOtherPoint); } break; case Step.Step2_SpecifyOtherPoint: { LitMath.Vector2 dir = (xyRet.value - _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 = _currXline.Clone() as Ray; } this.GotoStep(Step.Step2_SpecifyOtherPoint); } break; } } else { if (_xlines.Count > 0) { _mgr.FinishCurrentCommand(); } else { _mgr.CancelCurrentCommand(); } } }
/// <summary> /// 边数输入结束事件响应 /// </summary> private void OnSidesCntInputReturn(DynInputCtrl sender, DynInputResult result) { DynInputResult <int> ret = result as DynInputResult <int>; if (ret != null && ret.status == DynInputStatus.OK) { _sides = (uint)ret.value; _step = Step.Step2_IORC; DynInputString icInput = new DynInputString(this.presenter, "I"); icInput.Message = "输入选项[内接于圆(I)/外切于圆(C)]: "; this.dynamicInputer.StartInput(icInput); icInput.finish += this.OnIcInputReturn; icInput.cancel += this.OnIcInputReturn; } else { _mgr.CancelCurrentCommand(); } sender.finish -= this.OnSidesCntInputReturn; sender.cancel -= this.OnSidesCntInputReturn; }