// 获得数据 bool NFCRecord::QueryRow(const int nRow, NFIDataList& varList) { if (!ValidRow(nRow)) { return false; } if (!IsUsed(nRow)) { return false; } varList.Clear(); for (int i = 0; i < GetCols(); ++i) { NF_SHARE_PTR<NFIDataList::TData> pVar = mtRecordVec.at(GetPos(nRow, i)); if (pVar.get()) { varList.Append(*pVar); } else { switch (GetColType(i)) { case TDATA_INT: varList.Add(NFINT64(0)); break; case TDATA_FLOAT: varList.Add(0.0f); break; case TDATA_STRING: varList.Add(NULL_STR.c_str()); break; case TDATA_OBJECT: varList.Add(NFGUID()); break; default: return false; break; } } } if (varList.GetCount() != GetCols()) { return false; } return true; }
const int NFCGridModule::GetAroundObject(NFCSceneGridInfo* pGridInfo, NFIDataList& objectList, EGRID_AROUND eAround /*= EGRID_AROUND_9 */) { if (!pGridInfo) { return 0; } NFCDataList gridList; if (GetAroundGrid(pGridInfo, gridList, eAround) > 0) { for (int i = 0; i < gridList.GetCount(); i++) { NFCSceneGridInfo* pGridInfo = (NFCSceneGridInfo*)(gridList.Pointer(i)); if (pGridInfo) { NFIDENTID ident; bool bRet = pGridInfo->First(ident); while (bRet) { objectList.Add(ident); bRet = pGridInfo->Next(ident); } } } } return objectList.GetCount(); }
const int NFCGridModule::GetAroundGrid(NFCSceneGridInfo* pGridInfo, NFIDataList& gridList, EGRID_AROUND eAround /*= EGRID_AROUND_9 */) { int nObjectCount = 0; if (!pGridInfo) { return nObjectCount; } gridList.Add(pGridInfo); nObjectCount += pGridInfo->Count(); switch (eAround) { case EGRID_AROUND_9: { for (int i = 0; i < EGRID_DIRECTION_MAXCOUNT; i++) { NFCSceneGridInfo* pInfo = pGridInfo->GetConnectGrid((EGRID_DIRECTION)i); if (pInfo) { gridList.Add(pInfo); //gridList.push_back( pInfo ); nObjectCount += pInfo->Count(); } } } break; case EGRID_AROUND_16: break; case EGRID_AROUND_25: break; case EGRID_AROUND_ALL: break; default: break; } return nObjectCount; }