|
@@ -180,7 +180,6 @@ void Card::reset()
|
|
|
{
|
|
|
//以下参数与算法相关
|
|
|
//坐标初始值为0
|
|
|
- //TRACE(_T("reset card info \r\n"));
|
|
|
m_nLastLocateT = 0;
|
|
|
time_stamp_last = 0;
|
|
|
b_long_interval = false;
|
|
@@ -1306,7 +1305,6 @@ void Card::algo_tdoa(int cnt)
|
|
|
}
|
|
|
#endif
|
|
|
}else{
|
|
|
- //TRACE(_T("no kalman . \n"));
|
|
|
//最新通过算法算出的结果
|
|
|
LOCATION_SYSTEM_BRANCH(LOCATION_SYSTEM_BRANCH_214);
|
|
|
if(p->posx == INVALID_COORDINATE || p->posy == INVALID_COORDINATE){
|
|
@@ -1412,7 +1410,6 @@ int Card::algo_tdoa_1d(int cnt)
|
|
|
{
|
|
|
//解存在,解可能异常
|
|
|
//判断是否回退,至少第三次定位才走这,回退了使用上一次的
|
|
|
- TRACE(_T("no sol x: %f,y%f\r\n"),pos->posx,pos->posy);
|
|
|
}else{
|
|
|
//解异常
|
|
|
}
|
|
@@ -2255,7 +2252,6 @@ bool Area::is_in_polygon( _point p )
|
|
|
}
|
|
|
p1 = p2;
|
|
|
}
|
|
|
- //TRACE(_T("counter : %d \n"),counter);
|
|
|
return (counter % 2 == 0) ? false : true;
|
|
|
}
|
|
|
|
|
@@ -3177,6 +3173,64 @@ std::shared_ptr<POS> Card::Cell2Position(std::shared_ptr<Cell>& cell)
|
|
|
|
|
|
return pos;
|
|
|
}
|
|
|
+
|
|
|
+int Card::MappingCell2FitLinear(std::shared_ptr<Cell>& cell)
|
|
|
+{
|
|
|
+ if (cell == nullptr)
|
|
|
+ {
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ double ctArray[5] = {0.0};
|
|
|
+ double cidArray[5] = {0};
|
|
|
+
|
|
|
+ //获取新5个元素的值
|
|
|
+ int i = 4;
|
|
|
+ for (std::list<std::shared_ptr<Cell>>::reverse_iterator rit = his_cell.rbegin();rit != his_cell.rend();++rit)
|
|
|
+ {
|
|
|
+ ctArray[i] = (*rit)->card_stamp_time;
|
|
|
+ cidArray[i] = (*rit)->id;
|
|
|
+ i--;
|
|
|
+ if (i<0)
|
|
|
+ {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //第五点和前4点拟合的直线方程y = kx + b的k,b
|
|
|
+ Fit f;
|
|
|
+ f.linearFit(ctArray,cidArray,true);
|
|
|
+ if (f.getR()!=1)
|
|
|
+ {
|
|
|
+ double k = f.getSlope();
|
|
|
+ double b = f.getIntercept();
|
|
|
+ //取得垂直线的k
|
|
|
+ double k1 = -1.0/k;
|
|
|
+ double b1 = cidArray[4] - k1*ctArray[4];
|
|
|
+
|
|
|
+ fit_k = k;
|
|
|
+ fit_b = b;
|
|
|
+
|
|
|
+ double x = (b1 - b) /(k + k1);
|
|
|
+ double y = k1*x + b1;
|
|
|
+ //这里的y即为第五点格子id投影到直线上的格子id
|
|
|
+
|
|
|
+ int newCellId = int(y);
|
|
|
+
|
|
|
+ //将新格子id进行更新
|
|
|
+ if (newCellId < mpCellPath->find(curCellReaderName)->second.size())
|
|
|
+ {
|
|
|
+ cell->id = newCellId;
|
|
|
+ }else{
|
|
|
+ int n = cell->id;
|
|
|
+ int b = n;
|
|
|
+ n = b;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
int Card::PersonLocation(int cnt)
|
|
|
|
|
|
{
|
|
@@ -3184,7 +3238,6 @@ int Card::PersonLocation(int cnt)
|
|
|
std::shared_ptr<Cell> cell = nullptr;
|
|
|
std::shared_ptr<Cell> tmp_cell = std::make_shared<Cell>();
|
|
|
is_fit_pos = false;
|
|
|
- TRACE(_T("+ ct : %d \r\n"),time_stamp_cal);
|
|
|
//1.数据有效性判断
|
|
|
ret = CheckDistData(cnt);
|
|
|
if(ret){
|
|
@@ -3207,9 +3260,6 @@ int Card::PersonLocation(int cnt)
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
- TRACE(_T("++ ct : %d \r\n"),time_stamp_cal);
|
|
|
-
|
|
|
- //time_stamp_cal==12298
|
|
|
std::shared_ptr<POS> pos = std::make_shared<POS>();
|
|
|
//3.算法定位
|
|
|
std::vector<std::shared_ptr<POS>> udm_pos;
|
|
@@ -3248,11 +3298,6 @@ int Card::PersonLocation(int cnt)
|
|
|
cell = Position2Cell(tmp_pos);
|
|
|
if (cell && cell->id != 0)
|
|
|
{
|
|
|
- if(cell->id == 184)
|
|
|
- {
|
|
|
- TRACE(_T("cell->id == 184"));
|
|
|
-
|
|
|
- }
|
|
|
originCellId = cell->id;
|
|
|
originCellReaderName = cell->strSubjectReader;
|
|
|
cell->card_stamp_time = time_stamp_cal;
|
|
@@ -3676,6 +3721,112 @@ int Card::PersonLocation(int cnt)
|
|
|
// return ret;
|
|
|
//}
|
|
|
|
|
|
+//
|
|
|
+int Card::DiscreteLocate(int cnt)
|
|
|
+{
|
|
|
+ ULONGLONG nowTickCounts = ::GetTickCount();
|
|
|
+ //如果last_cell存在,那说明不是第一次定位,如果不存在,那么继续往下走。
|
|
|
+ if (last_cell)
|
|
|
+ {
|
|
|
+ SYSTEMTIME curSt;
|
|
|
+ ::GetLocalTime(&curSt);
|
|
|
+
|
|
|
+ int ret = 0;
|
|
|
+ ret = CFunctions::CompareSystemTime(curSt,last_cell->interval_time);
|
|
|
+ if (ret < 0)
|
|
|
+ {
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ int ret = 0;
|
|
|
+ std::shared_ptr<Cell> cell = nullptr;
|
|
|
+ std::shared_ptr<Cell> tmp_cell = std::make_shared<Cell>();
|
|
|
+ is_fit_pos = false;
|
|
|
+
|
|
|
+ //1.数据有效性判断
|
|
|
+ ret = CheckDistData(cnt);
|
|
|
+ if(ret){
|
|
|
+ return 1;
|
|
|
+ }else{
|
|
|
+ //2.组装数据
|
|
|
+ std::shared_ptr<ReceiveDataMap> pRdm = std::make_shared<ReceiveDataMap>();
|
|
|
+ pRdm->clear();
|
|
|
+ ret = AssembleDistData(pRdm);
|
|
|
+ if(ret){
|
|
|
+ return 1;
|
|
|
+ }else{
|
|
|
+ if (pRdm->size()<=0)
|
|
|
+ {
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ std::shared_ptr<POS> pos = std::make_shared<POS>();
|
|
|
+ //3.算法定位
|
|
|
+ std::vector<std::shared_ptr<POS>> udm_pos;
|
|
|
+ udm_pos.resize(0);
|
|
|
+ ret = LocateAlgorithm::CalcTdoaPosition(pRdm,pTdoaReaderPathMap,udm_pos);
|
|
|
+ //4.从多解中筛选出一个解,存在两种可能:
|
|
|
+ //a.可能无解返回非0,
|
|
|
+ //b.可能有解,但解不正确,比如解的位置在4727,-100,但选出的解是4727,-200
|
|
|
+ ret = ChooseOneSolution(pRdm, udm_pos, pos);
|
|
|
+ SaveOriginDataBeforeFilter(pos);
|
|
|
+ bool bRet = false;
|
|
|
+ bRet = LocateAlgorithm::IsOnMap(pos,pTdoaReaderPathMap);
|
|
|
+ if (!bRet)
|
|
|
+ {
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ if (ret)
|
|
|
+ {
|
|
|
+ //根据上一次数据计算格子数,并根据上一次方向进行偏移
|
|
|
+ double y = 0;
|
|
|
+ y = fit_k*this->time_stamp_cal + fit_b;
|
|
|
+
|
|
|
+ int nCellId = int(y);
|
|
|
+ //将新格子的信息除了格子id信息
|
|
|
+ cell = FindCell(curCellReaderName,nCellId);
|
|
|
+ }else{
|
|
|
+ std::shared_ptr<POS> tmp_pos = std::make_shared<POS>();
|
|
|
+ //获取分站信息
|
|
|
+ bool bRet = false;
|
|
|
+ *tmp_pos = *pos;
|
|
|
+
|
|
|
+ if (ret == 0)
|
|
|
+ {
|
|
|
+ cell = Position2Cell(tmp_pos);
|
|
|
+ if (cell)
|
|
|
+ {
|
|
|
+ originCellId = cell->id;
|
|
|
+ originCellReaderName = cell->strSubjectReader;
|
|
|
+
|
|
|
+ if (his_cell.size() > 100)
|
|
|
+ {
|
|
|
+ his_cell.pop_front();
|
|
|
+ }
|
|
|
+ his_cell.push_back(cell);
|
|
|
+
|
|
|
+ if (his_cell.size() > 4)
|
|
|
+ {
|
|
|
+ MappingCell2FitLinear(cell);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ originCellId = 0;
|
|
|
+ originCellReaderName = "";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (cell)
|
|
|
+ {
|
|
|
+ SaveCardAlgoData(cell);
|
|
|
+ }
|
|
|
+
|
|
|
+ return ret;
|
|
|
+}
|
|
|
+
|
|
|
std::shared_ptr<Cell> Card::GetNextCell(std::shared_ptr<Cell> lastCell,int increase,int nIndex,std::shared_ptr<Cell> newCell)
|
|
|
{
|
|
|
if (lastCell->id == 0)
|
|
@@ -3935,6 +4086,27 @@ std::shared_ptr<Cell> Card::GetNextCell(std::shared_ptr<Cell> lastCell,int incre
|
|
|
return cell;
|
|
|
}
|
|
|
|
|
|
+//根据分站名称和格子id查找出格子的其他所有信息
|
|
|
+std::shared_ptr<Cell> Card::FindCell(std::string strReaderName,int cellid)
|
|
|
+{
|
|
|
+ std::shared_ptr<Cell> cell = std::make_shared<Cell>();
|
|
|
+
|
|
|
+ if (strReaderName == "" || cellid == 0)
|
|
|
+ {
|
|
|
+ return nullptr;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (std::list<std::shared_ptr<Cell>>::iterator it = mpCellPath->find(strReaderName)->second.begin();it != mpCellPath->find(strReaderName)->second.end();++it)
|
|
|
+ {
|
|
|
+ if ((*it)->id = cellid)
|
|
|
+ {
|
|
|
+ cell = (*it);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return cell;
|
|
|
+}
|
|
|
+
|
|
|
/*
|
|
|
* 如果怠速返回true,否则返回false
|
|
|
*/
|
|
@@ -4024,10 +4196,6 @@ bool Card::CheckIdleStatus()
|
|
|
{
|
|
|
//相等的话就保持原来的方向
|
|
|
}
|
|
|
- if (card_id == "0020000001002")
|
|
|
- {
|
|
|
- TRACE(_T("nIncrease : %d \r\n"),nIncrease);
|
|
|
- }
|
|
|
|
|
|
i = 0;
|
|
|
for (; i < MAX_FIT_DATA_COUNTS;i++)
|
|
@@ -4061,7 +4229,7 @@ bool Card::CheckIdleStatus()
|
|
|
bool Card::CheckStartRule()
|
|
|
{
|
|
|
//前5次不运动
|
|
|
- if (nStartLocateCounts < 5)//哈哈哈 先注释掉
|
|
|
+ if (nStartLocateCounts < 5)
|
|
|
{
|
|
|
return false;
|
|
|
}
|
|
@@ -5175,7 +5343,6 @@ int Card::SaveOriginDataBeforeFilter(std::shared_ptr<POS> pos)
|
|
|
int Card::ChooseOneSolution(std::shared_ptr<ReceiveDataMap> pRdm, std::vector<std::shared_ptr<POS>> udm_pos, std::shared_ptr<POS>& pos )
|
|
|
{
|
|
|
if(0 == udm_pos.size()){ // 没有解
|
|
|
- TRACE(_T("没有接"));
|
|
|
return SOLUTION_NO_SOLUTION;
|
|
|
}
|
|
|
|
|
@@ -5203,7 +5370,6 @@ int Card::ChooseOneSolution(std::shared_ptr<ReceiveDataMap> pRdm, std::vector<st
|
|
|
dist = sqrt(pow(udm_pos.at(0)->posx - it_first->second->x,2)+pow(udm_pos.at(0)->posy - it_first->second->y,2));
|
|
|
if (dist < NEAR_READER && it_first->second->special == 0)
|
|
|
{
|
|
|
- TRACE(_T("4002"));
|
|
|
return SOLUTION_NEAR_READER;
|
|
|
}
|
|
|
}
|
|
@@ -5212,7 +5378,6 @@ int Card::ChooseOneSolution(std::shared_ptr<ReceiveDataMap> pRdm, std::vector<st
|
|
|
dist = sqrt(pow(udm_pos.at(0)->posx - it_second->second->x,2)+pow(udm_pos.at(0)->posy - it_second->second->y,2));
|
|
|
if (dist < NEAR_READER && it_second->second->special == 0)
|
|
|
{
|
|
|
- TRACE(_T("40002"));
|
|
|
return SOLUTION_NEAR_READER;
|
|
|
}
|
|
|
|
|
@@ -5358,7 +5523,6 @@ int Card::ChooseOneSolution(std::shared_ptr<ReceiveDataMap> pRdm, std::vector<st
|
|
|
// 未计算出结果
|
|
|
if(pos->posx == INVALID_COORDINATE || pos->posy == INVALID_COORDINATE){
|
|
|
LOCATION_SYSTEM_BRANCH(LOCATION_SYSTEM_BRANCH_148);
|
|
|
- TRACE(_T("未计算出结果"));
|
|
|
return SOLUTION_NO_SOLUTION;
|
|
|
}else{
|
|
|
bool bExistSolution = true;
|
|
@@ -5384,7 +5548,6 @@ int Card::ChooseOneSolution(std::shared_ptr<ReceiveDataMap> pRdm, std::vector<st
|
|
|
pos->cx = 0;
|
|
|
pos->cy = 0;
|
|
|
pos->cz = 0;
|
|
|
- TRACE(_T("无解"));
|
|
|
return SOLUTION_NO_SOLUTION;
|
|
|
}
|
|
|
}
|
|
@@ -6061,114 +6224,114 @@ int Card::colourfulCloudsChasingTheMoon(std::shared_ptr<Cell> &cell, std::list<s
|
|
|
/*
|
|
|
*
|
|
|
*/
|
|
|
-int Card::DiscreteLocate(int cnt)
|
|
|
-{
|
|
|
- try{
|
|
|
- ULONGLONG nowTickCounts = ::GetTickCount();
|
|
|
- //如果last_cell存在,那说明不是第一次定位,如果不存在,那么继续往下走。
|
|
|
- if (last_cell)
|
|
|
- {
|
|
|
- SYSTEMTIME curSt;
|
|
|
- ::GetLocalTime(&curSt);
|
|
|
-
|
|
|
- int ret = 0;
|
|
|
- ret = CFunctions::CompareSystemTime(curSt,last_cell->interval_time);
|
|
|
- if (ret < 0)
|
|
|
- {
|
|
|
- return 1;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- int ret = 0;
|
|
|
- std::shared_ptr<Cell> cell = nullptr;
|
|
|
- //std::shared_ptr<Cell> tmp_cell = std::make_shared<Cell>();
|
|
|
- is_fit_pos = false;
|
|
|
-
|
|
|
- //1.数据有效性判断
|
|
|
- ret = CheckDistData(cnt);
|
|
|
- if(ret){
|
|
|
- originCellId = 0;
|
|
|
- originCellReaderName = "";
|
|
|
- return 1;
|
|
|
- }else{
|
|
|
- //2.组装数据
|
|
|
- std::shared_ptr<ReceiveDataMap> pRdm = std::make_shared<ReceiveDataMap>();
|
|
|
- pRdm->clear();
|
|
|
- ret = AssembleDistData(pRdm);
|
|
|
- if(ret){
|
|
|
- return 1;
|
|
|
- }else{
|
|
|
- if (pRdm->size()<=0)
|
|
|
- {
|
|
|
- return 1;
|
|
|
- }
|
|
|
-
|
|
|
- std::shared_ptr<POS> pos = std::make_shared<POS>();
|
|
|
- //3.算法定位
|
|
|
- std::vector<std::shared_ptr<POS>> udm_pos;
|
|
|
- udm_pos.resize(0);
|
|
|
- ret = LocateAlgorithm::CalcTdoaPosition(pRdm,pTdoaReaderPathMap,udm_pos);
|
|
|
- //4.从多解中筛选出一个解,存在两种可能:
|
|
|
- //a.可能无解返回非0,
|
|
|
- //b.可能有解,但解不正确,比如解的位置在4727,-100,但选出的解是4727,-200
|
|
|
- ret = ChooseOneSolution(pRdm, udm_pos, pos);
|
|
|
-
|
|
|
- if (ret)
|
|
|
- {
|
|
|
- return 1;
|
|
|
- }else{
|
|
|
- std::shared_ptr<POS> tmp_pos = std::make_shared<POS>();
|
|
|
- //获取分站信息
|
|
|
- bool bRet = false;
|
|
|
- *tmp_pos = *pos;
|
|
|
-
|
|
|
- if (ret == 0)
|
|
|
- {
|
|
|
- //这里的cell->id是originalId
|
|
|
- cell = Position2Cell(tmp_pos);
|
|
|
- //从测试数据中读cell,送给彩云追月形成输出
|
|
|
- //by lsp on 2017.07.15 @北京林萃公寓
|
|
|
- //his_cell = nullptr;
|
|
|
- //int oiginalId[10] = {1023, 1016, 998, 988, 979, 974, 966, 960, 949, 938}; //原始cellId
|
|
|
- //int ct[10] ={9859, 9860, 9863, 9865, 9866, 9867, 9868, 9869, 9870, 9872}; //对应的ct号码
|
|
|
- //int firstStation[10] = {201, 201, 201, 201, 201, 201, 201, 201, 201, 201};
|
|
|
- //int endStation[10] = {202, 202, 202, 202, 202, 202, 202, 202, 202, 202};
|
|
|
- //std::list<std::shared_ptr<Cell>> myCellList;
|
|
|
- //myCellList.resize(0);
|
|
|
- //for (int i=0; i < 10; i++)
|
|
|
- //{
|
|
|
- // //初始化格子
|
|
|
- // std::shared_ptr<Cell> cell = std::make_shared<Cell>();
|
|
|
- // cell->id = oiginalId[i];
|
|
|
- // cell->card_stamp_time = ct[i];
|
|
|
- // cell->minReaderId = firstStation[i];
|
|
|
- // cell->maxReaderId = endStation[i];
|
|
|
- // cell->strSubjectReader = CFunctions::getCellName(firstStation[i], endStation[i]);
|
|
|
- // //调用彩云追月来处理
|
|
|
- // if(colourfulCloudsChasingTheMoon(cell, myCellList) == 0){
|
|
|
- // //输出结果
|
|
|
- // Log::write_log(FILE_TYPE::SQL_S, "ct: " + CFunctions::int2string(cell->card_stamp_time) + " station: " + cell->strSubjectReader + " original id: " + CFunctions::int2string(cell->id) + " realId: "+ CFunctions::int2string(cell->realId) + " cardid: " + this->card_id, true);
|
|
|
- // }
|
|
|
- //}
|
|
|
- //Log::write_log(FILE_TYPE::JSON_S, this->card_id + ": have postion2cell, go now!!!!!!!!!!!!!!!", true);
|
|
|
- //if (cell && cell->id == 0)
|
|
|
- //{
|
|
|
- // //问题是下面这一步不可能走过来,只有500ms补的地方才会出现originalId为0
|
|
|
- // Log::write_log(FILE_TYPE::JSON_S, this->card_id + ":my cell Id is Zero, so I have to go out!!!!!!!!!!!!!!!", true);
|
|
|
- // return 1; //cellId为0,直接走人
|
|
|
- //}else{
|
|
|
- // if(colourfulCloudsChasingTheMoon(cell) && cell != nullptr){
|
|
|
- // Log::write_log(FILE_TYPE::SQL_S, "original id: " + CFunctions::int2string(cell->id) + " realId: "+ CFunctions::int2string(cell->realId) + " cardid: " + this->card_id, true);
|
|
|
- // SaveCardAlgoData(cell);
|
|
|
- // }
|
|
|
- //}
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- *}
|
|
|
- return ret;*/
|
|
|
- }catch (...)
|
|
|
- {
|
|
|
- return 1;
|
|
|
- }
|
|
|
-}
|
|
|
+//int Card::DiscreteLocate(int cnt)
|
|
|
+//{
|
|
|
+// try{
|
|
|
+// ULONGLONG nowTickCounts = ::GetTickCount();
|
|
|
+// //如果last_cell存在,那说明不是第一次定位,如果不存在,那么继续往下走。
|
|
|
+// if (last_cell)
|
|
|
+// {
|
|
|
+// SYSTEMTIME curSt;
|
|
|
+// ::GetLocalTime(&curSt);
|
|
|
+//
|
|
|
+// int ret = 0;
|
|
|
+// ret = CFunctions::CompareSystemTime(curSt,last_cell->interval_time);
|
|
|
+// if (ret < 0)
|
|
|
+// {
|
|
|
+// return 1;
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// int ret = 0;
|
|
|
+// std::shared_ptr<Cell> cell = nullptr;
|
|
|
+// //std::shared_ptr<Cell> tmp_cell = std::make_shared<Cell>();
|
|
|
+// is_fit_pos = false;
|
|
|
+//
|
|
|
+// //1.数据有效性判断
|
|
|
+// ret = CheckDistData(cnt);
|
|
|
+// if(ret){
|
|
|
+// originCellId = 0;
|
|
|
+// originCellReaderName = "";
|
|
|
+// return 1;
|
|
|
+// }else{
|
|
|
+// //2.组装数据
|
|
|
+// std::shared_ptr<ReceiveDataMap> pRdm = std::make_shared<ReceiveDataMap>();
|
|
|
+// pRdm->clear();
|
|
|
+// ret = AssembleDistData(pRdm);
|
|
|
+// if(ret){
|
|
|
+// return 1;
|
|
|
+// }else{
|
|
|
+// if (pRdm->size()<=0)
|
|
|
+// {
|
|
|
+// return 1;
|
|
|
+// }
|
|
|
+//
|
|
|
+// std::shared_ptr<POS> pos = std::make_shared<POS>();
|
|
|
+// //3.算法定位
|
|
|
+// std::vector<std::shared_ptr<POS>> udm_pos;
|
|
|
+// udm_pos.resize(0);
|
|
|
+// ret = LocateAlgorithm::CalcTdoaPosition(pRdm,pTdoaReaderPathMap,udm_pos);
|
|
|
+// //4.从多解中筛选出一个解,存在两种可能:
|
|
|
+// //a.可能无解返回非0,
|
|
|
+// //b.可能有解,但解不正确,比如解的位置在4727,-100,但选出的解是4727,-200
|
|
|
+// ret = ChooseOneSolution(pRdm, udm_pos, pos);
|
|
|
+//
|
|
|
+// if (ret)
|
|
|
+// {
|
|
|
+// return 1;
|
|
|
+// }else{
|
|
|
+// std::shared_ptr<POS> tmp_pos = std::make_shared<POS>();
|
|
|
+// //获取分站信息
|
|
|
+// bool bRet = false;
|
|
|
+// *tmp_pos = *pos;
|
|
|
+//
|
|
|
+// if (ret == 0)
|
|
|
+// {
|
|
|
+// //这里的cell->id是originalId
|
|
|
+// cell = Position2Cell(tmp_pos);
|
|
|
+// //从测试数据中读cell,送给彩云追月形成输出
|
|
|
+// //by lsp on 2017.07.15 @北京林萃公寓
|
|
|
+// //his_cell = nullptr;
|
|
|
+// //int oiginalId[10] = {1023, 1016, 998, 988, 979, 974, 966, 960, 949, 938}; //原始cellId
|
|
|
+// //int ct[10] ={9859, 9860, 9863, 9865, 9866, 9867, 9868, 9869, 9870, 9872}; //对应的ct号码
|
|
|
+// //int firstStation[10] = {201, 201, 201, 201, 201, 201, 201, 201, 201, 201};
|
|
|
+// //int endStation[10] = {202, 202, 202, 202, 202, 202, 202, 202, 202, 202};
|
|
|
+// //std::list<std::shared_ptr<Cell>> myCellList;
|
|
|
+// //myCellList.resize(0);
|
|
|
+// //for (int i=0; i < 10; i++)
|
|
|
+// //{
|
|
|
+// // //初始化格子
|
|
|
+// // std::shared_ptr<Cell> cell = std::make_shared<Cell>();
|
|
|
+// // cell->id = oiginalId[i];
|
|
|
+// // cell->card_stamp_time = ct[i];
|
|
|
+// // cell->minReaderId = firstStation[i];
|
|
|
+// // cell->maxReaderId = endStation[i];
|
|
|
+// // cell->strSubjectReader = CFunctions::getCellName(firstStation[i], endStation[i]);
|
|
|
+// // //调用彩云追月来处理
|
|
|
+// // if(colourfulCloudsChasingTheMoon(cell, myCellList) == 0){
|
|
|
+// // //输出结果
|
|
|
+// // Log::write_log(FILE_TYPE::SQL_S, "ct: " + CFunctions::int2string(cell->card_stamp_time) + " station: " + cell->strSubjectReader + " original id: " + CFunctions::int2string(cell->id) + " realId: "+ CFunctions::int2string(cell->realId) + " cardid: " + this->card_id, true);
|
|
|
+// // }
|
|
|
+// //}
|
|
|
+// //Log::write_log(FILE_TYPE::JSON_S, this->card_id + ": have postion2cell, go now!!!!!!!!!!!!!!!", true);
|
|
|
+// //if (cell && cell->id == 0)
|
|
|
+// //{
|
|
|
+// // //问题是下面这一步不可能走过来,只有500ms补的地方才会出现originalId为0
|
|
|
+// // Log::write_log(FILE_TYPE::JSON_S, this->card_id + ":my cell Id is Zero, so I have to go out!!!!!!!!!!!!!!!", true);
|
|
|
+// // return 1; //cellId为0,直接走人
|
|
|
+// //}else{
|
|
|
+// // if(colourfulCloudsChasingTheMoon(cell) && cell != nullptr){
|
|
|
+// // Log::write_log(FILE_TYPE::SQL_S, "original id: " + CFunctions::int2string(cell->id) + " realId: "+ CFunctions::int2string(cell->realId) + " cardid: " + this->card_id, true);
|
|
|
+// // SaveCardAlgoData(cell);
|
|
|
+// // }
|
|
|
+// //}
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// return ret;
|
|
|
+// }catch (...)
|
|
|
+// {
|
|
|
+// return 1;
|
|
|
+// }
|
|
|
+//}
|