Browse Source

区域注册area_business && 获取地标 && 完善on_point

lixioayao 6 years ago
parent
commit
74e90d2568
11 changed files with 167 additions and 282 deletions
  1. 42 194
      area.cpp
  2. 18 20
      area.h
  3. 72 44
      area_business.cpp
  4. 1 1
      area_business.h
  5. 1 0
      card_base.h
  6. 14 19
      card_car.cpp
  7. 2 1
      card_car.h
  8. 5 2
      card_person.cpp
  9. 1 0
      card_person.h
  10. 9 0
      site_area.cpp
  11. 2 1
      site_area.h

+ 42 - 194
area.cpp

@@ -13,6 +13,7 @@
 #include <boost/algorithm/string/classification.hpp>
 
 #include"module_service/module_area.h"
+#include "area_business.h"
 
 template<> std::shared_ptr<area_list> 
 single_base<area_list, int, std::shared_ptr<area>>::m_instance=std::make_shared<area_list>();
@@ -58,7 +59,7 @@ void area::on_hover(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_
 {
  	for(auto i:m_area_business_list)
 	{
-		i->on_hover(a,c,a->get_business_data(i->business_type()));
+		i->on_hover(a,c,a->get_business_data(i->area_business_type()));
 	}
 }
 
@@ -67,7 +68,7 @@ void area::on_enter(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_
 	log_info("on_enter..%d  areaId:%d",c->m_id,m_id);
  	for(auto i:m_area_business_list)
 	{
-		i->on_enter(a,c,a->get_business_data(i->business_type()));
+		i->on_enter(a,c,a->get_business_data(i->area_business_type()));
 	}
 }
 
@@ -76,7 +77,7 @@ void area::on_leave(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_
 	log_info("on_leave..%d  areaId:%d",c->m_id,m_id);
  	for(auto i:m_area_business_list)
 	{
-		i->on_leave(a,c,a->get_business_data(i->business_type()));
+		i->on_leave(a,c,a->get_business_data(i->area_business_type()));
 	}
 }
 
@@ -111,86 +112,11 @@ bool area::in_area(const std::shared_ptr<site>&s, const point & p)
 area_list::area_list()
 {
 }
-#if 0
-void area_list::init_monkeycar_area()
-{
-	std::unordered_map<int,std::shared_ptr<area>> map;
-	const char *sql = "SELECT a.area_id, a.name, a.map_id, a.area_type_id, a.path, c.scale,\
-						over_count_person, over_count_vehicle, over_time_person, over_time_vehicle, over_speed_vehicle, is_attendance ,b.monkeycar_coordinate,b.monkeycar_speed \
-						FROM dat_area a ,dat_monkeycar_base_info b ,dat_map c\
-						where a.area_id = b.monkeycar_base_info_id and a.map_id = c.map_id;";
-	std::string Error;
-	YADB::CDBResultSet DBRes;
-	sDBConnPool.Query(sql,DBRes,Error);
-	if(!Error.empty())
-		log_error("monkeycar area init Error,%s",Error.c_str());
-	int nCount = DBRes.GetRecordCount( Error );
-	if (nCount > 0)
-	{
-		log_info( "init_monkey area. The record count=%d", nCount );
-
-		while ( DBRes.GetNextRecod(Error) )
-		{
-			int area_id  = 0;
-			DBRes.GetField( "area_id",area_id, Error );
-
-			int map_id  = 0;
-			DBRes.GetField( "map_id",map_id, Error );
-
-			unsigned int area_type_id  = 0;
-			DBRes.GetField( "area_type_id",area_type_id, Error );
-  		
-			int over_count_person = 0;
-			DBRes.GetField( "over_count_person",over_count_person, Error );
-
-			int over_count_vehicle = 0;
-			DBRes.GetField( "over_count_vehicle",over_count_vehicle, Error );
-
-			int over_time_person = 0;
-			DBRes.GetField( "over_time_person",over_time_person, Error );
-
-			int over_time_vehicle = 0;
-			DBRes.GetField( "over_time_vehicle",over_time_vehicle, Error );
-
-			std::string path;
-			DBRes.GetField( "path",path, Error );
-  		
-			float monkeycar_speed = 0;
-			DBRes.GetField( "monkeycar_speed",monkeycar_speed, Error );
-
-			std::string monkeycar_coor;
-			DBRes.GetField( "monkeycar_coordinate",monkeycar_coor, Error );
-
-			float scale=0;
-			DBRes.GetField( "scale",scale, Error );
-
-
-			log_info("init_area : id:%d,path:%s",area_id, path.c_str());
-
-			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);
-
-			map.insert({area_id,ap});
-		}
-	}
-  
-	area_list::instance()->add(map);
-}
-#endif
 void area_list::init_monkeycar_area(int id)
 {
     std::string sql = "SELECT a.area_id, a.name, a.map_id, a.area_type_id, a.path, c.scale,\
             over_count_person, over_count_vehicle, over_time_person, over_time_vehicle,\
-            over_speed_vehicle, is_attendance ,b.monkeycar_coordinate,b.monkeycar_speed \
+            over_speed_vehicle, is_attendance ,b.monkeycar_coordinate,b.monkeycar_speed,a.business_type \
             FROM dat_area a ,dat_monkeycar_base_info b ,dat_map c\
             where a.area_id = b.monkeycar_base_info_id and a.map_id = c.map_id";
 
@@ -254,6 +180,9 @@ void area_list::init_monkeycar_area(int id)
         double scale=0;
         DBRes.GetField( "scale",scale, Error );
 
+		uint32_t b_type =0;
+        DBRes.GetField( "business_type",b_type, Error );
+
         log_info("monkeycar area init_area : id:%d,path:%s",area_id, path.c_str());
 
         if(-1 == id)
@@ -262,8 +191,9 @@ void area_list::init_monkeycar_area(int id)
             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);
+            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_area_business_list=std::move(area_business::get_instance_list(b_type));
 
             ap->m_bound=init_path(path);
             for(const auto &p : ap->m_bound)
@@ -275,35 +205,29 @@ 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);
+            std::shared_ptr<area> ap = area_list::instance()->get(id);
+			if(!ap)
+			{
+				ap = std::make_shared<monkey_area>(da,area_id,over_count_person, over_time_person,scale,map_id,area_type_id);
+				area_list::instance()->add(id, ap);
+			}
+			ap->m_area_business_list=std::move(area_business::get_instance_list(b_type));
 
             ap->m_bound=init_path(path);
+            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);
             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);
-            }
-
-            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",
                      id,over_count_person, over_time_person,scale,map_id,area_type_id,
                      over_count_vehicle,over_time_vehicle);
-            std_debug("基础数据 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",
-                      id,over_count_person, over_time_person,scale,map_id,area_type_id,
-                      over_count_vehicle,over_time_vehicle);
         }
     }
 
@@ -318,7 +242,7 @@ void area_list::init_from_db(int id/*=-1*/)
 {
     std::string sql = "SELECT a.area_id, a.name, a.map_id, a.area_type_id, a.path,b.scale, \
             over_count_person, over_count_vehicle, over_time_person, over_time_vehicle, \
-            over_speed_vehicle, is_attendance \
+            over_speed_vehicle, is_attendance,business_type \
             FROM dat_area a,dat_map b\
             where a.map_id = b.map_id and  area_id not in \
             (select monkeycar_base_info_id from dat_monkeycar_base_info)";
@@ -376,6 +300,9 @@ void area_list::init_from_db(int id/*=-1*/)
         double scale = 0;
         DBRes.GetField( "scale",scale, Error );
 
+		uint32_t b_type =0;
+        DBRes.GetField( "business_type",b_type, Error );
+
         log_info("init_area : id:%d,path:%s",area_id, path.c_str());
 
         if(-1 == id)
@@ -389,6 +316,8 @@ void area_list::init_from_db(int id/*=-1*/)
             ap->m_bound=init_path(path);
             for(const auto &p : ap->m_bound)
               log_info("point:area_id:%d--x:%.2f,y:%.2f",area_id,p.x,p.y);
+			
+			ap->m_area_business_list=std::move(area_business::get_instance_list(b_type));
 
             map.insert({area_id,ap});
 
@@ -397,30 +326,17 @@ void area_list::init_from_db(int id/*=-1*/)
         else
         {
             auto tmp_ptr = area_list::instance()->get(id);
-            if(tmp_ptr)
+            if(!tmp_ptr)
             {
-//               CheckAreaType(tmp_ptr,area_type_id,tmp_ptr->m_area_type);
-
-                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);
-            }
-            else
-            {
-                std::shared_ptr<area> ap = std::make_shared<area>(area_id,over_count_person,over_time_person,
-                                                                  scale,map_id,area_type_id);
-
-                ap->m_limit_vehicle_second = over_time_vehicle;
-                ap->m_limit_vehicle_count = over_count_vehicle;
-
-                ap->m_bound=init_path(path);
-                for(const auto &p : ap->m_bound)
-                  log_info("point:area_id:%d--x:%.2f,y:%.2f",area_id,p.x,p.y);
-
-                area_list::instance()->add(id, ap);
-
-//               CheckAreaType(ap,area_type_id,0);
+                tmp_ptr= std::make_shared<area>(area_id,over_count_person,over_time_person,scale,map_id,area_type_id);
+                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_area_business_list=std::move(area_business::get_instance_list(b_type));
+            for(const auto &p : tmp_ptr->m_bound)
+                log_info("point:area_id:%d--x:%.2f,y:%.2f",area_id,p.x,p.y);
+//               CheckAreaType(tmp_ptr,area_type_id,tmp_ptr->m_area_type);
 
             log_info("基础数据 增加或修改区域成功:区域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",
@@ -433,7 +349,6 @@ void area_list::init_from_db(int id/*=-1*/)
     {
         log_info( "init_area. The record count=%d\n", nCount );
         area_list::instance()->add(map);
-
         init_monkeycar_area();
     }
 }
@@ -519,74 +434,6 @@ void area_list::CheckAreaType( std::shared_ptr<area> pArea,int new_area_type,int
     card_list::instance()->accept(lv);
 }
 
-#endif
-
-#if 0
-void area_list::init_from_db()
-{
-	std::unordered_map<int,std::shared_ptr<area>> map;
-	const char *sql = "SELECT a.area_id, a.name, a.map_id, a.area_type_id, a.path,b.scale, \
-						over_count_person, over_count_vehicle, over_time_person, over_time_vehicle, over_speed_vehicle, is_attendance \
-						FROM dat_area a,dat_map b\
-						where a.map_id = b.map_id and  area_id not in (select monkeycar_base_info_id from dat_monkeycar_base_info);";
-	std::string Error;
-	YADB::CDBResultSet DBRes;
-	sDBConnPool.Query(sql,DBRes,Error);
-	if(!Error.empty())
-		log_error("monkeycar area init Error,%s",Error.c_str());
-	int nCount = DBRes.GetRecordCount( Error );
-	if (nCount > 0)
-	{
-		log_info( "init_area. The record count=%d\n", nCount );
-
-		while ( DBRes.GetNextRecod(Error) )
-		{
-			int area_id  = 0;
-			DBRes.GetField( "area_id",area_id, Error );
-
-			int map_id  = 0;
-			DBRes.GetField( "map_id",map_id, Error );
-
-			unsigned int area_type_id  = 0;
-			DBRes.GetField( "area_type_id",area_type_id, Error );
-  		
-			int over_count_person = 0;
-			DBRes.GetField( "over_count_person",over_count_person, Error );
-
-			int over_count_vehicle = 0;
-			DBRes.GetField( "over_count_vehicle",over_count_vehicle, Error );
-
-			int over_time_person = 0;
-			DBRes.GetField( "over_time_person",over_time_person, Error );
-
-			int over_time_vehicle = 0;
-			DBRes.GetField( "over_time_vehicle",over_time_vehicle, Error );
-
-			std::string path;
-			DBRes.GetField( "path",path, Error );
-  	
-			double scale = 0;
-			DBRes.GetField( "scale",scale, Error );
-
-			log_info("init_area : id:%d,path:%s",area_id, path.c_str());
-  		
-            std::shared_ptr<area> ap = std::make_shared<area>(area_id,over_count_person,over_time_person,scale,map_id,area_type_id);
-
-            ap->m_limit_vehicle_second = over_time_vehicle;
-            ap->m_limit_vehicle_count = over_count_vehicle;
-
-			ap->m_bound=init_path(path);
-			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});
-		}
-	}
-  
-	area_list::instance()->add(map);
-
-	init_monkeycar_area();
-}
 #endif
 std::vector<point> area_list::init_path(std::string &str)
 {
@@ -615,12 +462,8 @@ std::vector<std::shared_ptr<area>> area_list::get_area(const std::shared_ptr<sit
 	auto map = area_list::instance()->m_map;
 
 	for(const auto &a:map)
-	{
 		if(a.second->in_area(s, pt))
-		{
 			ret.push_back(a.second);
-		}
-	}
 	//区域覆盖不完全地图,很多车辆人行驶在地图外,如何确认.
 	return std::move(ret);
 }
@@ -628,11 +471,16 @@ std::vector<std::shared_ptr<area>> area_list::get_area(const std::shared_ptr<sit
 void area_tool::on_point(const std::shared_ptr<site>&s,std::shared_ptr<card_location_base> c,const point&pt)
 {
 	log_info("on_point...cardid:%d,type:%d",c->m_id,c->m_type);
-
 	setLandmark(pt);
 
 	std::vector<std::shared_ptr<area>> areas=area_list::instance()->get_area(s, pt);//找出所有的区域
-	std::sort(areas.begin(),areas.end(),[](std::shared_ptr<area>&l,std::shared_ptr<area>&r){
+	int sa = c->get_area();
+	if(sa!=-1)
+	{
+		auto area_=area_list::instance()->get(sa);
+		areas.push_back(area_);
+	}
+	std::sort(areas.begin(),areas.end(),[](const std::shared_ptr<area>&l,const std::shared_ptr<area>&r){
 			return l->id()<r->id();
 			});
 

+ 18 - 20
area.h

@@ -3,6 +3,7 @@
 
 #include <atomic>
 #include <algorithm>
+#include <cfloat>
 #include <iterator>
 #include <point.h>
 #include "common.h"
@@ -55,11 +56,6 @@ struct area
     }
     virtual ~area()
     {}
-    ///区域卡数
-    int card_count()const
-    {
-        return m_person_count + m_vehicle_count;
-    }
 
     void  update(int limit_count_person, int limit_time_person,double scale,int32_t mapid,
                      int32_t type,int limit_count_vehicle, int limit_time_vehicle)
@@ -76,10 +72,8 @@ public:
 	std::vector<area_business*> m_area_business_list;
 public:
     std::vector<point> m_bound;
-    //std::atomic<int> m_card_count;
 	//数据库唯一ID
     int    m_id;
-    ///区域类型  AREA_TYPE
 
 	//用户定义的业务类型,BIT集合
 	/*
@@ -201,7 +195,7 @@ struct area_hover
 struct site;
 struct area_tool
 {
-	//卡所在的所有area的列表,以id排序
+	//卡所在的所有area的列表,以id排序小->大
 	std::vector<std::shared_ptr<area_hover>> m_hover_list;
 
 	//推送卡位置时需要推送的所在区域id列表
@@ -226,21 +220,25 @@ struct area_tool
 
     void setLandmark(const point &pt)
     {
-#if 0
-        if(m_area_hover)
-        {
-            m_area_hover->setLandmark(pt);
-        }
-#endif
+		for(const auto & ha:m_hover_list)
+			ha->setLandmark(pt);
     }
     std::tuple<time_t,time_t,int,int,int,int,double,double> getLandmark()
     {
-#if 0
-        if(m_area_hover)
-            return m_area_hover->getLandmark();
-        else
-#endif 
-            return std::make_tuple(0,0,0,0,0,0,0,0);
+		double dis = DBL_MAX,d=0;
+		std::shared_ptr<area_hover> tmp=nullptr;
+		for(const auto & ha:m_hover_list)
+		{
+			d=ha->landmark_dis;
+			if(d<dis){
+				dis=d;
+				tmp = ha;
+			}
+		}	
+		if(tmp)
+		  return tmp->getLandmark();
+		else
+          return std::make_tuple(0,0,0,0,0,0,0,0);
 
     }
 

+ 72 - 44
area_business.cpp

@@ -7,50 +7,6 @@
 #include "card.h"
 #include "ya_event.h"
 #include "module_service/module_call.h"
-
-struct area_business_factory
-{
-	area_business_factory()
-	{
-	}
-
-	void regist(int type,area_business* ab)
-	{
-		if(type>=(int)m_check_list.size())
-		{
-			m_check_list.resize(type+1);
-		}
-
-		assert(m_check_list[type]);
-
-		m_check_list[type].reset(ab);
-	}
-
-	std::vector<area_business*> get_check_list(int business_type)
-	{
-		std::vector<area_business*> check_list;
-		for(int i=0;i<32;i++)
-		{
-			if(business_type==0)
-				break;
-
-			if((business_type&1)==0)
-				continue;
-
-			check_list.push_back(m_check_list[i].get());
-		}
-
-		return std::move(check_list);
-	}
-
-	std::vector<std::unique_ptr<area_business>> m_check_list;
-	static area_business_factory& instance()
-	{
-		static area_business_factory _instance;
-		return _instance;
-	}
-};
-
 /*
 	确定推送人员信息时的区域,每一个明确需要推送的区域,都要推送
 */
@@ -122,6 +78,7 @@ struct area_business_restricted:area_business
 	//记录进入时间等信息,生成告警
 	virtual void on_enter(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> )
 	{
+
         a->m_enter_point = point(c->x,c->y,c->z);
         a->m_last_point.set(0,0,0);
         a->m_last_time = 0;
@@ -304,6 +261,77 @@ struct area_business_person_dwell_checker:area_business
 	}
 };
 
+struct area_business_card_enter_or_leave:area_business
+{
+	virtual int area_business_type()
+	{
+		return 9;
+	}
+	//初始化 ptr 的相关数据项
+	virtual void on_enter(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr)
+	{
+	
+	}
+
+	//更新 ptr 的相关数据项,并进行超时判断
+	virtual void on_leave(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr)
+	{
+	
+	}
+};
+
+struct area_business_factory
+{
+	void regist(int type,area_business* ab)
+	{
+		if(type>=(int)m_check_list.size())
+		{
+			m_check_list.resize(type+1);
+		}
+
+		assert(!m_check_list[type]);
+
+		m_check_list[type].reset(ab);
+	}
+
+	std::vector<area_business*> get_check_list(int business_type)
+	{
+		std::vector<area_business*> check_list;
+		for(int i=0;i<32;i++)
+		{
+			if(business_type==0)
+				break;
+
+			if((business_type&1)==0)
+				continue;
+
+			check_list.push_back(m_check_list[i].get());
+		}
+
+		return std::move(check_list);
+	}
+
+	static area_business_factory& instance()
+	{
+		static area_business_factory _instance;
+		return _instance;
+	}
+private:
+	std::vector<std::unique_ptr<area_business>> m_check_list;
+	area_business_factory()
+	{
+		regist(1,new area_business_post_area);
+		regist(2,new area_business_person_dwell_checker);
+		regist(3,new area_business_count_checker);
+		regist(4,new area_business_speed_checker);
+		regist(5,new area_business_person_attendance);
+		regist(6,new area_business_car_attendance);
+		regist(7,new area_business_restricted);
+		//regist(8,new area_business_monkey_area);
+		regist(9,new area_business_card_enter_or_leave);
+	}
+
+};
 
 std::vector<area_business*> area_business::get_instance_list(int business_type)
 {

+ 1 - 1
area_business.h

@@ -11,7 +11,7 @@ struct business_data
 
 struct area_business
 {
-	virtual int business_type()=0;
+	virtual int area_business_type()=0;
 
 	virtual void on_enter(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr){}
 	virtual void on_hover(std::shared_ptr<area_hover>&a,std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr){}

+ 1 - 0
card_base.h

@@ -83,6 +83,7 @@ struct card_location_base:card,std::enable_shared_from_this<card_location_base>
 	virtual void reset(std::shared_ptr<monkey_person> mp){}
     virtual int get_vehicle_type_id(){return  0;}
     virtual std::tuple<time_t,time_t,int,int,int,int,double,double> getLandmark()=0;
+	virtual int get_area()=0;
 
     void on_message(zloop<task*> * loop,const message_locinfo&loc,bool is_history);
     void on_location(const std::vector<point>&vp,const std::vector<loc_message> &lm );

+ 14 - 19
card_car.cpp

@@ -82,32 +82,25 @@ bool car::on_timer()
 {
 	return make_package();
 }
-
-int car::statbiz(int32_t special_id)
+int car::get_area()
 {
-#pragma message ("代码被注释掉,需调整...")
-	return 0;
-#if 0
 	int status = get_stat();
+	int special_id = -1;
 	if(status == STATUS_LOST)
 	{
-		if(!m_area_tool->special_area())			
+#pragma message("special_area()咋删了");
+		//if(!m_area_tool->special_area())			
 		{
 			special_id = special_area_list::instance()->get_special_id(m_id,*this,m_vehicle_category_id);
 			log_info("enter_special_area:%.2f,%2.f,id:%d,special_area_id:%d",x,y,m_id,special_id);
-			if(special_id != -1)
-			{
-				m_area_tool->change_area(m_id,m_speed,m_type,special_id);//自动拖车
-			}
 		}
 	}
-	return status;
-#endif
+	return special_id;
 }
+
 bool car::make_package()
 {
 	bool f=false;
-	int32_t special_id=-1;
 	YA::_CARD_POS_ cp;
 	loc_point pt = getSmoothPoint();
 
@@ -120,18 +113,20 @@ bool car::make_package()
 	cp.landmark_id = std::get<4>(lm);
 	cp.lm_direction = std::get<5>(lm);
 	cp.landmark_dis=std::get<6>(lm);
-	int32_t biz_stat=statbiz(special_id);
+	//int32_t biz_stat=statbiz(special_id);
+	int32_t biz_stat=get_stat();
+	
 	cp.biz_stat=biz_stat;
 	cp.down_time = m_mine_tool->get_down_time();
 	cp.work_time = m_mine_tool->get_work_time();
 	cp.is_on_duty=m_mine_tool->is_on_duty();
 	upt_card_pos(cp,pt);
 	m_his_location_card->push(pt.m_time,pt,area_id,map_id);
-	if(biz_stat==STATUS_LOST && special_id != -1 && m_display==1)
-	{
-		cp.area_id = special_id;
-		swsClientMgr.SendSpecialAreaProcess(cp);
-	}
+//	if(biz_stat==STATUS_LOST && special_id != -1 && m_display==1)
+//	{
+//		cp.area_id = special_id;
+//		swsClientMgr.SendSpecialAreaProcess(cp);
+//	}
 	uint64_t _now=tool_time::now_to_ms();
 	uint64_t t=_now>m_time?_now-m_time:m_time-_now;
 	if(t<45*1000 && !empty())

+ 2 - 1
card_car.h

@@ -32,12 +32,13 @@ public:
     virtual std::shared_ptr<mine_tool> get_mine_tool();
     virtual std::shared_ptr<site_area_hover> get_site_area();
 	virtual void do_business(const std::shared_ptr<site>&site,const point &pt,double acc);
+	virtual int get_area();
     int get_vehicle_type_id();
 
 private:
 	void handle_three_rates(const point &pt);
 	bool on_timer();
-	int statbiz(int32_t special_id);
+	//int statbiz(int32_t special_id);
 	bool make_package();
 	loc_point getSmoothPoint();
 

+ 5 - 2
card_person.cpp

@@ -69,7 +69,10 @@ void person::IKSDK_DB(int sid)
 		}
 	}
 }
-
+int person::get_area()
+{
+	return m_site_area->get_att_type();
+}
 std::shared_ptr<area_hover> person::get_area_hover()
 {
 	return m_area_tool->get_area_first();
@@ -116,7 +119,7 @@ void person::handle_three_rates(const point & pt)
 bool person::on_timer()
 {
 	//人员井下超时
-    m_mine_tool->on_check_overtime(this->m_id,this->m_type);
+//    m_mine_tool->on_check_overtime(this->m_id,this->m_type);
 
 	if(!m_mine_tool->is_attendance())
 		return false;

+ 1 - 0
card_person.h

@@ -27,6 +27,7 @@ struct person:card_location_base, card_area
     virtual std::shared_ptr<site_area_hover> get_site_area();
 	virtual void do_business(const std::shared_ptr<site>&site,const point &pt,double acc);
     virtual std::tuple<time_t,time_t,int,int,int,int,double,double> getLandmark();
+	virtual int get_area();
 };
 
 #endif

+ 9 - 0
site_area.cpp

@@ -49,3 +49,12 @@ void site_area_hover::leave_site(uint32_t card_id,int enter_site,int32_t type)
 {
     module_site::leave_site(card_id, enter_site, type);
 }
+int site_area_hover::get_att_type() const 
+{
+	int id = -1;
+		const auto &s = sit_list::instance()->get(m_site_id);
+		if(s)
+			if(s->m_reader_type_id == READER_TYPE_ID_DOWN)
+				id=0;
+		return id;
+}

+ 2 - 1
site_area.h

@@ -29,12 +29,13 @@ private:
 	point  m_enter_point,m_last_point;
 
 public:
+	int get_att_type() const;
     int site_id() const
     {
         return m_site_id;
     }
 
-    bool is_invalid()
+    bool is_invalid() const 
     {
         return -1==m_site_id;
     }