把非utf8-bom编码的cpp/h文件改为 utf8 bom 编码, msvc识别utf8编码时,如果不是bom格式的,会使用当前cp_oem来解码.
This commit is contained in:
gjm committed 2026-10-04 00:04:20 +08:00
1 parent 2b0c2055ff
commit 164968b62e
6171 files changed
+191244 -191243

No files matched your search

@@ -1,4 +1,4 @@
#include "StdAfx.h"
#include "StdAfx.h"
#include "ReverseElevationCalc.h"
#include "elevationcalcdlg.h"
#include <stack>
@@ -38,15 +38,15 @@ void ReverseElevationCalc::InitCalcSys()
node.dGradient = GetPipeGradient(name);
node.dPipeLen = pPipe->m_nLength;
if (pEWell->m_iType == 3) //井
if (pEWell->m_iType == 3) //井
{
node.dWellEleUpE = GetWellEleUp(pEWell->m_ID);
node.strEWellName = GetWellName(pEWell->m_ID);
}
else if (pEWell->m_iType == 4) // 化粪池
else if (pEWell->m_iType == 4) // 化粪池
{
node.dWellEleUpE = GetPoolGroundEle(pEWell->m_ID);
node.strEWellName = GetPoolName(pEWell->m_ID) + _T("进");
node.strEWellName = GetPoolName(pEWell->m_ID) + _T("进");
}
if (pSWell->m_iType == 3)
@@ -60,10 +60,10 @@ void ReverseElevationCalc::InitCalcSys()
{
node.bPool = TRUE;
node.dWellEleUpS = GetPoolGroundEle(pSWell->m_ID);
node.strSWellName = GetPoolName(pSWell->m_ID) + _T("出");
node.strSWellName = GetPoolName(pSWell->m_ID) + _T("出");
}
if (pSWell->m_lstNode.Length() == 0) //系统起点井
if (pSWell->m_lstNode.Length() == 0) //系统起点井
{
node.bSysStartWell = TRUE;
}
@@ -85,17 +85,17 @@ void ReverseElevationCalc::InitCalcSys()
void ReverseElevationCalc::LayingDepthCalc()
{
m_vecCheckforPipe.clear();
// 获得反算计算序列
// 获得反算计算序列
std::vector<CALCNODE> vecCalcforR;
SortforCalcR(vecCalcforR);
acedSetStatusBarProgressMeter(_T("计算中..."), 0, vecCalcforR.size());
acedSetStatusBarProgressMeter(_T("计算中..."), 0, vecCalcforR.size());
for (size_t i = 0; i < vecCalcforR.size(); i++)
{
acedSetStatusBarProgressMeterPos(i);
CALCNODE &node = vecCalcforR[i];
node.dGradientDist = node.dGradient * node.dPipeLen;
if(node.idE == m_pAllList->m_ID) // 排出口
if(node.idE == m_pAllList->m_ID) // 排出口
{
node.dPipeEleE = m_dPipeEleDown;
node.dPipeEleS = node.dPipeEleE + node.dGradientDist;
@@ -104,11 +104,11 @@ void ReverseElevationCalc::LayingDepthCalc()
}
else
{
if (IsPool(node.idE)) // 化粪池
if (IsPool(node.idE)) // 化粪池
{
node.dPipeEleE = GetPipeEleDown2(vecCalcforR, node.idE) + GetPoolDrop(node.idE);
}
else // 井
else // 井
{
node.dPipeEleE = GetPipeEleUp2(vecCalcforR, node.idE) - GetPipeDjById(node.idP, node.dPipeDn) * 0.001;
}
@@ -126,40 +126,40 @@ void ReverseElevationCalc::LayingDepthCalc()
void ReverseElevationCalc::AutoCalc(BOOL bModify)
{
UpdateSWellLayDepth(); // cet 2012.6.25 add 更新起点井埋深
// 获得正算计算序列
UpdateSWellLayDepth(); // cet 2012.6.25 add 更新起点井埋深
// 获得正算计算序列
std::vector<CALCNODE> vecCalcforP;
SortforCalcP(vecCalcforP);
acedSetStatusBarProgressMeter(_T("自动计算中..."), 0, vecCalcforP.size());
acedSetStatusBarProgressMeter(_T("自动计算中..."), 0, vecCalcforP.size());
for (size_t i = 0; i < vecCalcforP.size(); i++)
{
acedSetStatusBarProgressMeterPos(i);
CALCNODE &node = vecCalcforP[i];
node.dGradientDist = node.dGradient * node.dPipeLen;
if (node.bSysStartWell) //系统起点井
if (node.bSysStartWell) //系统起点井
{
double dLayingDepth = GetWellLayDepth(node.idS); // 埋设深度
double dLayingDepth = GetWellLayDepth(node.idS); // 埋设深度
node.dPipeEleS = node.dWellEleUpS - dLayingDepth;
}
else if (node.bIsDropWell) //跌水井
else if (node.bIsDropWell) //跌水井
{
node.dPipeEleS = node.dWellEleDownS;
}
else if (node.bPool) // 化粪池
else if (node.bPool) // 化粪池
{
node.dPipeEleS = GetPipeEleDown(vecCalcforP, node.idS) - GetPoolDrop(node.idS);
}
else
{
node.bIsDropWell = isDropWell(vecCalcforP, node.idS); // cet 2011.11.29 add 判断井是否产生跌水
node.bIsDropWell = isDropWell(vecCalcforP, node.idS); // cet 2011.11.29 add 判断井是否产生跌水
double dPipeEleUp = GetPipeEleUp(vecCalcforP, node.idS);
node.dPipeEleS = dPipeEleUp - GetPipeDjById(node.idP, node.dPipeDn) * 0.001;
}
// 检查起点井覆土厚度
// 检查起点井覆土厚度
double dThick = node.dWellEleUpS - (node.dPipeEleS + GetPipeDjById(node.idP, node.dPipeDn) * 0.001 + GetPipeThickById(node.idP, node.dPipeDn));
if (dThick + 0.001 < m_dMinThick) // 小于最小覆土厚度时调整为最小覆土厚度
if (dThick + 0.001 < m_dMinThick) // 小于最小覆土厚度时调整为最小覆土厚度
{
if (!node.bIsDropWell && !node.bPool)
{
@@ -170,9 +170,9 @@ void ReverseElevationCalc::AutoCalc(BOOL bModify)
node.dWellEleDownS = node.dPipeEleS;
}
}
else if (node.bIsDropWell && bModify) // 跌水井
else if (node.bIsDropWell && bModify) // 跌水井
{
// 变为普通井
// 变为普通井
node.bIsDropWell = FALSE;
double dPipeEleUp = GetPipeEleUp(vecCalcforP, node.idS);
node.dPipeEleS = dPipeEleUp - GetPipeDjById(node.idP, node.dPipeDn) * 0.001;
@@ -187,15 +187,15 @@ void ReverseElevationCalc::AutoCalc(BOOL bModify)
node.dPipeEleE = node.dPipeEleS - node.dGradientDist;
// 检查终点井覆土厚度
// 检查终点井覆土厚度
dThick = node.dWellEleUpE - (node.dPipeEleE + GetPipeDjById(node.idP, node.dPipeDn) * 0.001 + GetPipeThickById(node.idP, node.dPipeDn));
if (dThick + 0.001 < m_dMinThick) // 小于最小覆土深度时调整为最小覆土深度
if (dThick + 0.001 < m_dMinThick) // 小于最小覆土深度时调整为最小覆土深度
{
node.dPipeEleE = node.dWellEleUpE - m_dMinThick - GetPipeDjById(node.idP, node.dPipeDn) * 0.001 - GetPipeThickById(node.idP, node.dPipeDn);
node.dPipeEleS = node.dPipeEleE + node.dGradientDist;
if (!node.bSysStartWell && !node.bPool)
{
node.bIsDropWell = TRUE; //起点井设置为跌水井
node.bIsDropWell = TRUE; //起点井设置为跌水井
node.dWellEleDownS = node.dPipeEleS;
}
}
@@ -203,7 +203,7 @@ void ReverseElevationCalc::AutoCalc(BOOL bModify)
node.dDeepS = node.dWellEleUpS - node.dPipeEleS;
node.dDeepE = node.dWellEleUpE - node.dPipeEleE;
// 不能修改埋深否则 无法比较起点井和用户设置的埋深关系
// 不能修改埋深否则 无法比较起点井和用户设置的埋深关系
// if (node.bSysStartWell)
// {
// m_mapLayingDepth.erase(node.idS);
@@ -220,15 +220,15 @@ void ReverseElevationCalc::CheckSys(CWnd *pWnd)
std::vector<AcDbObjectId> vecCheck1, vecCheck2;
std::vector<CALCNODE>::iterator it;
CString strMinThick, strLessDeep, strGreaterDeep;
CString strTemp = _T("、");
CString strTemp = _T("、");
for (it = m_vecLstData.begin(); it != m_vecLstData.end(); it++)
{
const CALCNODE &node = *it;
//起点井覆土厚度
//起点井覆土厚度
double dThick1 = node.dWellEleUpS - (node.dPipeEleS + GetPipeDjById(node.idP, node.dPipeDn) * 0.001 + GetPipeThickById(node.idP, node.dPipeDn));
//终点井覆土厚度
//终点井覆土厚度
double dThick2 = node.dWellEleUpE - (node.dPipeEleE + GetPipeDjById(node.idP, node.dPipeDn) * 0.001 + GetPipeThickById(node.idP, node.dPipeDn));
if (Compare(dThick1, m_dMinThick) == -1 || Compare(dThick2, m_dMinThick) == -1) // 管段不符合最小覆土厚度
if (Compare(dThick1, m_dMinThick) == -1 || Compare(dThick2, m_dMinThick) == -1) // 管段不符合最小覆土厚度
{
strMinThick += node.strSWellName + _T("-") + node.strEWellName + strTemp;
vecCheck1.push_back(node.idP);
@@ -237,7 +237,7 @@ void ReverseElevationCalc::CheckSys(CWnd *pWnd)
if (node.bSysStartWell)
{
double dLayingDepth = GetWellLayDepth(node.idS);
// 管内底标高介于最小覆土厚度和用户设定的埋设深度之间
// 管内底标高介于最小覆土厚度和用户设定的埋设深度之间
if ((Compare(node.dDeepS, dLayingDepth) == -1)
&& (Compare(dThick1, m_dMinThick) != -1))
{
@@ -245,32 +245,32 @@ void ReverseElevationCalc::CheckSys(CWnd *pWnd)
vecCheck2.push_back(node.idP);
}
else if (Compare(node.dDeepS, dLayingDepth) == 1
&& Compare(dThick1, m_dMinThick) != -1) // 起点埋深大于用户设定值
&& Compare(dThick1, m_dMinThick) != -1) // 起点埋深大于用户设定值
{
strGreaterDeep += node.strSWellName + strTemp;
}
}
}
if (!strMinThick.IsEmpty()) // 存在不符合最小覆土厚度的管段
if (!strMinThick.IsEmpty()) // 存在不符合最小覆土厚度的管段
{
strMinThick = strMinThick.Left(strMinThick.GetLength() - strTemp.GetLength());
if (pWnd != NULL)
{
pWnd->MessageBox(strMinThick + _T("管段不符合最小埋设深度要求!"), _T("反算校核"));
pWnd->MessageBox(strMinThick + _T("管段不符合最小埋设深度要求!"), _T("反算校核"));
}
else
{
AfxMessageBox(strMinThick + _T("管段不符合最小埋设深度要求!"));
AfxMessageBox(strMinThick + _T("管段不符合最小埋设深度要求!"));
}
m_vecCheckforPipe = vecCheck1;
}
else if (!strLessDeep.IsEmpty()) // 存在管内底标高介于最小覆土厚度和用户设定的埋设深度之间的系统起点井
else if (!strLessDeep.IsEmpty()) // 存在管内底标高介于最小覆土厚度和用户设定的埋设深度之间的系统起点井
{
CString strTip;
strLessDeep = strLessDeep.Left(strLessDeep.GetLength() - strTemp.GetLength());
strTip = strLessDeep + _T("起点井计算所得埋设深度小于用户设定埋设深度!!");
strTip = strLessDeep + _T("起点井计算所得埋设深度小于用户设定埋设深度!!");
CString strDropWellName;
std::map<AcDbObjectId,double>::iterator it;
for (it = m_mapDropWell.begin(); it != m_mapDropWell.end(); it++)
@@ -281,12 +281,12 @@ void ReverseElevationCalc::CheckSys(CWnd *pWnd)
if (!strDropWellName.IsEmpty())
{
strDropWellName = strDropWellName.Left(strDropWellName.GetLength() - strTemp.GetLength());
strTip += _T("\n") + strDropWellName + _T("设定跌水井标高与实际计算不符!");
strTip += _T("\n") + strDropWellName + _T("设定跌水井标高与实际计算不符!");
}
if (pWnd != NULL)
{
pWnd->MessageBox(strTip, _T("反算校核"));
pWnd->MessageBox(strTip, _T("反算校核"));
}
else
{
@@ -296,31 +296,31 @@ void ReverseElevationCalc::CheckSys(CWnd *pWnd)
m_mapDropWell.clear();
m_vecCheckforPipe = vecCheck2;
}
else if (!strGreaterDeep.IsEmpty()) // 存在起点埋深大于用户设定值
else if (!strGreaterDeep.IsEmpty()) // 存在起点埋深大于用户设定值
{
if (pWnd != NULL)
{
if (pWnd->MessageBox(_T("是否将管网各个起点井的埋设深度提高到用户设置位置并进行自动计算"), _T("反算校核"), MB_YESNO) == IDYES)
if (pWnd->MessageBox(_T("是否将管网各个起点井的埋设深度提高到用户设置位置并进行自动计算"), _T("反算校核"), MB_YESNO) == IDYES)
{
AutoCalc(TRUE);
// 检查用户设置的跌水井与计算结果是否一致
// 检查用户设置的跌水井与计算结果是否一致
CheckDropWell();
}
}
else
{
if (AfxMessageBox(_T("是否将管网各个起点井的埋设深度提高到用户设置位置并进行自动计算"), MB_YESNO) == IDYES)
if (AfxMessageBox(_T("是否将管网各个起点井的埋设深度提高到用户设置位置并进行自动计算"), MB_YESNO) == IDYES)
{
AutoCalc(TRUE);
// 检查用户设置的跌水井与计算结果是否一致
// 检查用户设置的跌水井与计算结果是否一致
CheckDropWell();
}
}
}
else // 起点井埋深与用户设置一致
else // 起点井埋深与用户设置一致
{
// 存在跌水井时
// 存在跌水井时
CString strDropWellName;
std::map<AcDbObjectId,double>::iterator it;
for (it = m_mapDropWell.begin(); it != m_mapDropWell.end(); it++)
@@ -333,11 +333,11 @@ void ReverseElevationCalc::CheckSys(CWnd *pWnd)
strDropWellName = strDropWellName.Left(strDropWellName.GetLength() - strTemp.GetLength());
if (pWnd != NULL)
{
pWnd->MessageBox(strDropWellName + _T("设定跌水井标高与实际计算不符,实际计算") + strDropWellName + _T("应为普通井!"), _T("反算校核"));
pWnd->MessageBox(strDropWellName + _T("设定跌水井标高与实际计算不符,实际计算") + strDropWellName + _T("应为普通井!"), _T("反算校核"));
}
else
{
AfxMessageBox(strDropWellName + _T("设定跌水井标高与实际计算不符,实际计算") + strDropWellName + _T("应为普通井!"));
AfxMessageBox(strDropWellName + _T("设定跌水井标高与实际计算不符,实际计算") + strDropWellName + _T("应为普通井!"));
}
DeleteDropWell();
m_mapDropWell.clear();
@@ -373,7 +373,7 @@ void ReverseElevationCalc::SortforCalcP(std::vector<CALCNODE> &vecData)
{
UpDatePipeSys();
SSearchPipeList *pList = NULL;
pList = GetFarthestSWell(m_pAllList); //获得最远起点井
pList = GetFarthestSWell(m_pAllList); //获得最远起点井
if (pList != NULL)
{
@@ -386,22 +386,22 @@ void ReverseElevationCalc::SortforCalcP(std::vector<CALCNODE> &vecData)
pSWell = data.top();
data.pop();
if ((pSWell->m_iType == 3 || pSWell->m_iType == 4) && pSWell->m_pPrevious != NULL && pSWell->m_iSpare != 2) //管段起点井
if ((pSWell->m_iType == 3 || pSWell->m_iType == 4) && pSWell->m_pPrevious != NULL && pSWell->m_iSpare != 2) //管段起点井
{
int nNum = pSWell->m_lstNode.Length();
if (nNum == 1 || nNum == 0 || (nNum > 1 && pSWell->m_iSpare == 1))
{
SSearchPipeList *pPipe = pSWell->m_pPrevious;
if (pPipe->m_iType == 0 && pPipe->m_pPrevious != NULL) //管段
if (pPipe->m_iType == 0 && pPipe->m_pPrevious != NULL) //管段
{
SSearchPipeList *pEWell = pPipe->m_pPrevious;
if (pEWell->m_iType == 3 || pEWell->m_iType == 4) // 管段终点井
if (pEWell->m_iType == 3 || pEWell->m_iType == 4) // 管段终点井
{
pSWell->m_iSpare = 2; //表示井处理(注意只需标注管段起点井)
pSWell->m_iSpare = 2; //表示井处理(注意只需标注管段起点井)
if (nNum == 0) //系统起点井
if (nNum == 0) //系统起点井
{
pSWell->m_bNeedCale = TRUE; //已处理
pSWell->m_bNeedCale = TRUE; //已处理
}
std::vector<CALCNODE>::iterator it;
@@ -415,7 +415,7 @@ void ReverseElevationCalc::SortforCalcP(std::vector<CALCNODE> &vecData)
}
}
}
else if (nNum > 1) //存在分支
else if (nNum > 1) //存在分支
{
data.push(pSWell);
@@ -426,11 +426,11 @@ void ReverseElevationCalc::SortforCalcP(std::vector<CALCNODE> &vecData)
}
else
{
pSWell->m_iSpare = 1; //井上所有分支已处理
pSWell->m_iSpare = 1; //井上所有分支已处理
}
}
}
else if (pSWell->m_lstNode.Length() > 1) // 排出端存在支路
else if (pSWell->m_lstNode.Length() > 1) // 排出端存在支路
{
SSearchPipeList *pTemp = GetFarthestSWell(pSWell);
if (pTemp != NULL)
@@ -491,7 +491,7 @@ void ReverseElevationCalc::DeleteDropWell()
void ReverseElevationCalc::CheckDropWell()
{
CString strTip, strTemp = _T("、");
CString strTip, strTemp = _T("、");
std::map<AcDbObjectId,double>::iterator it;
for (it = m_mapDropWell.begin(); it != m_mapDropWell.end(); it++)
{
@@ -509,13 +509,13 @@ void ReverseElevationCalc::CheckDropWell()
if (!strTip.IsEmpty())
{
strTip = strTip.Left(strTip.GetLength() - strTemp.GetLength());
AfxMessageBox(strTip + _T("设定跌水井标高与实际计算不符!"));
AfxMessageBox(strTip + _T("设定跌水井标高与实际计算不符!"));
}
}
BOOL ReverseElevationCalc::IsModifyEleforEndWell()
{
// 如果排出井连接着多跟管段,以管内底标高最小值与用户设置值比较
// 如果排出井连接着多跟管段,以管内底标高最小值与用户设置值比较
BOOL bRet = FALSE;
std::vector<CALCNODE>::iterator it;
std::set<double> data;
@@ -524,14 +524,14 @@ BOOL ReverseElevationCalc::IsModifyEleforEndWell()
CALCNODE &node = *it;
if (node.idE == m_pAllList->m_ID)
{
// 排出井可能连接多个管
// 排出井可能连接多个管
data.insert(node.dPipeEleE);
}
}
if (!data.empty())
{
// 取出最小值
// 取出最小值
double dMin = *(data.begin());
if (Compare(dMin, m_dPipeEleDown) != 0)
{
@@ -563,7 +563,7 @@ bool ReverseElevationCalc::isDropWell(std::vector<CALCNODE> &data, const AcDbObj
double dRet = 0.0;
bool bFirst = true;
bool bDorpWell = false;
std::vector<CALCNODE>::iterator it; // cet 2011.7.5 modfiy 改为非const迭代器,方便修改
std::vector<CALCNODE>::iterator it; // cet 2011.7.5 modfiy 改为非const迭代器,方便修改
for (it = data.begin(); it != data.end(); it++)
{
if ((*it).idE == idSWell)
@@ -573,7 +573,7 @@ bool ReverseElevationCalc::isDropWell(std::vector<CALCNODE> &data, const AcDbObj
bFirst = false;
dRet = (*it).dPipeEleE;
}
else if (fabs(dRet - (*it).dPipeEleE) > 0.0001) // 误差值
else if (fabs(dRet - (*it).dPipeEleE) > 0.0001) // 误差值
{
bDorpWell = true;
break;
@@ -581,10 +581,10 @@ bool ReverseElevationCalc::isDropWell(std::vector<CALCNODE> &data, const AcDbObj
}
}
// cet 2011.7.5 add 通过此函数判断出的跌水井可能导致计算错误,添加以下代码纠正错误
// cet 2011.7.5 add 通过此函数判断出的跌水井可能导致计算错误,添加以下代码纠正错误
if (bDorpWell)
{
// 找出管内底标高最小值
// 找出管内底标高最小值
bFirst = true;
double dPipeDn = 0.0;
AcDbObjectId idPipe;
@@ -610,7 +610,7 @@ bool ReverseElevationCalc::isDropWell(std::vector<CALCNODE> &data, const AcDbObj
if (!!idPipe)
{
// 管内顶标高
// 管内顶标高
dRet += GetPipeDjById(idPipe, dPipeDn) * 0.001;
for (it = data.begin(); it != data.end(); it++)
{
@@ -620,7 +620,7 @@ bool ReverseElevationCalc::isDropWell(std::vector<CALCNODE> &data, const AcDbObj
}
}
// 根据管内顶平接,计算出it中管的起点管内底标高,并将值设置给起点井底标高
// 根据管内顶平接,计算出it中管的起点管内底标高,并将值设置给起点井底标高
if (it != data.end())
{
(*it).dWellEleDownS = dRet - GetPipeDjById((*it).idP, (*it).dPipeDn) * 0.001;