a
This commit is contained in:
@@ -0,0 +1,133 @@
|
||||
// MeidumBipoleUpHole.cpp: implementation of the CMeidumBipoleUpHole class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "geomative.h"
|
||||
#include "MeidumBipoleUpHole.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[]=__FILE__;
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
||||
extern int g_iUILanguage;
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
CMediumBipoleUpHole::CMediumBipoleUpHole(int iAR): CMedium(iAR)
|
||||
{
|
||||
m_iSurfaceElecNum = 0;
|
||||
}
|
||||
|
||||
CMediumBipoleUpHole::~CMediumBipoleUpHole()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CMediumBipoleUpHole::SetParamVal(const void* pVal)
|
||||
{
|
||||
m_iSurfaceElecNum = *((int*)pVal);
|
||||
}
|
||||
|
||||
bool CMediumBipoleUpHole::GenerateSptRecElecVal(int iEAmount, int* pMaxLevel, int* pPtAmount, CPtrArray* pSptRecArray)
|
||||
{
|
||||
if (iEAmount < 4)
|
||||
{
|
||||
if (LANG_ZHCN == g_iUILanguage)
|
||||
AfxMessageBox(_T("双极电极的数目是误差的。"));
|
||||
else
|
||||
MessageBoxEx(NULL, _T("The number of electrode in BipoleUpHole is error."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_iSurfaceElecNum < 2)
|
||||
{
|
||||
if (LANG_ZHCN == g_iUILanguage)
|
||||
AfxMessageBox(_T("地表电极数错误!"));
|
||||
else
|
||||
MessageBoxEx(NULL, _T("The number of surface electrode is error."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||||
return false;
|
||||
}
|
||||
int iHoleElectNum = iEAmount - m_iSurfaceElecNum;
|
||||
if (iHoleElectNum < 2)
|
||||
{
|
||||
if (LANG_ZHCN == g_iUILanguage)
|
||||
AfxMessageBox(_T("井内电极数错误!"));
|
||||
else
|
||||
MessageBoxEx(NULL, _T("The number of hole electrode is error."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||||
return false;
|
||||
}
|
||||
if (NULL == pSptRecArray)
|
||||
{
|
||||
if (LANG_ZHCN == g_iUILanguage)
|
||||
AfxMessageBox(_T("pSptRecArray不能为空!"));
|
||||
else
|
||||
MessageBoxEx(NULL, _T("pSptRecArray can't be NULL!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||||
return false;
|
||||
}
|
||||
pSptRecArray->RemoveAll();
|
||||
|
||||
//装置的位置顺序为AMNB
|
||||
int iC1Pos = 0, iC2Pos = 1,iP1Pos = 0,iP2Pos = 2;
|
||||
int iTsn = 0, iElecSpace = 1;
|
||||
CSptRecord *pSptRec = NULL;
|
||||
//此时固定A的位置不动,B点向右移动,然后M从2开始往右移动,MN的间距始终为1
|
||||
while((1 + iElecSpace) <= m_iSurfaceElecNum)
|
||||
{
|
||||
iC2Pos = 1;
|
||||
iP2Pos = iC2Pos + iElecSpace;
|
||||
while(true)
|
||||
{
|
||||
if (iP2Pos > m_iSurfaceElecNum)
|
||||
{
|
||||
break;
|
||||
}
|
||||
iC1Pos = m_iSurfaceElecNum+1;
|
||||
iP1Pos = iC1Pos + iElecSpace;
|
||||
for(; iP1Pos <= iEAmount; iP1Pos+=2)
|
||||
{
|
||||
iC1Pos = iP1Pos - iElecSpace;
|
||||
pSptRec = new CSptRecord();
|
||||
pSptRec->m_iC1 = iC1Pos;
|
||||
pSptRec->m_iC2 = iC2Pos;
|
||||
pSptRec->m_iP1 = iP1Pos;
|
||||
pSptRec->m_iP2 = iP2Pos;
|
||||
pSptRec->m_fK = CalculateCESptKVal(iC1Pos, iC2Pos, iP1Pos, iP2Pos);
|
||||
//由于不需要画剖面图,所以这里暂时对m_iPtNum赋值为0
|
||||
pSptRec->m_iPtNum = 0;
|
||||
// pSptRec->m_iPtNum = iC1Pos;
|
||||
pSptRec->m_iLevel = GenSptRecLevel(iC1Pos, iC2Pos, iP1Pos, iP2Pos);
|
||||
pSptRec->m_colorREF = RGB(0, 255, 0);
|
||||
pSptRec->m_iN = 1;
|
||||
pSptRec->m_bIsSel = TRUE;
|
||||
pSptRec->m_iTsn = ++iTsn;
|
||||
pSptRecArray->Add(pSptRec);
|
||||
}
|
||||
iC2Pos += 2;
|
||||
iP2Pos += 2;
|
||||
}
|
||||
iElecSpace++;
|
||||
}
|
||||
|
||||
*pPtAmount = pSptRecArray->GetSize();
|
||||
*pMaxLevel = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
float CMediumBipoleUpHole::CalculateCESptKVal(float fA, float fB, float fX, float fY)
|
||||
{
|
||||
float fAM = fabs(fX - fA);
|
||||
float fAN = sqrt(pow(fA-m_iSurfaceElecNum, 2) + pow(m_iSurfaceElecNum-fY, 2));
|
||||
float fBM = sqrt(pow(fX-m_iSurfaceElecNum, 2) + pow(m_iSurfaceElecNum-fB, 2));
|
||||
float fBN = fabs(fY - fB);
|
||||
if (0 == fAM || 0 ==fAN || 0 == fBM || 0 == fBN)
|
||||
{
|
||||
return 0;
|
||||
// AfxMessageBox(_T("Calcualte K value error.value = "))
|
||||
}
|
||||
return fabs(2*VAL_PI/(1.0/fAM - 1.0/fAN - 1.0/fBM + 1.0/fBN));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user