#include "T2FloorPtrList.h" #include "T2Tenant.h" #include "T2TenantArray.h" #include "T2TenantArrayList.h" T2FloorPtrList::T2FloorPtrList(T2TenantArrayList* inList) { LArrayIterator iterator(*inList); T2TenantArray *theArray; while (iterator.Next(&theArray)) { for (int i = 0; i < T2TenantArray::kGroupSize; i++) { T2Tenant *theTenant = theArray->GetIndexTenant(i); if (theTenant->IsUsed() && theTenant->IsFloor() && theTenant->IsBuildFinish()) AddItem(theTenant); } } } /*virtual*/ T2FloorPtrList::~T2FloorPtrList() { } int T2FloorPtrList::CalcDistance(int inIndexA, int inIndexB) { int distance = -1; T2Tenant *theFloorA = (T2Tenant *) GetItem(inIndexA); T2Tenant *theFloorB = (T2Tenant *) GetItem(inIndexB); if (theFloorA && theFloorB) { RECT rectA, rectB; theFloorA->GetEquipArea(rectA); theFloorB->GetEquipArea(rectB); distance = (rectA.bottom - 1) - (rectB.bottom - 1); if (distance < 0) distance *= -1; } return distance; }