试了一下,有几个问题
1,query不到CATIDrwDimDimension
2. ipiAnnot -> GetAssociativePosition (piAssocPos);直接去kick GetAssociativePosition(CATIDrwAssociativePosition_var & opos)
不要说help,连CATIDrwAssociativePosition的.h文件我都找不到,这应该是个不公开的IF吧?
下面是我试过的做法(4种)
// delete position link
do {
break;
CATITPS * piTPS = NULL;
rc = piText -> QueryInterface(IID_CATITPS,
(void **) &piTPS);
if ( ( SUCCEEDED(rc) ) && !!piTPS ) {
// make a blank list
CATITTRSList* pTTRSList = NULL;
rc = ::CATCreateCATITTRSList( NULL, &pTTRSList);
if ( SUCCEEDED(rc) && !!pTTRSList ) {
piTPS->SetTTRS( pTTRSList);
}
if ( !!pTTRSList ) {
pTTRSList -> Release();
pTTRSList = NULL;
}
}
if ( !!piTPS ) {
piTPS -> Release();
piTPS = NULL;
}
} while (false);
do {
break;
CATITPS * piTPS = NULL;
rc = piText -> QueryInterface(IID_CATITPS,
(void **) &piTPS);
if ( ( FAILED(rc) ) || !piTPS ) {
break;
}
// get exist list
CATITTRSList* pTTRSList = NULL;
rc = piTPS->GetTTRS( &pTTRSList);
if ( FAILED(rc) || !pTTRSList ) {
break;
}
unsigned int iCntTol = 0;
rc = pTTRSList->Count(&iCntTol);
if ( FAILED(rc) ) {
break;
}
for ( unsigned int iCnt = iCntTol; iCnt > 0; iCnt-- ) {
CATITTRS* pTempTTRS = NULL;
rc = pTTRSList->Item( iCnt-1, &pTempTTRS);
rc = pTTRSList->Remove( pTempTTRS);
}
if ( !!piTPS ) {
piTPS -> Release();
piTPS = NULL;
}
} while (false);
do {
break;
CATITPS * piTPS = NULL;
rc = piText -> QueryInterface(IID_CATITPS,
(void **) &piTPS);
if ( ( FAILED(rc) ) || !piTPS ) {
break;
}
// get exist list
CATITTRSList* pTTRSList = NULL;
rc = piTPS->GetTTRS( &pTTRSList);
if ( FAILED(rc) || !pTTRSList ) {
break;
}
unsigned int iCntTol = 0;
rc = pTTRSList->Count(&iCntTol);
if ( FAILED(rc) ) {
break;
}
for ( unsigned int iCnt = iCntTol; iCnt > 0; iCnt-- ) {
CATITTRS* pTempTTRS = NULL;
rc = pTTRSList->Item( iCnt-1, &pTempTTRS);
if ( !pTempTTRS ) {
continue;
}
CATLISTV(CATBaseUnknown_var) oListe;
if ( FAILED( pTempTTRS->GetComponents( oListe))) {
continue;
}
for ( int iCntCom = 1; iCntCom <= oListe.Size(); iCntCom++ ) {
pTempTTRS->RemoveComponent( oListe[iCntCom] );
}
if ( !!pTempTTRS ) {
pTempTTRS -> Release();
pTempTTRS = NULL;
}
}
if ( !!piTPS ) {
piTPS -> Release();
piTPS = NULL;
}
} while (false);
do {
CATIDrwAnnotation * piAnnot = NULL;
rc = piText -> QueryInterface (IID_CATIDrwAnnotation,
(void**) & piAnnot);
if ( FAILED(rc) || !piAnnot) {
break;
}
CATIDrwDimDimension * piDimElem = NULL;
rc = piText -> QueryInterface (IID_CATIDrwDimDimension,
(void**) &piDimElem);
if ( FAILED(rc) || !piDimElem) {
break;
}
CATBaseUnknown *piAssocPos = NULL;
CATAssProjectingMode mode = Ass_Contour;
piAnnot -> GetAssociativePosition (piAssocPos, mode);
if ( !piAssocPos ) {
break;
}
CATISpecObject* piSpecAssocPos = NULL;
rc = piAssocPos -> QueryInterface (IID_CATISpecObject,
(void **) &piSpecAssocPos);
if( FAILED(rc) || !piSpecAssocPos ) {
break;
}
CATISpecObject* piSpecFather = piSpecAssocPos -> GetFather();
if ( !!piSpecFather ) {
piSpecFather -> Remove(piAssocPos);
piSpecFather -> Release();
piSpecFather = NULL;
}
piSpecAssocPos -> Release();
piSpecAssocPos = NULL;
piDimElem -> Release();
piDimElem = NULL;
piAnnot -> Release();
piAnnot = NULL;
} while (false);
这个查到的header,里面有几个helpl之外的nodoc的method
00001 #ifndef CATIDrwAnnotation_H
00002 #define CATIDrwAnnotation_H
00003 // COPYRIGHT DASSAULT SYSTEMES 1999
00004
00009 #include "CATBaseUnknown.h"
00010 #include "CATDrwDimDefine.h"
00011 #include "CATDrwAssDefs.h" // INCLUDE_AUTORISE
00012 #include "booleanDef.h" // INCLUDE_AUTORISE
00013
00014 class CATIDrwAssociativePosition_var;
00015 class CATIDrwAssociativeOrientation_var;
00016
00017 #include "DraftingItfCPP.h"
00018 #ifndef LOCAL_DEFINITION_FOR_IID
00019 extern ExportedByDraftingItfCPP IID IID_CATIDrwAnnotation ;
00020 #else
00021 extern "C" const IID IID_CATIDrwAnnotation ;
00022 #endif
00023
00027 class ExportedByDraftingItfCPP CATIDrwAnnotation : public CATBaseUnknown
00028 {
00029 CATDeclareInterface;
00030
00031 public:
00032
00036 virtual void InitPosition(double iXPos , double iYPos , double iAngle) = 0;
00037
00041 virtual void GetPosition (double & oXPos , double & oYPos ) = 0;
00045 virtual void SetPosition (double iXPos , double iYPos ) = 0;
00051 virtual void Move(double ideltaX, double ideltaY) = 0;
00052
00056 virtual double GetOrientation() = 0;
00060 virtual void SetOrientation(double iAngle) = 0;
00064 virtual void Rotate(double iDeltaAngle) = 0;
00065
00069 virtual HRESULT GetAssociativePosition(CATIDrwAssociativePosition_var & opos) =0;
00073 virtual HRESULT SetAssociativePosition(CATIDrwAssociativePosition_var & ipos) =0;
00074
00075
00076
00090 virtual HRESULT GetAssociativeOrientation(CATBaseUnknown * &oRef,CATAssProjectingMode &oProjMode) = 0;
00091
00107 virtual HRESULT SetAssociativeOrientation(CATBaseUnknown * iRef,CATAssProjectingMode iProjMode=Ass_Contour) = 0;
00108
00109
00123 virtual HRESULT GetAssociativePosition(CATBaseUnknown * &oRef,CATAssProjectingMode &oProjMode) = 0;
00124
00150 virtual HRESULT SetAssociativePosition(CATBaseUnknown * iRef,
00151 double iDelta=0.0, boolean iComputeDelta=TRUE,
00152 CATAssPositioningBehavior iPosBehavior=Ass_Relative,
00153 CATAssProjectingMode iProjMode=Ass_Contour) = 0;
00154
00158 virtual HRESULT GetAssociativeOrientation(CATIDrwAssociativeOrientation_var & oori) =0;
00162 virtual HRESULT SetAssociativeOrientation(CATIDrwAssociativeOrientation_var & iori) =0;
00163 };
00164 CATDeclareHandler(CATIDrwAnnotation, CATBaseUnknown);
00165 #endif |