#include "stdafx.h" #include "OpeningLabelData.h" extern AcDbObjectId GetValidTextStyle(AcDbDatabase *pDb, const TCHAR *pStyle); //类型 static int GetDormerType(TDormerPar::DormerType dormerType) { int nDormerType = 1; switch (dormerType) { case TDormerPar::SLOPE_TRIANGLE: nDormerType = 0; break; case TDormerPar::SLOPE_TWO: nDormerType = 1; break; case TDormerPar::SLOPE_THREE: nDormerType = 2; break; case TDormerPar::SLOPE_TRAPEZIA: nDormerType = 3; break; case TDormerPar::SLOPE_FLAT: nDormerType = 4; break; } return nDormerType; } static TDormerPar::DormerType GetDormerType(int nDormerType) { TDormerPar::DormerType dormerType=TDormerPar::SLOPE_TWO; switch(nDormerType) { case 0: dormerType = TDormerPar::SLOPE_TRIANGLE; break; case 1: dormerType = TDormerPar::SLOPE_TWO; break; case 2: dormerType = TDormerPar::SLOPE_THREE; break; case 3: dormerType = TDormerPar::SLOPE_TRAPEZIA; break; case 4: dormerType = TDormerPar::SLOPE_FLAT; break; } return dormerType; } static void DrawMesh(const XPoint& pt1, const XPoint& pt2, const XPoint& pt3, const XPoint& pt4, XExplodeDraw &dc) { Adesk::UInt32 nRows=2; Adesk::UInt32 nCols=2; AcGePoint3d *pVert=new AcGePoint3d[nRows*nCols]; pVert[0]=pt1; pVert[1]=pt2; pVert[2]=pt3; pVert[3]=pt4; dc.DrawMesh(nRows,nCols,pVert); delete [] pVert; } static void DrawMesh(const XPoint& pt1, const XPoint& pt2, const XPoint& pt3, const XPoint& pt4, const XPoint& pt5, const XPoint& pt6, XExplodeDraw &dc) { Adesk::UInt32 nRows=3; Adesk::UInt32 nCols=2; AcGePoint3d *pVert=new AcGePoint3d[nRows*nCols]; pVert[0]=pt1; pVert[1]=pt2; pVert[2]=pt3; pVert[3]=pt4; pVert[4]=pt5; pVert[5]=pt6; dc.DrawMesh(nRows,nCols,pVert); delete [] pVert; } static void DrawMesh(const XPoint& pt1, const XPoint& pt2, const XPoint& pt3, const XPoint& pt4, const XPoint& pt5, const XPoint& pt6, const XPoint& pt7, const XPoint& pt8, XExplodeDraw &dc) { Adesk::UInt32 nRows=4; Adesk::UInt32 nCols=2; AcGePoint3d *pVert=new AcGePoint3d[nRows*nCols]; pVert[0]=pt1; pVert[1]=pt2; pVert[2]=pt3; pVert[3]=pt4; pVert[4]=pt5; pVert[5]=pt6; pVert[6]=pt7; pVert[7]=pt8; dc.DrawMesh(nRows,nCols,pVert); delete [] pVert; } static void DrawMesh(const XPoint& pt1, const XPoint& pt2, const XPoint& pt3, const XPoint& pt4, const XPoint& pt5, const XPoint& pt6, const XPoint& pt7, const XPoint& pt8, const XPoint& pt9, const XPoint& pt10, XExplodeDraw &dc) { Adesk::UInt32 nRows=5; Adesk::UInt32 nCols=2; AcGePoint3d *pVert=new AcGePoint3d[nRows*nCols]; pVert[0]=pt1; pVert[1]=pt2; pVert[2]=pt3; pVert[3]=pt4; pVert[4]=pt5; pVert[5]=pt6; pVert[6]=pt7; pVert[7]=pt8; pVert[8]=pt9; pVert[9]=pt10; dc.DrawMesh(nRows,nCols,pVert); delete [] pVert; } static void DrawMesh(const XPoint& pt1, const XPoint& pt2, const XPoint& pt3, const XPoint& pt4, const XPoint& pt5, const XPoint& pt6, const XPoint& pt7, const XPoint& pt8, const XPoint& pt9, const XPoint& pt10, const XPoint& pt11, const XPoint& pt12, XExplodeDraw &dc) { Adesk::UInt32 nRows=6; Adesk::UInt32 nCols=2; AcGePoint3d *pVert=new AcGePoint3d[nRows*nCols]; pVert[0]=pt1; pVert[1]=pt2; pVert[2]=pt3; pVert[3]=pt4; pVert[4]=pt5; pVert[5]=pt6; pVert[6]=pt7; pVert[7]=pt8; pVert[8]=pt9; pVert[9]=pt10; pVert[10]=pt11; pVert[11]=pt12; dc.DrawMesh(nRows,nCols,pVert); delete [] pVert; } static void DrawMesh(const XPoint& pt1, const XPoint& pt2, const XPoint& pt3, const XPoint& pt4, const XPoint& pt5, const XPoint& pt6, const XPoint& pt7, const XPoint& pt8, const XPoint& pt9, const XPoint& pt10, const XPoint& pt11, const XPoint& pt12, const XPoint& pt13, const XPoint& pt14, XExplodeDraw &dc) { Adesk::UInt32 nRows=7; Adesk::UInt32 nCols=2; AcGePoint3d *pVert=new AcGePoint3d[nRows*nCols]; pVert[0]=pt1; pVert[1]=pt2; pVert[2]=pt3; pVert[3]=pt4; pVert[4]=pt5; pVert[5]=pt6; pVert[6]=pt7; pVert[7]=pt8; pVert[8]=pt9; pVert[9]=pt10; pVert[10]=pt11; pVert[11]=pt12; pVert[12]=pt13; pVert[13]=pt14; dc.DrawMesh(nRows,nCols,pVert); delete [] pVert; } static void DrawMesh(const XPoint& pt1, const XPoint& pt2, const XPoint& pt3, const XPoint& pt4, const XPoint& pt5, const XPoint& pt6, const XPoint& pt7, const XPoint& pt8, const XPoint& pt9, const XPoint& pt10, const XPoint& pt11, const XPoint& pt12, const XPoint& pt13, const XPoint& pt14, const XPoint& pt15, const XPoint& pt16, const XPoint& pt17, const XPoint& pt18, XExplodeDraw &dc) { Adesk::UInt32 nRows=9; Adesk::UInt32 nCols=2; AcGePoint3d *pVert=new AcGePoint3d[nRows*nCols]; pVert[0]=pt1; pVert[1]=pt2; pVert[2]=pt3; pVert[3]=pt4; pVert[4]=pt5; pVert[5]=pt6; pVert[6]=pt7; pVert[7]=pt8; pVert[8]=pt9; pVert[9]=pt10; pVert[10]=pt11; pVert[11]=pt12; pVert[12]=pt13; pVert[13]=pt14; pVert[14]=pt15; pVert[15]=pt16; pVert[16]=pt17; pVert[17]=pt18; dc.DrawMesh(nRows,nCols,pVert); delete [] pVert; } static void DrawShell(const XPoint& pt1, const XPoint& pt2, const XPoint& pt3, XExplodeDraw &dc) { Adesk::UInt32 nVert=3; AcGePoint3d *pVert=new AcGePoint3d[nVert]; pVert[0]=pt1; pVert[1]=pt2; pVert[2]=pt3; Adesk::Int32 faceList[]={nVert,0,1,2}; Adesk::UInt32 nFaceListLength=nVert+1; dc.DrawShell(nVert,pVert,nFaceListLength,faceList); delete [] pVert; } static void DrawShell(const XPoint& pt1, const XPoint& pt2, const XPoint& pt3, const XPoint& pt4, XExplodeDraw &dc) { Adesk::UInt32 nVert=4; AcGePoint3d *pVert=new AcGePoint3d[nVert]; pVert[0]=pt1; pVert[1]=pt2; pVert[2]=pt3; pVert[3]=pt4; Adesk::Int32 faceList[]={nVert,0,1,2,3}; Adesk::UInt32 nFaceListLength=nVert+1; dc.DrawShell(nVert,pVert,nFaceListLength,faceList); delete [] pVert; } static void DrawShell(const XPoint& pt1, const XPoint& pt2, const XPoint& pt3, const XPoint& pt4, const XPoint& pt5, XExplodeDraw &dc) { Adesk::UInt32 nVert=5; AcGePoint3d *pVert=new AcGePoint3d[nVert]; pVert[0]=pt1; pVert[1]=pt2; pVert[2]=pt3; pVert[3]=pt4; pVert[4]=pt5; Adesk::Int32 faceList[]={nVert,0,1,2,3,4}; Adesk::UInt32 nFaceListLength=nVert+1; dc.DrawShell(nVert,pVert,nFaceListLength,faceList); delete [] pVert; } static void DrawShell(const XPoint& pt1, const XPoint& pt2, const XPoint& pt3, const XPoint& pt4, const XPoint& pt5, const XPoint& pt6, XExplodeDraw &dc) { Adesk::UInt32 nVert=6; AcGePoint3d *pVert=new AcGePoint3d[nVert]; pVert[0]=pt1; pVert[1]=pt2; pVert[2]=pt3; pVert[3]=pt4; pVert[4]=pt5; pVert[5]=pt6; Adesk::Int32 faceList[]={nVert,0,1,2,3,4,5}; Adesk::UInt32 nFaceListLength=nVert+1; dc.DrawShell(nVert,pVert,nFaceListLength,faceList); delete [] pVert; } static void DrawShell(const XPoint& pt1, const XPoint& pt2, const XPoint& pt3, const XPoint& pt4, const XPoint& pt5, const XPoint& pt6, const XPoint& pt7, const XPoint& pt8, XExplodeDraw &dc) { Adesk::UInt32 nVert=8; AcGePoint3d *pVert=new AcGePoint3d[nVert]; pVert[0]=pt1; pVert[1]=pt2; pVert[2]=pt3; pVert[3]=pt4; pVert[4]=pt5; pVert[5]=pt6; pVert[6]=pt7; pVert[7]=pt8; Adesk::Int32 faceList[]={nVert,0,1,2,3,4,5,6,7}; Adesk::UInt32 nFaceListLength=nVert+1; dc.DrawShell(nVert,pVert,nFaceListLength,faceList); delete [] pVert; } static void DrawShell(const XPoint& pt1, const XPoint& pt2, const XPoint& pt3, const XPoint& pt4, const XPoint& pt5, const XPoint& pt6, const XPoint& pt7, const XPoint& pt8, const XPoint& pt9, const XPoint& pt10, XExplodeDraw &dc) { Adesk::UInt32 nVert=10; AcGePoint3d *pVert=new AcGePoint3d[nVert]; pVert[0]=pt1; pVert[1]=pt2; pVert[2]=pt3; pVert[3]=pt4; pVert[4]=pt5; pVert[5]=pt6; pVert[6]=pt7; pVert[7]=pt8; pVert[8]=pt9; pVert[9]=pt10; Adesk::Int32 faceList[]={nVert,0,1,2,3,4,5,6,7,8,9}; Adesk::UInt32 nFaceListLength=nVert+1; dc.DrawShell(nVert,pVert,nFaceListLength,faceList); delete [] pVert; } static void DrawShell(const XPoint& ptOut1, const XPoint& ptOut2, const XPoint& ptOut3, XExplodeDraw &dc, const XPoint& ptIn1, const XPoint& ptIn2, const XPoint& ptIn3) { Adesk::UInt32 nVert=6; AcGePoint3d *pVert=new AcGePoint3d[nVert]; pVert[0]=ptOut1; pVert[1]=ptOut2; pVert[2]=ptOut3; pVert[3]=ptIn1; pVert[4]=ptIn2; pVert[5]=ptIn3; Adesk::Int32 faceList[]={3,0,1,2,-3,3,4,5}; Adesk::UInt32 nFaceListLength=nVert+2; dc.DrawShell(nVert,pVert,nFaceListLength,faceList); delete [] pVert; } static void DrawShell(const XPoint& ptOut1, const XPoint& ptOut2, const XPoint& ptOut3, const XPoint& ptOut4, XExplodeDraw &dc, const XPoint& ptIn1, const XPoint& ptIn2, const XPoint& ptIn3, const XPoint& ptIn4) { Adesk::UInt32 nVert=8; AcGePoint3d *pVert=new AcGePoint3d[nVert]; pVert[0]=ptOut1; pVert[1]=ptOut2; pVert[2]=ptOut3; pVert[3]=ptOut4; pVert[4]=ptIn1; pVert[5]=ptIn2; pVert[6]=ptIn3; pVert[7]=ptIn4; Adesk::Int32 faceList[]={4,0,1,2,3,-4,4,5,6,7}; Adesk::UInt32 nFaceListLength=nVert+2; dc.DrawShell(nVert,pVert,nFaceListLength,faceList); delete [] pVert; } static void DrawShell(const XPoint& ptOut1, const XPoint& ptOut2, const XPoint& ptOut3, const XPoint& ptOut4, const XPoint& ptOut5, XExplodeDraw &dc, const XPoint& ptIn1, const XPoint& ptIn2, const XPoint& ptIn3, const XPoint& ptIn4, const XPoint& ptIn5) { Adesk::UInt32 nVert=10; AcGePoint3d *pVert=new AcGePoint3d[nVert]; pVert[0]=ptOut1; pVert[1]=ptOut2; pVert[2]=ptOut3; pVert[3]=ptOut4; pVert[4]=ptOut5; pVert[5]=ptIn1; pVert[6]=ptIn2; pVert[7]=ptIn3; pVert[8]=ptIn4; pVert[9]=ptIn5; Adesk::Int32 faceList[]={5,0,1,2,3,4,-5,5,6,7,8,9}; Adesk::UInt32 nFaceListLength=nVert+2; dc.DrawShell(nVert,pVert,nFaceListLength,faceList); delete [] pVert; } static void DrawShell(const XPoint& ptOut1, const XPoint& ptOut2, const XPoint& ptOut3, const XPoint& ptOut4, const XPoint& ptOut5, const XPoint& ptOut6, XExplodeDraw &dc, const XPoint& ptIn1, const XPoint& ptIn2, const XPoint& ptIn3, const XPoint& ptIn4, const XPoint& ptIn5, const XPoint& ptIn6) { Adesk::UInt32 nVert=12; AcGePoint3d *pVert=new AcGePoint3d[nVert]; pVert[0]=ptOut1; pVert[1]=ptOut2; pVert[2]=ptOut3; pVert[3]=ptOut4; pVert[4]=ptOut5; pVert[5]=ptOut6; pVert[6]=ptIn1; pVert[7]=ptIn2; pVert[8]=ptIn3; pVert[9]=ptIn4; pVert[10]=ptIn5; pVert[11]=ptIn6; Adesk::Int32 faceList[]={6,0,1,2,3,4,5,-6,6,7,8,9,10,11}; Adesk::UInt32 nFaceListLength=nVert+2; dc.DrawShell(nVert,pVert,nFaceListLength,faceList); delete [] pVert; } ////////////////////////////////////////////////////////////////////////////////////////////// TDormerPar::TDormerPar(): m_dormerType(SLOPE_TWO), m_dWallHeight(_AS_SYS_UNIT(1500)), m_dWallWidth(_AS_SYS_UNIT(1800)), m_dWallThickness(_AS_SYS_UNIT(180)), m_dWindowHeight(_AS_SYS_UNIT(1300)), m_dWindowWidth(_AS_SYS_UNIT(1400)), m_dSlopeGrade(0.5), m_dSlopeHeight(_AS_SYS_UNIT(450)), m_dSlopeThickness(_AS_SYS_UNIT(200)), m_dExtendEaves(_AS_SYS_UNIT(200)), m_dExtendHill(_AS_SYS_UNIT(200)) { } TDormerPar::~TDormerPar() { } BOOL TDormerPar::IsValid() const { if (m_dWindowHeight > m_dWallHeight) return FALSE; if (m_dWindowWidth > m_dWallWidth-2*m_dWallThickness) return FALSE; return TRUE; } //类型 void TDormerPar::SetDormerType(DormerType dormerType) { m_dormerType = dormerType; } TDormerPar::DormerType TDormerPar::GetDormerType() const { return m_dormerType; } //墙 void TDormerPar::SetWallHeight(double dHeight) { m_dWallHeight = dHeight; } void TDormerPar::SetWallWidth(double dWidth) { m_dWallWidth = dWidth; } void TDormerPar::SetWallThickness(double dThickness) { m_dWallThickness = dThickness; } double TDormerPar::GetWallHeight() const { return m_dWallHeight; } double TDormerPar::GetWallWidth() const { return m_dWallWidth; } double TDormerPar::GetWallThickness() const { return m_dWallThickness; } //窗 void TDormerPar::SetWindowHeight(double dHeight) { m_dWindowHeight = dHeight; } void TDormerPar::SetWindowWidth(double dWidth) { m_dWindowWidth = dWidth; } double TDormerPar::GetWindowHeight() const { return m_dWindowHeight; } double TDormerPar::GetWindowWidth() const { return m_dWindowWidth; } //坡 void TDormerPar::SetSlopeGrade(double dGrade) { m_dSlopeGrade = dGrade; } void TDormerPar::SetSlopeHeight(double dHeight) { m_dSlopeHeight = dHeight; } void TDormerPar::SetSlopeThickness(double dThickness) { m_dSlopeThickness = dThickness; } double TDormerPar::GetSlopeGrade() const { return m_dSlopeGrade; } double TDormerPar::GetSlopeHeight() const { return m_dSlopeHeight; } double TDormerPar::GetSlopeThickness() const { return m_dSlopeThickness; } //伸出长度 void TDormerPar::SetExtendEaves(double dEaves) { m_dExtendEaves = dEaves; } void TDormerPar::SetExtendHill(double dHill) { m_dExtendHill = dHill; } double TDormerPar::GetExtendEaves() const { return m_dExtendEaves; } double TDormerPar::GetExtendHill() const { return m_dExtendHill; } ////////////////////////////////////////////////////////////////////////////////////// TDormerLayer::TDormerLayer() { } TDormerLayer::~TDormerLayer() { } void TDormerLayer::InitDefaults() { m_id3DRoof = InitLayer(LAY_ROOF, FALSE); //m_id3DFloor = InitLayer(LAY_FLOOR,FALSE); m_id3DWall = InitLayer(LAY_WALL,FALSE); //m_id3DEaves = InitLayer(_T("3D_EAVES"),FALSE); m_id3DGlass = InitLayer(LAY_3DGLASS,FALSE); m_id3DWindow = InitLayer(LAY_3DFRAME); } //图层 void TDormerLayer::SetRoof(AcDbObjectId idLayer) { m_id3DRoof = idLayer; } void TDormerLayer::SetFloor(AcDbObjectId idLayer) { m_id3DFloor = idLayer; } void TDormerLayer::SetWall(AcDbObjectId idLayer) { m_id3DWall = idLayer; } void TDormerLayer::SetEaves(AcDbObjectId idLayer) { m_id3DEaves = idLayer; } void TDormerLayer::SetGlass(AcDbObjectId idLayer) { m_id3DGlass = idLayer; } void TDormerLayer::SetWindow(AcDbObjectId idLayer) { m_id3DWindow = idLayer; } AcDbObjectId TDormerLayer::GetRoofId() const { return m_id3DRoof; } AcDbObjectId TDormerLayer::GetFloorId() const { return m_id3DFloor; } AcDbObjectId TDormerLayer::GetWallId() const { return m_id3DWall; } AcDbObjectId TDormerLayer::GetEavesId() const { return m_id3DEaves; } AcDbObjectId TDormerLayer::GetGlassId() const { return m_id3DGlass; } AcDbObjectId TDormerLayer::GetWindowId() const { return m_id3DWindow; } void TDormerLayer::SetRoof(const TCHAR * sName) { m_id3DRoof = LayerString2Id(sName); } void TDormerLayer::SetFloor(const TCHAR * sName) { m_id3DFloor = LayerString2Id(sName); } void TDormerLayer::SetWall(const TCHAR * sName) { m_id3DWall = LayerString2Id(sName); } void TDormerLayer::SetEaves(const TCHAR * sName) { m_id3DEaves = LayerString2Id(sName); } void TDormerLayer::SetGlass(const TCHAR * sName) { m_id3DGlass = LayerString2Id(sName); } void TDormerLayer::SetWindow(const TCHAR * sName) { m_id3DWindow = LayerString2Id(sName); } XString TDormerLayer::GetRoofName() const { return LayerId2String(m_id3DRoof); } XString TDormerLayer::GetFloorName() const { return LayerId2String(m_id3DFloor); } XString TDormerLayer::GetWallName() const { return LayerId2String(m_id3DWall); } XString TDormerLayer::GetEavesName() const { return LayerId2String(m_id3DEaves); } XString TDormerLayer::GetGlassName() const { return LayerId2String(m_id3DGlass); } XString TDormerLayer::GetWindowName() const { return LayerId2String(m_id3DWindow); } ////////////////////////////////////////////////////////////////////////////////////// // ver:1-T6Beta1;2-T6Beta2 const Adesk::UInt8 TDbDormer::g_nVersion = 2; ACRX_DXF_DEFINE_MEMBERS(ATSDormer, ATSEntity, AcDb::kDHL_CURRENT, AcDb::kMReleaseCurrent, 1, ATS_DORMER, "ATS_DORMER图形无法解析, 请下载上华软件|网址: www.shanghuasoft.com"); IMPLEMENT_TENTBASE(TDbDormer); TDbDormer::TDbDormer(): m_vtDormerDir(0,1,1), m_bShowWindow(TRUE), m_nTextHeight(3.5) { } TDbDormer::~TDbDormer() { } //基点、角度 void TDbDormer::SetDormerBase(XPoint ptBase) { assertWriteEnabled(); m_ptDormerBase = ptBase; } void TDbDormer::SetDormerDir(XVector3D vtDormerDir) { assertWriteEnabled(); m_vtDormerDir = vtDormerDir; } XPoint TDbDormer::GetDormerBase() const { assertReadEnabled(); return m_ptDormerBase; } XVector3D TDbDormer::GetDormerDir() const { assertReadEnabled(); return m_vtDormerDir; } //老虎窗参数 const TDormerPar & TDbDormer::GetDormerPar() const { assertReadEnabled(); return m_dormerPar; } void TDbDormer::SetDormerPar(const TDormerPar& dormerPar) { assertWriteEnabled(); m_dormerPar = dormerPar; } const TDormerLayer & TDbDormer::GetDormerLayer() const { assertReadEnabled(); return m_dormerLayer; } void TDbDormer::SetDormerLayer(const TDormerLayer& dormerLayer) { assertWriteEnabled(); m_dormerLayer = dormerLayer; } void TDbDormer::ShowWindow(BOOL bShow) { assertWriteEnabled(); m_bShowWindow = bShow; } BOOL TDbDormer::IsShowWindow() const { assertReadEnabled(); return m_bShowWindow; } XString TDbDormer::GetDormerType() const { XString sDormerType; switch (m_dormerPar.GetDormerType()) { case TDormerPar::SLOPE_TRIANGLE: sDormerType = _T("三角坡"); break; case TDormerPar::SLOPE_TWO: sDormerType = _T("双坡"); break; case TDormerPar::SLOPE_THREE: sDormerType = _T("三坡"); break; case TDormerPar::SLOPE_TRAPEZIA: sDormerType = _T("梯形坡"); break; case TDormerPar::SLOPE_FLAT: sDormerType = _T("平顶窗"); break; } return sDormerType; } BOOL TDbDormer::IsValid() const { if(!TDbEntity::IsValid()) return FALSE; if (fabs(m_vtDormerDir.z)<1.0E-6) return FALSE; if (fabs(m_vtDormerDir.x)<1.0E-6 && fabs(m_vtDormerDir.y)<1.0E-6) return FALSE; if (!m_dormerPar.IsValid()) return FALSE; return TRUE; } // 提供对格式刷的支持 void TDbDormer::CopyPropertiesFrom(AcDbEntity *pSrcEntity, unsigned gMatchFlag) { assertWriteEnabled(); TDbEntity::CopyPropertiesFrom(pSrcEntity, gMatchFlag); TDbDormer *pSrc=TDbDormer::cast(pSrcEntity); if(pSrc) { m_dormerLayer=pSrc->m_dormerLayer; m_bShowWindow=pSrc->m_bShowWindow; TDormerPar::DormerType tp=pSrc->m_dormerPar.GetDormerType(); m_dormerPar=pSrc->m_dormerPar; m_dormerPar.SetDormerType(tp); //老虎窗类型不刷 if(database()==NULL|| pSrcEntity->database()==NULL|| database()==pSrcEntity->database())//add by whl on 060317 { m_idTextStyle=pSrc->m_idTextStyle; m_idLayerText=pSrc->m_idLayerText; } m_nTextHeight=pSrc->m_nTextHeight; } } Acad::ErrorStatus TDbDormer::subGetClassID(CLSID* pClsid) const { return Acad::eOk; //return TDbEntity::getClassID(pClsid); } // 从DWG读入数据: Acad::ErrorStatus TDbDormer::dwgInFields (AcDbDwgFiler* pFiler) { assertWriteEnabled(); Acad::ErrorStatus es = Acad::eOk; es = TDbEntity::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; } //图层 AcDbHardPointerId idTemp; pFiler->readItem(&idTemp); m_dormerLayer.SetRoof(idTemp); pFiler->readItem(&idTemp); m_dormerLayer.SetFloor(idTemp); pFiler->readItem(&idTemp); m_dormerLayer.SetWall(idTemp); pFiler->readItem(&idTemp); m_dormerLayer.SetEaves(idTemp); pFiler->readItem(&idTemp); m_dormerLayer.SetGlass(idTemp); pFiler->readItem(&idTemp); m_dormerLayer.SetWindow(idTemp); //老虎窗参数 Adesk::UInt16 nTemp=1; double dTemp=0; pFiler->readItem(&nTemp); m_dormerPar.SetDormerType(::GetDormerType(nTemp)); pFiler->readItem(&dTemp); m_dormerPar.SetExtendEaves(dTemp); pFiler->readItem(&dTemp); m_dormerPar.SetExtendHill(dTemp); pFiler->readItem(&dTemp); m_dormerPar.SetSlopeGrade(dTemp); pFiler->readItem(&dTemp); m_dormerPar.SetSlopeHeight(dTemp); pFiler->readItem(&dTemp); m_dormerPar.SetSlopeThickness(dTemp); pFiler->readItem(&dTemp); m_dormerPar.SetWallHeight(dTemp); pFiler->readItem(&dTemp); m_dormerPar.SetWallThickness(dTemp); pFiler->readItem(&dTemp); m_dormerPar.SetWallWidth(dTemp); pFiler->readItem(&dTemp); m_dormerPar.SetWindowHeight(dTemp); pFiler->readItem(&dTemp); m_dormerPar.SetWindowWidth(dTemp); //其他 pFiler->readItem(&(AcGePoint3d &)m_ptDormerBase); pFiler->readItem(&(AcGeVector3d &)m_vtDormerDir); pFiler->readItem(&m_bShowWindow); if(nVer>1) { pFiler->readItem(&m_idTextStyle); pFiler->readItem(&m_idLayerText); pFiler->readItem(&m_nTextHeight); ReadString(pFiler, m_sLabel); pFiler->readItem(&(AcGePoint2d &)m_ptLabel); } else { if(database()==acdbCurDwg()) { m_idTextStyle = InitTextStyle(TS_WINDOW); m_idLayerText = InitLayer(LAY_OPENING_DIM, FALSE); } else { m_idTextStyle = GetValidTextStyle(database(), _T("_TCH_WINDOW")); m_idLayerText = GetLayerIdFromString(LAY_OPENING_DIM, database()); } m_ptLabel=GetDefaultLabPos(); } return pFiler->filerStatus(); } Acad::ErrorStatus TDbDormer::dwgOutFields(AcDbDwgFiler* pFiler) const { assertReadEnabled(); Acad::ErrorStatus es = Acad::eOk; if (!IsValid()) return Acad::eInvalidInput; es = TDbEntity::dwgOutFields(pFiler); if(es != Acad::eOk) return es; pFiler->writeItem(g_nVersion); //图层 pFiler->writeItem(AcDbHardPointerId(m_dormerLayer.GetRoofId())); pFiler->writeItem(AcDbHardPointerId(m_dormerLayer.GetFloorId())); pFiler->writeItem(AcDbHardPointerId(m_dormerLayer.GetWallId())); pFiler->writeItem(AcDbHardPointerId(m_dormerLayer.GetEavesId())); pFiler->writeItem(AcDbHardPointerId(m_dormerLayer.GetGlassId())); pFiler->writeItem(AcDbHardPointerId(m_dormerLayer.GetWindowId())); //老虎窗参数 Adesk::UInt16 nTemp=::GetDormerType(m_dormerPar.GetDormerType()); pFiler->writeItem(nTemp); pFiler->writeItem(m_dormerPar.GetExtendEaves()); pFiler->writeItem(m_dormerPar.GetExtendHill()); pFiler->writeItem(m_dormerPar.GetSlopeGrade()); pFiler->writeItem(m_dormerPar.GetSlopeHeight()); pFiler->writeItem(m_dormerPar.GetSlopeThickness()); pFiler->writeItem(m_dormerPar.GetWallHeight()); pFiler->writeItem(m_dormerPar.GetWallThickness()); pFiler->writeItem(m_dormerPar.GetWallWidth()); pFiler->writeItem(m_dormerPar.GetWindowHeight()); pFiler->writeItem(m_dormerPar.GetWindowWidth()); //其他 pFiler->writeItem((AcGePoint3d &)m_ptDormerBase); pFiler->writeItem((AcGeVector3d &)m_vtDormerDir); pFiler->writeItem(m_bShowWindow); pFiler->writeItem(m_idTextStyle); pFiler->writeItem(m_idLayerText); pFiler->writeItem(m_nTextHeight); pFiler->writeString(m_sLabel); pFiler->writeItem((const AcGePoint2d &)m_ptLabel); return pFiler->filerStatus(); } // 没有做数据检查 Acad::ErrorStatus TDbDormer::dxfInFields (AcDbDxfFiler* pFiler) { assertWriteEnabled(); Acad::ErrorStatus es = Acad::eOk; es = TDbEntity::dxfInFields(pFiler); if(es!=Acad::eOk) return es; if (!pFiler->atSubclassData(_T("TDbDormer"))) { return Acad::eBadDxfSequence; } resbuf rb; Adesk::UInt16 nTemp=1; AcDbHardPointerId idTemp; double dTemp=0; while ((es == Acad::eOk) && ((es = pFiler->readResBuf(&rb)) == Acad::eOk)) { switch (rb.restype) { case 302: m_sLabel=rb.resval.rstring; free(rb.resval.rstring); break; case AcDb::kDxfXCoord: m_ptDormerBase=rb.resval.rpoint; break; case 11: m_ptLabel=rb.resval.rpoint; break; case 7: { XString sName; sName=rb.resval.rstring; free(rb.resval.rstring); m_idTextStyle=TchExport::GetTextStyleId(sName, database()); if(!m_idTextStyle) { XString style; if(database()) m_idTextStyle=database()->textstyle(); else { xg_getvar(_T("TEXTSTYLE"), style); m_idTextStyle = TchExport::GetTextStyleId(style, database()); } } } break; case 40: m_nTextHeight=rb.resval.rreal; break; case 50: m_vtDormerDir.x=cos(rb.resval.rreal); m_vtDormerDir.y=sin(rb.resval.rreal); m_vtDormerDir.z=0.0; break; case AcDb::kDxfInt16: nTemp=rb.resval.rint; m_dormerPar.SetDormerType(::GetDormerType(nTemp)); break; case 71: m_bShowWindow=rb.resval.rint; break; case 140: dTemp=rb.resval.rreal; m_dormerPar.SetExtendEaves(dTemp); break; case 141: dTemp=rb.resval.rreal; m_dormerPar.SetExtendHill(dTemp); break; case 142: dTemp=rb.resval.rreal; m_dormerPar.SetSlopeGrade(dTemp); break; case 143: dTemp=rb.resval.rreal; m_dormerPar.SetSlopeHeight(dTemp); break; case 144: dTemp=rb.resval.rreal; m_dormerPar.SetSlopeThickness(dTemp); break; case 145: dTemp=rb.resval.rreal; m_dormerPar.SetWallHeight(dTemp); break; case 146: dTemp=rb.resval.rreal; m_dormerPar.SetWallThickness(dTemp); break; case 147: dTemp=rb.resval.rreal; m_dormerPar.SetWallWidth(dTemp); break; case 148: dTemp=rb.resval.rreal; m_dormerPar.SetWindowHeight(dTemp); break; case 149: dTemp=rb.resval.rreal; m_dormerPar.SetWindowWidth(dTemp); break; case 410: m_idLayerText=LayerString2Id(rb.resval.rstring, database()); free(rb.resval.rstring); break; case 411: m_dormerLayer.SetGlass(LayerString2Id(rb.resval.rstring, database())); free(rb.resval.rstring); break; case 412: m_dormerLayer.SetWindow(LayerString2Id(rb.resval.rstring, database())); free(rb.resval.rstring); break; case 413: m_dormerLayer.SetEaves(LayerString2Id(rb.resval.rstring, database())); free(rb.resval.rstring); break; case 414: m_dormerLayer.SetRoof(LayerString2Id(rb.resval.rstring, database())); free(rb.resval.rstring); break; case 415: m_dormerLayer.SetFloor(LayerString2Id(rb.resval.rstring, database())); free(rb.resval.rstring); break; case 416: m_dormerLayer.SetWall(LayerString2Id(rb.resval.rstring, database())); free(rb.resval.rstring); break; default: pFiler->pushBackItem(); es = Acad::eEndOfFile; break; } } if (es != Acad::eEndOfFile) return Acad::eInvalidResBuf; return pFiler->filerStatus(); } Acad::ErrorStatus TDbDormer::dxfOutFields(AcDbDxfFiler* pFiler) const { assertReadEnabled(); Acad::ErrorStatus es = Acad::eOk; if (!IsValid()) return Acad::eInvalidInput; es = TDbEntity::dxfOutFields(pFiler); assert(es == Acad::eOk); es = pFiler->writeItem(AcDb::kDxfSubclass,_T("TDbDormer")); assert(es == Acad::eOk); pFiler->writeString(302, m_sLabel); pFiler->writePoint3d(AcDb::kDxfXCoord, m_ptDormerBase); pFiler->writePoint2d(AcDb::kDxfXCoord+1, m_ptLabel); pFiler->writeString(7, (const TCHAR *)GetSymbolName(m_idTextStyle)); pFiler->writeDouble(40, m_nTextHeight); pFiler->writeDouble(50, ads_angle(XPoint(),m_vtDormerDir)); Adesk::UInt16 nTemp=::GetDormerType(m_dormerPar.GetDormerType()); pFiler->writeInt16(AcDb::kDxfInt16, nTemp); pFiler->writeInt16(71, (Adesk::UInt16)m_bShowWindow); pFiler->writeDouble(140,m_dormerPar.GetExtendEaves()); pFiler->writeDouble(141,m_dormerPar.GetExtendHill()); pFiler->writeDouble(142,m_dormerPar.GetSlopeGrade()); pFiler->writeDouble(143,m_dormerPar.GetSlopeHeight()); pFiler->writeDouble(144,m_dormerPar.GetSlopeThickness()); pFiler->writeDouble(145,m_dormerPar.GetWallHeight()); pFiler->writeDouble(146,m_dormerPar.GetWallThickness()); pFiler->writeDouble(147,m_dormerPar.GetWallWidth()); pFiler->writeDouble(148,m_dormerPar.GetWindowHeight()); pFiler->writeDouble(149,m_dormerPar.GetWindowWidth()); pFiler->writeString(410, (const TCHAR *)LayerId2String(m_idLayerText)); pFiler->writeString(411, (const TCHAR *)LayerId2String(m_dormerLayer.GetGlassId())); pFiler->writeString(412, (const TCHAR *)LayerId2String(m_dormerLayer.GetWindowId())); pFiler->writeString(413, (const TCHAR *)LayerId2String(m_dormerLayer.GetEavesId())); pFiler->writeString(414, (const TCHAR *)LayerId2String(m_dormerLayer.GetRoofId())); pFiler->writeString(415, (const TCHAR *)LayerId2String(m_dormerLayer.GetFloorId())); pFiler->writeString(416, (const TCHAR *)LayerId2String(m_dormerLayer.GetWallId())); return pFiler->filerStatus(); } Acad::ErrorStatus TDbDormer::subGetOsnapPoints(AcDb::OsnapMode osnapMode, INT_PTR gsSelectionMark, const AcGePoint3d& ptPick, const AcGePoint3d& lastPoint, const AcGeMatrix3d& viewXform, AcGePoint3dArray& snapPoints, AcDbIntArray& geomIds) const { if(osnapMode==AcDb::kOsModeIns) { snapPoints.append(GetDormerBase().AsAcGePoint3d()); return Acad::eOk; } Acad::ErrorStatus es = TDbEntity::subGetOsnapPoints(osnapMode, gsSelectionMark, ptPick, lastPoint, viewXform, snapPoints, geomIds); return es; } Acad::ErrorStatus TDbDormer::subGetGripPoints(AcGePoint3dArray& gripPoints, AcDbIntArray& osnapModes, AcDbIntArray& geomIds) const { gripPoints.append(m_ptDormerBase.AsAcGePoint3d());//插入点 gripPoints.append(m_ptLabel); return Acad::eOk; } Acad::ErrorStatus TDbDormer::subMoveGripPointsAt(const AcDbIntArray& indices, const AcGeVector3d& offset) { for (int i = 0; i < indices.length(); i++) { int idx = indices[i]; switch(idx) { case 0: { //用户选择的点 AcGePoint3d ptNewBase = m_ptDormerBase; ptNewBase += offset; //屋顶平面 AcGeVector3d vtDormerDir = m_vtDormerDir; AcGePlane planeTemp(m_ptDormerBase,vtDormerDir); AcGePlane planeXY(AcGePoint3d(0,0,0),AcGeVector3d(0,0,1)); AcGeLine3d lnIntersect; if (!planeTemp.intersectWith(planeXY,lnIntersect)) return Acad::eNotApplicable; AcGeVector3d vtTemp = lnIntersect.direction(); AcGeVector3d vtRoofNormal=vtDormerDir.crossProduct(vtTemp); AcGePlane planeRoof(m_ptDormerBase,vtRoofNormal); //用户点在屋顶平面上的投影 AcGeLine3d lnNormal(ptNewBase,AcGeVector3d(0,0,1)); if (!planeRoof.intersectWith(lnNormal,ptNewBase)) return Acad::eNotApplicable; m_ptDormerBase = ptNewBase; } break; case 1: m_ptLabel += XVector3D(offset[0], offset[1]); break; } } return Acad::eOk; } Acad::ErrorStatus TDbDormer::GetGripText(int idx, CString &cs) const { if (idx==0) { cs = _T("改变插入基点"); } else if(idx==1) { cs = _T("改变编号位置"); } else { return Acad::eInvalidIndex; } return Acad::eOk; } Acad::ErrorStatus TDbDormer:: DormerParTransformBy(const AcGeMatrix3d& xform) { double dScale = xform.scale(); if (dScale!=1 && dScale!=0) { m_dormerPar.SetExtendEaves(m_dormerPar.GetExtendEaves() * dScale); m_dormerPar.SetExtendHill(m_dormerPar.GetExtendHill() * dScale); m_dormerPar.SetSlopeHeight(m_dormerPar.GetSlopeHeight() * dScale); m_dormerPar.SetSlopeThickness(m_dormerPar.GetSlopeThickness() * dScale); m_dormerPar.SetWallHeight(m_dormerPar.GetWallHeight() * dScale); m_dormerPar.SetWallThickness(m_dormerPar.GetWallThickness() * dScale); m_dormerPar.SetWallWidth(m_dormerPar.GetWallWidth() *dScale); m_dormerPar.SetWindowWidth(m_dormerPar.GetWindowWidth() * dScale); m_dormerPar.SetWindowHeight(m_dormerPar.GetWindowHeight() * dScale);//add by whl on 071018 } return Acad::eOk; } Acad::ErrorStatus TDbDormer::subTransformBy(const AcGeMatrix3d& xform) { Acad::ErrorStatus es = Acad::eOk; es = TDbEntity::subTransformBy(xform); if (es != Acad::eOk) return es; m_ptDormerBase.TransformBy(xform); AcGeVector3d vtDormerDir = m_vtDormerDir; vtDormerDir.transformBy(xform); vtDormerDir.normalize(); m_vtDormerDir = vtDormerDir; DormerParTransformBy(xform); m_ptLabel.TransformBy(xform); return Acad::eOk; } Acad::ErrorStatus TDbDormer::ExplodeOrDraw2d(XExplodeDraw &dc) const { assertReadEnabled(); if (!IsValid()) return Acad::eNotApplicable; if (m_vtDormerDir.z==0) return Acad::eInvalidInput; //变换矩阵 AcGeVector3d vtDormerDir=m_vtDormerDir; AcGePlane planXY(AcGePoint3d(0,0,0), AcGeVector3d(0,0,1)); double dXYAngle=vtDormerDir.angleOnPlane(planXY)-PI/2; ads_matrix matAds; m_ptDormerBase.GetRotationMatrix(dXYAngle,matAds); AcGeMatrix3d matAcge=AsAcGeMatrix3d(matAds); //角度 double dRoofGrade=fabs(m_vtDormerDir.z)/ sqrt(m_vtDormerDir.x*m_vtDormerDir.x+m_vtDormerDir.y*m_vtDormerDir.y); Acad::ErrorStatus es = Acad::eOk; switch (m_dormerPar.GetDormerType()) { case TDormerPar::SLOPE_TRIANGLE: es = DrawTriangleSlope2D(dc,matAcge,dRoofGrade); break; case TDormerPar::SLOPE_TWO: es = DrawTwoSlope2D(dc,matAcge,dRoofGrade); break; case TDormerPar::SLOPE_THREE: es = DrawThreeSlope2D(dc,matAcge,dRoofGrade); break; case TDormerPar::SLOPE_TRAPEZIA: es = DrawTrapeziaSlope2D(dc,matAcge,dRoofGrade); break; case TDormerPar::SLOPE_FLAT: es = DrawFlatWindow2D(dc,matAcge,dRoofGrade); break; } if(!!m_sLabel||g_bExplodeSubText) { DrawLabel(dc, m_sLabel); } return es; } void TDbDormer::DrawLabel(XExplodeDraw &dc, const TCHAR *szLab) const { if(!szLab || !szLab[0]) return; AcDbObjectId id=m_idTextStyle; if(!id.isValid()) { id=GetTextStyleId(_T("STANDARD"), database()); } ASSERT(id.isValid()); TDbText textLabel; textLabel.setPropertiesFrom(this); if(m_idLayerText.isValid()) textLabel.setLayer(m_idLayerText); //可否设置图层 textLabel.SetStyleId(id); textLabel.SetLocation(XPoint(m_ptLabel.x, m_ptLabel.y)); textLabel.SetAlignment(XExplodeDraw::kMiddleCenter); double nRotLabel=Wcs2Layout(ads_angle(XPoint(),m_vtDormerDir)-PI/2); textLabel.SetRotation(xg_angle(nRotLabel)); textLabel.SetHeight(m_nTextHeight); TCHAR szLabel[256]=_T(""); _tcscpy(szLabel, szLab); TDbConfig *pConfig=GetDwgGlobal(AcDb::kForRead,g_pCurrentDb); if(pConfig && pConfig->IsCapLabel()) _tcsupr(szLabel); if(pConfig) pConfig->close(); textLabel.SetText(szLabel); TPushProperty vProp(&textLabel, dc); if(dc.IsFullExplode()) { textLabel.ExplodeOrDraw2d(dc); } else dc.DrawEntity(textLabel); } XPoint TDbDormer::GetDefaultLabPos() const { ads_real nDistToLocation=m_dormerPar.GetExtendEaves(); double nDist2Wall=GetTextHeight()/2; nDist2Wall += DocGetText2Base(); nDistToLocation += nDist2Wall*GetPScale(); XPoint ptLab; ads_polar(m_ptDormerBase, ads_angle(XPoint(),m_vtDormerDir)+PI, nDistToLocation, ptLab); ptLab.z = 0; return ptLab; } const TCHAR *TDbDormer::GetDefaultLayer() const { return LAY_ROOF; } // 绘制3d的显示 Acad::ErrorStatus TDbDormer::ExplodeOrDraw3d(XExplodeDraw &dc) const { assertReadEnabled(); if (!IsValid()) return Acad::eNotApplicable; if (m_vtDormerDir.z==0) return Acad::eInvalidInput; //变换矩阵 AcGeVector3d vtDormerDir=m_vtDormerDir; AcGePlane planXY(AcGePoint3d(0,0,0), AcGeVector3d(0,0,1)); double dXYAngle=vtDormerDir.angleOnPlane(planXY)-PI/2; ads_matrix matAds; m_ptDormerBase.GetRotationMatrix(dXYAngle,matAds); AcGeMatrix3d matAcge=AsAcGeMatrix3d(matAds); //角度 double dRoofGrade=fabs(m_vtDormerDir.z)/ sqrt(m_vtDormerDir.x*m_vtDormerDir.x+m_vtDormerDir.y*m_vtDormerDir.y); Acad::ErrorStatus es = Acad::eOk; switch (m_dormerPar.GetDormerType()) { case TDormerPar::SLOPE_TRIANGLE: es = DrawTriangleSlope3D(dc,matAcge,dRoofGrade); break; case TDormerPar::SLOPE_TWO: es = DrawTwoSlope3D(dc,matAcge,dRoofGrade); break; case TDormerPar::SLOPE_THREE: es = DrawThreeSlope3D(dc,matAcge,dRoofGrade); break; case TDormerPar::SLOPE_TRAPEZIA: es = DrawTrapeziaSlope3D(dc,matAcge,dRoofGrade); break; case TDormerPar::SLOPE_FLAT: es = DrawFlatWindow3D(dc,matAcge,dRoofGrade); break; } return es; } void TDbDormer::DrawWindow(const XPoint& pt1, const XPoint& pt2, const XPoint& pt3, XExplodeDraw &dc) const { XVector3D vtTemp=pt2-pt1; AcGeVector3d vt1=vtTemp; vtTemp = pt3-pt1; AcGeVector3d vt2=vtTemp; AcGeVector3d vtNormal=vt1.crossProduct(vt2); double dWidth=_AS_SYS_UNIT(50),dHeight=_AS_SYS_UNIT(50); XPoint ptBase(dWidth,dHeight/2,0); XPoly2D polyShape(1),polyPath(1); polyShape.AppendNode(XPoint(0,0,0)); polyShape.AppendNode(XPoint(dWidth,0,0)); polyShape.AppendNode(XPoint(dWidth,dHeight,0)); polyShape.AppendNode(XPoint(0,dHeight,0)); polyPath.AppendNode(Wcs2Ecs(pt1,vtNormal)); polyPath.AppendNode(Wcs2Ecs(pt2,vtNormal)); polyPath.AppendNode(Wcs2Ecs(pt3,vtNormal)); TDbCurveMesh mesh; mesh.setPropertiesFrom(this); mesh.setLayer(m_dormerLayer.GetWindowId()); mesh.SetShapeBase(ptBase); mesh.SetShapePoly(polyShape); mesh.SetPathPoly(polyPath,vtNormal); TPushProperty vProp(&mesh, dc); if(dc.IsFullExplode()) mesh.ExplodeOrDraw3d(dc); else dc.DrawEntity(mesh); } void TDbDormer::DrawWindow(const XPoint& pt1, const XPoint& pt2, const XPoint& pt3, const XPoint& pt4, XExplodeDraw &dc) const { XVector3D vtTemp=pt2-pt1; AcGeVector3d vt1=vtTemp; vtTemp = pt3-pt1; AcGeVector3d vt2=vtTemp; AcGeVector3d vtNormal=vt1.crossProduct(vt2); double dWidth=_AS_SYS_UNIT(50),dHeight=_AS_SYS_UNIT(50); XPoint ptBase(dWidth,dHeight/2,0); XPoly2D polyShape(1),polyPath(1); polyShape.AppendNode(XPoint(0,0,0)); polyShape.AppendNode(XPoint(dWidth,0,0)); polyShape.AppendNode(XPoint(dWidth,dHeight,0)); polyShape.AppendNode(XPoint(0,dHeight,0)); polyPath.AppendNode(Wcs2Ecs(pt1,vtNormal)); polyPath.AppendNode(Wcs2Ecs(pt2,vtNormal)); polyPath.AppendNode(Wcs2Ecs(pt3,vtNormal)); polyPath.AppendNode(Wcs2Ecs(pt4,vtNormal)); TDbCurveMesh mesh; mesh.setPropertiesFrom(this); mesh.setLayer(m_dormerLayer.GetWindowId()); mesh.SetShapeBase(ptBase); mesh.SetShapePoly(polyShape); mesh.SetPathPoly(polyPath,vtNormal); TPushProperty vProp(&mesh, dc); if(dc.IsFullExplode()) mesh.ExplodeOrDraw3d(dc); else dc.DrawEntity(mesh); } //三角坡 BOOL TDbDormer::GetTriangleSlopeVertexs(const double dRoofGrade, DList& lstVertex) const { if (dRoofGrade<=0) return FALSE; lstVertex.Reset(); double InX = m_ptDormerBase.x; double InY = m_ptDormerBase.y; double InZ = m_ptDormerBase.z; //double ang = atan(dRoofGrade); double dDormerGrade = m_dormerPar.GetSlopeGrade(); if (dDormerGrade == 0) return FALSE; double dDormerAngle = atan(dDormerGrade); double dDormerCos = cos(dDormerAngle); if (dDormerCos == 0) return FALSE; double dDormerSin = sin(dDormerAngle); if (dDormerSin == 0) return FALSE; double dWallThick = m_dormerPar.GetWallThickness(); double dWallWidth = m_dormerPar.GetWallWidth()/2; if (dWallWidth == 0) return FALSE; double dWallHeigh = dWallWidth*dDormerGrade; double dWallZ = dWallThick*dRoofGrade; double dSlopeY = dWallHeigh/dRoofGrade; if (dSlopeY == 0) return FALSE; double dWallX = dWallWidth-dWallWidth*(dWallThick/dSlopeY); //外墙 lstVertex.Append(new XPoint(InX-dWallWidth,InY,InZ)); //0 lstVertex.Append(new XPoint(InX+dWallWidth,InY,InZ)); //1 lstVertex.Append(new XPoint(InX,InY,InZ+dWallHeigh)); //2 //内墙 lstVertex.Append(new XPoint(InX-dWallX,InY+dWallThick,InZ+dWallZ)); //3 lstVertex.Append(new XPoint(InX+dWallX,InY+dWallThick,InZ+dWallZ)); //4 lstVertex.Append(new XPoint(InX,InY+dWallThick,InZ+dWallHeigh)); //5 double dBrimZ = m_dormerPar.GetSlopeThickness()/dDormerCos; double dBrimY = dBrimZ/dRoofGrade; //后面顶 lstVertex.Append(new XPoint(InX,InY+dSlopeY,InZ+dWallHeigh)); //6 lstVertex.Append(new XPoint(InX,InY+dSlopeY+dBrimY,InZ+dWallHeigh+dBrimZ)); //7 double dHill = m_dormerPar.GetExtendHill(); double dHillX = dWallWidth*(dHill/dSlopeY)+dWallWidth; double dHillZ = dWallHeigh*(dHill/dSlopeY); double dBrimX = m_dormerPar.GetSlopeThickness()/dDormerSin; //前面顶 lstVertex.Append(new XPoint(InX-dHillX,InY-dHill,InZ-dHillZ)); //8 lstVertex.Append(new XPoint(InX+dHillX,InY-dHill,InZ-dHillZ)); //9 lstVertex.Append(new XPoint(InX-dHillX-dBrimX,InY-dHill,InZ-dHillZ)); //10 lstVertex.Append(new XPoint(InX+dHillX+dBrimX,InY-dHill,InZ-dHillZ)); //11 lstVertex.Append(new XPoint(InX,InY-dHill,InZ+dWallHeigh)); //12 lstVertex.Append(new XPoint(InX,InY-dHill,InZ+dWallHeigh+dBrimZ)); //13 double dWinWidth = m_dormerPar.GetWindowWidth()/2; double dWinHei = dWinWidth*dDormerGrade; double dWinHeiLow = (dWallHeigh-dWinHei-dWallZ)/2+dWallZ; double dWinHeiUp = dWinHeiLow+dWinHei; //外窗 lstVertex.Append(new XPoint(InX-dWinWidth,InY,InZ+dWinHeiLow)); //14 lstVertex.Append(new XPoint(InX+dWinWidth,InY,InZ+dWinHeiLow)); //15 lstVertex.Append(new XPoint(InX,InY,InZ+dWinHeiUp)); //16 //内窗 lstVertex.Append(new XPoint(InX-dWinWidth,InY+dWallThick,InZ+dWinHeiLow)); //17 lstVertex.Append(new XPoint(InX+dWinWidth,InY+dWallThick,InZ+dWinHeiLow)); //18 lstVertex.Append(new XPoint(InX,InY+dWallThick,InZ+dWinHeiUp)); //19 //玻璃 lstVertex.Append(new XPoint(InX-dWinWidth,InY+dWallThick/2,InZ+dWinHeiLow));//20 lstVertex.Append(new XPoint(InX+dWinWidth,InY+dWallThick/2,InZ+dWinHeiLow));//21 lstVertex.Append(new XPoint(InX,InY+dWallThick/2,InZ+dWinHeiUp)); //22 return TRUE; } Acad::ErrorStatus TDbDormer::DrawTriangleSlope3D( XExplodeDraw &dc, const AcGeMatrix3d &mat, const double dRoofGrade) const { DList lstVertex; if (!GetTriangleSlopeVertexs(dRoofGrade,lstVertex)) return Acad::eNotApplicable; int nCount = lstVertex.Length(); if (nCount != 23)//顶点数 return Acad::eNotApplicable; for (int i=0; i& lstVertex) const { if (dRoofGrade<=0) return FALSE; lstVertex.Reset(); double InX = m_ptDormerBase.x; double InY = m_ptDormerBase.y; double InZ = m_ptDormerBase.z; double dDormerGrade = m_dormerPar.GetSlopeGrade(); double dDormerAngle = atan(dDormerGrade); double dDormerCos = cos(dDormerAngle); if (dDormerCos == 0) return FALSE; double dWallThick = m_dormerPar.GetWallThickness(); double dWallWidth = m_dormerPar.GetWallWidth()/2; double dWallHeigh = m_dormerPar.GetWallHeight(); double dSlopeHeight = dWallWidth*dDormerGrade; double dWallY = dWallHeigh/dRoofGrade; double dWallZ = dWallThick*dRoofGrade; //外墙 lstVertex.Append(new XPoint(InX-dWallWidth,InY,InZ)); //0 lstVertex.Append(new XPoint(InX+dWallWidth,InY,InZ)); //1 lstVertex.Append(new XPoint(InX-dWallWidth,InY,InZ+dWallHeigh)); //2 lstVertex.Append(new XPoint(InX+dWallWidth,InY,InZ+dWallHeigh)); //3 lstVertex.Append(new XPoint(InX-dWallWidth,InY+dWallY,InZ+dWallHeigh)); //4 lstVertex.Append(new XPoint(InX+dWallWidth,InY+dWallY,InZ+dWallHeigh)); //5 lstVertex.Append(new XPoint(InX,InY,InZ+dWallHeigh+dSlopeHeight)); //6 //内墙 lstVertex.Append(new XPoint(InX-dWallWidth+dWallThick,InY+dWallThick,InZ+dWallZ)); //7 lstVertex.Append(new XPoint(InX+dWallWidth-dWallThick,InY+dWallThick,InZ+dWallZ)); //8 lstVertex.Append(new XPoint(InX-dWallWidth+dWallThick,InY+dWallThick,InZ+dWallHeigh)); //9 lstVertex.Append(new XPoint(InX+dWallWidth-dWallThick,InY+dWallThick,InZ+dWallHeigh)); //10 lstVertex.Append(new XPoint(InX-dWallWidth+dWallThick,InY+dWallY,InZ+dWallHeigh)); //11 lstVertex.Append(new XPoint(InX+dWallWidth-dWallThick,InY+dWallY,InZ+dWallHeigh)); //12 lstVertex.Append(new XPoint(InX,InY+dWallThick,InZ+dWallHeigh+dSlopeHeight)); //13 //新增墙顶点 double dHeight = dWallThick*dDormerGrade; lstVertex.Append(new XPoint(InX-dWallWidth+dWallThick,InY+dWallThick,InZ+dWallHeigh+dHeight)); //14 lstVertex.Append(new XPoint(InX+dWallWidth-dWallThick,InY+dWallThick,InZ+dWallHeigh+dHeight)); //15 lstVertex.Append(new XPoint(InX-dWallWidth,InY+dWallThick,InZ+dWallHeigh)); //16 lstVertex.Append(new XPoint(InX+dWallWidth,InY+dWallThick,InZ+dWallHeigh)); //17 double dHill = m_dormerPar.GetExtendHill(); double dSlopeY = dSlopeHeight/dRoofGrade; double dEaves = m_dormerPar.GetExtendEaves(); double dEavesZ = dEaves*dDormerGrade; double dEavesY = dEavesZ/dRoofGrade; double dBrimZ = m_dormerPar.GetSlopeThickness()/dDormerCos; double dBrimY = dBrimZ/dRoofGrade; double dBrimX = m_dormerPar.GetWallWidth()/2+dEaves; double dBrimYLow = InY+dWallY-dEavesY; double dBrimYUp = dBrimYLow+dBrimY; double dBrimZLow = InZ+dWallHeigh-dEavesZ; double dBrimZUp = dBrimZLow+dBrimZ; double dBrimYMidLow = InY+dWallY+dSlopeY; double dBrimYMidUp = dBrimYMidLow+dBrimY; double dBrimZMidLow = InZ+dWallHeigh+dSlopeHeight; double dBrimZMidUp = dBrimZMidLow+dBrimZ; //后面顶 lstVertex.Append(new XPoint(InX-dBrimX,dBrimYUp,dBrimZUp)); //18 lstVertex.Append(new XPoint(InX+dBrimX,dBrimYUp,dBrimZUp)); //19 lstVertex.Append(new XPoint(InX-dBrimX,dBrimYLow,dBrimZLow)); //20 lstVertex.Append(new XPoint(InX+dBrimX,dBrimYLow,dBrimZLow)); //21 lstVertex.Append(new XPoint(InX,dBrimYMidUp,dBrimZMidUp)); //22中间 lstVertex.Append(new XPoint(InX,dBrimYMidLow,dBrimZMidLow)); //13 //前面顶 lstVertex.Append(new XPoint(InX-dBrimX,InY-dHill,dBrimZUp)); //24 lstVertex.Append(new XPoint(InX+dBrimX,InY-dHill,dBrimZUp)); //25 lstVertex.Append(new XPoint(InX-dBrimX,InY-dHill,dBrimZLow)); //26 lstVertex.Append(new XPoint(InX+dBrimX,InY-dHill,dBrimZLow)); //27 lstVertex.Append(new XPoint(InX,InY-dHill,dBrimZMidUp)); //28中间 lstVertex.Append(new XPoint(InX,InY-dHill,dBrimZMidLow)); //29 double dWinWidth = m_dormerPar.GetWindowWidth()/2; double dWinSlope = dWinWidth*dDormerGrade; double dWinHei = m_dormerPar.GetWindowHeight(); double dWinHeiLow = (dWallHeigh-dWinHei-dWallZ)/2+dWallZ; double dWinHeiUp = dWinHeiLow+dWinHei; //外窗 lstVertex.Append(new XPoint(InX-dWinWidth,InY,InZ+dWinHeiLow)); //30 lstVertex.Append(new XPoint(InX+dWinWidth,InY,InZ+dWinHeiLow)); //31 lstVertex.Append(new XPoint(InX-dWinWidth,InY,InZ+dWinHeiUp)); //32 lstVertex.Append(new XPoint(InX+dWinWidth,InY,InZ+dWinHeiUp)); //33 lstVertex.Append(new XPoint(InX,InY,InZ+dWinHeiUp+dWinSlope)); //34 //内窗 lstVertex.Append(new XPoint(InX-dWinWidth,InY+dWallThick,InZ+dWinHeiLow)); //35 lstVertex.Append(new XPoint(InX+dWinWidth,InY+dWallThick,InZ+dWinHeiLow)); //36 lstVertex.Append(new XPoint(InX-dWinWidth,InY+dWallThick,InZ+dWinHeiUp)); //37 lstVertex.Append(new XPoint(InX+dWinWidth,InY+dWallThick,InZ+dWinHeiUp)); //38 lstVertex.Append(new XPoint(InX,InY+dWallThick,InZ+dWinHeiUp+dWinSlope)); //39 //玻璃 lstVertex.Append(new XPoint(InX-dWinWidth,InY+dWallThick/2,InZ+dWinHeiLow));//40 lstVertex.Append(new XPoint(InX+dWinWidth,InY+dWallThick/2,InZ+dWinHeiLow));//41 lstVertex.Append(new XPoint(InX-dWinWidth,InY+dWallThick/2,InZ+dWinHeiUp)); //42 lstVertex.Append(new XPoint(InX+dWinWidth,InY+dWallThick/2,InZ+dWinHeiUp)); //43 lstVertex.Append(new XPoint(InX,InY+dWallThick/2,InZ+dWinHeiUp+dWinSlope)); //44 //窗户 lstVertex.Append(new XPoint(InX,InY+dWallThick/2,InZ+dWinHeiLow)); //45 lstVertex.Append(new XPoint(InX,InY+dWallThick/2,InZ+dWinHeiUp)); //46 return TRUE; } Acad::ErrorStatus TDbDormer::DrawTwoSlope3D( XExplodeDraw &dc, const AcGeMatrix3d &mat, const double dRoofGrade) const { DList lstVertex; if (!GetTwoSlopeVertexs(dRoofGrade,lstVertex)) return Acad::eNotApplicable; int nCount = lstVertex.Length(); if (nCount != 47)//顶点数 return Acad::eNotApplicable; for (int i=0; i& lstVertex) const { if (dRoofGrade<=0) return FALSE; lstVertex.Reset(); double InX = m_ptDormerBase.x; double InY = m_ptDormerBase.y; double InZ = m_ptDormerBase.z; double dDormerGrade = m_dormerPar.GetSlopeGrade(); double dDormerAngle = atan(dDormerGrade); double dDormerCos = cos(dDormerAngle); if (dDormerCos == 0) return FALSE; double dWallThick = m_dormerPar.GetWallThickness(); double dWallWidth = m_dormerPar.GetWallWidth()/2; double dWallHeigh = m_dormerPar.GetWallHeight(); double dSlopeHeight = dWallWidth*dDormerGrade; double dWallY = dWallHeigh/dRoofGrade; double dWallZ = dWallThick*dRoofGrade; //外墙 lstVertex.Append(new XPoint(InX-dWallWidth,InY,InZ)); //0 lstVertex.Append(new XPoint(InX+dWallWidth,InY,InZ)); //1 lstVertex.Append(new XPoint(InX-dWallWidth,InY,InZ+dWallHeigh)); //2 lstVertex.Append(new XPoint(InX+dWallWidth,InY,InZ+dWallHeigh)); //3 lstVertex.Append(new XPoint(InX-dWallWidth,InY+dWallY,InZ+dWallHeigh)); //4 lstVertex.Append(new XPoint(InX+dWallWidth,InY+dWallY,InZ+dWallHeigh)); //5 //内墙 lstVertex.Append(new XPoint(InX-dWallWidth+dWallThick,InY+dWallThick,InZ+dWallZ)); //6 lstVertex.Append(new XPoint(InX+dWallWidth-dWallThick,InY+dWallThick,InZ+dWallZ)); //7 lstVertex.Append(new XPoint(InX-dWallWidth+dWallThick,InY+dWallThick,InZ+dWallHeigh)); //8 lstVertex.Append(new XPoint(InX+dWallWidth-dWallThick,InY+dWallThick,InZ+dWallHeigh)); //9 lstVertex.Append(new XPoint(InX-dWallWidth+dWallThick,InY+dWallY,InZ+dWallHeigh)); //10 lstVertex.Append(new XPoint(InX+dWallWidth-dWallThick,InY+dWallY,InZ+dWallHeigh)); //11 double dHill = m_dormerPar.GetExtendHill(); double dSlopeY = dSlopeHeight/dRoofGrade; double dEaves = m_dormerPar.GetExtendEaves(); double dEavesZ = dEaves*dDormerGrade; double dEavesY = dEavesZ/dRoofGrade; double dBrimZ = m_dormerPar.GetSlopeThickness()/dDormerCos; double dBrimY = dBrimZ/dRoofGrade; double dBrimX = m_dormerPar.GetWallWidth()/2+dEaves; double dBrimYLow = InY+dWallY-dEavesY; double dBrimYUp = dBrimYLow+dBrimY; double dBrimZLow = InZ+dWallHeigh-dEavesZ; double dBrimZUp = dBrimZLow+dBrimZ; double dBrimYMidLow = InY+dWallY+dSlopeY; double dBrimYMidUp = dBrimYMidLow+dBrimY; double dBrimZMidLow = InZ+dWallHeigh+dSlopeHeight; double dBrimZMidUp = dBrimZMidLow+dBrimZ; //后面顶 lstVertex.Append(new XPoint(InX-dBrimX,dBrimYUp,dBrimZUp)); //12 lstVertex.Append(new XPoint(InX+dBrimX,dBrimYUp,dBrimZUp)); //13 lstVertex.Append(new XPoint(InX-dBrimX,dBrimYLow,dBrimZLow)); //14 lstVertex.Append(new XPoint(InX+dBrimX,dBrimYLow,dBrimZLow)); //15 lstVertex.Append(new XPoint(InX,dBrimYMidUp,dBrimZMidUp)); //16中间 lstVertex.Append(new XPoint(InX,dBrimYMidLow,dBrimZMidLow)); //17 //前面顶 lstVertex.Append(new XPoint(InX-dBrimX,InY-dHill,dBrimZUp)); //18 lstVertex.Append(new XPoint(InX+dBrimX,InY-dHill,dBrimZUp)); //19 lstVertex.Append(new XPoint(InX-dBrimX,InY-dHill,dBrimZLow)); //20 lstVertex.Append(new XPoint(InX+dBrimX,InY-dHill,dBrimZLow)); //21 lstVertex.Append(new XPoint(InX,InY-dHill+dSlopeY,dBrimZMidUp)); //22中间 lstVertex.Append(new XPoint(InX,InY-dHill+dSlopeY,dBrimZMidLow)); //23 double dWinWidth = m_dormerPar.GetWindowWidth()/2; double dWinHei = m_dormerPar.GetWindowHeight(); double dWinHeiLow = (dWallHeigh-dWinHei-dWallZ)/2+dWallZ; double dWinHeiUp = dWinHeiLow+dWinHei; //外窗 lstVertex.Append(new XPoint(InX-dWinWidth,InY,InZ+dWinHeiLow)); //24 lstVertex.Append(new XPoint(InX+dWinWidth,InY,InZ+dWinHeiLow)); //25 lstVertex.Append(new XPoint(InX-dWinWidth,InY,InZ+dWinHeiUp)); //26 lstVertex.Append(new XPoint(InX+dWinWidth,InY,InZ+dWinHeiUp)); //27 //内窗 lstVertex.Append(new XPoint(InX-dWinWidth,InY+dWallThick,InZ+dWinHeiLow)); //28 lstVertex.Append(new XPoint(InX+dWinWidth,InY+dWallThick,InZ+dWinHeiLow)); //29 lstVertex.Append(new XPoint(InX-dWinWidth,InY+dWallThick,InZ+dWinHeiUp)); //30 lstVertex.Append(new XPoint(InX+dWinWidth,InY+dWallThick,InZ+dWinHeiUp)); //31 //玻璃 lstVertex.Append(new XPoint(InX-dWinWidth,InY+dWallThick/2,InZ+dWinHeiLow));//32 lstVertex.Append(new XPoint(InX+dWinWidth,InY+dWallThick/2,InZ+dWinHeiLow));//33 lstVertex.Append(new XPoint(InX-dWinWidth,InY+dWallThick/2,InZ+dWinHeiUp)); //34 lstVertex.Append(new XPoint(InX+dWinWidth,InY+dWallThick/2,InZ+dWinHeiUp)); //35 //窗户 lstVertex.Append(new XPoint(InX,InY+dWallThick/2,InZ+dWinHeiLow)); //36 lstVertex.Append(new XPoint(InX,InY+dWallThick/2,InZ+dWinHeiUp)); //37 return TRUE; } Acad::ErrorStatus TDbDormer::DrawThreeSlope3D( XExplodeDraw &dc, const AcGeMatrix3d &mat, const double dRoofGrade) const { DList lstVertex; if (!GetThreeSlopeVertexs(dRoofGrade,lstVertex)) return Acad::eNotApplicable; int nCount = lstVertex.Length(); if (nCount != 38)//顶点数 return Acad::eNotApplicable; for (int i=0; i& lstVertex) const { if (dRoofGrade<=0) return FALSE; lstVertex.Reset(); double InX = m_ptDormerBase.x; double InY = m_ptDormerBase.y; double InZ = m_ptDormerBase.z; double dDormerGrade = m_dormerPar.GetSlopeGrade(); double dDormerAngle = atan(dDormerGrade); double dDormerCos = cos(dDormerAngle); if (dDormerGrade == 0) return FALSE; //墙 double dWallThick = m_dormerPar.GetWallThickness(); double dWallWidth = m_dormerPar.GetWallWidth()/2; double dWallHeigh = m_dormerPar.GetWallHeight(); double dWallY = dWallHeigh/dRoofGrade; double dWallZ = dWallThick*dRoofGrade; //顶 double dSlopeHeight = m_dormerPar.GetSlopeHeight(); double dHill = m_dormerPar.GetExtendHill(); double dEaves = m_dormerPar.GetExtendEaves(); double dSlopeY = dSlopeHeight/dRoofGrade; double dEavesZ = dEaves*dDormerGrade; double dEavesY = dEavesZ/dRoofGrade; double dBrimZ = m_dormerPar.GetSlopeThickness(); double dBrimY = dBrimZ/dRoofGrade; //顶 double dBrimX = dWallWidth+dEaves; double dBrimYLow = InY+dWallY-dEavesY; double dBrimYUp = dBrimYLow+dBrimY; double dBrimZLow = InZ+dWallHeigh-dEavesZ; double dBrimZUp = dBrimZLow+dBrimZ; double dBrimYMidLow = InY+dWallY+dSlopeY-dEavesY; double dBrimYMidUp = dBrimYMidLow+dBrimY; double dBrimZMidLow = InZ+dWallHeigh+dSlopeHeight-dEavesZ; double dBrimZMidUp = dBrimZMidLow+dBrimZ; double dBrimXMid = dWallWidth + dEaves - dSlopeHeight/dDormerGrade; //外墙 lstVertex.Append(new XPoint(InX-dWallWidth,InY,InZ)); //0 lstVertex.Append(new XPoint(InX+dWallWidth,InY,InZ)); //1 lstVertex.Append(new XPoint(InX-dWallWidth,InY,InZ+dWallHeigh)); //2 lstVertex.Append(new XPoint(InX+dWallWidth,InY,InZ+dWallHeigh)); //3 lstVertex.Append(new XPoint(InX-dWallWidth,InY+dWallY,InZ+dWallHeigh)); //4 lstVertex.Append(new XPoint(InX+dWallWidth,InY+dWallY,InZ+dWallHeigh)); //5 lstVertex.Append(new XPoint(InX-dBrimXMid,InY,dBrimZMidLow)); //6 lstVertex.Append(new XPoint(InX+dBrimXMid,InY,dBrimZMidLow)); //7 //内墙 lstVertex.Append(new XPoint(InX-dWallWidth+dWallThick,InY+dWallThick,InZ+dWallZ)); //8 lstVertex.Append(new XPoint(InX+dWallWidth-dWallThick,InY+dWallThick,InZ+dWallZ)); //9 lstVertex.Append(new XPoint(InX-dWallWidth+dWallThick,InY+dWallThick,InZ+dWallHeigh)); //10 lstVertex.Append(new XPoint(InX+dWallWidth-dWallThick,InY+dWallThick,InZ+dWallHeigh)); //11 lstVertex.Append(new XPoint(InX-dWallWidth+dWallThick,InY+dWallY,InZ+dWallHeigh)); //12 lstVertex.Append(new XPoint(InX+dWallWidth-dWallThick,InY+dWallY,InZ+dWallHeigh)); //13 lstVertex.Append(new XPoint(InX-dBrimXMid,InY+dWallThick,dBrimZMidLow)); //14 lstVertex.Append(new XPoint(InX+dBrimXMid,InY+dWallThick,dBrimZMidLow)); //15 //新增墙顶点 double dHeight = dWallThick*dDormerGrade; lstVertex.Append(new XPoint(InX-dWallWidth+dWallThick,InY+dWallThick,InZ+dWallHeigh+dHeight)); //16 lstVertex.Append(new XPoint(InX+dWallWidth-dWallThick,InY+dWallThick,InZ+dWallHeigh+dHeight)); //17 lstVertex.Append(new XPoint(InX-dWallWidth,InY+dWallThick,InZ+dWallHeigh)); //18 lstVertex.Append(new XPoint(InX+dWallWidth,InY+dWallThick,InZ+dWallHeigh)); //19 //后面顶 lstVertex.Append(new XPoint(InX-dBrimX,dBrimYUp,dBrimZUp)); //20 lstVertex.Append(new XPoint(InX+dBrimX,dBrimYUp,dBrimZUp)); //21 lstVertex.Append(new XPoint(InX-dBrimX,dBrimYLow,dBrimZLow)); //22 lstVertex.Append(new XPoint(InX+dBrimX,dBrimYLow,dBrimZLow)); //23 lstVertex.Append(new XPoint(InX-dBrimXMid,dBrimYMidUp,dBrimZMidUp)); //24中间 lstVertex.Append(new XPoint(InX+dBrimXMid,dBrimYMidUp,dBrimZMidUp)); //25 lstVertex.Append(new XPoint(InX-dBrimXMid,dBrimYMidLow,dBrimZMidLow)); //26 lstVertex.Append(new XPoint(InX+dBrimXMid,dBrimYMidLow,dBrimZMidLow)); //27 //前面顶 lstVertex.Append(new XPoint(InX-dBrimX,InY-dHill,dBrimZUp)); //28 lstVertex.Append(new XPoint(InX+dBrimX,InY-dHill,dBrimZUp)); //29 lstVertex.Append(new XPoint(InX-dBrimX,InY-dHill,dBrimZLow)); //30 lstVertex.Append(new XPoint(InX+dBrimX,InY-dHill,dBrimZLow)); //31 lstVertex.Append(new XPoint(InX-dBrimXMid,InY-dHill,dBrimZMidUp)); //32中间 lstVertex.Append(new XPoint(InX+dBrimXMid,InY-dHill,dBrimZMidUp)); //33 lstVertex.Append(new XPoint(InX-dBrimXMid,InY-dHill,dBrimZMidLow)); //34 lstVertex.Append(new XPoint(InX+dBrimXMid,InY-dHill,dBrimZMidLow)); //35 if (dWallWidth == 0) return FALSE; double dWinWidth = m_dormerPar.GetWindowWidth()/2; double dWinSlopeX = dBrimXMid*(dWinWidth/dWallWidth); double dWinSlopeZ = (dWinWidth-dWinSlopeX)*dDormerGrade; double dWinHei = m_dormerPar.GetWindowHeight(); double dWinHeiLow = (dWallHeigh-dWinHei-dWallZ)/2+dWallZ; double dWinHeiUp = dWinHeiLow+dWinHei; //外窗 lstVertex.Append(new XPoint(InX-dWinWidth,InY,InZ+dWinHeiLow)); //36 lstVertex.Append(new XPoint(InX+dWinWidth,InY,InZ+dWinHeiLow)); //37 lstVertex.Append(new XPoint(InX-dWinWidth,InY,InZ+dWinHeiUp)); //38 lstVertex.Append(new XPoint(InX+dWinWidth,InY,InZ+dWinHeiUp)); //39 lstVertex.Append(new XPoint(InX-dWinSlopeX,InY,InZ+dWinHeiUp+dWinSlopeZ)); //40 lstVertex.Append(new XPoint(InX+dWinSlopeX,InY,InZ+dWinHeiUp+dWinSlopeZ)); //41 //内窗 lstVertex.Append(new XPoint(InX-dWinWidth,InY+dWallThick,InZ+dWinHeiLow)); //42 lstVertex.Append(new XPoint(InX+dWinWidth,InY+dWallThick,InZ+dWinHeiLow)); //43 lstVertex.Append(new XPoint(InX-dWinWidth,InY+dWallThick,InZ+dWinHeiUp)); //44 lstVertex.Append(new XPoint(InX+dWinWidth,InY+dWallThick,InZ+dWinHeiUp)); //45 lstVertex.Append(new XPoint(InX-dWinSlopeX,InY+dWallThick,InZ+dWinHeiUp+dWinSlopeZ));//46 lstVertex.Append(new XPoint(InX+dWinSlopeX,InY+dWallThick,InZ+dWinHeiUp+dWinSlopeZ));//47 //玻璃 lstVertex.Append(new XPoint(InX-dWinWidth,InY+dWallThick/2,InZ+dWinHeiLow));//48 lstVertex.Append(new XPoint(InX+dWinWidth,InY+dWallThick/2,InZ+dWinHeiLow));//49 lstVertex.Append(new XPoint(InX-dWinWidth,InY+dWallThick/2,InZ+dWinHeiUp)); //50 lstVertex.Append(new XPoint(InX+dWinWidth,InY+dWallThick/2,InZ+dWinHeiUp)); //51 lstVertex.Append(new XPoint(InX-dWinSlopeX,InY+dWallThick/2,InZ+dWinHeiUp+dWinSlopeZ)); //52 lstVertex.Append(new XPoint(InX+dWinSlopeX,InY+dWallThick/2,InZ+dWinHeiUp+dWinSlopeZ)); //53 //窗户 lstVertex.Append(new XPoint(InX,InY+dWallThick/2,InZ+dWinHeiLow)); //54 lstVertex.Append(new XPoint(InX,InY+dWallThick/2,InZ+dWinHeiUp)); //55 return TRUE; } Acad::ErrorStatus TDbDormer::DrawTrapeziaSlope3D( XExplodeDraw &dc, const AcGeMatrix3d &mat, const double dRoofGrade) const { DList lstVertex; if (!GetTrapeziaSlopeVertexs(dRoofGrade,lstVertex)) return Acad::eNotApplicable; int nCount = lstVertex.Length(); if (nCount != 56)//顶点数 return Acad::eNotApplicable; for (int i=0; i& lstVertex) const { if (dRoofGrade<=0) return FALSE; lstVertex.Reset(); double InX = m_ptDormerBase.x; double InY = m_ptDormerBase.y; double InZ = m_ptDormerBase.z; //double ang = atan(dRoofGrade); double dWallThick = m_dormerPar.GetWallThickness(); double dWallWidth = m_dormerPar.GetWallWidth()/2; double dWallHeigh = m_dormerPar.GetWallHeight(); double dWallY = dWallHeigh/dRoofGrade; double dWallZ = dWallThick*dRoofGrade; //外墙 lstVertex.Append(new XPoint(InX-dWallWidth,InY,InZ)); //0 lstVertex.Append(new XPoint(InX+dWallWidth,InY,InZ)); //1 lstVertex.Append(new XPoint(InX-dWallWidth,InY,InZ+dWallHeigh)); //2 lstVertex.Append(new XPoint(InX+dWallWidth,InY,InZ+dWallHeigh)); //3 lstVertex.Append(new XPoint(InX-dWallWidth,InY+dWallY,InZ+dWallHeigh)); //4 lstVertex.Append(new XPoint(InX+dWallWidth,InY+dWallY,InZ+dWallHeigh)); //5 //内墙 lstVertex.Append(new XPoint(InX-dWallWidth+dWallThick,InY+dWallThick,InZ+dWallZ)); //6 lstVertex.Append(new XPoint(InX+dWallWidth-dWallThick,InY+dWallThick,InZ+dWallZ)); //7 lstVertex.Append(new XPoint(InX-dWallWidth+dWallThick,InY+dWallThick,InZ+dWallHeigh)); //8 lstVertex.Append(new XPoint(InX+dWallWidth-dWallThick,InY+dWallThick,InZ+dWallHeigh)); //9 lstVertex.Append(new XPoint(InX-dWallWidth+dWallThick,InY+dWallY,InZ+dWallHeigh)); //10 lstVertex.Append(new XPoint(InX+dWallWidth-dWallThick,InY+dWallY,InZ+dWallHeigh)); //11 double dHill = m_dormerPar.GetExtendHill(); double dBrimZ = m_dormerPar.GetSlopeThickness(); double dBrimY = m_dormerPar.GetSlopeThickness()/dRoofGrade; double dBrimX = m_dormerPar.GetWallWidth()/2+m_dormerPar.GetExtendEaves(); //后面顶 lstVertex.Append(new XPoint(InX-dBrimX,InY+dWallY+dBrimY,InZ+dWallHeigh+dBrimZ));//12 lstVertex.Append(new XPoint(InX+dBrimX,InY+dWallY+dBrimY,InZ+dWallHeigh+dBrimZ));//13 lstVertex.Append(new XPoint(InX-dBrimX,InY+dWallY,InZ+dWallHeigh)); //14 lstVertex.Append(new XPoint(InX+dBrimX,InY+dWallY,InZ+dWallHeigh)); //15 //前面顶 lstVertex.Append(new XPoint(InX-dBrimX,InY-dHill,InZ+dWallHeigh+dBrimZ));//16 lstVertex.Append(new XPoint(InX+dBrimX,InY-dHill,InZ+dWallHeigh+dBrimZ));//17 lstVertex.Append(new XPoint(InX-dBrimX,InY-dHill,InZ+dWallHeigh)); //18 lstVertex.Append(new XPoint(InX+dBrimX,InY-dHill,InZ+dWallHeigh)); //19 double dWinWidth = m_dormerPar.GetWindowWidth()/2; double dWinHei = m_dormerPar.GetWindowHeight(); double dWinHeiLow = (dWallHeigh-dWinHei-dWallZ)/2+dWallZ; double dWinHeiUp = dWinHeiLow+dWinHei; //外窗 lstVertex.Append(new XPoint(InX-dWinWidth,InY,InZ+dWinHeiLow)); //20 lstVertex.Append(new XPoint(InX+dWinWidth,InY,InZ+dWinHeiLow)); //21 lstVertex.Append(new XPoint(InX-dWinWidth,InY,InZ+dWinHeiUp)); //22 lstVertex.Append(new XPoint(InX+dWinWidth,InY,InZ+dWinHeiUp)); //23 //内窗 lstVertex.Append(new XPoint(InX-dWinWidth,InY+dWallThick,InZ+dWinHeiLow)); //24 lstVertex.Append(new XPoint(InX+dWinWidth,InY+dWallThick,InZ+dWinHeiLow)); //25 lstVertex.Append(new XPoint(InX-dWinWidth,InY+dWallThick,InZ+dWinHeiUp)); //26 lstVertex.Append(new XPoint(InX+dWinWidth,InY+dWallThick,InZ+dWinHeiUp)); //27 //玻璃 lstVertex.Append(new XPoint(InX-dWinWidth,InY+dWallThick/2,InZ+dWinHeiLow));//28 lstVertex.Append(new XPoint(InX+dWinWidth,InY+dWallThick/2,InZ+dWinHeiLow));//29 lstVertex.Append(new XPoint(InX-dWinWidth,InY+dWallThick/2,InZ+dWinHeiUp)); //30 lstVertex.Append(new XPoint(InX+dWinWidth,InY+dWallThick/2,InZ+dWinHeiUp)); //31 //窗户 lstVertex.Append(new XPoint(InX,InY+dWallThick/2,InZ+dWinHeiLow)); //32 lstVertex.Append(new XPoint(InX,InY+dWallThick/2,InZ+dWinHeiUp)); //33 return TRUE; } Acad::ErrorStatus TDbDormer::DrawFlatWindow3D( XExplodeDraw &dc, const AcGeMatrix3d &mat, const double dRoofGrade) const { DList lstVertex; if (!GetFlatWindowVertexs(dRoofGrade,lstVertex)) return Acad::eNotApplicable; int nCount = lstVertex.Length(); if (nCount != 34)//顶点数 return Acad::eNotApplicable; for (int i=0; i lstVertex; if (!GetTriangleSlopeVertexs(dRoofGrade,lstVertex)) return Acad::eNotApplicable; int nCount = lstVertex.Length(); if (nCount != 23)//顶点数 return Acad::eNotApplicable; for (int i=0; i lstVertex; if (!GetTwoSlopeVertexs(dRoofGrade,lstVertex)) return Acad::eNotApplicable; int nCount = lstVertex.Length(); if (nCount != 47)//顶点数 return Acad::eNotApplicable; for (int i=0; i lstVertex; if (!GetThreeSlopeVertexs(dRoofGrade,lstVertex)) return Acad::eNotApplicable; int nCount = lstVertex.Length(); if (nCount != 38)//顶点数 return Acad::eNotApplicable; for (int i=0; i lstVertex; if (!GetTrapeziaSlopeVertexs(dRoofGrade,lstVertex)) return Acad::eNotApplicable; int nCount = lstVertex.Length(); if (nCount != 56)//顶点数 return Acad::eNotApplicable; for (int i=0; i lstVertex; if (!GetFlatWindowVertexs(dRoofGrade,lstVertex)) return Acad::eNotApplicable; int nCount = lstVertex.Length(); if (nCount != 34)//顶点数 return Acad::eNotApplicable; for (int i=0; i &lstInfo) const { lstInfo.Append(new TObjInfoUnit(_T("对象类型"), _T("老虎窗"))); lstInfo.Append(new TObjInfoUnit(_T("型式"), GetDormerType())); lstInfo.Append(new TObjInfoUnit(_T("编号"), m_sLabel)); TDormerPar::DormerType dormerType=m_dormerPar.GetDormerType(); if (dormerType!=TDormerPar::SLOPE_FLAT) { lstInfo.Append(new TObjInfoUnit(_T("坡度"), XString(_T("%.2f"), m_dormerPar.GetSlopeGrade()))); lstInfo.Append(new TObjInfoUnit(_T("坡顶高"), XString(_T("%d"), AS_INT(m_dormerPar.GetSlopeHeight())))); } lstInfo.Append(new TObjInfoUnit(_T("檐板厚"), XString(_T("%d"), AS_INT(m_dormerPar.GetSlopeThickness())))); if (dormerType!=TDormerPar::SLOPE_TRIANGLE) { lstInfo.Append(new TObjInfoUnit(_T("出檐长"), XString(_T("%d"), AS_INT(m_dormerPar.GetExtendEaves())))); } lstInfo.Append(new TObjInfoUnit(_T("出山长"), XString(_T("%d"), AS_INT(m_dormerPar.GetExtendHill())))); lstInfo.Append(new TObjInfoUnit(_T("墙高"), XString(_T("%d"), AS_INT(m_dormerPar.GetWallHeight())))); lstInfo.Append(new TObjInfoUnit(_T("墙宽"), XString(_T("%d"), AS_INT(m_dormerPar.GetWallWidth())))); lstInfo.Append(new TObjInfoUnit(_T("墙厚"), XString(_T("%d"), AS_INT(m_dormerPar.GetWallThickness())))); if (m_bShowWindow) { lstInfo.Append(new TObjInfoUnit(_T("窗高"), XString(_T("%d"), AS_INT(m_dormerPar.GetWindowHeight())))); lstInfo.Append(new TObjInfoUnit(_T("窗宽"), XString(_T("%d"), AS_INT(m_dormerPar.GetWindowWidth())))); } } // sg add 110224,增加自动编号 CString TDbDormer::GetAutoLabel(bool &bAddNum)const { TOpeningLabelData data; CStringArray arSubType; // 获得类型数组 data.GetSubType(_T("Dormer"),arSubType); CString csNewName = _T(""); if (arSubType.GetSize() > 0) { data.GetOpeningLabel(_T("Dormer"),arSubType[0], csNewName); } // 获得是否需要添加连字符 CString csHypen = _T(""); if (data.HasHypen()) csHypen = _T("-"); bool bRound = data.IsRound(); // 是否进行四舍五入 TOpeningLabelData::ESerialRule nRule = data.GetNumRule(); if (nRule == TOpeningLabelData::kSize) // 按尺寸标注 { bAddNum = false; // 洞口尺寸宽+高 double nWidth = m_dormerPar.GetWindowWidth(), nHeight = m_dormerPar.GetWindowHeight(); int nWidth1 = AS_INT(nWidth/100), nHeight1 = AS_INT(nHeight/100); if (!bRound) // 不进行四舍五入 { nWidth1 = AS_INT(nWidth)/100; nHeight1 = AS_INT(nHeight)/100; } if (nWidth1>9&&nHeight1>9) csNewName.Format(_T("%s%s%d%d"),csNewName, csHypen, nWidth1, nHeight1); else if (nWidth1<10&&nHeight1>9) csNewName.Format(_T("%s%s0%d%d"),csNewName, csHypen, nWidth1, nHeight1); else if (nWidth1>9&&nHeight1<10) csNewName.Format(_T("%s%s%d0%d"),csNewName, csHypen, nWidth1, nHeight1); else csNewName.Format(_T("%s%s0%d0%d"),csNewName, csHypen, nWidth1, nHeight1); } else // 按数序排列 { csNewName.Format(_T("%s%s"), csNewName, csHypen); bAddNum = true; // 由对话框处进行+1工作 } return csNewName; } void InitDbDormer(BOOL bTrue) { if(bTrue) { TDbDormer::rxInit(); //TDbDormer::SetEditMethod(EditDormer0); acrxBuildClassHierarchy(); TDbDormer::InitMatchProtocol(TRUE); } else { TDbDormer::InitMatchProtocol(FALSE); deleteAcRxClass(TDbDormer::desc()); } }