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;
}
struct resbuf*
AecUiPrEntitySet::keywordCallback(const TCHAR* str)
{
    if (AecUiPrEntitySet::m_currentPromptObj == NULL) {
        AEC_ASSERT(0);
        return NULL;
    }

    AecRmCString tmpStr;
    AecRmCString tmpStr2(GetAecUiBaseAppName(), AECU_STR_KEYWORDCALLBACK_AECUIPRENTITYSET_FILTERS, TRUE);
    AecRmCString tmpStr3(GetAecUiBaseAppName(), AECU_STR_KEYWORDCALLBACK_AECUIPRENTITYSET_ALLOWED_OBJECT, TRUE);

    ads_printf(tmpStr2);        //~  "\nFILTERS:"
    Aec::ads_printf(GetAecUiBaseAppName(), AECU_STR_KEYWORDCALLBACK_AECUIPRENTITYSET_LOCKED_LAYERS,       //~ "\n  Locked Layers:        %s"
                    Aec::booleanToStr(AecUiPrEntitySet::m_currentPromptObj->m_filterLockedLayers, tmpStr));
    ads_printf(tmpStr3);        //~  "\n  Allowed Object Types:"

    int len = AecUiPrEntitySet::m_currentPromptObj->m_classTypeCache.length();
    if (len == 0) {
        AecRmCString tmpStr4(GetAecUiBaseAppName(), AECU_STR_KEYWORDCALLBACK_AECUIPRENTITYSET_ALL_ENTITIES, TRUE);
        ads_printf(tmpStr4);    //~  "\n    All entities allowed."
    }
    else {
        AcRxClass* classType;
        for (int i=0; i<len; i++) {
            classType = static_cast<AcRxClass*>(AecUiPrEntitySet::m_currentPromptObj->m_classTypeCache[i]);
            ads_printf(_DNT(_T("\n    %s")), classType->name());
        }
    }

    ads_printf(_DNT(_T("\n")));

    return NULL;
}
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 #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();
}
Exemple #5
0
bool
ArxDbgUiPrEntity::correctClass(AcDbEntity* ent)
{
    if (m_allowedClassTypes.isEmpty())
        return Adesk::kTrue;

    AcRxClass* rxClass;
    int len = m_allowedClassTypes.length();
    bool isOk = false;
    for (int i=0; i<len; i++) {
        rxClass = static_cast<AcRxClass*>(m_allowedClassTypes[i]);
        if (m_doIsATest[i]) {
            if (ent->isA() == rxClass)
                isOk = true;
        }
        else {
            if (ent->isKindOf(rxClass))
                isOk = true;
        }
    }

    if (isOk)
        return true;

        // print out error message with allowed types
    CString types;
    CString str;
    for (int ii=0; ii<len;ii++) {
        if (ii > 0)
            types += _T(", ");

        rxClass = static_cast<AcRxClass*>(m_allowedClassTypes[ii]);
        types += rxClass->name();
    }

    acutPrintf(_T("\nSelected entity must be of type: %s"), types);

    return false;
}
Exemple #6
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;
}