也就是说,我传递机制没做成功。我要是把 _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的微博 |