5888 lines
205 KiB
C++
5888 lines
205 KiB
C++
#include "stdafx.h"
|
||
#include "DbVerticalSection.h"
|
||
#include "DbWell.h"
|
||
#include "DbPipe.h"
|
||
#include <DbElipse.h>
|
||
#include <DbSymbolAnnotate.h>
|
||
#include <dbgridsheet.h>
|
||
|
||
#include "dbPipeFitting.h"
|
||
#include "DbPool.h"
|
||
|
||
extern CString ReadXdata(Entity ent, const TCHAR*szName);
|
||
CString I2Str(double i)
|
||
{
|
||
CString csText;
|
||
i = i/1000;
|
||
int iTmp = int(i * 1000) * 10;
|
||
int iTmp2 = int(i * 10000);
|
||
if(iTmp == iTmp2){
|
||
iTmp = int(i * 100) * 10;
|
||
iTmp2 = int(i * 1000);
|
||
if(iTmp == iTmp2)
|
||
csText.Format(_T("%.2f"), i);
|
||
else
|
||
csText.Format(_T("%.3f"), i);
|
||
}
|
||
else
|
||
csText.Format(_T("%.4f"), i);
|
||
return csText;
|
||
}
|
||
extern void FullExplode(const AcDbEntity *pEnt, AcDbVoidPtrArray &entitySet);
|
||
namespace
|
||
{
|
||
//得到2管线的交点和各自起点到交点的距离
|
||
bool GetCrossPipeInfo(TDbPipe *pPipe1, TDbPipe *pPipe2, XPoint &ptInt, double &nDist2Well1, double &nDist2Well2, bool bShowPipeEndNotLinkedPipe = false)
|
||
{
|
||
XPoint ptWell1, ptWell2;
|
||
XLine line1, line2;
|
||
// 纵断面图干管
|
||
{
|
||
XLine line(pPipe1->GetStartPoint(), pPipe1->GetEndPoint(), 1);
|
||
line.StartPoint().z = 0;
|
||
line.EndPoint().z = 0;
|
||
if(pPipe1->GetFlowDir() == TPipeSys::kFromStart)
|
||
ptWell1 = pPipe1->StartPoint();
|
||
else
|
||
ptWell1 = pPipe1->EndPoint();
|
||
line1 = line;
|
||
}
|
||
// 交叉管
|
||
{
|
||
XLine line(pPipe2->GetStartPoint(), pPipe2->GetEndPoint(), 1);
|
||
line.StartPoint().z = 0;
|
||
line.EndPoint().z = 0;
|
||
if(pPipe2->GetFlowDir() == TPipeSys::kFromStart)
|
||
ptWell2 = pPipe2->StartPoint();
|
||
else
|
||
ptWell2 = pPipe2->EndPoint();
|
||
line2 = line;
|
||
}
|
||
line1.StartPoint().z = 0;
|
||
line1.EndPoint().z = 0;
|
||
line2.StartPoint().z = 0;
|
||
line2.EndPoint().z = 0;
|
||
// cet 2016.4.29 modify 管道距离原点较远时,无法计算交点
|
||
// int ret = line1.Intersection(&line2, ptInt);
|
||
// if(!ptInt)
|
||
// return;
|
||
AcGeVector3d vt1 = line1.StartPoint() - line1.EndPoint();
|
||
AcGeVector3d vt2 = line2.StartPoint() - line2.EndPoint();
|
||
double dAngle = vt1.angleTo(vt2);
|
||
if (fabs(dAngle) < 0.001 || fabs(dAngle - PI) < 0.001) // 管道平行
|
||
{
|
||
return false;
|
||
}
|
||
XCurveSegment seg;
|
||
seg = line1;
|
||
seg.SetLineFlag(LS_INFINITE);
|
||
if (seg.ProjectToMe(line2.StartPoint(), ptInt) != RTNORM) // 获得投影点
|
||
return false;
|
||
bool bEndWell = false; // 是否为起始井
|
||
ptInt = line2.StartPoint() - vt2.normalize() * ptInt.Distance(line2.StartPoint()) / sin(dAngle); // 真正交点
|
||
if (fabs(ptInt.Distance(line1.StartPoint()) + ptInt.Distance(line1.EndPoint()) - line1.GetLength()) > 0.001 ||
|
||
fabs(ptInt.Distance(line2.StartPoint()) + ptInt.Distance(line2.EndPoint()) - line2.GetLength()) > 0.001)
|
||
{
|
||
// cet 2017.8.24 modify 起始井处穿井并且没有与管道相交的管道交点
|
||
bool bPassWell = false;
|
||
{
|
||
// 是否穿过井或池
|
||
AcDbObjectId id = pPipe1->GetNode(ptInt.Distance2d(pPipe1->StartPoint()) > ptInt.Distance2d(pPipe1->EndPoint()) ? 1 : 0);
|
||
OPENOBJ_BEGIN(id, AcDb::kForRead, TDbEquipment, pEquip);
|
||
if (pEquip != NULL)
|
||
{
|
||
// 管网中的井或池
|
||
if (pEquip->GetInterfaceNum() > 1)
|
||
{
|
||
return false;
|
||
}
|
||
bEndWell = true;
|
||
AcDbLine line(line2.StartPoint(), line2.EndPoint());
|
||
AcDbVoidPtrArray entitySet;
|
||
FullExplode(pEquip, entitySet);
|
||
AcGePoint3dArray arr;
|
||
int nCount = entitySet.length();
|
||
for (int i = 0; i < nCount; ++i)
|
||
{
|
||
AcDbCurve *pCurve = (AcDbCurve*)entitySet[i];
|
||
if (pCurve != NULL)
|
||
{
|
||
line.intersectWith(pCurve, AcDb::kOnBothOperands, AcGePlane::kXYPlane, arr);
|
||
if (arr.length() > 0)
|
||
{
|
||
bPassWell = true;
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
ReleaseEntSet(entitySet);
|
||
}
|
||
OPENOBJ_END();
|
||
}
|
||
if (!bPassWell)
|
||
{
|
||
return false;
|
||
}
|
||
}
|
||
if(ptInt == line1.StartPoint() || ptInt == line1.EndPoint() || ptInt == line2.StartPoint() || ptInt == line2.EndPoint())
|
||
{//如果交点在线端,就不考虑了,因为之前已经考虑了
|
||
// cet 2017.8.23 modify 考虑是否显示与管端有交点但没有连接关系的管道
|
||
if (bShowPipeEndNotLinkedPipe)
|
||
{
|
||
// 管道有交点,但在端点没有与井连接时显示交点
|
||
{
|
||
int nPos = ptInt.Distance2d(pPipe1->StartPoint()) < 0.001 ? 0 : 1;
|
||
OPENOBJ_BEGIN(pPipe1->GetNode(nPos), AcDb::kForRead, TDbEquipment, pEquip);
|
||
if (pEquip != NULL)
|
||
{
|
||
int nNum = pEquip->GetInterfaceNum();
|
||
for (int i = 0; i < nNum; ++i)
|
||
{
|
||
const TPipeInterface &face = pEquip->GetInterface(i);
|
||
if (face.m_idPipe == pPipe2->objectId())
|
||
{
|
||
return false;
|
||
}
|
||
}
|
||
}
|
||
OPENOBJ_END();
|
||
}
|
||
}
|
||
else
|
||
{
|
||
ptInt = XPoint();
|
||
return false;
|
||
}
|
||
}
|
||
ptWell1.z = 0;
|
||
ptWell2.z = 0;
|
||
|
||
nDist2Well1 = ads_distance(ptInt, ptWell1) ; //相交管线起点到交点的距离
|
||
nDist2Well2 = ads_distance(ptInt, ptWell2) ; //本管线起点到交点的距离
|
||
if(!DocGetMeterUnitDraw()){
|
||
nDist2Well1 = nDist2Well1 / 1000.0;
|
||
nDist2Well2 = nDist2Well2 / 1000.0;
|
||
}
|
||
// cet 2017.8.24 add 起始井被管道穿过,没有与干管井交叉
|
||
if (bEndWell && ptWell1.Distance2d(ptInt) < ptWell2.Distance2d(ptInt))
|
||
{
|
||
nDist2Well1 *= -1;
|
||
}
|
||
return true;
|
||
}
|
||
// 交叉管是否已统计
|
||
bool IsExistCrossNode(const std::vector<CrossPoint> &vecCross, const AcDbObjectId &id, const XPoint &pt)
|
||
{
|
||
std::vector<CrossPoint>::const_iterator it, itEnd = vecCross.end();
|
||
for (it = vecCross.begin(); it != itEnd; ++it)
|
||
{
|
||
if (it->IsExistCrossNode(id, pt))
|
||
{
|
||
return true;
|
||
}
|
||
}
|
||
return false;
|
||
}
|
||
}
|
||
|
||
CrossPoint::CrossPoint(const AcDbObjectId &id)
|
||
{
|
||
m_id = id;
|
||
}
|
||
|
||
CrossPoint::CrossPoint()
|
||
{
|
||
m_id = AcDbObjectId::kNull;
|
||
}
|
||
|
||
AcDbObjectId CrossPoint::PipeId() const
|
||
{
|
||
return m_id;
|
||
}
|
||
|
||
bool CrossPoint::IsCross() const
|
||
{
|
||
return !m_vecNode.empty();
|
||
}
|
||
|
||
void CrossPoint::AddCrossPoint(const AcDbObjectId &id, const XPoint &ptInt, double dDist2Well1, double dDist2Well2)
|
||
{
|
||
CrossNode node;
|
||
node.m_id = id;
|
||
node.m_pt = ptInt;
|
||
node.m_dDist2Well1 = dDist2Well1;
|
||
node.m_dDist2Well2 = dDist2Well2;
|
||
m_vecNode.push_back(node);
|
||
}
|
||
|
||
void CrossPoint::GetAllCrossPipes(DList<AcDbObjectId> &lstPipe) const
|
||
{
|
||
std::vector<CrossNode>::const_iterator it, itEnd = m_vecNode.end();
|
||
for (it = m_vecNode.begin(); it != itEnd; ++it)
|
||
{
|
||
lstPipe.Append(new AcDbObjectId(it->m_id));
|
||
}
|
||
}
|
||
|
||
bool CrossPoint::GetCrossInfo(const AcDbObjectId &id, XPoint &ptIns, double &dDist2Well1, double &dDist2Well2) const
|
||
{
|
||
std::vector<CrossNode>::const_iterator it, itEnd = m_vecNode.end();
|
||
for (it = m_vecNode.begin(); it != itEnd; ++it)
|
||
{
|
||
if (it->m_id == id)
|
||
{
|
||
ptIns = it->m_pt;
|
||
dDist2Well1 = it->m_dDist2Well1;
|
||
dDist2Well2 = it->m_dDist2Well2;
|
||
return true;
|
||
}
|
||
}
|
||
return false;
|
||
}
|
||
|
||
void CrossPoint::Sort()
|
||
{
|
||
std::sort(m_vecNode.begin(), m_vecNode.end());
|
||
}
|
||
|
||
bool CrossPoint::IsExistCrossNode(const AcDbObjectId &id, const XPoint &pt) const
|
||
{
|
||
std::vector<CrossNode>::const_iterator it, itEnd = m_vecNode.end();
|
||
for (it = m_vecNode.begin(); it != itEnd; ++it)
|
||
{
|
||
if (it->m_id == id && pt.Distance(it->m_pt) < 0.001)
|
||
{
|
||
return true;
|
||
}
|
||
}
|
||
return false;
|
||
}
|
||
|
||
void CrossPoint::ReadCrossPoint(const TEntityFields &fd, const CString &sKey)
|
||
{
|
||
// 主管id
|
||
AcDbSoftPointerId idTemp;
|
||
fd.GFD(sKey + _T("_MainPipe"), idTemp);
|
||
m_id = idTemp;
|
||
// 交叉管数据
|
||
Adesk::UInt16 nNum = 0;
|
||
fd.GFD(sKey + _T("_Num"), nNum);
|
||
CString sTemp = sKey + _T("_CrossNode"), sIndex;
|
||
AcGePoint3d pt;
|
||
for (Adesk::UInt16 i = 0; i < nNum; ++i)
|
||
{
|
||
sIndex.Format(_T("_%d"), i);
|
||
sTemp += sIndex;
|
||
CrossNode node;
|
||
// 交叉管
|
||
fd.GFD(sTemp +_T("_CrossPipe"), idTemp);
|
||
node.m_id = idTemp;
|
||
// 交点
|
||
fd.GFD(sTemp + _T("_Point"), pt);
|
||
node.m_pt = pt;
|
||
// 到起点井距离
|
||
double dDistS = 0.0;
|
||
fd.GFD(sTemp + _T("_SDist"), dDistS);
|
||
node.m_dDist2Well1 = dDistS;
|
||
// 到终点井距离
|
||
double dDistE = 0.0;
|
||
fd.GFD(sTemp + _T("_EDist"), dDistE);
|
||
node.m_dDist2Well2 = dDistE;
|
||
// 存储数据
|
||
m_vecNode.push_back(node);
|
||
}
|
||
}
|
||
|
||
void CrossPoint::WriteCrossPoint(TEntityFields &fd, const CString &sKey)
|
||
{
|
||
// 主管id
|
||
fd.SFD(sKey + _T("_MainPipe"), AcDbSoftPointerId(m_id));
|
||
// 交叉管数据
|
||
fd.SFD(sKey + _T("_Num"), Adesk::UInt16(m_vecNode.size()));
|
||
CString sTemp = sKey + _T("_CrossNode"), sIndex;
|
||
std::vector<CrossNode>::iterator it, itEnd = m_vecNode.end();
|
||
int nIndex = 0;
|
||
for (it = m_vecNode.begin(); it != itEnd; ++it)
|
||
{
|
||
CrossNode &node = *it;
|
||
sIndex.Format(_T("_%d"), nIndex);
|
||
sTemp += sIndex;
|
||
++nIndex;
|
||
// 交叉管
|
||
fd.SFD(sTemp +_T("_CrossPipe"), AcDbSoftPointerId(node.m_id));
|
||
// 交点
|
||
fd.SFD(sTemp + _T("_Point"), node.m_pt.AsAcGePoint3d());
|
||
// 到起点井距离
|
||
fd.SFD(sTemp + _T("_SDist"), node.m_dDist2Well1);
|
||
// 到终点井距离
|
||
fd.SFD(sTemp + _T("_EDist"), node.m_dDist2Well2);
|
||
}
|
||
}
|
||
|
||
void CrossPoint::DelCrossPoint(TEntityFields &fd, const CString &sKey)
|
||
{
|
||
// 主管id
|
||
DelTEntityField(fd, sKey + _T("_MainPipe"));
|
||
// 交叉管数据
|
||
Adesk::UInt16 nNum = 0;
|
||
fd.GFD(sKey + _T("_Num"), nNum);
|
||
DelTEntityField(fd, sKey + _T("_Num"));
|
||
CString sTemp = sKey + _T("_CrossNode"), sIndex;
|
||
for (Adesk::UInt16 i = 0; i < nNum; ++i)
|
||
{
|
||
sIndex.Format(_T("_%d"), i);
|
||
sTemp += sIndex;
|
||
// 交叉管
|
||
DelTEntityField(fd, sTemp +_T("_CrossPipe"));
|
||
// 交点
|
||
DelTEntityField(fd, sTemp + _T("_Point"));
|
||
// 到起点井距离
|
||
DelTEntityField(fd, sTemp + _T("_SDist"));
|
||
// 到终点井距离
|
||
DelTEntityField(fd, sTemp + _T("_EDist"));
|
||
}
|
||
}
|
||
|
||
bool CrossPoint::DelTEntityField(TEntityFields &fd, const CString &sKey)
|
||
{
|
||
bool bRet = true;
|
||
long nIndex = fd.Find(sKey);
|
||
if (nIndex != -1)
|
||
{
|
||
fd.Del(nIndex);
|
||
bRet = false;
|
||
}
|
||
return bRet;
|
||
}
|
||
|
||
// 计算管道交叉点
|
||
void CalcCrossPipes(DList<AcDbObjectId> &lstPipe, DList<AcDbObjectId> &lstOtherPipe, std::vector<CrossPoint> &vecCross, bool bShowPipeEndNotLinkedPipe)
|
||
{
|
||
// 打开管道
|
||
std::vector<TDbPipe*> vecOtherPipe;
|
||
for (int i = 0; i < lstOtherPipe.Length(); ++i)
|
||
{
|
||
TDbPipe *pPipe = NULL;
|
||
acdbOpenObject(pPipe, *lstOtherPipe[i], AcDb::kForRead);
|
||
if (pPipe != NULL)
|
||
{
|
||
vecOtherPipe.push_back(pPipe);
|
||
}
|
||
}
|
||
// 计算管道与其他管交点
|
||
XPoint ptInt;
|
||
double dDist2Well1 = 0.0, dDist2Well2 = 0.0;
|
||
for (int i = 0; i < lstPipe.Length(); ++i)
|
||
{
|
||
OPENOBJ_BEGIN(*lstPipe[i], AcDb::kForRead, TDbPipe, pPipe);
|
||
if(pPipe != NULL)
|
||
{
|
||
CrossPoint cr(pPipe->objectId());
|
||
for (int j = 0; j < vecOtherPipe.size(); ++j)
|
||
{
|
||
// 有管道交叉点且唯一
|
||
if (GetCrossPipeInfo(pPipe, vecOtherPipe[j], ptInt, dDist2Well1, dDist2Well2, bShowPipeEndNotLinkedPipe) && !IsExistCrossNode(vecCross, vecOtherPipe[j]->objectId(), ptInt))
|
||
{
|
||
cr.AddCrossPoint(vecOtherPipe[j]->objectId(), ptInt, dDist2Well1, dDist2Well2);
|
||
}
|
||
}
|
||
// 有交叉点
|
||
if (cr.IsCross())
|
||
{
|
||
cr.Sort();
|
||
vecCross.push_back(cr);
|
||
}
|
||
}
|
||
OPENOBJ_END();
|
||
}
|
||
// 关闭管道
|
||
std::vector<TDbPipe*>::iterator it, itEnd = vecOtherPipe.end();
|
||
for (it = vecOtherPipe.begin(); it != itEnd; ++it)
|
||
{
|
||
(*it)->close();
|
||
}
|
||
}
|
||
// 干管交叉信息
|
||
bool GetCrossInfo(const std::vector<CrossPoint> &vecCross, CrossPoint &cr)
|
||
{
|
||
std::vector<CrossPoint>::const_iterator it, itEnd = vecCross.end();
|
||
for (it = vecCross.begin(); it != itEnd; ++it)
|
||
{
|
||
if (it->PipeId() == cr.PipeId())
|
||
{
|
||
cr = *it;
|
||
return true;
|
||
}
|
||
}
|
||
return false;
|
||
}
|
||
|
||
Acad::ErrorStatus TWellData::dwgInFields (AcDbDwgFiler* pFiler, int iVer)
|
||
{
|
||
|
||
XString xsName;
|
||
ReadString(pFiler, xsName);
|
||
m_csName = (const TCHAR*)xsName;
|
||
pFiler->readItem(&m_iDn);
|
||
pFiler->readItem(&m_nLength);
|
||
// cet 2017.6.1 del 应该在应用层处理数值转换问题
|
||
// if(m_nLength > 1000)
|
||
// m_nLength = m_nLength / 1000.0; //7.0用MM
|
||
pFiler->readItem(&m_nGroundEle);
|
||
pFiler->readItem(&m_nUpEle);
|
||
pFiler->readItem(&m_nDownEle);
|
||
pFiler->readItem(&m_nFrondDownEle);
|
||
pFiler->readItem(&m_nDeep);
|
||
pFiler->readItem(&m_nI);
|
||
pFiler->readItem(&m_nWellRadius);
|
||
// cet 2017.6.1 del 应该在应用层处理数值转换问题
|
||
// if(fabs(m_nWellRadius) < 100)
|
||
// m_nWellRadius = m_nWellRadius*100.0;//7.0
|
||
pFiler->readItem(&m_nSpare);
|
||
//pFiler->readItem(&m_bIsWell);
|
||
//pFiler->readItem(&m_bIsDropWell);
|
||
FilerRead(pFiler, m_bIsWell);
|
||
FilerRead(pFiler, m_bIsDropWell);
|
||
pFiler->readItem(&m_ID);
|
||
|
||
if(iVer > 1)
|
||
{
|
||
pFiler->readItem(&m_dRealLength);
|
||
// cet 2016.5.11 modify 更改了成员变量类型
|
||
// pFiler->readItem(&m_iSpare);
|
||
if (iVer < 3)
|
||
{
|
||
Adesk::UInt16 nVal = 0;
|
||
pFiler->readItem(&nVal);
|
||
m_iSpare = nVal;
|
||
}
|
||
else
|
||
{
|
||
pFiler->readItem(&m_iSpare);
|
||
}
|
||
ReadString(pFiler, xsName);
|
||
m_csSpare = (const TCHAR*)xsName;
|
||
}
|
||
|
||
return pFiler->filerStatus();
|
||
}
|
||
|
||
Acad::ErrorStatus TWellData::dwgOutFields(AcDbDwgFiler* pFiler, int iVer) const
|
||
{
|
||
pFiler->writeItem((const TCHAR *)m_csName);
|
||
pFiler->writeItem(m_iDn);
|
||
pFiler->writeItem(m_nLength);
|
||
pFiler->writeItem(m_nGroundEle);
|
||
pFiler->writeItem(m_nUpEle);
|
||
pFiler->writeItem(m_nDownEle);
|
||
pFiler->writeItem(m_nFrondDownEle);
|
||
pFiler->writeItem(m_nDeep);
|
||
pFiler->writeItem(m_nI);
|
||
pFiler->writeItem(m_nWellRadius);
|
||
pFiler->writeItem(m_nSpare);
|
||
//pFiler->writeItem(m_bIsWell);
|
||
//pFiler->writeItem(m_bIsDropWell);
|
||
FilerWrite(pFiler, m_bIsWell);
|
||
FilerWrite(pFiler, m_bIsDropWell);
|
||
pFiler->writeItem(m_ID);
|
||
|
||
if(iVer > 1)
|
||
{
|
||
pFiler->writeItem(m_dRealLength);
|
||
// cet 2016.5.11 modify 更改了成员变量类型
|
||
// pFiler->writeItem(m_iSpare);
|
||
if (iVer < 3)
|
||
{
|
||
Adesk::UInt16 nVal = static_cast<Adesk::UInt16>(m_iSpare);
|
||
pFiler->writeItem(nVal);
|
||
}
|
||
else
|
||
{
|
||
pFiler->writeItem(m_iSpare);
|
||
}
|
||
pFiler->writeItem((const TCHAR *)m_csSpare);
|
||
}
|
||
|
||
return pFiler->filerStatus();
|
||
}
|
||
|
||
|
||
|
||
TWellData & TWellData::operator = (const TWellData &src)
|
||
{
|
||
m_csName = src.m_csName;
|
||
m_iDn = src.m_iDn;
|
||
m_nLength = src.m_nLength;
|
||
m_nGroundEle = src.m_nGroundEle;
|
||
m_nUpEle = src.m_nUpEle;
|
||
m_nDownEle = src.m_nDownEle;
|
||
m_nFrondDownEle = src.m_nFrondDownEle;
|
||
m_nDeep = src.m_nDeep;
|
||
m_nI = src.m_nI;
|
||
m_nWellRadius = src.m_nWellRadius;
|
||
m_nSpare = src.m_nSpare;
|
||
m_bIsWell = src.m_bIsWell;
|
||
m_bIsDropWell = src.m_bIsDropWell;
|
||
m_ID = src.m_ID;
|
||
m_dRealLength = src.m_dRealLength;
|
||
m_iSpare = src.m_iSpare;
|
||
m_csSpare = src.m_csSpare;
|
||
|
||
// CopyObject(src, *this);
|
||
return *this;
|
||
}
|
||
|
||
TWellData::TWellData(const TWellData &src)
|
||
{
|
||
*this = src;
|
||
}
|
||
|
||
|
||
Acad::ErrorStatus TFeedWellData::dwgInFields (AcDbDwgFiler* pFiler)
|
||
{
|
||
XString xsName;
|
||
ReadString(pFiler, xsName);
|
||
m_csName = (const TCHAR*)xsName;
|
||
pFiler->readItem(&m_iDn);
|
||
pFiler->readItem(&m_nLength);
|
||
pFiler->readItem(&m_nGroundEle);
|
||
pFiler->readItem(&m_nUpEle);
|
||
pFiler->readItem(&m_nDownEle);
|
||
pFiler->readItem(&m_nFrondDownEle);
|
||
pFiler->readItem(&m_nDeep);
|
||
pFiler->readItem(&m_nI);
|
||
pFiler->readItem(&m_nWellRadius);
|
||
pFiler->readItem(&m_nSpare);
|
||
//pFiler->readItem(&m_bIsWell);
|
||
//pFiler->readItem(&m_bIsDropWell);
|
||
FilerRead(pFiler, m_bIsWell);
|
||
FilerRead(pFiler, m_bIsDropWell);
|
||
pFiler->readItem(&m_ID);
|
||
|
||
Adesk::UInt16 nNum=0;
|
||
pFiler->readItem(&nNum);
|
||
m_lstID.Reset();
|
||
for(Adesk::UInt16 i=0; i<nNum; i++) {
|
||
AcDbSoftPointerId id;
|
||
pFiler->readItem(&id);
|
||
m_lstID.Append(new AcDbSoftPointerId(id));
|
||
}
|
||
return pFiler->filerStatus();
|
||
}
|
||
|
||
Acad::ErrorStatus TFeedWellData::dwgOutFields(AcDbDwgFiler* pFiler) const
|
||
{
|
||
pFiler->writeItem((const TCHAR *)m_csName);
|
||
pFiler->writeItem(m_iDn);
|
||
pFiler->writeItem(m_nLength);
|
||
pFiler->writeItem(m_nGroundEle);
|
||
pFiler->writeItem(m_nUpEle);
|
||
pFiler->writeItem(m_nDownEle);
|
||
pFiler->writeItem(m_nFrondDownEle);
|
||
pFiler->writeItem(m_nDeep);
|
||
pFiler->writeItem(m_nI);
|
||
pFiler->writeItem(m_nWellRadius);
|
||
pFiler->writeItem(m_nSpare);
|
||
//pFiler->writeItem(m_bIsWell);
|
||
//pFiler->writeItem(m_bIsDropWell);
|
||
FilerWrite(pFiler, m_bIsWell);
|
||
FilerWrite(pFiler, m_bIsDropWell);
|
||
pFiler->writeItem(m_ID);
|
||
|
||
Adesk::UInt16 nCount=(Adesk::UInt16)m_lstID.Length();
|
||
pFiler->writeItem(nCount);
|
||
for(Adesk::UInt16 i=0; i<nCount; i++) {
|
||
AcDbSoftPointerId id = m_lstID[i];
|
||
pFiler->writeItem(id);
|
||
}
|
||
|
||
return pFiler->filerStatus();
|
||
}
|
||
|
||
|
||
|
||
TFeedWellData & TFeedWellData::operator = (const TFeedWellData &src)
|
||
{
|
||
CopyObject(src, *this);
|
||
return *this;
|
||
}
|
||
|
||
TFeedWellData::TFeedWellData(const TFeedWellData &src)
|
||
{
|
||
*this = src;
|
||
}
|
||
|
||
|
||
|
||
//////////////////////////////////////////////////////////////////////
|
||
// Construction/Destruction
|
||
//////////////////////////////////////////////////////////////////////
|
||
ACRX_DXF_DEFINE_MEMBERS(ATSVerticalSection, ATSEntity, AcDb::kDHL_CURRENT,
|
||
AcDb::kMReleaseCurrent, 1, ATS_VERTICALSECTION,
|
||
"ATS_VERTICALSECTION图形无法解析, 请下载上华软件|网址: www.shanghuasoft.com");
|
||
IMPLEMENT_TENTBASE(TDbVerticalSection);
|
||
const Adesk::UInt8 TDbVerticalSection::g_nVersion = 3; // cet 2016.5.11 modify 添加了新成员变量
|
||
|
||
|
||
//////////////////////////////////////////////////////////////////////
|
||
// Construction/Destruction
|
||
//////////////////////////////////////////////////////////////////////
|
||
|
||
TDbVerticalSection::TDbVerticalSection()
|
||
{
|
||
m_iScaleX = 100;
|
||
m_iScaleY = 50;
|
||
m_iCalcMode = 0;
|
||
m_nStartDeep = 0;
|
||
m_nMaxDeep = 0;
|
||
m_nMinDeep = 0;
|
||
m_nSpare = 0;
|
||
m_nGridScale = 1;
|
||
m_idTextLayer = NULL;
|
||
m_idGridLayer = NULL;
|
||
m_idSectLayer = NULL;
|
||
m_idDoteLayer = NULL;
|
||
m_sSheetHead = _T("井编号 设计地面标高(m) 埋设深度(m) 覆土厚度(m) 管内底标高(m) 管道长度(m) 管径(mm) 管道坡度 备注");
|
||
m_sSheetRow = _T("");
|
||
}
|
||
|
||
void TDbVerticalSection::CopyPropertiesFrom(AcDbEntity *pSrc,unsigned gMatchFlag)
|
||
{
|
||
assertWriteEnabled();
|
||
TDbVerticalSection *pSect = TDbVerticalSection::cast(pSrc);
|
||
if(pSect) {
|
||
m_iScaleX = pSect->m_iScaleX;
|
||
m_iScaleY = pSect->m_iScaleY;
|
||
m_iCalcMode = pSect->m_iCalcMode;
|
||
}
|
||
TDbEntity::CopyPropertiesFrom(pSrc, gMatchFlag);
|
||
}
|
||
|
||
Acad::ErrorStatus TDbVerticalSection::subGetClassID(CLSID* pClsid) const
|
||
{
|
||
return Acad::eOk;
|
||
}
|
||
|
||
Acad::ErrorStatus TDbVerticalSection::subGetOsnapPoints(AcDb::OsnapMode osnapMode, INT_PTR gsSelectionMark, const AcGePoint3d& ptPick, const AcGePoint3d& lastPoint, const AcGeMatrix3d& viewXform, AcGePoint3dArray& snapPoints, AcDbIntArray& geomIds) const
|
||
{
|
||
Acad::ErrorStatus es = TDbEntity::subGetOsnapPoints(osnapMode, gsSelectionMark, ptPick, lastPoint, viewXform, snapPoints, geomIds);
|
||
AcDbLine line1(m_ptTopLeft, m_ptBottomLeft);
|
||
line1.getOsnapPoints(osnapMode, gsSelectionMark, ptPick, lastPoint, viewXform, snapPoints, geomIds);
|
||
AcDbLine line2(m_ptBottomLeft, m_ptBottomRight);
|
||
line2.getOsnapPoints(osnapMode, gsSelectionMark, ptPick, lastPoint, viewXform, snapPoints, geomIds);
|
||
AcDbLine line3(m_ptTolRight, m_ptBottomRight);
|
||
line3.getOsnapPoints(osnapMode, gsSelectionMark, ptPick, lastPoint, viewXform, snapPoints, geomIds);
|
||
return es;
|
||
}
|
||
|
||
// 取得所有的夹点
|
||
Acad::ErrorStatus
|
||
TDbVerticalSection::subGetGripPoints(AcGePoint3dArray& gripPoints,
|
||
AcDbIntArray& osnapModes,
|
||
AcDbIntArray& geomIds) const
|
||
{
|
||
assertReadEnabled();
|
||
XPoint pt = m_ptIns;
|
||
ads_polar(pt, m_nLayoutRotation+PI, 10*GetPScale(), pt);
|
||
gripPoints.append(pt);
|
||
|
||
for(int i=0; i<m_lstPt.Length(); i++){
|
||
gripPoints.append(m_lstPt[i]);
|
||
}
|
||
// cet 2017.9.6 add 添加表格夹点,便于用户拖动对齐纵断面图
|
||
gripPoints.append(m_ptTopLeft);
|
||
gripPoints.append(m_ptTolRight);
|
||
gripPoints.append(m_ptBottomLeft);
|
||
gripPoints.append(m_ptBottomRight);
|
||
return Acad::eOk;
|
||
}
|
||
|
||
// 功能: 夹点操作
|
||
Acad::ErrorStatus
|
||
TDbVerticalSection::subMoveGripPointsAt(const AcDbIntArray& indices, const AcGeVector3d& offset)
|
||
{
|
||
assertWriteEnabled();
|
||
AcGeMatrix3d mat;
|
||
AcGeVector3d vtOffset=offset;
|
||
vtOffset.z=0;
|
||
mat.setToTranslation(vtOffset);
|
||
int idx=0;
|
||
|
||
for (int i = 0; i < indices.length(); i++) {
|
||
idx = indices[i];
|
||
if(idx == 0 || idx > m_lstPt.Length()) // cet 2017.9.6 modify 拖动底部两个夹点之一时,移动纵断面图
|
||
{
|
||
m_ptIns.TransformBy(mat);
|
||
ads_matrix mat2;
|
||
AsAdsMatrix(mat, mat2);
|
||
m_lstPt.TransUCS(mat2);
|
||
// cet 2017.9.6 add 更新表格夹点
|
||
m_ptTopLeft.TransformBy(mat);
|
||
m_ptTolRight.TransformBy(mat);
|
||
m_ptBottomLeft.TransformBy(mat);
|
||
m_ptBottomRight.TransformBy(mat);
|
||
}
|
||
else{
|
||
XPoint ptOffset = *m_lstPt[idx-1];
|
||
XPoint ptOld = ptOffset;
|
||
ptOffset.TransformBy(mat);
|
||
double dScaleY = m_iScaleY;
|
||
dScaleY = GetPScale() / dScaleY * 1000;//转化为毫米
|
||
double nDist = (ptOffset.y - ptOld.y)/dScaleY;
|
||
if(m_iCalcMode == 3){
|
||
m_lstFeedWell[(idx-1)*2]->m_nUpEle += nDist;
|
||
for(int j=0;j<m_lstWell.Length();j++){
|
||
if(m_lstWell[j]->m_csName == m_lstFeedWell[(idx-1)*2]->m_csName){
|
||
m_lstWell[j]->m_nUpEle = m_lstFeedWell[(idx-1)*2]->m_nUpEle;
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
else{
|
||
if((idx-1)*2 < 0 || (idx-1)*2 > m_lstWell.Length() - 1)
|
||
continue;
|
||
m_lstWell[(idx-1)*2]->m_nUpEle += nDist;
|
||
}
|
||
Calc();
|
||
}
|
||
}
|
||
Acad::ErrorStatus es=Acad::eOk;
|
||
return es;
|
||
}
|
||
|
||
Acad::ErrorStatus
|
||
TDbVerticalSection::GetGripText(int idx, CString &cs) const
|
||
{
|
||
Acad::ErrorStatus es=Acad::eOk;
|
||
// cet 2017.9.6 add 底部添加的两个夹点提示
|
||
if (idx > m_lstPt.Length())
|
||
{
|
||
cs=_T("移动");
|
||
return es;
|
||
}
|
||
switch(idx) {
|
||
case 0:
|
||
cs=_T("移动");
|
||
break;
|
||
default:
|
||
cs=_T("修改井面标高");
|
||
}
|
||
return es;
|
||
}
|
||
|
||
// 从DWG读入数据:
|
||
Acad::ErrorStatus TDbVerticalSection::dwgInFields(AcDbDwgFiler* pFiler)
|
||
{
|
||
assertWriteEnabled();
|
||
Acad::ErrorStatus es = TDbEntity::dwgInFields(pFiler);
|
||
if(es != Acad::eOk) return es;
|
||
|
||
es = TLabelStyle::dwgInFields(pFiler);
|
||
if(es != Acad::eOk) return es;
|
||
|
||
|
||
Adesk::UInt8 nVer;
|
||
pFiler->readItem(&nVer);
|
||
if(nVer>g_nVersion) {// Version is too new
|
||
return Acad::eMakeMeProxy;
|
||
}
|
||
pFiler->readItem((AcGePoint3d *)&m_ptIns);
|
||
pFiler->readItem(&m_iScaleX);
|
||
pFiler->readItem(&m_iScaleY);
|
||
pFiler->readItem(&m_iCalcMode);
|
||
pFiler->readItem(&m_nStartDeep);
|
||
pFiler->readItem(&m_nSpare);
|
||
pFiler->readItem(&m_nMaxDeep);
|
||
pFiler->readItem(&m_nMinDeep);
|
||
pFiler->readItem(&m_idTextLayer);
|
||
pFiler->readItem(&m_idGridLayer);
|
||
pFiler->readItem(&m_idSectLayer);
|
||
pFiler->readItem(&m_idDoteLayer);
|
||
ReadString(pFiler, m_sSheetHead);
|
||
|
||
Adesk::UInt16 nNum=0;
|
||
pFiler->readItem(&nNum);
|
||
m_lstWell.Reset();
|
||
|
||
for(Adesk::UInt16 i=0; i<nNum; i++) {
|
||
TWellData *pData = new TWellData;
|
||
pData->dwgInFields(pFiler, nVer);
|
||
m_lstWell.Append(pData);
|
||
}
|
||
|
||
if(m_iCalcMode == 3)//如果是给水系统,则重新构造链表
|
||
GetFeedWellListData(m_lstWell, m_lstFeedWell);
|
||
|
||
m_lstPt.Reset();
|
||
pFiler->readItem(&nNum);
|
||
for(i=0; i<nNum; i++) {
|
||
XPoint PtTemp;
|
||
pFiler->readItem((AcGePoint3d *)&PtTemp);
|
||
m_lstPt.NewAppend(PtTemp);
|
||
}
|
||
if(nVer > 1)
|
||
{
|
||
ReadString(pFiler, m_sSheetRow);
|
||
}
|
||
m_nGridScale = GetGridScale();
|
||
return pFiler->filerStatus();
|
||
}
|
||
|
||
Acad::ErrorStatus TDbVerticalSection::dwgOutFields(AcDbDwgFiler* pFiler) const
|
||
{
|
||
assertReadEnabled();
|
||
Acad::ErrorStatus es = TDbEntity::dwgOutFields(pFiler);
|
||
if(es != Acad::eOk) return es;
|
||
|
||
es = TLabelStyle::dwgOutFields(pFiler);
|
||
if(es != Acad::eOk) return es;
|
||
|
||
if(g_nSaveTArchVer==7)
|
||
pFiler->writeItem((Adesk::UInt8)1);
|
||
else if (g_nSaveTArchVer <= 10) // cet 2016.5.13 add
|
||
pFiler->writeItem((Adesk::UInt8)2);
|
||
else
|
||
pFiler->writeItem(g_nVersion);
|
||
|
||
pFiler->writeItem((const AcGePoint3d &)m_ptIns);
|
||
pFiler->writeItem(m_iScaleX);
|
||
pFiler->writeItem(m_iScaleY);
|
||
pFiler->writeItem(m_iCalcMode);
|
||
pFiler->writeItem(m_nStartDeep);
|
||
pFiler->writeItem(m_nSpare);
|
||
pFiler->writeItem(m_nMaxDeep);
|
||
pFiler->writeItem(m_nMinDeep);
|
||
pFiler->writeItem(m_idTextLayer);
|
||
pFiler->writeItem(m_idGridLayer);
|
||
pFiler->writeItem(m_idSectLayer);
|
||
pFiler->writeItem(m_idDoteLayer);
|
||
pFiler->writeItem((const TCHAR *)m_sSheetHead);
|
||
|
||
Adesk::UInt16 nCount=(Adesk::UInt16)m_lstWell.Length();
|
||
pFiler->writeItem(nCount);
|
||
|
||
int iVer = 1;
|
||
if(g_nSaveTArchVer==7)
|
||
iVer = 1;
|
||
else if (g_nSaveTArchVer <= 10) // cet 2016.5.13 add
|
||
iVer = 2;
|
||
else
|
||
iVer = g_nVersion;
|
||
|
||
for(Adesk::UInt16 i=0; i<nCount; i++) {
|
||
m_lstWell[i].dwgOutFields(pFiler, iVer);
|
||
}
|
||
|
||
nCount=(Adesk::UInt16)m_lstPt.Length();
|
||
pFiler->writeItem(nCount);
|
||
for(i=0; i<nCount; i++) {
|
||
pFiler->writeItem((AcGePoint3d &)m_lstPt[i]);
|
||
}
|
||
|
||
if(g_nSaveTArchVer > 7)
|
||
{
|
||
pFiler->writeItem((const TCHAR *)m_sSheetRow); //8.0数据
|
||
}
|
||
|
||
|
||
return pFiler->filerStatus();
|
||
}
|
||
|
||
Acad::ErrorStatus TDbVerticalSection::dxfInFields(AcDbDxfFiler* pFiler)
|
||
{
|
||
assertWriteEnabled();
|
||
Acad::ErrorStatus es=Acad::eOk;
|
||
es=TDbEntity::dxfInFields(pFiler);
|
||
return es;
|
||
}
|
||
|
||
Acad::ErrorStatus TDbVerticalSection::dxfOutFields(AcDbDxfFiler* pFiler) const
|
||
{
|
||
Acad::ErrorStatus es=Acad::eOk;
|
||
es=TDbEntity::dxfOutFields(pFiler);
|
||
return es;
|
||
}
|
||
|
||
// Active when being rotated, scaled, moved, etc.
|
||
Acad::ErrorStatus
|
||
TDbVerticalSection::subTransformBy(const AcGeMatrix3d& xform)
|
||
{
|
||
assertWriteEnabled();
|
||
m_ptIns.TransformBy(xform);
|
||
ads_matrix mat;
|
||
AsAdsMatrix(xform,mat);
|
||
m_lstPt.TransUCS(mat);
|
||
Acad::ErrorStatus es=Acad::eOk;
|
||
return es;
|
||
}
|
||
|
||
Acad::ErrorStatus TDbVerticalSection::subIntersectWith(const AcDbEntity* ent,
|
||
AcDb::Intersect intType,
|
||
AcGePoint3dArray& points,
|
||
int thisGsMarker,
|
||
int otherGsMarker) const
|
||
{
|
||
|
||
return Acad::eOk;
|
||
}
|
||
|
||
Acad::ErrorStatus TDbVerticalSection::subIntersectWith(const AcDbEntity* ent,
|
||
AcDb::Intersect intType,
|
||
const AcGePlane& projPlane,
|
||
AcGePoint3dArray& points,
|
||
int thisGsMarker,
|
||
int otherGsMarker) const
|
||
{
|
||
|
||
return Acad::eOk;
|
||
}
|
||
|
||
//const TCHAR* TDbVerticalSection::GetSheetRowHeight() const
|
||
//{
|
||
// const TEntityFields &fd = GetFields();
|
||
// CString sData;
|
||
// fd.GFD(_T("ROW_HEIGHT"), sData);
|
||
// return (const TCHAR*)sData;
|
||
//}
|
||
//
|
||
//void TDbVerticalSection::SetSheetRowHeight(const TCHAR* szSheetRowHeight)
|
||
//{
|
||
// assertWriteEnabled();
|
||
// TEntityFields &fd = Fields();
|
||
// fd.SFD(_T("ROW_HEIGHT"), szSheetRowHeight);
|
||
//}
|
||
|
||
|
||
//判断是否是节点?
|
||
BOOL IsNodeWell(AcDbObjectId id)
|
||
{
|
||
OPENOBJ_BEGIN(id, AcDb::kForRead, TDbWell, pEquip);
|
||
if(pEquip){
|
||
AcDbObjectId eqId = pEquip->GetBlock2d();
|
||
CString csBlkName = GetSymbolName(eqId).cs();
|
||
if(_tcsicmp(_T("$TwtSys$00000389"), csBlkName) == 0)
|
||
return TRUE;
|
||
}
|
||
OPENOBJ_END();
|
||
return FALSE;
|
||
}
|
||
|
||
void TDbVerticalSection::DrawBreakPipe(XPoint ptStart, XPoint ptEnd, XExplodeDraw &dc) const
|
||
{
|
||
AcDbObjectId idLayerOld=dc.GetLayerId();
|
||
dc.SetLayer(m_idSectLayer);
|
||
|
||
XPoint ptMid, ptTmp1, ptTmp2;
|
||
XLine l1(ptStart, ptEnd);
|
||
ptMid = l1.MidPoint();
|
||
|
||
XLine l2(ptStart, ptMid);
|
||
ptTmp1 = l2.MidPoint();
|
||
ads_polar(ptTmp1, m_nLayoutRotation+PI, l2.GetLength()/4, ptTmp1);
|
||
XArc arc(ptStart, ptTmp1, ptMid);
|
||
|
||
dc.DrawArc(arc,0);
|
||
|
||
XLine l3(ptEnd, ptMid);
|
||
ptTmp2 = l3.MidPoint();
|
||
ads_polar(ptTmp2, m_nLayoutRotation, l3.GetLength()/4, ptTmp2);
|
||
XArc arc2(ptMid, ptTmp2, ptEnd);
|
||
dc.DrawArc(arc2,0);
|
||
dc.SetLayer(idLayerOld);
|
||
}
|
||
|
||
void TDbVerticalSection::DrawGridLine(XPoint ptStart, XPoint ptEnd, XExplodeDraw &dc) const
|
||
{
|
||
|
||
//2011-9-30 SR 关闭图层,打印的时候依然打印。dc.DrawLine存在问题,改viewDraw.Polyline正常。无法解释李夫银在查
|
||
// if(m_nGridScale < 0.01)
|
||
// return;
|
||
// AcDbObjectId idLayerOld=dc.GetLayerId();
|
||
// dc.SetLayer(m_idGridLayer);
|
||
// XLine pLine(ptStart, ptEnd, 1);
|
||
// dc.DrawLine(pLine,0);
|
||
// dc.SetLayer(idLayerOld);
|
||
|
||
if(m_nGridScale < 0.01)
|
||
return;
|
||
AcDbObjectId idLayerOld=dc.GetLayerId();
|
||
dc.SetLayer(m_idGridLayer);
|
||
XLine pLine(ptStart, ptEnd, 1);
|
||
if (_tcscmp(dc.Desc(), XAcGiViewDraw::Descriptor())==0 && dc.IsPlotGeneration()) //如果在打印,换一种方式
|
||
{
|
||
XAcGiViewDraw &viewDraw = (XAcGiViewDraw &)dc;
|
||
XCurveSegment seg;
|
||
seg = pLine;
|
||
XPoly2D poly;
|
||
seg.AsPoly2D(poly);
|
||
AcDbPolyline pline;
|
||
PolyConvert(poly, pline);
|
||
viewDraw.Polyline(pline);
|
||
}
|
||
else
|
||
dc.DrawLine(pLine,0);
|
||
dc.SetLayer(idLayerOld);
|
||
}
|
||
|
||
void TDbVerticalSection::DrawDoteLine(XPoint ptStart, XPoint ptEnd, XExplodeDraw &dc) const
|
||
{
|
||
AcDbObjectId idLayerOld=dc.GetLayerId();
|
||
dc.SetLayer(m_idDoteLayer);
|
||
XLine pLine(ptStart, ptEnd, 1);
|
||
if (_tcscmp(dc.Desc(), XAcGiViewDraw::Descriptor())==0 && dc.IsPlotGeneration())//如果在打印,换一种方式
|
||
{
|
||
XAcGiViewDraw &viewDraw = (XAcGiViewDraw &)dc;
|
||
XCurveSegment seg;
|
||
seg = pLine;
|
||
XPoly2D poly;
|
||
seg.AsPoly2D(poly);
|
||
AcDbPolyline pline;
|
||
PolyConvert(poly, pline);
|
||
viewDraw.Polyline(pline);
|
||
}
|
||
else
|
||
dc.DrawLine(pLine,0);
|
||
dc.SetLayer(idLayerOld);
|
||
}
|
||
|
||
void TDbVerticalSection::DrawLine(XPoint ptStart, XPoint ptEnd, XExplodeDraw &dc) const
|
||
{
|
||
AcDbObjectId idLayerOld=dc.GetLayerId();
|
||
dc.SetLayer(m_idSectLayer);
|
||
XLine pLine(ptStart, ptEnd, 1);
|
||
dc.DrawLine(pLine,0);
|
||
dc.SetLayer(idLayerOld);
|
||
}
|
||
|
||
void TDbVerticalSection::DrawPLine(XPoint ptStart, XPoint ptEnd, XExplodeDraw &dc, double nWeight) const
|
||
{
|
||
AcDbObjectId idLayerOld=dc.GetLayerId();
|
||
dc.SetLayer(m_idSectLayer);
|
||
XLine pLine(ptStart, ptEnd, 1);
|
||
XCurveSegment seg;
|
||
seg = pLine;
|
||
XPoly2D poly;
|
||
seg.AsPoly2D(poly);
|
||
AcDbPolyline pline;
|
||
PolyConvert(poly, pline);
|
||
XAcGiViewDraw &viewDraw = (XAcGiViewDraw &)dc;
|
||
int nNum = pline.numVerts();
|
||
if (nNum > 0) {
|
||
for (int k=0;k<nNum; k++) {
|
||
pline.setWidthsAt(k,nWeight,nWeight);
|
||
}
|
||
viewDraw.Polyline(pline);
|
||
}
|
||
dc.SetLayer(idLayerOld);
|
||
}
|
||
|
||
void TDbVerticalSection::DrawText(XPoint ptText, const TCHAR*szText, XExplodeDraw::TextAlignment Align, XExplodeDraw &dc, double nRotation) const
|
||
{
|
||
nRotation = m_nLayoutRotation + nRotation;
|
||
AcDbObjectId idTextStyle = m_idTextStyle;
|
||
if(!idTextStyle)
|
||
idTextStyle = InitTextStyle(_T("Standard"));
|
||
AcDbObjectId idLayerOld=dc.GetLayerId();
|
||
dc.SetLayer(m_idTextLayer);
|
||
TDbText text;
|
||
text.SetPScale(GetPScale());
|
||
text.setLayer(m_idTextLayer);
|
||
text.SetStyleId(idTextStyle);
|
||
text.SetText(szText);
|
||
text.SetRotation(nRotation);
|
||
text.SetLocation(ptText);
|
||
text.SetHeight(m_dTextHeight);
|
||
text.SetAlignment(Align);
|
||
text.ExplodeOrDraw2d(dc);
|
||
|
||
dc.SetLayer(idLayerOld);
|
||
}
|
||
|
||
void TDbVerticalSection::DrawScaleArrow(XPoint ptStart, XPoint ptEnd, const TCHAR*szText, XExplodeDraw &dc) const
|
||
{
|
||
AcDbObjectId idLayerOld=dc.GetLayerId();
|
||
dc.SetLayer(m_idTextLayer);
|
||
|
||
AcDbObjectId idTextStyle = m_idTextStyle;
|
||
if(!idTextStyle)
|
||
idTextStyle = InitTextStyle(_T("Standard"));
|
||
TDbSymbArrow pArrow;
|
||
pArrow.setPropertiesFrom(this);
|
||
|
||
XPoly2D poly;
|
||
poly.AppendNode(ptStart);
|
||
poly.AppendNode(ptEnd);
|
||
pArrow.SetPoly2D(poly);
|
||
pArrow.setLayer(m_idTextLayer);
|
||
pArrow.SetTextLayerId(m_idTextLayer);
|
||
pArrow.SetTextStyleId(idTextStyle);
|
||
pArrow.SetTextHeight(m_dTextHeight);
|
||
pArrow.SetTextAlign(TDbSymbArrow::kAlignMid);
|
||
pArrow.SetArrowSize(2);
|
||
pArrow.SetText(szText);
|
||
XPoint ptText = pArrow.GetDefaultTextLocation();
|
||
pArrow.SetTextLocation(ptText);
|
||
pArrow.ExplodeOrDraw2d(dc);
|
||
|
||
dc.SetLayer(idLayerOld);
|
||
}
|
||
|
||
void TDbVerticalSection::DrawEllipse(XPoint ptCen, double nRadiusLong, double nRadiusShort, AcDbObjectId idLay, XExplodeDraw &dc, bool *pRet) const
|
||
{
|
||
if (pRet != NULL)
|
||
{
|
||
*pRet = false;
|
||
}
|
||
// cet 2016.7.5 add 超出管井显示区域
|
||
AcGeVector3d vtDir = AcGeVector3d::kXAxis;
|
||
vtDir.rotateBy(m_nLayoutRotation + PI * 0.5, AcGeVector3d::kZAxis);
|
||
XLine line(ptCen, ptCen + vtDir * 10, INFINITE);
|
||
XPoint pt1, pt2;
|
||
m_ptTop.Project(&line, pt1);
|
||
m_ptBottom.Project(&line, pt2);
|
||
if (pt1.Distance(ptCen) + pt2.Distance(ptCen) > pt1.Distance(pt2) + 0.001 &&
|
||
(pt1.Distance(ptCen) > pt2.Distance(ptCen) && ptCen.Distance(pt2) > nRadiusLong + 0.0001 ||
|
||
pt1.Distance(ptCen) < pt2.Distance(ptCen) && ptCen.Distance(pt1) > nRadiusLong + 0.0001))
|
||
{
|
||
return;
|
||
}
|
||
AcDbEllipse ellipse;
|
||
double ratio = nRadiusShort/nRadiusLong;
|
||
XPoint ptTem;
|
||
ads_polar(ptCen, m_nLayoutRotation+PI/2, nRadiusLong, ptTem);
|
||
AcGeVector3d majorAxis = ptTem.AsAcGePoint3d() - ptCen.AsAcGePoint3d();
|
||
// cet 2016.7.5 add 长轴小于短轴
|
||
if (nRadiusLong + 0.001 < nRadiusShort)
|
||
{
|
||
ads_polar(ptCen, m_nLayoutRotation, nRadiusShort, ptTem);
|
||
majorAxis = ptTem.AsAcGePoint3d() - ptCen.AsAcGePoint3d();
|
||
ratio = nRadiusLong/nRadiusShort;
|
||
}
|
||
ellipse.set(ptCen, AcGeVector3d::kZAxis, majorAxis, ratio);
|
||
int iColorIdx(7);
|
||
OPENOBJ_BEGIN(idLay, AcDb::kForRead, AcDbLayerTableRecord, pRec);
|
||
if(pRec){
|
||
AcCmColor color = pRec->color();
|
||
iColorIdx = color.colorIndex();
|
||
}
|
||
OPENOBJ_END();
|
||
ellipse.setColorIndex(iColorIdx);
|
||
ellipse.setLayer(m_idGridLayer); // cet 2018.2.8 add
|
||
dc.DrawEntity(ellipse);
|
||
if (pRet != NULL)
|
||
{
|
||
*pRet = true;
|
||
}
|
||
}
|
||
|
||
|
||
int TDbVerticalSection::HitTestOnVS2(XPoint pt, double &nColWidth, double &nHeight, XPoint &ptRet)
|
||
{
|
||
|
||
// if(dc.IsFullExplode())
|
||
// {
|
||
// TDbText text;
|
||
// text.setPropertiesFrom(this);
|
||
// text.SetStyleId(m_idTextStyle);
|
||
// text.SetText(m_sText);
|
||
// text.SetRotation(GetTextRotation());
|
||
// text.SetLocation(ptLocation);
|
||
// text.SetHeight(m_dTextHeight);
|
||
// text.SetAlignment(XExplodeDraw::kMiddleCenter);
|
||
//
|
||
// }
|
||
// else
|
||
// {
|
||
// TDbText text;
|
||
// text.setPropertiesFrom(this);
|
||
// text.SetStyleId(m_idTextStyle);
|
||
// text.SetText(m_sText);
|
||
// text.SetRotation(GetTextRotation());
|
||
// text.SetLocation(ptLocation);
|
||
// text.SetHeight(m_dTextHeight);
|
||
// text.SetAlignment(XExplodeDraw::kMiddleCenter);
|
||
//
|
||
// }
|
||
|
||
XPointList lstPt;
|
||
XPoint ptIns = m_ptIns;
|
||
double dScaleY = m_iScaleY;
|
||
double dScaleX = m_iScaleX;
|
||
dScaleX = GetPScale() / dScaleX * 1000;
|
||
dScaleY = GetPScale() / dScaleY * 1000;//转化为毫米
|
||
|
||
XPoint ptStart, ptEnd;
|
||
ptStart = ptIns;
|
||
double dPipeLen = 0;
|
||
//1.0 创建点列表,其中z坐标记录宽度
|
||
lstPt.Reset();
|
||
|
||
ptIns.z = m_lstWell[0]->m_nWellRadius;
|
||
// if(DocGetMeterUnitDraw())
|
||
ptIns.z = ptIns.z *GetPScale()/100;
|
||
|
||
lstPt.NewAppend(ptIns);
|
||
// cet 2016.5.10 modify 考虑起点是断管,且断管连接着化粪池的情况
|
||
if(m_iCalcMode < 100) // 从左往右
|
||
{
|
||
if (m_lstWell[0]->m_csName == _T("断管") && m_lstWell.Length() > 2 && m_lstWell[2]->m_csName == _T("HC"))
|
||
{
|
||
OPENOBJ_BEGIN(m_lstWell[2]->m_ID, AcDb::kForRead, TDbPool, pEquip);
|
||
if(pEquip != NULL)
|
||
{
|
||
double dPoolLength = pEquip->GetPoolLength();
|
||
if(!DocGetMeterUnitDraw())
|
||
dPoolLength = dPoolLength / 1000;
|
||
ads_polar(ptIns, m_nLayoutRotation, dPoolLength * dScaleX * 0.5, ptIns);
|
||
ptIns.z = dPoolLength * dScaleX;
|
||
ptIns.z = ptIns.z *GetPScale()/100;
|
||
lstPt.Reset();
|
||
lstPt.NewAppend(ptIns);
|
||
ads_polar(ptIns, m_nLayoutRotation, dPoolLength * dScaleX * 0.5, ptIns);
|
||
ptStart = ptIns;
|
||
}
|
||
OPENOBJ_END();
|
||
}
|
||
}
|
||
else // 从右到左
|
||
{
|
||
int nCount = m_lstWell.Length();
|
||
if (m_lstWell[nCount - 1]->m_csName == _T("断管") && nCount > 3 && m_lstWell[nCount -3]->m_csName == _T("HC"))
|
||
{
|
||
OPENOBJ_BEGIN(m_lstWell[nCount - 3]->m_ID, AcDb::kForRead, TDbPool, pEquip);
|
||
if(pEquip != NULL)
|
||
{
|
||
double dPoolLength = pEquip->GetPoolLength();
|
||
if(!DocGetMeterUnitDraw())
|
||
dPoolLength = dPoolLength / 1000;
|
||
ads_polar(ptIns, m_nLayoutRotation, dPoolLength * dScaleX * 0.5, ptIns);
|
||
ptIns.z = dPoolLength * dScaleX;
|
||
ptIns.z = ptIns.z *GetPScale()/100;
|
||
lstPt.Reset();
|
||
lstPt.NewAppend(ptIns);
|
||
ads_polar(ptIns, m_nLayoutRotation, dPoolLength * dScaleX * 0.5, ptIns);
|
||
ptStart = ptIns;
|
||
}
|
||
OPENOBJ_END();
|
||
}
|
||
}
|
||
double dEleStart(0);
|
||
|
||
if(m_iCalcMode < 100) // 从左往右 原代码
|
||
dEleStart = m_lstWell[0]->m_nUpEle;
|
||
else // 从右向左 王辉 添加 08-05-05
|
||
dEleStart = m_lstWell[m_lstWell.Length() - 1]->m_nUpEle;
|
||
|
||
double dLastEle = dEleStart;
|
||
if(m_iCalcMode < 100) // 从左往右
|
||
{
|
||
for(int i=0;i<m_lstWell.Length();i++){
|
||
double nEle = m_lstWell[i]->m_nUpEle - dLastEle;//地面标高
|
||
if(m_lstWell[i]->m_bIsWell){ //井
|
||
if(dPipeLen > 0){
|
||
ads_polar(ptStart, m_nLayoutRotation, dPipeLen/2, ptEnd);
|
||
ads_polar(ptEnd, m_nLayoutRotation+PI/2, nEle*dScaleY, ptEnd);
|
||
ptEnd.z = dPipeLen;
|
||
lstPt.NewAppend(ptEnd);
|
||
dLastEle = m_lstWell[i]->m_nUpEle;
|
||
|
||
ads_polar(ptStart, m_nLayoutRotation, dPipeLen, ptEnd);
|
||
ads_polar(ptEnd, m_nLayoutRotation+PI/2, nEle*dScaleY, ptEnd);
|
||
|
||
if(m_lstWell[i]->m_csName == _T("HC")){
|
||
OPENOBJ_BEGIN(m_lstWell[i]->m_ID, AcDb::kForRead, TDbPool, pEquip);
|
||
if(pEquip){
|
||
double dPoolLength = pEquip->GetPoolLength();
|
||
if(!DocGetMeterUnitDraw())
|
||
dPoolLength = dPoolLength / 1000;
|
||
ads_polar(ptEnd, m_nLayoutRotation, dPoolLength / 2 * dScaleX, ptEnd);
|
||
ptEnd.z = dPoolLength * dScaleX;
|
||
lstPt.NewAppend(ptEnd);
|
||
ads_polar(ptEnd, m_nLayoutRotation, dPoolLength / 2 * dScaleX, ptEnd);
|
||
ptStart = ptEnd;
|
||
}
|
||
OPENOBJ_END();
|
||
}
|
||
else
|
||
{
|
||
ptEnd.z = m_lstWell[i]->m_nWellRadius;
|
||
// if(DocGetMeterUnitDraw())
|
||
ptEnd.z = ptEnd.z *GetPScale()/100;
|
||
|
||
lstPt.NewAppend(ptEnd);
|
||
ptStart = ptEnd;
|
||
}
|
||
}
|
||
dPipeLen = 0;
|
||
}
|
||
else if(!m_lstWell[i]->m_bIsWell){ //管
|
||
dPipeLen = m_lstWell[i]->m_nLength * dScaleX;
|
||
if(m_lstWell[i-1]->m_csName == _T("断管"))
|
||
dPipeLen = 0;
|
||
}
|
||
}
|
||
}
|
||
else // 从右往左
|
||
{
|
||
for(int i=m_lstWell.Length() - 1; i >= 0; --i)
|
||
{
|
||
double nEle = m_lstWell[i]->m_nUpEle - dLastEle;//地面标高
|
||
if(m_lstWell[i]->m_bIsWell)
|
||
{ //井
|
||
if(dPipeLen > 0)
|
||
{
|
||
ads_polar(ptStart, m_nLayoutRotation, dPipeLen/2, ptEnd);
|
||
ads_polar(ptEnd, m_nLayoutRotation+PI/2, nEle*dScaleY, ptEnd);
|
||
ptEnd.z = dPipeLen;
|
||
lstPt.NewAppend(ptEnd);
|
||
dLastEle = m_lstWell[i]->m_nUpEle;
|
||
ads_polar(ptStart, m_nLayoutRotation, dPipeLen, ptEnd);
|
||
ads_polar(ptEnd, m_nLayoutRotation+PI/2, nEle*dScaleY, ptEnd);
|
||
|
||
if(m_lstWell[i]->m_csName == _T("HC"))
|
||
{
|
||
OPENOBJ_BEGIN(m_lstWell[i]->m_ID, AcDb::kForRead, TDbPool, pEquip);
|
||
if(pEquip){
|
||
double dPoolLength = pEquip->GetPoolLength();
|
||
if(!DocGetMeterUnitDraw())
|
||
dPoolLength = dPoolLength / 1000;
|
||
ads_polar(ptEnd, m_nLayoutRotation, dPoolLength / 2 * dScaleX, ptEnd);
|
||
ptEnd.z = dPoolLength * dScaleX;
|
||
lstPt.NewAppend(ptEnd);
|
||
ads_polar(ptEnd, m_nLayoutRotation, dPoolLength / 2 * dScaleX, ptEnd);
|
||
ptStart = ptEnd;
|
||
}
|
||
OPENOBJ_END();
|
||
}
|
||
else
|
||
{
|
||
ptEnd.z = m_lstWell[i]->m_nWellRadius;
|
||
// if(DocGetMeterUnitDraw())
|
||
ptEnd.z = ptEnd.z *GetPScale()/100;
|
||
lstPt.NewAppend(ptEnd);
|
||
ptStart = ptEnd;
|
||
}
|
||
}
|
||
dPipeLen = 0;
|
||
}
|
||
else if(!m_lstWell[i]->m_bIsWell) //管
|
||
{
|
||
dPipeLen = m_lstWell[i]->m_nLength * dScaleX;
|
||
if(m_lstWell[i+1]->m_csName == _T("断管"))
|
||
dPipeLen = 0;
|
||
}
|
||
}
|
||
}
|
||
int ret=-1;
|
||
double nRotWcs=Layout2Wcs(0);
|
||
int len = lstPt.Length();
|
||
int nWell = m_lstWell.Length();
|
||
//2.0 根据点列表,判断落点
|
||
for(int i=0;i<len;i++){
|
||
|
||
XPoint ptTmp = *lstPt[i];
|
||
XPoint ptLeft, ptRight;
|
||
double dLen = ptTmp.z;
|
||
dLen = fabs(dLen); // cet 2011.11.1 add 方井时半径为负值
|
||
ptTmp.z = 0;
|
||
|
||
ads_polar(ptTmp, m_nLayoutRotation+PI, dLen / 2, ptLeft);
|
||
ads_polar(ptTmp, m_nLayoutRotation, dLen / 2, ptRight);
|
||
XLine lnLeft(ptLeft, nRotWcs+PI/2);
|
||
XLine lnRight(ptRight, nRotWcs+PI/2);
|
||
int nSide1 = lnLeft.OnWhichSide(pt);
|
||
int nSide2 = lnRight.OnWhichSide(pt);
|
||
if(nSide1==OFFSET_RIGHT && nSide2==OFFSET_LEFT)
|
||
{
|
||
ret = i;
|
||
if(m_iCalcMode < 100) // 原来代码 按选择井的顺序画
|
||
{
|
||
// 正画
|
||
if(m_lstWell[ret]->m_bIsWell)
|
||
nHeight = (m_lstWell[ret]->m_nUpEle - m_lstWell[ret]->m_nDownEle)*dScaleY;
|
||
else
|
||
nHeight = (m_lstWell[ret-1]->m_nUpEle - m_lstWell[ret-1]->m_nDownEle)*dScaleY;
|
||
}
|
||
else // add by 王辉 按选择井的反顺序画 08-05-05
|
||
{
|
||
// 倒画
|
||
if(m_lstWell[ret]->m_bIsWell)
|
||
nHeight = (m_lstWell[nWell - ret - 1]->m_nUpEle - m_lstWell[nWell - ret - 1]->m_nDownEle)*dScaleY;
|
||
else
|
||
nHeight = (m_lstWell[nWell - ret]->m_nUpEle - m_lstWell[nWell - ret]->m_nDownEle)*dScaleY;
|
||
|
||
}
|
||
nColWidth = dLen*2;
|
||
ptRet = ptTmp;
|
||
break;
|
||
}
|
||
|
||
}
|
||
|
||
return ret;
|
||
}
|
||
|
||
|
||
void TDbVerticalSection::UpdateHidePipes()
|
||
{
|
||
//本图所有管线
|
||
DList<AcDbObjectId> lstAllPipe;
|
||
GetAllPipes(lstAllPipe);
|
||
// 管网中的管道
|
||
DList<AcDbObjectId> lstPipe;
|
||
for(int i = 0; i < m_lstWell.Length(); ++i)
|
||
{
|
||
if(!m_lstWell[i]->m_bIsWell)
|
||
{
|
||
lstPipe.Append(new AcDbObjectId(m_lstWell[i]->m_ID));
|
||
}
|
||
}
|
||
// 获取所有交叉信息
|
||
std::vector<CrossPoint> vecCrossPoint;
|
||
CalcCrossPipes(lstPipe, lstAllPipe, vecCrossPoint, true);
|
||
// 清除管道遮挡信息,避免出错
|
||
ClearHidePipes();
|
||
// 添加遮挡管道信息
|
||
TEntityFields &fd = Fields();
|
||
if (fd.SFD(_T("HidePipesNum"), (Adesk::UInt16)vecCrossPoint.size()))
|
||
{
|
||
std::vector<CrossPoint>::iterator it, itEnd = vecCrossPoint.end();
|
||
CString sKey;
|
||
int nIndex = 0;
|
||
for (it = vecCrossPoint.begin(); it != itEnd; ++it)
|
||
{
|
||
sKey.Format(_T("HidePipe_%d"), nIndex);
|
||
++nIndex;
|
||
it->WriteCrossPoint(fd, sKey);
|
||
}
|
||
}
|
||
}
|
||
|
||
CString TDbVerticalSection::GetFillingPattern() const
|
||
{
|
||
const TEntityFields &fd = GetFields();
|
||
CString sPattern = _T("AR-HBONE");
|
||
fd.GFD(_T("FILLING_PATTERN"), sPattern);
|
||
return sPattern;
|
||
}
|
||
|
||
void TDbVerticalSection::SetFillingPattern(const CString &sPattern)
|
||
{
|
||
assertWriteEnabled();
|
||
TEntityFields &fd = Fields();
|
||
fd.SFD(_T("FILLING_PATTERN"), sPattern);
|
||
}
|
||
|
||
double TDbVerticalSection::GetFillingRatio() const
|
||
{
|
||
const TEntityFields &fd = GetFields();
|
||
double dRatio = 0.5;
|
||
fd.GFD(_T("FILLING_RATIO"), dRatio);
|
||
return dRatio;
|
||
}
|
||
|
||
void TDbVerticalSection::SetFillingRatio(double dRatio)
|
||
{
|
||
assertWriteEnabled();
|
||
TEntityFields &fd = Fields();
|
||
fd.SFD(_T("FILLING_RATIO"), dRatio);
|
||
}
|
||
|
||
Adesk::UInt16 TDbVerticalSection::GetFillingColor() const
|
||
{
|
||
const TEntityFields &fd = GetFields();
|
||
Adesk::UInt16 nColor = 256;
|
||
fd.GFD(_T("FILLING_COLOR"), nColor);
|
||
return nColor;
|
||
}
|
||
|
||
void TDbVerticalSection::SetFillingColor(Adesk::UInt16 nColor)
|
||
{
|
||
assertWriteEnabled();
|
||
TEntityFields &fd = Fields();
|
||
fd.SFD(_T("FILLING_COLOR"), nColor);
|
||
}
|
||
|
||
/*
|
||
int TDbVerticalSection::HitTestOnVS2(XPoint pt, double &nColWidth, double &nHeight, XPoint &ptRet)
|
||
{
|
||
double dScaleY = m_iScaleY;
|
||
dScaleY = GetPScale() / dScaleY * 1000;//转化为毫米
|
||
double dScaleX = m_iScaleX;
|
||
dScaleX = GetPScale() / dScaleX * 1000;
|
||
|
||
pt.z=0;
|
||
int ret=-1;
|
||
double dWellRadius = 4 * GetPScale();
|
||
assertReadEnabled();
|
||
double nRotWcs=Layout2Wcs(0);
|
||
int len = m_lstPt.Length();
|
||
int nWell = m_lstWell.Length(); // add by 王辉 08-05-05
|
||
|
||
BOOL bHasPool = FALSE;
|
||
for(int i=0;i<len;i++){
|
||
if(m_lstWell[i]->m_csName == _T("HC"))
|
||
{
|
||
bHasPool = TRUE;
|
||
break;
|
||
}
|
||
}
|
||
if(bHasPool)
|
||
{
|
||
}
|
||
|
||
|
||
for(int i=0;i<len;i++){
|
||
double nWellRadius = dWellRadius;
|
||
XPoint ptTmp = *m_lstPt[i];
|
||
XPoint ptLeft, ptRight;
|
||
//2009.6.8
|
||
// if(m_lstWell[i]->m_csName == _T("HC"))
|
||
// {
|
||
// OPENOBJ_BEGIN(m_lstWell[i]->m_ID, AcDb::kForRead, TDbPool, pEquip);
|
||
// if(pEquip){
|
||
// double dPoolLen = pEquip->GetSizeX();
|
||
// if(dPoolLen > 100.0)//图纸是毫米单位
|
||
// dPoolLen = dPoolLen / 1000.0;
|
||
// nWellRadius = dPoolLen * dScaleX;//化粪池的长度
|
||
// }
|
||
// OPENOBJ_END();
|
||
//
|
||
// }
|
||
|
||
ads_polar(ptTmp, m_nLayoutRotation+PI, nWellRadius, ptLeft);
|
||
ads_polar(ptTmp, m_nLayoutRotation, nWellRadius, ptRight);
|
||
XLine lnLeft(ptLeft, nRotWcs+PI/2);
|
||
XLine lnRight(ptRight, nRotWcs+PI/2);
|
||
int nSide1 = lnLeft.OnWhichSide(pt);
|
||
int nSide2 = lnRight.OnWhichSide(pt);
|
||
if(nSide1==OFFSET_RIGHT && nSide2==OFFSET_LEFT)
|
||
{
|
||
ret = i*2;
|
||
if(m_iCalcMode < 100) // 原来代码 按选择井的顺序画
|
||
{
|
||
// 正画
|
||
nHeight = (m_lstWell[ret]->m_nUpEle - m_lstWell[ret]->m_nDownEle)*dScaleY;
|
||
}
|
||
else // add by 王辉 按选择井的反顺序画 08-05-05
|
||
{
|
||
// 倒画
|
||
nHeight = (m_lstWell[nWell - ret - 1]->m_nUpEle - m_lstWell[nWell - ret - 1]->m_nDownEle)*dScaleY;
|
||
}
|
||
nColWidth = nWellRadius*2;
|
||
ptRet = ptTmp;
|
||
break;
|
||
}
|
||
if(i != len-1){
|
||
XPoint ptTmp2 = *m_lstPt[i+1];
|
||
XLine line(ptTmp, ptTmp2);
|
||
XPoint ptMid;
|
||
line.MidPoint(ptMid);
|
||
double nLen = 0.0;
|
||
if(m_iCalcMode < 100) // 原来代码 按选择井的顺序画
|
||
{
|
||
// 正画
|
||
nLen = m_lstWell[i*2+1]->m_nLength* dScaleX;
|
||
}
|
||
else // add by 王辉 按选择井的反顺序画 08-05-05
|
||
{
|
||
// 倒画
|
||
nLen = m_lstWell[nWell - i*2 - 2]->m_nLength* dScaleX;
|
||
}
|
||
ads_polar(ptMid, m_nLayoutRotation+PI, nLen/2, ptLeft);
|
||
ads_polar(ptMid, m_nLayoutRotation, nLen/2, ptRight);
|
||
XLine lnLeft2(ptLeft, nRotWcs+PI/2);
|
||
XLine lnRight2(ptRight, nRotWcs+PI/2);
|
||
int nSide3 = lnLeft2.OnWhichSide(pt);
|
||
int nSide4 = lnRight2.OnWhichSide(pt);
|
||
if(nSide3==OFFSET_RIGHT && nSide4==OFFSET_LEFT)
|
||
{
|
||
ret = i*2+1;
|
||
if(m_iCalcMode < 100) // 原来代码 按选择井的顺序画
|
||
{
|
||
// 正画
|
||
nHeight = (m_lstWell[i*2]->m_nUpEle - m_lstWell[i*2]->m_nDownEle)*dScaleY;
|
||
}
|
||
else // add by 王辉 按选择井的反顺序画 08-05-05
|
||
{
|
||
// 倒画
|
||
nHeight = (m_lstWell[nWell - i*2 - 1]->m_nUpEle - m_lstWell[nWell - i*2 - 1]->m_nDownEle)*dScaleY;
|
||
}
|
||
nColWidth = (nLen-nWellRadius)*2;
|
||
ptRet = ptMid;
|
||
break;
|
||
}
|
||
}
|
||
|
||
}
|
||
return ret;
|
||
}
|
||
*/
|
||
|
||
int TDbVerticalSection::HitTestOnVS(XPoint pt, double &nColWidth, double &nHeight, XPoint &ptRet)
|
||
{
|
||
pt.z=0;
|
||
|
||
|
||
AcDbVoidPtrArray entSet;
|
||
explode(entSet);
|
||
int len=entSet.length();
|
||
|
||
//计算纵断面高度
|
||
double dScaleY = m_iScaleY;
|
||
double dScaleX = m_iScaleX;
|
||
dScaleX = GetPScale() / dScaleX * 1000;
|
||
dScaleY = GetPScale() / dScaleY * 1000;//转化为毫米
|
||
double nHighEle = m_nMaxDeep;
|
||
double nLowEle = m_nMinDeep;
|
||
int iHighEle = (int)(nHighEle + 1);
|
||
int iLowEle = (int)nLowEle;
|
||
if(fabs(nLowEle) > iLowEle && nLowEle < 0)
|
||
iLowEle --;
|
||
|
||
int iAllMeter = iHighEle - iLowEle;
|
||
nHeight = iAllMeter*dScaleY;
|
||
int ret=-1;
|
||
for(int i=0; i<len; i++) {
|
||
if(ret > -1)
|
||
break;
|
||
AcDbEntity *pEnt=(AcDbEntity *)entSet[i];
|
||
TDbSheet *pSheet = NULL;
|
||
if(pSheet = TDbSheet::cast(pEnt)){
|
||
int nColNum=pSheet->GetColumnNum();
|
||
XPoint ptTopLeft=pSheet->GetTopLeft(FALSE);
|
||
double nRotWcs=Layout2Wcs(0);
|
||
for(int n=0; n<nColNum; n++) {
|
||
XLine lnLeft(ptTopLeft, nRotWcs+PI/2);
|
||
nColWidth=pSheet->GetColumnWidth(n, FALSE);
|
||
ads_polar(XPoint(ptTopLeft), nRotWcs, nColWidth, ptTopLeft);
|
||
XLine lnRight(ptTopLeft, nRotWcs+PI/2);
|
||
int nSide1=lnLeft.OnWhichSide(pt);
|
||
int nSide2=lnRight.OnWhichSide(pt);
|
||
if(nSide1==OFFSET_RIGHT && nSide2==OFFSET_LEFT)
|
||
{
|
||
double d1=pt.Distance(&lnLeft),d2=pt.Distance(&lnRight);
|
||
double distPre=(d1+d2)/20.0;
|
||
if(!(d1<distPre||d2<distPre)){
|
||
ret = n;
|
||
ptRet = pSheet->GetColumnPoint(n);
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
ReleaseEntSet(entSet);
|
||
return ret;
|
||
}
|
||
|
||
Acad::ErrorStatus TDbVerticalSection::DrawScale(XExplodeDraw &dc, XPoint &ptEnd) const
|
||
{
|
||
double dScaleY = m_iScaleY;
|
||
double dScaleX = m_iScaleX;
|
||
dScaleX = GetPScale() / dScaleX * 1000;
|
||
dScaleY = GetPScale() / dScaleY * 1000;//转化为毫米
|
||
|
||
XPoint ptStart;
|
||
XPoint ptIns = m_ptIns;
|
||
double nHighEle = m_nMaxDeep;
|
||
double nLowEle = m_nMinDeep;
|
||
double nEleStart = 0.0;
|
||
if(m_iCalcMode < 100) // 从左往右 原代码
|
||
nEleStart = m_lstWell[0].m_nUpEle;
|
||
else // add by 王辉 08-05-05
|
||
nEleStart = m_lstWell[m_lstWell.Length() - 1].m_nUpEle;
|
||
//绘制比例尺
|
||
int iHighEle = (int)(nHighEle + 1);
|
||
int iLowEle = (int)nLowEle;
|
||
if(fabs(nLowEle) > iLowEle && nLowEle < 0)
|
||
iLowEle --;
|
||
//2009-6-24 增加以下2句,
|
||
if(fabs(nLowEle - iLowEle) < 0.2) //如果最低标尺值距实际最低标高就差0.2米,最低标尺再降低1米
|
||
iLowEle --;
|
||
if(fabs(nHighEle - iHighEle) < 0.2) //如果最高标尺值距实际最高标高就差0.2米,最高标尺再提高1米
|
||
iHighEle ++;
|
||
|
||
int iAllMeter = iHighEle - iLowEle;
|
||
nHighEle = (double)iHighEle - nEleStart;
|
||
ads_polar(ptIns, m_nLayoutRotation+PI, 20*GetPScale(), ptStart);
|
||
ads_polar(ptStart, m_nLayoutRotation+PI/2, nHighEle*dScaleY, ptStart);
|
||
|
||
//第一行比例尺
|
||
XPoint ptText, ptFisrtStart, ptStart2, ptEnd2, pt1;
|
||
ptFisrtStart = ptStart;
|
||
CString csText;
|
||
csText.Format(_T("%.2f"), (double)iHighEle);
|
||
ads_polar(ptStart, m_nLayoutRotation+PI, 3* GetPScale(), ptText);
|
||
DrawText(ptText, csText, XExplodeDraw::kBottomRight, dc);
|
||
ads_polar(ptStart, m_nLayoutRotation, GetAllPipeLen()+20*GetPScale(), pt1);
|
||
DrawGridLine(pt1, ptStart, dc);
|
||
double nHighEleTmp = (double)iHighEle;
|
||
ads_polar(ptStart, m_nLayoutRotation+PI, 2*GetPScale(), ptStart2);
|
||
|
||
DrawGridLine(ptStart, ptStart2, dc);
|
||
double nNum = 1/m_nGridScale;
|
||
double nGridScale = m_nGridScale;
|
||
if(m_nGridScale < 0.01){
|
||
nNum = 1;
|
||
nGridScale = 1;
|
||
}
|
||
|
||
for(int i=0;i<iAllMeter*nNum;i++){
|
||
ads_polar(ptStart, m_nLayoutRotation-PI/2, dScaleY/nNum, ptEnd);
|
||
if(i%2 == 0)
|
||
ads_polar(ptStart, m_nLayoutRotation+PI, 1.5* GetPScale(), ptStart2);
|
||
else
|
||
ads_polar(ptStart, m_nLayoutRotation+PI, 0.5*GetPScale(), ptStart2);
|
||
ads_polar(ptStart2, m_nLayoutRotation-PI/2, dScaleY/nNum, ptEnd2);
|
||
DrawPLine(ptStart2, ptEnd2, dc, 1*GetPScale());
|
||
|
||
ads_polar(ptStart, m_nLayoutRotation+PI, 2*GetPScale(), ptStart2);
|
||
ads_polar(ptStart2, m_nLayoutRotation-PI/2, dScaleY/nNum, ptEnd2);
|
||
DrawLine(ptStart, ptEnd, dc);
|
||
DrawLine(ptStart2, ptEnd2, dc);
|
||
|
||
ads_polar(ptEnd, m_nLayoutRotation+PI, 3*GetPScale(), ptText);
|
||
nHighEleTmp = nHighEleTmp - nGridScale;
|
||
csText.Format(_T("%.2f"), nHighEleTmp);
|
||
DrawText(ptText, csText, XExplodeDraw::kBottomRight, dc);
|
||
|
||
ptStart = ptEnd;
|
||
//绘制横网格
|
||
if(m_nGridScale > 0.01){
|
||
ads_polar(ptEnd, m_nLayoutRotation, GetAllPipeLen()+20*GetPScale(), pt1);
|
||
DrawGridLine(pt1, ptEnd, dc);
|
||
}
|
||
}
|
||
ads_polar(ptEnd, m_nLayoutRotation+PI, 2*GetPScale(), ptEnd2);
|
||
DrawGridLine(ptEnd, ptEnd2, dc);
|
||
// cet 2016.7.5 add 管井Y值方向显示区域
|
||
const_cast<XPoint&>(m_ptTop) = ptFisrtStart;
|
||
const_cast<XPoint&>(m_ptBottom) = ptEnd;
|
||
|
||
//绘制比例
|
||
ads_polar(ptStart, m_nLayoutRotation+PI, 30*GetPScale(), ptEnd);
|
||
ads_polar(ptEnd, m_nLayoutRotation, 15*GetPScale(), pt1);
|
||
DrawScaleArrow(ptEnd, pt1, XString(_T("1:%d"), m_iScaleX), dc);
|
||
ads_polar(ptEnd, m_nLayoutRotation+PI/2, 15*GetPScale(), pt1);
|
||
DrawScaleArrow(ptEnd, pt1, XString(_T("1:%d"), m_iScaleY), dc);
|
||
|
||
|
||
|
||
//绘制竖网格 ptStart当前是比例尺最下端
|
||
if(m_nGridScale > 0.01){
|
||
double nCount = (GetAllPipeLen()+20*GetPScale())/(dScaleY/nNum);
|
||
for(i=1;i<=nCount;i++){
|
||
XPoint ptTmp1, ptTmp2;
|
||
ads_polar(ptStart, m_nLayoutRotation, i*dScaleY/nNum, ptTmp1);
|
||
ads_polar(ptTmp1, m_nLayoutRotation+PI/2, iAllMeter*dScaleY, ptTmp2);
|
||
DrawGridLine(ptTmp1, ptTmp2, dc);
|
||
}
|
||
}
|
||
|
||
// //绘制井中心线
|
||
// ads_polar(ptStart, m_nLayoutRotation-PI/2, 10*GetPScale(), ptEnd);
|
||
// //ads_polar(ptEnd, m_nLayoutRotation+PI, 10*GetPScale(), ptEnd);
|
||
// for(i=0;i<m_lstPt.Length();i++){
|
||
// XPoint ptTmp1 = m_lstPt[i];
|
||
// XPoint ptTmp2 = ptTmp1;
|
||
// ptTmp2.y = ptEnd.y;
|
||
// DrawDoteLine(ptTmp1, ptTmp2, dc);
|
||
// }
|
||
|
||
//绘制井中心线
|
||
ads_polar(ptStart, m_nLayoutRotation-PI/2, 10*GetPScale(), ptStart);
|
||
ads_polar(ptStart, m_nLayoutRotation, 10*GetPScale(), ptEnd2);
|
||
|
||
XLine lineButton(ptStart, ptEnd2); //底线
|
||
for(i=0;i<m_lstPt.Length();i++){
|
||
XPoint ptTmp1 = m_lstPt[i];
|
||
XPoint ptTmp2;
|
||
ptTmp1.Project(&lineButton, ptTmp2);
|
||
DrawDoteLine(ptTmp1, ptTmp2, dc);
|
||
if(i == 0)
|
||
ptEnd = ptTmp2;
|
||
}
|
||
|
||
return Acad::eOk;
|
||
|
||
}
|
||
|
||
double TDbVerticalSection::GetAllPipeLen() const
|
||
{
|
||
assertReadEnabled();
|
||
double dScaleY = m_iScaleY;
|
||
double dScaleX = m_iScaleX;
|
||
dScaleX = GetPScale() / dScaleX * 1000;
|
||
dScaleY = GetPScale() / dScaleY * 1000;//转化为毫米
|
||
double nAllPipeLen = 0;
|
||
if(m_iCalcMode < 100) // 原来代码 按选择井的顺序画
|
||
{
|
||
for(int i=0;i<m_lstWell.Length();i++)
|
||
{
|
||
if(!m_lstWell[i].m_bIsWell)
|
||
{
|
||
if(m_lstWell[0].m_csName == _T("断管") && i==1)
|
||
continue;
|
||
|
||
// double dLenPipe = m_lstWell[i].m_nLength;
|
||
// if(dLenPipe > 1000)// 7.0 管长用mm
|
||
// dLenPipe = dLenPipe/1000.0;
|
||
|
||
double dPipeLen = m_lstWell[i].m_nLength * dScaleX;
|
||
if(m_lstWell[i].m_dRealLength > 0.1)
|
||
dPipeLen = m_lstWell[i].m_dRealLength * dScaleX; //实际管长
|
||
// cet 2016.5.9 add 化粪池紧邻断管时,管道长度许统计上化粪池长度
|
||
if (i < m_lstWell.Length() -1 && m_lstWell[i + 1].m_csName == _T("断管"))
|
||
{
|
||
OPENOBJ_BEGIN(m_lstWell[i+ 1].m_ID, AcDb::kForRead, TDbPool, pEquip);
|
||
if(pEquip != NULL)
|
||
{
|
||
double dPoolLen = pEquip->GetSizeX();
|
||
if(!DocGetMeterUnitDraw())//图纸是毫米单位
|
||
dPoolLen = dPoolLen / 1000.0;
|
||
dPipeLen -= dPoolLen * dScaleX * 0.5;
|
||
}
|
||
OPENOBJ_END();
|
||
}
|
||
nAllPipeLen += dPipeLen;
|
||
}
|
||
else if (m_lstWell[i].m_csName == _T("HC") &&
|
||
m_lstWell[0].m_csName == _T("断管") && i == 2) // cet 2016.5.9 add 化粪池紧邻断管时,管道长度许统计上化粪池长度
|
||
{
|
||
OPENOBJ_BEGIN(m_lstWell[i].m_ID, AcDb::kForRead, TDbPool, pEquip);
|
||
if(pEquip != NULL)
|
||
{
|
||
double dPoolLen = pEquip->GetSizeX();
|
||
if(!DocGetMeterUnitDraw())//图纸是毫米单位
|
||
dPoolLen = dPoolLen / 1000.0;
|
||
nAllPipeLen += dPoolLen * dScaleX * 0.5;
|
||
}
|
||
OPENOBJ_END();
|
||
}
|
||
}
|
||
}
|
||
else // add by 王辉 按选择井的反顺序画 08-05-05
|
||
{
|
||
for(int i = m_lstWell.Length() - 1;i >= 0; i--)
|
||
{
|
||
if(!m_lstWell[i].m_bIsWell)
|
||
{
|
||
if(m_lstWell[m_lstWell.Length() - 1].m_csName == _T("断管") && i == m_lstWell.Length() - 2)
|
||
continue;
|
||
|
||
// double dLenPipe = m_lstWell[i].m_nLength;
|
||
// if(dLenPipe > 1000)// 7.0 管长用mm
|
||
// dLenPipe = dLenPipe/1000.0;
|
||
|
||
double dPipeLen = m_lstWell[i].m_nLength * dScaleX;
|
||
if(m_lstWell[i].m_dRealLength > 0.1)
|
||
dPipeLen = m_lstWell[i].m_dRealLength * dScaleX; //实际管长
|
||
// cet 2016.5.9 add 化粪池紧邻断管时,管道长度许统计上化粪池长度
|
||
if (i > 0 && m_lstWell[i - 1].m_csName == _T("断管"))
|
||
{
|
||
OPENOBJ_BEGIN(m_lstWell[i - 1].m_ID, AcDb::kForRead, TDbPool, pEquip);
|
||
if(pEquip != NULL)
|
||
{
|
||
double dPoolLen = pEquip->GetSizeX();
|
||
if(!DocGetMeterUnitDraw())//图纸是毫米单位
|
||
dPoolLen = dPoolLen / 1000.0;
|
||
dPipeLen -= dPoolLen * dScaleX * 0.5;
|
||
}
|
||
OPENOBJ_END();
|
||
}
|
||
nAllPipeLen += dPipeLen;
|
||
}
|
||
else if (m_lstWell[i].m_csName == _T("HC") &&
|
||
m_lstWell[m_lstWell.Length() - 1].m_csName == _T("断管") && i == m_lstWell.Length() - 3) // cet 2016.5.9 add 化粪池紧邻断管时,管道长度许统计上化粪池长度
|
||
{
|
||
OPENOBJ_BEGIN(m_lstWell[i].m_ID, AcDb::kForRead, TDbPool, pEquip);
|
||
if(pEquip != NULL)
|
||
{
|
||
double dPoolLen = pEquip->GetSizeX();
|
||
if(!DocGetMeterUnitDraw())//图纸是毫米单位
|
||
dPoolLen = dPoolLen / 1000.0;
|
||
nAllPipeLen += dPoolLen * dScaleX * 0.5;
|
||
}
|
||
OPENOBJ_END();
|
||
}
|
||
}
|
||
}
|
||
|
||
return nAllPipeLen;
|
||
}
|
||
/**********************************************************************
|
||
2 S 1
|
||
______________________________________
|
||
| | | |
|
||
| | | |
|
||
| |_7_____________6| |
|
||
| |
|
||
+--+----------------+ |
|
||
8 | |_______________
|
||
|
|
||
+-------------------+
|
||
|
||
***********************************************************************/
|
||
|
||
|
||
Acad::ErrorStatus TDbVerticalSection::DrawSection(XExplodeDraw &dc) const
|
||
{
|
||
// DList<AcDbObjectId> lstAllPipe;//本图所有管线
|
||
// if(!!objectId())
|
||
// GetAllPipes(lstAllPipe);
|
||
double dUnitMeter = 1000;
|
||
if(DocGetMeterUnitDraw())
|
||
dUnitMeter = 1;
|
||
|
||
|
||
XPoint ptIns = m_ptIns;
|
||
double dScaleY = m_iScaleY;
|
||
double dScaleX = m_iScaleX;
|
||
dScaleX = GetPScale() / dScaleX * 1000;
|
||
dScaleY = GetPScale() / dScaleY * 1000;//转化为毫米
|
||
double iDn = InnerDn(m_lstWell[1].m_ID);
|
||
iDn = iDn * dScaleY / 1000;
|
||
double iDn2(0);
|
||
double nEleStart = m_lstWell[0].m_nUpEle;
|
||
XPoint ptStart, ptEnd, pt1, pt2, pt3, pt4, pt5, pt6, pt7, pt8, ptTmp, ptStartG, ptEndG;
|
||
ptStart = ptIns;
|
||
// cet 2016.5.9 add 纵断面图起点包含断管是,修正起点
|
||
if (m_lstWell[0].m_csName == _T("断管") && m_lstWell.Length() > 2)
|
||
{
|
||
OPENOBJ_BEGIN(m_lstWell[2].m_ID, AcDb::kForRead, TDbPool, pEquip);
|
||
if(pEquip != NULL)
|
||
{
|
||
double dPoolLen = pEquip->GetSizeX();
|
||
if(!DocGetMeterUnitDraw())//图纸是毫米单位
|
||
dPoolLen = dPoolLen / 1000.0;
|
||
ads_polar(ptStart, m_nLayoutRotation, dPoolLen * dScaleX * 0.5, ptStart);
|
||
}
|
||
OPENOBJ_END();
|
||
}
|
||
ads_polar(ptStart, m_nLayoutRotation+PI/2, (m_lstWell[0].m_nGroundEle - nEleStart)*dScaleY, ptStartG);
|
||
double dPipeLen = 0;
|
||
BOOL bDrawGround = FALSE;
|
||
for(int i=0;i<m_lstWell.Length();i++){
|
||
if(m_lstWell[i].m_bIsWell){ //井
|
||
if(fabs(m_lstWell[i].m_nGroundEle) > 0.0001){
|
||
bDrawGround = TRUE;
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
// // cet 2017.8.28 add 获取所有交叉信息
|
||
// DList<AcDbObjectId> lstPipe;
|
||
// for(int i = 0; i < m_lstWell.Length(); ++i)
|
||
// {
|
||
// if(!m_lstWell[i].m_bIsWell)
|
||
// {
|
||
// lstPipe.Append(new AcDbObjectId(m_lstWell[i].m_ID));
|
||
// }
|
||
// }
|
||
// std::vector<CrossPoint> vecCrossPoint;
|
||
// CalcCrossPipes(lstPipe, lstAllPipe, vecCrossPoint, IsShowPipeEndNotLinkedPipe());
|
||
std::vector<CrossPoint> vecCrossPoint;
|
||
GetCrossPointInfo(vecCrossPoint);
|
||
for(i=0;i<m_lstWell.Length();i++){
|
||
double nEle = m_lstWell[i].m_nUpEle - nEleStart; //井面标高
|
||
double nEleG = m_lstWell[i].m_nGroundEle - nEleStart;//地面标高
|
||
if(m_lstWell[i].m_bIsWell){ //井
|
||
BOOL bPool = m_lstWell[i].m_csName == _T("HC");
|
||
|
||
if(m_lstWell[i].m_csName == _T("断管") && dPipeLen > 0){
|
||
double nI = m_lstWell[i-1].m_nI;
|
||
double nLow = nI * dPipeLen/2;
|
||
ads_polar(pt7, m_nLayoutRotation, dPipeLen/2, pt3);
|
||
ads_polar(pt8, m_nLayoutRotation, dPipeLen/2, pt4);
|
||
ads_polar(pt3, m_nLayoutRotation+PI/2, -nLow, pt3);
|
||
ads_polar(pt4, m_nLayoutRotation+PI/2, -nLow, pt4);
|
||
DrawPLine(pt7, pt3, dc, 0.35*GetPScale());//井底边线
|
||
DrawPLine(pt8, pt4, dc, 0.35*GetPScale());//井底边线
|
||
DrawBreakPipe(pt3, pt4, dc);
|
||
ads_polar(ptStart, m_nLayoutRotation, dPipeLen, ptEnd);
|
||
// cet 2016.5.10 add 右端断管
|
||
int nCount = m_lstWell.Length();
|
||
if (i == nCount - 1)
|
||
{
|
||
double nWellDia = fabs(m_lstWell[i - 2].m_nWellRadius * dScaleX * 0.002);
|
||
ads_polar(ptStart, m_nLayoutRotation, nWellDia/2, pt1);
|
||
// 管道首端连着化粪池
|
||
if (i >= 2 && m_lstWell[i - 2].m_csName == _T("HC"))
|
||
{
|
||
OPENOBJ_BEGIN(m_lstWell[i - 2].m_ID, AcDb::kForRead, TDbPool, pEquip);
|
||
if(pEquip != NULL)
|
||
{
|
||
double dPoolLen = pEquip->GetSizeX() * GetPScale() / 100;
|
||
ads_polar(ptStart, m_nLayoutRotation, dPoolLen * 0.5, pt1);
|
||
}
|
||
OPENOBJ_END();
|
||
}
|
||
ads_polar(pt1, m_nLayoutRotation, dPipeLen/2, pt2);
|
||
ads_polar(pt1, m_nLayoutRotation-PI/2, 3*GetPScale(), pt3);
|
||
ads_polar(pt2, m_nLayoutRotation-PI/2, 3*GetPScale(), pt4);
|
||
XPoly2D poly2d;
|
||
poly2d.AppendNode(pt1);
|
||
poly2d.AppendNode(pt3);
|
||
poly2d.AppendNode(pt4);
|
||
poly2d.AppendNode(pt2);
|
||
// cet 2018.2.8 modify 填充
|
||
// if(!!objectId())
|
||
// dc.DrawHatch(poly2d, _T("AR-HBONE"), 0.5*GetPScale());//动态拖动速度极慢
|
||
DrawHatch(dc, poly2d);
|
||
}
|
||
continue;
|
||
}
|
||
else if(m_lstWell[i].m_csName == _T("断管") && dPipeLen < 0.0001){
|
||
continue;
|
||
}
|
||
double nWellDia = fabs(m_lstWell[i].m_nWellRadius * dScaleX * 0.002);//支持米单位
|
||
// cet 2016.12.8 add 池的长度
|
||
OPENOBJ_BEGIN(m_lstWell[i].m_ID, AcDb::kForRead, TDbPool, pEquip);
|
||
if(pEquip != NULL)
|
||
{
|
||
nWellDia = pEquip->GetSizeX() * dScaleX;
|
||
if(!DocGetMeterUnitDraw())//图纸是毫米单位
|
||
nWellDia = nWellDia / 1000.0;
|
||
}
|
||
OPENOBJ_END();
|
||
// BOOL bIsNode = IsNodeWell(m_lstWell[i].m_ID);
|
||
if(i != m_lstWell.Length() - 1)
|
||
iDn = InnerDn(m_lstWell[i + 1].m_ID) * dScaleY / 1000;
|
||
if(i != 0)
|
||
iDn2 = InnerDn(m_lstWell[i - 1].m_ID) * dScaleY / 1000;
|
||
|
||
//把井盖填平
|
||
if(dPipeLen < 0.001){
|
||
ads_polar(ptStart, m_nLayoutRotation+PI/2, nEle*dScaleY, ptStart);
|
||
ads_polar(ptStart, m_nLayoutRotation+PI, nWellDia/2, pt1);
|
||
ads_polar(ptStart, m_nLayoutRotation, nWellDia/2, pt2);
|
||
DrawLine(pt1, pt2, dc);
|
||
}
|
||
if(dPipeLen > 0){
|
||
ads_polar(ptStart, m_nLayoutRotation, dPipeLen, ptEnd);
|
||
nEle = m_lstWell[i].m_nUpEle - m_lstWell[i-2].m_nUpEle; //井面标高
|
||
|
||
// 先得到设计地面标高的点ptEnd
|
||
ads_polar(ptEnd, m_nLayoutRotation+PI/2, nEle*dScaleY, ptEnd);
|
||
// 再根据设计地面标高的点ptEnd,算出自然地面标高点(根据他们之差)sr 2009-12-21 修改
|
||
ads_polar(ptEnd, m_nLayoutRotation+PI/2, (m_lstWell[i].m_nGroundEle - m_lstWell[i].m_nUpEle)*dScaleY, ptEndG);
|
||
if(bDrawGround)
|
||
DrawDoteLine(ptStartG, ptEndG, dc);
|
||
|
||
ads_polar(ptEnd, m_nLayoutRotation+PI, nWellDia/2, pt1);
|
||
ads_polar(ptEnd, m_nLayoutRotation, nWellDia/2, pt2);
|
||
DrawLine(pt1, pt2, dc);//把井盖填平
|
||
// cet 2016.12.7 modify 使用管道首端井的宽度
|
||
// ads_polar(ptStart, m_nLayoutRotation, nWellDia/2, pt3);
|
||
ads_polar(ptStart, m_nLayoutRotation, i >= 2 ? fabs(m_lstWell[i - 2].m_nWellRadius * dScaleX * 0.002) / 2 : nWellDia/2, pt3);
|
||
if (i >= 2 && m_lstWell[i - 2].m_csName == _T("HC"))
|
||
{
|
||
OPENOBJ_BEGIN(m_lstWell[i - 2].m_ID, AcDb::kForRead, TDbPool, pEquip);
|
||
if(pEquip != NULL)
|
||
{
|
||
double dPoolLen = pEquip->GetSizeX() * dScaleX;
|
||
if(!DocGetMeterUnitDraw())//图纸是毫米单位
|
||
dPoolLen = dPoolLen / 1000.0;
|
||
ads_polar(ptStart, m_nLayoutRotation, dPoolLen * 0.5, pt3);
|
||
}
|
||
OPENOBJ_END();
|
||
}
|
||
DrawLine(pt3, pt1, dc);//绘制地面线
|
||
// cet 2016.12.7 modify 使用管道首端井的宽度
|
||
// ads_polar(ptStart, m_nLayoutRotation, nWellDia/2, pt1);
|
||
ads_polar(ptStart, m_nLayoutRotation, i >= 2 ? fabs(m_lstWell[i - 2].m_nWellRadius * dScaleX * 0.002) / 2 : nWellDia/2, pt1);
|
||
// cet 2016.5.10 add 管道首端连着化粪池
|
||
if (i >= 2 && m_lstWell[i - 2].m_csName == _T("HC"))
|
||
{
|
||
OPENOBJ_BEGIN(m_lstWell[i - 2].m_ID, AcDb::kForRead, TDbPool, pEquip);
|
||
if(pEquip != NULL)
|
||
{
|
||
double dPoolLen = pEquip->GetSizeX() * dScaleX;
|
||
if(!DocGetMeterUnitDraw())//图纸是毫米单位
|
||
dPoolLen = dPoolLen / 1000.0;
|
||
ads_polar(ptStart, m_nLayoutRotation, dPoolLen * 0.5, pt1);
|
||
}
|
||
OPENOBJ_END();
|
||
}
|
||
ads_polar(ptEnd, m_nLayoutRotation+PI, nWellDia/2, pt2);
|
||
// cet 2016.5.10 add 管道尾端连着化粪池
|
||
if (m_lstWell[i].m_csName == _T("HC"))
|
||
{
|
||
OPENOBJ_BEGIN(m_lstWell[i].m_ID, AcDb::kForRead, TDbPool, pEquip);
|
||
if(pEquip != NULL)
|
||
{
|
||
double dPoolLen = pEquip->GetSizeX() * dScaleX;
|
||
if(!DocGetMeterUnitDraw())//图纸是毫米单位
|
||
dPoolLen = dPoolLen / 1000.0;
|
||
ads_polar(ptEnd, m_nLayoutRotation+PI, dPoolLen * 0.5, pt2);
|
||
}
|
||
OPENOBJ_END();
|
||
}
|
||
ads_polar(pt1, m_nLayoutRotation-PI/2, 3*GetPScale(), pt3);
|
||
ads_polar(pt2, m_nLayoutRotation-PI/2, 3*GetPScale(), pt4);
|
||
XPoly2D poly2d;
|
||
poly2d.AppendNode(pt1);
|
||
poly2d.AppendNode(pt3);
|
||
poly2d.AppendNode(pt4);
|
||
poly2d.AppendNode(pt2);
|
||
|
||
// cet 2018.2.8 modify 填充
|
||
// if(!!objectId())
|
||
// dc.DrawHatch(poly2d, _T("AR-HBONE"), 0.5*GetPScale());//动态拖动速度极慢
|
||
DrawHatch(dc, poly2d);
|
||
|
||
ptStart = ptEnd;
|
||
ptStartG = ptEndG;
|
||
}
|
||
|
||
double dPoolEleUp(0), dPoolEleDown(0);
|
||
if(bPool){
|
||
OPENOBJ_BEGIN(m_lstWell[i].m_ID, AcDb::kForRead, TDbPool, pEquip);
|
||
if(pEquip){
|
||
double dPoolLen = pEquip->GetSizeX();
|
||
if(dPoolLen > 100.0)//图纸是毫米单位
|
||
dPoolLen = dPoolLen / 1000.0;
|
||
nWellDia = dPoolLen * dScaleX;//化粪池的长度
|
||
dPoolEleUp = pEquip->GetTopBanEle();
|
||
dPoolEleDown = pEquip->GetBottomBanEle();
|
||
}
|
||
OPENOBJ_END();
|
||
// OPENOBJ_BEGIN(m_lstWell[i].m_ID, AcDb::kForRead, TDbPump, pEquip);
|
||
// if(pEquip){
|
||
// double dPoolLen = pEquip->GetPumpLength();
|
||
// if(dPoolLen > 100.0)//图纸是毫米单位
|
||
// dPoolLen = dPoolLen / 1000.0;
|
||
// nWellDia = dPoolLen * dScaleX;//化粪池的长度
|
||
// dPoolEleUp = pEquip->GetPumpQ();
|
||
// dPoolEleDown = pEquip->GetPumpRaise();
|
||
// }
|
||
// OPENOBJ_END();
|
||
|
||
//如果化粪池有顶板,底板标高,则绘制化粪池矩形示意图
|
||
if(fabs(dPoolEleUp) > 0.01 && fabs(dPoolEleDown) > 0.01){
|
||
XPoint ptPool1, ptPool2, ptPool3, ptPool4;
|
||
ads_polar(ptEnd, m_nLayoutRotation+PI, nWellDia/2, ptPool1);
|
||
ads_polar(ptEnd, m_nLayoutRotation, nWellDia/2, ptPool2);
|
||
|
||
double dPoolDeepDown = m_lstWell[i].m_nUpEle - dPoolEleDown;
|
||
ads_polar(ptPool1, m_nLayoutRotation-PI/2, dPoolDeepDown * dScaleY, ptPool3);
|
||
ads_polar(ptPool2, m_nLayoutRotation-PI/2, dPoolDeepDown * dScaleY, ptPool4);
|
||
DrawLine(ptPool3, ptPool4, dc);
|
||
|
||
double dPoolDeepUp = m_lstWell[i].m_nUpEle - dPoolEleUp;
|
||
ads_polar(ptPool1, m_nLayoutRotation-PI/2, dPoolDeepUp * dScaleY, ptPool1);
|
||
ads_polar(ptPool2, m_nLayoutRotation-PI/2, dPoolDeepUp * dScaleY, ptPool2);
|
||
DrawLine(ptPool1, ptPool2, dc);
|
||
|
||
DrawLine(ptPool1, ptPool3, dc);
|
||
DrawLine(ptPool2, ptPool4, dc);
|
||
}
|
||
}
|
||
|
||
XPoint ptUpLeft2;
|
||
ads_polar(ptStart, m_nLayoutRotation, nWellDia/2, pt1);
|
||
ads_polar(ptStart, m_nLayoutRotation+PI, nWellDia/2, pt2);
|
||
double nDeep = m_lstWell[i].m_nDeep * dScaleY;
|
||
double nDeepLeft = nDeep;
|
||
if(m_iCalcMode == 0)
|
||
nDeepLeft = nDeep - iDn;
|
||
else if(m_iCalcMode == 1)
|
||
nDeepLeft = nDeep - iDn2;
|
||
else if(m_iCalcMode == 2)
|
||
nDeepLeft = nDeep - iDn2 - (iDn-iDn2)/2;
|
||
|
||
|
||
if(i != 0 && (m_lstWell[i].m_bIsDropWell || bPool)){ //给水系统没有跌水井
|
||
double nDropDeep = m_lstWell[i].m_nUpEle - m_lstWell[i].m_nFrondDownEle;
|
||
// cet 2014.5.6 modify 化粪池与跌水井应分开处理
|
||
// // cet 2013.3.13 modify
|
||
// // ads_polar(pt2, m_nLayoutRotation-PI/2, nDropDeep * dScaleY - iDn2, pt6);
|
||
// ads_polar(pt2, m_nLayoutRotation-PI/2, nDropDeep * dScaleY - iDn, pt6);
|
||
if (bPool)
|
||
{
|
||
ads_polar(pt2, m_nLayoutRotation-PI/2, nDropDeep * dScaleY - iDn, pt6);
|
||
}
|
||
else
|
||
{
|
||
ads_polar(pt2, m_nLayoutRotation-PI/2, nDropDeep * dScaleY - iDn2, pt6);
|
||
}
|
||
ads_polar(pt6, m_nLayoutRotation-PI/2, iDn, ptTmp);
|
||
ads_polar(pt6, m_nLayoutRotation-PI/2, iDn2, ptUpLeft2);
|
||
}
|
||
else{
|
||
ads_polar(pt2, m_nLayoutRotation-PI/2, nDeepLeft, pt6);
|
||
if(m_iCalcMode == 0){
|
||
ads_polar(pt6, m_nLayoutRotation-PI/2, iDn, ptTmp);
|
||
ads_polar(pt6, m_nLayoutRotation-PI/2, iDn2, ptUpLeft2);
|
||
}
|
||
else if(m_iCalcMode == 1){
|
||
ads_polar(pt6, m_nLayoutRotation-PI/2, iDn2, ptTmp);
|
||
ptUpLeft2 = ptTmp;
|
||
}
|
||
else if(m_iCalcMode == 2){
|
||
ads_polar(pt6, m_nLayoutRotation-PI/2, iDn2+(iDn-iDn2)/2, ptTmp);
|
||
ads_polar(pt6, m_nLayoutRotation-PI/2, iDn2, ptUpLeft2);
|
||
}
|
||
|
||
}
|
||
|
||
if(!ptUpLeft2)
|
||
ptUpLeft2 = ptTmp;
|
||
|
||
if(m_lstWell[i].m_csName != _T("HC")){ //如果是节点或者就不画井了
|
||
if(i == 0)
|
||
DrawPLine(pt2, ptTmp, dc, 0.3*GetPScale()); //井左边线
|
||
else{
|
||
double nDropDeep2 = m_lstWell[i].m_nFrondDownEle - m_lstWell[i].m_nDownEle;
|
||
DrawPLine(pt2, pt6, dc, 0.3*GetPScale()); //井左边线
|
||
if(m_lstWell[i].m_bIsDropWell && nDropDeep2 > 0)
|
||
{
|
||
ads_polar(pt2, m_nLayoutRotation-PI/2, nDeep, ptTmp);
|
||
DrawPLine(ptTmp, ptUpLeft2, dc, 0.3*GetPScale()); //跌水井左下边线
|
||
}
|
||
else if(ptTmp != ptUpLeft2)
|
||
{
|
||
DrawPLine(ptTmp, ptUpLeft2, dc, 0.3*GetPScale()); //井2边管径差
|
||
}
|
||
}
|
||
}
|
||
if(dPipeLen > 0){
|
||
DrawPLine(pt6, pt7, dc, 0.35*GetPScale()); //横管上线
|
||
DrawPLine(pt8, ptUpLeft2, dc, 0.35*GetPScale()); //横管下线
|
||
}
|
||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||
// 绘制表示本井其它管标高的管,用椭圆表示
|
||
OPENOBJ_BEGIN(m_lstWell[i].m_ID, AcDb::kForRead, TDbEquipment, pEquip);
|
||
if(pEquip){
|
||
int num = pEquip->GetInterfaceNum();
|
||
if(num > 1){ // cet 2016.9.6 modify 未考虑起始端井连接的管道
|
||
for(int j=0;j<num;j++){
|
||
TPipeInterface face;
|
||
pEquip->GetInterface(j, face);
|
||
if(i>0 && face.m_idPipe == m_lstWell[i-1].m_ID)
|
||
continue;
|
||
if(i< m_lstWell.Length() - 1 && face.m_idPipe == m_lstWell[i+1].m_ID)
|
||
continue;
|
||
// cet 2011.12.5 add 判断交叉管是否需要显示
|
||
if (!IsShowCrossPipe(face.m_idPipe))
|
||
{
|
||
continue;
|
||
}
|
||
double nPipeDownEle = 0.0;
|
||
double dOuterDn = 0.0, dPipeThick = 0.0;
|
||
double nThirdDn(0);
|
||
AcDbObjectId idLay = NULL;
|
||
bool bBranch = true; // cet 2016.9.8 add 是否为支路
|
||
OPENOBJ_BEGIN(face.m_idPipe, AcDb::kForRead, TDbPipe, pPipe);
|
||
if(pPipe){
|
||
idLay = pPipe->layerId();
|
||
nThirdDn = (pPipe->OuterDn() - pPipe->GetPipeThick() * 2) * dScaleY / 1000;
|
||
// cet 2016.7.6 add 计算管内底标高, 内径
|
||
double dDn = (pPipe->OuterDn() - pPipe->GetPipeThick() * 2) / 2000;
|
||
if (pPipe->StartPoint().Distance2d(face.m_ptLocation) < 0.001)
|
||
{
|
||
nPipeDownEle = pPipe->StartPoint().z / dUnitMeter - dDn;
|
||
}
|
||
else
|
||
{
|
||
nPipeDownEle = pPipe->EndPoint().z / dUnitMeter - dDn;
|
||
}
|
||
dOuterDn = pPipe->OuterDn();
|
||
dPipeThick = pPipe->GetPipeThick();
|
||
bBranch = IsBrach(pPipe, m_lstWell[i].m_ID); // cet 2016.9.8 add 是否为支路
|
||
}
|
||
OPENOBJ_END();
|
||
// cet 2016.7.6 del 直接获取管底标高
|
||
// CString csPipeDownEle = pEquip->GetISysLabel(j);
|
||
// if(csPipeDownEle == _T(""))
|
||
// continue;
|
||
// double nPipeDownEle = _tstof(csPipeDownEle);
|
||
// cet 2016.9.8 modify 细化显示控制
|
||
// if(fabs(nPipeDownEle - m_lstWell[i].m_nDownEle) > 0.001) // cet 2016.9.6 modify 不绘制管内底标高与井底标高一致的管道
|
||
if ((IsOnlyShowBranch() && bBranch || !IsOnlyShowBranch()) && // 控制是否只显示支路
|
||
((fabs(nPipeDownEle - m_lstWell[i].m_nDownEle) > 0.001) && !IsShowEqualEleBranch() || IsShowEqualEleBranch())) // 是否只显示等高支路
|
||
{
|
||
XPoint ptEllipse;
|
||
double nThirdPipeDeep = m_lstWell[i].m_nUpEle - nPipeDownEle;
|
||
ads_polar(ptStart, m_nLayoutRotation-PI/2, nThirdPipeDeep * dScaleY - nThirdDn/2, ptEllipse);
|
||
bool bRet = false;
|
||
DrawEllipse(ptEllipse, (dOuterDn - dPipeThick * 2) * dScaleY * 0.0005, (dOuterDn - dPipeThick * 2) * dScaleX * 0.0005, idLay, dc, &bRet);
|
||
|
||
// cet 2011.6.2 add 标注碰撞管内底标高
|
||
if (bRet && IsDimEle())
|
||
{
|
||
CString ss;
|
||
DimEle(ptEllipse, (dOuterDn - dPipeThick * 2) * dScaleY * 0.0005, (dOuterDn - dPipeThick * 2) * dScaleX * 0.0005, nPipeDownEle, ss, true, dc);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
OPENOBJ_END();
|
||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||
|
||
|
||
XPoint ptBottomRight, ptUpRight, ptBottomLeft(ptTmp);
|
||
ads_polar(pt1, m_nLayoutRotation-PI/2, nDeep, ptBottomRight);
|
||
if(i == m_lstWell.Length() -1)
|
||
ptUpRight = ptBottomRight; //最后一个井
|
||
else
|
||
ads_polar(pt1, m_nLayoutRotation-PI/2, nDeep-iDn, ptUpRight);
|
||
|
||
|
||
|
||
if(m_lstWell[i].m_csName != _T("HC")){
|
||
if(m_lstWell[i].m_nSpare > 0){//绘制沉沙井
|
||
double nDeepSand = m_lstWell[i].m_nSpare / 1000 * dScaleY;
|
||
XPoint ptSandRight, ptSandLeft;
|
||
ads_polar(ptBottomRight, m_nLayoutRotation+PI/2*3, nDeepSand, ptSandRight);
|
||
ads_polar(ptBottomLeft, m_nLayoutRotation+PI/2*3, nDeepSand, ptSandLeft);
|
||
DrawPLine(ptSandRight, ptSandLeft, dc, 0.35*GetPScale()); //井底边线
|
||
DrawPLine(ptBottomRight, ptSandRight, dc, 0.35*GetPScale());//沉沙边线
|
||
DrawPLine(ptBottomLeft, ptSandLeft, dc, 0.35*GetPScale()); //跌水井左下边线
|
||
}
|
||
else{
|
||
double nDropDeep2 = m_lstWell[i].m_nFrondDownEle - m_lstWell[i].m_nDownEle;
|
||
if(nDropDeep2 < 0){ //虹吸井,往上跌水
|
||
XPoint ptBottomRight2;
|
||
ads_polar(ptBottomLeft, m_nLayoutRotation, nWellDia, ptBottomRight2);
|
||
DrawPLine(ptBottomRight2, ptBottomLeft, dc, 0.35*GetPScale());//井底边线
|
||
DrawPLine(ptBottomRight2, ptBottomRight, dc, 0.35*GetPScale());//井底边线
|
||
}
|
||
else
|
||
{
|
||
DrawPLine(ptBottomRight, ptBottomLeft, dc, 0.35*GetPScale());//井底边线
|
||
}
|
||
|
||
}
|
||
DrawPLine(pt1, ptUpRight, dc, 0.3*GetPScale()); //井右边线
|
||
}
|
||
|
||
pt7 = ptUpRight; // PT7井管顶右边点
|
||
pt8 = ptBottomRight; // PT8井管底左边点
|
||
|
||
//前断管
|
||
if(dPipeLen < 0.001 && i != 0){
|
||
double nI = m_lstWell[i-1].m_nI;
|
||
dPipeLen = 10*GetPScale();
|
||
double nLow = nI * dPipeLen/2;
|
||
ads_polar(pt6, m_nLayoutRotation+PI, dPipeLen/2, pt3);
|
||
ads_polar(ptUpLeft2, m_nLayoutRotation+PI, dPipeLen/2, pt4);
|
||
ads_polar(pt3, m_nLayoutRotation+PI/2, nLow, pt3);
|
||
ads_polar(pt4, m_nLayoutRotation+PI/2, nLow, pt4);
|
||
DrawPLine(pt6, pt3, dc, 0.35*GetPScale()); //井底边线
|
||
DrawPLine(ptUpLeft2, pt4, dc, 0.35*GetPScale());//井底边线
|
||
DrawBreakPipe(pt3, pt4, dc);
|
||
// cet 2016.5.10 add 左端断管
|
||
int nCount = m_lstWell.Length();
|
||
if (i == 2)
|
||
{
|
||
double nWellDia = fabs(m_lstWell[i].m_nWellRadius * dScaleX * 0.002);
|
||
ads_polar(ptStart, m_nLayoutRotation, -nWellDia/2, pt1);
|
||
// 管道尾端连着化粪池
|
||
if (m_lstWell[i].m_csName == _T("HC"))
|
||
{
|
||
OPENOBJ_BEGIN(m_lstWell[i].m_ID, AcDb::kForRead, TDbPool, pEquip);
|
||
if(pEquip != NULL)
|
||
{
|
||
double dPoolLen = pEquip->GetSizeX() * dScaleX;
|
||
if(!DocGetMeterUnitDraw())//图纸是毫米单位
|
||
dPoolLen = dPoolLen / 1000.0;
|
||
ads_polar(ptStart, m_nLayoutRotation, -dPoolLen * 0.5, pt1);
|
||
}
|
||
OPENOBJ_END();
|
||
}
|
||
ads_polar(pt1, m_nLayoutRotation, -dPipeLen/2, pt2);
|
||
ads_polar(pt1, m_nLayoutRotation-PI/2, 3*GetPScale(), pt3);
|
||
ads_polar(pt2, m_nLayoutRotation-PI/2, 3*GetPScale(), pt4);
|
||
XPoly2D poly2d;
|
||
poly2d.AppendNode(pt1);
|
||
poly2d.AppendNode(pt3);
|
||
poly2d.AppendNode(pt4);
|
||
poly2d.AppendNode(pt2);
|
||
// cet 2018.2.8 modify 填充
|
||
// if(!!objectId())
|
||
// dc.DrawHatch(poly2d, _T("AR-HBONE"), 0.5*GetPScale());//动态拖动速度极慢
|
||
DrawHatch(dc, poly2d);
|
||
}
|
||
}
|
||
dPipeLen = 0;
|
||
}
|
||
else if(!m_lstWell[i].m_bIsWell){ //管
|
||
// double dLenPipe = m_lstWell[i].m_nLength;
|
||
// if(dLenPipe > 1000)// 7.0 管长用mm
|
||
// dLenPipe = dLenPipe/1000.0;
|
||
dPipeLen = m_lstWell[i].m_nLength * dScaleX;
|
||
if(m_lstWell[i].m_dRealLength > 0.1)
|
||
dPipeLen = m_lstWell[i].m_dRealLength * dScaleX;
|
||
// cet 2016.5.10 add 右侧末尾连接断管
|
||
if (i == m_lstWell.Length() - 2 && m_lstWell[i + 1].m_csName == _T("断管") && i > 0)
|
||
{
|
||
dPipeLen = m_lstWell[i].m_nLength * dScaleX;
|
||
}
|
||
if(m_lstWell[i-1].m_csName == _T("断管"))
|
||
dPipeLen = 0;
|
||
//2006-10-20 沈睿 加入考虑其它交叉管线
|
||
AcDbObjectId idPipe = m_lstWell[i].m_ID;
|
||
OPENOBJ_BEGIN(idPipe, AcDb::kForRead, TDbPipe, pPipe);
|
||
if(pPipe && m_lstWell[i-1].m_csName != _T("断管"))
|
||
{
|
||
//-------------------------------------------------------------------------------------------
|
||
//int nPipeNum = pPipe->GetHidePipes().Length();
|
||
XPoint ptEllipse, ptInt;
|
||
// ZXL 2013.12.06 ADD 管线交叉在此处处理(包括标高高于自身的管线的处理)
|
||
DList<AcDbObjectId> lstCrossPipes;
|
||
CrossPoint cr(pPipe->objectId());
|
||
GetCrossInfo(vecCrossPoint, cr);
|
||
cr.GetAllCrossPipes(lstCrossPipes);
|
||
int nPipeNum = lstCrossPipes.Length();
|
||
int nIndex = 0;
|
||
|
||
for(int j=0;j<nPipeNum;j++){
|
||
// ZXL 2013.12.06 modify
|
||
//AcDbObjectId idOther = pPipe->GetHidePipes()[j];
|
||
AcDbObjectId idOther = *lstCrossPipes[j];
|
||
OPENOBJ_BEGIN(idOther, AcDb::kForRead, TDbPipe, pPipe2);
|
||
if(pPipe2){
|
||
// cet 2011.12.5 add 判断交叉管是否需要显示
|
||
if (!IsShowCrossPipe(pPipe2->objectId()))
|
||
{
|
||
continue;
|
||
}
|
||
double dDn = pPipe2->OuterDn() - pPipe2->GetPipeThick() * 2;
|
||
double dI = pPipe2->GetPipeGradient();
|
||
double dPipeStartEle(0);
|
||
dDn = dDn / 2000; //转换为米单位
|
||
if(pPipe2->GetFlowDir() == TPipeSys::kFromStart)
|
||
dPipeStartEle = pPipe2->StartPoint().z/dUnitMeter - dDn;
|
||
else
|
||
dPipeStartEle = pPipe2->EndPoint().z/dUnitMeter - dDn;
|
||
double nDist2Well1(0), nDist2Well2(0);
|
||
cr.GetCrossInfo(idOther, ptInt, nDist2Well1, nDist2Well2);
|
||
if(fabs(nDist2Well1) > 0.001 && fabs(nDist2Well2) > 0.001 || IsShowPipeEndNotLinkedPipe() && (fabs(nDist2Well1) > 0.001 || fabs(nDist2Well2) > 0.001))
|
||
{
|
||
AcDbObjectId idLay = pPipe2->layerId();
|
||
//int iDnTmp = int(dDn*dScaleY/1000);
|
||
double dDnTmp = dDn*dScaleY;
|
||
double nPipeIntEle = dPipeStartEle - nDist2Well2*dI; //根据相交管线起点标高计算交点标高
|
||
double nThirdPipeDeep = m_lstWell[i-1].m_nUpEle - nPipeIntEle;//转换为埋深
|
||
ads_polar(ptStart, m_nLayoutRotation-PI/2, nThirdPipeDeep * dScaleY - dDnTmp, ptEllipse);
|
||
ads_polar(ptEllipse, m_nLayoutRotation, nDist2Well1 * dScaleX, ptEllipse);
|
||
double dOuterDn = pPipe2->OuterDn();
|
||
double dPipeThick = pPipe2->GetPipeThick();
|
||
bool bRet = false;
|
||
DrawEllipse(ptEllipse, (dOuterDn - dPipeThick * 2) * dScaleY * 0.0005, (dOuterDn - dPipeThick * 2) * dScaleX * 0.0005, idLay, dc, &bRet);
|
||
// cet 2011.6.3 add 标注碰撞管内底标高
|
||
if (bRet && IsDimEle())
|
||
{
|
||
CString sPipeName = pPipe2->GetPipeSystemName();
|
||
sPipeName += _T("管");
|
||
CString sLabel = pPipe2->GetLabel();
|
||
sPipeName += sLabel;
|
||
sLabel.Format(_T("%.f"), pPipe2->GetDnDiameter());
|
||
sPipeName += sLabel;
|
||
DimEle(ptEllipse, (dOuterDn - dPipeThick * 2) * dScaleY * 0.0005, (dOuterDn - dPipeThick * 2) * dScaleX * 0.0005, nPipeIntEle, sPipeName, false, dc);
|
||
}
|
||
// zxl 2013.12.10 add
|
||
if (bRet && IsDimDist())
|
||
{
|
||
CString sDim;
|
||
sDim.Format(_T("%.2f"), nDist2Well1 * dUnitMeter);
|
||
if (dUnitMeter > 1.0)
|
||
{
|
||
sDim.Format(_T("%.f"), nDist2Well1 * dUnitMeter);
|
||
}
|
||
DimDist(sDim, ptStart, ptEllipse, dc, nIndex, nThirdPipeDeep, dDnTmp);
|
||
}
|
||
}
|
||
|
||
}
|
||
OPENOBJ_END();
|
||
}
|
||
}
|
||
OPENOBJ_END();
|
||
}
|
||
}
|
||
|
||
return Acad::eOk;
|
||
}
|
||
// 反向画井 2008.4.30 add by wanghui
|
||
Acad::ErrorStatus TDbVerticalSection::DrawSectionFromRight(XExplodeDraw &dc) const
|
||
{
|
||
// DList<AcDbObjectId> lstAllPipe;//本图所有管线
|
||
// if(!!objectId())
|
||
// GetAllPipes(lstAllPipe);
|
||
double dUnitMeter = 1000;
|
||
if(DocGetMeterUnitDraw())
|
||
dUnitMeter = 1;
|
||
|
||
|
||
XPoint ptIns = m_ptIns;
|
||
double dScaleY = m_iScaleY;
|
||
double dScaleX = m_iScaleX;
|
||
dScaleX = GetPScale() / dScaleX * 1000;
|
||
dScaleY = GetPScale() / dScaleY * 1000;//转化为毫米
|
||
// 管径
|
||
double iDn = InnerDn(m_lstWell[m_lstWell.Length() - 2].m_ID) * dScaleY / 1000;
|
||
double iDn2(0);
|
||
// 开始井面标高
|
||
double dEleStart = m_lstWell[m_lstWell.Length() - 1].m_nUpEle;
|
||
|
||
XPoint ptStart, ptEnd, ptTmp, ptStartG, ptEndG;
|
||
XPoint ptWellLeft,ptWellRight,ptPreWellRight,ptPreWellBtmDownRight,ptHatchLeft,ptHatchRight,ptWellDownLeft,ptWellDownRight; // 左井口点 右井口点
|
||
XPoint ptPreWellBtmUpRight,ptAftWellBtmUpLeft;
|
||
XPoint ptWellDis1,ptWellDis2;
|
||
// 插入点
|
||
ptStart = ptIns;
|
||
// cet 2016.5.9 add 纵断面图起点包含断管是,修正起点
|
||
if (m_lstWell[m_lstWell.Length() - 1].m_csName == _T("断管") && m_lstWell.Length() > 2)
|
||
{
|
||
OPENOBJ_BEGIN(m_lstWell[m_lstWell.Length() - 3].m_ID, AcDb::kForRead, TDbPool, pEquip);
|
||
if(pEquip != NULL)
|
||
{
|
||
double dPoolLen = pEquip->GetSizeX();
|
||
if(!DocGetMeterUnitDraw())//图纸是毫米单位
|
||
dPoolLen = dPoolLen / 1000.0;
|
||
ads_polar(ptStart, m_nLayoutRotation, dPoolLen * dScaleX * 0.5, ptStart);
|
||
}
|
||
OPENOBJ_END();
|
||
}
|
||
// ptEndG地面标高
|
||
ads_polar(ptStart, m_nLayoutRotation+PI/2, (m_lstWell[m_lstWell.Length() - 1].m_nGroundEle - dEleStart) * dScaleY, ptStartG);
|
||
|
||
BOOL bDrawGround = FALSE;
|
||
for(int i=0;i<m_lstWell.Length();i++)
|
||
{
|
||
if(m_lstWell[i].m_bIsWell) //井
|
||
{
|
||
if(fabs(m_lstWell[i].m_nGroundEle) > 0.0001)
|
||
{
|
||
bDrawGround = TRUE;
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
// 管线长
|
||
double dPipeLen = 0.0;
|
||
// // cet 2017.8.28 add 获取所有交叉信息
|
||
// DList<AcDbObjectId> lstPipe;
|
||
// for(int i = 0; i < m_lstWell.Length(); ++i)
|
||
// {
|
||
// if(!m_lstWell[i].m_bIsWell)
|
||
// {
|
||
// lstPipe.Append(new AcDbObjectId(m_lstWell[i].m_ID));
|
||
// }
|
||
// }
|
||
// std::vector<CrossPoint> vecCrossPoint;
|
||
// CalcCrossPipes(lstPipe, lstAllPipe, vecCrossPoint, IsShowPipeEndNotLinkedPipe());
|
||
std::vector<CrossPoint> vecCrossPoint;
|
||
GetCrossPointInfo(vecCrossPoint);
|
||
for(i=m_lstWell.Length() - 1;i>=0;i--)
|
||
{
|
||
double dEle = m_lstWell[i].m_nUpEle - dEleStart; //井面标高
|
||
double dEleG = m_lstWell[i].m_nGroundEle - dEleStart;//地面标高
|
||
if(m_lstWell[i].m_bIsWell)
|
||
{ //井
|
||
BOOL bPool = m_lstWell[i].m_csName == _T("HC");
|
||
CString str = m_lstWell[i].m_csName;
|
||
if(i != m_lstWell.Length() - 1)
|
||
iDn = InnerDn(m_lstWell[i + 1].m_ID) * dScaleY / 1000; //前井管径
|
||
if(i != 0)
|
||
iDn2 = InnerDn(m_lstWell[i - 1].m_ID) * dScaleY / 1000; // 后井管径
|
||
|
||
// 当前井埋深
|
||
double dDeep = m_lstWell[i].m_nDeep * dScaleY;
|
||
double dDeepLeft = dDeep;
|
||
|
||
// 井直径
|
||
double nWellDia = fabs(m_lstWell[i].m_nWellRadius * dScaleX * 0.002);//支持米单位
|
||
// cet 2016.12.8 add 池的长度
|
||
OPENOBJ_BEGIN(m_lstWell[i].m_ID, AcDb::kForRead, TDbPool, pEquip);
|
||
if(pEquip != NULL)
|
||
{
|
||
nWellDia = pEquip->GetSizeX() * dScaleX;
|
||
if(!DocGetMeterUnitDraw())//图纸是毫米单位
|
||
nWellDia = nWellDia / 1000.0;
|
||
}
|
||
OPENOBJ_END();
|
||
if(m_lstWell[i].m_csName == _T("断管") && dPipeLen > 0){
|
||
double nI = m_lstWell[i + 1].m_nI;
|
||
double nLow = nI * dPipeLen/2;
|
||
XPoint ptEndRight,ptEndRight1;
|
||
ads_polar(ptPreWellBtmUpRight, m_nLayoutRotation, dPipeLen/2, ptEndRight);
|
||
ads_polar(ptEndRight, m_nLayoutRotation+PI/2, -nLow, ptEndRight);
|
||
DrawPLine(ptPreWellBtmUpRight, ptEndRight, dc, 0.35*GetPScale());//井底上边线
|
||
ads_polar(ptPreWellBtmUpRight, m_nLayoutRotation-PI/2, iDn2, ptPreWellBtmUpRight);
|
||
ads_polar(ptPreWellBtmUpRight, m_nLayoutRotation, dPipeLen/2, ptEndRight1);
|
||
ads_polar(ptEndRight1, m_nLayoutRotation+PI/2, -nLow, ptEndRight1);
|
||
|
||
DrawPLine(ptPreWellBtmUpRight, ptEndRight1, dc, 0.35*GetPScale());//井底边线
|
||
DrawBreakPipe(ptEndRight, ptEndRight1, dc);
|
||
ads_polar(ptStart, 0, dPipeLen, ptEnd);
|
||
// cet 2016.5.10 add 右端断管
|
||
int nCount = m_lstWell.Length();
|
||
if (i == 0)
|
||
{
|
||
XPoint pt1, pt2, pt3, pt4;
|
||
double nWellDia = fabs(m_lstWell[2].m_nWellRadius * dScaleX * 0.002);
|
||
ads_polar(ptStart, m_nLayoutRotation, nWellDia/2, pt1);
|
||
// 管道首端连着化粪池
|
||
if (i < m_lstWell.Length() - 2 && m_lstWell[2].m_csName == _T("HC"))
|
||
{
|
||
OPENOBJ_BEGIN(m_lstWell[2].m_ID, AcDb::kForRead, TDbPool, pEquip);
|
||
if(pEquip != NULL)
|
||
{
|
||
double dPoolLen = pEquip->GetSizeX() * GetPScale() / 100;
|
||
ads_polar(ptStart, m_nLayoutRotation, dPoolLen * 0.5, pt1);
|
||
}
|
||
OPENOBJ_END();
|
||
}
|
||
ads_polar(pt1, m_nLayoutRotation, dPipeLen/2, pt2);
|
||
ads_polar(pt1, m_nLayoutRotation-PI/2, 3*GetPScale(), pt3);
|
||
ads_polar(pt2, m_nLayoutRotation-PI/2, 3*GetPScale(), pt4);
|
||
XPoly2D poly2d;
|
||
poly2d.AppendNode(pt1);
|
||
poly2d.AppendNode(pt3);
|
||
poly2d.AppendNode(pt4);
|
||
poly2d.AppendNode(pt2);
|
||
// cet 2018.2.8 modify 填充
|
||
// if(!!objectId())
|
||
// dc.DrawHatch(poly2d, _T("AR-HBONE"), 0.5*GetPScale());//动态拖动速度极慢
|
||
DrawHatch(dc, poly2d);
|
||
}
|
||
continue;
|
||
}
|
||
else if(m_lstWell[i].m_csName == _T("断管") && dPipeLen < 0.0001){
|
||
continue;
|
||
}
|
||
|
||
//把井盖填平
|
||
if(dPipeLen < 0.001)
|
||
{
|
||
ads_polar(ptStart, m_nLayoutRotation+PI/2, dEle * dScaleY, ptStart);
|
||
ads_polar(ptStart, m_nLayoutRotation+PI, nWellDia/2, ptWellLeft);
|
||
ads_polar(ptStart, m_nLayoutRotation, nWellDia/2, ptWellRight);
|
||
|
||
// 开始井盖
|
||
DrawLine(ptWellLeft, ptWellRight, dc);
|
||
}
|
||
|
||
if(dPipeLen > 0)
|
||
{
|
||
ads_polar(ptStart, m_nLayoutRotation, dPipeLen, ptEnd);
|
||
dEle = m_lstWell[i].m_nUpEle - m_lstWell[i+2].m_nUpEle; //井面标高
|
||
|
||
// 先得到设计地面标高的点ptEnd
|
||
ads_polar(ptEnd, m_nLayoutRotation+PI/2, dEle*dScaleY, ptEnd);
|
||
// 再根据设计地面标高的点ptEnd,算出自然地面标高点(根据他们之差)sr 2009-12-21 修改
|
||
ads_polar(ptEnd, m_nLayoutRotation+PI/2, (m_lstWell[i].m_nGroundEle - m_lstWell[i].m_nUpEle)*dScaleY, ptEndG);
|
||
|
||
if(bDrawGround)
|
||
DrawDoteLine(ptStartG, ptEndG, dc);
|
||
|
||
|
||
ads_polar(ptEnd, m_nLayoutRotation+PI, nWellDia / 2, ptWellLeft);
|
||
ads_polar(ptEnd, m_nLayoutRotation, nWellDia / 2, ptWellRight);
|
||
|
||
DrawLine(ptWellLeft, ptWellRight, dc);//把井盖填平
|
||
// cet 2016.12.7 modify 使用管道首端井的宽度
|
||
// ads_polar(ptStart, m_nLayoutRotation, nWellDia / 2, ptPreWellRight);
|
||
int nSize = m_lstWell.Length();
|
||
ads_polar(ptStart, m_nLayoutRotation, i < nSize - 2 ? fabs(m_lstWell[i + 2].m_nWellRadius * dScaleX * 0.002) / 2 : nWellDia / 2, ptPreWellRight);
|
||
if (i <= m_lstWell.Length() - 3 && m_lstWell[i + 2].m_csName == _T("HC"))
|
||
{
|
||
OPENOBJ_BEGIN(m_lstWell[i + 2].m_ID, AcDb::kForRead, TDbPool, pEquip);
|
||
if(pEquip != NULL)
|
||
{
|
||
double dPoolLen = pEquip->GetSizeX() * dScaleX;
|
||
if(!DocGetMeterUnitDraw())//图纸是毫米单位
|
||
dPoolLen = dPoolLen / 1000.0;
|
||
ads_polar(ptStart, m_nLayoutRotation, dPoolLen * 0.5, ptPreWellRight);
|
||
}
|
||
OPENOBJ_END();
|
||
}
|
||
DrawLine(ptPreWellRight, ptWellLeft, dc);//绘制地面线
|
||
// cet 2016.12.7 modify 使用管道首端井的宽度
|
||
// ads_polar(ptStart, m_nLayoutRotation, nWellDia / 2, ptWellLeft);
|
||
ads_polar(ptStart, m_nLayoutRotation, i < nSize - 2 ? fabs(m_lstWell[i + 2].m_nWellRadius * dScaleX * 0.002) / 2 : nWellDia / 2, ptWellLeft);
|
||
// cet 2016.5.10 add 管道首端连着化粪池
|
||
if (i <= m_lstWell.Length() - 3 && m_lstWell[i + 2].m_csName == _T("HC"))
|
||
{
|
||
OPENOBJ_BEGIN(m_lstWell[i + 2].m_ID, AcDb::kForRead, TDbPool, pEquip);
|
||
if(pEquip != NULL)
|
||
{
|
||
double dPoolLen = pEquip->GetSizeX() * dScaleX;
|
||
if(!DocGetMeterUnitDraw())//图纸是毫米单位
|
||
dPoolLen = dPoolLen / 1000.0;
|
||
ads_polar(ptStart, m_nLayoutRotation, dPoolLen * 0.5, ptWellLeft);
|
||
}
|
||
OPENOBJ_END();
|
||
}
|
||
ads_polar(ptEnd, m_nLayoutRotation+PI, nWellDia / 2, ptWellRight);
|
||
// cet 2016.5.10 add 管道尾端连着化粪池
|
||
if (m_lstWell[i].m_csName == _T("HC"))
|
||
{
|
||
OPENOBJ_BEGIN(m_lstWell[i].m_ID, AcDb::kForRead, TDbPool, pEquip);
|
||
if(pEquip != NULL)
|
||
{
|
||
double dPoolLen = pEquip->GetSizeX() * dScaleX;
|
||
if(!DocGetMeterUnitDraw())//图纸是毫米单位
|
||
dPoolLen = dPoolLen / 1000.0;
|
||
ads_polar(ptEnd, m_nLayoutRotation+PI, dPoolLen * 0.5, ptWellRight);
|
||
}
|
||
OPENOBJ_END();
|
||
}
|
||
ads_polar(ptWellLeft, m_nLayoutRotation-PI/2, 3*GetPScale(), ptHatchLeft);
|
||
ads_polar(ptWellRight, m_nLayoutRotation-PI/2, 3*GetPScale(), ptHatchRight);
|
||
XPoly2D poly2d;
|
||
poly2d.AppendNode(ptWellLeft);
|
||
poly2d.AppendNode(ptHatchLeft);
|
||
poly2d.AppendNode(ptHatchRight);
|
||
poly2d.AppendNode(ptWellRight);
|
||
// cet 2018.2.8 modify 填充
|
||
// if(!!objectId())
|
||
// dc.DrawHatch(poly2d, _T("AR-HBONE"), 0.5*GetPScale());//动态拖动速度极慢
|
||
DrawHatch(dc, poly2d);
|
||
|
||
ptStart = ptEnd;
|
||
ptStartG = ptEndG;
|
||
}
|
||
|
||
double dPoolEleUp(0), dPoolEleDown(0);
|
||
if(bPool){
|
||
OPENOBJ_BEGIN(m_lstWell[i].m_ID, AcDb::kForRead, TDbPool, pEquip);
|
||
if(pEquip){
|
||
double dPoolLen = pEquip->GetSizeX();
|
||
if(dPoolLen > 100.0)//图纸是毫米单位
|
||
dPoolLen = dPoolLen / 1000.0;
|
||
nWellDia = dPoolLen * dScaleX;//化粪池的长度
|
||
dPoolEleUp = pEquip->GetTopBanEle();
|
||
dPoolEleDown = pEquip->GetBottomBanEle();
|
||
}
|
||
OPENOBJ_END();
|
||
|
||
//如果化粪池有顶板,底板标高,则绘制化粪池矩形示意图
|
||
if(fabs(dPoolEleUp) > 0.01 && fabs(dPoolEleDown) > 0.01){
|
||
XPoint ptPool1, ptPool2, ptPool3, ptPool4;
|
||
ads_polar(ptEnd, m_nLayoutRotation+PI, nWellDia/2, ptPool1);
|
||
ads_polar(ptEnd, m_nLayoutRotation, nWellDia/2, ptPool2);
|
||
|
||
double dPoolDeepDown = m_lstWell[i].m_nUpEle - dPoolEleDown;
|
||
ads_polar(ptPool1, m_nLayoutRotation-PI/2, dPoolDeepDown * dScaleY, ptPool3);
|
||
ads_polar(ptPool2, m_nLayoutRotation-PI/2, dPoolDeepDown * dScaleY, ptPool4);
|
||
DrawLine(ptPool3, ptPool4, dc);
|
||
|
||
double dPoolDeepUp = m_lstWell[i].m_nUpEle - dPoolEleUp;
|
||
ads_polar(ptPool1, m_nLayoutRotation-PI/2, dPoolDeepUp * dScaleY, ptPool1);
|
||
ads_polar(ptPool2, m_nLayoutRotation-PI/2, dPoolDeepUp * dScaleY, ptPool2);
|
||
DrawLine(ptPool1, ptPool2, dc);
|
||
|
||
DrawLine(ptPool1, ptPool3, dc);
|
||
DrawLine(ptPool2, ptPool4, dc);
|
||
}
|
||
|
||
}
|
||
|
||
|
||
// 还原当前井面的左右坐标
|
||
ads_polar(ptStart, m_nLayoutRotation+PI, nWellDia / 2, ptWellLeft);
|
||
ads_polar(ptStart, m_nLayoutRotation, nWellDia / 2, ptWellRight);
|
||
|
||
if(m_iCalcMode == 100) // 计算模式
|
||
dDeepLeft = dDeep - iDn;
|
||
else if(m_iCalcMode == 101) // 管顶平接
|
||
dDeepLeft = dDeep - iDn2;
|
||
else if(m_iCalcMode == 102) // 管底平接
|
||
dDeepLeft = dDeep - iDn2 - (iDn-iDn2)/2;
|
||
else if(m_iCalcMode == 3) // 给水系统
|
||
break;
|
||
|
||
XPoint ptUpLeft2;
|
||
if(i != m_lstWell.Length() - 1 && (m_lstWell[i].m_bIsDropWell || bPool))
|
||
{ //给水系统没有跌水井
|
||
double dDropDeep = m_lstWell[i].m_nUpEle - m_lstWell[i].m_nFrondDownEle;
|
||
ads_polar(ptWellLeft, m_nLayoutRotation-PI/2, m_lstWell[i].m_nDeep * dScaleY - iDn, ptWellDownLeft);
|
||
ads_polar(ptWellRight, m_nLayoutRotation-PI/2, m_lstWell[i].m_nDeep * dScaleY - iDn, ptWellDownRight);
|
||
}
|
||
else{
|
||
ads_polar(ptWellLeft, m_nLayoutRotation-PI/2, dDeepLeft, ptWellDownLeft);
|
||
ads_polar(ptWellRight, m_nLayoutRotation-PI/2, dDeepLeft, ptWellDownRight);
|
||
if(m_iCalcMode == 100)
|
||
{
|
||
ads_polar(ptWellDownLeft, m_nLayoutRotation-PI/2, iDn, ptTmp);
|
||
ads_polar(ptWellDownLeft, m_nLayoutRotation-PI/2, iDn2, ptUpLeft2);
|
||
ads_polar(ptWellDownRight, m_nLayoutRotation-PI/2, iDn, ptWellDis1);
|
||
ads_polar(ptWellDownRight, m_nLayoutRotation-PI/2, iDn2, ptWellDis2);
|
||
}
|
||
else if(m_iCalcMode == 101)
|
||
{
|
||
ads_polar(ptWellDownLeft, m_nLayoutRotation-PI/2, iDn2, ptTmp);
|
||
ads_polar(ptWellDownRight, m_nLayoutRotation-PI/2, iDn2, ptWellDis1);
|
||
ptWellDis1 = ptWellDis2;
|
||
ads_polar(ptWellLeft, m_nLayoutRotation-PI/2, dDeep-iDn, ptWellDownLeft);
|
||
}
|
||
else if(m_iCalcMode == 102)
|
||
{
|
||
ads_polar(ptWellDownLeft, m_nLayoutRotation-PI/2, iDn2+(iDn-iDn2)/2, ptTmp);
|
||
ads_polar(ptWellDownRight, m_nLayoutRotation-PI/2, iDn2+(iDn-iDn2)/2, ptWellDis1);
|
||
ads_polar(ptWellDownRight, m_nLayoutRotation-PI/2, iDn2, ptWellDis2);
|
||
ads_polar(ptWellLeft, m_nLayoutRotation-PI/2, dDeep-iDn, ptWellDownLeft);
|
||
}
|
||
|
||
}
|
||
|
||
if(!ptWellDis2)
|
||
ptWellDis2 = ptWellDis1;
|
||
|
||
if(m_lstWell[i].m_csName != _T("HC")) //如果是节点或者就不画井了
|
||
{
|
||
//井左边线
|
||
if(i == m_lstWell.Length() - 1)
|
||
{
|
||
DrawPLine(ptWellLeft, ptTmp, dc, 0.3*GetPScale());
|
||
}
|
||
else
|
||
{
|
||
DrawPLine(ptWellLeft, ptWellDownLeft, dc, 0.3*GetPScale());
|
||
}
|
||
}
|
||
|
||
|
||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||
// 绘制表示本井其它管标高的管,用椭圆表示
|
||
OPENOBJ_BEGIN(m_lstWell[i].m_ID, AcDb::kForRead, TDbEquipment, pEquip);
|
||
if(pEquip)
|
||
{
|
||
int num = pEquip->GetInterfaceNum();
|
||
if(num > 1) // cet 2016.9.6 modify 未考虑起始端井连接的管道
|
||
{
|
||
for(int j=0;j<num;j++)
|
||
{
|
||
TPipeInterface face;
|
||
pEquip->GetInterface(j, face);
|
||
if(i>0 && face.m_idPipe == m_lstWell[i-1].m_ID)
|
||
continue;
|
||
if(i< m_lstWell.Length() - 1 && face.m_idPipe == m_lstWell[i+1].m_ID)
|
||
continue;
|
||
double nPipeDownEle = 0.0;
|
||
double dOuterDn = 0.0, dPipeThick = 0.0;
|
||
double nThirdDn(0);
|
||
AcDbObjectId idLay = NULL;
|
||
bool bBranch = true; // cet 2016.9.8 add 是否为支路
|
||
OPENOBJ_BEGIN(face.m_idPipe, AcDb::kForRead, TDbPipe, pPipe);
|
||
if(pPipe)
|
||
{
|
||
// cet 2011.12.5 add 判断交叉管是否需要显示
|
||
if (!IsShowCrossPipe(pPipe->objectId()))
|
||
{
|
||
continue;
|
||
}
|
||
idLay = pPipe->layerId();
|
||
nThirdDn = (pPipe->OuterDn() - pPipe->GetPipeThick() * 2) * dScaleY / 1000;
|
||
// cet 2016.7.6 add 计算管内底标高, 内径
|
||
double dDn = (pPipe->OuterDn() - pPipe->GetPipeThick() * 2) / 2000;
|
||
if (pPipe->StartPoint().Distance2d(face.m_ptLocation) < 0.001)
|
||
{
|
||
nPipeDownEle = pPipe->StartPoint().z / dUnitMeter - dDn;
|
||
}
|
||
else
|
||
{
|
||
nPipeDownEle = pPipe->EndPoint().z / dUnitMeter - dDn;
|
||
}
|
||
dOuterDn = pPipe->OuterDn();
|
||
dPipeThick = pPipe->GetPipeThick();
|
||
bBranch = IsBrach(pPipe, m_lstWell[i].m_ID); // cet 2016.9.8 add 是否为支路
|
||
}
|
||
OPENOBJ_END();
|
||
// cet 2016.7.6 del 直接获取管底标高
|
||
// CString csPipeDownEle = pEquip->GetISysLabel(j);
|
||
// if(csPipeDownEle == _T(""))
|
||
// continue;
|
||
// double nPipeDownEle = _tstof(csPipeDownEle);
|
||
// cet 2016.9.8 modify 细化显示控制
|
||
// if(fabs(nPipeDownEle - m_lstWell[i].m_nDownEle) > 0.001) // cet 2016.9.6 modify 不绘制管内底标高与井底标高一致的管道
|
||
if ((IsOnlyShowBranch() && bBranch || !IsOnlyShowBranch()) && // 控制是否只显示支路
|
||
((fabs(nPipeDownEle - m_lstWell[i].m_nDownEle) > 0.001) && !IsShowEqualEleBranch() || IsShowEqualEleBranch())) // 是否只显示等高支路
|
||
{
|
||
XPoint ptEllipse;
|
||
double nThirdPipeDeep = m_lstWell[i].m_nUpEle - nPipeDownEle;
|
||
ads_polar(ptStart, m_nLayoutRotation-PI/2, nThirdPipeDeep * dScaleY - nThirdDn/2, ptEllipse);
|
||
bool bRet = false;
|
||
DrawEllipse(ptEllipse, (dOuterDn - dPipeThick * 2) * dScaleY * 0.0005, (dOuterDn - dPipeThick * 2) * dScaleX * 0.0005, idLay, dc, &bRet);
|
||
// cet 2011.6.2 add 标注碰撞管内底标高
|
||
if (bRet && IsDimEle())
|
||
{
|
||
CString ss;
|
||
DimEle(ptEllipse, (dOuterDn - dPipeThick * 2) * dScaleY * 0.0005, (dOuterDn - dPipeThick * 2) * dScaleX * 0.0005, nPipeDownEle, ss, true, dc);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
OPENOBJ_END();
|
||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||
|
||
|
||
XPoint ptBottomRight, ptUpRight, ptBottomLeft(ptTmp);
|
||
ads_polar(ptWellRight, m_nLayoutRotation-PI/2, dDeep, ptBottomRight);
|
||
if(i == 0)
|
||
ptUpRight = ptBottomRight; //最后一个井
|
||
else
|
||
{
|
||
if(i != m_lstWell.Length() - 1 && (m_lstWell[i].m_bIsDropWell || bPool)) // 判断粪池
|
||
{
|
||
double dDropDeep = m_lstWell[i].m_nUpEle - m_lstWell[i].m_nFrondDownEle;
|
||
ads_polar(ptWellRight, m_nLayoutRotation-PI/2, dDropDeep * dScaleY - iDn, ptUpRight);
|
||
}
|
||
else
|
||
{
|
||
ads_polar(ptWellRight, m_nLayoutRotation-PI/2, dDeepLeft, ptUpRight);
|
||
}
|
||
}
|
||
|
||
|
||
if(m_lstWell[i].m_csName != _T("HC"))
|
||
{
|
||
if(m_lstWell[i].m_bIsDropWell)
|
||
{
|
||
if(i > 0)
|
||
{
|
||
// 跌水井的右边线
|
||
XPoint ptTmp1;
|
||
double dDropDeep = m_lstWell[i].m_nUpEle - m_lstWell[i].m_nFrondDownEle;
|
||
ads_polar(ptWellRight, m_nLayoutRotation-PI/2, dDropDeep * dScaleY - iDn2, ptUpRight);
|
||
DrawPLine(ptWellRight , ptUpRight, dc, 0.3*GetPScale());
|
||
ads_polar(ptUpRight, m_nLayoutRotation-PI/2, iDn2, ptBottomRight);
|
||
ads_polar(ptWellRight, m_nLayoutRotation-PI/2, m_lstWell[i].m_nDeep * dScaleY, ptTmp1);
|
||
DrawPLine(ptBottomRight , ptTmp1, dc, 0.3*GetPScale());
|
||
}
|
||
else
|
||
{
|
||
DrawPLine(ptWellRight, ptUpRight, dc, 0.3*GetPScale()); //井右边线
|
||
}
|
||
}
|
||
else
|
||
{
|
||
DrawPLine(ptWellRight, ptUpRight, dc, 0.3*GetPScale()); //井右边线
|
||
if (ptWellDis1 != ptWellDis2)//管径不一样
|
||
DrawPLine(ptWellDis1,ptWellDis2,dc,0.3*GetPScale());
|
||
}
|
||
if(m_lstWell[i].m_nSpare > 0) //绘制沉沙井
|
||
{
|
||
double dDeepSand = m_lstWell[i].m_nSpare / 1000 * dScaleY;
|
||
XPoint ptSandRight, ptSandLeft;
|
||
ads_polar(ptWellLeft, m_nLayoutRotation-PI / 2, m_lstWell[i].m_nDeep * dScaleY, ptBottomRight);
|
||
ads_polar(ptWellRight, m_nLayoutRotation-PI / 2, m_lstWell[i].m_nDeep * dScaleY, ptBottomLeft);
|
||
ads_polar(ptBottomRight, m_nLayoutRotation+PI/2*3, dDeepSand, ptSandRight);
|
||
ads_polar(ptBottomLeft, m_nLayoutRotation+PI/2*3, dDeepSand, ptSandLeft);
|
||
DrawPLine(ptSandRight, ptSandLeft, dc, 0.35*GetPScale()); //井底边线
|
||
DrawPLine(ptBottomRight, ptSandRight, dc, 0.35*GetPScale());//沉沙边线
|
||
DrawPLine(ptBottomLeft, ptSandLeft, dc, 0.35*GetPScale()); //跌水井左下边线
|
||
}
|
||
else
|
||
{
|
||
double dDropDeep2 = m_lstWell[i].m_nFrondDownEle - m_lstWell[i].m_nDownEle;
|
||
if(dDropDeep2 < 0)
|
||
{ //虹吸井,往上跌水
|
||
XPoint ptBottomRight2;
|
||
ads_polar(ptBottomLeft, m_nLayoutRotation, nWellDia, ptBottomRight2);
|
||
DrawPLine(ptBottomRight2, ptBottomLeft, dc, 0.35*GetPScale());//井底边线
|
||
DrawPLine(ptBottomRight2, ptBottomRight, dc, 0.35*GetPScale());//井底边线
|
||
}
|
||
else
|
||
{
|
||
// 跌水井的底线
|
||
ads_polar(ptWellLeft, m_nLayoutRotation-PI / 2, m_lstWell[i].m_nDeep * dScaleY, ptBottomRight);
|
||
ads_polar(ptWellRight, m_nLayoutRotation-PI / 2, m_lstWell[i].m_nDeep * dScaleY, ptBottomLeft);
|
||
DrawPLine(ptBottomRight, ptBottomLeft, dc, 0.35*GetPScale());//井底边线
|
||
}
|
||
}
|
||
}
|
||
|
||
if(dPipeLen > 0)
|
||
{
|
||
DrawPLine(ptPreWellBtmUpRight, ptWellDownLeft, dc, 0.35*GetPScale()); //横管上线
|
||
ads_polar(ptPreWellBtmUpRight, m_nLayoutRotation-PI / 2, iDn, ptPreWellBtmDownRight);
|
||
ads_polar(ptWellDownLeft, m_nLayoutRotation-PI / 2, iDn, ptTmp);
|
||
DrawPLine(ptPreWellBtmDownRight,ptTmp,dc, 0.35*GetPScale()); //横管下线
|
||
}
|
||
|
||
// 临时记录当前井的右上管线的值
|
||
ptPreWellBtmUpRight = ptUpRight; // PT7井管顶右边点
|
||
|
||
//前断管
|
||
if(dPipeLen < 0.001 && i != m_lstWell.Length() - 1)
|
||
{
|
||
double nI = m_lstWell[i-1].m_nI;
|
||
dPipeLen = 10*GetPScale();
|
||
double nLow = nI * dPipeLen/2;
|
||
XPoint ptTmp1,ptTmp2;
|
||
ads_polar(ptWellDownLeft, m_nLayoutRotation+PI, dPipeLen/2, ptTmp);
|
||
ads_polar(ptTmp, m_nLayoutRotation+PI/2, nLow, ptTmp);
|
||
DrawPLine(ptWellDownLeft, ptTmp, dc, 0.35*GetPScale()); //井底边线
|
||
ads_polar(ptWellDownLeft, m_nLayoutRotation-PI / 2, iDn, ptWellDownLeft);
|
||
ads_polar(ptWellDownLeft, m_nLayoutRotation+PI, dPipeLen/2, ptTmp1);
|
||
ads_polar(ptTmp1, m_nLayoutRotation+PI/2, nLow, ptTmp1);
|
||
DrawPLine(ptWellDownLeft, ptTmp1, dc, 0.35*GetPScale());//井底边线
|
||
|
||
DrawBreakPipe(ptTmp, ptTmp1, dc);
|
||
// cet 2016.5.10 add 左端断管
|
||
int nCount = m_lstWell.Length();
|
||
if (i == m_lstWell.Length() - 3)
|
||
{
|
||
XPoint pt1, pt2, pt3, pt4;
|
||
double nWellDia = fabs(m_lstWell[i].m_nWellRadius * dScaleX * 0.002);
|
||
ads_polar(ptStart, m_nLayoutRotation, -nWellDia/2, pt1);
|
||
// 管道尾端连着化粪池
|
||
if (m_lstWell[i].m_csName == _T("HC"))
|
||
{
|
||
OPENOBJ_BEGIN(m_lstWell[i].m_ID, AcDb::kForRead, TDbPool, pEquip);
|
||
if(pEquip != NULL)
|
||
{
|
||
double dPoolLen = pEquip->GetSizeX() * GetPScale() / 100;
|
||
ads_polar(ptStart, m_nLayoutRotation, -dPoolLen * 0.5, pt1);
|
||
}
|
||
OPENOBJ_END();
|
||
}
|
||
ads_polar(pt1, m_nLayoutRotation, -dPipeLen/2, pt2);
|
||
ads_polar(pt1, m_nLayoutRotation-PI/2, 3*GetPScale(), pt3);
|
||
ads_polar(pt2, m_nLayoutRotation-PI/2, 3*GetPScale(), pt4);
|
||
XPoly2D poly2d;
|
||
poly2d.AppendNode(pt1);
|
||
poly2d.AppendNode(pt3);
|
||
poly2d.AppendNode(pt4);
|
||
poly2d.AppendNode(pt2);
|
||
// cet 2018.2.8 modify 填充
|
||
// if(!!objectId())
|
||
// dc.DrawHatch(poly2d, _T("AR-HBONE"), 0.5*GetPScale());//动态拖动速度极慢
|
||
DrawHatch(dc, poly2d);
|
||
}
|
||
}
|
||
dPipeLen = 0;
|
||
}
|
||
else if(!m_lstWell[i].m_bIsWell){ //管
|
||
// double dLenPipe = m_lstWell[i].m_nLength;
|
||
// if(dLenPipe > 1000)// 7.0 管长用mm
|
||
// dLenPipe = dLenPipe/1000.0;
|
||
dPipeLen = m_lstWell[i].m_nLength * dScaleX;
|
||
if(m_lstWell[i].m_dRealLength > 0.1)
|
||
dPipeLen = m_lstWell[i].m_dRealLength * dScaleX; //实际管长
|
||
// cet 2016.5.10 add 右侧末尾连接断管
|
||
if (i == 1 && m_lstWell[0].m_csName == _T("断管") && m_lstWell.Length() > 3)
|
||
{
|
||
dPipeLen = m_lstWell[i].m_nLength * dScaleX;
|
||
}
|
||
if(m_lstWell[i + 1].m_csName == _T("断管"))
|
||
dPipeLen = 0;
|
||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||
//2006-10-20 沈睿 加入考虑其它交叉管线
|
||
AcDbObjectId idPipe = m_lstWell[i].m_ID;
|
||
OPENOBJ_BEGIN(idPipe, AcDb::kForRead, TDbPipe, pPipe);
|
||
if(pPipe != NULL && m_lstWell[i + 1].m_csName != _T("断管"))
|
||
{
|
||
//-------------------------------------------------------------------------------------------
|
||
// ZXL 2013.12.06 ADD 管线交叉在此处处理(包括标高高于自身的管线的处理)
|
||
DList<AcDbObjectId> lstCrossPipes;
|
||
CrossPoint cr(pPipe->objectId());
|
||
GetCrossInfo(vecCrossPoint, cr);
|
||
cr.GetAllCrossPipes(lstCrossPipes);
|
||
int nPipeNum = lstCrossPipes.Length();
|
||
|
||
XPoint ptEllipse, ptInt;
|
||
int nIndex = 0;
|
||
for(int j=0;j<nPipeNum;j++){
|
||
AcDbObjectId idOther = *lstCrossPipes[j];
|
||
OPENOBJ_BEGIN(idOther, AcDb::kForRead, TDbPipe, pPipe2);
|
||
if(pPipe2){
|
||
// cet 2011.12.5 add 判断交叉管是否需要显示
|
||
if (!IsShowCrossPipe(pPipe2->objectId()))
|
||
{
|
||
continue;
|
||
}
|
||
double dDn = pPipe2->OuterDn() - pPipe2->GetPipeThick() * 2;
|
||
double dI = pPipe2->GetPipeGradient();
|
||
double dPipeStartEle(0);
|
||
dDn = dDn / 2000;
|
||
if(pPipe2->GetFlowDir() == TPipeSys::kFromStart)
|
||
dPipeStartEle = pPipe2->StartPoint().z/dUnitMeter - dDn;
|
||
else
|
||
dPipeStartEle = pPipe2->EndPoint().z/dUnitMeter - dDn;
|
||
double nDist2Well1(0), nDist2Well2(0);
|
||
cr.GetCrossInfo(idOther, ptInt, nDist2Well1, nDist2Well2);
|
||
if(fabs(nDist2Well1) > 0.001 && fabs(nDist2Well2) > 0.001 || IsShowPipeEndNotLinkedPipe() && (fabs(nDist2Well1) > 0.001 || fabs(nDist2Well2) > 0.001))
|
||
{
|
||
AcDbObjectId idLay = pPipe2->layerId();
|
||
// int iDnTmp = int(dDn*dScaleY);
|
||
double dDnTmp = dDn*dScaleY;
|
||
double nPipeIntEle = dPipeStartEle - nDist2Well2*dI; //根据相交管线起点标高计算交点标高
|
||
double nThirdPipeDeep = m_lstWell[i-1].m_nUpEle - nPipeIntEle;//转换为埋深
|
||
ads_polar(ptStart, m_nLayoutRotation-PI/2, nThirdPipeDeep * dScaleY - dDnTmp, ptEllipse);
|
||
double dLen = pPipe->GetLength();
|
||
ads_polar(ptEllipse, m_nLayoutRotation, (dLen / dUnitMeter - nDist2Well1) * dScaleX, ptEllipse);
|
||
double dOuterDn = pPipe2->OuterDn();
|
||
double dPipeThick = pPipe2->GetPipeThick();
|
||
bool bRet = false;
|
||
DrawEllipse(ptEllipse, (dOuterDn - dPipeThick * 2) * dScaleY * 0.0005, (dOuterDn - dPipeThick * 2) * dScaleX * 0.0005, idLay, dc, &bRet);
|
||
// cet 2011.6.3 add 标注碰撞管内底标高
|
||
if (bRet && IsDimEle())
|
||
{
|
||
CString sPipeName = pPipe2->GetPipeSystemName();
|
||
sPipeName += _T("管");
|
||
CString sLabel = pPipe2->GetLabel();
|
||
sPipeName += sLabel;
|
||
sLabel.Format(_T("%.f"), pPipe2->GetDnDiameter());
|
||
sPipeName += sLabel;
|
||
DimEle(ptEllipse, (dOuterDn - dPipeThick * 2) * dScaleY * 0.0005, (dOuterDn - dPipeThick * 2) * dScaleX * 0.0005, nPipeIntEle, sPipeName, false, dc);
|
||
}
|
||
|
||
// zxl 2013.12.06 add
|
||
if (bRet && IsDimDist())
|
||
{
|
||
XPoint pt;
|
||
ads_polar(ptStart, m_nLayoutRotation, dLen / dUnitMeter * dScaleX, pt);
|
||
CString sDim;
|
||
sDim.Format(_T("%.2f"), nDist2Well1 * dUnitMeter);
|
||
if (dUnitMeter > 1.0)
|
||
{
|
||
sDim.Format(_T("%.f"), nDist2Well1 * dUnitMeter);
|
||
}
|
||
DimDist(sDim, pt, ptEllipse, dc, nIndex, nThirdPipeDeep, dOuterDn * dScaleY * 0.0005, true);
|
||
}
|
||
}
|
||
|
||
}
|
||
OPENOBJ_END();
|
||
}
|
||
}
|
||
OPENOBJ_END();
|
||
}
|
||
}
|
||
|
||
return Acad::eOk;
|
||
}
|
||
|
||
//绘制给水的支管, 要求必须是TDbPipeFitting,且连接水管在2根以上
|
||
//往AcDbObjectIdArray中添加一个对象, 如何已经存在就不添加
|
||
BOOL TDbVerticalSection::AppendIdArray(AcDbObjectIdArray &idArray, AcDbObjectId id) const
|
||
{
|
||
BOOL bFlag = FALSE;
|
||
OPENOBJ_BEGIN(id, AcDb::kForRead, TDbPipeFitting, pNode);
|
||
if(pNode){
|
||
if(pNode->GetInterfaceNum() > 2)
|
||
bFlag = TRUE;
|
||
}
|
||
OPENOBJ_END();
|
||
if(!bFlag)
|
||
return FALSE;
|
||
|
||
int len = idArray.length();
|
||
for(int i=0;i<len;i++){
|
||
AcDbObjectId idTmp = idArray[i];
|
||
if(idTmp == id)
|
||
return FALSE;
|
||
}
|
||
idArray.append(id);
|
||
return TRUE;
|
||
}
|
||
|
||
Acad::ErrorStatus TDbVerticalSection::DrawCivilSheet(XExplodeDraw &dc, XPoint ptEnd) const
|
||
{
|
||
double nSheetHeight = m_dTextHeight+3;
|
||
XStringList lstHead;
|
||
int idx2(1);
|
||
double nWellNameRow(0), nStakeRow(0), nWellRaiusRow(0), nDeepRow(0), nGroundEleRow(0), nUpEleRow(0), nThicknessRow(0), nDownEleRow(0), nTmpHeight(0);
|
||
while(1){
|
||
TCHAR sBuf[256]=_T("");
|
||
CT_strnth(m_sSheetHead, idx2, sBuf);
|
||
if(_tcsicmp(sBuf, _T("")) == 0)
|
||
break;
|
||
lstHead.Append(tstrnew(sBuf));
|
||
idx2++;
|
||
if(_tcsicmp(sBuf, _T("井编号")) == 0){
|
||
nWellNameRow = nTmpHeight;
|
||
nTmpHeight += nSheetHeight;
|
||
}
|
||
else if(_tcsicmp(sBuf, _T("桩号")) == 0){
|
||
nStakeRow = nTmpHeight;
|
||
nTmpHeight += nSheetHeight;
|
||
}
|
||
else if(_tcsicmp(sBuf, _T("井径(mm)")) == 0){
|
||
nWellRaiusRow = nTmpHeight;
|
||
nTmpHeight += nSheetHeight;
|
||
}
|
||
else if(_tcsicmp(sBuf, _T("设计地面标高(m)")) == 0){
|
||
nUpEleRow = nTmpHeight;
|
||
nTmpHeight += nSheetHeight*2.5;
|
||
}
|
||
else if(_tcsicmp(sBuf, _T("自然地面标高(m)")) == 0){
|
||
nGroundEleRow = nTmpHeight;
|
||
nTmpHeight += nSheetHeight*2.5;
|
||
}
|
||
else if(_tcsicmp(sBuf, _T("埋设深度(m)")) == 0){
|
||
nDeepRow = nTmpHeight;
|
||
nTmpHeight += nSheetHeight*2;
|
||
}
|
||
else if(_tcsicmp(sBuf, _T("覆土厚度(m)")) == 0){
|
||
nThicknessRow = nTmpHeight;
|
||
nTmpHeight += nSheetHeight*2;
|
||
}
|
||
else if(_tcsicmp(sBuf, _T("管标高(m)")) == 0){
|
||
nDownEleRow = nTmpHeight;
|
||
nTmpHeight += nSheetHeight*2.5;
|
||
}
|
||
else
|
||
nTmpHeight += nSheetHeight;
|
||
}
|
||
int iDemoRow = lstHead.Index(_T("备注"));
|
||
int iPipeLenRow = lstHead.Index(_T("管道长度(m)"));
|
||
int iGradientRow = lstHead.Index(_T("管道坡度"));
|
||
int iDnRow = lstHead.Index(_T("管径(mm)"));
|
||
int iWellNameRow = lstHead.Index(_T("井编号"));
|
||
int iUpEleRow = lstHead.Index(_T("设计地面标高(m)"));
|
||
int iDeepRow = lstHead.Index(_T("埋设深度(m)"));
|
||
int iThicknessRow = lstHead.Index(_T("覆土厚度(m)"));
|
||
int iGroundEleRow = lstHead.Index(_T("自然地面标高(m)"));
|
||
int iWellRadiusRow = lstHead.Index(_T("井径(mm)"));
|
||
int iDownEleRow = lstHead.Index(_T("管标高(m)"));
|
||
int iPipePlanRow = lstHead.Index(_T("管线平面"));
|
||
int iStakeRow = lstHead.Index(_T("桩号"));
|
||
|
||
BOOL bBreak1 = FALSE;
|
||
BOOL bBreak2 = FALSE;
|
||
if(m_iCalcMode < 100) // 原来代码 按选择井的顺序画
|
||
{
|
||
if(m_lstWell[0].m_csName == _T("断管"))
|
||
bBreak1 = TRUE;
|
||
if(m_lstWell[m_lstWell.Length()-1].m_csName == _T("断管"))
|
||
bBreak2 = TRUE;
|
||
}
|
||
else // add by 王辉 按选择井的反顺序画 08-05-05
|
||
{
|
||
if(m_lstWell[0].m_csName == _T("断管"))
|
||
bBreak2 = TRUE;
|
||
if(m_lstWell[m_lstWell.Length()-1].m_csName == _T("断管"))
|
||
bBreak1 = TRUE;
|
||
}
|
||
|
||
double dScaleY = m_iScaleY;
|
||
double dScaleX = m_iScaleX;
|
||
dScaleX = GetPScale() / dScaleX * 1000;
|
||
dScaleY = GetPScale() / dScaleY * 1000;//转化为毫米
|
||
|
||
XPoint ptCivilIns = ptEnd;
|
||
XPoint ptIns = ptCivilIns;
|
||
ads_polar(ptCivilIns, m_nLayoutRotation+PI, 45*GetPScale(), ptCivilIns);
|
||
|
||
//绘制表格
|
||
AcDbObjectId idTextStyle = m_idTextStyle;
|
||
TDbSheet pSheet;
|
||
// cet 2018.2.7 modify 表格图层与网格一致
|
||
// pSheet.setLayer(this->layerId());
|
||
pSheet.setLayer(this->GetGridLayer());
|
||
pSheet.SetPScale(GetPScale());
|
||
pSheet.SetRotation(m_nLayoutRotation);
|
||
TGridStyle gridStyle;
|
||
gridStyle.SetOverrideAll(TRUE);
|
||
gridStyle.SetTextHeight(m_dTextHeight);
|
||
gridStyle.SetTextStyleId(idTextStyle);
|
||
|
||
TSheetTitle &title=pSheet.GetTitle();
|
||
title.SetHeight(nSheetHeight);
|
||
title.SetVisible(FALSE);
|
||
|
||
gridStyle.SetHorMode(AcDb::kTextCenter);
|
||
gridStyle.SetVerMode(AcDb::kTextVertMid);
|
||
gridStyle.SetLineSpaceFactor(0.2);
|
||
gridStyle.SetTextWrap(FALSE);
|
||
pSheet.SetGridStyle(gridStyle);
|
||
pSheet.SetRowHeight(m_dTextHeight+2);
|
||
if(bBreak2 || bBreak1)
|
||
pSheet.InitSheet(lstHead.Length(), bBreak1 && bBreak2 ? m_lstWell.Length()/2+1 : m_lstWell.Length()/2+2, nSheetHeight, 50); // cet 2016.5.9 modify 没有考虑两端同时存在断管的情况
|
||
else
|
||
pSheet.InitSheet(lstHead.Length(), m_lstWell.Length()/2+3, nSheetHeight, 50);
|
||
|
||
TSheetColumn column;
|
||
column.SetWidth(25); //表头
|
||
pSheet.SetColumnAt(0, column);
|
||
|
||
TSheetColumn column2;
|
||
if(!bBreak2 && !bBreak1){
|
||
column2.SetWidth(5); //表尾
|
||
pSheet.SetColumnAt(m_lstWell.Length()/2+2, column2);
|
||
}
|
||
if(bBreak1){
|
||
column2.SetWidth(5); //表尾
|
||
pSheet.SetColumnAt(bBreak2 ? m_lstWell.Length()/2 : m_lstWell.Length()/2+1, column2); // cet 2016.5.9 modify 未考虑两端同为断管的情况
|
||
}
|
||
double nWidth = 20 * GetPScale();
|
||
|
||
XPoint ptCellS, ptCellE, ptText, ptWell;
|
||
|
||
ptCellS = ptIns;
|
||
double dPipeLen(0);
|
||
int idx = 1;
|
||
int iDn(0);
|
||
int nGsMarker=1;
|
||
pSheet.SetLocation(ptCivilIns);
|
||
|
||
if(m_iCalcMode < 100) // 原来代码 按选择井的顺序画
|
||
{
|
||
for(int i=0;i<m_lstWell.Length();i++)
|
||
{
|
||
|
||
AcDbObjectId id = m_lstWell[i].m_ID;
|
||
if(m_lstWell[i].m_bIsWell){ //井
|
||
if(m_lstWell[i].m_csName == _T("断管") && dPipeLen > 0){
|
||
TSheetColumn column3;
|
||
column3.SetWidth(dPipeLen/GetPScale()); //表尾
|
||
pSheet.SetColumnAt(pSheet.GetColumnNum() - 1, column3); // cet 2016.5.9 modify 未考虑两端同为断管的情况
|
||
continue;
|
||
}
|
||
if(m_lstWell[i].m_csName == _T("断管") && dPipeLen < 0.001){
|
||
continue;
|
||
}
|
||
|
||
double nEle = m_lstWell[i].m_nUpEle;
|
||
double nDeep = m_lstWell[i].m_nDeep;
|
||
double nDownEle = m_lstWell[i].m_nDownEle;
|
||
double nGroundDeep = m_lstWell[i].m_nDeep;
|
||
double nFrondEle = m_lstWell[i].m_nFrondDownEle;
|
||
double nGroundEle = m_lstWell[i].m_nGroundEle;
|
||
double dWellRadius = m_lstWell[i].m_nWellRadius;
|
||
// cet 2016.5.12 modify 覆土厚度=埋设深度-管内径-壁厚
|
||
// //先试试外径 2009-6.9 sr
|
||
// double dOutDn(0), dDn(0);
|
||
// if(i == m_lstWell.Length() - 1)
|
||
// {
|
||
// dOutDn = (double)m_lstWell[i-1].m_iSpare / 1000;
|
||
// dDn = (double)m_lstWell[i-1].m_iDn / 1000;
|
||
// }
|
||
// else
|
||
// {
|
||
// dOutDn = (double)m_lstWell[i+1].m_iSpare / 1000;
|
||
// dDn = (double)m_lstWell[i+1].m_iDn / 1000;
|
||
// }
|
||
//
|
||
// if(dOutDn < 0.0001)
|
||
// nGroundDeep -= dDn; //不带外径
|
||
// else
|
||
// {
|
||
// // cet 2016.5.11 modify 覆土厚度=埋设深度-管外径的一半
|
||
// // nGroundDeep -= (dDn + (dOutDn-dDn) / 2);//带外径
|
||
// nGroundDeep -= dOutDn / 2.0;
|
||
// }
|
||
double dOuterDn = 0.0, dThick = 0.0;
|
||
int nIndex = (i == m_lstWell.Length() - 1) ? i - 1 : i + 1;
|
||
dOuterDn = m_lstWell[nIndex].m_iDn;
|
||
OPENOBJ_BEGIN(m_lstWell[nIndex].m_ID, AcDb::kForRead, TDbPipe, pPipe);
|
||
if (pPipe != NULL)
|
||
{
|
||
if (pPipe->OuterDn() > 0.001)
|
||
{
|
||
dOuterDn = pPipe->OuterDn();
|
||
}
|
||
dThick = pPipe->GetPipeThick();
|
||
}
|
||
OPENOBJ_END();
|
||
dOuterDn *= 0.001;
|
||
dThick *= 0.001;
|
||
nGroundDeep = nDeep - (dOuterDn - dThick * 2) - dThick;
|
||
|
||
CString csWellUpEle, csDeep, csDownEle, csGroundDeep, csFrontEle, csGroundEle, csWellRaius;
|
||
CString csWellName = m_lstWell[i].m_csName;
|
||
|
||
csWellRaius.Format(_T("%%%%c%.0f"), dWellRadius*2.0);
|
||
if(dWellRadius < 0)
|
||
csWellRaius = _T("矩形井");
|
||
|
||
int iPre = GetWellDeepPrecision(this->database());
|
||
CString sHead,sFormat;
|
||
sHead.Format(_T("%d"),iPre);
|
||
sFormat = _T("%.") + sHead + _T("f");
|
||
csDeep.Format(sFormat, nDeep);
|
||
csGroundEle.Format(sFormat, nGroundEle);
|
||
csDownEle.Format(sFormat, nDownEle);
|
||
csWellUpEle.Format(sFormat, nEle);
|
||
csGroundDeep.Format(sFormat, nGroundDeep);
|
||
csFrontEle.Format(sFormat, nFrondEle);
|
||
|
||
ads_polar(ptCellS, m_nLayoutRotation, dPipeLen, ptCellS);
|
||
XPoint ptCellS2 = ptCellS;
|
||
double dPoolLength(0);
|
||
if(m_lstWell[i].m_csName == _T("HC"))
|
||
{
|
||
OPENOBJ_BEGIN(m_lstWell[i].m_ID, AcDb::kForRead, TDbPool, pEquip);
|
||
if(pEquip){
|
||
dPoolLength = pEquip->GetPoolLength();
|
||
if(!DocGetMeterUnitDraw())
|
||
dPoolLength = dPoolLength / 1000;
|
||
if(iDemoRow > -1 && i > 1 && m_lstWell[i].m_csName == _T("HC")) //备注
|
||
{
|
||
TGridCell &cell24=*(pSheet)(iDemoRow, idx+1);
|
||
// cet 2016.11.3 modify 池名称可能不是化粪池
|
||
// cell24.SetText(XString(_T("化粪池L=%.2f"), dPoolLength));
|
||
CString sName = _T("化粪池"), sTemp;
|
||
bool bRet = true;
|
||
sTemp = pEquip->GetName(&bRet);
|
||
if (bRet) // 池设置了名称
|
||
{
|
||
sName = sTemp;
|
||
}
|
||
cell24.SetText(XString(_T("%sL=%.2f"), sName, dPoolLength));
|
||
}
|
||
dPoolLength = dPoolLength *dScaleX;
|
||
}
|
||
OPENOBJ_END();
|
||
ads_polar(ptCellS, m_nLayoutRotation, dPoolLength, ptCellS2);
|
||
}
|
||
|
||
if(iWellNameRow > -1){//名称
|
||
// cet 2013.3.1 modify 获得池子的真实名称
|
||
// if(m_lstWell[i].m_csName == _T("HC"))
|
||
// csWellName = _T("HC进");
|
||
CString sName;
|
||
if (m_lstWell[i].m_csName == _T("HC"))
|
||
{
|
||
sName = GetPoolName(m_lstWell[i].m_ID);
|
||
csWellName = sName + _T("进");
|
||
}
|
||
|
||
ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nWellNameRow + nSheetHeight/2) * GetPScale(), ptText);
|
||
DrawText(ptText, csWellName, XExplodeDraw::kMiddleCenter, dc);
|
||
if(m_lstWell[i].m_csName == _T("HC"))
|
||
{
|
||
ads_polar(ptCellS2, m_nLayoutRotation-PI/2, (nWellNameRow + nSheetHeight/2) * GetPScale(), ptText);
|
||
// cet 2013.3.1 modify 获得池子的真实名称
|
||
// DrawText(ptText, _T("HC出"), XExplodeDraw::kMiddleCenter, dc);
|
||
DrawText(ptText, sName + _T("出"), XExplodeDraw::kMiddleCenter, dc);
|
||
}
|
||
}
|
||
if(iWellRadiusRow > -1){
|
||
ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nWellRaiusRow + nSheetHeight/2) * GetPScale(), ptText);
|
||
DrawText(ptText, csWellRaius, XExplodeDraw::kMiddleCenter, dc);
|
||
}
|
||
|
||
if(iUpEleRow > -1){//地面标高
|
||
ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nUpEleRow + nSheetHeight/3) * GetPScale(), ptText);
|
||
DrawText(ptText, csWellUpEle, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
if(m_lstWell[i].m_csName == _T("HC"))
|
||
{
|
||
ads_polar(ptCellS2, m_nLayoutRotation-PI/2, (nUpEleRow + nSheetHeight/3) * GetPScale(), ptText);
|
||
DrawText(ptText, csWellUpEle, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
}
|
||
}
|
||
if(iGroundEleRow > -1){//自然地面标高
|
||
ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nGroundEleRow + nSheetHeight/3) * GetPScale(), ptText);
|
||
DrawText(ptText, csGroundEle, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
if(m_lstWell[i].m_csName == _T("HC"))
|
||
{
|
||
ads_polar(ptCellS2, m_nLayoutRotation-PI/2, (nGroundEleRow + nSheetHeight/3) * GetPScale(), ptText);
|
||
DrawText(ptText, csGroundEle, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
}
|
||
}
|
||
if(iStakeRow > -1){//桩号
|
||
AcDbObjectId id = m_lstWell[i].m_ID;
|
||
ads_name entWell;
|
||
acdbGetAdsName(entWell, id);
|
||
CString csStake = ReadXdata(entWell, _T("TWT-STAKEVALUE"));
|
||
|
||
ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nStakeRow + nSheetHeight/2) * GetPScale(), ptText);
|
||
DrawText(ptText, csStake, XExplodeDraw::kMiddleCenter, dc);
|
||
}
|
||
if(iDeepRow > -1 && m_iCalcMode != 3){//埋深
|
||
if(!m_lstWell[i].m_bIsDropWell){
|
||
if(m_lstWell[i].m_csName == _T("HC"))
|
||
{
|
||
CString csDeep2;
|
||
double nDeep2 = m_lstWell[i].m_nUpEle - m_lstWell[i].m_nFrondDownEle;
|
||
csDeep2.Format(sFormat, fabs(nDeep2));
|
||
ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nDeepRow + nSheetHeight/3) * GetPScale(), ptText);
|
||
DrawText(ptText, csDeep2, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
ads_polar(ptCellS2, m_nLayoutRotation-PI/2, (nDeepRow + nSheetHeight/3) * GetPScale(), ptText);
|
||
DrawText(ptText, csDeep, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
}
|
||
else
|
||
{
|
||
ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nDeepRow + nSheetHeight/3) * GetPScale(), ptText);
|
||
DrawText(ptText, csDeep, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
}
|
||
|
||
}
|
||
else{
|
||
ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nDeepRow + nSheetHeight/3) * GetPScale(), ptText);
|
||
XPoint ptTmpText = ptText;
|
||
if(i != 0){
|
||
CString csDeep2;
|
||
double nDeep2 = m_lstWell[i].m_nUpEle - m_lstWell[i].m_nFrondDownEle;
|
||
csDeep2.Format(sFormat, fabs(nDeep2));
|
||
ads_polar(ptText, m_nLayoutRotation+PI, GetPScale()*2, ptTmpText);
|
||
DrawText(ptTmpText, csDeep2, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
}
|
||
// if(i != m_lstWell.Length() - 1){
|
||
ads_polar(ptText, m_nLayoutRotation, GetPScale()*2, ptTmpText);
|
||
DrawText(ptTmpText, csDeep, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
// }
|
||
}
|
||
}
|
||
if(iThicknessRow > -1 && m_iCalcMode != 3){// 雨污 覆土厚度
|
||
// cet 2016.5.12 add 获得外径和壁厚
|
||
double dOuterDn = 0.0, dThick = 0.0;
|
||
if (!m_lstWell[i].m_bIsDropWell && m_lstWell[i].m_csName == _T("HC") || i != 0)
|
||
{
|
||
dOuterDn = m_lstWell[i - 1].m_iDn;
|
||
OPENOBJ_BEGIN(m_lstWell[i - 1].m_ID, AcDb::kForRead, TDbPipe, pPipe);
|
||
if (pPipe != NULL)
|
||
{
|
||
if (pPipe->OuterDn() > 0.001)
|
||
{
|
||
dOuterDn = pPipe->OuterDn();
|
||
}
|
||
dThick = pPipe->GetPipeThick();
|
||
}
|
||
OPENOBJ_END();
|
||
}
|
||
if(!m_lstWell[i].m_bIsDropWell){
|
||
if(m_lstWell[i].m_csName == _T("HC"))
|
||
{
|
||
CString csDeep2;
|
||
// cet 2016.5.12 modify 应使用内径和壁厚计算
|
||
// double nDeep2 = m_lstWell[i].m_nUpEle - m_lstWell[i].m_nFrondDownEle-(double)m_lstWell[i-1].m_iDn/1000;
|
||
double nDeep2 = m_lstWell[i].m_nUpEle - m_lstWell[i].m_nFrondDownEle - (dOuterDn - dThick * 2) * 0.001 - dThick * 0.001;
|
||
csDeep2.Format(sFormat, fabs(nDeep2));
|
||
ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nThicknessRow + nSheetHeight/2) * GetPScale(), ptText);
|
||
DrawText(ptText, csDeep2, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
ads_polar(ptCellS2, m_nLayoutRotation-PI/2, (nThicknessRow + nSheetHeight/2) * GetPScale(), ptText);
|
||
DrawText(ptText, csGroundDeep, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
}
|
||
else
|
||
{
|
||
ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nThicknessRow + nSheetHeight/2) * GetPScale(), ptText);
|
||
DrawText(ptText, csGroundDeep, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
}
|
||
}
|
||
else{
|
||
ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nThicknessRow + nSheetHeight/3) * GetPScale(), ptText);
|
||
XPoint ptTmpText = ptText;
|
||
if(i != 0){
|
||
CString csDeep2;
|
||
// cet 2016.5.12 modify 应使用内径和壁厚计算
|
||
// double nDeep2 = m_lstWell[i].m_nUpEle - m_lstWell[i].m_nFrondDownEle-(double)m_lstWell[i-1].m_iDn/1000;
|
||
double nDeep2 = m_lstWell[i].m_nUpEle - m_lstWell[i].m_nFrondDownEle - (dOuterDn - dThick * 2) * 0.001 - dThick * 0.001;
|
||
csDeep2.Format(sFormat, fabs(nDeep2));
|
||
ads_polar(ptText, m_nLayoutRotation+PI, GetPScale()*2, ptTmpText);
|
||
DrawText(ptTmpText, csDeep2, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
}
|
||
// if(i != m_lstWell.Length() - 1){
|
||
ads_polar(ptText, m_nLayoutRotation, GetPScale()*2, ptTmpText);
|
||
DrawText(ptTmpText, csGroundDeep, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
// }
|
||
}
|
||
}
|
||
|
||
if(iDownEleRow > -1){ //管内底标高
|
||
if(csFrontEle == csDownEle || i == 0){
|
||
ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nDownEleRow + nSheetHeight/3) * GetPScale(), ptText);
|
||
DrawText(ptText, csDownEle, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
}
|
||
else{
|
||
if(m_lstWell[i].m_csName == _T("HC"))
|
||
{
|
||
ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nDownEleRow + nSheetHeight/3) * GetPScale(), ptText);
|
||
DrawText(ptText, csFrontEle, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
ads_polar(ptCellS2, m_nLayoutRotation-PI/2, (nDownEleRow + nSheetHeight/3) * GetPScale(), ptText);
|
||
DrawText(ptText, csDownEle, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
}
|
||
else
|
||
{
|
||
ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nDownEleRow + nSheetHeight/3) * GetPScale(), ptText);
|
||
XPoint ptTmpText = ptText;
|
||
if(i != 0){
|
||
ads_polar(ptText, m_nLayoutRotation+PI, GetPScale()*2, ptTmpText);
|
||
DrawText(ptTmpText, csFrontEle, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
}
|
||
// if(i != m_lstWell.Length() - 1){ //2009-6-11 最后1个井,刚好是跌水井
|
||
ads_polar(ptText, m_nLayoutRotation, GetPScale()*2, ptTmpText);
|
||
DrawText(ptTmpText, csDownEle, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
// }
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
TSheetColumn column4;
|
||
column4.SetWidth(nWidth/GetPScale()); //序号
|
||
pSheet.SetColumnAt(idx, column4);
|
||
idx++;
|
||
if(m_lstWell[i].m_csName == _T("HC"))
|
||
{
|
||
pSheet.AddColumnAt(pSheet.GetColumnNum());
|
||
TSheetColumn column5;
|
||
column5.SetWidth(dPoolLength/GetPScale()); //序号
|
||
pSheet.SetColumnAt(idx, column5);
|
||
idx++;
|
||
ads_polar(ptCellS, m_nLayoutRotation, dPoolLength, ptCellS);
|
||
}
|
||
|
||
|
||
}
|
||
else if(!m_lstWell[i].m_bIsWell)
|
||
{ //管
|
||
dPipeLen = m_lstWell[i].m_nLength * dScaleX;
|
||
nWidth = dPipeLen;
|
||
if(m_lstWell[i-1].m_csName == _T("断管")){
|
||
nWidth = 20 * GetPScale();
|
||
dPipeLen = 0;
|
||
}
|
||
|
||
iDn = m_lstWell[i].m_iDn;
|
||
CString csDn, csPipeLen, csI, csLable;
|
||
OPENOBJ_BEGIN(id, AcDb::kForRead, TDbPipe, pPipe);
|
||
if(pPipe){
|
||
csLable = pPipe->GetLabel();
|
||
}
|
||
OPENOBJ_END();
|
||
|
||
csDn.Format(_T("%s%d"), csLable, iDn);
|
||
|
||
csI = I2Str(m_lstWell[i].m_nI * 1000);
|
||
|
||
////////////////////////
|
||
int iPre = GetPipeLenPrecision(this->database());
|
||
CString sHead,sFormat;
|
||
sHead.Format(_T("%d"),iPre);
|
||
sFormat = _T("%.") + sHead + _T("f");
|
||
csPipeLen.Format(sFormat, m_lstWell[i].m_nLength);
|
||
|
||
|
||
if(iDnRow > -1){
|
||
TGridCell &cell21=*(pSheet)(iDnRow, idx);
|
||
cell21.SetText(csDn);
|
||
}
|
||
if(iPipeLenRow > -1){
|
||
TGridCell &cell22=*(pSheet)(iPipeLenRow, idx);
|
||
cell22.SetText(csPipeLen);
|
||
}
|
||
if(iGradientRow > -1){
|
||
TGridCell &cell23=*(pSheet)(iGradientRow, idx);
|
||
cell23.SetText(csI);
|
||
}
|
||
|
||
if(iDemoRow > -1 && i > 1 && m_lstWell[i-1].m_bIsDropWell && m_iCalcMode != 3){
|
||
TGridCell &cell24=*(pSheet)(iDemoRow, idx);
|
||
double nDrop = m_lstWell[i-1].m_nDownEle - m_lstWell[i-1].m_nFrondDownEle;
|
||
cell24.SetText(XString(_T("跌落%.2f米"), fabs(nDrop)));
|
||
TGridStyle gridStyle2;
|
||
gridStyle2.SetOverrideAll(TRUE);
|
||
gridStyle2.SetHorMode(AcDb::kTextLeft);
|
||
gridStyle2.SetTextHeight(m_dTextHeight);
|
||
cell24.SetGridStyle(gridStyle2);
|
||
}
|
||
}//if 管
|
||
}//FOR m_lstWell
|
||
}
|
||
else // add by 王辉 按选择井的反顺序画 08-05-05
|
||
{
|
||
for(int i = m_lstWell.Length() - 1;i >= 0; i--)
|
||
{
|
||
AcDbObjectId id = m_lstWell[i].m_ID;
|
||
if(m_lstWell[i].m_bIsWell)
|
||
{ //井
|
||
if(m_lstWell[i].m_csName == _T("断管") && dPipeLen > 0)
|
||
{
|
||
TSheetColumn column3;
|
||
column3.SetWidth(dPipeLen/GetPScale()); //表尾
|
||
pSheet.SetColumnAt(pSheet.GetColumnNum() - 1, column3); // cet 2016.5.9 modify 未考虑两端同为断管的情况
|
||
continue;
|
||
}
|
||
|
||
if(m_lstWell[i].m_csName == _T("断管") && dPipeLen < 0.001)
|
||
{
|
||
continue;
|
||
}
|
||
double nEle = m_lstWell[i].m_nUpEle;
|
||
double nDeep = m_lstWell[i].m_nDeep;
|
||
double nDownEle = m_lstWell[i].m_nDownEle;
|
||
double nGroundDeep = m_lstWell[i].m_nDeep;
|
||
double nFrondEle = m_lstWell[i].m_nFrondDownEle;
|
||
double nGroundEle = m_lstWell[i].m_nGroundEle;
|
||
double dWellRadius = m_lstWell[i].m_nWellRadius;
|
||
// cet 2016.5.12 modify 覆土厚度=埋设深度-管内径-壁厚
|
||
// //先试试外径 2009-6.9 sr
|
||
// double dOutDn(0), dDn(0);
|
||
// if(i == m_lstWell.Length() - 1)
|
||
// {
|
||
// dOutDn = (double)m_lstWell[i-1].m_iSpare / 1000;
|
||
// dDn = (double)m_lstWell[i-1].m_iDn / 1000;
|
||
// }
|
||
// else
|
||
// {
|
||
// dOutDn = (double)m_lstWell[i+1].m_iSpare / 1000;
|
||
// dDn = (double)m_lstWell[i+1].m_iDn / 1000;
|
||
// }
|
||
// if(dOutDn < 0.0001)
|
||
// nGroundDeep -= dDn; //不带外径
|
||
// else
|
||
// nGroundDeep -= (dDn + (dOutDn-dDn) / 2);//带外径
|
||
double dOuterDn = 0.0, dThick = 0.0;
|
||
int nIndex = (i == m_lstWell.Length() - 1) ? i - 1 : i + 1;
|
||
dOuterDn = m_lstWell[nIndex].m_iDn;
|
||
OPENOBJ_BEGIN(m_lstWell[nIndex].m_ID, AcDb::kForRead, TDbPipe, pPipe);
|
||
if (pPipe != NULL)
|
||
{
|
||
if (pPipe->OuterDn() > 0.001)
|
||
{
|
||
dOuterDn = pPipe->OuterDn();
|
||
}
|
||
dThick = pPipe->GetPipeThick();
|
||
}
|
||
OPENOBJ_END();
|
||
dOuterDn *= 0.001;
|
||
dThick *= 0.001;
|
||
nGroundDeep = nDeep - (dOuterDn - dThick * 2) - dThick;
|
||
|
||
CString csWellUpEle, csDeep, csDownEle, csGroundDeep, csFrontEle, csGroundEle, csWellRaius;
|
||
CString csWellName = m_lstWell[i].m_csName;
|
||
csWellRaius.Format(_T("%%%%c%.0f"), dWellRadius*2.0);
|
||
if(dWellRadius < 0)
|
||
csWellRaius = _T("矩形井");
|
||
|
||
int iPre = GetWellDeepPrecision(this->database());
|
||
CString sHead,sFormat;
|
||
sHead.Format(_T("%d"),iPre);
|
||
sFormat = _T("%.") + sHead + _T("f");
|
||
csDeep.Format(sFormat, nDeep);
|
||
csGroundEle.Format(sFormat, nGroundEle);
|
||
csDownEle.Format(sFormat, nDownEle);
|
||
csWellUpEle.Format(sFormat, nEle);
|
||
csGroundDeep.Format(sFormat, nGroundDeep);
|
||
csFrontEle.Format(sFormat, nFrondEle);
|
||
|
||
ads_polar(ptCellS, m_nLayoutRotation, dPipeLen, ptCellS);
|
||
XPoint ptCellS2 = ptCellS;
|
||
double dPoolLength(0);
|
||
if(m_lstWell[i].m_csName == _T("HC"))
|
||
{
|
||
OPENOBJ_BEGIN(m_lstWell[i].m_ID, AcDb::kForRead, TDbPool, pEquip);
|
||
if(pEquip){
|
||
dPoolLength = pEquip->GetPoolLength();
|
||
if(!DocGetMeterUnitDraw())
|
||
dPoolLength = dPoolLength / 1000;
|
||
if(iDemoRow > -1 && i > 1 && m_lstWell[i].m_csName == _T("HC")) //备注
|
||
{
|
||
TGridCell &cell24=*(pSheet)(iDemoRow, idx+1);
|
||
// cet 2016.11.3 modify 池名称可能不是化粪池
|
||
// cell24.SetText(XString(_T("化粪池L=%.2f"), dPoolLength));
|
||
CString sName = _T("化粪池"), sTemp;
|
||
bool bRet = true;
|
||
sTemp = pEquip->GetName(&bRet);
|
||
if (bRet) // 池设置了名称
|
||
{
|
||
sName = sTemp;
|
||
}
|
||
cell24.SetText(XString(_T("%sL=%.2f"), sName, dPoolLength));
|
||
}
|
||
dPoolLength = dPoolLength *dScaleX;
|
||
}
|
||
OPENOBJ_END();
|
||
ads_polar(ptCellS, m_nLayoutRotation, dPoolLength, ptCellS2);
|
||
}
|
||
|
||
|
||
if(iWellNameRow > -1)//名称
|
||
{
|
||
// cet 2013.3.1 modify 获得池子的真实名称
|
||
// if(m_lstWell[i].m_csName == _T("HC"))
|
||
// csWellName = _T("HC出");
|
||
CString sName;
|
||
if (m_lstWell[i].m_csName == _T("HC"))
|
||
{
|
||
sName = GetPoolName(m_lstWell[i].m_ID);
|
||
csWellName = sName + _T("出");
|
||
}
|
||
|
||
ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nWellNameRow + nSheetHeight/2) * GetPScale(), ptText);
|
||
DrawText(ptText, csWellName, XExplodeDraw::kMiddleCenter, dc);
|
||
if(m_lstWell[i].m_csName == _T("HC"))
|
||
{
|
||
ads_polar(ptCellS2, m_nLayoutRotation-PI/2, (nWellNameRow + nSheetHeight/2) * GetPScale(), ptText);
|
||
// cet 2013.3.1 modify 获得池子的真实名称
|
||
// DrawText(ptText, _T("HC进"), XExplodeDraw::kMiddleCenter, dc);
|
||
DrawText(ptText, sName + _T("进"), XExplodeDraw::kMiddleCenter, dc);
|
||
}
|
||
}
|
||
if(iWellRadiusRow > -1)
|
||
{
|
||
ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nWellRaiusRow + nSheetHeight/2) * GetPScale(), ptText);
|
||
DrawText(ptText, csWellRaius, XExplodeDraw::kMiddleCenter, dc);
|
||
}
|
||
|
||
if(iUpEleRow > -1)//地面标高
|
||
{
|
||
ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nUpEleRow + nSheetHeight/3) * GetPScale(), ptText);
|
||
DrawText(ptText, csWellUpEle, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
if(m_lstWell[i].m_csName == _T("HC"))
|
||
{
|
||
ads_polar(ptCellS2, m_nLayoutRotation-PI/2, (nUpEleRow + nSheetHeight/3) * GetPScale(), ptText);
|
||
DrawText(ptText, csWellUpEle, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
}
|
||
}
|
||
if(iGroundEleRow > -1)//自然地面标高
|
||
{
|
||
ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nGroundEleRow + nSheetHeight/3) * GetPScale(), ptText);
|
||
DrawText(ptText, csGroundEle, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
if(m_lstWell[i].m_csName == _T("HC"))
|
||
{
|
||
ads_polar(ptCellS2, m_nLayoutRotation-PI/2, (nGroundEleRow + nSheetHeight/3) * GetPScale(), ptText);
|
||
DrawText(ptText, csGroundEle, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
}
|
||
}
|
||
if(iStakeRow > -1){
|
||
AcDbObjectId id = m_lstWell[i].m_ID;
|
||
ads_name entWell;
|
||
acdbGetAdsName(entWell, id);
|
||
CString csStake = ReadXdata(entWell, _T("TWT-STAKEVALUE"));
|
||
|
||
ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nStakeRow + nSheetHeight/2) * GetPScale(), ptText);
|
||
DrawText(ptText, csStake, XExplodeDraw::kMiddleCenter, dc);
|
||
}
|
||
|
||
if(iDeepRow > -1 && m_iCalcMode != 3) //埋深
|
||
{
|
||
if(!m_lstWell[i].m_bIsDropWell){
|
||
if(m_lstWell[i].m_csName == _T("HC"))
|
||
{
|
||
CString csDeep2;
|
||
double nDeep2 = m_lstWell[i].m_nUpEle - m_lstWell[i].m_nFrondDownEle;
|
||
csDeep2.Format(sFormat, fabs(nDeep2));
|
||
ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nDeepRow + nSheetHeight/3) * GetPScale(), ptText);
|
||
DrawText(ptText, csDeep, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
ads_polar(ptCellS2, m_nLayoutRotation-PI/2, (nDeepRow + nSheetHeight/3) * GetPScale(), ptText);
|
||
DrawText(ptText, csDeep2, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
}
|
||
else
|
||
{
|
||
ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nDeepRow + nSheetHeight/3) * GetPScale(), ptText);
|
||
DrawText(ptText, csDeep, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
}
|
||
|
||
}
|
||
else{
|
||
ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nDeepRow + nSheetHeight/3) * GetPScale(), ptText);
|
||
XPoint ptTmpText = ptText;
|
||
//if(i != 0){
|
||
ads_polar(ptText, m_nLayoutRotation+PI, GetPScale()*2, ptTmpText);
|
||
DrawText(ptTmpText, csDeep, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
//}
|
||
if(i != 0){
|
||
CString csDeep2;
|
||
double nDeep2 = m_lstWell[i].m_nUpEle - m_lstWell[i].m_nFrondDownEle;
|
||
csDeep2.Format(sFormat, fabs(nDeep2));
|
||
|
||
ads_polar(ptText, m_nLayoutRotation, GetPScale()*2, ptTmpText);
|
||
DrawText(ptTmpText, csDeep2, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
}
|
||
}
|
||
|
||
}
|
||
if(iThicknessRow > -1 && m_iCalcMode != 3) // 雨污 覆土厚度
|
||
{
|
||
// cet 2016.5.12 add 获得外径和壁厚
|
||
double dOuterDn = 0.0, dThick = 0.0;
|
||
if (!m_lstWell[i].m_bIsDropWell && m_lstWell[i].m_csName == _T("HC") || i != 0)
|
||
{
|
||
dOuterDn = m_lstWell[i - 1].m_iDn;
|
||
OPENOBJ_BEGIN(m_lstWell[i - 1].m_ID, AcDb::kForRead, TDbPipe, pPipe);
|
||
if (pPipe != NULL)
|
||
{
|
||
if (pPipe->OuterDn() > 0.001)
|
||
{
|
||
dOuterDn = pPipe->OuterDn();
|
||
}
|
||
dThick = pPipe->GetPipeThick();
|
||
}
|
||
OPENOBJ_END();
|
||
}
|
||
if(!m_lstWell[i].m_bIsDropWell){
|
||
if(m_lstWell[i].m_csName == _T("HC"))
|
||
{
|
||
CString csDeep2;
|
||
// cet 2016.5.12 modify 应使用内径和壁厚计算
|
||
// double nDeep2 = m_lstWell[i].m_nUpEle - m_lstWell[i].m_nFrondDownEle-(double)m_lstWell[i-1].m_iDn/1000;
|
||
double nDeep2 = m_lstWell[i].m_nUpEle - m_lstWell[i].m_nFrondDownEle-(dOuterDn - dThick * 2) * 0.001 - dThick * 0.001;
|
||
csDeep2.Format(sFormat, fabs(nDeep2));
|
||
ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nThicknessRow + nSheetHeight/2) * GetPScale(), ptText);
|
||
DrawText(ptText, csGroundDeep, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
ads_polar(ptCellS2, m_nLayoutRotation-PI/2, (nThicknessRow + nSheetHeight/2) * GetPScale(), ptText);
|
||
DrawText(ptText, csDeep2, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
}
|
||
else
|
||
{
|
||
ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nThicknessRow + nSheetHeight/2) * GetPScale(), ptText);
|
||
DrawText(ptText, csGroundDeep, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
}
|
||
}
|
||
else{
|
||
ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nThicknessRow + nSheetHeight/3) * GetPScale(), ptText);
|
||
XPoint ptTmpText = ptText;
|
||
// if(i != 0){
|
||
ads_polar(ptText, m_nLayoutRotation+PI, GetPScale()*2, ptTmpText);
|
||
DrawText(ptTmpText, csGroundDeep, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
// }
|
||
if(i != 0){
|
||
CString csDeep2;
|
||
// cet 2016.5.12 modify 应使用内径和壁厚计算
|
||
// double nDeep2 = m_lstWell[i].m_nUpEle - m_lstWell[i].m_nFrondDownEle-(double)m_lstWell[i-1].m_iDn/1000;
|
||
double nDeep2 = m_lstWell[i].m_nUpEle - m_lstWell[i].m_nFrondDownEle-(dOuterDn - dThick * 2) * 0.001 - dThick * 0.001;
|
||
csDeep2.Format(sFormat, fabs(nDeep2));
|
||
ads_polar(ptText, m_nLayoutRotation, GetPScale()*2, ptTmpText);
|
||
DrawText(ptTmpText, csDeep2, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
}
|
||
}
|
||
}
|
||
|
||
if(iDownEleRow > -1)
|
||
{ //管内底标高, 或给水的管中标高
|
||
if(csFrontEle == csDownEle || i == 0){
|
||
ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nDownEleRow + nSheetHeight/3) * GetPScale(), ptText);
|
||
DrawText(ptText, csDownEle, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
}
|
||
else{
|
||
if(m_lstWell[i].m_csName == _T("HC"))
|
||
{
|
||
ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nDownEleRow + nSheetHeight/3) * GetPScale(), ptText);
|
||
DrawText(ptText, csDownEle, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
ads_polar(ptCellS2, m_nLayoutRotation-PI/2, (nDownEleRow + nSheetHeight/3) * GetPScale(), ptText);
|
||
DrawText(ptText, csFrontEle, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
}
|
||
else
|
||
{
|
||
ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nDownEleRow + nSheetHeight/3) * GetPScale(), ptText);
|
||
XPoint ptTmpText = ptText;
|
||
if(i != 0){
|
||
ads_polar(ptText, m_nLayoutRotation+PI, GetPScale()*2, ptTmpText);
|
||
DrawText(ptTmpText, csDownEle, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
}
|
||
// if(i != m_lstWell.Length() - 1){
|
||
ads_polar(ptText, m_nLayoutRotation, GetPScale()*2, ptTmpText);
|
||
DrawText(ptTmpText, csFrontEle, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
// }
|
||
}
|
||
}
|
||
}
|
||
|
||
ptWell = ptText;
|
||
TSheetColumn column4;
|
||
column4.SetWidth(nWidth/GetPScale()); //序号
|
||
pSheet.SetColumnAt(idx, column4);
|
||
idx++;
|
||
if(m_lstWell[i].m_csName == _T("HC"))
|
||
{
|
||
pSheet.AddColumnAt(pSheet.GetColumnNum());
|
||
TSheetColumn column5;
|
||
column5.SetWidth(dPoolLength/GetPScale()); //序号
|
||
pSheet.SetColumnAt(idx, column5);
|
||
idx++;
|
||
ads_polar(ptCellS, m_nLayoutRotation, dPoolLength, ptCellS);
|
||
}
|
||
}
|
||
else if(!m_lstWell[i].m_bIsWell) //管
|
||
{
|
||
dPipeLen = m_lstWell[i].m_nLength * dScaleX;
|
||
nWidth = dPipeLen;
|
||
if(m_lstWell[i+1].m_csName == _T("断管"))
|
||
{
|
||
nWidth = 20 * GetPScale();
|
||
dPipeLen = 0;
|
||
}
|
||
|
||
iDn = m_lstWell[i].m_iDn;
|
||
CString csDn, csPipeLen, csI, csLable;
|
||
OPENOBJ_BEGIN(id, AcDb::kForRead, TDbPipe, pPipe);
|
||
if(pPipe){
|
||
csLable = pPipe->GetLabel();
|
||
}
|
||
OPENOBJ_END();
|
||
|
||
csDn.Format(_T("%s%d"), csLable, iDn);
|
||
csI = I2Str(m_lstWell[i].m_nI * 1000);
|
||
|
||
////////////////////////
|
||
int iPre = GetPipeLenPrecision(this->database());
|
||
CString sHead,sFormat;
|
||
sHead.Format(_T("%d"),iPre);
|
||
sFormat = _T("%.") + sHead + _T("f");
|
||
csPipeLen.Format(sFormat, m_lstWell[i].m_nLength);
|
||
|
||
if(iDnRow > -1)
|
||
{
|
||
TGridCell &cell21=*(pSheet)(iDnRow, idx);
|
||
cell21.SetText(csDn);
|
||
}
|
||
if(iPipeLenRow > -1)
|
||
{
|
||
TGridCell &cell22=*(pSheet)(iPipeLenRow, idx);
|
||
cell22.SetText(csPipeLen);
|
||
}
|
||
if(iGradientRow > -1)
|
||
{
|
||
TGridCell &cell23=*(pSheet)(iGradientRow, idx);
|
||
cell23.SetText(csI);
|
||
}
|
||
|
||
if(iDemoRow > -1 && i > 1 && m_lstWell[i+1].m_bIsDropWell && m_iCalcMode != 3)
|
||
{
|
||
TGridCell &cell24=*(pSheet)(iDemoRow, idx);
|
||
double nDrop = m_lstWell[i+1].m_nDownEle - m_lstWell[i+1].m_nFrondDownEle;
|
||
cell24.SetText(XString(_T("跌落%.2f米"), fabs(nDrop)));
|
||
TGridStyle gridStyle2;
|
||
gridStyle2.SetOverrideAll(TRUE);
|
||
gridStyle2.SetHorMode(AcDb::kTextLeft);
|
||
gridStyle2.SetTextHeight(m_dTextHeight);
|
||
cell24.SetGridStyle(gridStyle2);
|
||
}
|
||
|
||
}
|
||
|
||
}
|
||
}
|
||
|
||
for(int j=0;j<lstHead.Length();j++){
|
||
TGridCell &cell=*(pSheet)(j, 0);
|
||
CString csHead = lstHead[j];
|
||
if(csHead == _T("管标高(m)")){
|
||
if(m_iCalcMode == 3)
|
||
cell.SetText(_T("管中标高(m)"));
|
||
else
|
||
cell.SetText(_T("管内底标高(m)"));
|
||
}
|
||
else
|
||
cell.SetText(csHead);
|
||
|
||
if(csHead.Find(_T("埋设深度")) > -1 || csHead.Find(_T("覆土厚度")) > -1 || csHead.Find(_T("管线平面")) > -1)
|
||
{
|
||
TSheetRow *row = pSheet.GetRow(j);
|
||
row->SetRowHeightStyle(TSheetRow::kFree);
|
||
row->SetHeight(nSheetHeight*2);
|
||
}
|
||
else if(csHead.Find(_T("设计地面标高")) > -1|| csHead.Find(_T("自然地面标高")) > -1 || csHead.Find(_T("管标高(m)")) > -1 )
|
||
{//这几个标高的行,很容易出界
|
||
TSheetRow *row = pSheet.GetRow(j);
|
||
row->SetRowHeightStyle(TSheetRow::kFree);
|
||
row->SetHeight(nSheetHeight*2.5);
|
||
}
|
||
|
||
if(csHead.Find(_T("设计地面标高")) > -1 || csHead.Find(_T("埋设深度")) > -1
|
||
|| csHead.Find(_T("桩号")) > -1 || csHead.Find(_T("管道基础")) > -1 || csHead.Find(_T("自然地面标高")) > -1
|
||
|| csHead.Find(_T("管材")) > -1 || csHead.Find(_T("管线平面")) > -1 || csHead.Find(_T("井径(mm)")) > -1
|
||
|| csHead.Find(_T("覆土厚度")) > -1 || csHead.Find(_T("井编号")) > -1 || csHead.Find(_T("管标高")) > -1)
|
||
{
|
||
pSheet.MergeCells(j, 1, j, pSheet.GetColumnNum()-1);
|
||
}
|
||
}
|
||
|
||
//绘制管线平面 sr add 2007-8-17 sr modify 2009-7-20 支持断管,支持反向绘制
|
||
if(iPipePlanRow > -1){
|
||
XPoint ptS, ptSize;
|
||
ptS = pSheet.GetCellPoint(iPipePlanRow, 1);
|
||
ads_polar(ptS, m_nLayoutRotation+PI/2, -nSheetHeight*GetPScale(), ptS);
|
||
ads_polar(ptS, m_nLayoutRotation, 20*GetPScale(), ptS);
|
||
if(m_iCalcMode < 100)
|
||
{
|
||
for(int i=0;i<m_lstWell.Length();i++){
|
||
AcDbObjectId id = m_lstWell[i].m_ID;
|
||
if(m_lstWell[i].m_bIsWell){ //井
|
||
CString csName = m_lstWell[i].m_csName;
|
||
if(csName == _T("断管"))
|
||
continue;
|
||
OPENOBJ_BEGIN(id, AcDb::kForRead, TDbWell, pEquip);
|
||
if(pEquip){
|
||
AcDbObjectId eqId = pEquip->GetBlock2d();
|
||
CString csBlkName = GetSymbolName(eqId).cs();
|
||
OPENOBJ_BEGIN(eqId, AcDb::kForRead, AcDbBlockTableRecord, pBlock);
|
||
if(pBlock) {
|
||
AcGeScale3d scale(pEquip->GetScale()*GetPScale(),pEquip->GetScale()*GetPScale(),pEquip->GetScale()*GetPScale());
|
||
dc.DrawBlock(*pBlock,ptS,scale,0,TRUE);
|
||
}
|
||
OPENOBJ_END();
|
||
}
|
||
OPENOBJ_END();
|
||
// idx++;
|
||
}
|
||
else if(!m_lstWell[i].m_bIsWell){
|
||
if(m_lstWell[i-1].m_csName == _T("断管") || m_lstWell[i+1].m_csName == _T("断管"))
|
||
continue;
|
||
XPoint ptTmp1, ptTmp2;
|
||
dPipeLen = m_lstWell[i].m_nLength * dScaleX;
|
||
if(m_lstWell[i].m_dRealLength > 0.1)
|
||
dPipeLen = m_lstWell[i].m_dRealLength * dScaleX; //实际管长
|
||
ptTmp1 = ptS;
|
||
ads_polar(ptS, m_nLayoutRotation, dPipeLen, ptS);
|
||
ptTmp2 = ptS;
|
||
AcDbObjectId id2 = m_lstWell[i-1].m_ID;
|
||
OPENOBJ_BEGIN(id2, AcDb::kForRead, TDbWell, pEquip);
|
||
if(pEquip){
|
||
if(pEquip->IsHidePipe()){
|
||
double dScale = pEquip->GetScale()*GetPScale();
|
||
ads_polar(ptTmp1, m_nLayoutRotation, dScale/2, ptTmp1);
|
||
}
|
||
}
|
||
OPENOBJ_END();
|
||
AcDbObjectId id3 = m_lstWell[i+1].m_ID;
|
||
OPENOBJ_BEGIN(id3, AcDb::kForRead, TDbWell, pEquip);
|
||
if(pEquip){
|
||
if(pEquip->IsHidePipe()){
|
||
double dScale = pEquip->GetScale()*GetPScale();
|
||
ads_polar(ptTmp2, m_nLayoutRotation, -dScale/2, ptTmp2);
|
||
}
|
||
}
|
||
OPENOBJ_END();
|
||
DrawLine(ptTmp1, ptTmp2, dc);
|
||
}
|
||
}
|
||
}
|
||
else //反向绘制
|
||
{
|
||
for(int i = m_lstWell.Length() - 1;i >= 0; i--){
|
||
AcDbObjectId id = m_lstWell[i].m_ID;
|
||
if(m_lstWell[i].m_bIsWell){ //井
|
||
CString csName = m_lstWell[i].m_csName;
|
||
if(csName == _T("断管"))
|
||
continue;
|
||
OPENOBJ_BEGIN(id, AcDb::kForRead, TDbWell, pEquip);
|
||
if(pEquip){
|
||
AcDbObjectId eqId = pEquip->GetBlock2d();
|
||
CString csBlkName = GetSymbolName(eqId).cs();
|
||
OPENOBJ_BEGIN(eqId, AcDb::kForRead, AcDbBlockTableRecord, pBlock);
|
||
if(pBlock) {
|
||
AcGeScale3d scale(pEquip->GetScale()*GetPScale(),pEquip->GetScale()*GetPScale(),pEquip->GetScale()*GetPScale());
|
||
dc.DrawBlock(*pBlock,ptS,scale,0,TRUE);
|
||
}
|
||
OPENOBJ_END();
|
||
}
|
||
OPENOBJ_END();
|
||
// idx++;
|
||
}
|
||
else if(!m_lstWell[i].m_bIsWell){
|
||
if(m_lstWell[i-1].m_csName == _T("断管") || m_lstWell[i+1].m_csName == _T("断管"))
|
||
continue;
|
||
XPoint ptTmp1, ptTmp2;
|
||
dPipeLen = m_lstWell[i].m_nLength * dScaleX;
|
||
if(m_lstWell[i].m_dRealLength > 0.1)
|
||
dPipeLen = m_lstWell[i].m_dRealLength * dScaleX; //实际管长
|
||
ptTmp1 = ptS;
|
||
ads_polar(ptS, m_nLayoutRotation, dPipeLen, ptS);
|
||
ptTmp2 = ptS;
|
||
AcDbObjectId id2 = m_lstWell[i-1].m_ID;
|
||
OPENOBJ_BEGIN(id2, AcDb::kForRead, TDbWell, pEquip);
|
||
if(pEquip){
|
||
if(pEquip->IsHidePipe()){
|
||
double dScale = pEquip->GetScale()*GetPScale();
|
||
ads_polar(ptTmp1, m_nLayoutRotation, dScale/2, ptTmp1);
|
||
}
|
||
}
|
||
OPENOBJ_END();
|
||
AcDbObjectId id3 = m_lstWell[i+1].m_ID;
|
||
OPENOBJ_BEGIN(id3, AcDb::kForRead, TDbWell, pEquip);
|
||
if(pEquip){
|
||
if(pEquip->IsHidePipe()){
|
||
double dScale = pEquip->GetScale()*GetPScale();
|
||
ads_polar(ptTmp2, m_nLayoutRotation, -dScale/2, ptTmp2);
|
||
}
|
||
}
|
||
OPENOBJ_END();
|
||
DrawLine(ptTmp1, ptTmp2, dc);
|
||
}
|
||
}
|
||
|
||
}
|
||
}
|
||
|
||
|
||
// int nGsMarker=1;
|
||
// pSheet.SetLocation(ptCivilIns);
|
||
XPoint ptBase=pSheet.GetTopLeft(FALSE);
|
||
if(dc.IsFullExplode()) //炸开时,以防多绘制一遍文字
|
||
pSheet.DrawCellText(ptBase, dc, nGsMarker);
|
||
if(dc.IsFullExplode())
|
||
pSheet.ExplodeOrDraw2d(dc);
|
||
else
|
||
dc.DrawEntity(pSheet);
|
||
// cet 2017.9.6 add 获得表格角点
|
||
double dAngle = pSheet.GetRotation();
|
||
AcGeVector3d vtX = AcGeVector3d::kXAxis;
|
||
Ucs2Wcs(vtX, TRUE);
|
||
vtX.rotateBy(dAngle, AcGeVector3d::kZAxis);
|
||
AcGeVector3d vtY = vtX;
|
||
vtY.rotateBy(PI / 2, AcGeVector3d::kZAxis);
|
||
double dWidth = 0.0;
|
||
for (int i = 0; i < pSheet.GetColumnNum(); ++i)
|
||
{
|
||
dWidth += pSheet.GetColumnWidth(i, FALSE);
|
||
}
|
||
double dHeight = pSheet.GetRowsHeight(0, pSheet.GetRowNum() - 1, FALSE);
|
||
const_cast<XPoint&>(m_ptTopLeft) = ptCivilIns;
|
||
const_cast<XPoint&>(m_ptTolRight) = m_ptTopLeft + vtX * dWidth;
|
||
const_cast<XPoint&>(m_ptBottomLeft) = ptCivilIns - vtY * dHeight;
|
||
const_cast<XPoint&>(m_ptBottomRight) = m_ptBottomLeft + vtX * dWidth;
|
||
return Acad::eOk;
|
||
|
||
}
|
||
|
||
|
||
Acad::ErrorStatus TDbVerticalSection::DrawCivilSheetFeed(XExplodeDraw &dc, XPoint ptEnd) const
|
||
{
|
||
double nSheetHeight = m_dTextHeight+3;
|
||
XStringList lstHead;
|
||
int idx2(1);
|
||
double nWellNameRow(0), nWellRaiusRow(0), nDeepRow(0), nGroundEleRow(0), nUpEleRow(0), nThicknessRow(0), nDownEleRow(0), nTmpHeight(0);
|
||
while(1){
|
||
TCHAR sBuf[256]=_T("");
|
||
CT_strnth(m_sSheetHead, idx2, sBuf);
|
||
if(_tcsicmp(sBuf, _T("")) == 0)
|
||
break;
|
||
lstHead.Append(tstrnew(sBuf));
|
||
idx2++;
|
||
if(_tcsicmp(sBuf, _T("井编号")) == 0){
|
||
nWellNameRow = nTmpHeight;
|
||
nTmpHeight += nSheetHeight;
|
||
}
|
||
else if(_tcsicmp(sBuf, _T("井径(mm)")) == 0){
|
||
nWellRaiusRow = nTmpHeight;
|
||
nTmpHeight += nSheetHeight;
|
||
}
|
||
else if(_tcsicmp(sBuf, _T("设计地面标高(m)")) == 0){
|
||
nUpEleRow = nTmpHeight;
|
||
nTmpHeight += nSheetHeight*2;
|
||
}
|
||
else if(_tcsicmp(sBuf, _T("自然地面标高(m)")) == 0){
|
||
nGroundEleRow = nTmpHeight;
|
||
nTmpHeight += nSheetHeight*2;
|
||
}
|
||
else if(_tcsicmp(sBuf, _T("埋设深度(m)")) == 0){
|
||
nDeepRow = nTmpHeight;
|
||
nTmpHeight += nSheetHeight*2;
|
||
}
|
||
else if(_tcsicmp(sBuf, _T("覆土厚度(m)")) == 0){
|
||
nThicknessRow = nTmpHeight;
|
||
nTmpHeight += nSheetHeight*2;
|
||
}
|
||
else if(_tcsicmp(sBuf, _T("管标高(m)")) == 0){
|
||
nDownEleRow = nTmpHeight;
|
||
nTmpHeight += nSheetHeight*2;
|
||
}
|
||
else
|
||
nTmpHeight += nSheetHeight;
|
||
}
|
||
int iDemoRow = lstHead.Index(_T("备注"));
|
||
int iPipeLenRow = lstHead.Index(_T("管道长度(m)"));
|
||
int iGradientRow = lstHead.Index(_T("管道坡度"));
|
||
int iDnRow = lstHead.Index(_T("管径(mm)"));
|
||
int iWellNameRow = lstHead.Index(_T("井编号"));
|
||
int iUpEleRow = lstHead.Index(_T("设计地面标高(m)"));
|
||
int iDeepRow = lstHead.Index(_T("埋设深度(m)"));
|
||
int iThicknessRow = lstHead.Index(_T("覆土厚度(m)"));
|
||
int iGroundEleRow = lstHead.Index(_T("自然地面标高(m)"));
|
||
int iWellRadiusRow = lstHead.Index(_T("井径(mm)"));
|
||
int iDownEleRow = lstHead.Index(_T("管标高(m)"));
|
||
int iPipePlanRow = lstHead.Index(_T("管线平面"));
|
||
|
||
BOOL bBreak1 = FALSE;
|
||
BOOL bBreak2 = FALSE;
|
||
if(m_lstFeedWell[0].m_csName == _T("断管"))
|
||
bBreak1 = TRUE;
|
||
if(m_lstFeedWell[m_lstFeedWell.Length()-1].m_csName == _T("断管"))
|
||
bBreak2 = TRUE;
|
||
double dScaleY = m_iScaleY;
|
||
double dScaleX = m_iScaleX;
|
||
dScaleX = GetPScale() / dScaleX * 1000;
|
||
dScaleY = GetPScale() / dScaleY * 1000;//转化为毫米
|
||
|
||
// XPoint ptIns = m_ptIns;
|
||
// XPoint ptCivilIns = ptIns;
|
||
// ptCivilIns.y = ptEnd.y;
|
||
// ptIns = ptCivilIns;
|
||
// ads_polar(ptCivilIns, m_nLayoutRotation+PI, 45*GetPScale(), ptCivilIns);
|
||
XPoint ptCivilIns = ptEnd;
|
||
XPoint ptIns = ptCivilIns;
|
||
ads_polar(ptCivilIns, m_nLayoutRotation+PI, 45*GetPScale(), ptCivilIns);
|
||
|
||
|
||
//绘制表格
|
||
AcDbObjectId idTextStyle = m_idTextStyle;
|
||
TDbSheet pSheet;
|
||
// cet 2018.2.7 modify 表格图层与网格一致
|
||
// pSheet.setLayer(this->layerId());
|
||
pSheet.setLayer(this->GetGridLayer());
|
||
pSheet.SetPScale(GetPScale());
|
||
pSheet.SetRotation(m_nLayoutRotation);
|
||
TGridStyle gridStyle;
|
||
gridStyle.SetOverrideAll(TRUE);
|
||
gridStyle.SetTextHeight(m_dTextHeight);
|
||
gridStyle.SetTextStyleId(idTextStyle);
|
||
|
||
TSheetTitle &title=pSheet.GetTitle();
|
||
title.SetHeight(nSheetHeight);
|
||
title.SetVisible(FALSE);
|
||
|
||
gridStyle.SetHorMode(AcDb::kTextCenter);
|
||
gridStyle.SetVerMode(AcDb::kTextVertMid);
|
||
gridStyle.SetLineSpaceFactor(0.2);
|
||
gridStyle.SetTextWrap(FALSE);
|
||
pSheet.SetGridStyle(gridStyle);
|
||
pSheet.SetRowHeight(m_dTextHeight+2);
|
||
if(bBreak2 || bBreak1)
|
||
pSheet.InitSheet(lstHead.Length(), m_lstFeedWell.Length()/2+2, nSheetHeight, 50);
|
||
else
|
||
pSheet.InitSheet(lstHead.Length(), m_lstFeedWell.Length()/2+3, nSheetHeight, 50);
|
||
|
||
TSheetColumn column;
|
||
column.SetWidth(25); //表头
|
||
pSheet.SetColumnAt(0, column);
|
||
|
||
TSheetColumn column2;
|
||
if(!bBreak2 && !bBreak1){
|
||
column2.SetWidth(5); //表尾
|
||
pSheet.SetColumnAt(m_lstFeedWell.Length()/2+2, column2);
|
||
}
|
||
if(bBreak1){
|
||
column2.SetWidth(5); //表尾
|
||
pSheet.SetColumnAt(m_lstFeedWell.Length()/2+1, column2);
|
||
}
|
||
double nWidth = 20 * GetPScale();
|
||
|
||
XPoint ptCellS, ptCellE, ptText, ptWell;
|
||
|
||
ptCellS = ptIns;
|
||
double dPipeLen(0);
|
||
int idx = 1;
|
||
int iDn(0);
|
||
int nGsMarker=1;
|
||
pSheet.SetLocation(ptCivilIns);
|
||
for(int i=0;i<m_lstFeedWell.Length();i++){
|
||
|
||
AcDbObjectId id = m_lstFeedWell[i].m_ID;
|
||
if(m_lstFeedWell[i].m_bIsWell){ //井
|
||
if(m_lstFeedWell[i].m_csName == _T("断管") && dPipeLen > 0){
|
||
TSheetColumn column3;
|
||
column3.SetWidth(dPipeLen/GetPScale()); //表尾
|
||
pSheet.SetColumnAt(m_lstFeedWell.Length()/2+1, column3);
|
||
continue;
|
||
}
|
||
if(m_lstFeedWell[i].m_csName == _T("断管") && dPipeLen < 0.001){
|
||
continue;
|
||
}
|
||
double nEle = m_lstFeedWell[i].m_nUpEle;
|
||
double nDeep = m_lstFeedWell[i].m_nDeep;
|
||
double nDownEle = m_lstFeedWell[i].m_nDownEle;
|
||
double nGroundDeep = m_lstFeedWell[i].m_nDeep;
|
||
double nFrondEle = m_lstFeedWell[i].m_nFrondDownEle;
|
||
double nGroundEle = m_lstFeedWell[i].m_nGroundEle;
|
||
double dWellRadius = m_lstFeedWell[i].m_nWellRadius;
|
||
if(i == m_lstFeedWell.Length() - 1)
|
||
nGroundDeep -= (double)m_lstFeedWell[i-1].m_iDn/1000;
|
||
else
|
||
nGroundDeep -= (double)m_lstFeedWell[i+1].m_iDn/1000;
|
||
|
||
int iPre = GetWellDeepPrecision(this->database());
|
||
CString sHead,sFormat;
|
||
sHead.Format(_T("%d"),iPre);
|
||
sFormat = _T("%.") + sHead + _T("f");
|
||
|
||
CString csWellUpEle, csDeep, csDownEle, csGroundDeep, csFrontEle, csGroundEle, csWellRaius;
|
||
csDeep.Format(sFormat, nDeep);
|
||
csGroundEle.Format(sFormat, nGroundEle);
|
||
csDownEle.Format(sFormat, nDownEle);
|
||
csWellUpEle.Format(sFormat, nEle);
|
||
csGroundDeep.Format(sFormat, nGroundDeep);
|
||
csFrontEle.Format(sFormat, nFrondEle);
|
||
CString csWellName = m_lstFeedWell[i].m_csName;
|
||
csWellRaius.Format(_T("D%.0f"), dWellRadius*2.0);
|
||
|
||
|
||
ads_polar(ptCellS, m_nLayoutRotation, dPipeLen, ptCellS);
|
||
if(iWellNameRow > -1){
|
||
ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nWellNameRow + nSheetHeight/2) * GetPScale(), ptText);
|
||
DrawText(ptText, csWellName, XExplodeDraw::kMiddleCenter, dc);
|
||
}
|
||
if(iWellRadiusRow > -1){
|
||
ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nWellRaiusRow + nSheetHeight/2) * GetPScale(), ptText);
|
||
DrawText(ptText, csWellRaius, XExplodeDraw::kMiddleCenter, dc);
|
||
}
|
||
|
||
if(iUpEleRow > -1){
|
||
ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nUpEleRow + nSheetHeight/3) * GetPScale(), ptText);
|
||
DrawText(ptText, csWellUpEle, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
}
|
||
if(iGroundEleRow > -1){
|
||
ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nGroundEleRow + nSheetHeight/3) * GetPScale(), ptText);
|
||
DrawText(ptText, csGroundEle, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
}
|
||
if(iDeepRow > -1 && m_iCalcMode != 3){//埋深
|
||
if(!m_lstFeedWell[i].m_bIsDropWell){
|
||
ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nDeepRow + nSheetHeight/2) * GetPScale(), ptText);
|
||
DrawText(ptText, csDeep, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
}
|
||
else{
|
||
ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nDeepRow + nSheetHeight/3) * GetPScale(), ptText);
|
||
XPoint ptTmpText = ptText;
|
||
if(i != 0){
|
||
CString csDeep2;
|
||
double nDeep2 = m_lstFeedWell[i].m_nUpEle - m_lstFeedWell[i].m_nFrondDownEle;
|
||
csDeep2.Format(sFormat, fabs(nDeep2));
|
||
ads_polar(ptText, m_nLayoutRotation+PI, GetPScale()*2, ptTmpText);
|
||
DrawText(ptTmpText, csDeep2, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
}
|
||
if(i != m_lstFeedWell.Length() - 1){
|
||
ads_polar(ptText, m_nLayoutRotation, GetPScale()*2, ptTmpText);
|
||
DrawText(ptTmpText, csDeep, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
}
|
||
}
|
||
}
|
||
if(iThicknessRow > -1 && m_iCalcMode != 3){// 雨污 覆土厚度
|
||
if(!m_lstFeedWell[i].m_bIsDropWell){
|
||
ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nThicknessRow + nSheetHeight/2) * GetPScale(), ptText);
|
||
DrawText(ptText, csGroundDeep, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
}
|
||
else{
|
||
ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nThicknessRow + nSheetHeight/3) * GetPScale(), ptText);
|
||
XPoint ptTmpText = ptText;
|
||
if(i != 0){
|
||
CString csDeep2;
|
||
double nDeep2 = m_lstFeedWell[i].m_nUpEle - m_lstFeedWell[i].m_nFrondDownEle-(double)m_lstFeedWell[i-1].m_iDn/1000;
|
||
csDeep2.Format(sFormat, fabs(nDeep2));
|
||
ads_polar(ptText, m_nLayoutRotation+PI, GetPScale()*2, ptTmpText);
|
||
DrawText(ptTmpText, csDeep2, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
}
|
||
if(i != m_lstFeedWell.Length() - 1){
|
||
ads_polar(ptText, m_nLayoutRotation, GetPScale()*2, ptTmpText);
|
||
DrawText(ptTmpText, csGroundDeep, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
}
|
||
}
|
||
}
|
||
else if(iThicknessRow > -1 && m_iCalcMode == 3){// 给水 覆土厚度
|
||
CString csFeedDeep;
|
||
double dDn(0);
|
||
|
||
if(csFrontEle == csDownEle || i == 0){
|
||
if(i == m_lstFeedWell.Length() - 1)
|
||
dDn = (double)m_lstFeedWell[i-1].m_iDn/2000;
|
||
else
|
||
dDn = (double)m_lstFeedWell[i+1].m_iDn/2000;
|
||
double dFeedDeep = nEle - nDownEle - dDn;
|
||
csFeedDeep.Format(sFormat, dFeedDeep);
|
||
ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nThicknessRow + nSheetHeight/2) * GetPScale(), ptText);
|
||
DrawText(ptText, csFeedDeep, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
}
|
||
else{
|
||
ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nThicknessRow + nSheetHeight/3) * GetPScale(), ptText);
|
||
XPoint ptTmpText = ptText;
|
||
if(i != 0){
|
||
dDn = (double)m_lstFeedWell[i-1].m_iDn/2000;
|
||
double nFrondEle2 = m_lstFeedWell[i].m_nFrondDownEle;
|
||
double dFeedDeep = nEle - nFrondEle2 - dDn;
|
||
csFeedDeep.Format(sFormat, dFeedDeep);
|
||
|
||
ads_polar(ptText, m_nLayoutRotation+PI, GetPScale()*2, ptTmpText);
|
||
DrawText(ptTmpText, csFeedDeep, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
}
|
||
if(i != m_lstFeedWell.Length() - 1){
|
||
dDn = (double)m_lstFeedWell[i+1].m_iDn/2000;
|
||
double dFeedDeep = nEle - nDownEle - dDn;
|
||
csFeedDeep.Format(sFormat, dFeedDeep);
|
||
|
||
ads_polar(ptText, m_nLayoutRotation, GetPScale()*2, ptTmpText);
|
||
DrawText(ptTmpText, csFeedDeep, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
}
|
||
}
|
||
}
|
||
|
||
if(iDownEleRow > -1){ //管内底标高, 或给水的管中标高
|
||
if(csFrontEle == csDownEle || i == 0){
|
||
ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nDownEleRow + nSheetHeight/2) * GetPScale(), ptText);
|
||
DrawText(ptText, csDownEle, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
}
|
||
else{
|
||
ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nDownEleRow + nSheetHeight/3) * GetPScale(), ptText);
|
||
XPoint ptTmpText = ptText;
|
||
if(i != 0){
|
||
ads_polar(ptText, m_nLayoutRotation+PI, GetPScale()*2, ptTmpText);
|
||
DrawText(ptTmpText, csFrontEle, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
}
|
||
if(i != m_lstFeedWell.Length() - 1){
|
||
ads_polar(ptText, m_nLayoutRotation, GetPScale()*2, ptTmpText);
|
||
DrawText(ptTmpText, csDownEle, XExplodeDraw::kMiddleRight, dc, PI/2);
|
||
}
|
||
}
|
||
}
|
||
|
||
ads_polar(ptCellS, m_nLayoutRotation-PI/2, nSheetHeight*12 * GetPScale(), ptText);
|
||
int num(0);
|
||
|
||
ptWell = ptText;
|
||
TSheetColumn column4;
|
||
column4.SetWidth(nWidth/GetPScale()); //序号
|
||
pSheet.SetColumnAt(idx, column4);
|
||
idx++;
|
||
|
||
}
|
||
else if(!m_lstFeedWell[i].m_bIsWell){ //管
|
||
// double dLenPipe = m_lstWell[i].m_nLength;
|
||
// if(dLenPipe > 1000)// 7.0 管长用mm
|
||
// dLenPipe = dLenPipe/1000.0;
|
||
|
||
dPipeLen = m_lstFeedWell[i].m_nLength * dScaleX;
|
||
nWidth = dPipeLen;
|
||
if(m_lstFeedWell[i-1].m_csName == _T("断管")){
|
||
nWidth = 20 * GetPScale();
|
||
dPipeLen = 0;
|
||
}
|
||
|
||
iDn = m_lstFeedWell[i].m_iDn;
|
||
CString csDn, csPipeLen, csI;
|
||
csDn.Format(_T("%d"), iDn);
|
||
csI = I2Str(m_lstFeedWell[i].m_nI * 1000);
|
||
csPipeLen.Format(_T("%.2f"), m_lstFeedWell[i].m_nLength);
|
||
if(iDnRow > -1){
|
||
TGridCell &cell21=*(pSheet)(iDnRow, idx);
|
||
cell21.SetText(csDn);
|
||
}
|
||
if(iPipeLenRow > -1){
|
||
TGridCell &cell22=*(pSheet)(iPipeLenRow, idx);
|
||
cell22.SetText(csPipeLen);
|
||
}
|
||
if(iGradientRow > -1){
|
||
TGridCell &cell23=*(pSheet)(iGradientRow, idx);
|
||
cell23.SetText(csI);
|
||
}
|
||
|
||
if(iDemoRow > -1 && i > 1 && m_lstFeedWell[i-1].m_bIsDropWell && m_iCalcMode != 3){
|
||
TGridCell &cell24=*(pSheet)(iDemoRow, idx);
|
||
double nDrop = m_lstFeedWell[i-1].m_nDownEle - m_lstFeedWell[i-1].m_nFrondDownEle;
|
||
cell24.SetText(XString(_T("跌落%.2f米"), fabs(nDrop)));
|
||
TGridStyle gridStyle2;
|
||
gridStyle2.SetOverrideAll(TRUE);
|
||
gridStyle2.SetHorMode(AcDb::kTextLeft);
|
||
gridStyle2.SetTextHeight(m_dTextHeight);
|
||
cell24.SetGridStyle(gridStyle2);
|
||
}
|
||
|
||
}
|
||
|
||
}
|
||
|
||
|
||
for(int j=0;j<lstHead.Length();j++){
|
||
TGridCell &cell=*(pSheet)(j, 0);
|
||
CString csHead = lstHead[j];
|
||
if(csHead == _T("管标高(m)")){
|
||
if(m_iCalcMode == 3)
|
||
cell.SetText(_T("管中标高(m)"));
|
||
else
|
||
cell.SetText(_T("管内底标高(m)"));
|
||
}
|
||
else
|
||
cell.SetText(csHead);
|
||
|
||
if(csHead.Find(_T("设计地面标高")) > -1 || csHead.Find(_T("埋设深度")) > -1 || csHead.Find(_T("自然地面标高")) > -1
|
||
|| csHead.Find(_T("覆土厚度")) > -1 || csHead.Find(_T("管标高(m)")) > -1 || csHead.Find(_T("管线平面")) > -1){
|
||
TSheetRow *row = pSheet.GetRow(j);
|
||
row->SetRowHeightStyle(TSheetRow::kFree);
|
||
row->SetHeight(nSheetHeight*2);
|
||
}
|
||
if(csHead.Find(_T("设计地面标高")) > -1 || csHead.Find(_T("埋设深度")) > -1
|
||
|| csHead.Find(_T("桩号")) > -1 || csHead.Find(_T("管道基础")) > -1 || csHead.Find(_T("自然地面标高")) > -1
|
||
|| csHead.Find(_T("管材")) > -1 || csHead.Find(_T("管线平面")) > -1 || csHead.Find(_T("井径(mm)")) > -1
|
||
|| csHead.Find(_T("覆土厚度")) > -1 || csHead.Find(_T("井编号")) > -1 || csHead.Find(_T("管标高")) > -1){
|
||
if(bBreak2 || bBreak1){
|
||
pSheet.MergeCells(j, 1, j, m_lstFeedWell.Length()/2+1);
|
||
}
|
||
else{
|
||
pSheet.MergeCells(j, 1, j, m_lstFeedWell.Length()/2+2);
|
||
}
|
||
}
|
||
}
|
||
|
||
//绘制管线平面 sr add 2007-8-17
|
||
if(iPipePlanRow > -1){
|
||
XPoint ptS;
|
||
ptS = pSheet.GetCellPoint(iPipePlanRow, 1);
|
||
ads_polar(ptS, m_nLayoutRotation+PI/2, -nSheetHeight*GetPScale(), ptS);
|
||
ads_polar(ptS, m_nLayoutRotation, 20*GetPScale(), ptS);
|
||
|
||
for(int i=0;i<m_lstFeedWell.Length();i++){
|
||
AcDbObjectId id = m_lstFeedWell[i].m_ID;
|
||
if(m_lstFeedWell[i].m_bIsWell){ //井
|
||
OPENOBJ_BEGIN(id, AcDb::kForRead, TDbWell, pEquip);
|
||
if(pEquip){
|
||
AcDbObjectId eqId = pEquip->GetBlock2d();
|
||
CString csBlkName = GetSymbolName(eqId).cs();
|
||
OPENOBJ_BEGIN(eqId, AcDb::kForRead, AcDbBlockTableRecord, pBlock);
|
||
if(pBlock) {
|
||
AcGeScale3d scale(pEquip->GetScale()*GetPScale(),pEquip->GetScale()*GetPScale(),pEquip->GetScale()*GetPScale());
|
||
dc.DrawBlock(*pBlock,ptS,scale,0,TRUE);
|
||
}
|
||
OPENOBJ_END();
|
||
}
|
||
OPENOBJ_END();
|
||
// idx++;
|
||
}
|
||
else if(!m_lstFeedWell[i].m_bIsWell){//管
|
||
XPoint ptTmp1, ptTmp2;
|
||
dPipeLen = m_lstFeedWell[i].m_nLength * dScaleX;
|
||
ptTmp1 = ptS;
|
||
ads_polar(ptS, m_nLayoutRotation, dPipeLen, ptS);
|
||
ptTmp2 = ptS;
|
||
AcDbObjectId id2 = m_lstFeedWell[i-1].m_ID;
|
||
OPENOBJ_BEGIN(id2, AcDb::kForRead, TDbWell, pEquip);
|
||
if(pEquip){
|
||
if(pEquip->IsHidePipe()){
|
||
double dScale = pEquip->GetScale()*GetPScale();
|
||
ads_polar(ptTmp1, m_nLayoutRotation, dScale/2, ptTmp1);
|
||
}
|
||
}
|
||
OPENOBJ_END();
|
||
|
||
AcDbObjectId id3 = m_lstFeedWell[i+1].m_ID;
|
||
OPENOBJ_BEGIN(id3, AcDb::kForRead, TDbWell, pEquip);
|
||
if(pEquip){
|
||
if(pEquip->IsHidePipe()){
|
||
double dScale = pEquip->GetScale()*GetPScale();
|
||
ads_polar(ptTmp2, m_nLayoutRotation, -dScale/2, ptTmp2);
|
||
}
|
||
}
|
||
OPENOBJ_END();
|
||
DrawLine(ptTmp1, ptTmp2, dc);
|
||
|
||
// 绘制给水管道中间的支路 sr add 2008-7-8
|
||
int iPipeLen = m_lstFeedWell[i].m_lstID.Length();
|
||
XPoly2D poly;
|
||
AcDbObjectIdArray idArray;
|
||
for (int j=0; j<iPipeLen; j++){
|
||
AcDbObjectId idPipe = m_lstFeedWell[i].m_lstID[j];
|
||
OPENOBJ_BEGIN(idPipe, AcDb::kForRead, TDbPipe, pPipe);
|
||
if(pPipe){
|
||
AcDbObjectId idNode1 = pPipe->GetNode(0);
|
||
AcDbObjectId idNode2 = pPipe->GetNode(1);
|
||
AppendIdArray(idArray, idNode1);
|
||
AppendIdArray(idArray, idNode2);
|
||
XCurveSegment seg = *pPipe;
|
||
seg.SetElevation(0);
|
||
if(j == iPipeLen-1)
|
||
poly.AppendSegment(seg, 0, 1);
|
||
else
|
||
poly.AppendSegment(seg);
|
||
}
|
||
OPENOBJ_END();
|
||
|
||
}
|
||
AcDbPolyline pline;
|
||
PolyConvert(poly, pline);
|
||
int iNodeLen = idArray.length();
|
||
for(j=0; j<iNodeLen; j++){
|
||
AcDbObjectId idNode = idArray[j];
|
||
double dDist2Well(0);
|
||
OPENOBJ_BEGIN(idNode, AcDb::kForRead, TDbPipeFitting, pNode);
|
||
if(pNode){
|
||
XPoint ptLoc = pNode->GetLocation();
|
||
ptLoc.z = 0;//仅算投影距离
|
||
pline.getDistAtPoint(ptLoc, dDist2Well);
|
||
}
|
||
OPENOBJ_END();
|
||
if(!DocGetMeterUnitDraw())
|
||
dDist2Well = dDist2Well / 1000.0; //转换为米
|
||
XPoint ptPipe1, ptPipe2;
|
||
ads_polar(ptTmp1, m_nLayoutRotation, dDist2Well * dScaleX, ptPipe1);
|
||
ads_polar(ptPipe1, m_nLayoutRotation+PI/2, nSheetHeight*GetPScale()/2.0, ptPipe2);
|
||
DrawLine(ptPipe1, ptPipe2, dc);
|
||
}
|
||
|
||
}
|
||
}
|
||
}
|
||
|
||
XPoint ptBase=pSheet.GetTopLeft(FALSE);
|
||
if(dc.IsFullExplode()) //炸开时,以防多绘制一遍文字
|
||
pSheet.DrawCellText(ptBase, dc, nGsMarker);
|
||
if(dc.IsFullExplode())
|
||
pSheet.ExplodeOrDraw2d(dc);
|
||
else
|
||
dc.DrawEntity(pSheet);
|
||
|
||
return Acad::eOk;
|
||
|
||
}
|
||
|
||
|
||
void TDbVerticalSection::GetAllPipes(DList<AcDbObjectId> &lstAllPipe) const
|
||
{
|
||
// cet 2016.7.6 add 纵断面图上的管道
|
||
std::set<AcDbObjectId> setId;
|
||
for(int i = 0; i < m_lstWell.Length(); ++i)
|
||
{
|
||
setId.insert(m_lstWell[i].m_ID);
|
||
}
|
||
lstAllPipe.Reset();
|
||
XDbBlockTableRec objMSpace;
|
||
if(!objMSpace)
|
||
return;
|
||
AcDbBlockTableRecordIterator* pBlockIterator=NULL;
|
||
Acad::ErrorStatus es=objMSpace.m_pBlockTableRec->newIterator(pBlockIterator);
|
||
ASSERT(es==Acad::eOk && pBlockIterator!=NULL);
|
||
for(pBlockIterator->start(); !pBlockIterator->done(); pBlockIterator->step()) {
|
||
AcDbEntity *pEntity=NULL;
|
||
es=pBlockIterator->getEntity(pEntity, AcDb::kForRead);
|
||
if(pEntity != NULL){
|
||
if(pEntity->isKindOf(TDbPipe::desc())){
|
||
AcDbObjectId id = pEntity->objectId();
|
||
if (setId.count(id) == 0) // cet 2016.7.6 add 排除纵断面图上的管道
|
||
{
|
||
lstAllPipe.Append(new AcDbObjectId(id));
|
||
}
|
||
}
|
||
pEntity->close();
|
||
}
|
||
}
|
||
delete pBlockIterator;
|
||
return;
|
||
|
||
}
|
||
|
||
Acad::ErrorStatus TDbVerticalSection::ExplodeOrDraw2d(XExplodeDraw &dc) const
|
||
{
|
||
// cet 2016.10.17 add 图层关闭时,实体不显示,不进行绘制(打印时,也不会绘制)
|
||
AcDbLayerTableRecordPointer player(this->layerId(), AcDb::kForRead);
|
||
if (player.openStatus() == Acad::eOk && player->isOff())
|
||
{
|
||
return Acad::eOk;
|
||
}
|
||
assertReadEnabled();
|
||
if(g_bOsnapExpl)//不支持求交,速度太慢
|
||
return Acad::eOk;
|
||
InitPipeData(); // cet 2016.9.23 add 获得最新管道信息
|
||
XPoint ptEnd;
|
||
if(!!objectId())
|
||
DrawScale(dc, ptEnd);
|
||
|
||
if(m_iCalcMode >= 100)
|
||
DrawSectionFromRight(dc); //雨污系统 从右往左
|
||
else
|
||
DrawSection(dc); //雨污系统 从左往右
|
||
|
||
if(!!objectId()){
|
||
if(m_iCalcMode == 3)
|
||
DrawCivilSheetFeed(dc, ptEnd); //给水系统
|
||
else
|
||
DrawCivilSheet(dc, ptEnd); //雨污系统
|
||
}
|
||
return Acad::eOk;
|
||
}
|
||
|
||
|
||
void TDbVerticalSection::Calc()
|
||
{
|
||
UpdateHidePipes(); // cet 2017.11.22 add 更新遮挡数据
|
||
if(m_iCalcMode == 3){
|
||
CalcFeed();
|
||
return;
|
||
}
|
||
InitPipeData(); // cet 2016.7.6 add 获得管道信息,
|
||
int iCalcMode = m_iCalcMode;
|
||
if(iCalcMode >= 100)
|
||
iCalcMode -= 100;
|
||
m_nMaxDeep = m_lstWell[0]->m_nUpEle;
|
||
m_nMinDeep = m_lstWell[0]->m_nUpEle;
|
||
|
||
double nDeepStart = m_nStartDeep;
|
||
m_lstWell[0]->m_nDeep = nDeepStart;
|
||
double dPipeLen(0), nI(0), nFrontPipeEle(0);
|
||
double dEleStart = m_lstWell[0]->m_nUpEle;
|
||
nDeepStart = dEleStart - nDeepStart; //井底标高 = 起点井地面标高-最小埋深
|
||
m_lstWell[0]->m_nDownEle = nDeepStart;
|
||
for(int i=0;i<m_lstWell.Length();i++){
|
||
if(m_lstWell[i]->m_bIsWell){ //井
|
||
AcDbObjectId id = m_lstWell[i]->m_ID;
|
||
if(dPipeLen > 0){
|
||
double nWellEle = m_lstWell[i]->m_nUpEle;
|
||
double nWellDownEle = m_lstWell[i]->m_nDownEle;
|
||
double nLastEnd = nDeepStart - nI * dPipeLen;
|
||
double nFrontPipeDeep = nWellEle - nLastEnd; //埋深 地面-前管
|
||
double nWellDeep = nWellEle - nWellDownEle; //埋深 地面-井底
|
||
nFrontPipeEle = nLastEnd;
|
||
|
||
if(m_lstWell[i]->m_bIsDropWell){
|
||
nDeepStart = m_lstWell[i]->m_nDownEle;
|
||
m_lstWell[i]->m_nFrondDownEle = nFrontPipeEle;
|
||
}
|
||
else{
|
||
double nRadiusFront(0), nRadiusBack(0);
|
||
nRadiusFront = m_lstWell[i-1]->m_iDn;
|
||
if(i != m_lstWell.Length()-1)
|
||
nRadiusBack = m_lstWell[i+1]->m_iDn;
|
||
double nDifference(0);
|
||
if(nRadiusFront > 0 && nRadiusBack > 0){//井前后管径差
|
||
nDifference = (nRadiusBack - nRadiusFront)/1000;
|
||
}
|
||
m_lstWell[i]->m_nFrondDownEle = nDeepStart - nI * dPipeLen;
|
||
if(iCalcMode == 0) //管顶平接
|
||
nDeepStart = nDeepStart - nI * dPipeLen - nDifference;
|
||
else if(iCalcMode == 1) //管底平接
|
||
nDeepStart = nDeepStart - nI * dPipeLen;
|
||
else if(iCalcMode == 2) //水面平接
|
||
nDeepStart = nDeepStart - nI * dPipeLen - nDifference/2;
|
||
}
|
||
/////////////////////////////////////////////////////////////////
|
||
if(m_lstWell[i]->m_csName == _T("HC")){
|
||
m_lstWell[i]->m_nFrondDownEle = nDeepStart;
|
||
|
||
//最小标高也要考虑化粪池,sr add 2007-516
|
||
OPENOBJ_BEGIN(m_lstWell[i]->m_ID, AcDb::kForRead, TDbPool, pEquip);
|
||
if(pEquip){
|
||
double dPoolEleDown = pEquip->GetBottomBanEle();
|
||
if(fabs(dPoolEleDown) > 0.001 && dPoolEleDown < m_nMinDeep)
|
||
m_nMinDeep = dPoolEleDown;
|
||
if(pEquip->GetSpare() > 0.01)
|
||
nDeepStart -= pEquip->GetSpare();
|
||
else
|
||
nDeepStart -= 0.1;//化粪池
|
||
}
|
||
OPENOBJ_END();
|
||
}
|
||
/////////////////////////////////////////////////////////////////
|
||
|
||
m_lstWell[i]->m_nDownEle = nDeepStart;
|
||
if(nDeepStart < m_nMinDeep) //找出最小标高
|
||
m_nMinDeep = nDeepStart;
|
||
if(nWellEle > m_nMaxDeep) //找出最大标高, 绘制Y比例尺
|
||
m_nMaxDeep = nWellEle;
|
||
nWellDeep = nWellEle - nDeepStart;
|
||
m_lstWell[i]->m_nDeep = nWellDeep;
|
||
}
|
||
}
|
||
else if(!m_lstWell[i]->m_bIsWell){ //管
|
||
if(i == m_lstWell.Length() - 1)
|
||
continue;
|
||
dPipeLen = m_lstWell[i]->m_nLength;
|
||
nI = m_lstWell[i]->m_nI;
|
||
CString csPipeName = m_lstWell[i-1]->m_csName + m_lstWell[i+1]->m_csName;
|
||
}
|
||
}
|
||
|
||
|
||
|
||
XPoint ptIns = m_ptIns;
|
||
double dScaleY = m_iScaleY;
|
||
double dScaleX = m_iScaleX;
|
||
dScaleX = GetPScale() / dScaleX * 1000;
|
||
dScaleY = GetPScale() / dScaleY * 1000;//转化为毫米
|
||
if(m_iCalcMode < 100) // 从左往右 原代码
|
||
dEleStart = m_lstWell[0]->m_nUpEle;
|
||
else // 从右向左 王辉 添加 08-05-05
|
||
dEleStart = m_lstWell[m_lstWell.Length() - 1]->m_nUpEle;
|
||
|
||
XPoint ptStart, ptEnd;
|
||
ptStart = ptIns;
|
||
dPipeLen = 0;
|
||
m_lstPt.Reset();
|
||
m_lstPt.NewAppend(ptIns);
|
||
|
||
|
||
double dLastEle = dEleStart;
|
||
if(m_iCalcMode < 100) // 从左往右
|
||
{
|
||
for(i=0;i<m_lstWell.Length();i++){
|
||
double nEle = m_lstWell[i]->m_nUpEle - dLastEle;//地面标高
|
||
if(m_lstWell[i]->m_bIsWell){ //井
|
||
if(dPipeLen > 0){
|
||
ads_polar(ptStart, m_nLayoutRotation, dPipeLen, ptEnd);
|
||
ads_polar(ptEnd, m_nLayoutRotation+PI/2, nEle*dScaleY, ptEnd);
|
||
m_lstPt.NewAppend(ptEnd);
|
||
ptStart = ptEnd;
|
||
dLastEle = m_lstWell[i]->m_nUpEle;
|
||
if(m_lstWell[i]->m_csName == _T("HC")){
|
||
OPENOBJ_BEGIN(m_lstWell[i]->m_ID, AcDb::kForRead, TDbPool, pEquip);
|
||
if(pEquip){
|
||
double dPoolLength = pEquip->GetPoolLength();
|
||
if(!DocGetMeterUnitDraw())
|
||
dPoolLength = dPoolLength / 1000;
|
||
ads_polar(ptStart, m_nLayoutRotation, dPoolLength * dScaleX, ptEnd);
|
||
m_lstPt.NewAppend(ptStart); // cet 2016.5.9 add 化粪池需要考虑两点
|
||
m_lstPt.NewAppend(ptEnd);
|
||
ptStart = ptEnd;
|
||
}
|
||
OPENOBJ_END();
|
||
}
|
||
}
|
||
else if (m_lstWell[i]->m_csName == _T("HC") && m_lstWell[0]->m_csName == _T("断管")) // cet 2016.5.9 add 存在断管
|
||
{
|
||
OPENOBJ_BEGIN(m_lstWell[i]->m_ID, AcDb::kForRead, TDbPool, pEquip);
|
||
if(pEquip != NULL)
|
||
{
|
||
double dPoolLength = pEquip->GetPoolLength();
|
||
if(!DocGetMeterUnitDraw())
|
||
dPoolLength = dPoolLength / 1000;
|
||
ads_polar(ptStart, m_nLayoutRotation, dPoolLength * dScaleX, ptEnd);
|
||
m_lstPt.NewAppend(ptStart);
|
||
m_lstPt.NewAppend(ptEnd);
|
||
ptStart = ptEnd;
|
||
}
|
||
OPENOBJ_END();
|
||
}
|
||
dPipeLen = 0;
|
||
}
|
||
else if(!m_lstWell[i]->m_bIsWell){ //管
|
||
dPipeLen = m_lstWell[i]->m_nLength * dScaleX;
|
||
if(m_lstWell[i-1]->m_csName == _T("断管"))
|
||
dPipeLen = 0;
|
||
}
|
||
}
|
||
}
|
||
else // 从右往左
|
||
{
|
||
for(i=m_lstWell.Length() - 1; i >= 0; --i)
|
||
{
|
||
double nEle = m_lstWell[i]->m_nUpEle - dLastEle;//地面标高
|
||
if(m_lstWell[i]->m_bIsWell)
|
||
{ //井
|
||
if(dPipeLen > 0)
|
||
{
|
||
ads_polar(ptStart, m_nLayoutRotation, dPipeLen, ptEnd);
|
||
ads_polar(ptEnd, m_nLayoutRotation+PI/2, nEle*dScaleY, ptEnd);
|
||
m_lstPt.NewAppend(ptEnd);
|
||
ptStart = ptEnd;
|
||
dLastEle = m_lstWell[i]->m_nUpEle;
|
||
|
||
if(m_lstWell[i]->m_csName == _T("HC")){
|
||
OPENOBJ_BEGIN(m_lstWell[i]->m_ID, AcDb::kForRead, TDbPool, pEquip);
|
||
if(pEquip){
|
||
double dPoolLength = pEquip->GetPoolLength();
|
||
if(!DocGetMeterUnitDraw())
|
||
dPoolLength = dPoolLength / 1000;
|
||
ads_polar(ptStart, m_nLayoutRotation, dPoolLength * dScaleX, ptEnd);
|
||
m_lstPt.NewAppend(ptStart); // cet 2016.5.9 add 化粪池需要考虑两点
|
||
m_lstPt.NewAppend(ptEnd);
|
||
ptStart = ptEnd;
|
||
}
|
||
OPENOBJ_END();
|
||
|
||
}
|
||
}
|
||
else if (m_lstWell[i]->m_csName == _T("HC") && m_lstWell[m_lstWell.Length() - 1]->m_csName == _T("断管")) // cet 2016.5.9 add 存在断管
|
||
{
|
||
OPENOBJ_BEGIN(m_lstWell[i]->m_ID, AcDb::kForRead, TDbPool, pEquip);
|
||
if(pEquip != NULL)
|
||
{
|
||
double dPoolLength = pEquip->GetPoolLength();
|
||
if(!DocGetMeterUnitDraw())
|
||
dPoolLength = dPoolLength / 1000;
|
||
ads_polar(ptStart, m_nLayoutRotation, dPoolLength * dScaleX, ptEnd);
|
||
m_lstPt.NewAppend(ptStart);
|
||
m_lstPt.NewAppend(ptEnd);
|
||
ptStart = ptEnd;
|
||
}
|
||
OPENOBJ_END();
|
||
}
|
||
dPipeLen = 0;
|
||
}
|
||
else if(!m_lstWell[i]->m_bIsWell) //管
|
||
{
|
||
dPipeLen = m_lstWell[i]->m_nLength * dScaleX;
|
||
if(m_lstWell[i+1]->m_csName == _T("断管"))
|
||
dPipeLen = 0;
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
}
|
||
|
||
BOOL TDbVerticalSection::GetFeedWellListData(DList<TWellData> &lstWellSys, DList<TFeedWellData> &lstFeedWellSys)
|
||
{
|
||
lstFeedWellSys.Reset();
|
||
BOOL bRet = TRUE;
|
||
int len = lstWellSys.Length();
|
||
for(int i=0;i<len;i++){
|
||
if(lstWellSys[i]->m_bIsWell){
|
||
TFeedWellData *pNewList = new TFeedWellData();
|
||
pNewList->m_csName = lstWellSys[i]->m_csName;
|
||
pNewList->m_iDn = lstWellSys[i]->m_iDn;
|
||
pNewList->m_nLength = lstWellSys[i]->m_nLength;
|
||
pNewList->m_nGroundEle = lstWellSys[i]->m_nGroundEle;
|
||
pNewList->m_nUpEle = lstWellSys[i]->m_nUpEle;
|
||
pNewList->m_nDownEle = lstWellSys[i]->m_nDownEle;
|
||
pNewList->m_nFrondDownEle = lstWellSys[i]->m_nFrondDownEle;
|
||
pNewList->m_nDeep = lstWellSys[i]->m_nDeep;
|
||
pNewList->m_bIsWell = lstWellSys[i]->m_bIsWell;
|
||
pNewList->m_bIsDropWell = lstWellSys[i]->m_bIsDropWell;;
|
||
pNewList->m_nWellRadius = lstWellSys[i]->m_nWellRadius;
|
||
pNewList->m_ID = lstWellSys[i]->m_ID;
|
||
pNewList->m_nI = lstWellSys[i]->m_nI;
|
||
pNewList->m_nSpare = lstWellSys[i]->m_nSpare;
|
||
lstFeedWellSys.Append(pNewList);
|
||
}
|
||
else{ //管线
|
||
TFeedWellData *pNewList = new TFeedWellData();
|
||
pNewList->m_csName = lstWellSys[i]->m_csName;
|
||
pNewList->m_iDn = lstWellSys[i]->m_iDn;
|
||
pNewList->m_nGroundEle = lstWellSys[i]->m_nGroundEle;
|
||
pNewList->m_nUpEle = lstWellSys[i]->m_nUpEle;
|
||
pNewList->m_nDownEle = lstWellSys[i]->m_nDownEle;
|
||
pNewList->m_nFrondDownEle = lstWellSys[i]->m_nFrondDownEle;
|
||
pNewList->m_nDeep = lstWellSys[i]->m_nDeep;
|
||
pNewList->m_bIsWell = lstWellSys[i]->m_bIsWell;
|
||
pNewList->m_bIsDropWell = lstWellSys[i]->m_bIsDropWell;;
|
||
pNewList->m_nWellRadius = lstWellSys[i]->m_nWellRadius;
|
||
pNewList->m_nI = lstWellSys[i]->m_nI;
|
||
pNewList->m_nSpare = lstWellSys[i]->m_nSpare;
|
||
pNewList->m_nLength = 0;
|
||
int idx = i;
|
||
while (idx < len) {
|
||
AcDbSoftPointerId id = lstWellSys[idx]->m_ID;
|
||
pNewList->m_nLength += lstWellSys[idx]->m_nLength;
|
||
pNewList->m_lstID.Append(new AcDbSoftPointerId(id));
|
||
i = idx;
|
||
idx ++;
|
||
if(lstWellSys[idx]->m_bIsWell)
|
||
break;
|
||
}
|
||
lstFeedWellSys.Append(pNewList);
|
||
}
|
||
}
|
||
return bRet;
|
||
}
|
||
|
||
void TDbVerticalSection::CalcFeed()
|
||
{
|
||
m_nMaxDeep = m_lstWell[0]->m_nUpEle;
|
||
m_nMinDeep = m_lstWell[0]->m_nUpEle;
|
||
for(int i=0;i<m_lstWell.Length();i++){
|
||
if(m_lstWell[i]->m_bIsWell){ //井
|
||
AcDbObjectId id = m_lstWell[i]->m_ID;
|
||
|
||
double nWellEle = m_lstWell[i]->m_nUpEle;
|
||
double nWellDownEle = m_lstWell[i]->m_nDownEle;
|
||
|
||
if(nWellDownEle < m_nMinDeep) //找出最小标高
|
||
m_nMinDeep = nWellDownEle;
|
||
if(nWellEle > m_nMaxDeep) //找出最大标高, 绘制Y比例尺
|
||
m_nMaxDeep = nWellEle;
|
||
|
||
}
|
||
else if(!m_lstWell[i]->m_bIsWell){ //管
|
||
if(i == m_lstWell.Length() - 1)
|
||
continue;
|
||
}
|
||
}
|
||
|
||
XPoint ptIns = m_ptIns;
|
||
double dScaleY = m_iScaleY;
|
||
double dScaleX = m_iScaleX;
|
||
dScaleX = GetPScale() / dScaleX * 1000;
|
||
dScaleY = GetPScale() / dScaleY * 1000;//转化为毫米
|
||
double nEleStart = m_lstFeedWell[0]->m_nUpEle;
|
||
XPoint ptStart, ptEnd;
|
||
ptStart = ptIns;
|
||
double dPipeLen = 0;
|
||
m_lstPt.Reset();
|
||
m_lstPt.NewAppend(ptIns);
|
||
for(i=0;i<m_lstFeedWell.Length();i++){
|
||
double nEle = m_lstFeedWell[i]->m_nUpEle - nEleStart;//地面标高
|
||
if(m_lstFeedWell[i]->m_bIsWell){ //井
|
||
if(dPipeLen > 0){
|
||
ads_polar(ptStart, m_nLayoutRotation, dPipeLen, ptEnd);
|
||
// ptEnd.y = ptIns.y;
|
||
nEle = m_lstFeedWell[i]->m_nUpEle - m_lstFeedWell[i-2]->m_nUpEle; //井面标高
|
||
ads_polar(ptEnd, m_nLayoutRotation+PI/2, nEle*dScaleY, ptEnd);
|
||
m_lstPt.NewAppend(ptEnd);
|
||
ptStart = ptEnd;
|
||
}
|
||
dPipeLen = 0;
|
||
}
|
||
else if(!m_lstFeedWell[i]->m_bIsWell){ //管
|
||
dPipeLen = m_lstFeedWell[i]->m_nLength * dScaleX;
|
||
if(m_lstFeedWell[i-1]->m_csName == _T("断管"))
|
||
dPipeLen = 0;
|
||
}
|
||
}
|
||
|
||
|
||
}
|
||
|
||
void TDbVerticalSection::GetWellDatas(DList<TWellData>& lstWell) const
|
||
{
|
||
int nCount = m_lstWell.Length();
|
||
for(int i=0; i<nCount; i++) {
|
||
TWellData *pData = new TWellData;
|
||
*pData = m_lstWell[i];
|
||
lstWell.Append(pData);
|
||
}
|
||
}
|
||
|
||
void TDbVerticalSection::SetWellDatas(DList<TWellData>& lstWell)
|
||
{
|
||
assertWriteEnabled();
|
||
m_lstWell.Reset();
|
||
int nCount = lstWell.Length();
|
||
for(int i=0; i<nCount; i++) {
|
||
TWellData *pData = new TWellData;
|
||
*pData = *lstWell[i];//值拷贝
|
||
m_lstWell.Append(pData);
|
||
}
|
||
if(m_iCalcMode == 3)//如果是给水系统,则重新构造链表
|
||
GetFeedWellListData(m_lstWell, m_lstFeedWell);
|
||
|
||
}
|
||
|
||
//取动态属性显示数据
|
||
void TDbVerticalSection::GetTips(DList<TObjInfoUnit> &info) const
|
||
{
|
||
info.Append(new TObjInfoUnit(_T("对象类型"), _T("纵断面图")));
|
||
}
|
||
|
||
void TDbVerticalSection::GetLine(XLine &line) const
|
||
{
|
||
XPoint ptEnd;
|
||
double dScaleY = m_iScaleY;
|
||
double dScaleX = m_iScaleX;
|
||
dScaleX = GetPScale() / dScaleX * 1000;
|
||
dScaleY = GetPScale() / dScaleY * 1000;//转化为毫米
|
||
|
||
XPoint ptStart;
|
||
XPoint ptIns = m_ptIns;
|
||
double nHighEle = m_nMaxDeep;
|
||
double nLowEle = m_nMinDeep;
|
||
double nEleStart = 0.0;
|
||
if(m_iCalcMode < 100) // 从左往右 原代码
|
||
nEleStart = m_lstWell[0].m_nUpEle;
|
||
else // add by 王辉 08-05-05
|
||
nEleStart = m_lstWell[m_lstWell.Length() - 1].m_nUpEle;
|
||
//绘制比例尺
|
||
int iHighEle = (int)(nHighEle + 1);
|
||
int iLowEle = (int)nLowEle;
|
||
if(fabs(nLowEle) > iLowEle && nLowEle < 0)
|
||
iLowEle --;
|
||
//2009-6-24 增加以下2句,
|
||
if(fabs(nLowEle - iLowEle) < 0.2) //如果最低标尺值距实际最低标高就差0.2米,最低标尺再降低1米
|
||
iLowEle --;
|
||
if(fabs(nHighEle - iHighEle) < 0.2) //如果最高标尺值距实际最高标高就差0.2米,最高标尺再提高1米
|
||
iHighEle ++;
|
||
|
||
int iAllMeter = iHighEle - iLowEle;
|
||
nHighEle = (double)iHighEle - nEleStart;
|
||
ads_polar(ptIns, m_nLayoutRotation+PI, 20*GetPScale(), ptStart);
|
||
ads_polar(ptStart, m_nLayoutRotation+PI/2, nHighEle*dScaleY, ptStart);
|
||
|
||
//第一行比例尺
|
||
XPoint ptText, ptFisrtStart, ptStart2, ptEnd2, pt1;
|
||
ptFisrtStart = ptStart;
|
||
ads_polar(ptStart, m_nLayoutRotation+PI, 3* GetPScale(), ptText);
|
||
ads_polar(ptStart, m_nLayoutRotation, GetAllPipeLen()+20*GetPScale(), pt1);
|
||
double nHighEleTmp = (double)iHighEle;
|
||
ads_polar(ptStart, m_nLayoutRotation+PI, 2*GetPScale(), ptStart2);
|
||
|
||
double nNum = 1/m_nGridScale;
|
||
double nGridScale = m_nGridScale;
|
||
if(m_nGridScale < 0.01)
|
||
{
|
||
nNum = 1;
|
||
nGridScale = 1;
|
||
}
|
||
|
||
for(int i=0;i<iAllMeter*nNum;i++)
|
||
{
|
||
ads_polar(ptStart, m_nLayoutRotation-PI/2, dScaleY/nNum, ptEnd);
|
||
if(i%2 == 0)
|
||
ads_polar(ptStart, m_nLayoutRotation+PI, 1.5* GetPScale(), ptStart2);
|
||
else
|
||
ads_polar(ptStart, m_nLayoutRotation+PI, 0.5*GetPScale(), ptStart2);
|
||
ads_polar(ptStart2, m_nLayoutRotation-PI/2, dScaleY/nNum, ptEnd2);
|
||
|
||
ads_polar(ptStart, m_nLayoutRotation+PI, 2*GetPScale(), ptStart2);
|
||
ads_polar(ptStart2, m_nLayoutRotation-PI/2, dScaleY/nNum, ptEnd2);
|
||
|
||
ads_polar(ptEnd, m_nLayoutRotation+PI, 3*GetPScale(), ptText);
|
||
nHighEleTmp = nHighEleTmp - nGridScale;
|
||
ptStart = ptEnd;
|
||
//绘制横网格
|
||
if(m_nGridScale > 0.01)
|
||
{
|
||
ads_polar(ptEnd, m_nLayoutRotation, GetAllPipeLen()+20*GetPScale(), pt1);
|
||
}
|
||
}
|
||
|
||
//绘制井中心线
|
||
ads_polar(ptStart, m_nLayoutRotation-PI/2, 10*GetPScale(), ptStart);
|
||
ads_polar(ptStart, m_nLayoutRotation, 10*GetPScale(), ptEnd2);
|
||
|
||
XLine lineButton(ptStart, ptEnd2); //底线
|
||
line = lineButton;
|
||
}
|
||
|
||
void TDbVerticalSection::DimEle(const XPoint &ptCen, double dRadiusLong, double dRadiusShort, double dEle, CString &sText, bool bOnlyDimEle, XExplodeDraw &dc) const
|
||
{
|
||
XLine line;
|
||
GetLine(line);
|
||
XPoint pt;
|
||
ptCen.Project(&line, pt);
|
||
AcDbLine line2(ptCen, pt);
|
||
|
||
AcDbEllipse ellipse;
|
||
double ratio = dRadiusShort / dRadiusLong;
|
||
XPoint ptTem;
|
||
ads_polar(ptCen, m_nLayoutRotation+PI/2, dRadiusLong, ptTem);
|
||
AcGeVector3d majorAxis = ptTem.AsAcGePoint3d() - ptCen.AsAcGePoint3d();
|
||
// cet 2016.7.5 add 长轴小于短轴
|
||
if (dRadiusLong + 0.001 < dRadiusShort)
|
||
{
|
||
ads_polar(ptCen, m_nLayoutRotation, dRadiusShort, ptTem);
|
||
majorAxis = ptTem.AsAcGePoint3d() - ptCen.AsAcGePoint3d();
|
||
ratio = dRadiusLong/dRadiusShort;
|
||
}
|
||
ellipse.set(ptCen, AcGeVector3d::kZAxis, majorAxis, ratio);
|
||
|
||
AcGePoint3dArray ptArr;
|
||
line2.intersectWith(&ellipse, AcDb::kOnBothOperands, ptArr);
|
||
if (ptArr.length() == 1)
|
||
{
|
||
// cet 2014.7.7 add 当标高处于line之下时标注位置不对,现加以调整
|
||
int nFactor = 1;
|
||
AcGeVector3d vtTemp = ptArr[0] - pt.AsAcGePoint3d();
|
||
vtTemp.z = 0.0;
|
||
vtTemp.normalize();
|
||
AcGeTol tol;
|
||
tol.setEqualVector(0.001);
|
||
// cet 2014.7.16 modify 布局转角发生变化时,计算错误
|
||
AcGeVector3d vtY = AcGeVector3d::kXAxis;
|
||
vtY.rotateBy(m_nLayoutRotation + PI / 2, AcGeVector3d::kZAxis);
|
||
if (vtTemp.isCodirectionalTo(-vtY, tol))
|
||
{
|
||
nFactor = -1;
|
||
ptArr[0] += vtTemp * dRadiusLong * 2;
|
||
}
|
||
|
||
if (!bOnlyDimEle)
|
||
{
|
||
// 管线名称管径标注
|
||
XPoint ptMid;
|
||
Midpoint(pt, asDblArray(ptArr[0]), ptMid);
|
||
TDbText text1;
|
||
text1.SetPScale(GetPScale());
|
||
text1.setLayer(m_idTextLayer);
|
||
text1.SetStyleId(m_idTextStyle);
|
||
text1.SetText(sText);
|
||
text1.SetRotation(m_nLayoutRotation + PI / 2); // cet 2014.7.16 modify 考虑布局转角
|
||
text1.SetLocation(ptMid);
|
||
text1.SetHeight(m_dTextHeight);
|
||
text1.SetAlignment(XExplodeDraw::kMiddle);
|
||
double dWidth = 0.0;
|
||
text1.GetExtents(&dWidth, NULL);
|
||
if(dc.IsFullExplode())
|
||
{
|
||
text1.ExplodeOrDraw2d(dc);
|
||
}
|
||
else
|
||
{
|
||
dc.DrawEntity(text1);
|
||
}
|
||
|
||
// 直线
|
||
double dLen = pt.Distance2d(ptArr[0]);
|
||
AcGeVector3d vt = ptArr[0] - asPnt3d(pt);
|
||
vt.normalize();
|
||
XPoint pt2;
|
||
pt2 = pt + vt * (dLen - dWidth) * 0.5;
|
||
// cet 2018.2.8 modify 调整直线图层
|
||
// dc << TGGeLine(pt, pt2);
|
||
DrawGridLine(pt, pt2, dc);
|
||
|
||
pt2 = ptArr[0] - vt * (dLen - dWidth) * 0.5;
|
||
// cet 2018.2.8 modify 调整直线图层
|
||
// dc << TGGeLine(asDblArray(ptArr[0]), pt2);
|
||
DrawGridLine(ptArr[0], pt2, dc);
|
||
}
|
||
|
||
// 标高
|
||
AcGeVector3d vt = ptArr[0] - asPnt3d(pt);
|
||
vt.normalize();
|
||
vt.rotateBy(-PI / 2 * nFactor, AcGeVector3d::kZAxis); // cet 2014.7.7 add 当标高处于line之下时标注位置不对,现加以调整
|
||
XPoint pt3;
|
||
pt3 = ptArr[0] + vt * 1000;
|
||
if (DocGetMeterUnitDraw()) // cet 2011.6.30 add
|
||
{
|
||
pt3 = ptArr[0] + vt * 10;
|
||
}
|
||
// cet 2018.2.8 modify 调整直线图层
|
||
// dc << TGGeLine(pt3, asDblArray(ptArr[0]));
|
||
DrawGridLine(pt3, ptArr[0], dc);
|
||
CString sEle;
|
||
sEle.Format(_T("%.3f"), dEle);
|
||
TDbSymbElevation text;
|
||
pt3 = ptArr[0] + vt * 500;
|
||
if (DocGetMeterUnitDraw()) // cet 2011.6.30 add
|
||
{
|
||
pt3 = ptArr[0] + vt * 5;
|
||
}
|
||
text.setLayer(m_idTextLayer);
|
||
text.SetLocation(pt3);
|
||
text.SetText(sEle);
|
||
text.SetBaseLine(FALSE);
|
||
text.SetLeader(FALSE);
|
||
text.SetTextHeight(m_dTextHeight);
|
||
text.SetTextStyleId(m_idTextStyle);
|
||
text.SetLayoutRotation(Ucs2Wcs(0.0));
|
||
|
||
AcDbIntArray indices;
|
||
indices.append(1);
|
||
AcGeVector3d vtOffset(0, -1, 0);
|
||
vtOffset = Ucs2Wcs(vtOffset, TRUE); // cet 2011.6.30 add
|
||
if (vtOffset.length() > _DIST_SNAP*10)
|
||
{
|
||
vtOffset.normalize();
|
||
double dScale = (2*DocGetEleTriangleSize() + 0.5) * DocGetPScale();
|
||
vtOffset *= dScale;
|
||
text.moveGripPointsAt(indices, vtOffset);
|
||
}
|
||
|
||
text.SetLayoutRotation(m_nLayoutRotation);
|
||
|
||
int nColor = dc.GetColor();
|
||
dc.SetColor(3);
|
||
text.SetPScale(this->GetPScale()); // cet 2016.11.3 add 缺少比例设置,导致图纸空间中实体大小发生变化
|
||
if(dc.IsFullExplode())
|
||
{
|
||
text.ExplodeOrDraw2d(dc);
|
||
}
|
||
else
|
||
{
|
||
dc.DrawEntity(text);
|
||
}
|
||
dc.SetColor(nColor);
|
||
}
|
||
}
|
||
|
||
void TDbVerticalSection::DimDist(const CString &sDim, const XPoint &ptStart, const XPoint &ptEnd, XExplodeDraw &dc, int &nDist, const double dDeep, const double dLong, bool bFromRight) const
|
||
{
|
||
// cet 2017.8.29 add 长度为0不标注
|
||
if (fabs(_tstof(sDim)) < 0.0001)
|
||
{
|
||
return;
|
||
}
|
||
double d = m_iScaleY;
|
||
double dScale = (50 / d);
|
||
double dDist2Line = 2.3;
|
||
if (m_nGridScale == 2.0)
|
||
{
|
||
dDist2Line = 4.3;
|
||
}
|
||
XLine line;
|
||
GetLine(line);
|
||
XPoint pt1, pt2;
|
||
pt1 = line.GetStartPoint();
|
||
pt2 = line.GetEndPoint();
|
||
ads_polar(pt1, m_nLayoutRotation+PI/2, (1+(dDist2Line * dScale)) * (DocGetMeterUnitDraw() ? 10 : 1000), pt1);
|
||
ads_polar(pt2, m_nLayoutRotation+PI/2, (1+(dDist2Line * dScale)) * (DocGetMeterUnitDraw() ? 10 : 1000), pt2);
|
||
line.SetStartPoint(pt1);
|
||
line.SetEndPoint(pt2);
|
||
ptStart.Project(&line, pt1);
|
||
ptEnd.Project(&line, pt2);
|
||
AcGeVector3d vt = pt2 - pt1;
|
||
if (bFromRight)
|
||
{
|
||
vt = pt1 - pt2;
|
||
}
|
||
|
||
double dFact = 0.0;
|
||
if (dDeep < 0.001 || dDeep > 3.0)// 埋深与管线的距离不在合适的范围时,长度标注位置随管线
|
||
{
|
||
pt2 = ptEnd;
|
||
if (dDeep < 0.001)
|
||
{
|
||
dFact = 0.8;
|
||
}
|
||
else
|
||
{
|
||
dFact = -0.8;
|
||
}
|
||
|
||
if (bFromRight)
|
||
{
|
||
pt1 = pt2 + vt;
|
||
}
|
||
else
|
||
{
|
||
pt1 = pt2 - vt;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
nDist++;
|
||
dFact = nDist;
|
||
}
|
||
// cet 2016.7.25 modify 转T3 T5 T6时,提示错误,更改标注方法
|
||
// TDbDimension2 entDim;
|
||
// entDim.setLayer(LAY_DIM);
|
||
// entDim.SetLocation(pt1);
|
||
// entDim.SetStyleId(InitDimStyle(DS_LINEAR));
|
||
// entDim.SetRotation(m_nLayoutRotation);
|
||
// entDim.SetLayoutRotation(m_nLayoutRotation); // cet 2014.7.16 add 考虑布局转角
|
||
// entDim.AddSegment(pt2);
|
||
// entDim.SetTextContent(0, sDim);
|
||
// entDim.SetDist2DimLine(-0.6 * dFact * (DocGetMeterUnitDraw() ? 10 : 1000), FALSE);
|
||
//
|
||
//
|
||
// int nIndex = dc.GetColor();
|
||
// dc.SetColor(3);
|
||
// if(dc.IsFullExplode())
|
||
// {
|
||
// entDim.ExplodeOrDraw2d(dc);
|
||
// }
|
||
// else
|
||
// {
|
||
// dc.DrawEntity(entDim);
|
||
// }
|
||
// dc.SetColor(nIndex);
|
||
XPoint ptMid;
|
||
Midpoint(pt1, pt2, ptMid);
|
||
TDbText text;
|
||
text.SetPScale(GetPScale());
|
||
text.setLayer(m_idTextLayer);
|
||
text.SetStyleId(m_idTextStyle);
|
||
text.SetText(sDim);
|
||
text.SetRotation(m_nLayoutRotation);
|
||
text.SetHeight(m_dTextHeight);
|
||
text.SetAlignment(XExplodeDraw::kBottomCenter);
|
||
double dWidth = 0.0, dHeight = 0.0;
|
||
text.GetExtents(&dWidth, &dHeight);
|
||
AcGeVector3d vtDir = AcGeVector3d::kXAxis;
|
||
vtDir.rotateBy(m_nLayoutRotation + PI * 0.5, AcGeVector3d::kZAxis);
|
||
double dOffset = dHeight * 0.3;
|
||
text.SetLocation(ptMid + vtDir * dOffset);
|
||
if(dc.IsFullExplode())
|
||
{
|
||
text.ExplodeOrDraw2d(dc);
|
||
}
|
||
else
|
||
{
|
||
dc.DrawEntity(text);
|
||
}
|
||
AcDbObjectId idLayerOld = dc.GetLayerId();
|
||
dc.SetLayer(m_idSectLayer);
|
||
int nIndex = dc.GetColor();
|
||
int nNewColor = 3;
|
||
dc.SetColor(nNewColor);
|
||
// cet 2018.2.8 modify 调整直线图层
|
||
// dc << XLine(pt1, pt2);
|
||
// dc << XLine(pt1 + vtDir * dHeight, pt1 - vtDir * dHeight);
|
||
// dc << XLine(pt2 + vtDir * dHeight, pt2 - vtDir * dHeight);
|
||
DrawGridLine(pt1, pt2, dc);
|
||
DrawGridLine(pt1 + vtDir * dHeight, pt1 - vtDir * dHeight, dc);
|
||
DrawGridLine(pt2 + vtDir * dHeight, pt2 - vtDir * dHeight, dc);
|
||
double dLineWidth = 0.05 * GetPScale();
|
||
vtDir.rotateBy(-PI * 0.25, AcGeVector3d::kZAxis);
|
||
AcDbPolyline polyLine1, polyLine2;
|
||
polyLine1.addVertexAt(0, (pt1 + vtDir * dHeight * 0.25).AsAcGePoint2d());
|
||
polyLine1.addVertexAt(1, (pt1 - vtDir * dHeight * 0.25).AsAcGePoint2d());
|
||
polyLine2.addVertexAt(0, (pt2 + vtDir * dHeight * 0.25).AsAcGePoint2d());
|
||
polyLine2.addVertexAt(1, (pt2 - vtDir * dHeight * 0.25).AsAcGePoint2d());
|
||
polyLine1.setConstantWidth(dLineWidth);
|
||
polyLine2.setConstantWidth(dLineWidth);
|
||
polyLine1.setLayer(m_idSectLayer);
|
||
polyLine2.setLayer(m_idSectLayer);
|
||
polyLine1.setColorIndex(nNewColor);
|
||
polyLine2.setColorIndex(nNewColor);
|
||
dc.DrawEntity(polyLine1);
|
||
dc.DrawEntity(polyLine2);
|
||
dc.SetColor(nIndex);
|
||
dc.SetLayer(idLayerOld);
|
||
}
|
||
|
||
bool TDbVerticalSection::IsDimDist() const
|
||
{
|
||
const TEntityFields &fd = GetFields();
|
||
Adesk::Boolean bVal = Adesk::kFalse;
|
||
fd.GFD(_T("DIM_DIST"), bVal);
|
||
return bVal == Adesk::kTrue ? true : false;
|
||
}
|
||
|
||
void TDbVerticalSection::SetDimDist(bool bDim)
|
||
{
|
||
assertWriteEnabled();
|
||
TEntityFields &fd = Fields();
|
||
fd.SFD(_T("DIM_DIST"), bDim ? Adesk::kTrue : Adesk::kFalse);
|
||
}
|
||
|
||
bool TDbVerticalSection::IsDimEle() const
|
||
{
|
||
const TEntityFields &fd = GetFields();
|
||
Adesk::Boolean bVal = Adesk::kFalse;
|
||
fd.GFD(_T("DIM_ELE"), bVal);
|
||
return bVal == Adesk::kTrue ? true : false;
|
||
}
|
||
|
||
void TDbVerticalSection::SetDimEle(bool bDim)
|
||
{
|
||
assertWriteEnabled();
|
||
TEntityFields &fd = Fields();
|
||
fd.SFD(_T("DIM_ELE"), bDim ? Adesk::kTrue : Adesk::kFalse);
|
||
}
|
||
|
||
bool TDbVerticalSection::IsShowCrossPipe(TPipeSys::SysType sys) const
|
||
{
|
||
int nDx = GetPipeIndex(sys);
|
||
if (nDx == -1)
|
||
{
|
||
return false;
|
||
}
|
||
Adesk::UInt32 nCrossPipe = 0xffff;
|
||
const TEntityFields &fd = GetFields();
|
||
fd.GFD(_T("ShowCrossPipe"), nCrossPipe);
|
||
Adesk::UInt32 nTemp = 0x01;
|
||
nTemp <<= nDx;
|
||
return ((nCrossPipe&nTemp) > 0);
|
||
}
|
||
|
||
bool TDbVerticalSection::IsShowCrossPipe(const CString &sSysName) const
|
||
{
|
||
const TEntityFields &fd = GetFields();
|
||
Adesk::Boolean bShow = Adesk::kFalse;
|
||
fd.GFD(sSysName, bShow);
|
||
return bShow == Adesk::kTrue ? true : false;
|
||
}
|
||
|
||
bool TDbVerticalSection::IsShowCrossPipe(const AcDbObjectId &idPipe) const
|
||
{
|
||
bool bShow = false;
|
||
TDbPipe *pPipe = NULL;
|
||
acdbOpenObject(pPipe, idPipe, AcDb::kForRead);
|
||
if (pPipe != NULL)
|
||
{
|
||
if (pPipe->HavePipeSystemName()) // 新版管道系统
|
||
{
|
||
bShow = IsShowCrossPipe(pPipe->GetPipeSystemName());
|
||
}
|
||
else // 旧版管道系统
|
||
{
|
||
bShow = IsShowCrossPipe(pPipe->GetSysType());
|
||
}
|
||
pPipe->close();
|
||
}
|
||
return bShow;
|
||
}
|
||
|
||
void TDbVerticalSection::SetShowCrossPipe(TPipeSys::SysType sys, bool bShow)
|
||
{
|
||
int nDx = GetPipeIndex(sys);
|
||
if (nDx == -1)
|
||
{
|
||
return;
|
||
}
|
||
Adesk::UInt32 nCrossPipe = 0;
|
||
TEntityFields &fd = Fields();
|
||
fd.GFD(_T("ShowCrossPipe"), nCrossPipe);
|
||
Adesk::UInt32 nTemp = 0x01;
|
||
nTemp <<= nDx;
|
||
if(bShow)
|
||
{
|
||
nCrossPipe |= nTemp;
|
||
}
|
||
else
|
||
{
|
||
nCrossPipe &= ~nTemp;
|
||
}
|
||
fd.SFD(_T("ShowCrossPipe"), nCrossPipe);
|
||
}
|
||
|
||
void TDbVerticalSection::SetShowCrossPipe(const CString &sSysName, bool bShow)
|
||
{
|
||
assertWriteEnabled();
|
||
TEntityFields &fd = Fields();
|
||
fd.SFD(sSysName, bShow ? Adesk::kTrue : Adesk::kFalse);
|
||
}
|
||
|
||
int TDbVerticalSection::GetPipeIndex(TPipeSys::SysType sys) const
|
||
{
|
||
int nRet = -1;
|
||
switch (sys)
|
||
{
|
||
case TPipeSys::kFeedWater:
|
||
case TPipeSys::kFeedWater2:
|
||
case TPipeSys::kFeedWater3:
|
||
{
|
||
nRet = 0;
|
||
break;
|
||
}
|
||
case TPipeSys::kDirtWater:
|
||
{
|
||
nRet = 1;
|
||
break;
|
||
}
|
||
case TPipeSys::kUselessWater:
|
||
{
|
||
nRet = 2;
|
||
break;
|
||
}
|
||
case TPipeSys::kRainWater:
|
||
{
|
||
nRet = 3;
|
||
break;
|
||
}
|
||
case TPipeSys::kUsedWater:
|
||
case TPipeSys::kUsedWater2:
|
||
case TPipeSys::kUsedWater3:
|
||
{
|
||
nRet = 4;
|
||
break;
|
||
}
|
||
case TPipeSys::kFireFighting:
|
||
case TPipeSys::kFireFighting2:
|
||
case TPipeSys::kFireFighting3:
|
||
{
|
||
nRet = 5;
|
||
break;
|
||
}
|
||
case TPipeSys::kOther:
|
||
{
|
||
nRet = 6;
|
||
break;
|
||
}
|
||
}
|
||
return nRet;
|
||
}
|
||
|
||
// cet 2013.3.1 add 获得池子名
|
||
CString TDbVerticalSection::GetPoolName( const AcDbObjectId &id ) const
|
||
{
|
||
CString sName;
|
||
OPENOBJ_BEGIN(id, AcDb::kForRead, TDbPool, pPool);
|
||
if (pPool != NULL)
|
||
{
|
||
sName = pPool->GetLabel();
|
||
}
|
||
OPENOBJ_END();
|
||
return sName;
|
||
}
|
||
|
||
inline double TDbVerticalSection::OuterDn(const AcDbSoftPointerId &idPipe) const
|
||
{
|
||
std::map<AcDbHandle, PIPEDATA>::const_iterator it = m_mapPipeData.find(idPipe.handle());
|
||
if (it != m_mapPipeData.end())
|
||
{
|
||
return it->second.dOutDn;
|
||
}
|
||
return 0.0;
|
||
}
|
||
|
||
inline double TDbVerticalSection::InnerDn(const AcDbSoftPointerId &idPipe) const
|
||
{
|
||
std::map<AcDbHandle, PIPEDATA>::const_iterator it = m_mapPipeData.find(idPipe.handle());
|
||
if (it != m_mapPipeData.end())
|
||
{
|
||
return it->second.dInnerDn;
|
||
}
|
||
return 0.0;
|
||
}
|
||
|
||
inline void TDbVerticalSection::InitPipeData() const
|
||
{
|
||
std::map<AcDbHandle, PIPEDATA> &mapData = const_cast<std::map<AcDbHandle, PIPEDATA>&>(m_mapPipeData);
|
||
mapData.clear();
|
||
for (int i = 0; i < m_lstWell.Length(); ++i)
|
||
{
|
||
if (m_lstWell[i].m_bIsWell) // cet 2016.9.23 add
|
||
{
|
||
continue;
|
||
}
|
||
PIPEDATA data;
|
||
data.dDn = m_lstWell[i].m_iDn; // cet 2016.9.23 add
|
||
InitPipeData(m_lstWell[i].m_ID, data);
|
||
mapData[m_lstWell[i].m_ID.handle()] = data;
|
||
}
|
||
}
|
||
|
||
inline void TDbVerticalSection::InitPipeData(const AcDbSoftPointerId &idPipe, PIPEDATA &node) const
|
||
{
|
||
// cet 2016.9.22 modify 读取计算数据,以便实现单独修改纵断面图数据而不影响管道实体(如单元修改管道管径,只对纵断面图产生影响,而不对管道进行任何修改)
|
||
// OPENOBJ_BEGIN(idPipe, AcDb::kForRead, TDbPipe, pPipe);
|
||
// if (pPipe != NULL)
|
||
// {
|
||
// node.dDn = pPipe->GetDnDiameter();
|
||
// node.dOutDn = ((pPipe->OuterDn() > 0.001) ? pPipe->OuterDn() : node.dDn);
|
||
// node.dPipeThick = pPipe->GetPipeThick();
|
||
// node.dInnerDn = node.dOutDn - node.dPipeThick * 2;
|
||
// }
|
||
// OPENOBJ_END();
|
||
AcDbHandle handle = idPipe.handle();
|
||
TCHAR szHandle[256]=_T("");
|
||
handle.getIntoAsciiBuffer(szHandle);
|
||
CString sHandle = szHandle;
|
||
node.dOutDn = node.dDn;
|
||
node.dInnerDn = node.dDn;
|
||
GetPipeOuterDnInnerDn(idPipe, node.dOutDn, node.dInnerDn);
|
||
node.dPipeThick = (node.dOutDn - node.dInnerDn) * 0.5;
|
||
}
|
||
|
||
bool TDbVerticalSection::IsOnlyShowBranch() const
|
||
{
|
||
assertReadEnabled();
|
||
const TEntityFields &fd = GetFields();
|
||
Adesk::Boolean bFlag = Adesk::kTrue;
|
||
fd.GFD(_T("ONLY_SHOW_BRANCH"), bFlag);
|
||
return bFlag == Adesk::kTrue ? true : false;
|
||
}
|
||
|
||
void TDbVerticalSection::SetOnlyShowBranch(bool bShow)
|
||
{
|
||
assertWriteEnabled();
|
||
TEntityFields &fd = Fields();
|
||
fd.SFD(_T("ONLY_SHOW_BRANCH"), bShow ? Adesk::kTrue : Adesk::kFalse);
|
||
}
|
||
|
||
bool TDbVerticalSection::IsShowEqualEleBranch() const
|
||
{
|
||
assertReadEnabled();
|
||
const TEntityFields &fd = GetFields();
|
||
Adesk::Boolean bFlag = Adesk::kFalse;
|
||
fd.GFD(_T("SHOW_EQUAL_ELEVATION_BRANCH"), bFlag);
|
||
return bFlag == Adesk::kTrue ? true : false;
|
||
}
|
||
|
||
void TDbVerticalSection::SetShowEqualEleBranch(bool bShow)
|
||
{
|
||
assertWriteEnabled();
|
||
TEntityFields &fd = Fields();
|
||
fd.SFD(_T("SHOW_EQUAL_ELEVATION_BRANCH"), bShow ? Adesk::kTrue : Adesk::kFalse);
|
||
}
|
||
|
||
bool TDbVerticalSection::IsBrach(TDbPipe *pPipe, const AcDbObjectId &idMainLinked) const
|
||
{
|
||
for (int i = 0; i < 2; ++i)
|
||
{
|
||
AcDbObjectId id = pPipe->GetNode(i);
|
||
if (id == idMainLinked) // 主干一端连接的实体
|
||
{
|
||
continue;
|
||
}
|
||
// 判断管道另一端连接的实体类型
|
||
OPENOBJ_BEGIN(id, AcDb::kForRead, TDbPipeNode, pEqup);
|
||
if (pEqup != NULL)
|
||
{
|
||
return pEqup->isKindOf(TDbWell::desc()) || pEqup->isKindOf(TDbPool::desc());
|
||
}
|
||
OPENOBJ_END();
|
||
}
|
||
return false;
|
||
}
|
||
|
||
void TDbVerticalSection::UpdatePipeOuterDnInnerDn(const AcDbObjectId &id, double dOuterDn, double dInnerDn)
|
||
{
|
||
assertWriteEnabled();
|
||
AcDbHandle handle = id.handle();
|
||
TCHAR szHandle[256]=_T("");
|
||
handle.getIntoAsciiBuffer(szHandle);
|
||
CString sHandle = szHandle;
|
||
TEntityFields &fd = Fields();
|
||
fd.SFD(sHandle + _T("-outerDn"), dOuterDn);
|
||
fd.SFD(sHandle + _T("-innerDn"), dInnerDn);
|
||
}
|
||
|
||
bool TDbVerticalSection::IsShowPipeEndNotLinkedPipe() const
|
||
{
|
||
assertReadEnabled();
|
||
const TEntityFields &fd = GetFields();
|
||
Adesk::Boolean bFlag = Adesk::kFalse;
|
||
fd.GFD(_T("SHOW_PIPEEND_NOTLINKE_PIPE"), bFlag);
|
||
return bFlag == Adesk::kTrue ? true : false;
|
||
}
|
||
|
||
void TDbVerticalSection::SetShowPipeEndNotLinkedPipe(bool bShow)
|
||
{
|
||
assertWriteEnabled();
|
||
TEntityFields &fd = Fields();
|
||
fd.SFD(_T("SHOW_PIPEEND_NOTLINKE_PIPE"), bShow ? Adesk::kTrue : Adesk::kFalse);
|
||
}
|
||
|
||
void TDbVerticalSection::GetPipeOuterDnInnerDn(const AcDbObjectId &id, double &dOuterDn, double &dInnerDn) const
|
||
{
|
||
assertReadEnabled();
|
||
const TEntityFields &fd = GetFields();
|
||
AcDbHandle handle = id.handle();
|
||
TCHAR szHandle[256]=_T("");
|
||
handle.getIntoAsciiBuffer(szHandle);
|
||
CString sHandle = szHandle;
|
||
fd.GFD(sHandle + _T("-outerDn"), dOuterDn);
|
||
fd.GFD(sHandle + _T("-innerDn"), dInnerDn);
|
||
}
|
||
|
||
void TDbVerticalSection::ClearHidePipes()
|
||
{
|
||
TEntityFields &fd = Fields();
|
||
Adesk::UInt16 nNum = 0;
|
||
if (fd.GFD(_T("HidePipesNum"), nNum))
|
||
{
|
||
// 删除遮挡管道数参数
|
||
long nIndex = fd.Find(_T("HidePipesNum"));
|
||
if (nIndex != -1)
|
||
{
|
||
fd.Del(nIndex);
|
||
}
|
||
// 删除遮挡管道记录
|
||
CString sIndex;
|
||
CrossPoint crossTemp(AcDbObjectId::kNull);
|
||
for (Adesk::UInt16 i = 0; i < nNum; ++i)
|
||
{
|
||
sIndex.Format(_T("HidePipe_%d"), i);
|
||
crossTemp.DelCrossPoint(fd, sIndex);
|
||
}
|
||
}
|
||
}
|
||
|
||
void TDbVerticalSection::GetCrossPointInfo(std::vector<CrossPoint> &vecCrossPoint) const
|
||
{
|
||
const TEntityFields &fd = GetFields();
|
||
Adesk::UInt16 nNum = 0;
|
||
if (fd.GFD(_T("HidePipesNum"), nNum)) // 有交叉点数据
|
||
{
|
||
CString sKey;
|
||
for (Adesk::UInt16 i = 0; i < nNum; ++i)
|
||
{
|
||
CrossPoint cr;
|
||
sKey.Format(_T("HidePipe_%d"), i);
|
||
cr.ReadCrossPoint(fd, sKey);
|
||
vecCrossPoint.push_back(cr);
|
||
}
|
||
}
|
||
else // 没有现成数据,计算获得
|
||
{
|
||
TDbVerticalSection *pVal = const_cast<TDbVerticalSection*>(this);
|
||
if (pVal != NULL)
|
||
{
|
||
pVal->UpdateHidePipes();
|
||
}
|
||
}
|
||
}
|
||
|
||
void TDbVerticalSection::DrawHatch(XExplodeDraw &dc, XPoly2D &ploy) const
|
||
{
|
||
AcDbObjectId idOldLayer = dc.GetLayerId();
|
||
dc.SetLayer(m_idGridLayer);
|
||
// cet 2018.2.8 modify 修改填充比例,颜色, 类型
|
||
// dc.DrawHatch(ploy, _T("AR-HBONE"), 0.5*GetPScale());
|
||
Adesk::UInt16 nOldColor = dc.GetColor();
|
||
dc.SetColor(GetFillingColor());
|
||
dc.DrawHatch(ploy, GetFillingPattern(), GetFillingRatio() * GetPScale());
|
||
dc.SetColor(nOldColor);
|
||
dc.SetLayer(idOldLayer);
|
||
}
|
||
|
||
void InitDbVerticalSection(BOOL bTrue)
|
||
{
|
||
if(bTrue) {
|
||
TDbVerticalSection::rxInit();
|
||
TDbVerticalSection::InitMatchProtocol(TRUE);
|
||
} else {
|
||
TDbVerticalSection::InitMatchProtocol(FALSE);
|
||
deleteAcRxClass(TDbVerticalSection::desc());
|
||
}
|
||
}
|