12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- #include "stdafx.h"
- #include "YaAlgorithmForCell.h"
- #include "../../mylog/log_module.h"
- #include "../../locate_algorithm.h"
- const int check_direction_same = 1;
- const int check_direction_not_same = -1;
- const int check_direction_error = -2;
- const int station_info_error = -3;
- const int return_correct = 0;
- int YaAlgorithmForCell::do_algorithm(Card* card, int cnt)
- {
- card->is_fit_pos = false;
- std::shared_ptr<Cell> cell = std::make_shared<Cell>();
- std::shared_ptr<POS> pos = nullptr;
- cell->card_stamp_time = card->time_stamp_cal;
- cell->originId = -1;
- //1.数据有效性判断 DIST_COUNT_CARD_CUR_CT_LESS_LAST
- int ret_by_check_data = card->CheckDistData(cnt);
- // ct 回退, 不做补值
- if(ret_by_check_data == DIST_COUNT_CARD_CUR_CT_LESS_LAST)
- {
- return 1;
- }
- if(ret_by_check_data != 0){
- return 1;
- }
- //2.组装数据
- std::shared_ptr<ReceiveDataMap> pRdm = std::make_shared<ReceiveDataMap>();
- pRdm->clear();
- if(card->AssembleDistData(pRdm) != 0 || pRdm->size() <= 0){
- return 1;
- }
- pos = std::make_shared<POS>();
- //3.算法定位
- std::vector<std::shared_ptr<POS>> udm_pos;
- if(LocateAlgorithm::CalcTdoaPosition(pRdm,card->pTdoaReaderPathMap,udm_pos) != 0)
- {
- return 1;
- }
- //4.从多解中筛选出一个解,存在两种可能:
- //a.可能无解返回非0,
- //b.可能有解,但解不正确,比如解的位置在4727,-100,但选出的解是4727,-200
- if(card->ChooseOneSolution(pRdm, udm_pos, pos) != 0)
- {
- return 1;
- }
- card->SaveOriginDataBeforeFilter(pos);
- //判断是否在地图集
- if (!LocateAlgorithm::IsOnMap(pos,card->pTdoaReaderPathMap))
- {
- return 1;
- }
- return 1;
- }
|