Ejemplo n.º 1
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();
}
Ejemplo n.º 2
0
bool ArxClassHelper::GetChildClass( const CString& type, AcStringArray& types )
{
    AcRxClass* pParentClass = AcRxClass::cast( acrxClassDictionary->at( type ) );
    if( pParentClass == 0 ) return false; // 类型不存在

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

    AcRxClass* pClass;
    for( ; !iter->done(); iter->next() )
    {
        if( ( pClass = AcRxClass::cast( iter->object() ) ) != NULL )
        {
            const ACHAR* text = pClass->name();
            if( ( text != NULL ) && ( pClass->myParent() == pParentClass ) )
            {
                types.append( text );
            }
        }
    }
    delete iter;
    return true;
}