iCAx开思工具箱

标题: 同一对话面板,我要选择两条直线,但始终只能选择一条 [打印本页]

作者: zsong22    时间: 2013-6-24 11:45
标题: 同一对话面板,我要选择两条直线,但始终只能选择一条

也就是说,我传递机制没做成功。我要是把      _pWiperAgent -> AddOrderedElementType("CATCurve");   这句话换成_pWiperAgent -> AddOrderedElementType("CATSurface");  来选择面,则两个都能选取。

void AreaCheckCmd::BuildGraph()
{
    _pAxisAgent                        = new CATFeatureImportAgent ( "CurveAgent", NULL, NULL, MfNoDuplicateFeature ) ;
        _pWiperAgent                        = new CATFeatureImportAgent ( "CurveAgent", NULL, NULL, MfNoDuplicateFeature ) ;
    _pOKAgent                                = new CATDialogAgent( "OKButton") ;
        _pOKAgent-> AcceptOnNotify( pAreaCheckDlg , pAreaCheckDlg->GetDiaOKNotification() );

//代理只能够选择实现接口CATSurface和CATPoint,CATCurve的组件,即此代理只能够选择面和曲线
        _pAxisAgent -> AddOrderedElementType( "CATCurve" );
        _pWiperAgent -> AddOrderedElementType("CATCurve");//一维的:CATIMfMonoDimResult
        _pAxisAgent -> SetBehavior( CATDlgEngWithPrevaluation | CATDlgEngWithCSO  | CATDlgEngOneShot  );
        _pWiperAgent -> SetBehavior( CATDlgEngWithPrevaluation | CATDlgEngWithCSO  | CATDlgEngOneShot  );

        //-----------------------------------------------------------------------------
        // Command States
        //-----------------------------------------------------------------------------
        CATDialogState *WaitForAxisState= GetInitialState("选择基准轴线");
        WaitForAxisState -> AddDialogAgent( _pAxisAgent);
       
        CATDialogState *WaitForWiperState= GetInitialState("选择与轴线相对应的线条");
        WaitForWiperState -> AddDialogAgent( _pWiperAgent);
       
        CATDialogState *OKState= GetInitialState("确定");
        OKState -> AddDialogAgent( _pOKAgent);
        //-----------------------------------------------------------------------------
        // Transitions
        //-----------------------------------------------------------------------------
        // 选择线
        AddTransition ( WaitForAxisState , WaitForWiperState ,
                IsOutputSetCondition ( _pAxisAgent ) ,
                Action ( ( ActionMethod ) &AreaCheckCmd::AxisSelected ) );
        //选择线
        AddTransition ( WaitForWiperState , OKState ,
                IsOutputSetCondition ( _pWiperAgent ) ,
                Action ( ( ActionMethod ) &AreaCheckCmd::WiperSelected ) );
        //传递到OK按钮
        AddTransition ( OKState , NULL ,
                IsOutputSetCondition ( _pOKAgent ) ,
                Action ( ( ActionMethod ) &AreaCheckCmd::OkAction ) );

        AddAnalyseNotificationCB (pAreaCheckDlg,
                pAreaCheckDlg->GetDiaCANCELNotification(),//这里 标明作用部分  为 取消按钮
                (CATCommandMethod)&AreaCheckCmd::CancelAction,
                NULL);
        AddAnalyseNotificationCB (pAreaCheckDlg,
                pAreaCheckDlg->GetWindCloseNotification(),//这里 标明作用部分  为 关闭按钮  也就是右上角的 叉
                (CATCommandMethod)&AreaCheckCmd::CancelAction,
                NULL);

}



该贴已经同步到 zsong22的微博
作者: zsong22    时间: 2013-6-24 14:45
修改搞定:
//-----------------------------------------------------------------------------
        // Command States
        //-----------------------------------------------------------------------------
        CATDialogState *WaitForAxisState= GetInitialState("选择基准轴线");
        WaitForAxisState -> AddDialogAgent( _pAxisAgent);
       
        CATDialogState *WaitForWiperState= AddDialogState("选择与轴线相对应的线条");
        WaitForWiperState -> AddDialogAgent( _pWiperAgent);
       
        CATDialogState *OKState= AddDialogState("确定");
        OKState -> AddDialogAgent( _pOKAgent);
作者: zsong22    时间: 2013-6-24 15:59
这样一来遇到新问题就是,一旦在选择的过程中,选错线条了,就没法修改了! 很是郁闷!
作者: linlily0925    时间: 2013-6-25 09:33
因为你一直在GetInitialState,如果有添加其他的状态,用AddDialogState

作者: linlily0925    时间: 2013-6-25 09:33
zsong22 发表于 2013-6-24 15:59
这样一来遇到新问题就是,一旦在选择的过程中,选错线条了,就没法修改了! 很是郁闷!

没法修改是因为你的状态没有切换,你可以试着多添加几个状态,或者添加Editor的Focus





欢迎光临 iCAx开思工具箱 (https://t.icax.org/) Powered by Discuz! X3.3