#include "StdAfx.h" #include "T2EquipPtrList.h" #include "T2RegistedTenantDB.h" #include "T2RegistedTenantIterator.h" #include "T2RouteNavigator.h" #include "T2Tenant.h" T2RegistedTenantIterator::T2RegistedTenantIterator(const T2RegistedTenantDB* db, unsigned int registID, const T2RouteNavigator* routeNavigator, POINT point) { mEquipPtrList = db->GetList(registID); mRouteNavigator = routeNavigator; if (mEquipPtrList && mRouteNavigator) { mIndex = 0; mPoint = point; } else { mIndex = -2; } } T2RegistedTenantIterator::~T2RegistedTenantIterator() { } BOOL T2RegistedTenantIterator::Next(T2Tenant*& pTenant) { BOOL result = false; BOOL done = false; T2Tenant *tenant = NULL; while (!done) { mIndex++; if (mIndex > 0 && mEquipPtrList->FetchItemAt(mIndex, &tenant)) { int status = tenant->GetStatus(); if (status > 9 && status < 10000) { POINT entrancePt = tenant->GetEntrancePt(); if (mRouteNavigator->CheckRoute(mPoint, entrancePt, tenant->GetCustomerSearchScore())) { pTenant = tenant; result = true; done = true; } } } else { done = true; } } return result; } BOOL T2RegistedTenantIterator::NextJob(T2Tenant*& pTenant) { BOOL result = false; BOOL done = false; T2Tenant *tenant = NULL; while (!done) { mIndex++; if (mIndex > 0 && mEquipPtrList->FetchItemAt(mIndex, &tenant)) { int status = tenant->GetStatus(); if (status > 9 && status < 10000) { POINT entrancePt = tenant->GetEntrancePt(); if (mRouteNavigator->CheckRoute(mPoint, entrancePt, tenant->GetEmployeeSearchScore())) { pTenant = tenant; result = true; done = true; } } } else { done = true; } } return result; }