Browse Source

添加历史轨迹

lixioayao 6 years ago
parent
commit
208e296358
11 changed files with 563 additions and 527 deletions
  1. 18 2
      Makefile
  2. 1 1
      Makefile.am
  3. 18 2
      Makefile.in
  4. 220 220
      ant.cpp
  5. 1 1
      ant.h
  6. 137 136
      area.cpp
  7. 2 2
      area.h
  8. 19 19
      autom4te.cache/requests
  9. 137 137
      card.cpp
  10. 7 5
      main.cpp
  11. 3 2
      znet.cpp

File diff suppressed because it is too large
+ 18 - 2
Makefile


File diff suppressed because it is too large
+ 1 - 1
Makefile.am


File diff suppressed because it is too large
+ 18 - 2
Makefile.in


+ 220 - 220
ant.cpp

@@ -169,182 +169,182 @@ void sit_list::read_sit_list(const char*fname)
 
 }
 #endif
+#if 0
+void sit_list::read_sit_list()
+{
+	std::unordered_map<int,std::shared_ptr<site>> map;
+	const char *sql = "SELECT antenna_id, a.reader_id, idx, a.x, a.y, a.z, a.angle \
+						FROM dat_antenna a, dat_reader r \
+						WHERE a.reader_id = r.reader_id;";
+    std::string Error;
+    YADB::CDBResultSet DBRes;
+    sDBConnPool.Query(sql,DBRes,Error);
+    uint64_t nCount = DBRes.GetRecordCount( Error );
+    if (nCount > 0)
+    {
+        log_info( "init_antenna. The record count=%ld\n", nCount );
+
+        while ( DBRes.GetNextRecod(Error) )
+        {
+            int reader_id  = 0;
+            DBRes.GetField( "reader_id",reader_id, Error );
+
+         	int idx=0;
+            DBRes.GetField( "idx",idx, Error );
+
+			int antid = idx-1;
+			if(antid >= 2)
+			  continue;
+
+            double x= 0;
+            DBRes.GetField( "x",x, Error );
 
-//void sit_list::read_sit_list()
-//{
-//	std::unordered_map<int,std::shared_ptr<site>> map;
-//	const char *sql = "SELECT antenna_id, a.reader_id, idx, a.x, a.y, a.z, a.angle \
-//						FROM dat_antenna a, dat_reader r \
-//						WHERE a.reader_id = r.reader_id;";
-//    std::string Error;
-//    YADB::CDBResultSet DBRes;
-//    sDBConnPool.Query(sql,DBRes,Error);
-//    uint64_t nCount = DBRes.GetRecordCount( Error );
-//    if (nCount > 0)
-//    {
-//        log_info( "init_antenna. The record count=%ld\n", nCount );
-
-//        while ( DBRes.GetNextRecod(Error) )
-//        {
-//            int reader_id  = 0;
-//            DBRes.GetField( "reader_id",reader_id, Error );
-
-//         	int idx=0;
-//            DBRes.GetField( "idx",idx, Error );
-
-//			int antid = idx-1;
-//			if(antid >= 2)
-//			  continue;
-
-//            double x= 0;
-//            DBRes.GetField( "x",x, Error );
-
-//            double y= 0;
-//            DBRes.GetField( "y",y, Error );
-
-//            double z= 0;
-//            DBRes.GetField( "z",z, Error );
-
-//			std::shared_ptr<site> site_ptr=nullptr;
-//		    auto it = map.find(reader_id);
-//            if(it==map.end())
-//            {
-//                site_ptr = std::make_shared<site>(reader_id);
-//				map.insert({reader_id,site_ptr});
-//            }
-//			else
-//			  site_ptr=it->second;
-//			site_ptr->m_ant[antid].set(x,-y);
-//			log_info("reand_ant..%d,%d,%.2f,%.2f",reader_id,antid,x,y);
-//        }
-//    }
-//	sit_list::instance()->add(map);
-//	for(auto&sit_:map)
-//	{
-//		auto & sit = *(sit_.second);
-//		if(sit.m_id==-1)
-//			continue;
-
-//		if(sit.m_ant[0]==sit.m_ant[1])
-//		{
-//			log_warn("%d分站天线坐标相等.",sit.m_id);
-//		}
-
-//		sit.set( (sit.m_ant[0].x+sit.m_ant[1].x)/2,(sit.m_ant[0].y+sit.m_ant[1].y)/2);
-//	}
-
-//}
-//void sit_list::read_ant_path()
-//{
-//	std::unordered_map<int,std::shared_ptr<site>> map;
-//	const char *sql = "SELECT reader_id,tof_flag,b_x,b_y,b_z,e_x,e_y,e_z,spacing_ratio FROM dat_reader_path_tof_n;";
-//    std::string Error;
-//    YADB::CDBResultSet DBRes;
-//    sDBConnPool.Query(sql,DBRes,Error);
-//    uint64_t nCount = DBRes.GetRecordCount( Error );
-//	if(nCount<=0)
-//	   log_error("init_ant_path error :%s",Error.c_str());
-//    if (nCount > 0)
-//    {
-//        log_info( "init_ant_path. The record count=%ld\n", nCount );
-
-//        while ( DBRes.GetNextRecod(Error) )
-//        {
-//            int reader_id  = 0;
-//            DBRes.GetField( "reader_id",reader_id, Error );
-
-//			auto site_ptr=sit_list::instance()->get(reader_id);
-//			if(nullptr==site_ptr)
-//				continue;
-
-//         	int pid=0;
-//            DBRes.GetField( "tof_flag",pid, Error );
-
-//            double b_x= 0;
-//            DBRes.GetField( "b_x",b_x, Error );
-
-//            double b_y= 0;
-//            DBRes.GetField( "b_y",b_y, Error );
-
-//            double b_z= 0;
-//            DBRes.GetField( "b_z",b_z, Error );
-
-//			double e_x= 0;
-//            DBRes.GetField( "e_x",e_x, Error );
-
-//            double e_y= 0;
-//            DBRes.GetField( "e_y",e_y, Error );
-
-//            double e_z= 0;
-//            DBRes.GetField( "e_z",e_z, Error );
-
-//			double spacing_ratio = 0;
-//            DBRes.GetField( "spacing_ratio",spacing_ratio, Error );
-//			log_info("ant_path:%d,%.2f,%.2f,%.2f,%.2f",reader_id,b_x,b_y,e_x,e_y);
-//			point p1(b_x,-b_y);
-//			point p2(e_x,-e_y);
-//			auto &sit_ = *site_ptr;
-//			if(pid == 0)
-//			{
-//				line_v l(p1,p2);
-//				{
-//					point px = l.line::projection(sit_);
-//					sit_.set(px);
-//					for(int i=0;i<2;i++)
-//					{
-//						path p;
-//						p.m_slope[0] = spacing_ratio;
-//						p.m_line[0] = line_v(px,l[i]);
-//						sit_.m_ant[i].m_path.push_back(p);
-//					}
-//				}
-//			}
-//			else
-//			{
-//				ant &a = pid<0?sit_.m_ant[0]:sit_.m_ant[1];
-//				if(a.m_path.size()!=0)
-//				{
-//					path &p = a.m_path[0];
-//					p.m_line[abs(pid)-1] = line_v(p1,p2);
-//					p.m_slope[abs(pid)-1] = spacing_ratio;
-//				}
-//				else
-//				{
-//					path p;
-//					p.m_line[abs(pid)-1] = line_v(p1,p2);
-//					p.m_slope[abs(pid)-1] = spacing_ratio;
-//					a.m_path.push_back(p);
-//				}
-//				if(abs(pid)==1)
-//					sit_.set(p1);
-//			}
-//        }
-//    }
-//	for(auto&_s:sit_list::instance()->m_map)
-//	{
-//		auto & s = *(_s.second);
-//		if(s.m_id==-1)
-//			continue;
-//        s.swap();
-//		if((s.path(0).empty() && s.path(1).empty()))
-//			continue;
-//        s.m_path_empty=false;
-
-//        for(auto &a:s.m_ant)
-//        for(auto &p:a.m_path)
-//        {
-//            if(!p.m_line[0].empty())
-//            {
-//                point px = p.m_line[0].line::projection(a);
-//                p.m_line[0]=line_v(px,p.m_line[0][1]);
-//            }
-//        }
-//        //std_info("%s",s.to_string().c_str());
-//        log_info("%s",s.to_string().c_str());
-//        //std_info("%f----%f",s.x,s.y);
-//	}
-//}
+            double y= 0;
+            DBRes.GetField( "y",y, Error );
 
+            double z= 0;
+            DBRes.GetField( "z",z, Error );
+
+			std::shared_ptr<site> site_ptr=nullptr;
+		    auto it = map.find(reader_id);
+            if(it==map.end())
+            {
+                site_ptr = std::make_shared<site>(reader_id);
+				map.insert({reader_id,site_ptr});
+            }
+			else
+			  site_ptr=it->second;
+			site_ptr->m_ant[antid].set(x,-y);
+			log_info("reand_ant..%d,%d,%.2f,%.2f",reader_id,antid,x,y);
+        }
+    }
+	sit_list::instance()->add(map);
+	for(auto&sit_:map)
+	{
+		auto & sit = *(sit_.second);
+		if(sit.m_id==-1)
+			continue;
+
+		if(sit.m_ant[0]==sit.m_ant[1])
+		{
+			log_warn("%d分站天线坐标相等.",sit.m_id);
+		}
+
+		sit.set( (sit.m_ant[0].x+sit.m_ant[1].x)/2,(sit.m_ant[0].y+sit.m_ant[1].y)/2);
+	}
+
+}
+void sit_list::read_ant_path()
+{
+	std::unordered_map<int,std::shared_ptr<site>> map;
+	const char *sql = "SELECT reader_id,tof_flag,b_x,b_y,b_z,e_x,e_y,e_z,spacing_ratio FROM dat_reader_path_tof_n;";
+    std::string Error;
+    YADB::CDBResultSet DBRes;
+    sDBConnPool.Query(sql,DBRes,Error);
+    uint64_t nCount = DBRes.GetRecordCount( Error );
+	if(nCount<=0)
+	   log_error("init_ant_path error :%s",Error.c_str());
+    if (nCount > 0)
+    {
+        log_info( "init_ant_path. The record count=%ld\n", nCount );
+
+        while ( DBRes.GetNextRecod(Error) )
+        {
+            int reader_id  = 0;
+            DBRes.GetField( "reader_id",reader_id, Error );
+
+			auto site_ptr=sit_list::instance()->get(reader_id);
+			if(nullptr==site_ptr)
+				continue;
+
+         	int pid=0;
+            DBRes.GetField( "tof_flag",pid, Error );
+
+            double b_x= 0;
+            DBRes.GetField( "b_x",b_x, Error );
+
+            double b_y= 0;
+            DBRes.GetField( "b_y",b_y, Error );
+
+            double b_z= 0;
+            DBRes.GetField( "b_z",b_z, Error );
+
+			double e_x= 0;
+            DBRes.GetField( "e_x",e_x, Error );
+
+            double e_y= 0;
+            DBRes.GetField( "e_y",e_y, Error );
+
+            double e_z= 0;
+            DBRes.GetField( "e_z",e_z, Error );
+
+			double spacing_ratio = 0;
+            DBRes.GetField( "spacing_ratio",spacing_ratio, Error );
+			log_info("ant_path:%d,%.2f,%.2f,%.2f,%.2f",reader_id,b_x,b_y,e_x,e_y);
+			point p1(b_x,-b_y);
+			point p2(e_x,-e_y);
+			auto &sit_ = *site_ptr;
+			if(pid == 0)
+			{
+				line_v l(p1,p2);
+				{
+					point px = l.line::projection(sit_);
+					sit_.set(px);
+					for(int i=0;i<2;i++)
+					{
+						path p;
+						p.m_slope[0] = spacing_ratio;
+						p.m_line[0] = line_v(px,l[i]);
+						sit_.m_ant[i].m_path.push_back(p);
+					}
+				}
+			}
+			else
+			{
+				ant &a = pid<0?sit_.m_ant[0]:sit_.m_ant[1];
+				if(a.m_path.size()!=0)
+				{
+					path &p = a.m_path[0];
+					p.m_line[abs(pid)-1] = line_v(p1,p2);
+					p.m_slope[abs(pid)-1] = spacing_ratio;
+				}
+				else
+				{
+					path p;
+					p.m_line[abs(pid)-1] = line_v(p1,p2);
+					p.m_slope[abs(pid)-1] = spacing_ratio;
+					a.m_path.push_back(p);
+				}
+				if(abs(pid)==1)
+					sit_.set(p1);
+			}
+        }
+    }
+	for(auto&_s:sit_list::instance()->m_map)
+	{
+		auto & s = *(_s.second);
+		if(s.m_id==-1)
+			continue;
+        s.swap();
+		if((s.path(0).empty() && s.path(1).empty()))
+			continue;
+        s.m_path_empty=false;
+
+        for(auto &a:s.m_ant)
+        for(auto &p:a.m_path)
+        {
+            if(!p.m_line[0].empty())
+            {
+                point px = p.m_line[0].line::projection(a);
+                p.m_line[0]=line_v(px,p.m_line[0][1]);
+            }
+        }
+        //std_info("%s",s.to_string().c_str());
+        log_info("%s",s.to_string().c_str());
+        //std_info("%f----%f",s.x,s.y);
+	}
+}
+#endif
 void sit_list::read_ant_path(int id)
 {
      std::string sql = "SELECT reader_id,tof_flag,b_x,b_y,b_z,e_x,e_y,e_z,spacing_ratio FROM dat_reader_path_tof_n";
@@ -641,64 +641,64 @@ void sit_list::read_sit_list(int id)
         }
     }
 }
+#if 0
+void sit_list::init_site()
+{
+    const char *sql = "SELECT reader_id, reader_type_id, dat_reader.map_id, \
+            area_id, device_type_id, dimension, dat_map.scale\
+            FROM dat_reader, dat_map where \
+            dat_reader.map_id=dat_map.map_id and state=0;";
 
-//void sit_list::init_site()
-//{
-//    const char *sql = "SELECT reader_id, reader_type_id, dat_reader.map_id, \
-//            area_id, device_type_id, dimension, dat_map.scale\
-//            FROM dat_reader, dat_map where \
-//            dat_reader.map_id=dat_map.map_id and state=0;";
-
-//    std::string Error;
-//    YADB::CDBResultSet DBRes;
-//    sDBConnPool.Query(sql,DBRes,Error);
-//    uint64_t nCount = DBRes.GetRecordCount( Error );
-//    if (nCount > 0)
-//    {
-//        log_info( "init_site. The record count=%ld\n", nCount );
-
-//        while ( DBRes.GetNextRecod(Error) )
-//        {
-//            int reader_id  = 0;
-//            DBRes.GetField( "reader_id",reader_id, Error );
+    std::string Error;
+    YADB::CDBResultSet DBRes;
+    sDBConnPool.Query(sql,DBRes,Error);
+    uint64_t nCount = DBRes.GetRecordCount( Error );
+    if (nCount > 0)
+    {
+        log_info( "init_site. The record count=%ld\n", nCount );
 
-//            auto site_ptr=sit_list::instance()->get(reader_id);
-//            if(nullptr==site_ptr)
-//            {
-//                site_ptr = std::make_shared<site>(reader_id);
-//                sit_list::instance()->add(reader_id,site_ptr);
-//            }
+        while ( DBRes.GetNextRecod(Error) )
+        {
+            int reader_id  = 0;
+            DBRes.GetField( "reader_id",reader_id, Error );
 
-//            int reader_type_id  = 0;
-//            DBRes.GetField( "reader_type_id",reader_type_id, Error );
+            auto site_ptr=sit_list::instance()->get(reader_id);
+            if(nullptr==site_ptr)
+            {
+                site_ptr = std::make_shared<site>(reader_id);
+                sit_list::instance()->add(reader_id,site_ptr);
+            }
 
-//            int map_id  = 0;
-//            DBRes.GetField( "map_id",map_id, Error );
+            int reader_type_id  = 0;
+            DBRes.GetField( "reader_type_id",reader_type_id, Error );
 
-//            int area_id  = 0;
-//            DBRes.GetField( "area_id",area_id, Error );
+            int map_id  = 0;
+            DBRes.GetField( "map_id",map_id, Error );
 
-//            int device_type_id  = 0;
-//            DBRes.GetField( "device_type_id",device_type_id, Error );
+            int area_id  = 0;
+            DBRes.GetField( "area_id",area_id, Error );
 
-//            int dimension  = 0;
-//            DBRes.GetField( "dimension",dimension, Error );
+            int device_type_id  = 0;
+            DBRes.GetField( "device_type_id",device_type_id, Error );
 
-//            double scale= 0;
-//            DBRes.GetField( "scale",scale, Error );
+            int dimension  = 0;
+            DBRes.GetField( "dimension",dimension, Error );
 
-//            site_ptr->m_reader_type_id = reader_type_id;
-//            site_ptr->m_map_id = map_id;
-//            site_ptr->m_area_id = area_id;
+            double scale= 0;
+            DBRes.GetField( "scale",scale, Error );
 
-//            site_ptr->m_device_type_id = device_type_id;
+            site_ptr->m_reader_type_id = reader_type_id;
+            site_ptr->m_map_id = map_id;
+            site_ptr->m_area_id = area_id;
 
-//            site_ptr->m_dimension = dimension;
-//            site_ptr->m_scale = scale;
-//        }
-//    }
-//}
+            site_ptr->m_device_type_id = device_type_id;
 
+            site_ptr->m_dimension = dimension;
+            site_ptr->m_scale = scale;
+        }
+    }
+}
+#endif
 algo_config site::g_config[]=
 {
 	{ "tof-1",  1, 2, 0.1, 1 },

+ 1 - 1
ant.h

@@ -335,7 +335,7 @@ struct sit_list:single_base<sit_list,int,std::shared_ptr<site>>
 //    }
 
     ///id=-1为初始化所有
-    void load_from_db(int id)
+    void load_from_db(int id=-1)
     {
         load();
         init_site(id);

+ 137 - 136
area.cpp

@@ -71,88 +71,88 @@ bool area::in_area(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 );
 
-//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_areaid 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);
+		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 );
 
-//			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);
+			int over_time_vehicle = 0;
+			DBRes.GetField( "over_time_vehicle",over_time_vehicle, Error );
 
-//			map.insert({area_id,ap});
-//		}
-//	}
-	
-//	area_list::instance()->add(map);
-//}
+			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 \
             FROM dat_area a ,dat_monkeycar_base_info b ,dat_map c\
-            where a.area_id = b.monkeycar_areaid and a.map_id = c.map_id";
+            where a.area_id = b.monkeycar_base_info_id and a.map_id = c.map_id";
 
     if(-1 == id)
     {
@@ -274,14 +274,14 @@ void area_list::init_monkeycar_area(int id)
     }
 }
 
-void area_list::init_from_db(int id)
+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 \
             FROM dat_area a,dat_map b\
             where a.map_id = b.map_id and  area_id not in \
-            (select monkeycar_areaid from dat_monkeycar_base_info)";
+            (select monkeycar_base_info_id from dat_monkeycar_base_info)";
 
     if(-1 == id)
     {
@@ -303,7 +303,7 @@ void area_list::init_from_db(int id)
     int nCount = DBRes.GetRecordCount( Error );
     if (nCount < 1)
     {
-        log_error("基础数据 增加或修改失败,数据库中找不到: area_id=%d", id);
+        log_error("基础数据 增加或修改失败,数据库中找不到: area_id=%d:%s", id,sql.c_str());
         return ;
     }
 
@@ -393,75 +393,76 @@ void area_list::init_from_db(int id)
         log_info( "init_area. The record count=%d\n", nCount );
         area_list::instance()->add(map);
 
-        init_monkeycar_area(-1);
+        init_monkeycar_area();
     }
 }
+#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 );
 
-//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_areaid 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 );
+		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 );
 
-//			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);
+			int over_time_person = 0;
+			DBRes.GetField( "over_time_person",over_time_person, Error );
 
-//            ap->m_limit_vehicle_second = over_time_vehicle;
-//            ap->m_limit_vehicle_count = over_count_vehicle;
+			int over_time_vehicle = 0;
+			DBRes.GetField( "over_time_vehicle",over_time_vehicle, Error );
 
-//			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);
+			std::string path;
+			DBRes.GetField( "path",path, Error );
+  	
+			double scale = 0;
+			DBRes.GetField( "scale",scale, Error );
 
-//			map.insert({area_id,ap});
-//		}
-//	}
-	
-//	area_list::instance()->add(map);
+			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);
 
-//	init_monkeycar_area();
-//}
+            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)
 {
 	if(str.empty())

+ 2 - 2
area.h

@@ -94,9 +94,9 @@ struct area_list:single_base<area_list,int,std::shared_ptr<area>>
     //void init_from_db();
     //void init_monkeycar_area();
     ///id=-1为初始化所有
-    void init_from_db(int id);
+    void init_from_db(int id=-1);
     ///id=-1为初始化所有
-    void init_monkeycar_area(int id);
+    void init_monkeycar_area(int id=-1);
 };
 
 struct area_hover

+ 19 - 19
autom4te.cache/requests

@@ -81,58 +81,58 @@
                         'configure.ac'
                       ],
                       {
-                        'AM_PROG_F77_C_O' => 1,
                         '_LT_AC_TAGCONFIG' => 1,
-                        'm4_pattern_forbid' => 1,
+                        'AM_PROG_F77_C_O' => 1,
                         'AC_INIT' => 1,
-                        '_AM_COND_IF' => 1,
+                        'm4_pattern_forbid' => 1,
                         'AC_CANONICAL_TARGET' => 1,
-                        'AC_SUBST' => 1,
+                        '_AM_COND_IF' => 1,
                         'AC_CONFIG_LIBOBJ_DIR' => 1,
-                        'AC_FC_SRCEXT' => 1,
+                        'AC_SUBST' => 1,
                         'AC_CANONICAL_HOST' => 1,
+                        'AC_FC_SRCEXT' => 1,
                         'AC_PROG_LIBTOOL' => 1,
                         'AM_PROG_MKDIR_P' => 1,
                         'AM_INIT_AUTOMAKE' => 1,
-                        'AM_PATH_GUILE' => 1,
                         'AC_CONFIG_SUBDIRS' => 1,
+                        'AM_PATH_GUILE' => 1,
                         'AM_AUTOMAKE_VERSION' => 1,
                         'LT_CONFIG_LTDL_DIR' => 1,
-                        'AC_CONFIG_LINKS' => 1,
                         'AC_REQUIRE_AUX_FILE' => 1,
-                        'm4_sinclude' => 1,
+                        'AC_CONFIG_LINKS' => 1,
                         'LT_SUPPORTED_TAG' => 1,
+                        'm4_sinclude' => 1,
                         'AM_MAINTAINER_MODE' => 1,
                         'AM_NLS' => 1,
                         'AC_FC_PP_DEFINE' => 1,
                         'AM_GNU_GETTEXT_INTL_SUBDIR' => 1,
-                        'AM_MAKEFILE_INCLUDE' => 1,
                         '_m4_warn' => 1,
+                        'AM_MAKEFILE_INCLUDE' => 1,
                         'AM_PROG_CXX_C_O' => 1,
-                        '_AM_MAKEFILE_INCLUDE' => 1,
                         '_AM_COND_ENDIF' => 1,
+                        '_AM_MAKEFILE_INCLUDE' => 1,
                         'AM_ENABLE_MULTILIB' => 1,
                         'AM_PROG_MOC' => 1,
                         'AM_SILENT_RULES' => 1,
                         'AC_CONFIG_FILES' => 1,
-                        'LT_INIT' => 1,
                         'include' => 1,
-                        'AM_GNU_GETTEXT' => 1,
+                        'LT_INIT' => 1,
                         'AM_PROG_AR' => 1,
+                        'AM_GNU_GETTEXT' => 1,
                         'AC_LIBSOURCE' => 1,
-                        'AM_PROG_FC_C_O' => 1,
                         'AC_CANONICAL_BUILD' => 1,
+                        'AM_PROG_FC_C_O' => 1,
                         'AC_FC_FREEFORM' => 1,
-                        'AH_OUTPUT' => 1,
                         'AC_FC_PP_SRCEXT' => 1,
-                        'AC_CONFIG_AUX_DIR' => 1,
+                        'AH_OUTPUT' => 1,
                         '_AM_SUBST_NOTMAKE' => 1,
-                        'm4_pattern_allow' => 1,
-                        'sinclude' => 1,
+                        'AC_CONFIG_AUX_DIR' => 1,
                         'AM_PROG_CC_C_O' => 1,
-                        'AM_XGETTEXT_OPTION' => 1,
-                        'AC_CANONICAL_SYSTEM' => 1,
+                        'sinclude' => 1,
+                        'm4_pattern_allow' => 1,
                         'AM_CONDITIONAL' => 1,
+                        'AC_CANONICAL_SYSTEM' => 1,
+                        'AM_XGETTEXT_OPTION' => 1,
                         'AC_CONFIG_HEADERS' => 1,
                         'AC_DEFINE_TRACE_LITERAL' => 1,
                         'AM_POT_TOOLS' => 1,

+ 137 - 137
card.cpp

@@ -667,145 +667,145 @@ void card_list::init_vehicle(int32_t id)
         card_list::instance()->add(map);
     }
 }
+#if 0
+void card_list::init_vehicle()
+{
+	std::unordered_map<uint64_t,std::shared_ptr<card_location_base>> map;
+	std::string strategy = config.get("car.strategy","car1");
+	const char *sql = "SELECT ve.vehicle_id, ve.card_id, c.card_type_id, \
+						ve.dept_id, ve.group_id, v.vehicle_type_id, vt.vehicle_level_id, \
+						vt.is_railroad AS vt_is_railroad,ve.need_display ,ve.power_alarm,\
+						vt.vehicle_category_id,v.bigger_car_flag,vc.over_speed \
+						FROM dat_vehicle_extend ve \
+						LEFT JOIN dat_vehicle v ON ve.vehicle_id = v.vehicle_id \
+						LEFT JOIN dat_card c ON ve.card_id = c.card_id \
+						LEFT JOIN dat_dept d ON ve.dept_id = d.dept_id \
+						LEFT JOIN dat_group g ON ve.group_id = g.group_id \
+						LEFT JOIN dat_vehicle_type vt ON v.vehicle_type_id = vt.vehicle_type_id \
+						LEFT JOIN dat_vehicle_category vc ON vc.vehicle_category_id = vt.vehicle_category_id \
+						WHERE c.card_type_id = 2 AND c.state_id = 0;";
+	std::string Error;
+	YADB::CDBResultSet DBRes;
+	sDBConnPool.Query(sql,DBRes,Error);
+	int nCount = DBRes.GetRecordCount( Error );
+	if (nCount > 0)
+	{
+        log_info( "init_vehicle. The record count=%d\n", nCount );
 
-//void card_list::init_vehicle()
-//{
-//	std::unordered_map<uint64_t,std::shared_ptr<card_location_base>> map;
-//	std::string strategy = config.get("car.strategy","car1");
-//	const char *sql = "SELECT ve.vehicle_id, ve.card_id, c.card_type_id, \
-//						ve.dept_id, ve.group_id, v.vehicle_type_id, vt.vehicle_level_id, \
-//						vt.is_railroad AS vt_is_railroad,ve.need_display ,ve.power_alarm,\
-//						vt.vehicle_category_id,v.bigger_car_flag,vc.over_speed \
-//						FROM dat_vehicle_extend ve \
-//						LEFT JOIN dat_vehicle v ON ve.vehicle_id = v.vehicle_id \
-//						LEFT JOIN dat_card c ON ve.card_id = c.card_id \
-//						LEFT JOIN dat_dept d ON ve.dept_id = d.dept_id \
-//						LEFT JOIN dat_group g ON ve.group_id = g.group_id \
-//						LEFT JOIN dat_vehicle_type vt ON v.vehicle_type_id = vt.vehicle_type_id \
-//						LEFT JOIN dat_vehicle_category vc ON vc.vehicle_category_id = vt.vehicle_category_id \
-//						WHERE c.card_type_id = 2 AND c.state_id = 0;";
-//	std::string Error;
-//	YADB::CDBResultSet DBRes;
-//	sDBConnPool.Query(sql,DBRes,Error);
-//	int nCount = DBRes.GetRecordCount( Error );
-//	if (nCount > 0)
-//	{
-//        log_info( "init_vehicle. The record count=%d\n", nCount );
-
-//		while ( DBRes.GetNextRecod(Error) )
-//		{
-//			unsigned int vehicle_id  = 0;
-//			DBRes.GetField( "vehicle_id",vehicle_id, Error );
-
-//			std::string card_id;
-//			DBRes.GetField( "card_id",card_id, Error );
-
-//			uint32_t vsid = atoi(card_id.substr(3).c_str());
-			
-//			unsigned int card_type_id  = 0;
-//			DBRes.GetField( "card_type_id",card_type_id, Error );
-
-//			int dept_id = 0;
-//			DBRes.GetField( "dept_id",dept_id, Error );
-
-//			int group_id = 0;
-//			DBRes.GetField( "group_id",group_id, Error );
-
-//			int vehicle_type_id = 0;
-//			DBRes.GetField( "vehicle_type_id",vehicle_type_id, Error );
-
-//			int vehicle_level_id = 0;
-//			DBRes.GetField( "vehicle_level_id",vehicle_level_id, Error );
-
-//			int need_display = 0;
-//			DBRes.GetField( "need_display",need_display, Error );
-
-//			int power_alarm = 0;
-//			DBRes.GetField( "power_alarm",power_alarm, Error );
-
-//			int vehicle_category_id = 0;
-//			DBRes.GetField( "vehicle_category_id",vehicle_category_id, Error );
-
-//			int bigger_car_flag= 0;
-//			DBRes.GetField( "bigger_car_flag",bigger_car_flag, Error );
-
-//			double over_speed= 0;
-//			DBRes.GetField( "over_speed",over_speed, Error );
-			
-//			//for now
-//			vehicle_id = vsid;
-
-//            std::shared_ptr<card_location_base> clb = std::make_shared<car>(strategy,vehicle_id,
-//                  need_display,card_type_id,dept_id,vehicle_category_id, vehicle_type_id,vehicle_level_id);
-//			uint64_t cardid = getId(vehicle_id,2);
-//			log_info("cardId:%llu,vehicle_id:%d dept_id:%d,need_display:%d---cardid:%s,categoryid:%d",cardid,vehicle_id,dept_id,need_display,card_id.c_str(),vehicle_category_id);
-//			map.insert({cardid,clb});
-//		}
-//	}
-	
-//	card_list::instance()->add(map);
-//}
-
-//void card_list::init_staffer()
-//{
-//	std::unordered_map<uint64_t,std::shared_ptr<card_location_base>> map;
-//	std::string strategy = config.get("person.strategy","person1");
-//	const char *sql = "SELECT staff_id, s.card_id, c.card_type_id, s.dept_id, s.group_id, s.occupation_id, \
-//						ol.occupation_level_id,s.worktype_id,s.need_display \
-//						FROM dat_staff_extend s \
-//						LEFT JOIN dat_card c ON s.card_id = c.card_id \
-//						LEFT JOIN dat_occupation o ON s.occupation_id = o.occupation_id \
-//						LEFT JOIN dat_occupation_level ol ON ol.occupation_level_id = o.occupation_level_id \
-//						WHERE c.card_type_id = 1 AND s.duty_id = 0 AND c.state_id = 0;";
-//	std::string Error;
-//	YADB::CDBResultSet DBRes;
-//	sDBConnPool.Query(sql,DBRes,Error);
-//	int nCount = DBRes.GetRecordCount( Error );
-//	if (nCount > 0)
-//	{
-//		log_info( "init_staffer. The record count=%d\n", nCount );
-
-//		while ( DBRes.GetNextRecod(Error) )
-//		{
-//			unsigned int staff_id  = 0;
-//			DBRes.GetField( "staff_id",staff_id, Error );
-
-//			std::string card_id;
-//			DBRes.GetField( "card_id",card_id, Error );
-
-//			uint32_t vsid = atoi(card_id.substr(3).c_str());
-			
-//			unsigned int card_type_id  = 0;
-//			DBRes.GetField( "card_type_id",card_type_id, Error );
-			
-//			int dept_id = 0;
-//			DBRes.GetField( "dept_id",dept_id, Error );
-
-//			int group_id = 0;
-//			DBRes.GetField( "group_id",group_id, Error );
-
-//			int occupation_id = 0;
-//			DBRes.GetField( "occupation_id",occupation_id, Error );
-
-//			int occupation_level_id = 0;
-//			DBRes.GetField( "occupation_level_id",occupation_level_id, Error );
-
-//			int need_display = 0;
-//			DBRes.GetField( "need_display",need_display, Error );
-
-//			//for now;
-//			staff_id = vsid;
-
-//			std::shared_ptr<card_location_base> clb = std::make_shared<person>(strategy,staff_id,need_display,card_type_id,dept_id,occupation_level_id);
-//			uint64_t cardid = getId(staff_id,1);
-//			log_info("cardId:%llu,staff_id:%d dept_id:%d,need_display:%d--c-ard:%s",cardid,staff_id,dept_id,need_display,card_id.c_str());
-//			map.insert({cardid,clb});
-//		}
-//	}
-	
-//	card_list::instance()->add(map);
-//}
+		while ( DBRes.GetNextRecod(Error) )
+		{
+			unsigned int vehicle_id  = 0;
+			DBRes.GetField( "vehicle_id",vehicle_id, Error );
+
+			std::string card_id;
+			DBRes.GetField( "card_id",card_id, Error );
+
+			uint32_t vsid = atoi(card_id.substr(3).c_str());
+  		
+			unsigned int card_type_id  = 0;
+			DBRes.GetField( "card_type_id",card_type_id, Error );
+
+			int dept_id = 0;
+			DBRes.GetField( "dept_id",dept_id, Error );
+
+			int group_id = 0;
+			DBRes.GetField( "group_id",group_id, Error );
+
+			int vehicle_type_id = 0;
+			DBRes.GetField( "vehicle_type_id",vehicle_type_id, Error );
+
+			int vehicle_level_id = 0;
+			DBRes.GetField( "vehicle_level_id",vehicle_level_id, Error );
+
+			int need_display = 0;
+			DBRes.GetField( "need_display",need_display, Error );
+
+			int power_alarm = 0;
+			DBRes.GetField( "power_alarm",power_alarm, Error );
+
+			int vehicle_category_id = 0;
+			DBRes.GetField( "vehicle_category_id",vehicle_category_id, Error );
+
+			int bigger_car_flag= 0;
+			DBRes.GetField( "bigger_car_flag",bigger_car_flag, Error );
+
+			double over_speed= 0;
+			DBRes.GetField( "over_speed",over_speed, Error );
+  		
+			//for now
+			vehicle_id = vsid;
+
+            std::shared_ptr<card_location_base> clb = std::make_shared<car>(strategy,vehicle_id,
+                  need_display,card_type_id,dept_id,vehicle_category_id, vehicle_type_id,vehicle_level_id);
+			uint64_t cardid = getId(vehicle_id,2);
+			log_info("cardId:%llu,vehicle_id:%d dept_id:%d,need_display:%d---cardid:%s,categoryid:%d",cardid,vehicle_id,dept_id,need_display,card_id.c_str(),vehicle_category_id);
+			map.insert({cardid,clb});
+		}
+	}
+  
+	card_list::instance()->add(map);
+}
+
+void card_list::init_staffer()
+{
+	std::unordered_map<uint64_t,std::shared_ptr<card_location_base>> map;
+	std::string strategy = config.get("person.strategy","person1");
+	const char *sql = "SELECT staff_id, s.card_id, c.card_type_id, s.dept_id, s.group_id, s.occupation_id, \
+						ol.occupation_level_id,s.worktype_id,s.need_display \
+						FROM dat_staff_extend s \
+						LEFT JOIN dat_card c ON s.card_id = c.card_id \
+						LEFT JOIN dat_occupation o ON s.occupation_id = o.occupation_id \
+						LEFT JOIN dat_occupation_level ol ON ol.occupation_level_id = o.occupation_level_id \
+						WHERE c.card_type_id = 1 AND s.duty_id = 0 AND c.state_id = 0;";
+	std::string Error;
+	YADB::CDBResultSet DBRes;
+	sDBConnPool.Query(sql,DBRes,Error);
+	int nCount = DBRes.GetRecordCount( Error );
+	if (nCount > 0)
+	{
+		log_info( "init_staffer. The record count=%d\n", nCount );
+
+		while ( DBRes.GetNextRecod(Error) )
+		{
+			unsigned int staff_id  = 0;
+			DBRes.GetField( "staff_id",staff_id, Error );
+
+			std::string card_id;
+			DBRes.GetField( "card_id",card_id, Error );
 
+			uint32_t vsid = atoi(card_id.substr(3).c_str());
+  		
+			unsigned int card_type_id  = 0;
+			DBRes.GetField( "card_type_id",card_type_id, Error );
+  		
+			int dept_id = 0;
+			DBRes.GetField( "dept_id",dept_id, Error );
+
+			int group_id = 0;
+			DBRes.GetField( "group_id",group_id, Error );
+
+			int occupation_id = 0;
+			DBRes.GetField( "occupation_id",occupation_id, Error );
+
+			int occupation_level_id = 0;
+			DBRes.GetField( "occupation_level_id",occupation_level_id, Error );
+
+			int need_display = 0;
+			DBRes.GetField( "need_display",need_display, Error );
+
+			//for now;
+			staff_id = vsid;
+
+			std::shared_ptr<card_location_base> clb = std::make_shared<person>(strategy,staff_id,need_display,card_type_id,dept_id,occupation_level_id);
+			uint64_t cardid = getId(staff_id,1);
+			log_info("cardId:%llu,staff_id:%d dept_id:%d,need_display:%d--c-ard:%s",cardid,staff_id,dept_id,need_display,card_id.c_str());
+			map.insert({cardid,clb});
+		}
+	}
+  
+	card_list::instance()->add(map);
+}
+#endif
 void card_list::init_card_from_db()
 {
     init_staffer(-1);

+ 7 - 5
main.cpp

@@ -41,11 +41,11 @@ struct Init_Setting
         DBSetting.PoolSize = config.get("db.conn_timeout",30);
         _mysql_init(DBSetting);
 
-        sit_list::instance()->load_from_db(-1);
+        sit_list::instance()->load_from_db();
 
         card_list::instance()->init_card_from_db();
 
-        area_list::instance()->init_from_db(-1);
+        area_list::instance()->init_from_db();
         std_info("here....");
         //test
         point pt(3348,100);
@@ -118,7 +118,7 @@ void usage(char ** argv)
     {
         printf("用法:yals [选项]文件...\n");
         printf("选项:\n");
-        printf("--help			显示此帮助说明\n");
+        printf("--help				显示此帮助说明\n");
         printf("-v|--version		显示采集程序版本信息\n");
     }
     else if(cmd == "--version" || cmd == "-v")
@@ -148,6 +148,10 @@ int main(int argc ,char * argv[])
         usage(argv);
         return 0;
     }
+
+    module_mgr::start();
+    atexit(&cleanup);
+
     log_init("../etc/log.ini");
     if(config.open("../etc/config.ini"))
         return -1;
@@ -156,9 +160,7 @@ int main(int argc ,char * argv[])
 
 	card_path::init();
 	test_find_path(point(4717,209.2),point(4727,206.4));
-    atexit(&cleanup);
 
-    module_mgr::start();
 
     net_service mh;
     int port=config.get("service.port",4000);

+ 3 - 2
znet.cpp

@@ -468,9 +468,10 @@ struct signal_w:ev::sig
 {
 	io_context&m_ic;
 	signal_w(io_context&ic, int s)
-		:m_ic(ic)
+		:ev::sig(ic)
+		,m_ic(ic)
 	{
-//		this->set(m_ic);
+		//this->set(m_ic);
 		this->set(this);
 		this->set(s);
 		this->start();