当前位置: 首页>>代码示例>>C++>>正文


C++ AcDbLayerTable::upgradeOpen方法代码示例

本文整理汇总了C++中AcDbLayerTable::upgradeOpen方法的典型用法代码示例。如果您正苦于以下问题:C++ AcDbLayerTable::upgradeOpen方法的具体用法?C++ AcDbLayerTable::upgradeOpen怎么用?C++ AcDbLayerTable::upgradeOpen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AcDbLayerTable的用法示例。


在下文中一共展示了AcDbLayerTable::upgradeOpen方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ASSERT

Acad::ErrorStatus
ArxDbgUtils::addNewLayer(LPCTSTR layerName, AcDbDatabase* db)
{
	ASSERT(db != NULL);

        // if layer already exists, then just return
    AcDbLayerTable* layTbl;
	Acad::ErrorStatus es = db->getSymbolTable(layTbl, AcDb::kForRead);
	if (es != Acad::eOk)
		return es;

    if (layTbl->has(layerName)) {
        layTbl->close();
        return Acad::eOk;
    }
        // upgrade to write
    es = layTbl->upgradeOpen();
    if (es != Acad::eOk) {
        ASSERT(0);
        layTbl->close();
        return es;
    }
        // make sure the name gets set ok
    AcDbLayerTableRecord* newRec = new AcDbLayerTableRecord;
    es = newRec->setName(layerName);
    if (es != Acad::eOk) {
        delete newRec;
        layTbl->close();
        return Acad::eInvalidInput;
    }
        // look up value for default linetype CONTINUOUS,
        // AcDbLayerTableRecord doesn't set this automatically (at least it didn't in Sedona)
    newRec->setLinetypeObjectId(db->continuousLinetype());

    es = layTbl->add(newRec);
    if (es != Acad::eOk)
        delete newRec;
    else
        newRec->close();

    layTbl->close();
    return es;
}
开发者ID:FengLuanShuangWu,项目名称:AutoCADPlugin-HeatSource,代码行数:43,代码来源:ArxDbgUtilsSymTbl.cpp

示例2: Create

Acad::ErrorStatus TWArxLayer::Create( OUT AcDbObjectId& IdLayer ) const
{
	if( m_strName.IsEmpty() ) return Acad::eInvalidInput;

	AcDbDatabase* pDb = GetWorkingDB();

	Acad::ErrorStatus es = Acad::eKeyNotFound;

	AcDbLayerTable* pLayerTb = NULL;
	es = pDb->getLayerTable( pLayerTb,AcDb::kForRead );
	if( pLayerTb == NULL ) return es;
	
	es = pLayerTb->getAt( m_strName, IdLayer );
	if( es == Acad::eOk )
	{
		pLayerTb->close();
		return es;
	}

	es = pLayerTb->upgradeOpen();

	AcDbLayerTableRecord* pLtr = new AcDbLayerTableRecord;
	pLtr->setName( m_strName );
	pLtr->setIsFrozen( m_bIsFrozen );
	pLtr->setIsLocked( m_bIsLocked );
	pLtr->setIsOff( m_bIsOff );

	es = pLayerTb->add( IdLayer, pLtr );
	pLayerTb->close();

	if( es == Acad::eOk )
	{
		pLtr->close();
		return es;
	}

	TWFreePtr( pLtr );
	return es;
}
开发者ID:jiangnanemail,项目名称:WorkingDB,代码行数:39,代码来源:TWArxTool.cpp

示例3: AddEntityToLayer

// This command demonstrates the use of kCleanup / kReuse flags
void AddEntityToLayer (AsdkHlrCollector &collector, ACHAR *layerName) {
    //----- Check layer
    if ( layerName != NULL && *layerName != ACRX_T('\0') ) {
        AcDbDatabase *pDb =acdbHostApplicationServices ()->workingDatabase () ;
        AcDbLayerTable *pLayerTable ;
        pDb->getLayerTable (pLayerTable, AcDb::kForRead) ;
        if ( !pLayerTable->has (layerName) ) {
            AcDbLayerTableRecord *pLayerRecord =new AcDbLayerTableRecord ;
            pLayerRecord->setName (layerName) ;
            pLayerTable->upgradeOpen () ;
            pLayerTable->add (pLayerRecord) ;
            pLayerTable->downgradeOpen () ;
            pLayerRecord->close () ;
            pLayerTable->close () ;
            applyCurDwgLayerTableChanges () ;
        } else {
            pLayerTable->close () ;
        }
    } else {
        layerName =NULL ;
    }
    //----- Assign color to the resulting entities
    //----- red for visible edges
    //----- blue for non-visible edges
    //----- yellow for internal edges
    int n =collector.mOutputData.logicalLength () ;
    for ( int i =0 ; i < n ; i++ ) {
        AsdkHlrData *p =collector.mOutputData [i] ;

        AcDbEntity *pEnt =p->getResultEntity () ;
        AsdkHlrData::Visibility vis =p->getVisibility () ;
        if ( vis == AsdkHlrData::kVisible ) {
            pEnt->setColorIndex (1) ; //----- Read
        } else if ( vis == AsdkHlrData::kInternallyHidden ) {
            if ( p->getHlrVisibility () == AsdkHlrData::kVisible )
                pEnt->setColorIndex (2) ; //----- Yellow
            else
                pEnt->setColorIndex (3) ; //----- Green
        } else {
            pEnt->setColorIndex (5) ; //----- Blue
        }
        if ( layerName != NULL )
            pEnt->setLayer (layerName) ;
        AcDbObjectId id ;
        if ( postToDatabase (NULL, pEnt, id) != Acad::eOk ) {
            acutPrintf (_T("Failed to add entity to current space.\n")) ;
            break ;
        }

        //----- Entity originator path for block reference entities
        AcDbObjectIdArray ids =p->getObjectIds () ;
        if ( ids.logicalLength () > 0 ) {
            acutPrintf (ACRX_T("\n%ld, "), pEnt->objectId ().asOldId ()) ;
            for ( int j =0 ; j < ids.logicalLength () ; j++ ) {
                acutPrintf (ACRX_T("%ld, "), ids.at (j).asOldId ()) ;
            }
        }

        pEnt->close () ;
    }
}
开发者ID:FengLuanShuangWu,项目名称:AutoCADPlugin-HeatSource,代码行数:62,代码来源:HlrArxSampleCommands.cpp


注:本文中的AcDbLayerTable::upgradeOpen方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。