|
@@ -186,12 +186,9 @@ void area::on_leave(const std::shared_ptr<area_hover>&a,const std::shared_ptr<ca
|
|
|
i->on_leave(a,c,x);
|
|
|
}
|
|
|
}
|
|
|
-bool area::in_area(const std::shared_ptr<site>&s,const std::shared_ptr<card_location_base>&c, const point & p,int & sarid)
|
|
|
+bool area::in_area(const point &p)
|
|
|
{
|
|
|
-#ifdef SITE_AREA
|
|
|
- return false;
|
|
|
-#endif
|
|
|
- if(m_bound.empty())
|
|
|
+ if(m_bound.empty())
|
|
|
return false;
|
|
|
int counter = 0;
|
|
|
double xinters;
|
|
@@ -216,6 +213,17 @@ bool area::in_area(const std::shared_ptr<site>&s,const std::shared_ptr<card_loca
|
|
|
}
|
|
|
return (counter % 2 == 0) ? false : true;
|
|
|
}
|
|
|
+bool area::in_area(const std::shared_ptr<site>&s,const std::shared_ptr<card_location_base>&c, const point & p,int & sarid)
|
|
|
+{
|
|
|
+ switch(m_area_type){
|
|
|
+ case AREA_TYPE_MONKEY:
|
|
|
+ case AREA_TYPE_ATTENDANCE:
|
|
|
+ case AREA_TYPE_FORBIDDEN:
|
|
|
+ return in_area(p);
|
|
|
+ default:
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
area_list::area_list()
|
|
|
{
|
|
@@ -298,6 +306,7 @@ void area_list::init_monkeycar_area(int id)
|
|
|
da->m_point = init_path(monkeycar_coor,area_id);
|
|
|
std::shared_ptr<area> ap = std::make_shared<monkey_area>(da,area_id,over_count_person, over_time_person,scale,map_id,b_type);
|
|
|
ap->update(over_count_person, over_time_person,scale,map_id,over_count_vehicle,over_time_vehicle);
|
|
|
+ ap->m_area_type=area_type_id;
|
|
|
|
|
|
ap->m_bound=init_path(path,area_id);
|
|
|
for(const auto &p : ap->m_bound)
|
|
@@ -325,7 +334,7 @@ void area_list::init_monkeycar_area(int id)
|
|
|
|
|
|
tmp_ptr->m_bound=init_path(path,area_id);
|
|
|
tmp_ptr->update(over_count_person, over_time_person,scale,map_id, over_count_vehicle,over_time_vehicle);
|
|
|
-
|
|
|
+ tmp_ptr->m_area_type=area_type_id;
|
|
|
if(newobj)
|
|
|
{
|
|
|
area_list::instance()->add(id, tmp_ptr);
|
|
@@ -449,6 +458,7 @@ void area_list::init_from_db(int id/*=-1*/)
|
|
|
ap->m_limit_vehicle_count = over_count_vehicle;
|
|
|
ap->m_speed=std::move(map_);
|
|
|
ap->m_is_work_area = is_work_area;
|
|
|
+ ap->m_area_type=area_type_id;
|
|
|
|
|
|
ap->m_bound=init_path(path,area_id);
|
|
|
for(const auto &p : ap->m_bound)
|
|
@@ -470,6 +480,7 @@ void area_list::init_from_db(int id/*=-1*/)
|
|
|
tmp_ptr->m_speed=std::move(map_);
|
|
|
tmp_ptr->m_bound=init_path(path,area_id);
|
|
|
tmp_ptr->m_is_work_area = is_work_area;
|
|
|
+ tmp_ptr->m_area_type=area_type_id;
|
|
|
|
|
|
for(const auto &p : tmp_ptr->m_bound)
|
|
|
log_info("point:area_id:%d--x:%.2f,y:%.2f",area_id,p.x,p.y);
|
|
@@ -540,11 +551,9 @@ std::vector<std::shared_ptr<area>> area_list::get_area(const std::shared_ptr<sit
|
|
|
ret.push_back(a.second);
|
|
|
if(s){
|
|
|
ret.push_back(s->get_area());
|
|
|
-#ifdef SITE_AREA
|
|
|
int area_id=s->m_area_id;
|
|
|
if(auto area_=area_list::instance()->get(area_id))
|
|
|
ret.push_back(area_);
|
|
|
-#endif
|
|
|
}
|
|
|
//区域覆盖不完全地图,很多车辆人行驶在地图外,如何确认.
|
|
|
return std::move(ret);
|