예제 #1
0
        /// <summary>
        /// 初始化
        /// </summary>
        public override void Initialize()
        {
            base.Initialize();

            if (this.presenter.selections.Count == 1)
            {
                foreach (Selection sel in this.presenter.selections)
                {
                    Entity entity = this.database.GetObject(sel.objectId) as Entity;
                    _currEntity   = entity;
                    _currOffsetOp = Offset._OffsetOpsMgr.Instance.NewOffsetOperation(_currEntity);
                    break;
                }
            }
            if (_currEntity == null)
            {
                this.presenter.selections.Clear();
            }

            _step             = Step.Step1_SpecifyOffsetDistance;
            this.pointer.mode = Pointer.Mode.Locate;

            DynInputDouble offdisInput = new DynInputDouble(this.presenter, 0.0);

            offdisInput.Message = "指定偏移距离: ";
            this.dynamicInputer.StartInput(offdisInput);
            offdisInput.finish += this.OnOffsetDistanceInputReturn;
            offdisInput.cancel += this.OnOffsetDistanceInputReturn;
        }
예제 #2
0
        public override EventResult OnMouseUp(MouseEventArgs e)
        {
            switch (_step)
            {
            case Step.Step1_SpecifyOffsetDistance:
                break;

            case Step.Step2_SelectObject:
                if (e.Button == MouseButtons.Right)
                {
                    if (this.presenter.selections.Count > 0)
                    {
                        foreach (Selection sel in _mgr.presenter.selections)
                        {
                            DBObject dbobj = this.database.GetObject(sel.objectId);
                            _currEntity   = dbobj as Entity;
                            _currOffsetOp = Offset._OffsetOpsMgr.Instance.NewOffsetOperation(_currEntity);
                            break;
                        }

                        this.pointer.mode = Pointer.Mode.Locate;
                        _step             = Step.Step3_SpecifyOffsetSide;
                    }
                    else
                    {
                        _mgr.CancelCurrentCommand();
                    }
                }
                break;

            case Step.Step3_SpecifyOffsetSide:
                break;

            default:
                break;
            }

            return(EventResult.Handled);
        }