ant.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <math.h>
  4. #include "ant.h"
  5. #include "db_api/CDBConnPool.h"
  6. template<> std::shared_ptr<sit_list>
  7. single_base<sit_list, int, std::shared_ptr<site>>::m_instance=std::make_shared<sit_list>();
  8. int site::index()const
  9. {
  10. return m_algo+(m_num_dims<<1);
  11. }
  12. site::site(int id)
  13. :m_algo(0)
  14. ,m_num_dims(0)
  15. ,m_id(id)
  16. ,m_path_empty(true)
  17. {
  18. }
  19. const algo_config&site::config()const
  20. {
  21. return g_config[index()];
  22. }
  23. #if 0
  24. static int str_split(char*s,char**rc)
  25. {
  26. char**o=rc;
  27. for(;*s;)
  28. {
  29. *o=strtok_r(s,",",&s);
  30. o++;
  31. }
  32. return o-rc;
  33. }
  34. void sit_list::read_ant_path(const char*fname)
  35. {
  36. FILE*fp=fopen(fname,"r");
  37. char buf[512],*p;
  38. int t,id,pid;
  39. char* s[20];
  40. while((p=fgets(buf,sizeof(buf),fp)))
  41. {
  42. t=str_split(buf,&s[0]);
  43. if(t<9)
  44. continue;
  45. id=atoi(s[0]);
  46. auto s_ = sit_list::instance()->get(id);
  47. if(s_==nullptr)
  48. continue;
  49. pid=atoi(s[1]);
  50. if(pid>2)
  51. continue;
  52. point p1(atof(s[2]),-atof(s[3]));
  53. point p2(atof(s[5]),-atof(s[6]));
  54. auto &sit_ = *s_;
  55. if(pid == 0)
  56. {
  57. line_v l(p1,p2);
  58. {
  59. point px = l.line::projection(sit_);
  60. sit_.set(px);
  61. for(int i=0;i<2;i++)
  62. {
  63. path p;
  64. p.m_slope[0] = atof(s[8]);
  65. p.m_line[0] = line_v(px,l[i]);
  66. sit_.m_ant[i].m_path.push_back(p);
  67. }
  68. }
  69. }
  70. else
  71. {
  72. ant &a = pid<0?sit_.m_ant[0]:sit_.m_ant[1];
  73. if(a.m_path.size()!=0)
  74. {
  75. path &p = a.m_path[0];
  76. p.m_line[abs(pid)-1] = line_v(p1,p2);
  77. p.m_slope[abs(pid)-1] = atof(s[8]);
  78. }
  79. else
  80. {
  81. path p;
  82. p.m_line[abs(pid)-1] = line_v(p1,p2);
  83. p.m_slope[abs(pid)-1] = atof(s[8]);
  84. a.m_path.push_back(p);
  85. }
  86. if(abs(pid)==1)
  87. sit_.set(p1);
  88. }
  89. }
  90. fclose(fp);
  91. for(auto&_s:sit_list::instance()->m_map)
  92. {
  93. auto & s = *(_s.second);
  94. if(s.m_id==-1)
  95. continue;
  96. s.swap();
  97. if((s.path(0).empty() && s.path(1).empty()))
  98. continue;
  99. s.m_path_empty=false;
  100. for(auto &a:s.m_ant)
  101. for(auto &p:a.m_path)
  102. {
  103. if(!p.m_line[0].empty())
  104. {
  105. point px = p.m_line[0].line::projection(a);
  106. p.m_line[0]=line_v(px,p.m_line[0][1]);
  107. }
  108. }
  109. //std_info("%s",s.to_string().c_str());
  110. log_info("%s",s.to_string().c_str());
  111. //std_info("%f----%f",s.x,s.y);
  112. }
  113. }
  114. //1, 101, 1, '101-1', 4727, 75, 0, 0, '2017-08-29 10:21:14'
  115. void sit_list::read_sit_list(const char*fname)
  116. {
  117. FILE*fp=fopen(fname,"r");
  118. char buf[512];
  119. int t,id;
  120. char* s[20];
  121. while(fgets(buf,sizeof(buf),fp))
  122. {
  123. t=str_split(buf,&s[0]);
  124. if(t<8)
  125. continue;
  126. id=atoi(s[1]);
  127. int antid=atoi(s[2])-1;
  128. if(antid>=2)
  129. continue;
  130. auto tmp = m_instance->get(id);
  131. if(tmp==nullptr)
  132. tmp = std::make_shared<site>(id);
  133. tmp->m_ant[antid].set(atof(s[4]),-atof(s[5]));
  134. sit_list::instance()->add(id,tmp);
  135. //std_info("211111 id=%dsize = %d",id,instance()->m_map.size());
  136. //m_list[id].m_id=id;
  137. //m_list[id].m_ant[antid].set(atof(s[4]),-atof(s[5]));
  138. }
  139. for(auto&sit_:sit_list::instance()->m_map)
  140. {
  141. auto & sit = *(sit_.second);
  142. if(sit.m_id==-1)
  143. continue;
  144. if(sit.m_ant[0]==sit.m_ant[1])
  145. {
  146. log_warn("%d分站天线坐标相等.",sit.m_id);
  147. }
  148. sit.set( (sit.m_ant[0].x+sit.m_ant[1].x)/2,(sit.m_ant[0].y+sit.m_ant[1].y)/2);
  149. }
  150. fclose(fp);
  151. }
  152. #endif
  153. //void sit_list::read_sit_list()
  154. //{
  155. // std::unordered_map<int,std::shared_ptr<site>> map;
  156. // const char *sql = "SELECT antenna_id, a.reader_id, idx, a.x, a.y, a.z, a.angle \
  157. // FROM dat_antenna a, dat_reader r \
  158. // WHERE a.reader_id = r.reader_id;";
  159. // std::string Error;
  160. // YADB::CDBResultSet DBRes;
  161. // sDBConnPool.Query(sql,DBRes,Error);
  162. // uint64_t nCount = DBRes.GetRecordCount( Error );
  163. // if (nCount > 0)
  164. // {
  165. // log_info( "init_antenna. The record count=%ld\n", nCount );
  166. // while ( DBRes.GetNextRecod(Error) )
  167. // {
  168. // int reader_id = 0;
  169. // DBRes.GetField( "reader_id",reader_id, Error );
  170. // int idx=0;
  171. // DBRes.GetField( "idx",idx, Error );
  172. // int antid = idx-1;
  173. // if(antid >= 2)
  174. // continue;
  175. // double x= 0;
  176. // DBRes.GetField( "x",x, Error );
  177. // double y= 0;
  178. // DBRes.GetField( "y",y, Error );
  179. // double z= 0;
  180. // DBRes.GetField( "z",z, Error );
  181. // std::shared_ptr<site> site_ptr=nullptr;
  182. // auto it = map.find(reader_id);
  183. // if(it==map.end())
  184. // {
  185. // site_ptr = std::make_shared<site>(reader_id);
  186. // map.insert({reader_id,site_ptr});
  187. // }
  188. // else
  189. // site_ptr=it->second;
  190. // site_ptr->m_ant[antid].set(x,-y);
  191. // log_info("reand_ant..%d,%d,%.2f,%.2f",reader_id,antid,x,y);
  192. // }
  193. // }
  194. // sit_list::instance()->add(map);
  195. // for(auto&sit_:map)
  196. // {
  197. // auto & sit = *(sit_.second);
  198. // if(sit.m_id==-1)
  199. // continue;
  200. // if(sit.m_ant[0]==sit.m_ant[1])
  201. // {
  202. // log_warn("%d分站天线坐标相等.",sit.m_id);
  203. // }
  204. // sit.set( (sit.m_ant[0].x+sit.m_ant[1].x)/2,(sit.m_ant[0].y+sit.m_ant[1].y)/2);
  205. // }
  206. //}
  207. //void sit_list::read_ant_path()
  208. //{
  209. // std::unordered_map<int,std::shared_ptr<site>> map;
  210. // 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;";
  211. // std::string Error;
  212. // YADB::CDBResultSet DBRes;
  213. // sDBConnPool.Query(sql,DBRes,Error);
  214. // uint64_t nCount = DBRes.GetRecordCount( Error );
  215. // if(nCount<=0)
  216. // log_error("init_ant_path error :%s",Error.c_str());
  217. // if (nCount > 0)
  218. // {
  219. // log_info( "init_ant_path. The record count=%ld\n", nCount );
  220. // while ( DBRes.GetNextRecod(Error) )
  221. // {
  222. // int reader_id = 0;
  223. // DBRes.GetField( "reader_id",reader_id, Error );
  224. // auto site_ptr=sit_list::instance()->get(reader_id);
  225. // if(nullptr==site_ptr)
  226. // continue;
  227. // int pid=0;
  228. // DBRes.GetField( "tof_flag",pid, Error );
  229. // double b_x= 0;
  230. // DBRes.GetField( "b_x",b_x, Error );
  231. // double b_y= 0;
  232. // DBRes.GetField( "b_y",b_y, Error );
  233. // double b_z= 0;
  234. // DBRes.GetField( "b_z",b_z, Error );
  235. // double e_x= 0;
  236. // DBRes.GetField( "e_x",e_x, Error );
  237. // double e_y= 0;
  238. // DBRes.GetField( "e_y",e_y, Error );
  239. // double e_z= 0;
  240. // DBRes.GetField( "e_z",e_z, Error );
  241. // double spacing_ratio = 0;
  242. // DBRes.GetField( "spacing_ratio",spacing_ratio, Error );
  243. // log_info("ant_path:%d,%.2f,%.2f,%.2f,%.2f",reader_id,b_x,b_y,e_x,e_y);
  244. // point p1(b_x,-b_y);
  245. // point p2(e_x,-e_y);
  246. // auto &sit_ = *site_ptr;
  247. // if(pid == 0)
  248. // {
  249. // line_v l(p1,p2);
  250. // {
  251. // point px = l.line::projection(sit_);
  252. // sit_.set(px);
  253. // for(int i=0;i<2;i++)
  254. // {
  255. // path p;
  256. // p.m_slope[0] = spacing_ratio;
  257. // p.m_line[0] = line_v(px,l[i]);
  258. // sit_.m_ant[i].m_path.push_back(p);
  259. // }
  260. // }
  261. // }
  262. // else
  263. // {
  264. // ant &a = pid<0?sit_.m_ant[0]:sit_.m_ant[1];
  265. // if(a.m_path.size()!=0)
  266. // {
  267. // path &p = a.m_path[0];
  268. // p.m_line[abs(pid)-1] = line_v(p1,p2);
  269. // p.m_slope[abs(pid)-1] = spacing_ratio;
  270. // }
  271. // else
  272. // {
  273. // path p;
  274. // p.m_line[abs(pid)-1] = line_v(p1,p2);
  275. // p.m_slope[abs(pid)-1] = spacing_ratio;
  276. // a.m_path.push_back(p);
  277. // }
  278. // if(abs(pid)==1)
  279. // sit_.set(p1);
  280. // }
  281. // }
  282. // }
  283. // for(auto&_s:sit_list::instance()->m_map)
  284. // {
  285. // auto & s = *(_s.second);
  286. // if(s.m_id==-1)
  287. // continue;
  288. // s.swap();
  289. // if((s.path(0).empty() && s.path(1).empty()))
  290. // continue;
  291. // s.m_path_empty=false;
  292. // for(auto &a:s.m_ant)
  293. // for(auto &p:a.m_path)
  294. // {
  295. // if(!p.m_line[0].empty())
  296. // {
  297. // point px = p.m_line[0].line::projection(a);
  298. // p.m_line[0]=line_v(px,p.m_line[0][1]);
  299. // }
  300. // }
  301. // //std_info("%s",s.to_string().c_str());
  302. // log_info("%s",s.to_string().c_str());
  303. // //std_info("%f----%f",s.x,s.y);
  304. // }
  305. //}
  306. void sit_list::read_ant_path(int id)
  307. {
  308. 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";
  309. if(-1 == id)
  310. {
  311. sql.append(";");
  312. }
  313. else
  314. {
  315. sql.append(" AND reader_id=");
  316. sql.append(std::to_string(id));
  317. sql.append(";");
  318. std_debug("修改path sql=%s", sql.c_str());
  319. log_info("修改path sql=%s", sql.c_str());
  320. }
  321. std::string Error;
  322. YADB::CDBResultSet DBRes;
  323. sDBConnPool.Query(sql.c_str(),DBRes,Error);
  324. int nCount = DBRes.GetRecordCount( Error );
  325. if (nCount < 1)
  326. {
  327. log_error("修改path失败,数据库中找不到(dat_reader_path_tof_n): 分站id=%d", id);
  328. return ;
  329. }
  330. while ( DBRes.GetNextRecod(Error) )
  331. {
  332. int reader_id = 0;
  333. DBRes.GetField( "reader_id",reader_id, Error );
  334. auto site_ptr=sit_list::instance()->get(reader_id);
  335. if(nullptr==site_ptr)
  336. continue;
  337. int pid=0;
  338. DBRes.GetField( "tof_flag",pid, Error );
  339. double b_x= 0;
  340. DBRes.GetField( "b_x",b_x, Error );
  341. double b_y= 0;
  342. DBRes.GetField( "b_y",b_y, Error );
  343. double b_z= 0;
  344. DBRes.GetField( "b_z",b_z, Error );
  345. double e_x= 0;
  346. DBRes.GetField( "e_x",e_x, Error );
  347. double e_y= 0;
  348. DBRes.GetField( "e_y",e_y, Error );
  349. double e_z= 0;
  350. DBRes.GetField( "e_z",e_z, Error );
  351. double spacing_ratio = 0;
  352. DBRes.GetField( "spacing_ratio",spacing_ratio, Error );
  353. log_info("ant_path:%d,%.2f,%.2f,%.2f,%.2f",reader_id,b_x,b_y,e_x,e_y);
  354. point p1(b_x,-b_y);
  355. point p2(e_x,-e_y);
  356. auto &sit_ = *site_ptr;
  357. if(-1!=id)//清空path
  358. {
  359. sit_.clear_path();
  360. log_info( "修改path 清空path,分站id=%d\n", id );
  361. std_debug( "修改path 清空path,分站id=%d\n", id );
  362. }
  363. if(pid == 0)
  364. {
  365. line_v l(p1,p2);
  366. {
  367. point px = l.line::projection(sit_);
  368. sit_.set(px);
  369. for(int i=0;i<2;i++)
  370. {
  371. path p;
  372. p.m_slope[0] = spacing_ratio;
  373. p.m_line[0] = line_v(px,l[i]);
  374. sit_.m_ant[i].m_path.push_back(p);
  375. }
  376. }
  377. }
  378. else
  379. {
  380. ant &a = pid<0?sit_.m_ant[0]:sit_.m_ant[1];
  381. if(a.m_path.size()!=0)
  382. {
  383. path &p = a.m_path[0];
  384. p.m_line[abs(pid)-1] = line_v(p1,p2);
  385. p.m_slope[abs(pid)-1] = spacing_ratio;
  386. }
  387. else
  388. {
  389. path p;
  390. p.m_line[abs(pid)-1] = line_v(p1,p2);
  391. p.m_slope[abs(pid)-1] = spacing_ratio;
  392. a.m_path.push_back(p);
  393. }
  394. if(abs(pid)==1)
  395. sit_.set(p1);
  396. }
  397. }
  398. if(-1==id)
  399. {
  400. log_info( "read_ant_path. The record count=%ld\n", nCount );
  401. for(auto&_s:sit_list::instance()->m_map)
  402. {
  403. _s.second->deal_path();
  404. }
  405. }
  406. else
  407. {
  408. auto sit_ptr=sit_list::instance()->get(id);
  409. if(sit_ptr)
  410. {
  411. sit_ptr->deal_path();
  412. log_info( "修改path成功,分站id=%d\n", id );
  413. std_debug( "修改path成功,分站id=%d\n", id );
  414. }
  415. }
  416. }
  417. void sit_list::init_site(int id)
  418. {
  419. std::string sql = "SELECT reader_id, reader_type_id, dat_reader.map_id, \
  420. area_id, device_type_id, dimension, dat_map.scale\
  421. FROM dat_reader, dat_map where \
  422. dat_reader.map_id=dat_map.map_id and state=0";
  423. if(-1 == id)
  424. {
  425. sql.append(";");
  426. }
  427. else
  428. {
  429. sql.append(" AND reader_id=");
  430. sql.append(std::to_string(id));
  431. sql.append(";");
  432. std_debug("增加或修改分站 sql=%s", sql.c_str());
  433. log_info("增加或修改分站 sql=%s", sql.c_str());
  434. }
  435. std::string Error;
  436. YADB::CDBResultSet DBRes;
  437. sDBConnPool.Query(sql.c_str(),DBRes,Error);
  438. int nCount = DBRes.GetRecordCount( Error );
  439. if (nCount < 1)
  440. {
  441. log_error("增加或修改失败,数据库中找不到: 分站id=%d", id);
  442. return ;
  443. }
  444. log_info( "增加或修改 init_site. The record count=%ld\n", nCount );
  445. while ( DBRes.GetNextRecod(Error) )
  446. {
  447. int reader_id = 0;
  448. DBRes.GetField( "reader_id",reader_id, Error );
  449. auto site_ptr=sit_list::instance()->get(reader_id);
  450. if(nullptr==site_ptr)
  451. {
  452. site_ptr = std::make_shared<site>(reader_id);
  453. sit_list::instance()->add(reader_id,site_ptr);
  454. }
  455. int reader_type_id = 0;
  456. DBRes.GetField( "reader_type_id",reader_type_id, Error );
  457. int map_id = 0;
  458. DBRes.GetField( "map_id",map_id, Error );
  459. int area_id = 0;
  460. DBRes.GetField( "area_id",area_id, Error );
  461. int device_type_id = 0;
  462. DBRes.GetField( "device_type_id",device_type_id, Error );
  463. int dimension = 0;
  464. DBRes.GetField( "dimension",dimension, Error );
  465. double scale= 0;
  466. DBRes.GetField( "scale",scale, Error );
  467. site_ptr->m_reader_type_id = reader_type_id;
  468. site_ptr->m_map_id = map_id;
  469. site_ptr->m_area_id = area_id;
  470. site_ptr->m_device_type_id = device_type_id;
  471. site_ptr->m_dimension = dimension;
  472. site_ptr->m_scale = scale;
  473. }
  474. }
  475. void sit_list::read_sit_list(int id)
  476. {
  477. std::string sql = "SELECT antenna_id, a.reader_id, idx, a.x, a.y, a.z, a.angle \
  478. FROM dat_antenna a, dat_reader r \
  479. WHERE a.reader_id = r.reader_id";
  480. if(-1 == id)
  481. {
  482. sql.append(";");
  483. }
  484. else
  485. {
  486. sql.append(" AND antenna_id=");
  487. sql.append(std::to_string(id));
  488. sql.append(";");
  489. std_debug("基础数据 增加或修改天线 sql=%s", sql.c_str());
  490. log_info("基础数据 增加或修改天线 sql=%s", sql.c_str());
  491. }
  492. std::string Error;
  493. YADB::CDBResultSet DBRes;
  494. sDBConnPool.Query(sql.c_str(),DBRes,Error);
  495. int nCount = DBRes.GetRecordCount( Error );
  496. if (nCount < 1)
  497. {
  498. log_error("基础数据 增加或修改失败,数据库中找不到: 天线id=%d", id);
  499. return ;
  500. }
  501. std::unordered_map<int,std::shared_ptr<site>> map;
  502. while ( DBRes.GetNextRecod(Error) )
  503. {
  504. int antenna_id = 0;
  505. DBRes.GetField( "antenna_id",antenna_id, Error );
  506. int reader_id = 0;
  507. DBRes.GetField( "reader_id",reader_id, Error );
  508. int idx=0;
  509. DBRes.GetField( "idx",idx, Error );
  510. int antid = idx-1;
  511. if(antid >= 2)
  512. continue;
  513. double x= 0;
  514. DBRes.GetField( "x",x, Error );
  515. double y= 0;
  516. DBRes.GetField( "y",y, Error );
  517. double z= 0;
  518. DBRes.GetField( "z",z, Error );
  519. if(-1 == id)
  520. {
  521. std::shared_ptr<site> site_ptr=nullptr;
  522. auto it = map.find(reader_id);
  523. if(it==map.end())
  524. {
  525. site_ptr = std::make_shared<site>(reader_id);
  526. map.insert({reader_id,site_ptr});
  527. }
  528. else
  529. site_ptr=it->second;
  530. site_ptr->m_ant[antid].m_id = antenna_id;
  531. site_ptr->m_ant[antid].set(x,-y);
  532. log_info("reand_ant..%d,%d,%.2f,%.2f",reader_id,antid,x,y);
  533. }
  534. else
  535. {
  536. auto site_ptr = sit_list::instance()->get(reader_id);
  537. if(site_ptr)
  538. {
  539. site_ptr->m_ant[antid].set(x,-y);
  540. site_ptr->set_ex();
  541. }
  542. log_info("基础数据 增加或修改天线成功:天线id:%d,分站id:%d",id,reader_id);
  543. std_debug("基础数据 增加或修改天线成功:天线id:%d,分站id:%d",id,reader_id);
  544. }
  545. }
  546. if(-1 == id)
  547. {
  548. log_info( "init_antenna. The record count=%ld\n", nCount );
  549. sit_list::instance()->add(map);
  550. for(auto&sit_:map)
  551. {
  552. sit_.second->set_ex();
  553. }
  554. }
  555. }
  556. //void sit_list::init_site()
  557. //{
  558. // const char *sql = "SELECT reader_id, reader_type_id, dat_reader.map_id, \
  559. // area_id, device_type_id, dimension, dat_map.scale\
  560. // FROM dat_reader, dat_map where \
  561. // dat_reader.map_id=dat_map.map_id and state=0;";
  562. // std::string Error;
  563. // YADB::CDBResultSet DBRes;
  564. // sDBConnPool.Query(sql,DBRes,Error);
  565. // uint64_t nCount = DBRes.GetRecordCount( Error );
  566. // if (nCount > 0)
  567. // {
  568. // log_info( "init_site. The record count=%ld\n", nCount );
  569. // while ( DBRes.GetNextRecod(Error) )
  570. // {
  571. // int reader_id = 0;
  572. // DBRes.GetField( "reader_id",reader_id, Error );
  573. // auto site_ptr=sit_list::instance()->get(reader_id);
  574. // if(nullptr==site_ptr)
  575. // {
  576. // site_ptr = std::make_shared<site>(reader_id);
  577. // sit_list::instance()->add(reader_id,site_ptr);
  578. // }
  579. // int reader_type_id = 0;
  580. // DBRes.GetField( "reader_type_id",reader_type_id, Error );
  581. // int map_id = 0;
  582. // DBRes.GetField( "map_id",map_id, Error );
  583. // int area_id = 0;
  584. // DBRes.GetField( "area_id",area_id, Error );
  585. // int device_type_id = 0;
  586. // DBRes.GetField( "device_type_id",device_type_id, Error );
  587. // int dimension = 0;
  588. // DBRes.GetField( "dimension",dimension, Error );
  589. // double scale= 0;
  590. // DBRes.GetField( "scale",scale, Error );
  591. // site_ptr->m_reader_type_id = reader_type_id;
  592. // site_ptr->m_map_id = map_id;
  593. // site_ptr->m_area_id = area_id;
  594. // site_ptr->m_device_type_id = device_type_id;
  595. // site_ptr->m_dimension = dimension;
  596. // site_ptr->m_scale = scale;
  597. // }
  598. // }
  599. //}
  600. algo_config site::g_config[]=
  601. {
  602. { "tof-1", 1, 2, 0.1, 1 },
  603. { "tdoa-1", 2, 2, 0.1, 1 },
  604. { "tof-2", 2, 3, 0.1, 1 },
  605. { "tdoa-2", 3, 3, 0.1, 1 },
  606. { "tof-3", 3, 4, 0.1, 1 },
  607. { "tdoa-3", 4, 4, 0.1, 1 }
  608. };
  609. #ifdef _TEST
  610. int main()
  611. {
  612. log_init("./log.ini");
  613. //sit_list *sl = sit_list::instance();
  614. sit_list::instance()->load("data_reader_antenna.txt","path_tof.txt");
  615. sit_list::instance()->get(209)->solving(0,100);
  616. sit_list::instance()->get(209)->solving(1,100.5);
  617. //std_info("---%d",(*sl)[209].m_ant[0].m_path.size());
  618. //std_info("---%d",(*sl)[209][0].size());
  619. //std_info("---%s",(*sl)[209][0][0][0].to_string().c_str());
  620. }
  621. #endif