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;
}
Ejemplo n.º 2
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;
}
Ejemplo n.º 3
0
AcDbObject* ArxClassHelper::CreateObjectByType( const CString& type )
{
    AcRxClass* pClass = AcRxClass::cast( acrxClassDictionary->at( type ) );
    if( pClass == 0 ) return 0; // 类型不存在

    return AcDbObject::cast( pClass->create() );
}
Ejemplo n.º 4
0
void DrawHelper::ConfigDraw( const CString& geType, const CString& drawName )
{
    MineGEDraw* pDraw = MineGEDrawSystem::GetInstance()->getGEDraw( geType, drawName );
    if( pDraw == 0 ) return; // 该绘制效果不存在

    pDraw->configExtraParams(); // 配置附加参数

    AcDbObjectIdArray objIds;
    ArxDataTool::GetEntsByType( geType, objIds, false );
    if( objIds.isEmpty() ) return; // dwg图形中没有任何geType类型图元

    AcTransaction* pTrans = actrTransactionManager->startTransaction();
    if( pTrans == 0 ) return;

    int len = objIds.length();
    for( int i = 0; i < len; i++ )
    {
        AcDbObject* pObj;
        if( Acad::eOk != pTrans->getObject( pObj, objIds.at( i ), AcDb::kForWrite ) ) continue;

        MineGE* pGE = MineGE::cast( pObj );
        if( pGE == 0 ) continue;

        pGE->configDraw( pDraw->isA()->name() ); // 更新extra param
        pGE->recordGraphicsModified( true );   // 更新图形
    }
    actrTransactionManager->endTransaction();

    AcRxClass* pClass = AcRxClass::cast( acrxClassDictionary->at( geType ) );
    if( pClass != 0 && pClass->isDerivedFrom( LinkedGE::desc() ) )
    {
        UpdateLinkedGE( objIds );
    }
}
Ejemplo n.º 5
0
void DrawHelper::SwitchDraw( const CString& geType, const CString& drawName )
{
    // 设置当前可视化效果
    if( !SetCurDraw( geType, drawName ) ) return;

    // 更新所有指定类型的图元
    AcDbObjectIdArray objIds;
    ArxDataTool::GetEntsByType( geType, objIds, false );
    if( objIds.isEmpty() ) return; // dwg图形中没有任何MineGE类型图元

    // 将所有geType类型图元的绘制效果更新
    AcTransaction* pTrans = actrTransactionManager->startTransaction();
    if( pTrans == 0 ) return;

    int len = objIds.length();
    for( int i = 0; i < len; i++ )
    {
        AcDbObject* pObj;
        if( Acad::eOk != pTrans->getObject( pObj, objIds.at( i ), AcDb::kForWrite ) ) continue;

        MineGE* pGE = MineGE::cast( pObj );
        if( pGE == 0 ) continue;

        pGE->updateDraw();             // 更细可视化效果指针
        //pGE->recordGraphicsModified(true);  // 更新图形
    }

    actrTransactionManager->endTransaction();

    AcRxClass* pClass = AcRxClass::cast( acrxClassDictionary->at( geType ) );
    if( pClass != 0 && pClass->isDerivedFrom( LinkedGE::desc() ) )
    {
        UpdateLinkedGE( objIds );
    }
}
Ejemplo n.º 6
0
// 获取图元的dxf名称
// 和类名称一样,dxf名称也必须是唯一的
bool ArxClassHelper::GetDxfName( const CString& type, CString& dxfName )
{
    AcRxClass* pClass = AcRxClass::cast( acrxClassDictionary->at( type ) );
    if( pClass == 0 ) return false;

    dxfName = pClass->dxfName();
    return true;
}
Ejemplo n.º 7
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 ) );
}
void
AecUiPrEntitySet::getAllowableClassTypes()
{
    ASSERT(m_allowedClassTypes.length() == m_doIsATest.length());

    m_classTypeCache = m_allowedClassTypes;     // copy over all the definite classes that are ok

    AcRxDictionaryIterator* iter;
    AcRxDictionary* classDict = acrxClassDictionary;
    if (classDict == NULL) {
        AEC_ASSERT(0);
        return;
    }

    int len = m_doIsATest.length();
    for (int i=0; i<len; i++) {
        // if not doing isA() testing, must get all classes derived from
        // this one.
        if (m_doIsATest[i] == Adesk::kFalse) {
            iter = classDict->newIterator();
            if (iter != NULL) {
                // iterate over each item and get its info
                AcRxObject* classDictItem;
                AcRxClass* classObj;

                for (; !iter->done(); iter->next()) {
                    classDictItem = iter->object();
                    if ((classObj = AcRxClass::cast(classDictItem)) != NULL) {
                        if (classObj->isDerivedFrom(static_cast<AcRxClass*>(m_allowedClassTypes[i]))) {
                            if (m_classTypeCache.contains(classObj) == Adesk::kFalse) {
                                m_classTypeCache.append(classObj);
                            }
                        }
                    }
                    else {
                        AEC_ASSERT(0);
                    }
                }
                delete iter;
            }
            else {
                AEC_ASSERT(0);
            }
        }
    }
}
Ejemplo n.º 9
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;
}
Ejemplo n.º 10
0
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;
}
Ejemplo n.º 11
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;
}
Ejemplo n.º 12
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();
}