2068 lines
51 KiB
C++
2068 lines
51 KiB
C++
// SaveInRes.cpp: implementation of the CSaveInRes class.
|
|
//
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
#include "stdafx.h"
|
|
#include "SaveInRes.h"
|
|
#include "Constant.h"
|
|
#include "CtrlProtocolDef.h"
|
|
#ifdef _DEBUG
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[]=__FILE__;
|
|
#define new DEBUG_NEW
|
|
#endif
|
|
|
|
#define AR_CROSS_HOLE_EAMOUNT 48
|
|
#define AR_CROSS_HOLE_SURFACE_ELECTRODE_NUM 7
|
|
//////////////////////////////////////////////////////////////////////
|
|
// Construction/Destruction
|
|
//////////////////////////////////////////////////////////////////////
|
|
extern HHOOK hHook;
|
|
extern LRESULT __stdcall CBTHookProc(long nCode, WPARAM wParam, LPARAM lParam);
|
|
extern int g_iUILanguage;
|
|
CSaveInRes::CSaveInRes()
|
|
{
|
|
m_resFile = NULL;
|
|
m_nFirstPole = 0;
|
|
m_nLandSign = 0;
|
|
m_MediumType = 0;
|
|
/* m_rect = NULL;*/
|
|
m_szDistancePole = _T("");
|
|
m_szPoleStart = _T("1");
|
|
m_methodType = 0;
|
|
m_fCrossHoleParam = 0;
|
|
m_fPoleDistance = 0;
|
|
m_i3DRollDiecetion = 0;
|
|
m_fMinAMDistance = 0;
|
|
m_fAPosX = 0;
|
|
m_fAPosY = 0;
|
|
m_iEAmount = 0;
|
|
m_fInitiDepth = 0;
|
|
m_byLineDirection = 0;
|
|
}
|
|
|
|
CSaveInRes::~CSaveInRes()
|
|
{
|
|
|
|
|
|
}
|
|
|
|
BOOL CSaveInRes::CreateResFile(CString szFilePath)
|
|
{
|
|
m_resFile = fopen(szFilePath, "w");
|
|
|
|
if (m_resFile == NULL)
|
|
{
|
|
// hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL);
|
|
// AfxMessageBox("打开文件失败");
|
|
return FALSE;
|
|
}
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
BOOL CSaveInRes::AddDateToFile(CStringArray *szDateArray)
|
|
{
|
|
CString szDate;
|
|
szDate.Empty();
|
|
|
|
CStringArray szDealDateArray;
|
|
szDealDateArray.RemoveAll();
|
|
|
|
switch(m_MediumType)
|
|
{
|
|
case 1://温纳
|
|
Wenner(szDateArray,&szDealDateArray);
|
|
break;
|
|
case 2://偶极
|
|
dipole(szDateArray,&szDealDateArray);
|
|
break;
|
|
case 3:
|
|
Wenner_Y_2D(szDateArray,&szDealDateArray);
|
|
break;
|
|
case 4:
|
|
Pole_dipole_2d(szDateArray,&szDealDateArray);
|
|
break;
|
|
case 5:
|
|
Reverse_Pole_dipole_2d(szDateArray,&szDealDateArray);
|
|
break;
|
|
case 6:
|
|
A_M_ARRAY_2D(szDateArray,&szDealDateArray);
|
|
break;
|
|
case 7:
|
|
AMN_ARRAY_2D(szDateArray,&szDealDateArray);
|
|
break;
|
|
case 9:
|
|
Dipole_Dipole_2D(szDateArray,&szDealDateArray);
|
|
break;
|
|
case 11://斯伦贝谢
|
|
Schlumberger(szDateArray,&szDealDateArray);
|
|
break;
|
|
case 16://跨孔
|
|
Cross_Hole_2D(szDateArray,&szDealDateArray);
|
|
break;
|
|
case 17:
|
|
CE_Schlumberger(szDateArray,&szDealDateArray);
|
|
break;
|
|
case 22:
|
|
Pole_Pole_3D(szDateArray,&szDealDateArray);
|
|
break;
|
|
case 23:
|
|
Pole_Dipole_3D(szDateArray,&szDealDateArray);
|
|
break;
|
|
case 24:
|
|
Dipole_Dipole_3D(szDateArray,&szDealDateArray);
|
|
break;
|
|
case 25:
|
|
Schlumberger3D(szDateArray,&szDealDateArray);
|
|
break;
|
|
case 26:
|
|
WennerAlfa3D(szDateArray,&szDealDateArray);
|
|
break;
|
|
case 27:
|
|
WennerBeta3D(szDateArray,&szDealDateArray);
|
|
break;
|
|
case 28:
|
|
Gradient_3D(szDateArray,&szDealDateArray);
|
|
break;
|
|
case 29:
|
|
Mid_Gardient_Scan_3D(szDateArray,&szDealDateArray);
|
|
break;
|
|
case 34:
|
|
CE_Res_Marine(szDateArray, &szDealDateArray);
|
|
break;
|
|
case 50://to be do, louis
|
|
case 39://温-斯装置
|
|
Wenner_Schlumberger_2D(szDateArray,&szDealDateArray);
|
|
break;
|
|
//由于边缘梯度的排列和用户自定义一样,在这里就直接沿用了用户自定义的排列
|
|
case 40:
|
|
case 41:
|
|
case 43:
|
|
case 44:
|
|
case 47:
|
|
Custom_2D(szDateArray,&szDealDateArray);
|
|
break;
|
|
case 45:
|
|
case 46:
|
|
CrossHole_2D(szDateArray, &szDealDateArray);
|
|
break;
|
|
default:
|
|
return FALSE;
|
|
}
|
|
|
|
szDate.Empty();
|
|
|
|
for (int nIndex = 0; nIndex < szDealDateArray.GetSize(); nIndex++)
|
|
{
|
|
szDate += szDealDateArray.GetAt(nIndex);
|
|
if(nIndex != szDealDateArray.GetSize() - 1)
|
|
szDate += " ";
|
|
}
|
|
|
|
szDate += "\n";
|
|
fwrite(szDate.GetBuffer(szDate.GetLength()), 1, szDate.GetLength(), m_resFile);
|
|
szDate.Empty();
|
|
fflush(m_resFile);
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
CString CSaveInRes::TransformMediumType(CString szMediumType)
|
|
{
|
|
CString szResult;
|
|
int nType;
|
|
|
|
szResult.Empty();
|
|
szResult = szMediumType;
|
|
|
|
nType = atoi(szResult);
|
|
szResult.Empty();
|
|
|
|
switch (nType)//nType是我们的装置类型
|
|
{
|
|
case 1:
|
|
szResult = "1";
|
|
break;
|
|
|
|
case 2:
|
|
szResult = "4";
|
|
break;
|
|
|
|
case 3:
|
|
szResult = "5";
|
|
break;
|
|
|
|
case 4:
|
|
szResult = "6";
|
|
break;
|
|
|
|
case 5:
|
|
szResult = "6";
|
|
break;
|
|
case 6:
|
|
szResult = "2";
|
|
break;
|
|
case 7:
|
|
szResult = "6";
|
|
break;
|
|
case 8:
|
|
szResult = szMediumType;
|
|
break;
|
|
case 9:
|
|
szResult = "3";
|
|
break;
|
|
case 10:
|
|
szResult = szMediumType;
|
|
break;
|
|
case 11:
|
|
szResult = "7";
|
|
break;
|
|
case 12:
|
|
szResult = szMediumType;
|
|
break;
|
|
case 13:
|
|
szResult = szMediumType;
|
|
break;
|
|
|
|
case 14:
|
|
szResult = szMediumType;
|
|
break;
|
|
|
|
case 15:
|
|
szResult = szMediumType;
|
|
break;
|
|
|
|
case 16:
|
|
case 45://AR_CROSS_HOLE_GEOMATIVE
|
|
case 46://AR_CROSS_HOLE_GEOMATIVE_AM
|
|
szResult = "12";
|
|
break;
|
|
case 18:
|
|
break;
|
|
case 22:
|
|
szResult = "2";
|
|
break;
|
|
case 23:
|
|
szResult = "6";
|
|
break;
|
|
case 24:
|
|
szResult = "3";
|
|
break;
|
|
case 25:
|
|
szResult = "7";
|
|
break;
|
|
case 26:
|
|
szResult = "1";
|
|
break;
|
|
case 27:
|
|
szResult = "4";
|
|
break;
|
|
case 28:
|
|
szResult = "11";
|
|
break;
|
|
case 29:
|
|
szResult = "11";
|
|
break;
|
|
case 50://to be do, louis
|
|
case 39:
|
|
szResult = "7";
|
|
break;
|
|
case 40:
|
|
case 41:
|
|
case 43:
|
|
case 44:
|
|
case 47:
|
|
case 48://AR_LAND_FILL_ONE
|
|
case 49://AR_LAND_FILL_TWO
|
|
szResult = "11";
|
|
break;
|
|
default:
|
|
return "NULL";
|
|
}
|
|
|
|
return szResult;
|
|
}
|
|
|
|
|
|
BOOL CSaveInRes::CloseFile()
|
|
{
|
|
switch (m_MediumType)
|
|
{
|
|
case 2:
|
|
case 11:
|
|
WriteZero(6);
|
|
break;
|
|
case 25:
|
|
case 26:
|
|
case 27:
|
|
WriteZero(5);
|
|
break;
|
|
default:
|
|
WriteZero(4);
|
|
}
|
|
|
|
if (m_resFile)
|
|
{
|
|
fclose(m_resFile);
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
void CSaveInRes::WriteZero(int nCount)
|
|
{
|
|
for(int nIndex = 0; nIndex < nCount; nIndex++)
|
|
{
|
|
fwrite("0\r\n",1,3,m_resFile);
|
|
fflush(m_resFile);
|
|
}
|
|
}
|
|
|
|
void CSaveInRes::Wenner(CStringArray *szSRCArray, CStringArray *szTARArray)
|
|
{
|
|
//szSRCArray这五个值得顺序分别是 0:A的位置 1:B的位置 2:M的位置 3:N的位置 4:R0
|
|
//Wenner的计算值有三列,计算公式分别:
|
|
//第一列:A * 间距
|
|
//第二列:(M-A) * 间距
|
|
//第三列:R0
|
|
|
|
szTARArray->RemoveAll();
|
|
|
|
//第一列:
|
|
DOUBLE firstRow;
|
|
CString szFirstRow;
|
|
firstRow = (0.5*(atof(szSRCArray->GetAt(2)) + atof(szSRCArray->GetAt(3)))-1) * atof(m_szDistancePole.GetBuffer(0));
|
|
szFirstRow.Format("%.3f",fabs(firstRow));
|
|
szTARArray->Add(szFirstRow);
|
|
|
|
//第二列:
|
|
DOUBLE secondRow;
|
|
CString szSecondRow;
|
|
secondRow = (atof(szSRCArray->GetAt(2)) - atof(szSRCArray->GetAt(0)) ) * atof(m_szDistancePole.GetBuffer(0));
|
|
szSecondRow.Format("%.3f",fabs(secondRow));
|
|
szTARArray->Add(szSecondRow);
|
|
|
|
|
|
//第三列
|
|
DOUBLE thirdRow;
|
|
CString szThirdRow = _T("");
|
|
thirdRow = atof(szSRCArray->GetAt(4));
|
|
szThirdRow.Format("%.3f",thirdRow);
|
|
szTARArray->Add(szThirdRow);
|
|
|
|
}
|
|
|
|
void CSaveInRes::Schlumberger(CStringArray *szSRCArray, CStringArray *szTARArray)
|
|
{
|
|
//szSRCArray这五个值得顺序分别是 0:A的位置 1:B的位置 2:M的位置 3:N的位置 4:R0
|
|
//Schlumberger的计算值有四列,计算公式分别:
|
|
//第一列:MN的中点 * m_szDistancePole
|
|
//第二列:(p2 - p1) * m_szDistancePole
|
|
//第三列:(p1 - c1) / (p2 - p1)
|
|
//第四列:R0
|
|
|
|
szTARArray->RemoveAll();
|
|
|
|
//第一列:
|
|
DOUBLE firstRow;
|
|
DOUBLE fDistancePole;
|
|
CString szFirstRow;
|
|
|
|
fDistancePole = atof(m_szDistancePole.GetBuffer(0));
|
|
firstRow = (0.5*(atof(szSRCArray->GetAt(2))+atof(szSRCArray->GetAt(3)))-1) * fDistancePole;
|
|
szFirstRow.Format("%.3f",fabs(firstRow));
|
|
szTARArray->Add(szFirstRow);
|
|
|
|
//第二列:
|
|
CString szSencondRow;
|
|
DOUBLE fdistance, fSencondRow;
|
|
fdistance = atof(m_szDistancePole);//m_szDistancePole成员变量,保存了电极间距
|
|
fSencondRow = ( atof(szSRCArray->GetAt(3)) - atof(szSRCArray->GetAt(2)) ) * fdistance;
|
|
szSencondRow.Format("%.3f",fabs(fSencondRow));
|
|
szTARArray->Add(szSencondRow);
|
|
|
|
//第三列
|
|
DOUBLE thirdRow;
|
|
CString szThirdRow;
|
|
//thirdRow = atof(szSRCArray->GetAt(2)) - atof(szSRCArray->GetAt(0));
|
|
thirdRow = ( atof(szSRCArray->GetAt(2)) - atof(szSRCArray->GetAt(0)) ) / ( atof(szSRCArray->GetAt(3)) - atof(szSRCArray->GetAt(2)) );
|
|
szThirdRow.Format("%.5f",fabs(thirdRow));
|
|
szTARArray->Add(szThirdRow);
|
|
|
|
//第四列
|
|
DOUBLE FourthRow;
|
|
CString szFourthRow;
|
|
FourthRow = atof(szSRCArray->GetAt(4));
|
|
szFourthRow.Format("%.3f",FourthRow);
|
|
szTARArray->Add(szFourthRow);
|
|
}
|
|
//温钠Beta
|
|
void CSaveInRes::dipole(CStringArray *szSRCArray, CStringArray *szTARArray)
|
|
{
|
|
//szSRCArray这五个值得顺序分别是 0:A的位置 1:B的位置 2:M的位置 3:N的位置 4:R0
|
|
//Schlumberger的计算值有四列,计算公式分别:
|
|
//第一列:C2 * m_szDistancePole,在这里要减掉第一个电极的基准位置(我们从1开始,反演软件从0开始)
|
|
//第二列:(C1 - C2) * m_szDistancePole
|
|
//第三列:R0
|
|
|
|
szTARArray->RemoveAll();
|
|
|
|
//第一列:
|
|
DOUBLE firstRow;
|
|
CString szFirstRow;
|
|
|
|
firstRow = (0.5*(atof(szSRCArray->GetAt(2)) + atof(szSRCArray->GetAt(0)))-1) * atof(m_szDistancePole.GetBuffer(0));
|
|
szFirstRow.Format("%.3f",fabs(firstRow));
|
|
szTARArray->Add(szFirstRow);
|
|
|
|
//第二列:
|
|
CString szSencondRow;
|
|
DOUBLE fSencondRow;
|
|
DOUBLE fdistance;
|
|
fdistance = atof(m_szDistancePole);//m_szDistancePole成员变量,保存了电极间距
|
|
fSencondRow = ( atof(szSRCArray->GetAt(0)) - atof(szSRCArray->GetAt(1)) ) * fdistance;
|
|
szSencondRow.Format("%.3f",fabs(fSencondRow));
|
|
szTARArray->Add(szSencondRow);
|
|
|
|
//第三列
|
|
DOUBLE thirdRow;
|
|
CString szThirdRow;
|
|
thirdRow = atof(szSRCArray->GetAt(4));
|
|
szThirdRow.Format("%.3f",thirdRow);
|
|
szTARArray->Add(szThirdRow);
|
|
|
|
}
|
|
|
|
BOOL CSaveInRes::WriteLandInform(CStringArray *f_szArray)
|
|
{
|
|
CString szNum;
|
|
|
|
szNum.Format("%d\n", m_nLandSign);
|
|
fwrite(szNum.GetBuffer(0), szNum.GetLength(), 1, m_resFile);
|
|
|
|
//写入地型数据标志 和 地型数据点的个数
|
|
szNum.Format("%d\n", f_szArray->GetSize());
|
|
fwrite(szNum.GetBuffer(0), szNum.GetLength(), 1, m_resFile);
|
|
|
|
for (int i = 0; i < f_szArray->GetSize(); i++)
|
|
{
|
|
szNum = f_szArray->GetAt(i);
|
|
szNum += "\n";
|
|
fwrite(szNum.GetBuffer(0), szNum.GetLength(), 1, m_resFile);
|
|
}
|
|
|
|
szNum.Format("%d\n", m_nFirstPole);
|
|
|
|
fwrite(szNum.GetBuffer(0), szNum.GetLength(), 1, m_resFile);
|
|
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
void CSaveInRes::WennerAlfa3D(CStringArray *szSRCArray, CStringArray *szTARArray)
|
|
{
|
|
/*
|
|
按顺序传入A、B、M、N、R0 5个值
|
|
*/
|
|
int A = 0, B = 1, M = 2, N = 3, R = 4;
|
|
// int nSort[4] = {A, M, N, B};
|
|
int nSort[4] = {A, B, M, N};
|
|
int nId = 0;
|
|
|
|
_pos *Pos = NULL;
|
|
|
|
CString szTmp = _T("");
|
|
int nTmp = 0;
|
|
|
|
Pos = new _pos();
|
|
|
|
_rect tmpRect;
|
|
//如果是按照Y轴合并,由于m_rect已经是旋转过后的矩阵,那么在计算时,还要将其旋转回去进行计算
|
|
//因为pole_to_pos函数是按照电极的长度对于X轴来进行解析的
|
|
if (2 == m_i3DRollDiecetion)
|
|
{
|
|
tmpRect.x0 = m_rect.y0;
|
|
tmpRect.x1 = m_rect.y1;
|
|
tmpRect.y0 = m_rect.x0;
|
|
tmpRect.y1 = m_rect.x1;
|
|
}
|
|
else
|
|
{
|
|
tmpRect.x0 = m_rect.x0;
|
|
tmpRect.x1 = m_rect.x1;
|
|
tmpRect.y0 = m_rect.y0;
|
|
tmpRect.y1 = m_rect.y1;
|
|
}
|
|
|
|
int iTmp;
|
|
for(int i = 0; i < 4; i++)
|
|
{
|
|
nId = nSort[i];
|
|
szTmp = szSRCArray->GetAt(nId);
|
|
nTmp = atoi(szTmp.GetBuffer(0));
|
|
|
|
pole_to_pos_3d(&tmpRect, atoi(m_szPoleStart.GetBuffer(0)), m_nPoleStepX, m_nPoleStepY,Pos, nTmp,m_byLineDirection);
|
|
|
|
//如果是按照Y轴方向合并,则需要进行逻辑坐标轴的转换
|
|
//此时转换之需要颠倒X轴和Y轴的位置就好
|
|
if (2 == m_i3DRollDiecetion)
|
|
{
|
|
iTmp = Pos->x;
|
|
Pos->x = Pos->y;
|
|
Pos->y = iTmp;
|
|
}
|
|
|
|
szTmp.Empty();
|
|
szTmp.Format("%.2f",(float)(Pos->x * atof(m_szX_DistancePole.GetBuffer(0))));
|
|
szTARArray->Add(szTmp);
|
|
|
|
szTmp.Empty();
|
|
szTmp.Format("%.2f",(float)(Pos->y * atof(m_szY_DistancePole.GetBuffer(0))));
|
|
szTARArray->Add(szTmp);
|
|
}
|
|
|
|
szTmp.Empty();
|
|
szTmp = szSRCArray->GetAt(4);
|
|
szTARArray->Add(szTmp);
|
|
|
|
delete Pos;
|
|
Pos = NULL;
|
|
|
|
}
|
|
|
|
void CSaveInRes::WennerBeta3D(CStringArray *szSRCArray, CStringArray *szTARArray)
|
|
{
|
|
/*
|
|
按顺序传入A、B、M、N、R0 5个值
|
|
*/
|
|
|
|
int A = 0, B = 1, M = 2, N = 3, R = 4;
|
|
int nSort[4] = {A, B, M, N};
|
|
int nId = 0;
|
|
_pos *Pos = NULL;
|
|
|
|
CString szTmp = _T("");
|
|
int nTmp = 0;
|
|
int nPoleStart = 0;
|
|
|
|
int nDistancePole = 0;
|
|
|
|
nPoleStart = atoi(m_szPoleStart.GetBuffer(m_szPoleStart.GetLength()));
|
|
|
|
Pos = new _pos();
|
|
|
|
_rect tmpRect;
|
|
//如果是按照Y轴合并,由于m_rect已经是旋转过后的矩阵,那么在计算时,还要将其旋转回去进行计算
|
|
//因为pole_to_pos函数是按照电极的长度对于X轴来进行解析的
|
|
if (2 == m_i3DRollDiecetion)
|
|
{
|
|
tmpRect.x0 = m_rect.y0;
|
|
tmpRect.x1 = m_rect.y1;
|
|
tmpRect.y0 = m_rect.x0;
|
|
tmpRect.y1 = m_rect.x1;
|
|
}
|
|
else
|
|
{
|
|
tmpRect.x0 = m_rect.x0;
|
|
tmpRect.x1 = m_rect.x1;
|
|
tmpRect.y0 = m_rect.y0;
|
|
tmpRect.y1 = m_rect.y1;
|
|
}
|
|
|
|
int iTmp;
|
|
for(int i = 0; i < 4; i++)
|
|
{
|
|
nId = nSort[i];
|
|
|
|
szTmp = szSRCArray->GetAt(nId);
|
|
nTmp = atoi(szTmp.GetBuffer(0));
|
|
|
|
pole_to_pos_3d(&tmpRect, nPoleStart, m_nPoleStepX, m_nPoleStepY, Pos, nTmp,m_byLineDirection);
|
|
|
|
//如果是按照Y轴方向合并,则需要进行逻辑坐标轴的转换
|
|
//此时转换之需要颠倒X轴和Y轴的位置就好
|
|
if (2 == m_i3DRollDiecetion)
|
|
{
|
|
iTmp = Pos->x;
|
|
Pos->x = Pos->y;
|
|
Pos->y = iTmp;
|
|
}
|
|
|
|
szTmp.Empty();
|
|
szTmp.Format("%.3f",(float)(Pos->x * atof(m_szX_DistancePole.GetBuffer(0))));
|
|
szTARArray->Add(szTmp);
|
|
|
|
szTmp.Empty();
|
|
szTmp.Format("%.3f",(float)(Pos->y * atof(m_szY_DistancePole.GetBuffer(0))));
|
|
szTARArray->Add(szTmp);
|
|
}
|
|
|
|
int q = szSRCArray->GetSize();
|
|
|
|
szTmp.Empty();
|
|
szTmp = szSRCArray->GetAt(4);
|
|
szTARArray->Add(szTmp);
|
|
|
|
delete Pos;
|
|
Pos = NULL;
|
|
}
|
|
|
|
void CSaveInRes::Schlumberger3D(CStringArray *szSRCArray, CStringArray *szTARArray)
|
|
{
|
|
/*
|
|
按顺序传入A、B、M、N、R0 5个值
|
|
*/
|
|
int A = 0, B = 1, M = 2, N = 3, R = 4;
|
|
// int nSort[4] = {A, M, N, B};
|
|
int nSort[4] = {A, B, M, N};
|
|
int nId = 0;
|
|
|
|
_pos *Pos = NULL;
|
|
|
|
CString szTmp = _T("");
|
|
int nTmp = 0;
|
|
Pos = new _pos();
|
|
|
|
_rect tmpRect;
|
|
//如果是按照Y轴合并,由于m_rect已经是旋转过后的矩阵,那么在计算时,还要将其旋转回去进行计算
|
|
//因为pole_to_pos函数是按照电极的长度对于X轴来进行解析的
|
|
if (2 == m_i3DRollDiecetion)
|
|
{
|
|
tmpRect.x0 = m_rect.y0;
|
|
tmpRect.x1 = m_rect.y1;
|
|
tmpRect.y0 = m_rect.x0;
|
|
tmpRect.y1 = m_rect.x1;
|
|
}
|
|
else
|
|
{
|
|
tmpRect.x0 = m_rect.x0;
|
|
tmpRect.x1 = m_rect.x1;
|
|
tmpRect.y0 = m_rect.y0;
|
|
tmpRect.y1 = m_rect.y1;
|
|
}
|
|
|
|
int iTmp;
|
|
for(int i = 0; i < 4; i++)
|
|
{
|
|
nId = nSort[i];
|
|
szTmp = szSRCArray->GetAt(nId);
|
|
nTmp = atoi(szTmp.GetBuffer(0));
|
|
pole_to_pos_3d(&tmpRect, atoi(m_szPoleStart.GetBuffer(0)), m_nPoleStepX, m_nPoleStepY, Pos, nTmp, m_byLineDirection);
|
|
|
|
//如果是按照Y轴方向合并,则需要进行逻辑坐标轴的转换
|
|
//此时转换之需要颠倒X轴和Y轴的位置就好
|
|
if (2 == m_i3DRollDiecetion)
|
|
{
|
|
iTmp = Pos->x;
|
|
Pos->x = Pos->y;
|
|
Pos->y = iTmp;
|
|
}
|
|
|
|
szTmp.Empty();
|
|
szTmp.Format("%.3f",(float)(Pos->x * atof(m_szX_DistancePole.GetBuffer(0))));
|
|
szTARArray->Add(szTmp);
|
|
|
|
szTmp.Empty();
|
|
szTmp.Format("%.3f",(float)(Pos->y * atof(m_szY_DistancePole.GetBuffer(0))));
|
|
szTARArray->Add(szTmp);
|
|
}
|
|
|
|
szTmp.Empty();
|
|
szTmp = szSRCArray->GetAt(4);
|
|
szTARArray->Add(szTmp);
|
|
|
|
delete Pos;
|
|
Pos = NULL;
|
|
}
|
|
|
|
void CSaveInRes::AddFileHeader(int method, int mediumType, CStringArray *szDataArray)
|
|
{
|
|
m_MediumType = mediumType; //保存在装置类型
|
|
m_methodType = method; //保存测试方法(电阻率Res,激电IP...)
|
|
|
|
/*if (mediumType >= 17 && mediumType <= 21) //1D脚本装置类型
|
|
{
|
|
InitCEFileHeader(szDataArray);
|
|
}
|
|
|
|
if ((mediumType >= 1 && mediumType <= 16) || (mediumType >= 39 && mediumType != 46)) //2D脚本装置类型
|
|
{
|
|
Init2DFileHeader(szDataArray);
|
|
}
|
|
|
|
if ((mediumType > 21 && mediumType < 39) || mediumType == 46) //3D脚本装置类型
|
|
{
|
|
Init3DFileHeader(szDataArray);
|
|
}*/
|
|
}
|
|
|
|
void CSaveInRes::Init3DFileHeader(CStringArray *szArray)
|
|
{
|
|
//3D的文件头
|
|
CString szTmp = _T("");
|
|
int x0, y0, x1,y1;
|
|
|
|
for (int i = 0; i < szArray->GetSize(); i++)
|
|
{
|
|
switch (i)
|
|
{
|
|
case 1:
|
|
szTmp = szArray->GetAt(i);
|
|
x0 = atoi(szTmp.GetBuffer(0));
|
|
m_rect.x0 = x0;
|
|
continue;
|
|
case 2:
|
|
szTmp = szArray->GetAt(i);
|
|
y0 = atoi(szTmp.GetBuffer(0));
|
|
m_rect.y0 = y0;
|
|
continue;
|
|
case 3:
|
|
szTmp = szArray->GetAt(i);
|
|
x1 = atoi(szTmp.GetBuffer(0));
|
|
m_rect.x1 = x1;
|
|
//如果是中梯,则X轴网格大小取的是AB距离/X轴电极间距
|
|
if (29 == atoi(szArray->GetAt(7)))
|
|
{
|
|
float fXPoleDis = atof(szArray->GetAt(5));
|
|
int iXGridSize = (0 == fXPoleDis) ? (int)m_fABDistance : (int)(m_fABDistance/fXPoleDis);
|
|
szTmp.Format(_T("%d"), iXGridSize+1);
|
|
}
|
|
else
|
|
szTmp.Format("%d", x1 - x0 + 1);
|
|
//szTmp.Format("%d", abs(x1 - x0) + 2);
|
|
break;
|
|
case 4:
|
|
szTmp = szArray->GetAt(i);
|
|
y1 = atoi(szTmp.GetBuffer(0));
|
|
m_rect.y1 = y1;
|
|
szTmp.Format("%d", y1 - y0 + 1);
|
|
// szTmp.Format("%d", abs(y1 - y0) + 2);
|
|
break;
|
|
case 5:
|
|
m_szX_DistancePole = szArray->GetAt(i);
|
|
szTmp = m_szX_DistancePole;
|
|
break;
|
|
case 6:
|
|
m_szY_DistancePole = szArray->GetAt(i);
|
|
szTmp = m_szY_DistancePole;
|
|
break;
|
|
case 7:
|
|
szTmp = szArray->GetAt(i);
|
|
szTmp = TransformMediumType(szTmp);
|
|
|
|
if (szTmp == "11")//混合装置
|
|
{
|
|
// szTmp += "\r\n0\r\n0\r\n0";
|
|
szTmp += _T("\r\n0\r\nType of data(0=apparent resistivity,1=resistance)\r\n0");
|
|
}
|
|
break;
|
|
default://0和8
|
|
szTmp = szArray->GetAt(i);
|
|
break;
|
|
}
|
|
|
|
szTmp += "\r\n";
|
|
fwrite(szTmp.GetBuffer(szTmp.GetLength()), 1, szTmp.GetLength(), m_resFile);
|
|
fflush(m_resFile);
|
|
szTmp.Empty();
|
|
}
|
|
}
|
|
|
|
void CSaveInRes::Init2DFileHeader(CStringArray *szArray)
|
|
{
|
|
//第一行:文件名
|
|
//第二行:电极间距
|
|
//第三行:装置类型
|
|
|
|
//(混合装置多三行,比如说微分,多三行0)
|
|
|
|
//第四行:测点总数
|
|
//第五行:X位置类型(0代表第一个电极位置,1代表中点)
|
|
//第六行:数据标志(0电阻率,1激电)
|
|
|
|
CString szDate = _T("");
|
|
CString szMediumType = _T("");
|
|
|
|
for (int nIndex = 0; nIndex < szArray->GetSize(); nIndex++)
|
|
{
|
|
|
|
if (nIndex == 1)
|
|
{
|
|
m_szDistancePole = szArray->GetAt(nIndex);
|
|
m_fPoleDistance = atof(m_szDistancePole);
|
|
}
|
|
|
|
if (nIndex == 2)
|
|
{
|
|
szMediumType = szArray->GetAt(nIndex);//将装置类型保存起来,后面根据这个变量进行不同的运算。
|
|
szArray->SetAt(nIndex,TransformMediumType(szMediumType));//这里将装置类型转换成res软件的类型定义表
|
|
if (szArray->GetAt(nIndex) == "NULL")
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (szMediumType == "3")//微分属于混合排列类型,文件头需要添加三行0
|
|
{
|
|
// szArray->InsertAt(nIndex + 1, "0");
|
|
// szArray->InsertAt(nIndex + 2, "0");
|
|
// szArray->InsertAt(nIndex + 3, "0");
|
|
}
|
|
}
|
|
|
|
szDate += szArray->GetAt(nIndex);
|
|
szDate += "\n";
|
|
}
|
|
|
|
fwrite(szDate.GetBuffer(szDate.GetLength()), 1, szDate.GetLength(), m_resFile);
|
|
szDate.Empty();
|
|
fflush(m_resFile);
|
|
}
|
|
|
|
BOOL CSaveInRes::AddElectrodeTitle(CStringArray* szArray)
|
|
{
|
|
CString strContent;
|
|
for (int nIndex = 0; nIndex < szArray->GetSize(); nIndex++)
|
|
{
|
|
strContent += szArray->GetAt(nIndex);
|
|
//if (nIndex != szArray->GetSize() - 1)
|
|
strContent += "\n";
|
|
}
|
|
|
|
//strContent += "\n";
|
|
fwrite(strContent.GetBuffer(strContent.GetLength()), 1, strContent.GetLength(), m_resFile);
|
|
strContent.Empty();
|
|
fflush(m_resFile);
|
|
return TRUE;
|
|
return TRUE;
|
|
}
|
|
|
|
BOOL CSaveInRes::AddElectrodeCoordinatesInfo(CStringArray* szArray)
|
|
{
|
|
CString strContent;
|
|
for (int nIndex = 0; nIndex < szArray->GetSize(); nIndex++)
|
|
{
|
|
strContent += szArray->GetAt(nIndex);
|
|
if (nIndex != szArray->GetSize() - 1)
|
|
strContent += ",";
|
|
}
|
|
|
|
strContent += "\n";
|
|
fwrite(strContent.GetBuffer(strContent.GetLength()), 1, strContent.GetLength(), m_resFile);
|
|
strContent.Empty();
|
|
fflush(m_resFile);
|
|
return TRUE;
|
|
}
|
|
|
|
void CSaveInRes::InitCEFileHeader(CStringArray *szArray)
|
|
{
|
|
switch (m_methodType)
|
|
{
|
|
case Res:
|
|
InitCeResHeader(szArray);
|
|
break;
|
|
case IP:
|
|
InitCeIpHeader(szArray);
|
|
break;
|
|
default:
|
|
|
|
break;
|
|
}
|
|
|
|
}
|
|
|
|
void CSaveInRes::InitCeResHeader(CStringArray *szArray)
|
|
{
|
|
CString szTmp = _T("");
|
|
|
|
for (int n = 0; n < szArray->GetSize(); n++)
|
|
{
|
|
switch (n)
|
|
{
|
|
case 0:
|
|
szTmp = szArray->GetAt(n);
|
|
break;
|
|
case 1:
|
|
szTmp = "Array Type\r\nSchlumberger" ;
|
|
break;
|
|
case 2:
|
|
szTmp = "Number of data points\r\n" + szArray->GetAt(n);
|
|
szTmp += "\r\nData Type\r\nResistivity";
|
|
break;
|
|
case 3:
|
|
szTmp = "Error in measurements included\r\n" + szArray->GetAt(n);
|
|
|
|
szTmp += "\r\nData section";
|
|
break;
|
|
}
|
|
szTmp += "\r\n";
|
|
fwrite(szTmp.GetBuffer(szTmp.GetLength()), 1, szTmp.GetLength(), m_resFile);
|
|
fflush(m_resFile);
|
|
szTmp.Empty();
|
|
}
|
|
}
|
|
|
|
void CSaveInRes::InitCeIpHeader(CStringArray *szArray)
|
|
{
|
|
CString szTmp = _T("");
|
|
|
|
for (int n = 0; n < szArray->GetSize(); n++)
|
|
{
|
|
switch (n)
|
|
{
|
|
case 0:
|
|
szTmp = szArray->GetAt(n);
|
|
break;
|
|
case 1:
|
|
szTmp = "Array Type\r\nSchlumberger" ;
|
|
break;
|
|
case 2:
|
|
szTmp = "Number of data points\r\n" + szArray->GetAt(n);
|
|
szTmp += "\r\nData Type\r\nIP\r\nChargeability\r\nmsec";
|
|
break;
|
|
case 3:
|
|
szTmp += szArray->GetAt(n);
|
|
break;
|
|
case 4:
|
|
szTmp = "Error in measurements included\r\n" + szArray->GetAt(n);
|
|
szTmp += "\r\nData section";
|
|
break;
|
|
}
|
|
szTmp += "\r\n";
|
|
fwrite(szTmp.GetBuffer(szTmp.GetLength()), 1, szTmp.GetLength(), m_resFile);
|
|
fflush(m_resFile);
|
|
szTmp.Empty();
|
|
}
|
|
}
|
|
|
|
void CSaveInRes::CE_Schlumberger(CStringArray *szSRCArray, CStringArray *szTARArray)
|
|
{
|
|
switch (m_methodType)
|
|
{
|
|
case Res:
|
|
CE_Res_Schlumberger(szSRCArray, szTARArray);
|
|
break;
|
|
case IP:
|
|
CE_Res_Schlumberger(szSRCArray, szTARArray);//IP和电阻率数据数据主体一样
|
|
break;
|
|
}
|
|
}
|
|
|
|
void CSaveInRes::CE_Res_Schlumberger(CStringArray *szSRCArray, CStringArray *szTARArray)
|
|
{
|
|
CString szTmp = _T("");
|
|
float fTmp = 0;
|
|
|
|
for (int n = 0; n < szSRCArray->GetSize(); n++)
|
|
{
|
|
if (n == 2)
|
|
{
|
|
fTmp = atof(szSRCArray->GetAt(n));
|
|
szTmp.Format("%.4f", fabs(fTmp));
|
|
}
|
|
else
|
|
{
|
|
fTmp = atof(szSRCArray->GetAt(n));
|
|
szTmp.Format("%.3f", fabs(fTmp));
|
|
}
|
|
|
|
szTARArray->Add(szTmp);
|
|
}
|
|
}
|
|
void CSaveInRes::CE_Res_Marine(CStringArray *szSRCArray, CStringArray *szTARArray)
|
|
{
|
|
CString szTmp = _T("");
|
|
float fTmp = 0;
|
|
|
|
for (int n = 0; n < szSRCArray->GetSize(); n++)
|
|
{
|
|
if (n == 2)
|
|
{
|
|
fTmp = atof(szSRCArray->GetAt(n));
|
|
szTmp.Format("%.4f", fabs(fTmp));
|
|
}
|
|
else
|
|
{
|
|
fTmp = atof(szSRCArray->GetAt(n));
|
|
szTmp.Format("%.3f", fabs(fTmp));
|
|
}
|
|
|
|
szTARArray->Add(szTmp);
|
|
}
|
|
}
|
|
|
|
void CSaveInRes::AddCEModel(CStringArray *szArray)
|
|
{
|
|
CString szTmp = _T("");
|
|
|
|
szTmp = szArray->GetAt(0); //取得用户模型选项
|
|
if (szTmp == "Yes")
|
|
{
|
|
//该部分待开发
|
|
}
|
|
else
|
|
{
|
|
szTmp = "User Starting Model Available\r\n";
|
|
szTmp += "No";
|
|
}
|
|
|
|
szTmp += "\r\n";
|
|
fwrite(szTmp.GetBuffer(szTmp.GetLength()), 1, szTmp.GetLength(), m_resFile);
|
|
szTmp.Empty();
|
|
fflush(m_resFile);
|
|
}
|
|
|
|
void CSaveInRes::Mid_Gardient_Scan_3D(CStringArray *szSRCArray, CStringArray *szTARArray)
|
|
{
|
|
/*
|
|
按顺序传入A、B、M、N、R0 5个值
|
|
*/
|
|
|
|
int A = 0, B = 1, M = 2, N = 3, R = 4;
|
|
int nSort[4] = {A, B, M, N};
|
|
int nId = 0;
|
|
_pos *Pos = NULL;
|
|
|
|
CString szTmp = _T("");
|
|
int nTmp = 0;
|
|
int nPoleStart = 0;
|
|
|
|
int nDistancePole = 0;
|
|
|
|
nPoleStart = atoi(m_szPoleStart.GetBuffer(m_szPoleStart.GetLength()));
|
|
|
|
Pos = new _pos();
|
|
|
|
_rect tmpRect;
|
|
//如果是按照Y轴合并,由于m_rect已经是旋转过后的矩阵,那么在计算时,还要将其旋转回去进行计算
|
|
//因为pole_to_pos函数是按照电极的长度对于X轴来进行解析的
|
|
if (2 == m_i3DRollDiecetion)
|
|
{
|
|
tmpRect.x0 = m_rect.y0;
|
|
tmpRect.x1 = m_rect.y1;
|
|
tmpRect.y0 = m_rect.x0;
|
|
tmpRect.y1 = m_rect.x1;
|
|
}
|
|
else
|
|
{
|
|
tmpRect.x0 = m_rect.x0;
|
|
tmpRect.x1 = m_rect.x1;
|
|
tmpRect.y0 = m_rect.y0;
|
|
tmpRect.y1 = m_rect.y1;
|
|
}
|
|
szTARArray->Add(_T("4"));
|
|
float fXPoleDistance = atof(m_szX_DistancePole.GetBuffer(0));
|
|
float fYPoleDistance = atof(m_szY_DistancePole.GetBuffer(0));
|
|
int iTmp;
|
|
for(int i = 0; i < 4; i++)
|
|
{
|
|
nId = nSort[i];
|
|
|
|
szTmp = szSRCArray->GetAt(nId);
|
|
nTmp = atoi(szTmp.GetBuffer(0));
|
|
|
|
pole_to_pos_3d(&tmpRect, nPoleStart, m_nPoleStepX, m_nPoleStepY,Pos, nTmp,m_byLineDirection);
|
|
|
|
//如果是按照Y轴方向合并,则需要进行逻辑坐标轴的转换
|
|
//此时转换之需要颠倒X轴和Y轴的位置就好
|
|
if (2 == m_i3DRollDiecetion)
|
|
{
|
|
iTmp = Pos->x;
|
|
Pos->x = Pos->y;
|
|
Pos->y = iTmp;
|
|
}
|
|
|
|
//AB是X轴的基准轴,所以此时Y的位置信息为0
|
|
if (i < 2)
|
|
{
|
|
szTmp.Empty();
|
|
szTmp.Format("%.3f",0 + m_fAPosX+i* m_fABDistance);
|
|
szTARArray->Add(szTmp);
|
|
|
|
szTmp.Empty();
|
|
szTmp.Format("%.3f",0);
|
|
szTARArray->Add(szTmp);
|
|
}
|
|
else
|
|
{
|
|
szTmp.Empty();
|
|
szTmp.Format("%.3f",m_fAPosX + m_fMinAMDistance + fXPoleDistance * Pos->x);
|
|
szTARArray->Add(szTmp);
|
|
|
|
szTmp.Empty();
|
|
szTmp.Format("%.3f",fYPoleDistance * Pos->y - m_fAPosY);
|
|
szTARArray->Add(szTmp);
|
|
}
|
|
|
|
}
|
|
|
|
int q = szSRCArray->GetSize();
|
|
|
|
szTmp.Empty();
|
|
szTmp = szSRCArray->GetAt(4);
|
|
szTARArray->Add(szTmp);
|
|
|
|
delete Pos;
|
|
Pos = NULL;
|
|
}
|
|
|
|
void CSaveInRes::Dipole_Dipole_3D(CStringArray *szSRCArray, CStringArray *szTARArray)
|
|
{
|
|
/*
|
|
按顺序传入A、B、M、N、R0 5个值
|
|
*/
|
|
|
|
int A = 0, B = 1, M = 2, N = 3, R = 4;
|
|
int nSort[4] = {A, B, M, N};
|
|
int nId = 0;
|
|
_pos *Pos = NULL;
|
|
|
|
CString szTmp = _T("");
|
|
int nTmp = 0;
|
|
int nPoleStart = 0;
|
|
|
|
int nDistancePole = 0;
|
|
|
|
nPoleStart = atoi(m_szPoleStart.GetBuffer(m_szPoleStart.GetLength()));
|
|
|
|
Pos = new _pos();
|
|
|
|
_rect tmpRect;
|
|
//如果是按照Y轴合并,由于m_rect已经是旋转过后的矩阵,那么在计算时,还要将其旋转回去进行计算
|
|
//因为pole_to_pos函数是按照电极的长度对于X轴来进行解析的
|
|
if (2 == m_i3DRollDiecetion)
|
|
{
|
|
tmpRect.x0 = m_rect.y0;
|
|
tmpRect.x1 = m_rect.y1;
|
|
tmpRect.y0 = m_rect.x0;
|
|
tmpRect.y1 = m_rect.x1;
|
|
}
|
|
else
|
|
{
|
|
tmpRect.x0 = m_rect.x0;
|
|
tmpRect.x1 = m_rect.x1;
|
|
tmpRect.y0 = m_rect.y0;
|
|
tmpRect.y1 = m_rect.y1;
|
|
}
|
|
|
|
int iTmp;
|
|
for(int i = 0; i < 4; i++)
|
|
{
|
|
nId = nSort[i];
|
|
|
|
szTmp = szSRCArray->GetAt(nId);
|
|
nTmp = atoi(szTmp.GetBuffer(0));
|
|
|
|
pole_to_pos_3d(&tmpRect, nPoleStart, m_nPoleStepX, m_nPoleStepY,Pos, nTmp,m_byLineDirection);
|
|
|
|
//如果是按照Y轴方向合并,则需要进行逻辑坐标轴的转换
|
|
//此时转换之需要颠倒X轴和Y轴的位置就好
|
|
if (2 == m_i3DRollDiecetion)
|
|
{
|
|
iTmp = Pos->x;
|
|
Pos->x = Pos->y;
|
|
Pos->y = iTmp;
|
|
}
|
|
|
|
szTmp.Empty();
|
|
szTmp.Format("%.3f",(float)(Pos->x * atof(m_szX_DistancePole.GetBuffer(0))));
|
|
szTARArray->Add(szTmp);
|
|
|
|
szTmp.Empty();
|
|
szTmp.Format("%.3f",(float)(Pos->y * atof(m_szY_DistancePole.GetBuffer(0))));
|
|
szTARArray->Add(szTmp);
|
|
}
|
|
|
|
int q = szSRCArray->GetSize();
|
|
|
|
szTmp.Empty();
|
|
szTmp = szSRCArray->GetAt(4);
|
|
szTARArray->Add(szTmp);
|
|
|
|
delete Pos;
|
|
Pos = NULL;
|
|
}
|
|
|
|
void CSaveInRes::Set_3D_LandSign(int f_type)
|
|
{
|
|
CString szTmp = _T("");
|
|
|
|
szTmp.Format("Topography\r\n%d", f_type);
|
|
|
|
szTmp += "\r\n";
|
|
fwrite(szTmp.GetBuffer(szTmp.GetLength()), 1, szTmp.GetLength(), m_resFile);
|
|
szTmp.Empty();
|
|
fflush(m_resFile);
|
|
|
|
|
|
}
|
|
|
|
void CSaveInRes::Add_3D_LandFile(CStringArray *szSRCArray)
|
|
{
|
|
CString szTmp = _T("");
|
|
|
|
for (int n = 0; n < szSRCArray->GetSize(); n++)
|
|
{
|
|
szTmp += szSRCArray->GetAt(n);
|
|
szTmp +=" ";
|
|
}
|
|
|
|
szTmp += "\r\n";
|
|
fwrite(szTmp.GetBuffer(szTmp.GetLength()), 1, szTmp.GetLength(), m_resFile);
|
|
szTmp.Empty();
|
|
fflush(m_resFile);
|
|
}
|
|
|
|
//联剖A
|
|
void CSaveInRes::Pole_dipole_2d(CStringArray *szSRCArray, CStringArray *szTARArray)
|
|
{
|
|
//szSRCArray这五个值得顺序分别是 0:A的位置 1:B的位置 2:M的位置 3:N的位置 4:R0
|
|
//Pole_dipole_2d的计算值有四列,计算公式分别:
|
|
//第一列:C1 * 间距
|
|
//第二列:(p2 - p1) * 间距
|
|
//第三列: (p1 - c1) / (p2 - p1)
|
|
//第四列:R0
|
|
//所有三极装置的中点都是MN
|
|
szTARArray->RemoveAll();
|
|
|
|
//第一列:
|
|
DOUBLE firstRow;
|
|
DOUBLE fDistancePole;
|
|
CString szFirstRow;
|
|
//modified by lsq 20160716
|
|
//将记录点的位置改为M点位置
|
|
// firstRow = (0.5*(atof(szSRCArray->GetAt(2))+atof(szSRCArray->GetAt(3)))-1) * atof(m_szDistancePole.GetBuffer(0));
|
|
//firstRow = (atof(szSRCArray->GetAt(2)) - 1) * atof(m_szDistancePole.GetBuffer(0));
|
|
firstRow = (atof(szSRCArray->GetAt(0)) - 1 )* atof(m_szDistancePole.GetBuffer(0));
|
|
szFirstRow.Format("%.3f",fabs(firstRow));
|
|
szTARArray->Add(szFirstRow);
|
|
|
|
//第二列:
|
|
CString szSencondRow;
|
|
DOUBLE fSencondRow;
|
|
DOUBLE fdistance;
|
|
fdistance = atof(m_szDistancePole);//m_szDistancePole成员变量,保存了电极间距
|
|
fSencondRow = ( atof(szSRCArray->GetAt(3)) - atof(szSRCArray->GetAt(2)) ) * atof(m_szDistancePole.GetBuffer(0));
|
|
szSencondRow.Format("%.3f",fabs(fSencondRow));
|
|
szTARArray->Add(szSencondRow);
|
|
|
|
//第三列
|
|
DOUBLE thirdRow;
|
|
CString szThirdRow;
|
|
thirdRow = 1.0*(atof(szSRCArray->GetAt(2)) - atof(szSRCArray->GetAt(0))) / (atof(szSRCArray->GetAt(3)) - atof(szSRCArray->GetAt(2)));
|
|
|
|
// DOUBLE a = atof(szSRCArray->GetAt(2));
|
|
// DOUBLE b = atof(szSRCArray->GetAt(0));
|
|
// DOUBLE c = atof(szSRCArray->GetAt(3));
|
|
// DOUBLE d = atof(szSRCArray->GetAt(2));
|
|
// DOUBLE e = (a - b)/ (c - d);
|
|
|
|
szThirdRow.Format("%.3f",fabs(thirdRow));
|
|
szTARArray->Add(szThirdRow);
|
|
|
|
//第四列
|
|
DOUBLE FourthRow;
|
|
CString szFourthRow;
|
|
FourthRow = atof(szSRCArray->GetAt(5)) / atof(szSRCArray->GetAt(6)) * (2* VAL_PI/(1.0/(atof(szSRCArray->GetAt(2)) - atof(szSRCArray->GetAt(0))) - 1.0/ (atof(szSRCArray->GetAt(3)) - atof(szSRCArray->GetAt(0)))));
|
|
szFourthRow.Format("%.3f",FourthRow);
|
|
szTARArray->Add(szFourthRow);
|
|
|
|
}
|
|
|
|
//联剖b
|
|
void CSaveInRes::Reverse_Pole_dipole_2d(CStringArray *szSRCArray, CStringArray *szTARArray)
|
|
{
|
|
//szSRCArray这五个值得顺序分别是 0:A的位置 1:B的位置 2:M的位置 3:N的位置 4:R0
|
|
//Reverse_Pole_dipole_2d的计算值有四列,计算公式分别:
|
|
//第一列:P1 * 间距
|
|
//第二列:(p1 - p2) * 间距
|
|
//第三列: (c2-p2)/(p2-p1)
|
|
//第四列:R0
|
|
|
|
szTARArray->RemoveAll();
|
|
|
|
//第一列:
|
|
DOUBLE firstRow;
|
|
DOUBLE fDistancePole;
|
|
CString szFirstRow;
|
|
|
|
//modified by lsq 20160716
|
|
//将记录点的位置改为N点位置
|
|
// firstRow = (0.5*(atof(szSRCArray->GetAt(2))+atof(szSRCArray->GetAt(3)))-1) * atof(m_szDistancePole.GetBuffer(0));
|
|
// firstRow = (atof(szSRCArray->GetAt(3)) - 1) * atof(m_szDistancePole.GetBuffer(0));
|
|
//将记录点的位置改为M点位置 x
|
|
firstRow = (atof(szSRCArray->GetAt(3)) - 1) * atof(m_szDistancePole.GetBuffer(0));
|
|
szFirstRow.Format("%.3f",fabs(firstRow));
|
|
szTARArray->Add(szFirstRow);
|
|
|
|
//第二列:
|
|
CString szSencondRow;
|
|
DOUBLE fSencondRow;
|
|
// DOUBLE fdistance;
|
|
// fdistance = atof(m_szDistancePole);//m_szDistancePole成员变量,保存了电极间距
|
|
fSencondRow = ( atof(szSRCArray->GetAt(2)) - atof(szSRCArray->GetAt(3)) ) * atof(m_szDistancePole.GetBuffer(0));
|
|
szSencondRow.Format("%.3f",fabs(fSencondRow));
|
|
szTARArray->Add(szSencondRow);
|
|
|
|
//第三列,mnb的n为负值
|
|
DOUBLE thirdRow;
|
|
CString szThirdRow;
|
|
thirdRow = (atof(szSRCArray->GetAt(1)) - atof(szSRCArray->GetAt(2))) / (atof(szSRCArray->GetAt(2)) - atof(szSRCArray->GetAt(3)));
|
|
szThirdRow.Format("-%.3f",fabs(thirdRow));
|
|
szTARArray->Add(szThirdRow);
|
|
|
|
//第四列
|
|
DOUBLE FourthRow;
|
|
CString szFourthRow;
|
|
FourthRow = atof(szSRCArray->GetAt(5)) / atof(szSRCArray->GetAt(6)) * (2 * VAL_PI / (1.0 / (atof(szSRCArray->GetAt(1)) - atof(szSRCArray->GetAt(3))) - 1.0 / (atof(szSRCArray->GetAt(1)) - atof(szSRCArray->GetAt(2)))));
|
|
szFourthRow.Format("%.3f",FourthRow);
|
|
szTARArray->Add(szFourthRow);
|
|
}
|
|
|
|
//微分排列2d
|
|
void CSaveInRes::Wenner_Y_2D(CStringArray *szSRCArray, CStringArray *szTARArray)
|
|
{
|
|
//Wenner_Y_2D这五个值得顺序分别是 0:A的位置 1:B的位置 2:M的位置 3:N的位置 4:R0
|
|
//Reverse_Pole_dipole_2d的计算值有四列,计算公式分别:
|
|
//第一列:记录点的位置,在这里为BM的中点
|
|
//第二列:电极间距,极AM的距离
|
|
//第三列:R0
|
|
//所有温钠装置的中点都是MN的中点
|
|
szTARArray->RemoveAll();
|
|
|
|
//电极间距
|
|
DOUBLE fdistance;
|
|
fdistance = atof(m_szDistancePole);//m_szDistancePole成员变量,保存了电极间距
|
|
|
|
//第一列:
|
|
DOUBLE firstRow;
|
|
DOUBLE fDistancePole;
|
|
CString szFirstRow;
|
|
|
|
firstRow = (0.5*(atof(szSRCArray->GetAt(2)) + atof(szSRCArray->GetAt(1))) -1) * fdistance;
|
|
szFirstRow.Format("%.3f",fabs(firstRow) );
|
|
szTARArray->Add(szFirstRow);
|
|
|
|
//第二列:
|
|
CString szSencondRow;
|
|
DOUBLE fSencondRow;
|
|
fSencondRow = (atof(szSRCArray->GetAt(2)) - atof(szSRCArray->GetAt(0))) * fdistance;
|
|
szSencondRow.Format("%.3f",fabs(fSencondRow));
|
|
szTARArray->Add(szSencondRow);
|
|
|
|
//第三列
|
|
DOUBLE thirdRow;
|
|
CString szThirdRow;
|
|
thirdRow = atof(szSRCArray->GetAt(4));
|
|
szThirdRow.Format("%.3f",thirdRow);
|
|
szTARArray->Add(szThirdRow);
|
|
|
|
}
|
|
|
|
void CSaveInRes::Pole_Dipole_3D(CStringArray *szSRCArray, CStringArray *szTARArray)
|
|
{
|
|
int A = 0, B = 1, M = 2, N = 3, R = 4;
|
|
int nSort[3] = {A, M, N};
|
|
int nId = 0;
|
|
_pos *Pos = NULL;
|
|
|
|
CString szTmp = _T("");
|
|
int nTmp = 0;
|
|
int nPoleStart = 0;
|
|
|
|
int nDistancePole = 0;
|
|
|
|
nPoleStart = atoi(m_szPoleStart.GetBuffer(m_szPoleStart.GetLength()));
|
|
|
|
Pos = new _pos();
|
|
|
|
_rect tmpRect;
|
|
//如果是按照Y轴合并,由于m_rect已经是旋转过后的矩阵,那么在计算时,还要将其旋转回去进行计算
|
|
//因为pole_to_pos函数是按照电极的长度对于X轴来进行解析的
|
|
if (2 == m_i3DRollDiecetion)
|
|
{
|
|
tmpRect.x0 = m_rect.y0;
|
|
tmpRect.x1 = m_rect.y1;
|
|
tmpRect.y0 = m_rect.x0;
|
|
tmpRect.y1 = m_rect.x1;
|
|
}
|
|
else
|
|
{
|
|
tmpRect.x0 = m_rect.x0;
|
|
tmpRect.x1 = m_rect.x1;
|
|
tmpRect.y0 = m_rect.y0;
|
|
tmpRect.y1 = m_rect.y1;
|
|
}
|
|
|
|
int iTmp;
|
|
for(int i = 0; i < 3; i++)
|
|
{
|
|
nId = nSort[i];
|
|
|
|
szTmp = szSRCArray->GetAt(nId);
|
|
nTmp = atoi(szTmp.GetBuffer(0));
|
|
|
|
pole_to_pos_3d(&tmpRect, nPoleStart, m_nPoleStepX, m_nPoleStepY, Pos, nTmp,m_byLineDirection);
|
|
|
|
//如果是按照Y轴方向合并,则需要进行逻辑坐标轴的转换
|
|
//此时转换之需要颠倒X轴和Y轴的位置就好
|
|
if (2 == m_i3DRollDiecetion)
|
|
{
|
|
iTmp = Pos->x;
|
|
Pos->x = Pos->y;
|
|
Pos->y = iTmp;
|
|
}
|
|
|
|
szTmp.Empty();
|
|
szTmp.Format("%.3f",(float)(Pos->x * atof(m_szX_DistancePole.GetBuffer(0))));
|
|
szTARArray->Add(szTmp);
|
|
|
|
szTmp.Empty();
|
|
szTmp.Format("%.3f",(float)(Pos->y * atof(m_szY_DistancePole.GetBuffer(0))));
|
|
szTARArray->Add(szTmp);
|
|
}
|
|
|
|
int q = szSRCArray->GetSize();
|
|
|
|
szTmp.Empty();
|
|
szTmp = szSRCArray->GetAt(4);
|
|
szTARArray->Add(szTmp);
|
|
|
|
delete Pos;
|
|
Pos = NULL;
|
|
}
|
|
|
|
void CSaveInRes::Pole_Pole_3D(CStringArray *szSRCArray, CStringArray *szTARArray)
|
|
{
|
|
int A = 0, B = 1, M = 2, N = 3, R = 4;
|
|
int nSort[2] = {A, M};
|
|
int nId = 0;
|
|
_pos *Pos = NULL;
|
|
|
|
CString szTmp = _T("");
|
|
int nTmp = 0;
|
|
int nPoleStart = 0;
|
|
|
|
int nDistancePole = 0;
|
|
|
|
nPoleStart = atoi(m_szPoleStart.GetBuffer(m_szPoleStart.GetLength()));
|
|
|
|
Pos = new _pos();
|
|
|
|
_rect tmpRect;
|
|
//如果是按照Y轴合并,由于m_rect已经是旋转过后的矩阵,那么在计算时,还要将其旋转回去进行计算
|
|
//因为pole_to_pos函数是按照电极的长度对于X轴来进行解析的
|
|
if (2 == m_i3DRollDiecetion)
|
|
{
|
|
tmpRect.x0 = m_rect.y0;
|
|
tmpRect.x1 = m_rect.y1;
|
|
tmpRect.y0 = m_rect.x0;
|
|
tmpRect.y1 = m_rect.x1;
|
|
}
|
|
else
|
|
{
|
|
tmpRect.x0 = m_rect.x0;
|
|
tmpRect.x1 = m_rect.x1;
|
|
tmpRect.y0 = m_rect.y0;
|
|
tmpRect.y1 = m_rect.y1;
|
|
}
|
|
|
|
int iTmp;
|
|
for(int i = 0; i < 2; i++)
|
|
{
|
|
nId = nSort[i];
|
|
|
|
szTmp = szSRCArray->GetAt(nId);
|
|
nTmp = atoi(szTmp.GetBuffer(0));
|
|
pole_to_pos_3d(&tmpRect, nPoleStart, m_nPoleStepX, m_nPoleStepY, Pos, nTmp, m_byLineDirection);
|
|
//pole_to_pos_by_normal_axis(&tmpRect, nPoleStart, m_nPoleStepX, m_nPoleStepY,Pos, nTmp);
|
|
|
|
//如果是按照Y轴方向合并,则需要进行逻辑坐标轴的转换
|
|
//此时转换之需要颠倒X轴和Y轴的位置就好
|
|
if (2 == m_i3DRollDiecetion)
|
|
{
|
|
iTmp = Pos->x;
|
|
Pos->x = Pos->y;
|
|
Pos->y = iTmp;
|
|
}
|
|
szTmp.Empty();
|
|
szTmp.Format("%.3f",(float)(Pos->x * atof(m_szX_DistancePole.GetBuffer(0))));
|
|
szTARArray->Add(szTmp);
|
|
|
|
szTmp.Empty();
|
|
szTmp.Format("%.3f",(float)(Pos->y * atof(m_szY_DistancePole.GetBuffer(0))));
|
|
szTARArray->Add(szTmp);
|
|
}
|
|
|
|
int q = szSRCArray->GetSize();
|
|
|
|
szTmp.Empty();
|
|
szTmp = szSRCArray->GetAt(4);
|
|
szTARArray->Add(szTmp);
|
|
|
|
delete Pos;
|
|
Pos = NULL;
|
|
}
|
|
|
|
//中梯,混合类型
|
|
void CSaveInRes::Gradient_3D(CStringArray *szSRCArray, CStringArray *szTARArray)
|
|
{
|
|
/*
|
|
按顺序传入A、B、M、N、R0 5个值
|
|
*/
|
|
|
|
int A = 0, B = 1, M = 2, N = 3, R = 4;
|
|
int nSort[2] = {/*A, B, */M, N};
|
|
int nId = 0;
|
|
_pos *Pos = NULL;
|
|
|
|
CString szTmp = _T("");
|
|
int nTmp = 0;
|
|
int nPoleStart = 0;
|
|
|
|
int nDistancePole = 0;
|
|
|
|
nPoleStart = atoi(m_szPoleStart.GetBuffer(m_szPoleStart.GetLength()));
|
|
|
|
Pos = new _pos();
|
|
|
|
szTARArray->Add("2"); //混合类型前面要跟点击数量
|
|
|
|
_rect tmpRect;
|
|
//如果是按照Y轴合并,由于m_rect已经是旋转过后的矩阵,那么在计算时,还要将其旋转回去进行计算
|
|
//因为pole_to_pos函数是按照电极的长度对于X轴来进行解析的
|
|
if (2 == m_i3DRollDiecetion)
|
|
{
|
|
tmpRect.x0 = m_rect.y0;
|
|
tmpRect.x1 = m_rect.y1;
|
|
tmpRect.y0 = m_rect.x0;
|
|
tmpRect.y1 = m_rect.x1;
|
|
}
|
|
else
|
|
{
|
|
tmpRect.x0 = m_rect.x0;
|
|
tmpRect.x1 = m_rect.x1;
|
|
tmpRect.y0 = m_rect.y0;
|
|
tmpRect.y1 = m_rect.y1;
|
|
}
|
|
|
|
int iTmp;
|
|
for(int i = 0; i < 2; i++)
|
|
{
|
|
nId = nSort[i];
|
|
|
|
szTmp = szSRCArray->GetAt(nId);
|
|
nTmp = atoi(szTmp.GetBuffer(0));
|
|
|
|
pole_to_pos_3d(&tmpRect, nPoleStart, m_nPoleStepX, m_nPoleStepY,Pos, nTmp, m_byLineDirection);
|
|
|
|
//如果是按照Y轴方向合并,则需要进行逻辑坐标轴的转换
|
|
//此时转换之需要颠倒X轴和Y轴的位置就好
|
|
if (2 == m_i3DRollDiecetion)
|
|
{
|
|
iTmp = Pos->x;
|
|
Pos->x = Pos->y;
|
|
Pos->y = iTmp;
|
|
}
|
|
|
|
szTmp.Empty();
|
|
szTmp.Format("%.3f",(float)(Pos->x * atof(m_szX_DistancePole.GetBuffer(0))));
|
|
szTARArray->Add(szTmp);
|
|
|
|
szTmp.Empty();
|
|
szTmp.Format("%.3f",(float)(Pos->y * atof(m_szY_DistancePole.GetBuffer(0))));
|
|
szTARArray->Add(szTmp);
|
|
}
|
|
|
|
int q = szSRCArray->GetSize();
|
|
|
|
szTmp.Empty();
|
|
szTmp = szSRCArray->GetAt(4);
|
|
szTARArray->Add(szTmp);
|
|
|
|
delete Pos;
|
|
Pos = NULL;
|
|
}
|
|
|
|
void CSaveInRes::Dipole_Dipole_2D(CStringArray *szSRCArray, CStringArray *szTARArray)
|
|
{
|
|
//szSRCArray这五个值得顺序分别是 0:A的位置 1:B的位置 2:M的位置 3:N的位置 4:R0
|
|
//Pole_dipole_2d的计算值有四列,计算公式分别:
|
|
//第一列:C1 * 间距
|
|
//第二列:(p2 - p1) * 间距
|
|
//第三列:(p1 - c1) / (p2 - p1)
|
|
//第四列:R0
|
|
//在偶极-偶极装置里,中点是C1和P1之间的中点
|
|
|
|
szTARArray->RemoveAll();
|
|
|
|
//第一列:
|
|
DOUBLE firstRow;
|
|
DOUBLE fDistancePole;
|
|
CString szFirstRow;
|
|
|
|
firstRow = (0.5*(atof(szSRCArray->GetAt(0)) + atof(szSRCArray->GetAt(2)))-1) * atof(m_szDistancePole.GetBuffer(0));
|
|
szFirstRow.Format("%.3f",fabs(firstRow));
|
|
szTARArray->Add(szFirstRow);
|
|
|
|
//第二列:
|
|
CString szSencondRow;
|
|
DOUBLE fSencondRow;
|
|
DOUBLE fdistance;
|
|
fdistance = atof(m_szDistancePole);//m_szDistancePole成员变量,保存了电极间距
|
|
fSencondRow = ( atof(szSRCArray->GetAt(3)) - atof(szSRCArray->GetAt(2)) ) * atof(m_szDistancePole.GetBuffer(0));
|
|
szSencondRow.Format("%.4f",fabs(fSencondRow));
|
|
szTARArray->Add(szSencondRow);
|
|
|
|
//第三列
|
|
DOUBLE thirdRow;
|
|
CString szThirdRow;
|
|
thirdRow = ( atof(szSRCArray->GetAt(2)) - atof(szSRCArray->GetAt(0)) ) / ( atof(szSRCArray->GetAt(3)) - atof(szSRCArray->GetAt(2)) );
|
|
szThirdRow.Format("%.5f",fabs(thirdRow));
|
|
szTARArray->Add(szThirdRow);
|
|
|
|
//第四列
|
|
DOUBLE FourthRow;
|
|
CString szFourthRow;
|
|
FourthRow = atof(szSRCArray->GetAt(4));
|
|
szFourthRow.Format("%.4f",FourthRow);
|
|
szTARArray->Add(szFourthRow);
|
|
}
|
|
|
|
void CSaveInRes::SetPoleStep(int f_StepX, int f_StepY)
|
|
{
|
|
m_nPoleStepX = f_StepX;
|
|
m_nPoleStepY = f_StepY;
|
|
}
|
|
|
|
|
|
void CSaveInRes::Cross_Hole_2D(CStringArray *szSRCArray, CStringArray *szTARArray)
|
|
{
|
|
//szSRCArray这顺序分别为0:A的位置 1:B的位置 2:M的位置 3:N的位置 4:R0
|
|
|
|
//所生成的内容的格式为
|
|
//1:已经使用电极的个数,这这种方法中,值固定为4
|
|
//2,3列:A的X,Z位置
|
|
//4,5列:B的X,Z位置
|
|
//6,7列:M的X,Z位置
|
|
//8,9列:N的X,Z位置
|
|
//10列:R0
|
|
|
|
float fXPos = 0;
|
|
float fZPos = 0;
|
|
CString strXPos = _T("");
|
|
CString strZPos = _T("");
|
|
CString strR0 = _T("");
|
|
szTARArray->RemoveAll();
|
|
|
|
//如果只有一个字符串_T("1")的话,表示此时需要添加跨孔虚拟电极信息
|
|
if ((2 == szSRCArray->GetSize()) && (_T("1") == szSRCArray->GetAt(0)))
|
|
{
|
|
m_iEAmount = atoi(szSRCArray->GetAt(1));
|
|
GetCrossHoleSurfaceElectrode(m_fPoleDistance, m_fCrossHoleParam, m_iEAmount, szTARArray);
|
|
return;
|
|
}
|
|
|
|
//第1列
|
|
szTARArray->Add(_T("4"));
|
|
// int nMid = (atof(szSRCArray->GetAt(0)) + atof(szSRCArray->GetAt(1)) -1) /2;
|
|
int nMid = m_iEAmount/2;
|
|
int nFirstRealElecIndex = AR_CROSS_HOLE_SURFACE_ELECTRODE_NUM/2;
|
|
float fFirstRealElecXPos = 2*m_fPoleDistance;
|
|
float fABDistance = m_fCrossHoleParam;
|
|
int iAMParam = (atof(szSRCArray->GetAt(0)) < nMid) ? 0 : 1;
|
|
int iBNParam = (atof(szSRCArray->GetAt(0)) < nMid) ? 1 : 0;
|
|
|
|
//第2.3列:A点的X,Z位置
|
|
//added by lsq20160613 在这里Z得位置多加一个电极间距,根据祝工的意见
|
|
//modified by lsq 20171009 A在做,B在右边,A和M在同一条井内,电极号从小到大
|
|
//比如24电极,那么该井内就是1到12,另外一条则是13到24
|
|
//modifyed by lsq 10171016 根据最新的文档,孔深的位置=初始孔深+(N-1)*电极间距
|
|
// fXPos = fFirstRealElecXPos + fABDistance;
|
|
// fZPos = m_fPoleDistance*(nMid - atof(szSRCArray->GetAt(0)) + 1);
|
|
fXPos = fFirstRealElecXPos;
|
|
fZPos = m_fInitiDepth + m_fPoleDistance*(atof(szSRCArray->GetAt(0))-iAMParam*nMid-1);
|
|
strXPos.Format(_T("%.2f"),fXPos);
|
|
strZPos.Format(_T("%.2f"),fZPos);
|
|
szTARArray->Add(strXPos);
|
|
szTARArray->Add(strZPos);
|
|
|
|
//第4,5列:B的X,Z位置
|
|
//由于A,B处在同一横向,所以Z轴的坐标是相同的
|
|
strXPos.Empty();
|
|
strZPos.Empty();
|
|
fXPos = fFirstRealElecXPos+fABDistance;
|
|
fZPos = m_fInitiDepth+ m_fPoleDistance*(atof(szSRCArray->GetAt(1)) -iBNParam*nMid-1);
|
|
strXPos.Format(_T("%.2f"),fXPos);
|
|
strZPos.Format(_T("%.2f"),fZPos);
|
|
szTARArray->Add(strXPos);
|
|
szTARArray->Add(strZPos);
|
|
|
|
//第6,7列:M的X,Z位置
|
|
|
|
// fXPos = fFirstRealElecXPos + fABDistance;
|
|
// fZPos = m_fPoleDistance*(nMid - atof(szSRCArray->GetAt(2)) + 1);
|
|
fXPos = fFirstRealElecXPos;
|
|
fZPos = m_fInitiDepth+m_fPoleDistance*(atof(szSRCArray->GetAt(2))-iAMParam*nMid-1);
|
|
strXPos.Empty();
|
|
strZPos.Empty();
|
|
strXPos.Format(_T("%.2f"),fXPos);
|
|
strZPos.Format(_T("%.2f"),fZPos);
|
|
szTARArray->Add(strXPos);
|
|
szTARArray->Add(strZPos);
|
|
|
|
//第8,9列:N的X,Z位置 ,N的Z轴和M的轴Z位置是相同的
|
|
fXPos = fFirstRealElecXPos+fABDistance;
|
|
fZPos = m_fInitiDepth + m_fPoleDistance*(atof(szSRCArray->GetAt(3)) -iBNParam*nMid-1);
|
|
strXPos.Empty();
|
|
strZPos.Empty();
|
|
strXPos.Format(_T("%.2f"),fXPos);
|
|
strZPos.Format(_T("%.2f"),fZPos);
|
|
szTARArray->Add(strXPos);
|
|
szTARArray->Add(strZPos);
|
|
|
|
//第10列,R0
|
|
strR0.Format(_T("%.4f"),atof(szSRCArray->GetAt(4)));
|
|
szTARArray->Add(strR0);
|
|
}
|
|
|
|
void CSaveInRes::GetCrossHoleSurfaceElectrode(float fPoleDis, float fCrosshole, int nHoleElectrodeNum,CStringArray* strArray)
|
|
{
|
|
strArray->RemoveAll();
|
|
int nElectordeCnt = AR_CROSS_HOLE_SURFACE_ELECTRODE_NUM;
|
|
float fXPos = 0;
|
|
CString strInfo = _T("");
|
|
CString strText = _T("Surface electrode\n");
|
|
strArray->Add(strText);
|
|
float fElecPos[2];
|
|
int iVirElectCnt = (int)(fCrosshole/fPoleDis);
|
|
float fVirElecSpace = fCrosshole/iVirElectCnt;
|
|
strInfo.Format(_T("%d\n"),6+iVirElectCnt-1);
|
|
strArray->Add(strInfo);
|
|
// int nFirstRealElectIndex = nElectordeCnt/2;
|
|
//加入前3个电极,2个虚拟电极和一个实际电极,这3个电极之间的距离为电极间距
|
|
int nFirstRealElectIndex = 3;
|
|
int i = 0;
|
|
for (; i < nFirstRealElectIndex; i++)
|
|
{
|
|
fXPos = i*fPoleDis;
|
|
strInfo.Empty();
|
|
strInfo.Format(_T("%.2f, 0.00\n"),fXPos);
|
|
strArray->Add(strInfo);
|
|
}
|
|
if ( fPoleDis <= 0)
|
|
{
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
AfxMessageBox(_T("电极间距必须为正数!"));
|
|
else
|
|
MessageBoxEx(NULL, _T("The pole space must be postive number!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
fPoleDis = 10;
|
|
}
|
|
if (fCrosshole <= fPoleDis)
|
|
{
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
AfxMessageBox(_T("跨孔电极间距必须大于孔内电极间距!"));
|
|
else
|
|
MessageBoxEx(NULL, _T("The space of crss-hole must greatter than pole space!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
fCrosshole = fPoleDis;
|
|
}
|
|
|
|
//添加虚拟电极
|
|
|
|
fElecPos[0] = fXPos;
|
|
for (i = 1; i < iVirElectCnt; i++)
|
|
{
|
|
fXPos = fElecPos[0] + i*fVirElecSpace;
|
|
strInfo.Empty();
|
|
strInfo.Format(_T("%.2f, 0.00\n"),fXPos);
|
|
strArray->Add(strInfo);
|
|
}
|
|
//添加第二个实际电极
|
|
fElecPos[1] = fElecPos[0] + fCrosshole;
|
|
strInfo.Empty();
|
|
strInfo.Format(_T("%.2f, 0.00\n"),fElecPos[1]);
|
|
strArray->Add(strInfo);
|
|
|
|
|
|
// //添加两孔中间的虚拟电极
|
|
// fXPos += fCrosshole*fPoleDis/2;
|
|
// strInfo.Empty();
|
|
// strInfo.Format(_T("%.1f, 0.0\n"),fXPos);
|
|
// strArray->Add(strInfo);
|
|
|
|
//第二个实际电极的位置
|
|
// i = 0;
|
|
// fXPos = (nFirstRealElectIndex-1) * fPoleDis + fCrosshole * fPoleDis;
|
|
// fElecPos[1] = fXPos;
|
|
// int nRemain = nElectordeCnt - nFirstRealElectIndex - 1;
|
|
//添加第二个实际电极右边的另外2个虚拟电极
|
|
for (i = 1; i <= 2; i++)
|
|
{
|
|
fXPos = fElecPos[1] + i*fPoleDis;
|
|
strInfo.Empty();
|
|
strInfo.Format(_T("%.2f, 0.00\n"),fXPos);
|
|
strArray->Add(strInfo);
|
|
}
|
|
|
|
|
|
int nHoleElecNumMid = nHoleElectrodeNum / 2;
|
|
i = 0;
|
|
float fZPos = 0;
|
|
for (; i < 2; i++)
|
|
{
|
|
//添加钻孔1的电极信息
|
|
strText.Empty();
|
|
strText.Format(_T("Drill hole %d\n %d\n"),i+1,nHoleElecNumMid);
|
|
strArray->Add(strText);
|
|
|
|
for (int j = 0; j < nHoleElecNumMid; j++)
|
|
{
|
|
strInfo.Empty();
|
|
//modifyed by lsq 20171016 按照张杰最新的方案,将电极的深度信息也修改成和实际的一样
|
|
strInfo.Format(_T("%.2f, %.2f\n"), fElecPos[i], m_fInitiDepth+j*fPoleDis);
|
|
strArray->Add(strInfo);
|
|
}
|
|
}
|
|
strText = _T("measured points");
|
|
strArray->Add(strText);
|
|
}
|
|
|
|
void CSaveInRes::Wenner_Schlumberger_2D(CStringArray *szSRCArray, CStringArray *szTARArray)
|
|
{
|
|
if (szSRCArray->GetSize()<5)
|
|
{
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
AfxMessageBox(_T("数据格式错误在Wenner_Schlumberger"));
|
|
else
|
|
MessageBoxEx(NULL, _T("Data format error in Wenner_Schlumberger!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return;
|
|
}
|
|
szTARArray->RemoveAll();
|
|
float fVal = 0;
|
|
CString strVal = _T("");
|
|
|
|
//第一列A点的位置
|
|
fVal = (0.5*(atof(szSRCArray->GetAt(2))+atof(szSRCArray->GetAt(3)))-1);
|
|
strVal.Format(_T("%.2f"), m_fPoleDistance*fVal);
|
|
szTARArray->Add(strVal);
|
|
|
|
//第二列最小电极间距
|
|
strVal.Empty();
|
|
strVal.Format(_T("%.2f"), m_fPoleDistance*(atof(szSRCArray->GetAt(3)) - atof(szSRCArray->GetAt(2))));
|
|
szTARArray->Add(strVal);
|
|
|
|
//第三列间隔系数=n/x
|
|
fVal = (atof(szSRCArray->GetAt(2)) - atof(szSRCArray->GetAt(0))) / (atof(szSRCArray->GetAt(3)) - atof(szSRCArray->GetAt(2)));
|
|
strVal.Empty();
|
|
strVal.Format(_T("%.5f"), fVal);
|
|
szTARArray->Add(strVal);
|
|
|
|
//第四列RO的值
|
|
fVal = atof(szSRCArray->GetAt(4));
|
|
strVal.Empty();
|
|
strVal.Format(_T("%.2f"),fVal);
|
|
szTARArray->Add(strVal);
|
|
|
|
}
|
|
|
|
void CSaveInRes::A_M_ARRAY_2D(CStringArray *szSRCArray, CStringArray *szTARArray)
|
|
{
|
|
if (szSRCArray->GetSize()<5)
|
|
{
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
AfxMessageBox(_T("数据格式错误在A_M_array"));
|
|
else
|
|
MessageBoxEx(NULL, _T("Data format error in A_M_array!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return;
|
|
}
|
|
szTARArray->RemoveAll();
|
|
float fVal = 0;
|
|
CString strVal = _T("");
|
|
|
|
//第一列AM中点的位置
|
|
fVal = 0.5*(atof(szSRCArray->GetAt(0))+atof(szSRCArray->GetAt(2)))-1;
|
|
strVal.Format(_T("%.2f"), fVal*m_fPoleDistance);
|
|
szTARArray->Add(strVal);
|
|
|
|
//第二列AM之间的电极间距
|
|
strVal.Empty();
|
|
strVal.Format(_T("%.2f"), m_fPoleDistance*(atof(szSRCArray->GetAt(2)) - atof(szSRCArray->GetAt(0))));
|
|
szTARArray->Add(strVal);
|
|
|
|
//第三列RO的值
|
|
fVal = atof(szSRCArray->GetAt(4));
|
|
strVal.Empty();
|
|
strVal.Format(_T("%.2f"),fVal);
|
|
szTARArray->Add(strVal);
|
|
|
|
}
|
|
void CSaveInRes::SetMidGardientInfo(float fAPosX, float fAPosY, float fABDistance, float fMinAMDistance)
|
|
{
|
|
m_fAPosX = fAPosX;
|
|
m_fAPosY = fAPosY;
|
|
m_fABDistance = fABDistance;
|
|
m_fMinAMDistance = fMinAMDistance;
|
|
|
|
}
|
|
|
|
void CSaveInRes::AMN_ARRAY_2D(CStringArray *szSRCArray, CStringArray *szTARArray)
|
|
{
|
|
if (szSRCArray->GetSize()<5)
|
|
{
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
AfxMessageBox(_T("数据格式错误在A_M_array"));
|
|
else
|
|
MessageBoxEx(NULL, _T("Data format error in A_M_array!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return;
|
|
}
|
|
szTARArray->RemoveAll();
|
|
float fVal = 0;
|
|
CString strVal = _T("");
|
|
|
|
//第一列A点的位置
|
|
fVal = atof(szSRCArray->GetAt(2)) - 1;
|
|
strVal.Format(_T("%.2f"), m_fPoleDistance*fVal);
|
|
szTARArray->Add(strVal);
|
|
|
|
//第二列AM之间的电极间距
|
|
strVal.Empty();
|
|
strVal.Format(_T("%.2f"), m_fPoleDistance*(atof(szSRCArray->GetAt(3)) - atof(szSRCArray->GetAt(2))));
|
|
szTARArray->Add(strVal);
|
|
|
|
//第三列AM/MN
|
|
fVal = (atof(szSRCArray->GetAt(2)) - atof(szSRCArray->GetAt(0))) / (atof(szSRCArray->GetAt(3)) - atof(szSRCArray->GetAt(2)));
|
|
strVal.Empty();
|
|
strVal.Format(_T("%.2f"), fVal);
|
|
szTARArray->Add(strVal);
|
|
|
|
//第三列RO的值
|
|
fVal = atof(szSRCArray->GetAt(4));
|
|
strVal.Empty();
|
|
strVal.Format(_T("%.2f"),fVal);
|
|
szTARArray->Add(strVal);
|
|
|
|
}
|
|
|
|
void CSaveInRes::Custom_2D(CStringArray *szSRCArray, CStringArray *szTARArray)
|
|
{
|
|
if (szSRCArray->GetSize()<5)
|
|
{
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
AfxMessageBox(_T("数据格式错误在Custom_array"));
|
|
else
|
|
MessageBoxEx(NULL, _T("Data format error in Custom_array!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return;
|
|
}
|
|
szTARArray->RemoveAll();
|
|
float fVal = 0;
|
|
CString strZVal = _T("0.000");
|
|
int iRealPoleCnt = 0;
|
|
for (int i = 0; i < 4; i++)
|
|
{
|
|
if (atof(szSRCArray->GetAt(i)) > 0)
|
|
{
|
|
iRealPoleCnt++;
|
|
}
|
|
}
|
|
CString strVal = _T("");
|
|
strVal.Format(_T("%d"),iRealPoleCnt);
|
|
//modified by lsq 20160718
|
|
//第1列电极的个数,在这里修改为实际电极个数
|
|
szTARArray->Add(strVal);
|
|
|
|
|
|
//第2,3列A点的位置和Z位置
|
|
fVal = atof(szSRCArray->GetAt(0));
|
|
if (fVal > 0)
|
|
{
|
|
strVal.Empty();
|
|
strVal.Format(_T("%.3f"), m_fPoleDistance*fVal);
|
|
szTARArray->Add(strVal);
|
|
szTARArray->Add(strZVal);
|
|
}
|
|
|
|
|
|
//第4,5列B点的位置和Z位置
|
|
fVal = atof(szSRCArray->GetAt(1));
|
|
if (fVal > 0)
|
|
{
|
|
strVal.Empty();
|
|
strVal.Format(_T("%.3f"), m_fPoleDistance*fVal);
|
|
szTARArray->Add(strVal);
|
|
szTARArray->Add(strZVal);
|
|
}
|
|
|
|
|
|
//第6,7列M点的位置和Z位置
|
|
fVal = atof(szSRCArray->GetAt(2));
|
|
if (fVal > 0)
|
|
{
|
|
strVal.Empty();
|
|
strVal.Format(_T("%.3f"), m_fPoleDistance*fVal);
|
|
szTARArray->Add(strVal);
|
|
szTARArray->Add(strZVal);
|
|
}
|
|
|
|
//第8,9列N点的位置和Z位置
|
|
fVal = atof(szSRCArray->GetAt(3));
|
|
if (fVal > 0)
|
|
{
|
|
strVal.Empty();
|
|
strVal.Format(_T("%.3f"), m_fPoleDistance*fVal);
|
|
szTARArray->Add(strVal);
|
|
szTARArray->Add(strZVal);
|
|
}
|
|
|
|
//第10列RO的值
|
|
fVal = atof(szSRCArray->GetAt(4));
|
|
strVal.Empty();
|
|
strVal.Format(_T("%.3f"),fVal);
|
|
szTARArray->Add(strVal);
|
|
}
|
|
|
|
void CSaveInRes::CrossHole_2D(CStringArray *szSRCArray, CStringArray *szTARArray)
|
|
{
|
|
if (szSRCArray->GetSize() < 5)
|
|
{
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
AfxMessageBox(_T("数据格式错误在Crosshole_array"));
|
|
else
|
|
MessageBoxEx(NULL, _T("Data format error in Crosshole_array!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return;
|
|
}
|
|
szTARArray->RemoveAll();
|
|
float fVal = 0;
|
|
CString strZVal = _T("0.000");
|
|
int iRealPoleCnt = 0;
|
|
for (int i = 0; i < 4; i++)
|
|
{
|
|
if (atof(szSRCArray->GetAt(i)) > 0)
|
|
{
|
|
iRealPoleCnt++;
|
|
}
|
|
}
|
|
CString strVal = _T("");
|
|
strVal.Format(_T("%d"), iRealPoleCnt);
|
|
//modified by lsq 20160718
|
|
//第1列电极的个数,在这里修改为实际电极个数
|
|
szTARArray->Add(strVal);
|
|
|
|
|
|
//第2,3列A点的位置和Z位置
|
|
szTARArray->Add(szSRCArray->GetAt(0));
|
|
|
|
//第4,5列B点的位置和Z位置
|
|
szTARArray->Add(szSRCArray->GetAt(1));
|
|
|
|
|
|
//第6,7列M点的位置和Z位置
|
|
szTARArray->Add(szSRCArray->GetAt(2));
|
|
|
|
//第8,9列N点的位置和Z位置
|
|
szTARArray->Add(szSRCArray->GetAt(3));
|
|
|
|
//第10列RO的值
|
|
fVal = atof(szSRCArray->GetAt(4));
|
|
strVal.Empty();
|
|
strVal.Format(_T("%.3f"), fVal);
|
|
szTARArray->Add(strVal);
|
|
} |