researchman 7 роки тому
батько
коміт
729bff1dc2
8 змінених файлів з 319 додано та 590 видалено
  1. 0 1
      QueueStrManager.cpp
  2. 1 3
      YAServer.vcxproj
  3. 7 410
      YAServer.vcxproj.filters
  4. 5 35
      YAServerDlg.cpp
  5. 1 0
      algorithm/Fit.h
  6. 297 134
      classdef.cpp
  7. 8 1
      classdef.h
  8. 0 6
      locate_algorithm.cpp

+ 0 - 1
QueueStrManager.cpp

@@ -62,7 +62,6 @@ void QueueStrManager::AddString(const char * chr)
 		}
 		m_couter++;
 		m_length += strlen(chr);
-		//TRACE(_T("sql counts: %d \r\n"),m_couter);
 	}
 	LeaveCriticalSection(&m_csQueueList);
 }

+ 1 - 3
YAServer.vcxproj

@@ -259,9 +259,7 @@ xcopy "$(SolutionDir)..\config.ini" "D:\0a-share\$(Configuration)\" /Y /C /D /S<
       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
     </ClCompile>
     <ClCompile Include="algorithm\FittingPosition.cpp" />
-    <ClCompile Include="classdef.cpp">
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
-    </ClCompile>
+    <ClCompile Include="classdef.cpp" />
     <ClCompile Include="YAServerDlg.cpp" />
     <ClInclude Include="locate_algorithm.h">
       <FileType>CppCode</FileType>

+ 7 - 410
YAServer.vcxproj.filters

@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <ItemGroup>
-<<<<<<< HEAD
     <ClCompile Include="..\common\Functions\deca_range_optimize.cpp" />
     <ClCompile Include="..\common\Functions\Functions.cpp" />
     <ClCompile Include="..\common\kalman\locate.cpp" />
@@ -21,7 +20,7 @@
     <ClCompile Include="..\thirdparty\include\socket.io-client-cpp\src\sio_client.cpp" />
     <ClCompile Include="..\thirdparty\include\socket.io-client-cpp\src\sio_socket.cpp" />
     <ClCompile Include="algorithm\FittingPosition.cpp" />
-    <ClCompile Include="classdef.cpp" />
+    <ClCompile Include="YAServerDlg.cpp" />
     <ClCompile Include="CSVparser\CSVparser.cpp" />
     <ClCompile Include="DbSettingDlg.cpp" />
     <ClCompile Include="debug_server\debug_server_socket.cpp" />
@@ -29,10 +28,10 @@
     <ClCompile Include="KNN\KNN.cpp" />
     <ClCompile Include="locate_algorithm.cpp" />
     <ClCompile Include="LogSetting.cpp" />
-    <ClCompile Include="log\log_module.cpp" />
-    <ClCompile Include="log\MyLog.cpp" />
     <ClCompile Include="log_process_module.cpp" />
     <ClCompile Include="minidump.cpp" />
+    <ClCompile Include="mylog\log_module.cpp" />
+    <ClCompile Include="mylog\MyLog.cpp" />
     <ClCompile Include="MysqlConnPool.cpp" />
     <ClCompile Include="ProcessRemodule.cpp" />
     <ClCompile Include="QueueStrManager.cpp" />
@@ -42,7 +41,7 @@
     <ClCompile Include="SysSetting.cpp" />
     <ClCompile Include="system_basic_info\SystemAnalysis.cpp" />
     <ClCompile Include="YAServer.cpp" />
-    <ClCompile Include="YAServerDlg.cpp" />
+    <ClCompile Include="classdef.cpp" />
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\common\def_msg.h" />
@@ -89,12 +88,12 @@
     <ClInclude Include="KNN\KNN.h" />
     <ClInclude Include="LocateRecord.h" />
     <ClInclude Include="LogSetting.h" />
-    <ClInclude Include="log\ExRollingFileAppender.h" />
-    <ClInclude Include="log\log_module.h" />
-    <ClInclude Include="log\MyLog.h" />
     <ClInclude Include="log_def.h" />
     <ClInclude Include="log_process_module.h" />
     <ClInclude Include="minidupm.h" />
+    <ClInclude Include="mylog\ExRollingFileAppender.h" />
+    <ClInclude Include="mylog\log_module.h" />
+    <ClInclude Include="mylog\MyLog.h" />
     <ClInclude Include="MysqlConnPool.h" />
     <ClInclude Include="ProcessRemodule.h" />
     <ClInclude Include="QueueStrManager.h" />
@@ -117,408 +116,6 @@
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="YAServer.rc" />
-=======
-    <ClCompile Include="..\common\kalman\locate.cpp">
-      <Filter>algorithm</Filter>
-    </ClCompile>
-    <ClCompile Include="locate_algorithm.cpp">
-      <Filter>algorithm</Filter>
-    </ClCompile>
-    <ClCompile Include="..\common\kalman\Smoother.cpp">
-      <Filter>algorithm</Filter>
-    </ClCompile>
-    <ClCompile Include="..\common\Functions\deca_range_optimize.cpp">
-      <Filter>function</Filter>
-    </ClCompile>
-    <ClCompile Include="..\common\Functions\Functions.cpp">
-      <Filter>function</Filter>
-    </ClCompile>
-    <ClCompile Include="..\thirdparty\include\iocp\Global\helper.cpp">
-      <Filter>hp-socket\global</Filter>
-    </ClCompile>
-    <ClCompile Include="MysqlConnPool.cpp">
-      <Filter>mysql</Filter>
-    </ClCompile>
-    <ClCompile Include="..\common\ReportCtrl\ReportCtrl.cpp">
-      <Filter>rpt</Filter>
-    </ClCompile>
-    <ClCompile Include="..\common\strconv\strconv.cpp">
-      <Filter>strconv</Filter>
-    </ClCompile>
-    <ClCompile Include="SyncTime\SyncHelper.cpp">
-      <Filter>synctime</Filter>
-    </ClCompile>
-    <ClCompile Include="SyncTime\SyncManager.cpp">
-      <Filter>synctime</Filter>
-    </ClCompile>
-    <ClCompile Include="..\thirdparty\include\socket.io-client-cpp\src\sio_client.cpp">
-      <Filter>websocket</Filter>
-    </ClCompile>
-    <ClCompile Include="..\thirdparty\include\socket.io-client-cpp\src\internal\sio_client_impl.cpp">
-      <Filter>websocket</Filter>
-    </ClCompile>
-    <ClCompile Include="..\thirdparty\include\socket.io-client-cpp\src\internal\sio_packet.cpp">
-      <Filter>websocket</Filter>
-    </ClCompile>
-    <ClCompile Include="..\thirdparty\include\socket.io-client-cpp\src\sio_socket.cpp">
-      <Filter>websocket</Filter>
-    </ClCompile>
-    <ClCompile Include="Filter\KalmanFilter.cpp">
-      <Filter>Filter</Filter>
-    </ClCompile>
-    <ClCompile Include="classdef.cpp">
-      <Filter>源文件</Filter>
-    </ClCompile>
-    <ClCompile Include="DbSettingDlg.cpp">
-      <Filter>源文件</Filter>
-    </ClCompile>
-    <ClCompile Include="LogSetting.cpp">
-      <Filter>源文件</Filter>
-    </ClCompile>
-    <ClCompile Include="stdafx.cpp">
-      <Filter>源文件</Filter>
-    </ClCompile>
-    <ClCompile Include="SysSetting.cpp">
-      <Filter>源文件</Filter>
-    </ClCompile>
-    <ClCompile Include="YAServer.cpp">
-      <Filter>源文件</Filter>
-    </ClCompile>
-    <ClCompile Include="YAServerDlg.cpp">
-      <Filter>源文件</Filter>
-    </ClCompile>
-    <ClCompile Include="..\common\matrix\_Matrix.cpp">
-      <Filter>algorithm</Filter>
-    </ClCompile>
-    <ClCompile Include="minidump.cpp">
-      <Filter>源文件</Filter>
-    </ClCompile>
-    <ClCompile Include="QueueStrManager.cpp">
-      <Filter>源文件</Filter>
-    </ClCompile>
-    <ClCompile Include="..\thirdparty\include\iocp\common\Src\bufferpool.cpp">
-      <Filter>hp-socket\common</Filter>
-    </ClCompile>
-    <ClCompile Include="..\thirdparty\include\iocp\common\Src\RWLock.cpp">
-      <Filter>hp-socket\common</Filter>
-    </ClCompile>
-    <ClCompile Include="..\thirdparty\include\iocp\common\Src\SysHelper.cpp">
-      <Filter>hp-socket\common</Filter>
-    </ClCompile>
-    <ClCompile Include="..\thirdparty\include\iocp\common\Src\WaitFor.cpp">
-      <Filter>hp-socket\common</Filter>
-    </ClCompile>
-    <ClCompile Include="..\thirdparty\include\iocp\Src\SocketHelper.cpp">
-      <Filter>hp-socket\socket</Filter>
-    </ClCompile>
-    <ClCompile Include="..\thirdparty\include\iocp\Src\TcpServer.cpp">
-      <Filter>hp-socket\socket</Filter>
-    </ClCompile>
-    <ClCompile Include="log_process_module.cpp">
-      <Filter>process</Filter>
-    </ClCompile>
-    <ClCompile Include="ProcessRemodule.cpp">
-      <Filter>process</Filter>
-    </ClCompile>
-    <ClCompile Include="debug_server\debug_server_socket.cpp">
-      <Filter>debug_server</Filter>
-    </ClCompile>
-    <ClCompile Include="system_basic_info\SystemAnalysis.cpp">
-      <Filter>system_basic_info</Filter>
-    </ClCompile>
-    <ClCompile Include="CSVparser\CSVparser.cpp">
-      <Filter>CSVparser</Filter>
-    </ClCompile>
-    <ClCompile Include="KNN\KNN.cpp">
-      <Filter>KNN</Filter>
-    </ClCompile>
-    <ClCompile Include="algorithm\FittingPosition.cpp">
-      <Filter>algorithm</Filter>
-    </ClCompile>
-    <ClCompile Include="mylog\log_module.cpp">
-      <Filter>mylog</Filter>
-    </ClCompile>
-    <ClCompile Include="mylog\MyLog.cpp">
-      <Filter>mylog</Filter>
-    </ClCompile>
-  </ItemGroup>
-  <ItemGroup>
-    <ClInclude Include="..\common\matrix\BaseMatrix.h">
-      <Filter>algorithm</Filter>
-    </ClInclude>
-    <ClInclude Include="..\common\kalman\locate.h">
-      <Filter>algorithm</Filter>
-    </ClInclude>
-    <ClInclude Include="locate_algorithm.h">
-      <Filter>algorithm</Filter>
-    </ClInclude>
-    <ClInclude Include="..\common\Functions\deca_range_optimize.h">
-      <Filter>function</Filter>
-    </ClInclude>
-    <ClInclude Include="..\common\Functions\Functions.h">
-      <Filter>function</Filter>
-    </ClInclude>
-    <ClInclude Include="..\thirdparty\include\iocp\Global\helper.h">
-      <Filter>hp-socket\global</Filter>
-    </ClInclude>
-    <ClInclude Include="MysqlConnPool.h">
-      <Filter>mysql</Filter>
-    </ClInclude>
-    <ClInclude Include="..\common\ReportCtrl\ReportCtrl.h">
-      <Filter>rpt</Filter>
-    </ClInclude>
-    <ClInclude Include="..\common\strconv\strconv.h">
-      <Filter>strconv</Filter>
-    </ClInclude>
-    <ClInclude Include="SyncTime\Common.h">
-      <Filter>synctime</Filter>
-    </ClInclude>
-    <ClInclude Include="SyncTime\Position.h">
-      <Filter>synctime</Filter>
-    </ClInclude>
-    <ClInclude Include="SyncTime\SyncHelper.h">
-      <Filter>synctime</Filter>
-    </ClInclude>
-    <ClInclude Include="SyncTime\SyncManager.h">
-      <Filter>synctime</Filter>
-    </ClInclude>
-    <ClInclude Include="SyncTime\SyncTime.h">
-      <Filter>synctime</Filter>
-    </ClInclude>
-    <ClInclude Include="SyncTime\SyncTimeMsg.h">
-      <Filter>synctime</Filter>
-    </ClInclude>
-    <ClInclude Include="SyncTime\TagMsg.h">
-      <Filter>synctime</Filter>
-    </ClInclude>
-    <ClInclude Include="..\thirdparty\include\socket.io-client-cpp\src\sio_client.h">
-      <Filter>websocket</Filter>
-    </ClInclude>
-    <ClInclude Include="..\thirdparty\include\socket.io-client-cpp\src\internal\sio_client_impl.h">
-      <Filter>websocket</Filter>
-    </ClInclude>
-    <ClInclude Include="..\thirdparty\include\socket.io-client-cpp\src\internal\sio_packet.h">
-      <Filter>websocket</Filter>
-    </ClInclude>
-    <ClInclude Include="..\thirdparty\include\socket.io-client-cpp\src\sio_socket.h">
-      <Filter>websocket</Filter>
-    </ClInclude>
-    <ClInclude Include="Filter\KalmanFilter.h">
-      <Filter>Filter</Filter>
-    </ClInclude>
-    <ClInclude Include="classdef.h">
-      <Filter>头文件</Filter>
-    </ClInclude>
-    <ClInclude Include="constdef.h">
-      <Filter>头文件</Filter>
-    </ClInclude>
-    <ClInclude Include="DbSettingDlg.h">
-      <Filter>头文件</Filter>
-    </ClInclude>
-    <ClInclude Include="def.h">
-      <Filter>头文件</Filter>
-    </ClInclude>
-    <ClInclude Include="..\common\json\json.h">
-      <Filter>头文件</Filter>
-    </ClInclude>
-    <ClInclude Include="log_def.h">
-      <Filter>头文件</Filter>
-    </ClInclude>
-    <ClInclude Include="LogSetting.h">
-      <Filter>头文件</Filter>
-    </ClInclude>
-    <ClInclude Include="Resource.h">
-      <Filter>头文件</Filter>
-    </ClInclude>
-    <ClInclude Include="stdafx.h">
-      <Filter>头文件</Filter>
-    </ClInclude>
-    <ClInclude Include="..\common\structdef.h">
-      <Filter>头文件</Filter>
-    </ClInclude>
-    <ClInclude Include="SysSetting.h">
-      <Filter>头文件</Filter>
-    </ClInclude>
-    <ClInclude Include="targetver.h">
-      <Filter>头文件</Filter>
-    </ClInclude>
-    <ClInclude Include="YAServer.h">
-      <Filter>头文件</Filter>
-    </ClInclude>
-    <ClInclude Include="YAServerDlg.h">
-      <Filter>头文件</Filter>
-    </ClInclude>
-    <ClInclude Include="..\common\def_msg.h">
-      <Filter>头文件</Filter>
-    </ClInclude>
-    <ClInclude Include="..\thirdparty\include\iocp\common\Src\GeneralHelper.h">
-      <Filter>hp-socket\common</Filter>
-    </ClInclude>
-    <ClInclude Include="..\thirdparty\include\iocp\Src\SocketInterface.h">
-      <Filter>hp-socket\socket</Filter>
-    </ClInclude>
-    <ClInclude Include="..\common\matrix\_Matrix.h">
-      <Filter>algorithm</Filter>
-    </ClInclude>
-    <ClInclude Include="minidupm.h">
-      <Filter>头文件</Filter>
-    </ClInclude>
-    <ClInclude Include="QueueStrManager.h">
-      <Filter>头文件</Filter>
-    </ClInclude>
-    <ClInclude Include="..\thirdparty\include\iocp\common\Src\bufferpool.h">
-      <Filter>hp-socket\common</Filter>
-    </ClInclude>
-    <ClInclude Include="..\thirdparty\include\iocp\common\Src\bufferptr.h">
-      <Filter>hp-socket\common</Filter>
-    </ClInclude>
-    <ClInclude Include="..\thirdparty\include\iocp\common\Src\CriticalSection.h">
-      <Filter>hp-socket\common</Filter>
-    </ClInclude>
-    <ClInclude Include="..\thirdparty\include\iocp\common\Src\Event.h">
-      <Filter>hp-socket\common</Filter>
-    </ClInclude>
-    <ClInclude Include="..\thirdparty\include\iocp\common\Src\PrivateHeap.h">
-      <Filter>hp-socket\common</Filter>
-    </ClInclude>
-    <ClInclude Include="..\thirdparty\include\iocp\common\Src\RWLock.h">
-      <Filter>hp-socket\common</Filter>
-    </ClInclude>
-    <ClInclude Include="..\thirdparty\include\iocp\common\Src\Semaphore.h">
-      <Filter>hp-socket\common</Filter>
-    </ClInclude>
-    <ClInclude Include="..\thirdparty\include\iocp\common\Src\Singleton.h">
-      <Filter>hp-socket\common</Filter>
-    </ClInclude>
-    <ClInclude Include="..\thirdparty\include\iocp\common\Src\STLHelper.h">
-      <Filter>hp-socket\common</Filter>
-    </ClInclude>
-    <ClInclude Include="..\thirdparty\include\iocp\common\Src\SysHelper.h">
-      <Filter>hp-socket\common</Filter>
-    </ClInclude>
-    <ClInclude Include="..\thirdparty\include\iocp\common\Src\WaitFor.h">
-      <Filter>hp-socket\common</Filter>
-    </ClInclude>
-    <ClInclude Include="..\thirdparty\include\iocp\common\Src\Win32Helper.h">
-      <Filter>hp-socket\common</Filter>
-    </ClInclude>
-    <ClInclude Include="..\thirdparty\include\iocp\Src\SocketHelper.h">
-      <Filter>hp-socket\socket</Filter>
-    </ClInclude>
-    <ClInclude Include="..\thirdparty\include\iocp\Src\TcpServer.h">
-      <Filter>hp-socket\socket</Filter>
-    </ClInclude>
-    <ClInclude Include="log_process_module.h">
-      <Filter>process</Filter>
-    </ClInclude>
-    <ClInclude Include="ProcessRemodule.h">
-      <Filter>process</Filter>
-    </ClInclude>
-    <ClInclude Include="debug_server\debug_server_socket.h">
-      <Filter>debug_server</Filter>
-    </ClInclude>
-    <ClInclude Include="system_basic_info\SystemAnalysis.h">
-      <Filter>system_basic_info</Filter>
-    </ClInclude>
-    <ClInclude Include="uwb_msg_def.h" />
-    <ClInclude Include="CSVparser\CSVparser.h">
-      <Filter>CSVparser</Filter>
-    </ClInclude>
-    <ClInclude Include="KNN\KNN.h">
-      <Filter>KNN</Filter>
-    </ClInclude>
-    <ClInclude Include="algorithm\FittingPosition.h">
-      <Filter>algorithm</Filter>
-    </ClInclude>
-    <ClInclude Include="algorithm\Fit.h">
-      <Filter>algorithm</Filter>
-    </ClInclude>
-    <ClInclude Include="LocateRecord.h" />
-    <ClInclude Include="mylog\ExRollingFileAppender.h">
-      <Filter>mylog</Filter>
-    </ClInclude>
-    <ClInclude Include="mylog\log_module.h">
-      <Filter>mylog</Filter>
-    </ClInclude>
-    <ClInclude Include="mylog\MyLog.h">
-      <Filter>mylog</Filter>
-    </ClInclude>
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="..\config.ini" />
-    <None Include="ReadMe.txt" />
-    <None Include="res\YAServer.ico">
-      <Filter>资源文件</Filter>
-    </None>
-    <None Include="res\YAServer.rc2">
-      <Filter>资源文件</Filter>
-    </None>
-  </ItemGroup>
-  <ItemGroup>
-    <Filter Include="algorithm">
-      <UniqueIdentifier>{a44759fe-7511-418f-a575-db3828a210c7}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="function">
-      <UniqueIdentifier>{836c6f6f-2230-4c5b-af40-c3dd999d86f7}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="hp-socket">
-      <UniqueIdentifier>{8ab5363f-8bca-43e4-9249-8c69162a7d3b}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="hp-socket\common">
-      <UniqueIdentifier>{7bf297e4-356e-455d-846a-3db7634a2d2f}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="hp-socket\global">
-      <UniqueIdentifier>{eeb37d8c-e8f9-4d71-94cb-6a322fe8a3b2}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="hp-socket\socket">
-      <UniqueIdentifier>{04e897f5-3578-4355-a805-777469371406}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="mysql">
-      <UniqueIdentifier>{95f6bdc6-2f1d-49e1-8167-f1ed8ae02ef1}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="rpt">
-      <UniqueIdentifier>{1621bd29-ff6b-4de2-8182-41386d4f0fba}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="strconv">
-      <UniqueIdentifier>{2afdd09a-a46a-4a6a-9195-b05db9122476}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="synctime">
-      <UniqueIdentifier>{df994534-12eb-40c2-931a-beafcb88c681}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="websocket">
-      <UniqueIdentifier>{dd102663-071c-4ad5-afc8-00e367b65f35}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="Filter">
-      <UniqueIdentifier>{51c50699-3893-4a31-8ec1-322089334141}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="头文件">
-      <UniqueIdentifier>{7a58a06b-e4b8-4483-baa3-b239f1f6ab8d}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="源文件">
-      <UniqueIdentifier>{56bd09d4-595e-4f32-8e5d-7c1a610c11d8}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="资源文件">
-      <UniqueIdentifier>{68e7b8b0-a5b1-4903-b17c-c72725ba9ffa}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="process">
-      <UniqueIdentifier>{7878fc4f-5622-49b0-b20f-43c04a71651a}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="debug_server">
-      <UniqueIdentifier>{3af2e7b9-7799-4c69-bf36-9d1375145e86}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="system_basic_info">
-      <UniqueIdentifier>{dbd9d95d-a924-4777-9b9b-47465f33f304}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="CSVparser">
-      <UniqueIdentifier>{e8c504b0-6168-46d1-960e-7ff86dd6ae31}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="KNN">
-      <UniqueIdentifier>{d62bd4f8-de16-4c89-84c1-91f8b5423d78}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="mylog">
-      <UniqueIdentifier>{b7ddd49d-f63e-4131-91d5-4079ee424ef7}</UniqueIdentifier>
-    </Filter>
->>>>>>> newprotocal
   </ItemGroup>
   <ItemGroup>
     <None Include="..\config.ini" />

+ 5 - 35
YAServerDlg.cpp

@@ -413,11 +413,6 @@ UINT thread_cell(LPVOID lparam)//
 	{
 		//处理格子信息
 		int nRet = dlg->ModifyCardInfo();
-		//nRet表示有多少张卡参与了补格子
-		if (nRet)
-		{
-			//SetEvent(dlg->hEvent);
-		}
 	}
 	return 0;
 }
@@ -6391,16 +6386,16 @@ std::string CYAServerDlg::get_json_card_statistic()
 	Json::Value data;
 	Json::Value v;
 	Json::Value s;
-	Log::write_log(FILE_TYPE::JSON_S, "get_json_card_statistic I am coming!", true);
+	//Log::write_log(FILE_TYPE::JSON_S, "get_json_card_statistic I am coming!", true);
 	//构造veicle的json,如果返回值为1,那么意味着发生了异常,直接返回空串给上一级,表示未成功
 	if(get_json_statistic_vehicle_data(v) == 1){
-		Log::write_log(FILE_TYPE::JSON_S, "get_json_statistic_vehicle_data(v) failed!!!!!!!", true);
+		//Log::write_log(FILE_TYPE::JSON_S, "get_json_statistic_vehicle_data(v) failed!!!!!!!", true);
 		return "";
 	}
 
 	////构造person的json,如果返回值为1,那么意味着发生了异常,直接返回空串给上一级,表示未成功
 	if(get_json_statistic_staff_data(s) == 1){
-		Log::write_log(FILE_TYPE::JSON_S, "get_json_statistic_staff_data(s) failed!!!!!!!", true);
+		//Log::write_log(FILE_TYPE::JSON_S, "get_json_statistic_staff_data(s) failed!!!!!!!", true);
 		return "";
 	}
 
@@ -6418,7 +6413,7 @@ std::string CYAServerDlg::get_json_card_statistic()
 		root[JSON_ROOT_KEY_VERSION] = INTERFACE_VERSION_1_4;
 		ret = root.toFastString();
 	}
-	Log::write_log(FILE_TYPE::JSON_S, "get_json_card_statistic I am going out, the json is:" + ret, true);
+	//Log::write_log(FILE_TYPE::JSON_S, "get_json_card_statistic I am going out, the json is:" + ret, true);
 	return ret; //返回包含json信息的字符串
 }
 
@@ -7339,9 +7334,6 @@ void CYAServerDlg::OnClosed( client::close_reason const& reason )
 	}
 	is_websocket_login = false;
 	is_websocket_ok = false;
-#ifdef DEBUG
-	TRACE(_T("The Connection is closed!\r\n"));
-#endif // DEBUG	
 }
 
 void CYAServerDlg::OnFailed()
@@ -7349,9 +7341,6 @@ void CYAServerDlg::OnFailed()
 	is_websocket_login = false;
 	is_websocket_ok = false;
 	_io->close();
-#ifdef DEBUG
-	TRACE(_T("The Connection is dropped because of failed!\r\n"));
-#endif // DEBUG	
 }
 
 void CYAServerDlg::ws_open()
@@ -8259,7 +8248,6 @@ int CYAServerDlg::deal_traffic_lights(std::shared_ptr<Card> card)
 					{
 						it_ll->second->m_nColor = COLOR_GREEN;
 						if(LIGHT_CTRL_STATE::CTRL_STATE_AUTO == it_ll->second->m_nIsCtrl){
-							//TRACE(_T("all show green ,light_id = %d \r\n"),it_ll->second->m_nID);
 							send_call_light(CC_SET_LIGHTS_STATE,it_ll->second->m_nID, it_ll->second->m_nIsCtrl, it_ll->second->m_nColor,GREEN_UP);
 							Sleep(LIGHT_CTRL_DELAY);
 						}
@@ -8425,11 +8413,9 @@ int CYAServerDlg::deal_traffic_lights(std::shared_ptr<Card> card)
 					switch (it_glight->second->m_nColor)
 					{
 					case COLOR_GREEN:
-						//TRACE(_T("group : show green ;light_id = %d\r\n"),it_glight->second->m_nID);
 						send_call_light(CC_SET_LIGHTS_STATE,it_glight->second->m_nID, it_glight->second->m_nIsCtrl, it_glight->second->m_nColor,GREEN_UP);
 						break;
 					case COLOR_RED:
-						//TRACE(_T("group : show red ;light_id = %d\r\n"),it_glight->second->m_nID);
 						send_call_light(CC_SET_LIGHTS_STATE,it_glight->second->m_nID, it_glight->second->m_nIsCtrl, it_glight->second->m_nColor,RED_CROSS);
 						break;
 					}
@@ -12986,6 +12972,7 @@ int CYAServerDlg::ModifyCardInfo()
 		}
 
 		std::shared_ptr<Cell> cell = it->second->GetNextCell(it->second->last_cell,it->second->nIncrease,nStep,nullptr);//20170705生成一个新的格子	
+		//根据上一次数据计算格子数,并根据上一次方向进行偏移
 		if (cell == nullptr)
 		{
 			continue;
@@ -13052,14 +13039,6 @@ int CYAServerDlg::ModifyCardInfo()
 
 		std::string strTime = "";
 		strTime = chIntervalTime;
-		#ifdef DEBUG
-		//TRACE(_T("modifycardinfo: interval_time = %s\r\n"),CFunctions::c2wc(strTime.c_str()));
-		#else
-		//char log[200] = {0};
-		//sprintf_s(log,"modifycardinfo: interval_time = %s",strTime.c_str());
-		//std::string strLog = log;
-		//Log::write_log(FILE_TYPE::SYS_S,strLog,true);
-		#endif // DEBUG
 		sprintf_s(sql,
 		LENGTH_SQL,
 		"insert ignore into his_cell_location(card_id,cur_time,interval_time,origin_reader_name,origin_cell_id,real_reader_name,real_cell_id,card_stamp_time,isFit,speed,mileage,map_id,area_id) values('%s','%s','%s','%s',%d,'%s',%d,%d,%d,%.4f,%.4f,%d,%d);",
@@ -13254,12 +13233,6 @@ void CYAServerDlg::deal_card_msg( std::shared_ptr<Card> card/*Card* card*/, bool
 			// 将距离加入到距离列表
 			std::shared_ptr<_coordinate> dist = std::make_shared<_coordinate>();
 			dist->t = card->time_stamp;//哈哈哈哈哈  卡的ct
-			if(dist->t == 2091)
-			{
-
-				TRACE(_T("DDDDDDDDDDDDDDDDDDDDDD"));
-
-			}
 			dist->x = card->p_reader->ant[card->antenna_id]->antenna_x;
 			dist->y = card->p_reader->ant[card->antenna_id]->antenna_y;
 			dist->z = card->p_reader->ant[card->antenna_id]->antenna_z;
@@ -13303,9 +13276,6 @@ void CYAServerDlg::deal_card_msg( std::shared_ptr<Card> card/*Card* card*/, bool
 			{
 				LOCATION_SYSTEM_BRANCH(LOCATION_SYSTEM_BRANCH_219);
 			}
-			if(card->card_type == CT_PERSON){
-				TRACE(_T("person \r\n"));
-			}
 			if(card->p_reader->sync_level == 0){
 				LOCATION_SYSTEM_BRANCH(LOCATION_SYSTEM_BRANCH_119);
 				bUseAlgo = true;

+ 1 - 0
algorithm/Fit.h

@@ -112,6 +112,7 @@ public:
 		return ans;  
 	}  
 
+	//»ñȡбÂÊ
 	double getSlope(){return factor[1];}  
 	///   
 	/// \brief »ñÈ¡½Ø¾à  

+ 297 - 134
classdef.cpp

@@ -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;
+//	}	
+//}

+ 8 - 1
classdef.h

@@ -1328,6 +1328,9 @@ public:
 	int isInsertToDb;		//插入数据库
 	int nOverThreCounts;	//连续大跳次数
 
+	double fit_k;	//最新的格子拟合的斜率
+	double fit_b;	//最新的格子拟合的截距
+
 	bool isIdling;		//怠速状态
 
 	std::thread* pThread;
@@ -1335,6 +1338,7 @@ public:
 	std::shared_ptr<Cell> last_cell;
 	std::list<std::shared_ptr<Cell>> his_cell;
 	std::list<std::shared_ptr<Cell>> locate_cells;
+	
 
 	int DiscreteLocate(int cnt);
 	int PersonLocation(int cnt);
@@ -1347,12 +1351,15 @@ public:
 	std::shared_ptr<POS> Cell2Position(std::shared_ptr<Cell>& cell);	//格子信息转化坐标输出
 	std::shared_ptr<Cell> GetNextCell(std::shared_ptr<Cell> lastCell,int increase,int nIndex);
 	std::shared_ptr<Cell> GetNextCell(std::shared_ptr<Cell> lastCell,int increase,int nIndex,std::shared_ptr<Cell> newCell);
-	
+	std::shared_ptr<Cell> FindCell(std::string strReaderName,int cellid);
+
 	int SetCellPathMap(std::shared_ptr<CellPathMap> pCellPath);
 	int ChangeSystemTime(SYSTEMTIME& st,const int condition);
 	int ChangeSystemTime(SYSTEMTIME& st);	//在st基础上加500ms
 	int colourfulCloudsChasingTheMoon(std::shared_ptr<Cell> &cell, std::list<std::shared_ptr<Cell>> &myCellList);
+	int MappingCell2FitLinear(std::shared_ptr<Cell>& cell);		//将格子拟合到线上
 	bool cftool(float *data_x, float *data_y, int data_n, std::vector<float> &vResult);
+	
 	//刘思平修订的代码Part 3/Sum 3:begin
 	//以下函数的声明:将当前时刻的毫秒四舍五入为0ms或者500ms
 	//by lsp on 2017.07.09 @山西长治

+ 0 - 6
locate_algorithm.cpp

@@ -676,10 +676,8 @@ std::shared_ptr<POS> LocateAlgorithm::TdoaLocate2d(std::shared_ptr<ReceiveDataMa
 	{
 		pos[0].x = ((-1)*B + sqrt(delta))/(2*A);
 		pos[0].y = a[0]*pos[0].x + a[1];
-		//TRACE(_T("x1: %.2f , y1: %.2f \r\n"),pos[0].x,pos[0].y);
 		pos[1].x = ((-1)*B - sqrt(delta))/(2*A);
 		pos[1].y = a[0]*pos[1].x + a[1];
-		//TRACE(_T("x2: %.2f , y2: %.2f \r\n"),pos[1].x,pos[1].y);
 		count  = 2;
 	}else{
 		return nullptr;
@@ -691,7 +689,6 @@ std::shared_ptr<POS> LocateAlgorithm::TdoaLocate2d(std::shared_ptr<ReceiveDataMa
 	{
 		if (IsInTriangle(vtp,pos[i]))
 		{
-			//TRACE(_T("point is in triangle. the index is : %d \r\n"),i);
 			bool condition[2] = {false,false};
 			double d1 = 0,d2 = 0;
 
@@ -716,19 +713,16 @@ std::shared_ptr<POS> LocateAlgorithm::TdoaLocate2d(std::shared_ptr<ReceiveDataMa
 
 			//idx = i;	
 		}else{
-			//TRACE(_T("point is not in triangle. the index is : %d \r\n"),i);
 		}
 	}
 
 	if (points == 2)
 	{
 		idx = -1;
-		//TRACE(_T("There hava 2 point.\r\n"));
 	}
 
 	if (idx != -1)
 	{
-		//TRACE(_T("the idx is : %d \r\n"),idx);
 		p->posx = pos[idx].x;
 		p->posy = pos[idx].y;
 	}else{