Exemple #1
0
// 查找从根类型派生的图元
void ArxClassHelper::GetArxClassTypes( const CString& root, AcStringArray& types, bool findAbstractType )
{
    // 如果根类型不存在,默认为AcDbObject
    AcRxClass* pParentClass = AcRxClass::cast( acrxClassDictionary->at( root ) );
    if( pParentClass == 0 ) pParentClass = AcDbObject::desc();

    AcRxDictionaryIterator* iter = acrxClassDictionary->newIterator();
    if( iter == 0 ) return;

    for( ; !iter->done(); iter->next() )
    {
        AcRxClass* pClass;
        if( ( pClass = AcRxClass::cast( iter->object() ) ) != NULL )
        {
            if( pClass->isDerivedFrom( pParentClass ) )
            {
                const ACHAR* text = pClass->name();
                if( text == NULL ) continue;

                if( !findAbstractType && ( pClass->dxfName() == NULL ) || ( pClass->appName() == NULL ) ) continue;

                //acutPrintf(_T("appName:%s\ndxfName:%s\nname:%s\n"), pClass->appName(), pClass->dxfName(), pClass->name());
                types.append( text );
            }
        }
    }
    delete iter;
}
void
ArxDbgUiDlgClassDict::buildClassList()
{
        // get an interator over the class dictionary
    AcRxDictionary* classDict = acrxClassDictionary;
    AcRxDictionaryIterator* iter;
    if ((classDict == NULL) || ((iter = classDict->newIterator()) == NULL)) {
        ArxDbgUtils::stopAlertBox(_T("ERROR: Couldn't get class dictionary."));
        return;
    }
        // iterate over each item and get its info
    AcRxObject* classDictItem;
    AcRxClass* classObj;
    const char* text;
    CString str, className, dxfName, appName;

    for (; !iter->done(); iter->next()) {
        classDictItem = iter->object();
        if ((classObj = AcRxClass::cast(classDictItem)) != NULL) {
            if ((text = classObj->appName()) != NULL)
                appName = text;
            else
                appName = _T("");

            if ((text = classObj->name()) != NULL)
                className = text;
            else
                className = _T("");

            if ((text = classObj->dxfName()) != NULL)
                dxfName = text;
            else
                dxfName = _T("");

            m_classNameStrList.AddTail(className);
            m_dxfNameStrList.AddTail(dxfName);
            m_appNameStrList.AddTail(appName);
			
			if (dxfName.IsEmpty()) {
				m_proxyStrList.AddTail(_T(""));
				m_birthDwgVerList.AddTail(_T(""));
				m_birthMntVerList.AddTail(_T(""));
			}
			else {
				int dwgVer = 0;
				int maintVer = 0;
				classObj->getClassVersion(dwgVer, maintVer);

				m_proxyStrList.AddTail(ArxDbgUtils::intToStr(classObj->proxyFlags(), str));
				m_birthDwgVerList.AddTail(ArxDbgUtils::dwgVersionToStr(static_cast<AcDb::AcDbDwgVersion>(dwgVer), str));
				m_birthMntVerList.AddTail(ArxDbgUtils::intToStr(maintVer, str));
			}
        }
        else {
            ArxDbgUtils::stopAlertBox(_T("ERROR: found non AcRxClass in class dictionary!"));
        }
    }
    delete iter;
}
Exemple #3
0
bool ArxClassHelper::IsAbstractClass( const CString& type )
{
    AcRxClass* pClass = AcRxClass::cast( acrxClassDictionary->at( type ) );
    if( pClass == 0 ) return false; // 类型不存在

    // 抽象类,使用ACRX_NO_CONS_DEFINE_MEMBERS宏定义
    return ( ( pClass->dxfName() == NULL ) || ( pClass->appName() == NULL ) );
}
Exemple #4
0
void ArxClassHelper::GetClassHierarchy( const CString& type, AcStringArray& types, bool findAbstractType )
{
    AcRxClass* pClass = AcRxClass::cast( acrxClassDictionary->at( type ) );
    if( pClass == 0 ) return;

    while( pClass != AcDbEntity::desc() )
    {
        // 排除抽象类型
        if( !findAbstractType && ( ( pClass->dxfName() == NULL ) || ( pClass->appName() == NULL ) ) )
        {
            pClass = pClass->myParent();
            continue;
        }

        types.append( pClass->name() );
        pClass = pClass->myParent();
    }
    types.reverse();
}