|
马上注册,结交更多同行朋友,交流,分享,学习。
您需要 登录 才可以下载或查看,没有帐号?注册
x
我在工程图中生成了一个点,然后想用鼠标点击选择,得到点的坐标,可是总出问题得不到,劳烦各位帮我看看,谢了~~
....
CATFeatureImportAgent * _ObjectAgent;
_ObjectAgent = new CATFeatureImportAgent ( "ointAgent", NULL, NULL, NULL, NULL, NULL) ;
_ObjectAgent -> SetElementType ( "CATI2DPoint" );
_ObjectAgent -> SetBehavior ( CATDlgEngWithPrevaluation | CATDlgEngAcceptOnPrevaluate | CATDlgEngWithUndo | CATDlgEngWithPSOHSO | CATDlgEngOneShot);
_ObjectAgent -> SetAgentBehavior ( MfPermanentBody | MfLastFeatureSupport | MfRelimitedFeaturization );
// Point selection state
CATDialogState *pState1= GetInitialState("Select a point ");
pState1 -> AddDialogAgent ( _ObjectAgent );
//-----------------------------------------------------------------------------
// Transitions
AddTransition ( pState1 , NULL ,
IsOutputSetCondition ( _ObjectAgent ) ,
Action ( ( ActionMethod ) [$DmCmd::GetPoint ) )]
....
CATBoolean DmCmd::GetPoint( void *data )
{
CATPathElement* iPath=NULL;
iPath = _ObjectAgent->GetValue();
CATBaseUnknown * pObject2D = _ObjectAgent->GetElementValue(iPath);
CATMathPoint2D * pPoint = (CATMathPoint2D *) pObject2D;
x = pPoint->GetX();
y = pPoint->GetY();
_ObjectAgent -> InitializeAcquisition();
return TRUE;
} |
|