|
@@ -74,7 +74,7 @@ area::area(int id,int limit_count_person, int limit_time_person,double scale,int
|
|
|
,m_person_count(0)
|
|
|
,m_vehicle_count(0)
|
|
|
{
|
|
|
- m_area_business_list=area_business::get_instance_list(m_area_type);
|
|
|
+ m_area_business_list=area_business::get_instance_list(m_area_type,id);
|
|
|
m_event_person_count = false;
|
|
|
m_event_vehicle_count = false;
|
|
|
}
|
|
@@ -232,11 +232,11 @@ void area_list::init_monkeycar_area(int id)
|
|
|
{
|
|
|
std::shared_ptr<db_area> da = std::make_shared<db_area>();
|
|
|
da->m_default_speed = monkeycar_speed;
|
|
|
- da->m_point = init_path(monkeycar_coor);
|
|
|
+ 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,area_type_id, over_count_vehicle,over_time_vehicle);
|
|
|
|
|
|
- ap->m_bound=init_path(path);
|
|
|
+ ap->m_bound=init_path(path,area_id);
|
|
|
for(const auto &p : ap->m_bound)
|
|
|
log_info("point:monkey:area_id:%d--x:%.2f,y:%.2f",area_id,p.x,p.y);
|
|
|
for(const auto &p : da->m_point)
|
|
@@ -249,14 +249,14 @@ void area_list::init_monkeycar_area(int id)
|
|
|
//这里后续需要把猴车得信息传递过去
|
|
|
std::shared_ptr<db_area> da = std::make_shared<db_area>();
|
|
|
da->m_default_speed = monkeycar_speed;
|
|
|
- da->m_point = init_path(monkeycar_coor);
|
|
|
+ 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);
|
|
|
if(auto area_=area_list::instance()->get(id))
|
|
|
area_=ap;
|
|
|
else
|
|
|
area_list::instance()->add(area_id,ap);
|
|
|
|
|
|
- ap->m_bound=init_path(path);
|
|
|
+ ap->m_bound=init_path(path,area_id);
|
|
|
ap->update(over_count_person, over_time_person,scale,map_id,area_type_id, over_count_vehicle,over_time_vehicle);
|
|
|
for(const auto &p : ap->m_bound)
|
|
|
log_info("point:monkey:area_id:%d--x:%.2f,y:%.2f",area_id,p.x,p.y);
|
|
@@ -366,7 +366,7 @@ void area_list::init_from_db(int id/*=-1*/)
|
|
|
|
|
|
log_info("init_area : id:%d,path:%s..speed:%s",area_id, path.c_str(),over_speed_vehicle.c_str());
|
|
|
std::map<int,double> map_;
|
|
|
- auto vp=init_path(over_speed_vehicle);
|
|
|
+ auto vp=init_path(over_speed_vehicle,area_id);
|
|
|
for(const auto &v:vp)
|
|
|
map_.insert({v.x,v.y});
|
|
|
if(-1 == id)
|
|
@@ -377,7 +377,7 @@ void area_list::init_from_db(int id/*=-1*/)
|
|
|
ap->m_speed=std::move(map_);
|
|
|
ap->m_is_work_area = is_work_area;
|
|
|
|
|
|
- ap->m_bound=init_path(path);
|
|
|
+ ap->m_bound=init_path(path,area_id);
|
|
|
for(const auto &p : ap->m_bound)
|
|
|
log_info("point:area_id:%d--x:%.2f,y:%.2f",area_id,p.x,p.y);
|
|
|
map.insert({area_id,ap});
|
|
@@ -391,8 +391,8 @@ void area_list::init_from_db(int id/*=-1*/)
|
|
|
area_list::instance()->add(id, tmp_ptr);
|
|
|
}
|
|
|
tmp_ptr->update(over_count_person, over_time_person,scale,map_id,area_type_id, over_count_vehicle,over_time_vehicle);
|
|
|
- tmp_ptr->m_bound=init_path(path);
|
|
|
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;
|
|
|
for(const auto &p : tmp_ptr->m_bound)
|
|
|
log_info("point:area_id:%d--x:%.2f,y:%.2f",area_id,p.x,p.y);
|
|
@@ -412,10 +412,12 @@ void area_list::init_from_db(int id/*=-1*/)
|
|
|
init_monkeycar_area(id);
|
|
|
}
|
|
|
|
|
|
-std::vector<point> area_list::init_path(std::string &str)
|
|
|
+std::vector<point> area_list::init_path(std::string &str,int area_id)
|
|
|
{
|
|
|
if(str.empty())
|
|
|
- log_error("area path empty()...");
|
|
|
+ {
|
|
|
+ log_error("area path is empty,area_id=%d.",area_id);
|
|
|
+ }
|
|
|
std::vector<point> vp;
|
|
|
std::vector<std::string> vs;
|
|
|
std::vector<std::string> vs1;
|
|
@@ -426,7 +428,9 @@ std::vector<point> area_list::init_path(std::string &str)
|
|
|
continue;
|
|
|
boost::split(vs1,s,boost::is_any_of(","));
|
|
|
if(vs1.size()!=2)
|
|
|
- log_error("area path data Error.pls check data table.");
|
|
|
+ {
|
|
|
+ log_error("area path data Error.pls check data table,area_id=%d",area_id);
|
|
|
+ }
|
|
|
vp.emplace_back(atof(vs1[0].c_str()),atof(vs1[1].c_str()));
|
|
|
}
|
|
|
return std::move(vp);
|