#include "area.h"
#include "card_base.h"
#include "tool_time.h"
#include "area_business_post_area.h"
/*
	确定推送人员信息时的区域,每一个明确需要推送的区域,都要推送
*/
struct pos_area:business_data
{
	pos_area(uint64_t t)
	{
		m_enter_time=t;
	}
	uint64_t m_enter_time=0;
};
//将推送区域信息加入人员数据
void area_business_post_area::on_enter(const std::shared_ptr<area_hover>&a,
						const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data>&ptr)
{
	//uint64_t t=tool_time::now_to_ms();
	//ptr=std::make_shared<pos_area>(t);
	c->set_area_info(a->mapid(),a->scale(),a->id(),a->m_enter_time,0);
}

void area_business_post_area::on_hover(const std::shared_ptr<area_hover>&a,
						const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr)
{
	//std::shared_ptr<pos_area> pa = std::dynamic_pointer_cast<pos_area>(ptr);
	//uint64_t t = pa->m_enter_time;
	c->set_area_info(0,0,a->id(),a->m_enter_time,1);
}

//从人员数据中清除区域信息
void area_business_post_area::on_leave(const std::shared_ptr<area_hover>&a,
						const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr)
{
	c->set_area_info(0,0,a->id(),0,2);
}