Browse Source

修改候车区域

daiyueteng 6 years ago
parent
commit
a39e6e6a86
1 changed files with 15 additions and 17 deletions
  1. 15 17
      area.cpp

+ 15 - 17
area.cpp

@@ -235,28 +235,26 @@ void area_list::init_monkeycar_area(int id)
         }
         else
         {
+            std::shared_ptr<db_area>  da = std::make_shared<db_area>();
+            da->m_default_speed = monkeycar_speed;
+            da->m_point = init_path(monkeycar_coor);
+
+            std::shared_ptr<area> ap = std::make_shared<monkey_area>(da,area_id,over_count_person,
+                                       over_time_person,scale,map_id,area_type_id);
+
+            ap->m_bound=init_path(path);
+            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)
+              log_info("point:monkey_coor:area_id:%d--x:%.2f,y:%.2f",area_id,p.x,p.y);
+
             auto tmp_ptr = area_list::instance()->get(id);
             if(tmp_ptr)
             {
-                //待补充
+                area_list::instance()->remove(id);
             }
-            else
-            {
-                std::shared_ptr<db_area>  da = std::make_shared<db_area>();
-                da->m_default_speed = monkeycar_speed;
-                da->m_point = init_path(monkeycar_coor);
-
-                std::shared_ptr<area> ap = std::make_shared<monkey_area>(da,area_id,over_count_person,
-                                           over_time_person,scale,map_id,area_type_id);
 
-                ap->m_bound=init_path(path);
-                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)
-                  log_info("point:monkey_coor:area_id:%d--x:%.2f,y:%.2f",area_id,p.x,p.y);
-
-                area_list::instance()->add(id, ap);
-            }
+            area_list::instance()->add(id, ap);
 
             log_info("基础数据 monkeycar area增加或修改区域成功:区域id:%d,over_count_person:%d over_time_person:%d,\
                      scale:%.2f,map_id:%d,area_type_id:%d,over_count_vehicle:%d,over_time_vehicle:%d",