protected override SamplerStatus Sampler(JigPrompts prompts) { var ppo = new JigPromptPointOptions(string.Empty); while (true) { if (_workType.Equals("Tangent")) { ppo.SetMessageAndKeywords($"\n{Language.GetItem(PlinesEditFunction.LangItem, "k17")}", "Tangent Point"); } if (_workType.Equals("Point")) { ppo.SetMessageAndKeywords($"\n{Language.GetItem(PlinesEditFunction.LangItem, "k18")}", "Tangent Point"); } ppo.BasePoint = _startPoint; ppo.UseBasePoint = true; ppo.UserInputControls = UserInputControls.Accept3dCoordinates | UserInputControls.NullResponseAccepted | UserInputControls.AcceptOtherInputString | UserInputControls.NoNegativeResponseAccepted; var ppr = prompts.AcquirePoint(ppo); if (ppr.Status == PromptStatus.Keyword) { _workType = ppr.StringResult; } else if (ppr.Status == PromptStatus.OK) { _currentPoint = ppr.Value; if (CursorHasMoved()) { _prevPoint = _currentPoint; return(SamplerStatus.OK); } return(SamplerStatus.NoChange); } else if (ppr.Status != PromptStatus.OK | ppr.Status != PromptStatus.Keyword) { return(SamplerStatus.Cancel); } } }
protected override SamplerStatus Sampler(JigPrompts prompts) { JigPromptPointOptions jigOpts = new JigPromptPointOptions(); jigOpts.UserInputControls = (UserInputControls.Accept3dCoordinates | UserInputControls.NullResponseAccepted | UserInputControls.NoNegativeResponseAccepted | UserInputControls.GovernedByOrthoMode); _isUndoing = false; if (_pline.NumberOfVertices == 1) { // For the first vertex, just ask for the point jigOpts.Message = "\nSpecify start point: "; } else if (_pline.NumberOfVertices > 1) { string msgAndKwds = (_isArcSeg ? "\nSpecify endpoint of arc or [Line/Undo]: " : "\nSpecify next point or [Arc/Undo]: "); string kwds = (_isArcSeg ? "Line Undo" : "Arc Undo"); jigOpts.SetMessageAndKeywords(msgAndKwds, kwds); } else { return(SamplerStatus.Cancel); // Should never happen } // Get the point itself PromptPointResult res = prompts.AcquirePoint(jigOpts); if (res.Status == PromptStatus.Keyword) { if (res.StringResult.ToUpper() == "ARC") { _isArcSeg = true; } else if (res.StringResult.ToUpper() == "LINE") { _isArcSeg = false; } else if (res.StringResult.ToUpper() == "UNDO") { _isUndoing = true; } return(SamplerStatus.OK); } else if (res.Status == PromptStatus.OK) { // Check if it has changed or not (reduces flicker) if (_tempPoint == res.Value) { return(SamplerStatus.NoChange); } else { _tempPoint = res.Value; return(SamplerStatus.OK); } } return(SamplerStatus.Cancel); }
protected override SamplerStatus Sampler(JigPrompts prompts) { JigPromptPointOptions opts = new JigPromptPointOptions(); // Not all options accept null response opts.UserInputControls = (UserInputControls.Accept3dCoordinates | UserInputControls.NoNegativeResponseAccepted); // Get the first point if (_mPts.Count == 0) { opts.UserInputControls |= UserInputControls.NullResponseAccepted; opts.Message = "\nStart point of mleader: "; opts.UseBasePoint = false; } else if (_mPts.Count == 1) { opts.BasePoint = _mPts[_mPts.Count - 1]; opts.UseBasePoint = true; opts.Message = "\nSpecify mleader vertex: "; } else if (_mPts.Count > 1) { opts.UserInputControls |= UserInputControls.NullResponseAccepted; opts.BasePoint = _mPts[_mPts.Count - 1]; opts.UseBasePoint = true; opts.SetMessageAndKeywords("\nSpecify mleader vertex or [End]: ", "End"); } else // Should never happen { return(SamplerStatus.Cancel); } PromptPointResult res = prompts.AcquirePoint(opts); if (res.Status == PromptStatus.Keyword) { if (res.StringResult == "End") { return(SamplerStatus.Cancel); } } if (_mTempPoint == res.Value) { return(SamplerStatus.NoChange); } else if (res.Status == PromptStatus.OK) { _mTempPoint = res.Value; return(SamplerStatus.OK); } return(SamplerStatus.Cancel); }
private PromptPointResult GetJigPosition(JigPrompts prompts) { JigPromptPointOptions jigPositionOptions = new JigPromptPointOptions(); jigPositionOptions.UserInputControls = (UserInputControls.Accept3dCoordinates | UserInputControls.NullResponseAccepted | UserInputControls.NoNegativeResponseAccepted | UserInputControls.GovernedByOrthoMode); jigPositionOptions.SetMessageAndKeywords(Environment.NewLine + "Upuść znak lub obróc [Vertical/Horizontal/KEnd]", "Vertical Horizontal KEnd"); jigPositionOptions.Keywords.Default = (angle == 0) ? "Vertical" : "Horizontal"; PromptPointResult jigPositionPromptResult = prompts.AcquirePoint(jigPositionOptions); return jigPositionPromptResult; }
protected override SamplerStatus Sampler(JigPrompts prompts) { JigPromptPointOptions promOpts = new JigPromptPointOptions(""); promOpts.UserInputControls = (UserInputControls.Accept3dCoordinates | UserInputControls.NoNegativeResponseAccepted | UserInputControls.NoZeroResponseAccepted | UserInputControls.NullResponseAccepted); switch (m_status) { case CommandStatus.kWaitForStartPnt: promOpts.BasePoint = m_fistPnt; promOpts.UseBasePoint = true; promOpts.Cursor = CursorType.RubberBand; promOpts.Message = "\n输入插入点:"; break; case CommandStatus.kWatiForOtherPnt: promOpts.BasePoint = m_startPnt; promOpts.UseBasePoint = true; promOpts.Cursor = CursorType.RubberBand; promOpts.Message = "\n输入插入点:"; promOpts.SetMessageAndKeywords( "\n下一个点[Undo]: ", "放弃" ); break; default: return(SamplerStatus.Cancel); } PromptPointResult res = prompts.AcquirePoint(promOpts); if (res.Value == m_lastPnt) { return(SamplerStatus.NoChange); } if (res.Status == PromptStatus.OK) { m_lastPnt = res.Value; return(SamplerStatus.OK); } return(SamplerStatus.Cancel); }
protected override SamplerStatus Sampler(JigPrompts prompts) { JigPromptPointOptions jigPromptPointOption = new JigPromptPointOptions(); jigPromptPointOption.SetMessageAndKeywords((this._isFrench ? "\nSpécifiez le point d'insertion [annUler]: " : "\nSpecify insertion point [Undo]"), (this._isFrench ? "annUler" : "Undo")); jigPromptPointOption.AppendKeywordsToMessage = this._cnt > 0; jigPromptPointOption.UserInputControls = UserInputControls.Accept3dCoordinates | UserInputControls.NullResponseAccepted; PromptPointResult promptPointResult = prompts.AcquirePoint(jigPromptPointOption); if (this._pos.DistanceTo(promptPointResult.Value) < Tolerance.Global.EqualPoint) { return(SamplerStatus.NoChange); } this._pos = promptPointResult.Value; return(SamplerStatus.OK); }
protected override SamplerStatus Sampler(JigPrompts prompts) { JigPromptPointOptions opts = new JigPromptPointOptions(); opts.UserInputControls = (UserInputControls.Accept3dCoordinates | UserInputControls.AcceptMouseUpAsPoint | UserInputControls.DoNotUpdateLastPoint); switch (_mPts.Count) { case 1: opts.UserInputControls |= UserInputControls.NullResponseAccepted; opts.Message = "\nPick Next Vertex: "; opts.BasePoint = _mTempPoint; opts.UseBasePoint = true; break; default: opts.UserInputControls |= UserInputControls.NullResponseAccepted; opts.BasePoint = _mPts[_mPts.Count - 1]; opts.UseBasePoint = true; opts.SetMessageAndKeywords("\nPick Next/Last Vertex or [End]; ", "End"); break; } PromptPointResult res = prompts.AcquirePoint(opts); if (res.Status == PromptStatus.Keyword) { if (res.StringResult == "End") { return(SamplerStatus.Cancel); } } if (_mTempPoint == res.Value) { return(SamplerStatus.NoChange); } if (res.Status == PromptStatus.OK) { _mTempPoint = res.Value; return(SamplerStatus.OK); } return(SamplerStatus.Cancel); }
protected override SamplerStatus Sampler(JigPrompts prompts) { JigPromptPointOptions jigOpts = new JigPromptPointOptions(); jigOpts.UserInputControls = (UserInputControls.Accept3dCoordinates) | UserInputControls.NoZeroResponseAccepted | UserInputControls.NoNegativeResponseAccepted; jigOpts.SetMessageAndKeywords("\nSurround plot area: " + "\nTab to rotate window [ROtate90]:", "ROtate90"); PromptPointResult ppr = prompts.AcquirePoint(jigOpts); if (ppr.Status == PromptStatus.Keyword) { if (ppr.StringResult == "ROtate90") { //CW subtract 90 deg & normalize the angle between 0 & 360 _angle -= Math.PI / 2; while (_angle < Math.PI * 2) { _angle += Math.PI * 2; } } return(SamplerStatus.OK); } else if (ppr.Status == PromptStatus.OK) { if (mActualPoint == ppr.Value) { return(SamplerStatus.NoChange); } else { mActualPoint = ppr.Value; } return(SamplerStatus.OK); } return(SamplerStatus.Cancel); }
protected override SamplerStatus Sampler(JigPrompts prompts) { var jigOpts = new JigPromptPointOptions(); jigOpts.UserInputControls = (UserInputControls.Accept3dCoordinates | UserInputControls.NullResponseAccepted | UserInputControls.NoNegativeResponseAccepted ); if (m_pts.Count == 0) { jigOpts.Message = "\n选择第一个点: "; } else if (m_pts.Count > 0) { jigOpts.UseBasePoint = true; jigOpts.Cursor = CursorType.RubberBand; jigOpts.BasePoint = m_pts[m_pts.Count - 1]; jigOpts.Message = "\n下一个点: "; jigOpts.SetMessageAndKeywords( "\n下一个点[Undo]: ", "放弃" ); } PromptPointResult res = prompts.AcquirePoint(jigOpts); if (res.Value == m_tempPoint) { return(SamplerStatus.NoChange); } if (res.Status == PromptStatus.OK) { m_tempPoint = res.Value; return(SamplerStatus.OK); } return(SamplerStatus.Cancel); }
protected override SamplerStatus Sampler(JigPrompts prompts) { JigPromptPointOptions opts = new JigPromptPointOptions(); // Not all options accept null response opts.UserInputControls = (UserInputControls.Accept3dCoordinates | UserInputControls.NoNegativeResponseAccepted ); // Get the first point if (m_pts.Count == 0) { opts.UserInputControls |= UserInputControls.NullResponseAccepted; opts.Message = "\nStart point of multileader: "; opts.UseBasePoint = false; } // And the second else if (m_pts.Count == 1) { opts.BasePoint = m_pts[m_pts.Count - 1]; opts.UseBasePoint = true; opts.Message = "\nSpecify multileader vertex: "; } // And subsequent points else if (m_pts.Count > 1) { opts.UserInputControls |= UserInputControls.NullResponseAccepted; opts.BasePoint = m_pts[m_pts.Count - 1]; opts.UseBasePoint = true; opts.SetMessageAndKeywords( "\nSpecify multileader vertex or [End]: ", "End" ); } else // Should never happen return SamplerStatus.Cancel; PromptPointResult res = prompts.AcquirePoint(opts); if (res.Status == PromptStatus.Keyword) { if (res.StringResult == "End") { return SamplerStatus.Cancel; } } if (m_tempPoint == res.Value) { return SamplerStatus.NoChange; } else if (res.Status == PromptStatus.OK) { m_tempPoint = res.Value; return SamplerStatus.OK; } return SamplerStatus.Cancel; }
protected override SamplerStatus Sampler(JigPrompts jp) { // We acquire a point but with keywords JigPromptPointOptions po = new JigPromptPointOptions( "\nPosition of text"); po.UserInputControls = UserInputControls.Accept3dCoordinates | UserInputControls.NullResponseAccepted | UserInputControls.NoNegativeResponseAccepted | UserInputControls.GovernedByOrthoMode; po.SetMessageAndKeywords( "\nSpecify position of text or [Bold/Italic/LArger/Smaller/ROtate90/LEft/Middle/RIght]: ", "Bold Italic LArger Smaller ROtate90 LEft Middle RIght"); PromptPointResult ppr = jp.AcquirePoint(po); if (ppr.Status == PromptStatus.Keyword) { switch (ppr.StringResult) { case "Bold": { _toggleBold = true; break; } case "Italic": { _toggleItalic = true; break; } case "LArger": { // Multiple the text size by two _txtSize *= 2; break; } case "Smaller": { // Divide the text size by two _txtSize /= 2; break; } case "ROtate90": { // To rotate clockwise we subtract 90 degrees and // then normalize the angle between 0 and 360 _angle -= Math.PI / 2; while (_angle < Math.PI * 2) { _angle += Math.PI * 2; } break; } case "LEft": { _align = TextHorizontalMode.TextLeft; break; } case "RIght": { _align = TextHorizontalMode.TextRight; break; } case "Middle": { _align = TextHorizontalMode.TextMid; break; } } return(SamplerStatus.OK); } else if (ppr.Status == PromptStatus.OK) { // Check if it has changed or not (reduces flicker) if (_position.DistanceTo(ppr.Value) < Tolerance.Global.EqualPoint) { return(SamplerStatus.NoChange); } _position = ppr.Value; return(SamplerStatus.OK); } return(SamplerStatus.Cancel); }