- 积分
- 621
- 明经币
- 个
- 注册时间
- 2003-5-14
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
问题,我的程序在没有加文挡反映器时,一切正常,可一加上文挡反映器时,关闭文挡抱错(见图)后经过进一步调试,发现问提在于
if (pActivatingDoc){.......}里头的代码有关,我自己实在找不出问题在那里,请教各位斑竹
我加了一个文挡反映器class bahQieTiDocManagReactor : public AcApDocManagerReactor
添加了如下功能函数
void bahQieTiDocManagReactor::documentBecameCurrent(AcApDocument* pActivatingDoc)
{
// TODO: implement this function.
if (pActivatingDoc)//问题在于下面在{...}之间的代码
{
acDocManager->lockDocument( acDocManager->curDocument(), AcAp::kWrite,NULL,NULL,true) ;
AcDbDictionary *pNamedobj;
AcDbDictionary *pDict;
acdbHostApplicationServices()->workingDatabase()
->getNamedObjectsDictionary(pNamedobj, AcDb::kForRead);
// Get a pointer to the ASDK_DICT dictionary.
AcGeIntArray layerHaoArry;
if(pNamedobj->getAt("MYLAYER_DICT",(AcDbObject*&)pDict,AcDb::kForRead)==Acad::eOk )
{
// Run through the entries and list their backpointers.
AcDbDictionaryIterator *pDictItr = pDict->newIterator();
for (; !pDictItr->done(); pDictItr->next())
{
//printOut(pDictItr->objectId());
AcDbObjectId id=pDictItr->objectId();
AcDbMyLayer *pDemo;
acdbOpenObject((AcDbObject*&)pDemo, id, AcDb::kForRead);
layerHaoArry.append(pDemo->intData());
acutPrintf("====2=======:%d\n",pDemo->intData());
pDemo->close();
}
}
pNamedobj->close();
pDict->close();
int tempLayerHao0,tempLayerHao1;
for(int p=0;p<layerHaoArry.length()-1;p++)//进行楼层排序
{
int m=p;
for(int j=p+1;j<layerHaoArry.length();j++)
{
if(layerHaoArry.at(j)<layerHaoArry.at(m))
{
m=j;
}
}
tempLayerHao0=layerHaoArry.at(p);
tempLayerHao1=layerHaoArry.at(m);
layerHaoArry.setAt(m,tempLayerHao0);
layerHaoArry.setAt(p,tempLayerHao1);
}
acDocManager->unlockDocument( acDocManager->curDocument());
for(int i=0;i<layerHaoArry.length();i++)
{
char cr[3];
acdbRToS(layerHaoArry.at(i),2,2,cr);
if(m_AihuiToolBar!=NULL){
m_AihuiToolBar->m_cmbDrawingLayer.InsertString( i, cr );}
}
}
m_AihuiToolBar为全局toolBar指针
在void InitApplication()
{
if(pQieTiDoc==NULL){
pQieTiDoc=new bahQieTiDocManagReactor();
}
acDocManager->addReactor(pQieTiDoc);
}
void UnloadApplication()
{
acDocManager->removeReactor(pQieTiDoc);
}
其中pQieTiDoc为全局bahQieTiDocManagReactor 指针
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注册
x
|