Browse Source

添加IsDigitString和IsDebugPass函数。

JeffWang 3 years ago
parent
commit
5b05c2956e

+ 62 - 1
Source/OGCAssistTool/OGCAssistTool/Global.cpp

@@ -68,7 +68,7 @@ namespace GLOBAL
 			memcpy(g_config.szOGCToolPath, g_config.szOGCToolProgram, sizeof(TCHAR)*(pBuff - g_config.szOGCToolProgram));
 		}
 		// BATCH;
-		g_config.nDeltaEType = GetPrivateProfileInt(_T("BATCH"), _T("EType"), 0, g_szConfigFile);
+		g_config.nDeltaEType = GetPrivateProfileInt(_T("BATCH"), _T("EType"), -1, g_szConfigFile);
 		GetPrivateProfileString(_T("BATCH"), _T("EValue"), _T(""), g_config.szDeltaEValue, MAX_PATH, g_szConfigFile);
 		g_config.dDeltaEValue = _tstof(g_config.szDeltaEValue);
 		GetPrivateProfileString(_T("BATCH"), _T("batchNumber"), _T(""), g_config.szBatchNumber, MAX_PATH, g_szConfigFile);
@@ -207,6 +207,27 @@ again:
 		return 0;
 	}
 
+	BOOL IsDebugPass(std::vector<RGB_PAT> &vtDebugRGB, INT nDeltaEType, DOUBLE dDeltaEValue)
+	{
+		BOOL bRet = FALSE;
+		DOUBLE dAllDeltaEValue = 0.0;
+		INT nDeltaETypeIndex = 3 + nDeltaEType;
+		for (std::vector<RGB_PAT>::iterator it = vtDebugRGB.begin(); it != vtDebugRGB.end(); it++)
+		{
+			if ( nDeltaEType == DeltaE76 )
+				dAllDeltaEValue += atof(it->deltaE76.c_str());
+			if ( nDeltaEType == DeltaE94 )
+				dAllDeltaEValue += atof(it->deltaE94.c_str());
+			if ( nDeltaEType == DeltaE00 )
+				dAllDeltaEValue += atof(it->deltaE00.c_str());
+		}
+
+		if ( dDeltaEValue <= dAllDeltaEValue/vtDebugRGB.size() )
+			bRet = TRUE;
+
+		return bRet;
+	}
+
 	DWORD FindProcess(LPCTSTR lpProName)
 	{
 		ASSERT(lpProName!=NULL);
@@ -1179,4 +1200,44 @@ end:
 
 		return bRet;
 	}
+
+	/************************************************************************/
+	/*  函数:IsDigitString[3/28/2016 IT];
+	/*  描述:;
+	/*  参数:;
+	/*  	[IN] :;
+	/*  返回:返回2表示浮点型, 返回1表示整型, 返回-1表示不是数字;
+	/*  注意:;
+	/*  示例:;
+	/*
+	/*  修改:;
+	/*  日期:;
+	/*  内容:;
+	/************************************************************************/
+	int IsDigitString(IN CONST CString& str)
+	{
+		int npt = 0;
+		for (int i = 0; i < str.GetLength(); i++)
+		{
+			if (!_istdigit(str.GetAt(i)))
+			{
+				if ( str.GetAt(i) == _T('.') && i != 0)
+				{
+					if ( npt > 1)
+					{
+						return -1;
+					}
+
+					npt++;
+				}
+				else
+				{
+					return -1;
+				}
+			}
+		}
+
+		return npt ? 2 : 1;
+	}
+
 };

+ 2 - 0
Source/OGCAssistTool/OGCAssistTool/Global.h

@@ -177,6 +177,7 @@ namespace GLOBAL {
 	std::string GetFileData(LPCTSTR lpFile);
 	std::string GetFileLine(std::string &strFileData, int nLine);
 	INT CheckOutData(std::vector<std::string> &vtData, std::vector<RGB_PAT> &vtResult);
+	BOOL IsDebugPass(std::vector<RGB_PAT> &vtDebugRGB, INT nDeltaEType, DOUBLE dDeltaEValue);
 	BOOL FindString(std::vector<std::string> &vtString, std::string strFind, std::string &strResult);
 	void GetStringList(std::string strData, std::string strSplit, std::vector<std::string> &vtString);
 	BOOL GetFileVersion( IN HMODULE hModule, IN DWORD (&dwArray)[4]);
@@ -201,6 +202,7 @@ namespace GLOBAL {
 	HWND GetProcessMainWnd(LPCTSTR lpProcessName, LPCTSTR lpTagetWndName);
 	BOOL EnumProcessAllWnd(LPPROC_WND_INFO lpProcWndInfo);
 	BOOL StartProcess(LPCTSTR lpPath, BOOL bShowWnd = FALSE, BOOL bSuspend = FALSE);
+	int IsDigitString(IN CONST CString& str);
 };
 
 #endif