解释下列代码CATBoolean SJDCreateCabinSymbolCmdActionSelectObjectInMultiListvoid data HSO _pHSO-Empty; int selectCount = _pPanel-GetCabinMultiList-GetSelectCount; if selectCount != 0 int selectLineRow
该函数是一个命令操作,用于在舱室多列表中选择对象并将其添加到当前的HSO(Hierarchical Selection Object)中。函数的具体解释如下:
-
_pHSO->Empty();:清空当前的HSO。 -
int selectCount = _pPanel->GetCabinMultiList()->GetSelectCount();:获取舱室多列表中选中的对象数量。 -
if (selectCount != 0):如果选中数量不为0,则执行下面的代码。 -
int * selectLineRow = new int[selectCount];:创建一个大小为选中数量的整型数组。 -
_pPanel->GetCabinMultiList()->GetSelect(selectLineRow, selectCount);:获取选中对象的行号,并将其存储在上一步创建的数组中。 -
for (int i = 0; i < selectCount; ++i):遍历选中对象的行号数组。 -
CreateCabinSymbolObject * pTempObj = _vectorCabinObject[selectLineRow[i]];:获取当前行号对应的舱室对象。 -
for (int j = 1; j <= pTempObj->listGeom.Size(); ++j):遍历当前舱室对象的几何对象列表。 -
SetGeomToHSO(pTempObj->listGeom[j]);:将当前几何对象添加到HSO中。 -
delete[]selectLineRow; selectLineRow = NULL;:释放选中行号的数组。 -
return TRUE;:返回操作成功。
原文地址: http://www.cveoy.top/t/topic/dvDM 著作权归作者所有。请勿转载和采集!