#include "stdafx.h" #include "DbVerticalSectionFeed.h" #include #include "DbWell.h" #include "DbPipe.h" #include #include #include "DbPump.h" #include "dbPipeFitting.h" extern CString ReadXdata(Entity ent, const TCHAR*szName); extern CString I2Str(double i); extern BOOL IsNodeWell(AcDbObjectId id); extern void CalcCrossPipes(DList &lstPipe, DList &lstOtherPipe, std::vector &vecCross, bool bShowPipeEndNotLinkedPipe); extern bool GetCrossInfo(const std::vector &vecCross, CrossPoint &cr); ACRX_DXF_DEFINE_MEMBERS(ATSVerticalSectionFeed, ATSEntity, AcDb::kDHL_CURRENT, AcDb::kMReleaseCurrent, 1, ATS_VERTICALSECTION_FEED, "ATS_VERTICALSECTION_FEED图形无法解析, 请下载上华软件|网址: www.shanghuasoft.com"); IMPLEMENT_TENTBASE(TDbVerticalSectionFeed); const Adesk::UInt8 TDbVerticalSectionFeed::g_nVersion = 2; // cet 2016.5.11 modify 添加新成员变量 TDbVerticalSectionFeed::TDbVerticalSectionFeed() { 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("井编号 井径(mm) 设计地面标高(m) 自然地面标高(m) 埋设深度(m) 覆土厚度(m) 管标高(m)管径(mm) 备注"); m_nCalcType = 1; // cet 2015.5.11 add 默认按已知覆土厚度计算 } void TDbVerticalSectionFeed::CopyPropertiesFrom(AcDbEntity *pSrc,unsigned gMatchFlag) { assertWriteEnabled(); TDbVerticalSectionFeed *pSect = TDbVerticalSectionFeed::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 TDbVerticalSectionFeed::subGetClassID(CLSID* pClsid) const { return Acad::eOk; } Acad::ErrorStatus TDbVerticalSectionFeed::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 TDbVerticalSectionFeed::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()) // 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; m_lstFeedWell[(idx-1)*2]->m_nUpEle += nDist; for(int j=0;jm_csName == m_lstFeedWell[(idx-1)*2]->m_csName){ m_lstFeedWell[j]->m_nUpEle = m_lstFeedWell[(idx-1)*2]->m_nUpEle; break; } } Calc(); } } Acad::ErrorStatus es=Acad::eOk; return es; } Acad::ErrorStatus TDbVerticalSectionFeed::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 TDbVerticalSectionFeed::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); // ReadString(pFiler, m_sSheetRow); Adesk::UInt16 nNum=0; pFiler->readItem(&nNum); m_lstFeedWell.Reset(); for(Adesk::UInt16 i=0; idwgInFields(pFiler); m_lstFeedWell.Append(pData); } m_lstPt.Reset(); pFiler->readItem(&nNum); for(i=0; ireadItem((AcGePoint3d *)&PtTemp); m_lstPt.NewAppend(PtTemp); } m_nGridScale = GetGridScale(); // cet 2016.5.11 add 添加计算方式 if (nVer > 1) { pFiler->readItem(&m_nCalcType); } return pFiler->filerStatus(); } Acad::ErrorStatus TDbVerticalSectionFeed::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; 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); // pFiler->writeItem((const TCHAR *)m_sSheetRow); //8.0数据 Adesk::UInt16 nCount=(Adesk::UInt16)m_lstFeedWell.Length(); pFiler->writeItem(nCount); for(Adesk::UInt16 i=0; iwriteItem(nCount); for(i=0; iwriteItem((AcGePoint3d &)m_lstPt[i]); } // cet 2016.5.11 add 添加计算方式 Adesk::UInt8 nVer; if (g_nSaveTArchVer <= 10) { nVer = 1; } else { nVer = g_nVersion; } if (nVer > 1) { pFiler->writeItem(m_nCalcType); } return pFiler->filerStatus(); } Acad::ErrorStatus TDbVerticalSectionFeed::dxfInFields(AcDbDxfFiler* pFiler) { assertWriteEnabled(); Acad::ErrorStatus es=Acad::eOk; es=TDbEntity::dxfInFields(pFiler); return es; } Acad::ErrorStatus TDbVerticalSectionFeed::dxfOutFields(AcDbDxfFiler* pFiler) const { Acad::ErrorStatus es=Acad::eOk; es=TDbEntity::dxfOutFields(pFiler); return es; } // Active when being rotated, scaled, moved, etc. Acad::ErrorStatus TDbVerticalSectionFeed::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 TDbVerticalSectionFeed::subIntersectWith(const AcDbEntity* ent, AcDb::Intersect intType, AcGePoint3dArray& points, int thisGsMarker, int otherGsMarker) const { return Acad::eOk; } Acad::ErrorStatus TDbVerticalSectionFeed::subIntersectWith(const AcDbEntity* ent, AcDb::Intersect intType, const AcGePlane& projPlane, AcGePoint3dArray& points, int thisGsMarker, int otherGsMarker) const { return Acad::eOk; } //const TCHAR* TDbVerticalSectionFeed::GetSheetRowHeight() const //{ // const TEntityFields &fd = GetFields(); // CString sData; // fd.GFD(_T("ROW_HEIGHT"), sData); // return (const TCHAR*)sData; //} // //void TDbVerticalSectionFeed::SetSheetRowHeight(const TCHAR* szSheetRowHeight) //{ // assertWriteEnabled(); // TEntityFields &fd = Fields(); // fd.SFD(_T("ROW_HEIGHT"), szSheetRowHeight); //} void TDbVerticalSectionFeed::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 TDbVerticalSectionFeed::DrawGridLine(XPoint ptStart, XPoint ptEnd, XExplodeDraw &dc) const { 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); } void TDbVerticalSectionFeed::DrawDoteLine(XPoint ptStart, XPoint ptEnd, XExplodeDraw &dc) const { AcDbObjectId idLayerOld=dc.GetLayerId(); dc.SetLayer(m_idDoteLayer); XLine pLine(ptStart, ptEnd, 1); dc.DrawLine(pLine,0); dc.SetLayer(idLayerOld); } void TDbVerticalSectionFeed::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 TDbVerticalSectionFeed::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 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 TDbVerticalSectionFeed::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 nWellRadius = 4 * GetPScale(); assertReadEnabled(); double nRotWcs=Layout2Wcs(0); int len = m_lstPt.Length(); int nWell = m_lstWell.Length(); // add by 王辉 08-05-05 for(int i=0;im_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 TDbVerticalSectionFeed::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 -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; nGetColumnWidth(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(!(d1GetColumnPoint(n); break; } } } } } ReleaseEntSet(entSet); return ret; } */ Acad::ErrorStatus TDbVerticalSectionFeed::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; nEleStart = m_lstFeedWell[0].m_nUpEle; //绘制比例尺 int iHighEle = (int)(nHighEle + 1); int iLowEle = (int)nLowEle; if(fabs(nLowEle) > iLowEle && nLowEle < 0) iLowEle --; 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 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(m_ptTop) = ptFisrtStart; const_cast(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 lstAllPipe;//本图所有管线 // if(!!objectId()) // GetAllPipes(lstAllPipe); XPoint ptIns = m_ptIns; double dScaleY = m_iScaleY; double dScaleX = m_iScaleX; dScaleX = GetPScale() / dScaleX * 1000; dScaleY = GetPScale() / dScaleY * 1000;//转化为毫米 double iDn = OuterDn(m_lstFeedWell[1].m_ID); iDn = iDn * dScaleY / 1000; double iDn2(0); double nEleStart = m_lstFeedWell[0].m_nUpEle; XPoint ptStart, ptEnd, pt1, pt2, pt3, pt4, pt5, pt6, pt7, pt8, ptTmp, ptStartG, ptEndG; XPoint ptFrontUp, ptFrontLow; ptStart = ptIns; ads_polar(ptStart, m_nLayoutRotation+PI/2, (m_lstFeedWell[0].m_nGroundEle - nEleStart)*dScaleY, ptStartG); double dPipeLen = 0; BOOL bDrawGround = FALSE; for(int i=0;i 0.0001){ bDrawGround = TRUE; break; } } } // // cet 2017.8.28 add 获取所有交叉信息 // DList lstPipe; // for(int i = 0; i < m_lstFeedWell.Length(); ++i) // { // if(!m_lstFeedWell[i].m_bIsWell) // { // lstPipe.Append(new AcDbObjectId(m_lstFeedWell[i].m_ID)); // } // } // std::vector vecCrossPoint; // CalcCrossPipes(lstPipe, lstAllPipe, vecCrossPoint, IsShowPipeEndNotLinkedPipe()); std::vector vecCrossPoint; GetCrossPointInfo(vecCrossPoint); for(i=0;i 0){ double nI = m_lstFeedWell[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); continue; } else if(m_lstFeedWell[i].m_csName == _T("断管") && dPipeLen < 0.0001){ continue; } double nWellDia = fabs(m_lstFeedWell[i].m_nWellRadius * dScaleX * 0.002);//支持米单位 BOOL bIsNode = IsNodeWell(m_lstFeedWell[i].m_ID); if(i != m_lstFeedWell.Length() - 1) iDn = OuterDn(m_lstFeedWell[i + 1].m_ID) * dScaleY / 1000; if(i != 0) iDn2 = OuterDn(m_lstFeedWell[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){ BOOL bIsNode2 = IsNodeWell(m_lstFeedWell[i-2].m_ID); //看前1井是否是节点 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, nEleG*dScaleY, ptEndG); ads_polar(ptEnd, m_nLayoutRotation+PI/2, nEle*dScaleY, ptEnd); 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.8 modify 使用管道首端井的宽度 // ads_polar(ptStart, m_nLayoutRotation, nWellDia/2, pt3); ads_polar(ptStart, m_nLayoutRotation, i >= 2 ? fabs(m_lstFeedWell[i - 2].m_nWellRadius * dScaleX * 0.002) / 2 : nWellDia/2, pt3); DrawLine(pt3, pt1, dc);//绘制地面线 // cet 2016.12.8 modify 使用管道首端井的宽度 // ads_polar(ptStart, m_nLayoutRotation, nWellDia/2, pt1); ads_polar(ptStart, m_nLayoutRotation, i >= 2 ? fabs(m_lstFeedWell[i - 2].m_nWellRadius * dScaleX * 0.002) / 2 : nWellDia/2, pt1); ads_polar(ptEnd, m_nLayoutRotation+PI, nWellDia/2, pt2); //如果是节点井,就不绘制井道,地面填充也填满 if(bIsNode) pt2 = ptEnd; if(bIsNode2) pt1 = ptStart; 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; } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// // 绘制表示本井其它管标高的管,用椭圆表示 OPENOBJ_BEGIN(m_lstFeedWell[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;jGetInterface(j, face); if(i>0 && face.m_idPipe == m_lstFeedWell[i-1].m_ID) continue; if(i< m_lstFeedWell.Length() - 1 && face.m_idPipe == m_lstFeedWell[i+1].m_ID) continue; double nPipeDownEle = 0.0; // cet 2016.7.6 add 管底标高 double dOuterDn = 0.0; // cet 2016.7.6 add 外径 double nThirdDn(0); double dDn = 0.0; AcDbObjectId idLay = NULL; bool bBranch = true; // cet 2016.9.8 add 是否为支路 OPENOBJ_BEGIN(face.m_idPipe, AcDb::kForRead, TDbPipe, pPipe); if(pPipe){ nThirdDn = (pPipe->OuterDn() - pPipe->GetPipeThick() * 2) * dScaleY / 1000; idLay = pPipe->layerId(); // cet 2016.7.6 add 计算管内底标高 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(); bBranch = IsBrach(pPipe, m_lstFeedWell[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_lstFeedWell[i].m_nDownEle) > 0.001) // cet 2016.9.6 modify 不绘制管内底标高与井底标高一致的管道 if ((IsOnlyShowBranch() && bBranch || !IsOnlyShowBranch()) && // 控制是否只显示支路 ((fabs(nPipeDownEle + dDn - m_lstFeedWell[i].m_nDownEle) > 0.001) && !IsShowEqualEleBranch() || IsShowEqualEleBranch())) // 是否只显示等高支路 { XPoint ptEllipse; double nThirdPipeDeep = m_lstFeedWell[i].m_nUpEle - nPipeDownEle; ads_polar(ptStart, m_nLayoutRotation-PI/2, nThirdPipeDeep * dScaleY - nThirdDn / 2, ptEllipse); bool bRet = false; DrawEllipse(ptEllipse, dOuterDn * dScaleY * 0.0005, dOuterDn * dScaleX * 0.0005, dc, idLay, &bRet); // cet 2011.6.2 add 标注碰撞管内底标高 if (bRet && IsDimEle()) { ads_polar(ptEllipse, m_nLayoutRotation + PI/2, dOuterDn * dScaleY * 0.0005, ptEllipse); CString ss; DimEle(ptEllipse, dOuterDn * dScaleY * 0.0005, dOuterDn * dScaleX * 0.0005, nPipeDownEle + dDn, ss, true, dc); } } } } } OPENOBJ_END(); ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// XPoint ptUpLeft2; ads_polar(ptStart, m_nLayoutRotation, nWellDia/2, pt1); ads_polar(ptStart, m_nLayoutRotation+PI, nWellDia/2, pt2); double nDeep = (m_lstFeedWell[i].m_nUpEle - m_lstFeedWell[i].m_nDownEle) * dScaleY; XPoint ptFrontWellTop, ptFrontWellBottom, ptBackWellTop, ptBackWellBottom; ptFrontWellTop = pt7;// 前井 pt7井管顶右边点 pt8井管底右边点 ptFrontWellBottom = pt8; if(i != 0){ double nDropDeep = m_lstFeedWell[i].m_nUpEle - m_lstFeedWell[i].m_nFrondDownEle; ads_polar(pt2, m_nLayoutRotation-PI/2.0, nDropDeep * dScaleY, pt6); ads_polar(pt6, m_nLayoutRotation-PI/2.0, iDn2/2.0, ptBackWellBottom); ads_polar(pt6, m_nLayoutRotation+PI/2.0, iDn2/2.0, ptBackWellTop); } else{ ads_polar(pt2, m_nLayoutRotation-PI/2.0, nDeep, pt6); ads_polar(pt6, m_nLayoutRotation-PI/2.0, iDn/2.0, ptBackWellTop); ptBackWellBottom = ptBackWellTop; } if(dPipeLen > 0){ DrawPLine(ptFrontWellTop, ptBackWellTop, dc, 0.35*GetPScale()); //横管上线 DrawPLine(ptFrontWellBottom, ptBackWellBottom, dc, 0.35*GetPScale()); //横管下线 } XPoint ptBottomRight, ptUpRight, ptBottomLeft(ptTmp); // ads_polar(pt1, m_nLayoutRotation-PI/2, nDeep+iDn/2, ptBottomRight); // cet 2010.7.14 del iDn / 2 结果应为double型 ads_polar(pt1, m_nLayoutRotation-PI/2, nDeep+iDn/2.0, ptBottomRight); // cet 2010.7.14 add if(i == m_lstFeedWell.Length() -1) ptUpRight = ptBottomRight; //最后一个井 else // ads_polar(pt1, m_nLayoutRotation-PI/2, nDeep-iDn/2, ptUpRight); // cet 2010.7.14 del iDn / 2 结果应为double型 ads_polar(pt1, m_nLayoutRotation-PI/2, nDeep-iDn/2.0, ptUpRight); // cet 2010.7.14 add double nDropDeep = m_lstFeedWell[i].m_nFrondDownEle - m_lstFeedWell[i].m_nDownEle; if(nDropDeep > 0.001 && i != 0 && i != m_lstFeedWell.Length() -1){//下跌水 XPoint ptBackWellTopRight, ptBackWellBottomLeft; ads_polar(ptBackWellTop, m_nLayoutRotation, nWellDia, ptBackWellTopRight); DrawPLine(ptBackWellTop, ptBackWellTopRight, dc, 0.35*GetPScale()); ads_polar(ptBottomRight, m_nLayoutRotation+PI, nWellDia, ptBackWellBottomLeft); DrawPLine(ptBottomRight, ptBackWellBottomLeft, dc, 0.35*GetPScale()); DrawPLine(ptBackWellBottomLeft, ptBackWellBottom, dc, 0.35*GetPScale()); DrawPLine(ptBackWellTopRight, ptUpRight, dc, 0.35*GetPScale()); } else if(nDropDeep < -0.001 && i != 0 && i != m_lstFeedWell.Length() -1){//上跌水 XPoint ptBackWellBottomRight, ptBackWellTopLeft; ads_polar(ptBackWellBottom, m_nLayoutRotation, nWellDia, ptBackWellBottomRight); DrawPLine(ptBackWellBottom, ptBackWellBottomRight, dc, 0.35*GetPScale()); ads_polar(ptUpRight, m_nLayoutRotation+PI, nWellDia, ptBackWellTopLeft); DrawPLine(ptUpRight, ptBackWellTopLeft, dc, 0.35*GetPScale()); DrawPLine(ptBackWellTopLeft, ptBackWellTop, dc, 0.35*GetPScale()); DrawPLine(ptBackWellBottomRight, ptBottomRight, dc, 0.35*GetPScale()); } else{ //绘制2管的连接部分 if(i != 0 && i != m_lstFeedWell.Length() -1){ DrawPLine(ptBackWellTop, ptUpRight, dc, 0.35*GetPScale()); DrawPLine(ptBackWellBottom, ptBottomRight, dc, 0.35*GetPScale()); } } //绘制井 if(!bIsNode){ //如果是节点或者就不画井了 double nDeepSand = m_lstFeedWell[i].m_nSpare / 1000 * dScaleY; XPoint ptWellDownRight, ptWellDownLeft; double nDeep2 = (m_lstFeedWell[i].m_nUpEle - m_lstFeedWell[i].m_nFrondDownEle) * dScaleY; if(nDeep < nDeep2 && i != 0) //如果前管的深度大于本井的深度 nDeep = nDeep2; ads_polar(pt1, m_nLayoutRotation-PI/2, nDeep+iDn/2+nDeepSand, ptWellDownRight); ads_polar(pt2, m_nLayoutRotation-PI/2, nDeep+iDn/2+nDeepSand, ptWellDownLeft); DrawLine(pt2, ptWellDownLeft, dc); //井左边线 DrawLine(pt1, ptWellDownRight, dc); //井右边线 DrawLine(ptWellDownLeft, ptWellDownRight, dc); //井底边线 } pt7 = ptUpRight; // PT7井管顶右边点 pt8 = ptBottomRight; // PT8井管底右边点 //前断管 if(dPipeLen < 0.001 && i != 0){ double nI = m_lstFeedWell[i-1].m_nI; dPipeLen = 10*GetPScale(); ads_polar(ptBackWellTop, m_nLayoutRotation+PI, dPipeLen/2, pt3); ads_polar(ptBackWellBottom, m_nLayoutRotation+PI, dPipeLen/2, pt4); DrawPLine(ptBackWellTop, pt3, dc, 0.35*GetPScale()); //井底边线 DrawPLine(ptBackWellBottom, pt4, dc, 0.35*GetPScale());//井底边线 DrawBreakPipe(pt3, pt4, dc); } 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; AcDbObjectId idPipe = m_lstFeedWell[i].m_ID; OPENOBJ_BEGIN(idPipe, AcDb::kForRead, TDbPipe, pPipe); if(pPipe) { // ZXL 2013.12.06 ADD DList 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;jlayerId(); 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_lstFeedWell[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(); bool bRet = false; DrawEllipse(ptEllipse, dOuterDn * dScaleY * 0.0005, dOuterDn * dScaleX * 0.0005, dc, idLay, &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; XPoint ptTemp; ads_polar(ptEllipse, m_nLayoutRotation + PI/2, dOuterDn * dScaleY * 0.0005, ptTemp); DimEle(ptTemp, dOuterDn * dScaleY * 0.0005, dOuterDn * dScaleX * 0.0005, nPipeIntEle + dDn, 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; } void TDbVerticalSectionFeed::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_lstFeedWell[0].m_nUpEle; else // add by 王辉 08-05-05 nEleStart = m_lstFeedWell[m_lstFeedWell.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 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 TDbVerticalSectionFeed::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(); 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); vtTemp = Wcs2Ucs(vtTemp, TRUE); if (vtTemp.isCodirectionalTo(-AcGeVector3d::kYAxis, 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(PI / 2); cet 2011.6.30 midofy text1.SetRotation(Ucs2Wcs(PI / 2)); 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); // cet 2018.2.8 add 标注图层 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 TDbVerticalSectionFeed::DimDist(const CString &sDim, const XPoint &ptStart, const XPoint &ptEnd, XExplodeDraw &dc, int &nDist, const double dDeep, const double dLong) const { // cet 2017.8.29 add 长度为0不标注 if (fabs(_tstof(sDim)) < 0.0001) { return; } double d = m_iScaleY; double dScale = (50 / d); double dDist2Line = 1.3; if (m_nGridScale == 2.0) { dDist2Line = 3.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; double dFact = 0.0; if (dDeep < 0.001 || dDeep > 3.0)// 埋深与管线的距离不在合适的范围时,长度标注位置随管线 { pt2 = ptEnd; if (dDeep < 0.001) { dFact = 0.8; } else { dFact = -0.8; } pt1 = pt2 - vt; } else { nDist++; dFact = nDist; } // cet 2016.7.25 modify 转T3 T5 T6时,提示错误,更改标注方法 // TDbDimension2 entDim; // entDim.setLayer(m_idTextLayer); // entDim.SetLocation(pt1); // entDim.SetStyleId(InitDimStyle(DS_LINEAR)); // entDim.SetRotation(Ucs2Wcs(0.0)); // 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 TDbVerticalSectionFeed::IsDimDist() const { const TEntityFields &fd = GetFields(); Adesk::Boolean bVal = Adesk::kFalse; fd.GFD(_T("DIM_DIST"), bVal); return bVal == Adesk::kTrue ? true : false; } void TDbVerticalSectionFeed::SetDimDist(bool bDim) { assertWriteEnabled(); TEntityFields &fd = Fields(); fd.SFD(_T("DIM_DIST"), bDim ? Adesk::kTrue : Adesk::kFalse); } bool TDbVerticalSectionFeed::IsDimEle() const { const TEntityFields &fd = GetFields(); Adesk::Boolean bVal = Adesk::kFalse; fd.GFD(_T("DIM_ELE"), bVal); return bVal == Adesk::kTrue ? true : false; } void TDbVerticalSectionFeed::SetDimEle(bool bDim) { assertWriteEnabled(); TEntityFields &fd = Fields(); fd.SFD(_T("DIM_ELE"), bDim ? Adesk::kTrue : Adesk::kFalse); } bool TDbVerticalSectionFeed::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 TDbVerticalSectionFeed::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 TDbVerticalSectionFeed::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 TDbVerticalSectionFeed::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 TDbVerticalSectionFeed::SetShowCrossPipe(const CString &sSysName, bool bShow) { assertWriteEnabled(); TEntityFields &fd = Fields(); fd.SFD(sSysName, bShow ? Adesk::kTrue : Adesk::kFalse); } int TDbVerticalSectionFeed::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; } //绘制给水的支管, 要求必须是TDbPipeFitting,且连接水管在2根以上 //往AcDbObjectIdArray中添加一个对象, 如何已经存在就不添加 BOOL TDbVerticalSectionFeed::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;ilayerId()); 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 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); } // cet 2012.820 增加桩号 if(iStakeRow > -1) //桩号 { AcDbObjectId id = m_lstFeedWell[i].m_ID; ads_name entWell; acdbGetAdsName(entWell, id); CString csStake = ReadXdata(entWell, _T("TWT-STAKEVALUE")); ads_polar(ptCellS, m_nLayoutRotation-PI/2, (dStakeRow + nSheetHeight/2) * GetPScale(), ptText); DrawText(ptText, csStake, XExplodeDraw::kMiddleCenter, dc); } // cet 2016.5.11 modify 原计算方法错误 纵断面图-压力流系统 // 1、已知覆土厚度时 埋设深度=覆土厚度+管外径的一半 管中标高=设计地面标高-埋设深度 // 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){// 给水 覆土厚度 // 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/3) * 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/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_lstFeedWell.Length() - 1){ // ads_polar(ptText, m_nLayoutRotation, GetPScale()*2, ptTmpText); // DrawText(ptTmpText, csDownEle, XExplodeDraw::kMiddleRight, dc, PI/2); // } // } // } #if ADS < 18 double dTol = 0.1; for(int j = 0; j < iPre; ++j) { dTol *= 0.1; } #else double dTol = std::pow(0.1, iPre + 1); #endif bool bFlag = (i != 0) && (i != m_lstFeedWell.Length() - 1) && (fabs(m_lstFeedWell[i].m_nFrondDownEle - m_lstFeedWell[i].m_nDownEle) > dTol || fabs((double)(m_lstFeedWell[i - 1].m_iDn - m_lstFeedWell[i + 1].m_iDn)) > dTol); // 埋设深度或覆土厚度是否不相同 if (m_nCalcType == 0) // 已知管中标高 { // 埋深 if(iDeepRow > -1 && m_iCalcMode != 3) { ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nDeepRow + nSheetHeight/3) * GetPScale(), ptText); // 埋设深度=设计地面标高-管中标高 if (i != 0) // 前管埋设深度 { double nDeep2 = m_lstFeedWell[i].m_nUpEle - m_lstFeedWell[i].m_nFrondDownEle; CString csDeep2; csDeep2.Format(sFormat, fabs(nDeep2)); XPoint ptTmpText = ptText; if (i != m_lstFeedWell.Length() - 1 && bFlag) { ads_polar(ptText, m_nLayoutRotation+PI, GetPScale()*2, ptTmpText); } DrawText(ptTmpText, csDeep2, XExplodeDraw::kMiddleRight, dc, PI/2); } if (i != m_lstFeedWell.Length() - 1) // 后管埋设深度 { double nDeep2 = m_lstFeedWell[i].m_nUpEle - m_lstFeedWell[i].m_nDownEle; CString csDeep2; csDeep2.Format(sFormat, fabs(nDeep2)); XPoint ptTmpText = ptText; if (i != 0 && bFlag) { ads_polar(ptText, m_nLayoutRotation, GetPScale() * 2, ptTmpText); } DrawText(ptTmpText, csDeep2, XExplodeDraw::kMiddleRight, dc, PI/2); } } // 覆土厚度 if(iThicknessRow > -1) { ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nThicknessRow + nSheetHeight/3) * GetPScale(), ptText); // 覆土厚度=埋设深度-管外径的一半 if (i != 0) // 前管覆土厚度 { double dFeedDeep = m_lstFeedWell[i].m_nUpEle - m_lstFeedWell[i].m_nFrondDownEle - m_lstFeedWell[i - 1].m_iDn * 0.0005; OPENOBJ_BEGIN(m_lstFeedWell[i - 1].m_ID, AcDb::kForRead, TDbPipe, pPipe); if (pPipe != NULL) { double dOuterDn = pPipe->OuterDn(); if (pPipe->OuterDn() > 0.001) { dFeedDeep = m_lstFeedWell[i].m_nUpEle - m_lstFeedWell[i].m_nFrondDownEle - dOuterDn * 0.0005; } } OPENOBJ_END(); CString csFeedDeep; csFeedDeep.Format(sFormat, dFeedDeep); XPoint ptTmpText = ptText; if (i != m_lstFeedWell.Length() - 1 && bFlag) { ads_polar(ptText, m_nLayoutRotation+PI, GetPScale()*2, ptTmpText); } DrawText(ptTmpText, csFeedDeep, XExplodeDraw::kMiddleRight, dc, PI/2); } if (i != m_lstFeedWell.Length() - 1) // 后管覆土厚度 { double dFeedDeep = m_lstFeedWell[i].m_nUpEle - m_lstFeedWell[i].m_nFrondDownEle - m_lstFeedWell[i + 1].m_iDn * 0.0005; OPENOBJ_BEGIN(m_lstFeedWell[i + 1].m_ID, AcDb::kForRead, TDbPipe, pPipe); if (pPipe != NULL) { double dOuterDn = pPipe->OuterDn(); if (pPipe->OuterDn() > 0.001) { dFeedDeep = m_lstFeedWell[i].m_nUpEle - m_lstFeedWell[i].m_nDownEle - dOuterDn * 0.0005; } } OPENOBJ_END(); CString csFeedDeep; csFeedDeep.Format(sFormat, dFeedDeep); XPoint ptTmpText = ptText; if (i != 0 && bFlag) { ads_polar(ptText, m_nLayoutRotation, GetPScale()*2, ptTmpText); } DrawText(ptTmpText, csFeedDeep, XExplodeDraw::kMiddleRight, dc, PI/2); } } } else // 已知覆土厚度 { // 埋深 if(iDeepRow > -1 && m_iCalcMode != 3) { // 埋设深度=覆土厚度+管外径的一半(管中标高=设计地面标高-埋设深度) ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nDeepRow + nSheetHeight/3) * GetPScale(), ptText); if (i != 0) // 前管埋设深度 { double nDeep2 = m_lstFeedWell[i].m_nUpEle - m_lstFeedWell[i].m_nFrondDownEle; CString csDeep2; csDeep2.Format(sFormat, fabs(nDeep2)); XPoint ptTmpText = ptText; if (i != m_lstFeedWell.Length() - 1 && bFlag) { ads_polar(ptText, m_nLayoutRotation+PI, GetPScale()*2, ptTmpText); } DrawText(ptTmpText, csDeep2, XExplodeDraw::kMiddleRight, dc, PI/2); } if (i != m_lstFeedWell.Length() - 1) // 后管埋设深度 { double nDeep2 = m_lstFeedWell[i].m_nUpEle - m_lstFeedWell[i].m_nDownEle; CString csDeep2; csDeep2.Format(sFormat, fabs(nDeep2)); XPoint ptTmpText = ptText; if (i != 0 && bFlag) { ads_polar(ptText, m_nLayoutRotation, GetPScale()*2, ptTmpText); } DrawText(ptTmpText, csDeep2, XExplodeDraw::kMiddleRight, dc, PI/2); } } // 覆土厚度 if(iThicknessRow > -1) { ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nThicknessRow + nSheetHeight/3) * GetPScale(), ptText); if (i != 0) // 前管覆土厚度 { double dFeedDeep = m_lstFeedWell[i].m_nUpEle - m_lstFeedWell[i].m_nFrondDownEle - m_lstFeedWell[i -1].m_iDn * 0.0005; OPENOBJ_BEGIN(m_lstFeedWell[i - 1].m_ID, AcDb::kForRead, TDbPipe, pPipe); if (pPipe != NULL) { double dOuterDn = pPipe->OuterDn(); if (pPipe->OuterDn() > 0.001) { dFeedDeep = m_lstFeedWell[i].m_nUpEle - m_lstFeedWell[i].m_nFrondDownEle - dOuterDn * 0.0005; } } OPENOBJ_END(); CString csFeedDeep; csFeedDeep.Format(sFormat, dFeedDeep); XPoint ptTmpText = ptText; if (i != m_lstFeedWell.Length() - 1 && bFlag) { ads_polar(ptText, m_nLayoutRotation+PI, GetPScale()*2, ptTmpText); } DrawText(ptTmpText, csFeedDeep, XExplodeDraw::kMiddleRight, dc, PI/2); } if (i != m_lstFeedWell.Length() - 1) // 后管覆土厚度 { double dFeedDeep = m_lstFeedWell[i].m_nUpEle - m_lstFeedWell[i].m_nDownEle - m_lstFeedWell[i + 1].m_iDn * 0.0005; OPENOBJ_BEGIN(m_lstFeedWell[i + 1].m_ID, AcDb::kForRead, TDbPipe, pPipe); if (pPipe != NULL) { double dOuterDn = pPipe->OuterDn(); if (pPipe->OuterDn() > 0.001) { dFeedDeep = dFeedDeep = m_lstFeedWell[i].m_nUpEle - m_lstFeedWell[i].m_nDownEle - dOuterDn * 0.0005; } } OPENOBJ_END(); CString csFeedDeep; csFeedDeep.Format(sFormat, dFeedDeep); XPoint ptTmpText = ptText; if (i != 0 && bFlag) { ads_polar(ptText, m_nLayoutRotation, GetPScale()*2, ptTmpText); } DrawText(ptTmpText, csFeedDeep, XExplodeDraw::kMiddleRight, dc, PI/2); } } } //管内底标高, 或给水的管中标高 if(iDownEleRow > -1) { ads_polar(ptCellS, m_nLayoutRotation-PI/2, (nDownEleRow + nSheetHeight/3) * GetPScale(), ptText); if(csFrontEle == csDownEle || i == 0 || i == m_lstFeedWell.Length() - 1) { DrawText(ptText, i != 0 ? csFrontEle : csDownEle, XExplodeDraw::kMiddleRight, dc, PI/2); } else { XPoint ptTmpText = ptText; ads_polar(ptText, m_nLayoutRotation+PI, GetPScale()*2, ptTmpText); DrawText(ptTmpText, csFrontEle, XExplodeDraw::kMiddleRight, dc, PI/2); 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 -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){ 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;iGetBlock2d(); 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; jGetNode(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; jGetLocation(); 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); // 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(m_ptTopLeft) = ptCivilIns; const_cast(m_ptTolRight) = m_ptTopLeft + vtX * dWidth; const_cast(m_ptBottomLeft) = ptCivilIns - vtY * dHeight; const_cast(m_ptBottomRight) = m_ptBottomLeft + vtX * dWidth; return Acad::eOk; } void TDbVerticalSectionFeed::GetAllPipes(DList &lstAllPipe) const { // cet 2016.7.6 add 纵断面图上的管道 std::set setId; for(int i = 0; i < m_lstFeedWell.Length(); ++i) { setId.insert(m_lstFeedWell[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 TDbVerticalSectionFeed::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); DrawSectionFeed(dc); //给水系统 从左往右 if(!!objectId()) DrawCivilSheetFeed(dc, ptEnd); //给水系统 return Acad::eOk; } void TDbVerticalSectionFeed::Calc() { UpdateHidePipes(); // cet 2017.11.22 add 更新遮挡数据 InitPipeData(); // cet 2016.7.6 add 获得管道信息, m_nMaxDeep = m_lstFeedWell[0]->m_nUpEle; m_nMinDeep = m_lstFeedWell[0]->m_nUpEle; for(int i=0;im_bIsWell){ //井 AcDbObjectId id = m_lstFeedWell[i]->m_ID; double nWellEle = m_lstFeedWell[i]->m_nUpEle; double nWellDownEle = m_lstFeedWell[i]->m_nDownEle; if(nWellDownEle < m_nMinDeep) //找出最小标高 m_nMinDeep = nWellDownEle; if(nWellEle > m_nMaxDeep) //找出最大标高, 绘制Y比例尺 m_nMaxDeep = nWellEle; } else if(!m_lstFeedWell[i]->m_bIsWell){ //管 if(i == m_lstFeedWell.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;im_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 TDbVerticalSectionFeed::Calc() //{ // m_nMaxDeep = m_lstWell[0]->m_nUpEle; // m_nMinDeep = m_lstWell[0]->m_nUpEle; // for(int i=0;im_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;im_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; // } // } // //} BOOL TDbVerticalSectionFeed::GetFeedWellListData(DList &lstWellSys, DList &lstFeedWellSys) { lstFeedWellSys.Reset(); BOOL bRet = TRUE; int len = lstWellSys.Length(); for(int i=0;im_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 TDbVerticalSectionFeed::GetWellDatas(DList& lstWell) const { int nCount = m_lstFeedWell.Length(); for(int i=0; i& lstWell) { assertWriteEnabled(); m_lstFeedWell.Reset(); int nCount = lstWell.Length(); for(int i=0; i& lstWell) const //{ // int nCount = m_lstWell.Length(); // for(int i=0; i& lstWell) //{ // assertWriteEnabled(); // m_lstWell.Reset(); // int nCount = lstWell.Length(); // for(int i=0; i &info) const { info.Append(new TObjInfoUnit(_T("对象类型"), _T("给水纵断面图"))); } inline double TDbVerticalSectionFeed::OuterDn(const AcDbSoftPointerId &idPipe) const { std::map::const_iterator it = m_mapPipeData.find(idPipe.handle()); if (it != m_mapPipeData.end()) { return it->second.dOutDn; } return 0.0; } inline double TDbVerticalSectionFeed::InnerDn(const AcDbSoftPointerId &idPipe) const { std::map::const_iterator it = m_mapPipeData.find(idPipe.handle()); if (it != m_mapPipeData.end()) { return it->second.dInnerDn; } return 0.0; } inline void TDbVerticalSectionFeed::InitPipeData() const { std::map &mapData = const_cast&>(m_mapPipeData); mapData.clear(); for (int i = 0; i < m_lstFeedWell.Length(); ++i) { if (m_lstFeedWell[i].m_bIsWell) // cet 2016.9.23 add { continue; } PIPEDATA data; data.dDn = m_lstFeedWell[i].m_iDn; // cet 2016.9.23 add InitPipeData(m_lstFeedWell[i].m_ID, data); mapData[m_lstFeedWell[i].m_ID.handle()] = data; } } inline void TDbVerticalSectionFeed::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 TDbVerticalSectionFeed::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 TDbVerticalSectionFeed::SetOnlyShowBranch(bool bShow) { assertWriteEnabled(); TEntityFields &fd = Fields(); fd.SFD(_T("ONLY_SHOW_BRANCH"), bShow ? Adesk::kTrue : Adesk::kFalse); } bool TDbVerticalSectionFeed::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 TDbVerticalSectionFeed::SetShowEqualEleBranch(bool bShow) { assertWriteEnabled(); TEntityFields &fd = Fields(); fd.SFD(_T("SHOW_EQUAL_ELEVATION_BRANCH"), bShow ? Adesk::kTrue : Adesk::kFalse); } bool TDbVerticalSectionFeed::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()); } OPENOBJ_END(); } return false; } void TDbVerticalSectionFeed::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); } void TDbVerticalSectionFeed::UpdateHidePipes() { //本图所有管线 DList lstAllPipe; GetAllPipes(lstAllPipe); // 管网中的管道 DList lstPipe; for(int i = 0; i < m_lstFeedWell.Length(); ++i) { if(!m_lstFeedWell[i]->m_bIsWell) { lstPipe.Append(new AcDbObjectId(m_lstFeedWell[i]->m_ID)); } } // 获取所有交叉信息 std::vector vecCrossPoint; CalcCrossPipes(lstPipe, lstAllPipe, vecCrossPoint, true); // 清除管道遮挡信息,避免出错 ClearHidePipes(); // 添加遮挡管道信息 TEntityFields &fd = Fields(); if (fd.SFD(_T("HidePipesNum"), (Adesk::UInt16)vecCrossPoint.size())) { std::vector::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 TDbVerticalSectionFeed::GetFillingPattern() const { const TEntityFields &fd = GetFields(); CString sPattern = _T("AR-HBONE"); fd.GFD(_T("FILLING_PATTERN"), sPattern); return sPattern; } void TDbVerticalSectionFeed::SetFillingPattern(const CString &sPattern) { assertWriteEnabled(); TEntityFields &fd = Fields(); fd.SFD(_T("FILLING_PATTERN"), sPattern); } double TDbVerticalSectionFeed::GetFillingRatio() const { const TEntityFields &fd = GetFields(); double dRatio = 0.5; fd.GFD(_T("FILLING_RATIO"), dRatio); return dRatio; } void TDbVerticalSectionFeed::SetFillingRatio(double dRatio) { assertWriteEnabled(); TEntityFields &fd = Fields(); fd.SFD(_T("FILLING_RATIO"), dRatio); } Adesk::UInt16 TDbVerticalSectionFeed::GetFillingColor() const { const TEntityFields &fd = GetFields(); Adesk::UInt16 nColor = 256; fd.GFD(_T("FILLING_COLOR"), nColor); return nColor; } void TDbVerticalSectionFeed::SetFillingColor(Adesk::UInt16 nColor) { assertWriteEnabled(); TEntityFields &fd = Fields(); fd.SFD(_T("FILLING_COLOR"), nColor); } void TDbVerticalSectionFeed::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 TDbVerticalSectionFeed::ClearHidePipes() { TEntityFields &fd = Fields(); Adesk::UInt16 nNum = 0; if (fd.GFD(_T("HidePipesNum"), nNum)) { // 删除遮挡管道数参数 long nIndex = fd.Find(_T("HidePipesNum")); 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); } } } bool TDbVerticalSectionFeed::IsExistHideData() const { assertReadEnabled(); const TEntityFields &fd = GetFields(); Adesk::UInt16 nNum = 0; return fd.GFD(_T("HidePipesNum"), nNum); } void TDbVerticalSectionFeed::GetCrossPointInfo(std::vector &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 // 没有现成数据,计算获得 { TDbVerticalSectionFeed *pVal = const_cast(this); if (pVal != NULL) { pVal->UpdateHidePipes(); } } } void TDbVerticalSectionFeed::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); } bool TDbVerticalSectionFeed::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 TDbVerticalSectionFeed::SetShowPipeEndNotLinkedPipe(bool bShow) { assertWriteEnabled(); TEntityFields &fd = Fields(); fd.SFD(_T("SHOW_PIPEEND_NOTLINKE_PIPE"), bShow ? Adesk::kTrue : Adesk::kFalse); } void IniTDbVerticalSectionFeed(BOOL bTrue) { if(bTrue) { TDbVerticalSectionFeed::rxInit(); TDbVerticalSectionFeed::InitMatchProtocol(TRUE); } else { TDbVerticalSectionFeed::InitMatchProtocol(FALSE); deleteAcRxClass(TDbVerticalSectionFeed::desc()); } }