4410 lines
116 KiB
C++
4410 lines
116 KiB
C++
#include "stdafx.h"
|
|
#include "TDbColumn.h"
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////
|
|
|
|
// ver: 1-TArch5; 2,3-TArch6;4-Tarch8
|
|
//const Adesk::UInt8 TDbRectStair::g_nVersion = 4;
|
|
//modefy by jsx on 160615 20V3
|
|
const Adesk::UInt8 TDbRectStair::g_nVersion = 5;
|
|
|
|
|
|
ACRX_DXF_DEFINE_MEMBERS(ATSRectStair, ATSPolyPathEnt, AcDb::kDHL_CURRENT, AcDb::kMReleaseCurrent,
|
|
1, ATS_RECTSTAIR, "ATS_RECTSTAIR图形无法解析, 请下载上华软件|网址: www.shanghuasoft.com");
|
|
|
|
IMPLEMENT_TENTBASE(TDbRectStair);
|
|
|
|
TDbRectStair::TDbRectStair()
|
|
{
|
|
m_nStepHeight=_AS_SYS_UNIT(220.0); //踏步高
|
|
m_nStepWidth=_AS_SYS_UNIT(300); //踏步宽
|
|
m_nStairWidth=_AS_SYS_UNIT(1200); //梯段宽
|
|
m_nSlabSize=_AS_SYS_UNIT(1200); //休息平台尺寸
|
|
m_nRotation=0.0; //旋转角度
|
|
m_nStepNum1=m_nStepNum2=2; //一跑和二跑步数
|
|
m_nSpaceWidth=_AS_SYS_UNIT(3000.0); //楼梯间尺寸
|
|
m_nRailHeight=_AS_SYS_UNIT(900);
|
|
m_nStairFlag=1; //楼层标记
|
|
m_nStartSide=OFFSET_LEFT; //起步的一侧
|
|
m_nAlignment=0; //踏步取齐: 0--齐休息平台, 1--齐中间, 2--齐楼板
|
|
|
|
m_nRailWidth=_AS_SYS_UNIT(60.0); //扶手宽度
|
|
m_nRailDistToSide=0.0; //扶手距离边
|
|
|
|
// TArch6 data
|
|
m_nFlagEx=0;
|
|
m_nBeamHeight=_AS_SYS_UNIT(200); //边梁高,坡道专用
|
|
m_nBeamThick=_AS_SYS_UNIT(120); //边梁厚度
|
|
m_nSlabThick=_AS_SYS_UNIT(120); //板厚或梁厚
|
|
|
|
m_lSectPos=m_rSectPos=0.0;
|
|
m_nViewCtrl=0; //自动确定
|
|
|
|
//add by xlc on 0806262
|
|
//Tarch8 member
|
|
m_nRailDistMid=m_nStepWidth*0.5; //层间转角处扶手伸出距离
|
|
m_nRailDist=m_nStepWidth*0.5; //层与层连接处扶手伸出距离
|
|
m_dSectElev=m_nStepWidth*m_nStepNum1*0.5; //剖切高度
|
|
m_dSectRotation=PI/6; //剖断线旋转角度
|
|
m_dTextHeight=3.5; //字高
|
|
m_nSlabSize2=_AS_SYS_UNIT(1200); //二跑一侧休息平台尺寸
|
|
m_nSlabSize1=_AS_SYS_UNIT(1200); //一跑一侧休息平台尺寸
|
|
m_dSlopeLength1=_AS_SYS_UNIT(1200); //一跑坡道长
|
|
m_dSlopeLength2=_AS_SYS_UNIT(1200); //二跑坡道长
|
|
//疏散半径颜色
|
|
m_nEvaRadiusColor = 9;
|
|
AcCmColor color;
|
|
color.setColorIndex(m_nEvaRadiusColor);
|
|
SetEvaRadiusColor(color);
|
|
SetLayerText(InitLayer(LAY_TEXT));
|
|
SetTextStyle(InitTextStyle(TS_DIM));
|
|
SetLayerArrow(InitLayer(LAY_OTHER_DIM));
|
|
SetManualSectPos(TRUE);
|
|
}
|
|
|
|
|
|
TDbRectStair::~TDbRectStair()
|
|
{
|
|
}
|
|
|
|
BOOL TDbRectStair::IsValid() const
|
|
{
|
|
BOOL bRet=TDbEntity::IsValid();
|
|
if(!bRet)
|
|
return bRet;
|
|
|
|
bRet=(m_nStepHeight>_DIST_SNAP && //踏步高
|
|
m_nStepWidth>_DIST_SNAP && //踏步宽
|
|
m_nStairWidth>_DIST_SNAP && //梯段宽
|
|
m_dTextHeight>0&& //字高
|
|
m_nStepNum1>1 &&
|
|
m_nStepNum2>1 && //一跑和二跑步数
|
|
m_nSpaceWidth-2*m_nStairWidth>-_DIST_SNAP && //楼梯间尺寸
|
|
m_nRailHeight>_DIST_SNAP &&
|
|
m_nRailWidth>_DIST_SNAP &&
|
|
GreatEqual(m_nRailDistToSide,-(m_nSpaceWidth-2*m_nStairWidth)*0.5) &&
|
|
GreatEqual(m_nBeamHeight, 0.0) &&
|
|
GreatEqual(m_nBeamThick, 0.0) &&
|
|
GreatEqual(m_nSlabThick, 0.0) &&
|
|
m_nStairWidth>m_nRailWidth+m_nRailDistToSide); //扶手高度
|
|
return bRet;
|
|
}
|
|
|
|
// 提供对格式刷的支持
|
|
void TDbRectStair::CopyPropertiesFrom(AcDbEntity *pSrcEntity, unsigned gMatchFlag)
|
|
{
|
|
assertWriteEnabled();
|
|
TDbPolyPathEnt::CopyPropertiesFrom(pSrcEntity, gMatchFlag);
|
|
TDbRectStair *pSrc=TDbRectStair::cast(pSrcEntity);
|
|
if(pSrc) {
|
|
m_nStepHeight=pSrc->m_nStepHeight;
|
|
m_nStepWidth=pSrc->m_nStepWidth;
|
|
m_nStairWidth=pSrc->m_nStairWidth;
|
|
m_nSlabSize=pSrc->m_nSlabSize;
|
|
m_nStepNum1=pSrc->m_nStepNum1;
|
|
m_nStepNum2=pSrc->m_nStepNum2;
|
|
m_nStartSide=pSrc->m_nStartSide;
|
|
m_nSpaceWidth=pSrc->m_nSpaceWidth;
|
|
m_nRailHeight=pSrc->m_nRailHeight;
|
|
m_nRailWidth=pSrc->m_nRailWidth;
|
|
m_nRailDistToSide=pSrc->m_nRailDistToSide;
|
|
m_nStairFlag=pSrc->m_nStairFlag;
|
|
m_nAlignment=pSrc->m_nAlignment;
|
|
|
|
//add by xlc on 090426箭头文字
|
|
SetTextUp(pSrc->GetTextUp());
|
|
SetTextDown(pSrc->GetTextDown());
|
|
|
|
// TArch6 members
|
|
m_nFlagEx=pSrc->m_nFlagEx;
|
|
m_nBeamHeight=pSrc->m_nBeamHeight; //边梁高,坡道专用
|
|
m_nBeamThick=pSrc->m_nBeamThick; //边梁厚度
|
|
m_nSlabThick=pSrc->m_nSlabThick; //板厚或梁厚
|
|
if(database()==NULL||
|
|
pSrcEntity->database()==NULL||
|
|
database()==pSrcEntity->database())//add by whl on 060317
|
|
{
|
|
m_idLayerHand3d=pSrc->m_idLayerHand3d;
|
|
m_idLayerStep3d=pSrc->m_idLayerStep3d;
|
|
m_idLayerBeam3d=pSrc->m_idLayerBeam3d;
|
|
m_idLayerRail3d=pSrc->m_idLayerRail3d;
|
|
|
|
//add by xlc on 080626
|
|
//Tarch8 member
|
|
m_idLayerText=pSrc->m_idLayerText;
|
|
m_idLayerArrow=pSrc->m_idLayerArrow;
|
|
m_idTextStyle=pSrc->m_idTextStyle;
|
|
}
|
|
|
|
m_lSectPos=pSrc->m_lSectPos;
|
|
m_rSectPos=pSrc->m_rSectPos;
|
|
m_nViewCtrl=pSrc->m_nViewCtrl;
|
|
|
|
//add by xlc on 080626
|
|
//Tarch8 member
|
|
m_nRailDistMid=pSrc->m_nRailDistMid; //层间转角处扶手伸出距离
|
|
m_nRailDist=pSrc->m_nRailDist; //层与层连接处扶手伸出距离
|
|
m_dSectElev=pSrc->m_dSectElev; //剖切高度
|
|
m_dSectRotation=pSrc->m_dSectRotation; //剖断线旋转角度
|
|
m_dTextHeight=pSrc->m_dTextHeight; //字高
|
|
m_nSlabSize1=pSrc->m_nSlabSize1; //一跑一侧平台尺寸
|
|
m_nSlabSize2=pSrc->m_nSlabSize2; //二跑一侧平台尺寸
|
|
m_dSlopeLength1=pSrc->m_dSlopeLength1; //一跑坡道长
|
|
m_dSlopeLength2=pSrc->m_dSlopeLength2; //二跑坡道长
|
|
m_nEvaRadiusColor = pSrc->m_nEvaRadiusColor;//疏散半径
|
|
}
|
|
}
|
|
|
|
Acad::ErrorStatus
|
|
TDbRectStair::subGetClassID(CLSID* pClsid) const
|
|
{
|
|
return Acad::eOk;
|
|
}
|
|
|
|
// 从DWG读入数据:
|
|
Acad::ErrorStatus
|
|
TDbRectStair::dwgInFields (AcDbDwgFiler* pFiler)
|
|
{
|
|
assertWriteEnabled();
|
|
|
|
Acad::ErrorStatus es = TDbPolyPathEnt::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_ptLocation);
|
|
pFiler->readItem(&m_nRotation); //旋转角度
|
|
pFiler->readItem(&m_nStepHeight); //踏步高
|
|
pFiler->readItem(&m_nStepWidth); //踏步宽
|
|
pFiler->readItem(&m_nStairWidth); //梯段宽
|
|
pFiler->readItem(&m_nSlabSize); //休息平台尺寸
|
|
pFiler->readItem(&m_nStepNum1);
|
|
pFiler->readItem(&m_nStepNum2); //一跑和二跑步数
|
|
pFiler->readItem(&m_nSpaceWidth);//楼梯间尺寸
|
|
pFiler->readItem(&m_nRailHeight);
|
|
pFiler->readItem(&m_nStairFlag); //楼层标记
|
|
pFiler->readItem(&m_nStartSide); //起步的一侧
|
|
pFiler->readItem(&m_nAlignment); //踏步取齐: 0--齐休息平台, 1--齐中间, 2--齐楼板
|
|
|
|
pFiler->readItem(&m_nRailWidth);
|
|
pFiler->readItem(&m_nRailDistToSide);
|
|
|
|
// TArch6
|
|
if(nVer>1) {
|
|
pFiler->readItem(&m_nFlagEx);
|
|
pFiler->readItem(&m_nBeamHeight);
|
|
pFiler->readItem(&m_nBeamThick);
|
|
pFiler->readItem(&m_nSlabThick);
|
|
pFiler->readItem(&m_idLayerHand3d);
|
|
pFiler->readItem(&m_idLayerStep3d);
|
|
pFiler->readItem(&m_idLayerBeam3d);
|
|
pFiler->readItem(&m_idLayerRail3d);
|
|
|
|
//add by xlc on 080715
|
|
if(nVer<4)
|
|
{
|
|
//左右边梁与Tarch8内外边梁转化
|
|
BOOL bInSideBeam=((m_nFlagEx&SFEX_LBEAM)!=0);
|
|
BOOL bOutSideBeam=((m_nFlagEx&SFEX_RBEAM)!=0);
|
|
if(m_nStartSide==0)
|
|
{
|
|
bInSideBeam=((m_nFlagEx&SFEX_RBEAM)!=0);
|
|
bOutSideBeam=((m_nFlagEx&SFEX_LBEAM)!=0);
|
|
}
|
|
SetInSideBeam(bInSideBeam);
|
|
SetOutSideBeam(bOutSideBeam);
|
|
|
|
SetShowSlab(TRUE);
|
|
SetArrow(FALSE); //不标箭头
|
|
SetConnectRail(TRUE); //扶手连接
|
|
if(m_nStairFlag==SF_FIRST)
|
|
{
|
|
m_nRailDist=-m_nStepWidth*0.5;
|
|
}
|
|
|
|
m_nSlabSize1=m_nSlabSize2=m_nSlabSize;
|
|
}
|
|
} else {
|
|
m_idLayerHand3d = InitLayer(LAY_HANDRAIL, FALSE); // 与TArch5兼容
|
|
|
|
//modify by xlc on 090525 打开T5图平台不显示,扶手不连接
|
|
SetShowSlab(TRUE);
|
|
SetArrow(FALSE); //不标箭头
|
|
SetConnectRail(TRUE); //扶手连接
|
|
}
|
|
if(nVer>2) {
|
|
pFiler->readItem(&m_lSectPos);
|
|
pFiler->readItem(&m_rSectPos);
|
|
pFiler->readItem(&m_nViewCtrl);
|
|
|
|
//add by xlc on 080715
|
|
if(nVer<4) //剖切线与Tarch8转化
|
|
{
|
|
XPoint ptSectLeft2d,ptSectRight2d;
|
|
int nHitLeft=HitTestSectPos(0, ptSectLeft2d),
|
|
nHitRight=HitTestSectPos(1, ptSectRight2d);
|
|
if(nHitLeft == nHitRight && nHitLeft != 0)
|
|
{
|
|
if(!IsManualSectPos())
|
|
{
|
|
m_dSectElev=0.5*m_nStepHeight*m_nStepNum1;
|
|
}
|
|
else
|
|
{
|
|
m_dSectElev=(m_lSectPos+m_rSectPos)*0.5;
|
|
}
|
|
|
|
m_dSectRotation=CT_std_angle(ads_angle(ptSectRight2d, ptSectLeft2d)-m_nRotation);
|
|
}
|
|
}
|
|
} else {
|
|
m_lSectPos=m_rSectPos=0.0;
|
|
m_nViewCtrl=0; //自动确定
|
|
}
|
|
//Tarch8
|
|
if(nVer>3)
|
|
{
|
|
pFiler->readItem(&m_nRailDistMid); //层间转角处扶手伸出距离
|
|
pFiler->readItem(&m_nRailDist); //层与层连接处扶手伸出距离
|
|
pFiler->readItem(&m_dSectElev); //剖切高度
|
|
pFiler->readItem(&m_dSectRotation); //剖断转角
|
|
pFiler->readItem(&m_dTextHeight); //字高
|
|
pFiler->readItem(&m_nSlabSize1); //一跑一侧休息平台尺寸
|
|
pFiler->readItem(&m_nSlabSize2); //二跑一侧休息平台尺寸
|
|
pFiler->readItem(&m_dSlopeLength1); //一跑坡道长
|
|
pFiler->readItem(&m_dSlopeLength2); //二跑坡道长
|
|
pFiler->readItem(&m_idLayerText);
|
|
pFiler->readItem(&m_idTextStyle);
|
|
pFiler->readItem(&m_idLayerArrow);
|
|
}
|
|
else
|
|
{
|
|
m_dTextHeight = 3.5; //字高
|
|
}
|
|
if(g_nSaveTArchVer>10 && nVer>4)//20v3
|
|
{
|
|
pFiler->readItem(&m_nEvaRadiusColor);
|
|
}
|
|
else
|
|
{
|
|
m_nEvaRadiusColor = 9;
|
|
}
|
|
return pFiler->filerStatus();
|
|
}
|
|
|
|
Acad::ErrorStatus
|
|
TDbRectStair::dwgOutFields(AcDbDwgFiler* pFiler) const
|
|
{
|
|
assertReadEnabled();
|
|
Acad::ErrorStatus es = TDbPolyPathEnt::dwgOutFields(pFiler);
|
|
if(es != Acad::eOk) return es;
|
|
|
|
if(g_nSaveTArchVer==5)
|
|
pFiler->writeItem((Adesk::UInt8)1);
|
|
else if(g_nSaveTArchVer==6||g_nSaveTArchVer==7)
|
|
pFiler->writeItem((Adesk::UInt8)3);
|
|
else if(g_nSaveTArchVer > 7 && g_nSaveTArchVer < 11)
|
|
pFiler->writeItem((Adesk::UInt8)4);
|
|
else
|
|
pFiler->writeItem(g_nVersion);
|
|
pFiler->writeItem((AcGePoint3d &)m_ptLocation);
|
|
pFiler->writeItem(m_nRotation); //旋转角度
|
|
pFiler->writeItem(m_nStepHeight); //踏步高
|
|
pFiler->writeItem(m_nStepWidth); //踏步宽
|
|
pFiler->writeItem(m_nStairWidth); //梯段宽
|
|
pFiler->writeItem(m_nSlabSize); //休息平台尺寸
|
|
pFiler->writeItem(m_nStepNum1);
|
|
pFiler->writeItem(m_nStepNum2); //一跑和二跑步数
|
|
pFiler->writeItem(m_nSpaceWidth);
|
|
pFiler->writeItem(m_nRailHeight); //楼梯间尺寸
|
|
pFiler->writeItem(m_nStairFlag); //楼层标记
|
|
pFiler->writeItem(m_nStartSide); //起步的一侧
|
|
pFiler->writeItem(m_nAlignment); //踏步取齐: 0--齐休息平台, 1--齐中间, 2--齐楼板
|
|
|
|
pFiler->writeItem(m_nRailWidth);
|
|
pFiler->writeItem(m_nRailDistToSide);
|
|
|
|
// TArch6
|
|
if(g_nSaveTArchVer>5) {
|
|
//add by xlc on 080715
|
|
if(g_nSaveTArchVer<8) //左右边梁与Tarch8内外边梁转化
|
|
{
|
|
BOOL bLBeam=((m_nFlagEx&SFEX_INSIDEBEAM)!=0);
|
|
BOOL bRBeam=((m_nFlagEx&SFEX_OUTSIDEBEAM)!=0);
|
|
if(m_nStartSide==0)
|
|
{
|
|
bLBeam=((m_nFlagEx&SFEX_OUTSIDEBEAM)!=0);
|
|
bRBeam=((m_nFlagEx&SFEX_INSIDEBEAM)!=0);
|
|
}
|
|
Adesk::UInt32 nFlagEx=m_nFlagEx;
|
|
if(bLBeam)
|
|
nFlagEx |= SFEX_LBEAM;
|
|
else
|
|
nFlagEx &= ~SFEX_LBEAM;
|
|
if(bRBeam)
|
|
nFlagEx |= SFEX_RBEAM;
|
|
else
|
|
nFlagEx &= ~SFEX_RBEAM;
|
|
|
|
//add by xlc on 090218
|
|
nFlagEx |= SFEX_SECTPOS;
|
|
|
|
pFiler->writeItem(nFlagEx);
|
|
}
|
|
else
|
|
{
|
|
//modify by xlc on 090218
|
|
Adesk::UInt32 nFlagEx=m_nFlagEx;
|
|
nFlagEx |= SFEX_SECTPOS;
|
|
pFiler->writeItem(nFlagEx);
|
|
}
|
|
|
|
pFiler->writeItem(m_nBeamHeight);
|
|
pFiler->writeItem(m_nBeamThick);
|
|
pFiler->writeItem(m_nSlabThick);
|
|
pFiler->writeItem(m_idLayerHand3d);
|
|
pFiler->writeItem(m_idLayerStep3d);
|
|
pFiler->writeItem(m_idLayerBeam3d);
|
|
pFiler->writeItem(m_idLayerRail3d);
|
|
|
|
// pFiler->writeItem(m_lSectPos);
|
|
// pFiler->writeItem(m_rSectPos);
|
|
if(IsManualSectPos())
|
|
{
|
|
double lSectPos,rSectPos;
|
|
XPoint ptLeft2d,ptRight2d;
|
|
BOOL bSect=CalSectPos(lSectPos,rSectPos,ptLeft2d,ptRight2d);
|
|
int nSectStair=GetSectStairPos();
|
|
if(bSect)
|
|
{
|
|
double stairHeight1=GetStepHeight()*GetStepNum1(),
|
|
stairHeight2=GetStepHeight()*GetStepNum2();
|
|
if(nSectStair==0)
|
|
{
|
|
lSectPos=lSectPos*(stairHeight1-(IsAscent()?0:GetStepHeight()));
|
|
rSectPos=rSectPos*(stairHeight1-(IsAscent()?0:GetStepHeight()));
|
|
}
|
|
else if(nSectStair==1)
|
|
{
|
|
lSectPos=lSectPos*(stairHeight2-(IsAscent()?0:GetStepHeight()))+stairHeight1;
|
|
rSectPos=rSectPos*(stairHeight2-(IsAscent()?0:GetStepHeight()))+stairHeight1;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
lSectPos=m_lSectPos;
|
|
rSectPos=m_rSectPos;
|
|
}
|
|
pFiler->writeItem(lSectPos);
|
|
pFiler->writeItem(rSectPos);
|
|
}
|
|
else
|
|
{
|
|
//modify by xlc on 090305
|
|
//pFiler->writeItem(0);
|
|
//pFiler->writeItem(0);
|
|
double dVal=0;
|
|
pFiler->writeItem(dVal);
|
|
pFiler->writeItem(dVal);
|
|
}
|
|
|
|
pFiler->writeItem(m_nViewCtrl);
|
|
}
|
|
|
|
//Tarch8
|
|
if(g_nSaveTArchVer>7)
|
|
{
|
|
pFiler->writeItem(m_nRailDistMid); //层间转角处扶手伸出距离
|
|
pFiler->writeItem(m_nRailDist); //层与层连接处扶手伸出距离
|
|
pFiler->writeItem(m_dSectElev); //剖切高度
|
|
pFiler->writeItem(m_dSectRotation); //剖断转角
|
|
pFiler->writeItem(m_dTextHeight); //字高
|
|
pFiler->writeItem(m_nSlabSize1); //一跑一侧休息平台尺寸
|
|
pFiler->writeItem(m_nSlabSize2); //二跑一侧休息平台尺寸
|
|
pFiler->writeItem(m_dSlopeLength1); //一跑坡道长
|
|
pFiler->writeItem(m_dSlopeLength2); //二跑坡道长
|
|
pFiler->writeItem(m_idLayerText);
|
|
pFiler->writeItem(m_idTextStyle);
|
|
pFiler->writeItem(m_idLayerArrow);
|
|
}
|
|
if (g_nSaveTArchVer>10 && g_nVersion > 4)//20V3
|
|
{
|
|
pFiler->writeItem(m_nEvaRadiusColor);
|
|
}
|
|
return pFiler->filerStatus();
|
|
}
|
|
|
|
|
|
Acad::ErrorStatus
|
|
TDbRectStair::dxfInFields (AcDbDxfFiler* pFiler)
|
|
{
|
|
assertWriteEnabled();
|
|
|
|
Acad::ErrorStatus es = TDbPolyPathEnt::dxfInFields(pFiler);
|
|
if(es!=Acad::eOk)
|
|
return es;
|
|
|
|
if (!pFiler->atSubclassData(_T("TDbRectStair"))) {
|
|
return Acad::eBadDxfSequence;
|
|
}
|
|
|
|
Adesk::Int32 fieldsFlags=0;
|
|
resbuf rb;
|
|
double r1, r2, r3, r4, r5, r6, r7, r8, r9;
|
|
int i1, i2, i3, i4, i5;
|
|
XPoint pt;
|
|
while ((es == Acad::eOk)
|
|
&& ((es = pFiler->readResBuf(&rb)) == Acad::eOk)) {
|
|
switch (rb.restype) {
|
|
case AcDb::kDxfXCoord:
|
|
pt=rb.resval.rpoint;
|
|
fieldsFlags |= 0x01;
|
|
break;
|
|
case AcDb::kDxfReal:
|
|
r1=rb.resval.rreal;
|
|
fieldsFlags |= 0x02;
|
|
break;
|
|
case AcDb::kDxfReal+1:
|
|
r2=rb.resval.rreal;
|
|
fieldsFlags |= 0x04;
|
|
break;
|
|
case AcDb::kDxfReal+2:
|
|
r3=rb.resval.rreal;
|
|
fieldsFlags |= 0x08;
|
|
break;
|
|
case AcDb::kDxfReal+3:
|
|
r4=rb.resval.rreal;
|
|
fieldsFlags |= 0x10;
|
|
break;
|
|
case AcDb::kDxfReal+4:
|
|
r5=rb.resval.rreal;
|
|
fieldsFlags |= 0x20;
|
|
break;
|
|
case AcDb::kDxfReal+5:
|
|
r6=rb.resval.rreal;
|
|
fieldsFlags |= 0x40;
|
|
break;
|
|
case AcDb::kDxfReal+6:
|
|
r7=rb.resval.rreal;
|
|
fieldsFlags |= 0x80;
|
|
break;
|
|
case AcDb::kDxfReal+7:
|
|
r8=rb.resval.rreal;
|
|
fieldsFlags |= 0x100;
|
|
break;
|
|
case AcDb::kDxfAngle:
|
|
r9 = rb.resval.rreal;
|
|
fieldsFlags |= 0x200;
|
|
break;
|
|
case AcDb::kDxfInt16:
|
|
i1=rb.resval.rint;
|
|
fieldsFlags |= 0x400;
|
|
break;
|
|
case AcDb::kDxfInt16+1:
|
|
i2=rb.resval.rint;
|
|
fieldsFlags |= 0x800;
|
|
break;
|
|
case AcDb::kDxfInt16+2:
|
|
i3=rb.resval.rint;
|
|
fieldsFlags |= 0x1000;
|
|
break;
|
|
case AcDb::kDxfInt16+3:
|
|
i4=rb.resval.rint;
|
|
fieldsFlags |= 0x400;
|
|
break;
|
|
case AcDb::kDxfInt16+4:
|
|
i5=rb.resval.rint;
|
|
fieldsFlags |= 0x400;
|
|
break;
|
|
//TArch6
|
|
case 75:
|
|
m_nViewCtrl=(Adesk::UInt8)rb.resval.rint;
|
|
break;
|
|
case 90:
|
|
m_nFlagEx=rb.resval.rlong;
|
|
break;
|
|
case 141:
|
|
m_lSectPos=rb.resval.rreal;
|
|
break;
|
|
case 142:
|
|
m_rSectPos=rb.resval.rreal;
|
|
break;
|
|
case 145:
|
|
m_nBeamHeight=rb.resval.rreal;
|
|
break;
|
|
case 146:
|
|
m_nBeamThick=rb.resval.rreal;
|
|
break;
|
|
case 147:
|
|
m_nSlabThick=rb.resval.rreal;
|
|
break;
|
|
case 412:
|
|
m_idLayerStep3d=GetLayerIdFromString(rb.resval.rstring, database());
|
|
free(rb.resval.rstring);
|
|
break;
|
|
case 413:
|
|
m_idLayerBeam3d=GetLayerIdFromString(rb.resval.rstring, database());
|
|
free(rb.resval.rstring);
|
|
break;
|
|
case 414:
|
|
m_idLayerHand3d=GetLayerIdFromString(rb.resval.rstring, database());
|
|
free(rb.resval.rstring);
|
|
break;
|
|
case 415:
|
|
m_idLayerRail3d=GetLayerIdFromString(rb.resval.rstring, database());
|
|
free(rb.resval.rstring);
|
|
break;
|
|
|
|
//Tarch8
|
|
case AcDb::kDxfReal+8:
|
|
m_nSlabSize2=rb.resval.rreal;
|
|
break;
|
|
case AcDb::kDxfReal+9:
|
|
m_nRailDistMid=rb.resval.rreal;
|
|
break;
|
|
case AcDb::kDxfReal+11:
|
|
m_nRailDist=rb.resval.rreal;
|
|
break;
|
|
case AcDb::kDxfReal+12:
|
|
m_dTextHeight=rb.resval.rreal;
|
|
break;
|
|
case AcDb::kDxfReal+13:
|
|
m_dSectRotation=rb.resval.rreal;
|
|
break;
|
|
case AcDb::kDxfReal+14:
|
|
m_dSectElev=rb.resval.rreal;
|
|
break;
|
|
case 416:
|
|
m_idLayerText=GetLayerIdFromString(rb.resval.rstring, database());
|
|
free(rb.resval.rstring);
|
|
break;
|
|
case 417:
|
|
m_idTextStyle=GetLayerIdFromString(rb.resval.rstring, database());
|
|
free(rb.resval.rstring);
|
|
break;
|
|
case 418:
|
|
m_idLayerArrow=GetLayerIdFromString(rb.resval.rstring, database());
|
|
free(rb.resval.rstring);
|
|
break;
|
|
|
|
//fall through intentional
|
|
default:
|
|
// An unrecognized group. Push it back so that
|
|
// the subclass can read it again.
|
|
pFiler->pushBackItem();
|
|
es = Acad::eEndOfFile;
|
|
break;
|
|
}
|
|
}
|
|
|
|
// At this point the es variable must contain eEndOfFile
|
|
// - either from readResBuf() or from pushback. If not,
|
|
// it indicates that an error happened and we should
|
|
// return immediately.
|
|
//
|
|
if (es != Acad::eEndOfFile)
|
|
return Acad::eInvalidResBuf;
|
|
|
|
if (!(fieldsFlags&0x01)) {
|
|
pFiler->setError(Acad::eMissingDxfField, _T("\nMissing DXF group code: 10"));
|
|
return Acad::eMissingDxfField;
|
|
}
|
|
if (!(fieldsFlags&0x02)) {
|
|
pFiler->setError(Acad::eMissingDxfField, _T("\nMissing DXF group code: 40"));
|
|
return Acad::eMissingDxfField;
|
|
}
|
|
if (!(fieldsFlags&0x04)) {
|
|
pFiler->setError(Acad::eMissingDxfField, _T("\nMissing DXF group code: 41"));
|
|
return Acad::eMissingDxfField;
|
|
}
|
|
if (!(fieldsFlags&0x08)) {
|
|
pFiler->setError(Acad::eMissingDxfField, _T("\nMissing DXF group code: 42"));
|
|
return Acad::eMissingDxfField;
|
|
}
|
|
if (!(fieldsFlags&0x10)) {
|
|
pFiler->setError(Acad::eMissingDxfField, _T("\nMissing DXF group code: 43"));
|
|
return Acad::eMissingDxfField;
|
|
}
|
|
if (!(fieldsFlags&0x20)) {
|
|
pFiler->setError(Acad::eMissingDxfField, _T("\nMissing DXF group code: 44"));
|
|
return Acad::eMissingDxfField;
|
|
}
|
|
if (!(fieldsFlags&0x800)) {
|
|
pFiler->setError(Acad::eMissingDxfField, _T("\nMissing DXF group code: 71"));
|
|
return Acad::eMissingDxfField;
|
|
}
|
|
if (!(fieldsFlags&0x1000)) {
|
|
pFiler->setError(Acad::eMissingDxfField, _T("\nMissing DXF group code: 72"));
|
|
return Acad::eMissingDxfField;
|
|
}
|
|
|
|
m_ptLocation=pt;
|
|
SetStepHeight(r1);
|
|
SetSpaceWidth(r2);
|
|
SetSlabSize(r3);
|
|
SetStepWidth(r4);
|
|
SetStairWidth(r5);
|
|
|
|
if(fieldsFlags&0x40)
|
|
SetRailHeight(r6);
|
|
if(fieldsFlags&0x80)
|
|
SetRailWidth(r7);
|
|
if(fieldsFlags&0x100)
|
|
SetRailDistToSide(r8);
|
|
if(fieldsFlags&0x200)
|
|
SetRotation(r9);
|
|
if(fieldsFlags&0x400)
|
|
SetStairFlag(i1);
|
|
SetStepNum1(i2);
|
|
SetStepNum2(i3);
|
|
m_nStartSide=i4;
|
|
m_nAlignment=i5;
|
|
|
|
return pFiler->filerStatus();
|
|
}
|
|
|
|
Acad::ErrorStatus
|
|
TDbRectStair::dxfOutFields(AcDbDxfFiler* pFiler) const
|
|
{
|
|
assertReadEnabled();
|
|
Acad::ErrorStatus es;
|
|
|
|
es = TDbPolyPathEnt::dxfOutFields(pFiler);
|
|
assert(es == Acad::eOk);
|
|
|
|
es = pFiler->writeItem(AcDb::kDxfSubclass,_T("TDbRectStair"));
|
|
assert(es == Acad::eOk);
|
|
|
|
pFiler->writePoint3d(AcDb::kDxfXCoord, m_ptLocation);
|
|
pFiler->writeDouble(AcDb::kDxfReal, GetStepHeight());
|
|
pFiler->writeDouble(AcDb::kDxfReal+1, GetSpaceWidth());
|
|
pFiler->writeDouble(AcDb::kDxfReal+2, GetSlabSize());
|
|
pFiler->writeDouble(AcDb::kDxfReal+3, GetStepWidth());
|
|
pFiler->writeDouble(AcDb::kDxfReal+4, GetStairWidth());
|
|
pFiler->writeDouble(AcDb::kDxfReal+5, GetRailHeight());
|
|
pFiler->writeDouble(AcDb::kDxfReal+6, GetRailWidth());
|
|
pFiler->writeDouble(AcDb::kDxfReal+7, GetRailDistToSide());
|
|
pFiler->writeDouble(AcDb::kDxfAngle, GetRotation());
|
|
pFiler->writeInt16(AcDb::kDxfInt16, GetStairFlag());
|
|
pFiler->writeInt16(AcDb::kDxfInt16+1, GetStepNum1());
|
|
pFiler->writeInt16(AcDb::kDxfInt16+2, GetStepNum2());
|
|
pFiler->writeInt16(AcDb::kDxfInt16+3, m_nStartSide);
|
|
pFiler->writeInt16(AcDb::kDxfInt16+4, m_nAlignment);
|
|
|
|
pFiler->writeInt16(AcDb::kDxfInt16+5, m_nViewCtrl);
|
|
pFiler->writeInt32(90, m_nFlagEx);
|
|
pFiler->writeDouble(141, m_lSectPos);
|
|
pFiler->writeDouble(142, m_rSectPos);
|
|
pFiler->writeDouble(145, m_nBeamHeight);
|
|
pFiler->writeDouble(146, m_nBeamThick);
|
|
pFiler->writeDouble(147, m_nSlabThick);
|
|
pFiler->writeString(412, (const TCHAR *)LayerId2String(m_idLayerStep3d));
|
|
pFiler->writeString(413, (const TCHAR *)LayerId2String(m_idLayerBeam3d));
|
|
pFiler->writeString(414, (const TCHAR *)LayerId2String(m_idLayerHand3d));
|
|
pFiler->writeString(415, (const TCHAR *)LayerId2String(m_idLayerRail3d));
|
|
|
|
//TArch8
|
|
pFiler->writeDouble(AcDb::kDxfReal+8, GetSlabSize2());
|
|
pFiler->writeDouble(AcDb::kDxfReal+9, GetRailDistMid());
|
|
pFiler->writeDouble(AcDb::kDxfReal+11, GetRailDist());
|
|
pFiler->writeDouble(AcDb::kDxfReal+12, GetTextHeight());
|
|
pFiler->writeDouble(AcDb::kDxfReal+13, GetSectRotation());
|
|
pFiler->writeDouble(AcDb::kDxfReal+14, GetSectElev());
|
|
pFiler->writeString(416, (const TCHAR *)LayerId2String(m_idLayerText));
|
|
pFiler->writeString(417, (const TCHAR *)LayerId2String(m_idTextStyle));
|
|
pFiler->writeString(418, (const TCHAR *)LayerId2String(m_idLayerArrow));
|
|
|
|
|
|
return pFiler->filerStatus();
|
|
}
|
|
|
|
|
|
Acad::ErrorStatus
|
|
TDbRectStair::subGetGripPoints(AcGePoint3dArray& gripPoints,
|
|
AcDbIntArray& osnapModes,
|
|
AcDbIntArray& geomIds) const
|
|
{
|
|
assertReadEnabled();
|
|
XPoint ptUpLeft=GetUpLeft2d(), ptUpRight=GetUpRight2d();
|
|
// 0,1--移动
|
|
gripPoints.append(ptUpLeft);
|
|
gripPoints.append(ptUpRight);
|
|
// 2,3--楼梯间
|
|
XPoint ptLeft, ptRight;
|
|
double nDist1=GetSlabSize1()+(m_nStepNum1-(IsAscent()?0:1))*m_nStepWidth/2.0,
|
|
nDist2=GetSlabSize2()+(m_nStepNum2-(IsAscent()?0:1))*m_nStepWidth/2.0;
|
|
ads_polar(ptUpLeft, m_nRotation-PI/2.0, (m_nStartSide==OFFSET_LEFT)?nDist1:nDist2, ptLeft);
|
|
ads_polar(ptUpRight, m_nRotation-PI/2.0, (m_nStartSide==OFFSET_LEFT)?nDist2:nDist1, ptRight);
|
|
gripPoints.append(ptLeft);
|
|
gripPoints.append(ptRight);
|
|
// 4,5--楼梯宽度
|
|
XPoint ptLeft1, ptRight1;
|
|
ads_polar(ptLeft, m_nRotation, GetStairWidth(), ptLeft1);
|
|
ads_polar(ptRight, m_nRotation+PI, GetStairWidth(), ptRight1);
|
|
gripPoints.append(ptLeft1);
|
|
gripPoints.append(ptRight1);
|
|
|
|
// 6--休息平台
|
|
Midpoint(ptUpLeft,ptUpRight,ptLeft1);
|
|
gripPoints.append(ptLeft1);
|
|
|
|
// 7,8--梯段位置
|
|
XPoint ptSlabLeft, ptSlabRight;
|
|
if(m_nStartSide==OFFSET_LEFT)
|
|
{
|
|
ads_polar(ptUpLeft, m_nRotation-PI/2.0, GetSlabSize1(), ptSlabLeft);
|
|
ads_polar(ptUpRight, m_nRotation-PI/2.0, GetSlabSize2(), ptSlabRight);
|
|
}
|
|
else
|
|
{
|
|
ads_polar(ptUpRight, m_nRotation-PI/2.0, GetSlabSize1(), ptSlabLeft);
|
|
ads_polar(ptUpLeft, m_nRotation-PI/2.0, GetSlabSize2(), ptSlabRight);
|
|
}
|
|
gripPoints.append(ptSlabLeft);
|
|
gripPoints.append(ptSlabRight);
|
|
|
|
XPoint ptTmp;
|
|
// 9--休息平台段扶手伸出距离
|
|
ads_polar(ptUpLeft, m_nRotation-PI/2, min(GetSlabSize1(),GetSlabSize2())-m_nRailDistMid, ptTmp);
|
|
ads_polar(ptTmp, m_nRotation, m_nSpaceWidth*0.5, ptTmp);
|
|
gripPoints.append(ptTmp);
|
|
|
|
double dLen1=GetSlabSize1()+(m_nStepNum1-(IsAscent()?0:1))*m_nStepWidth,
|
|
dLen2=GetSlabSize2()+(m_nStepNum2-(IsAscent()?0:1))*m_nStepWidth;
|
|
// 10--楼层连接段扶手伸出距离
|
|
ads_polar(ptUpLeft, m_nRotation-PI/2, m_nRailDist+max(dLen1,dLen2), ptTmp);
|
|
ads_polar(ptTmp, m_nRotation, m_nSpaceWidth*0.5, ptTmp);
|
|
gripPoints.append(ptTmp);
|
|
|
|
//if(IsManualSectPos())
|
|
{ //剖切线
|
|
/*XPoint ptLeft, ptRight;
|
|
int nHit1=HitTestSectPos(0, ptLeft);
|
|
int nHit2=HitTestSectPos(1, ptRight);
|
|
if(nHit1 && nHit2) {
|
|
gripPoints.append(ptLeft);
|
|
gripPoints.append(ptRight);
|
|
}*/
|
|
XPoint ptLeft, ptRight;
|
|
double lSectPos,rSectPos;
|
|
if(CalSectPos(lSectPos,rSectPos,ptLeft,ptRight))
|
|
{
|
|
gripPoints.append(ptLeft);
|
|
gripPoints.append(ptRight);
|
|
XPoint ptMid;
|
|
Midpoint(ptLeft,ptRight,ptMid);
|
|
gripPoints.append(ptMid);
|
|
}
|
|
}
|
|
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus
|
|
TDbRectStair::subGetStretchPoints(AcGePoint3dArray & stretchPoints) const
|
|
{
|
|
assertReadEnabled();
|
|
XPoint ptUpLeft=GetUpLeft2d();
|
|
stretchPoints.append(ptUpLeft);
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus
|
|
TDbRectStair::GetGripText(int i, CString &cs) const
|
|
{
|
|
switch(i) {
|
|
case 0:
|
|
case 1:
|
|
cs=_T("移动楼梯");
|
|
break;
|
|
case 2:
|
|
case 3:
|
|
cs=_T("改楼梯间宽度");
|
|
break;
|
|
case 4:
|
|
case 5:
|
|
cs=_T("改梯段宽度");
|
|
break;
|
|
case 6:
|
|
cs=_T("改平台宽");
|
|
break;
|
|
case 7:
|
|
cs=_T("改一跑梯段位置");
|
|
break;
|
|
case 8:
|
|
cs=_T("改二跑梯段位置");
|
|
break;
|
|
case 9:
|
|
case 10:
|
|
cs=_T("改扶手伸出距离");
|
|
break;
|
|
case 11:
|
|
case 12:
|
|
cs=_T("移动剖切角度");
|
|
break;
|
|
case 13:
|
|
cs=_T("移动剖切位置");
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
|
|
Acad::ErrorStatus
|
|
TDbRectStair::subTransformBy(const AcGeMatrix3d& xform)
|
|
{
|
|
assertWriteEnabled();
|
|
TDbEntity::subTransformBy(xform);
|
|
XPoint ptX, ptY;
|
|
ads_polar(m_ptLocation, m_nRotation, GetSpaceWidth(), ptX);
|
|
ads_polar(m_ptLocation, m_nRotation+PI/2.0, 1000.0, ptY);
|
|
((AcGePoint3d &)ptX).transformBy(xform);
|
|
((AcGePoint3d &)ptY).transformBy(xform);
|
|
((AcGePoint3d &)m_ptLocation).transformBy(xform);
|
|
double nAng = CT_std_angle(ads_angle(m_ptLocation, ptY)-
|
|
ads_angle(m_ptLocation, ptX));
|
|
if(fabs(nAng-PI*1.5)<_angSnap)
|
|
{
|
|
TchPrivate::Exchange(m_ptLocation, ptX);
|
|
m_nStartSide = !m_nStartSide;
|
|
}
|
|
m_nRotation = ads_angle(m_ptLocation, ptX);
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus
|
|
TDbRectStair::subMoveGripPointsAt(const AcDbIntArray& indices,
|
|
const AcGeVector3d& offset)
|
|
{
|
|
assertWriteEnabled();
|
|
XPoint vtOffset=*(XPoint *)&offset;
|
|
vtOffset.z = 0;
|
|
|
|
double nVtRot=CT_std_angle(ads_angle(XPoint(), vtOffset)-m_nRotation);
|
|
double nIncWidth=ads_distance(XPoint(), vtOffset) * cos(nVtRot);
|
|
double nIncLen=ads_distance(XPoint(), vtOffset) * sin(nVtRot);
|
|
int nLen=indices.length();
|
|
for (int i = 0; i < nLen; i++) {
|
|
int idx = indices[i];
|
|
switch(idx) {
|
|
case 0:
|
|
case 1:
|
|
if(nLen==1) { //Grip
|
|
m_ptLocation += vtOffset;
|
|
}
|
|
break;
|
|
case 2:
|
|
if(m_nSpaceWidth-nIncWidth > _DIST_SNAP && -1.0E-6<m_nSpaceWidth-nIncWidth-2*m_nStairWidth) {
|
|
m_nSpaceWidth -= nIncWidth;
|
|
ads_polar(XPoint(m_ptLocation), m_nRotation, nIncWidth, m_ptLocation);
|
|
}
|
|
else
|
|
{
|
|
ads_polar(XPoint(m_ptLocation), m_nRotation, m_nSpaceWidth-m_nStairWidth*2, m_ptLocation);
|
|
m_nSpaceWidth = m_nStairWidth*2;
|
|
}
|
|
break;
|
|
case 3:
|
|
if(m_nSpaceWidth+nIncWidth > _DIST_SNAP && -1.0E-6<m_nSpaceWidth+nIncWidth-2*m_nStairWidth)
|
|
m_nSpaceWidth += nIncWidth;
|
|
else
|
|
m_nSpaceWidth = m_nStairWidth*2;
|
|
break;
|
|
case 4:
|
|
if(m_nStairWidth+nIncWidth > _DIST_SNAP && -1.0E-6<m_nSpaceWidth-2*(m_nStairWidth+nIncWidth))
|
|
m_nStairWidth += nIncWidth;
|
|
else
|
|
m_nStairWidth = m_nSpaceWidth*0.5;
|
|
break;
|
|
case 5:
|
|
if(m_nStairWidth-nIncWidth > _DIST_SNAP && -1.0E-6<m_nSpaceWidth-2*(m_nStairWidth-nIncWidth))
|
|
m_nStairWidth -= nIncWidth;
|
|
else
|
|
m_nStairWidth = m_nSpaceWidth*0.5;
|
|
break;
|
|
case 6:
|
|
if(GetSlabSize1()+nIncLen>_DIST_SNAP&&GetSlabSize2()+nIncLen>_DIST_SNAP)
|
|
{
|
|
m_nSlabSize1 = GetSlabSize1()+nIncLen;
|
|
m_nSlabSize2 = GetSlabSize2()+nIncLen;
|
|
m_nSlabSize+=nIncLen;
|
|
ads_polar(XPoint(m_ptLocation), m_nRotation+PI*0.5, nIncLen, m_ptLocation);
|
|
}
|
|
else
|
|
{
|
|
double nSize=GetSlabSize1()>GetSlabSize2()?GetSlabSize2():GetSlabSize1();
|
|
m_nSlabSize1 = GetSlabSize1()-nSize;
|
|
m_nSlabSize2 = GetSlabSize2()-nSize;
|
|
m_nSlabSize-=nSize;
|
|
ads_polar(XPoint(m_ptLocation), m_nRotation+PI*0.5, -nSize, m_ptLocation);
|
|
}
|
|
break;
|
|
case 7:
|
|
if(GetSlabSize1()-nIncLen>_DIST_SNAP)
|
|
{
|
|
m_nSlabSize1 = GetSlabSize1()-nIncLen;
|
|
}
|
|
else
|
|
m_nSlabSize1 = 0;
|
|
|
|
//modify xlc on 090702 预览显示不正确
|
|
/*if(GetSlabSize1()<GetSlabSize2())
|
|
{
|
|
m_nSlabSize=m_nSlabSize1;
|
|
}*/
|
|
if(m_nSlabSize1<GetSlabSize2())
|
|
{
|
|
m_nSlabSize=m_nSlabSize1;
|
|
}
|
|
else
|
|
{
|
|
m_nSlabSize=GetSlabSize2();
|
|
}
|
|
m_nAlignment = 3;
|
|
break;
|
|
case 8:
|
|
if(GetSlabSize2()-nIncLen>_DIST_SNAP)
|
|
m_nSlabSize2 = GetSlabSize2()-nIncLen;
|
|
else
|
|
m_nSlabSize2 = 0;
|
|
|
|
//modify xlc on 090702 预览显示不正确
|
|
/*if(GetSlabSize2()<GetSlabSize1())
|
|
{
|
|
m_nSlabSize=m_nSlabSize2;
|
|
}*/
|
|
if(m_nSlabSize2<GetSlabSize1())
|
|
{
|
|
m_nSlabSize=m_nSlabSize2;
|
|
}
|
|
else
|
|
{
|
|
m_nSlabSize=GetSlabSize1();
|
|
}
|
|
m_nAlignment = 3;
|
|
break;
|
|
case 9:
|
|
if(m_nRailDistMid+nIncLen>_DIST_SNAP)
|
|
m_nRailDistMid += nIncLen;
|
|
else
|
|
m_nRailDistMid = 0;
|
|
break;
|
|
case 10:
|
|
if(m_nRailDist-nIncLen>-0.5*(m_nStepNum1>m_nStepNum2?m_nStepNum2:m_nStepNum1)*m_nStepWidth-_DIST_SNAP)
|
|
m_nRailDist -= nIncLen;
|
|
break;
|
|
case 13:
|
|
case 11:
|
|
case 12: //剖切线
|
|
{
|
|
/*
|
|
XPoint ptHit2d;
|
|
if(HitTestSectPos(idx-8, ptHit2d)) {
|
|
if(!IsManualSectPos())
|
|
{
|
|
SetManualSectPos(TRUE);
|
|
SetDefaultSectPos();
|
|
}
|
|
ptHit2d += vtOffset;
|
|
double nHitElev=HitElevationByPoint2d(ptHit2d);
|
|
if(idx-8==0)
|
|
m_lSectPos=nHitElev;
|
|
else
|
|
m_rSectPos=nHitElev;
|
|
}
|
|
*/
|
|
double lSectPos,rSectPos;
|
|
XPoint ptLeft2d,ptRight2d;
|
|
double angle=m_dSectRotation;
|
|
if(CalSectPos(lSectPos,rSectPos,ptLeft2d,ptRight2d))
|
|
{
|
|
XPoint ptMid;
|
|
Midpoint(ptLeft2d,ptRight2d,ptMid);
|
|
if(idx==13)
|
|
{
|
|
XPoint ptHit2d;
|
|
ptHit2d=ptMid;
|
|
ptHit2d += vtOffset;
|
|
double elev=HitElevationByPoint2d(ptHit2d);
|
|
if(elev>_DIST_SNAP)
|
|
m_dSectElev=elev;
|
|
}
|
|
else
|
|
{
|
|
XPoint ptTmp;
|
|
ads_polar(ptMid, m_nRotation, m_nStairWidth, ptTmp);
|
|
AcGeVector3d vectFrom,vectTo;
|
|
vectFrom=ptMid-ptTmp;
|
|
if((idx-11)%2==0)
|
|
{
|
|
ptTmp=ptLeft2d+vtOffset;
|
|
vectTo=ptTmp-ptMid;
|
|
}
|
|
else
|
|
{
|
|
ptTmp=ptRight2d+vtOffset;
|
|
vectTo=ptMid-ptTmp;
|
|
}
|
|
angle=vectFrom.angleTo(vectTo,AcGeVector3d::kZAxis);
|
|
SetSectRotation(angle);
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
return Acad::eOk;
|
|
//return TDbEntity::moveGripPointsAt(indices, offset);
|
|
}
|
|
|
|
Acad::ErrorStatus
|
|
TDbRectStair::subMoveStretchPointsAt(const AcDbIntArray& indices,
|
|
const AcGeVector3d& offset)
|
|
{
|
|
assertWriteEnabled();
|
|
if(indices.length()) {
|
|
AcGeMatrix3d mat;
|
|
mat.setToTranslation(offset);
|
|
subTransformBy(mat);
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
/*
|
|
Acad::ErrorStatus
|
|
TDbRectStair::explode(AcDbVoidPtrArray& entitySet) const
|
|
{
|
|
assertReadEnabled();
|
|
TDbLineStair *stair1=new TDbLineStair, *stair2=new TDbLineStair;
|
|
TDbSlab *slab=new TDbSlab;
|
|
TDbHandRail *rail=new TDbHandRail;
|
|
TDbHandRail *pTopRail=NULL;
|
|
if(m_nStairFlag==SF_TOP)
|
|
pTopRail=new TDbHandRail;
|
|
ExplodeTo(*stair1, *stair2, *slab, *rail, pTopRail);
|
|
|
|
entitySet.append(stair1);
|
|
entitySet.append(stair2);
|
|
entitySet.append(rail);
|
|
if(pTopRail)
|
|
entitySet.append(pTopRail);
|
|
if(m_nStairFlag==SF_TOP || m_nSlabSize<_DIST_SNAP) {
|
|
delete slab;
|
|
} else {
|
|
entitySet.append(slab);
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
*/
|
|
const TCHAR *
|
|
TDbRectStair::GetDefaultLayer() const
|
|
{
|
|
return LAY_STAIR;
|
|
}
|
|
|
|
void
|
|
TDbRectStair::GetTips(DList<TObjInfoUnit> &lstInfo) const
|
|
{
|
|
lstInfo.Append(new TObjInfoUnit(_T("对象类型"), _T("双跑楼梯")));
|
|
lstInfo.Append(new TObjInfoUnit(_T("一跑步数"), XString(_T("%d"), int(GetStepNum1()))));
|
|
lstInfo.Append(new TObjInfoUnit(_T("二跑步数"), XString(_T("%d"), int(GetStepNum2()))));
|
|
lstInfo.Append(new TObjInfoUnit(_T("踏步高"), Dist2Str(GetStepHeight())));
|
|
lstInfo.Append(new TObjInfoUnit(_T("踏步宽"), Dist2Str(GetStepWidth())));
|
|
lstInfo.Append(new TObjInfoUnit(_T("楼梯高"), Dist2Str(GetStepHeight()*(GetStepNum1()+GetStepNum2()))));
|
|
lstInfo.Append(new TObjInfoUnit(_T("梯段宽"), Dist2Str(GetStairWidth())));
|
|
lstInfo.Append(new TObjInfoUnit(_T("梯间宽"), Dist2Str(GetSpaceWidth())));
|
|
lstInfo.Append(new TObjInfoUnit(_T("扶手宽"), Dist2Str(GetRailWidth())));
|
|
lstInfo.Append(new TObjInfoUnit(_T("扶手边距"), Dist2Str(GetRailDistToSide())));
|
|
lstInfo.Append(new TObjInfoUnit(_T("平台宽"), Dist2Str(GetSlabSize())));
|
|
lstInfo.Append(new TObjInfoUnit(_T("底标高"), Dist2Str(GetElevation())));
|
|
|
|
const TCHAR *pszFloor=_T("中间层");
|
|
if(m_nStairFlag==0)
|
|
pszFloor=_T("首层");
|
|
else if(m_nStairFlag==2)
|
|
pszFloor=_T("顶层");
|
|
lstInfo.Append(new TObjInfoUnit(_T("楼层标记"), pszFloor));
|
|
const TCHAR *pszStep=_T("齐平台");
|
|
if(m_nAlignment==1)
|
|
pszStep=_T("齐中间");
|
|
else if(m_nAlignment==2)
|
|
pszStep=_T("齐楼板");
|
|
else
|
|
pszStep=_T("自由");
|
|
lstInfo.Append(new TObjInfoUnit(_T("踏步取齐"), pszStep));
|
|
lstInfo.Append(new TObjInfoUnit(_T("上楼位置"), m_nStartSide? _T("右边") : _T("左边")));
|
|
|
|
/*
|
|
lstInfo.Append(new TObjInfoUnit(_T("左边梁"), GetSideBeam(OFFSET_LEFT)? _T("有") : _T("无")));
|
|
lstInfo.Append(new TObjInfoUnit(_T("右边梁"), GetSideBeam(OFFSET_RIGHT)? _T("有") : _T("无")));
|
|
lstInfo.Append(new TObjInfoUnit(_T("需要2D"), Get2DFlag()? _T("是") : _T("否")));
|
|
lstInfo.Append(new TObjInfoUnit(_T("需要3D"), Get3DFlag()? _T("是") : _T("否")));
|
|
*/
|
|
|
|
}
|
|
|
|
|
|
Acad::ErrorStatus
|
|
TDbRectStair::ExplodeTo(TDbLineStair &stair1, TDbLineStair &stair2,
|
|
TDbSlab &slab, TDbHandRail &rail, TDbHandRail *rail1, TDbHandRail *rail2,
|
|
TDbHandRail *pRailTop,TDbHandRail* pRailOut1,TDbHandRail*pRailOut2) const
|
|
{
|
|
assertReadEnabled();
|
|
XPoint ptUpLeft=GetUpLeft2d(),
|
|
ptUpRight=GetUpRight2d();
|
|
XPoint ptLowLeft, ptLowRight; //休息平台板的顶点
|
|
double nLen1=(IsAscent()? m_nStepNum1 : (m_nStepNum1-1))*m_nStepWidth,
|
|
nLen2=(IsAscent()? m_nStepNum2 : (m_nStepNum2-1))*m_nStepWidth;
|
|
|
|
//modify by xlc on 080725 增加调整梯段位置功能
|
|
/*if(fabs(nLen1-nLen2)>_DIST_SNAP)
|
|
{
|
|
if(m_nAlignment==0)
|
|
{
|
|
ads_polar(ptUpLeft, m_nRotation-PI/2, m_nSlabSize, ptLowLeft);
|
|
ads_polar(ptUpRight, m_nRotation-PI/2, m_nSlabSize, ptLowRight);
|
|
}
|
|
else
|
|
{
|
|
double nTemp=(m_nAlignment==1)? 2.0 : 1.0;
|
|
if(nLen1>nLen2)
|
|
{
|
|
if(m_nStartSide==OFFSET_LEFT)
|
|
{
|
|
ads_polar(ptUpLeft, m_nRotation-PI/2, m_nSlabSize, ptLowLeft);
|
|
ads_polar(ptUpRight,m_nRotation-PI/2, m_nSlabSize+(nLen1-nLen2)/nTemp, ptLowRight);
|
|
}
|
|
else
|
|
{
|
|
ads_polar(ptUpLeft, m_nRotation-PI/2, m_nSlabSize+(nLen1-nLen2)/nTemp, ptLowLeft);
|
|
ads_polar(ptUpRight,m_nRotation-PI/2, m_nSlabSize, ptLowRight);
|
|
}
|
|
} else
|
|
{ //二跑大于一跑
|
|
if(m_nStartSide==OFFSET_LEFT)
|
|
{
|
|
ads_polar(ptUpLeft, m_nRotation-PI/2, m_nSlabSize+(nLen2-nLen1)/nTemp, ptLowLeft);
|
|
ads_polar(ptUpRight,m_nRotation-PI/2, m_nSlabSize, ptLowRight);
|
|
} else {
|
|
ads_polar(ptUpLeft, m_nRotation-PI/2, m_nSlabSize, ptLowLeft);
|
|
ads_polar(ptUpRight,m_nRotation-PI/2, m_nSlabSize+(nLen2-nLen1)/nTemp, ptLowRight);
|
|
}
|
|
}
|
|
}
|
|
} else
|
|
{
|
|
ads_polar(ptUpLeft, m_nRotation-PI/2.0, m_nSlabSize, ptLowLeft);
|
|
ads_polar(ptUpRight, m_nRotation-PI/2.0, m_nSlabSize, ptLowRight);
|
|
}*/
|
|
|
|
|
|
double nLenSide1=nLen1+GetSlabSize1(),nLenSide2=nLen2+GetSlabSize2(); //梯段与平台总长,判断是否齐楼板
|
|
|
|
if(m_nStartSide==OFFSET_LEFT)
|
|
{
|
|
ads_polar(ptUpLeft, m_nRotation-PI/2.0, GetSlabSize1(), ptLowLeft);
|
|
ads_polar(ptUpRight, m_nRotation-PI/2.0, GetSlabSize2(), ptLowRight);
|
|
}
|
|
else
|
|
{
|
|
ads_polar(ptUpLeft, m_nRotation-PI/2.0, GetSlabSize2(), ptLowLeft);
|
|
ads_polar(ptUpRight, m_nRotation-PI/2.0, GetSlabSize1(), ptLowRight);
|
|
}
|
|
|
|
stair1.SetStairWidth(m_nStairWidth);
|
|
stair2.SetStairWidth(m_nStairWidth);
|
|
stair1.SetStepHeight(m_nStepHeight);
|
|
stair2.SetStepHeight(m_nStepHeight);
|
|
stair1.SetStepWidth(m_nStepWidth);
|
|
stair2.SetStepWidth(m_nStepWidth);
|
|
stair1.SetStepNum(m_nStepNum1);
|
|
stair2.SetStepNum(m_nStepNum2);
|
|
stair1.SetRotation(m_nRotation);
|
|
stair2.SetRotation(CT_std_angle(m_nRotation+PI));
|
|
stair1.SetOnGround(IsOnGround());
|
|
stair2.SetOnGround(IsOnGround());
|
|
stair1.SetAscent(IsAscent());
|
|
stair2.SetAscent(IsAscent());
|
|
stair1.SetSlant(HasSlant());
|
|
stair2.SetSlant(HasSlant());
|
|
|
|
XPoint ptLoc1, ptLoc2;
|
|
if(m_nStartSide==OFFSET_LEFT)
|
|
{
|
|
ads_polar(ptLowLeft, m_nRotation-PI/2, nLen1, ptLoc1);
|
|
ptLoc2=ptLowRight;
|
|
}
|
|
else
|
|
{
|
|
XPoint ptTemp;
|
|
ads_polar(ptLowRight, m_nRotation-PI/2, nLen1, ptTemp);
|
|
ads_polar(ptTemp, m_nRotation+PI, m_nStairWidth, ptLoc1);
|
|
ads_polar(ptLowLeft, m_nRotation, m_nStairWidth, ptLoc2);
|
|
}
|
|
ptLoc1.z = m_ptLocation.z;
|
|
ptLoc2.z = ptLoc1.z + m_nStepNum1*m_nStepHeight;
|
|
stair1.SetLocation(ptLoc1);
|
|
stair2.SetLocation(ptLoc2);
|
|
|
|
stair1.Set3DFlag(m_nStairFlag==SF_TOP? 0 : SF_HAS3D);
|
|
stair2.Set3DFlag(m_nStairFlag==SF_TOP? 0 : SF_HAS3D);
|
|
|
|
int nSectStair=GetSectStairPos();
|
|
stair1.Set2DFlag(SF_NOSECT);
|
|
stair2.Set2DFlag(SF_NOSECT);
|
|
if(m_nStairFlag==SF_FIRST)
|
|
{
|
|
if(nSectStair==0)
|
|
stair1.Set2DFlag(SF_1SECT);
|
|
else if(nSectStair==1)
|
|
stair2.Set2DFlag(SF_1SECT);
|
|
}
|
|
else if(m_nStairFlag==SF_MIDDLE)
|
|
{
|
|
if(nSectStair==0)
|
|
stair1.Set2DFlag(SF_2SECT);
|
|
else if(nSectStair==1)
|
|
stair2.Set2DFlag(SF_2SECT);
|
|
}
|
|
|
|
// 设置Tarch6新增加的属性
|
|
/*for(int nSide=0; nSide<2; nSide++)
|
|
{
|
|
stair1.SetSideBeam(nSide, HasSideBeam(nSide));
|
|
stair2.SetSideBeam(nSide, HasSideBeam(nSide));
|
|
}*/
|
|
if(m_nStartSide==OFFSET_LEFT)
|
|
{
|
|
stair1.SetSideBeam(0, IsOutSideBeam());
|
|
stair1.SetSideBeam(1, IsInSideBeam());
|
|
stair2.SetSideBeam(0, IsOutSideBeam());
|
|
stair2.SetSideBeam(1, IsInSideBeam());
|
|
}
|
|
else
|
|
{
|
|
stair1.SetSideBeam(1, IsOutSideBeam());
|
|
stair1.SetSideBeam(0, IsInSideBeam());
|
|
stair2.SetSideBeam(1, IsOutSideBeam());
|
|
stair2.SetSideBeam(0, IsInSideBeam());
|
|
}
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
//扶手, 考虑了详图画法
|
|
double nDistToSide=((GetSpaceWidth()-2*GetStairWidth())<_DIST_SNAP*2 &&m_nRailDistToSide<0)?
|
|
_AS_SYS_UNIT(0) : m_nRailDistToSide;
|
|
nDistToSide += m_nRailWidth/2; // ZJQ Modify 2001/9/13
|
|
|
|
//add by xlc on 080626 增加扶手伸出距离
|
|
double nRailDist=m_nRailDist,nRailDistMid=m_nRailDistMid;
|
|
if(IsConnectRail())//扶手有连接时回缩半个扶手宽度
|
|
{
|
|
nRailDist=m_nRailDist-m_nRailWidth*0.5;
|
|
nRailDistMid=m_nRailDistMid-m_nRailWidth*0.5;
|
|
}
|
|
|
|
//扶手伸出距离为负时产生的高差
|
|
double height1=stair1.GetStairHeight(),height=0,width=0;
|
|
if(!IsAscent())
|
|
{
|
|
height1-=m_nStepHeight;
|
|
height=m_nStepHeight*0.5;
|
|
width=m_nStepWidth*0.5;
|
|
}
|
|
double elev1=(nRailDist/nLen1)*height1,
|
|
elev2=(nRailDistMid/nLen1)*height1;
|
|
|
|
XPoly2D polyRail,polyRail1,polyRail2;
|
|
XPoint ptStart;
|
|
if(m_nStairFlag!=SF_TOP)
|
|
{
|
|
//if(m_nStairFlag!=SF_FIRST && nLen2<nLen1-_DIST_SNAP && m_nAlignment!=2)
|
|
if(m_nStairFlag!=SF_FIRST && nLenSide2<nLenSide1-_DIST_SNAP)
|
|
{
|
|
// 踏步不与楼板取齐
|
|
if(m_nStartSide==OFFSET_LEFT)
|
|
{
|
|
ads_polar(ptLoc2, m_nRotation-PI/2, nLen2+nRailDist, ptStart);
|
|
ads_polar(XPoint(ptStart), m_nRotation+PI, m_nStairWidth-nDistToSide, ptStart);
|
|
}
|
|
else
|
|
{
|
|
ads_polar(ptLoc2, m_nRotation-PI/2, nLen2+nRailDist, ptStart);
|
|
ads_polar(XPoint(ptStart), m_nRotation+PI, nDistToSide, ptStart);
|
|
}
|
|
|
|
//ptStart.z = ptLoc1.z;
|
|
if(nRailDist > width+_DIST_SNAP)
|
|
{
|
|
ptStart.z = ptLoc1.z;
|
|
}
|
|
else
|
|
{
|
|
ptStart.z = ptLoc1.z-height+elev1;
|
|
}
|
|
polyRail.AppendNode(ptStart);
|
|
}
|
|
if(m_nStairFlag==SF_MIDDLE)
|
|
{
|
|
//if(nLen2>nLen1+_DIST_SNAP && m_nAlignment!=2)
|
|
if(nLenSide2>nLenSide1+_DIST_SNAP)
|
|
{
|
|
ads_polar(ptLoc2, m_nRotation-PI/2, nLen2+nRailDist, ptStart);
|
|
ads_polar(XPoint(ptStart), m_nRotation+PI,
|
|
m_nStartSide==OFFSET_LEFT? (m_nStairWidth-nDistToSide):nDistToSide, ptStart);
|
|
|
|
//ptStart.z=ptLoc1.z;
|
|
if(nRailDist > width+_DIST_SNAP)
|
|
{
|
|
ptStart.z = ptLoc1.z;
|
|
}
|
|
else
|
|
{
|
|
ptStart.z = ptLoc1.z+height-elev1;
|
|
}
|
|
|
|
polyRail.AppendNode(ptStart);
|
|
ads_polar(ptStart, m_nStartSide==OFFSET_LEFT? m_nRotation+PI : m_nRotation,
|
|
m_nSpaceWidth-2*m_nStairWidth+2*nDistToSide, ptStart);
|
|
polyRail.AppendNode(ptStart);
|
|
if(rail1!=NULL)
|
|
{
|
|
polyRail1.AppendNode(ptStart);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if(m_nStartSide==OFFSET_LEFT)
|
|
ads_polar(ptLoc1, m_nRotation, m_nSpaceWidth-m_nStairWidth+nDistToSide, ptStart);
|
|
else
|
|
ads_polar(ptLoc1, m_nRotation+PI, m_nSpaceWidth-2*m_nStairWidth+nDistToSide, ptStart);
|
|
ads_polar(XPoint(ptStart), m_nRotation-PI/2.0, nRailDist, ptStart);
|
|
if(nRailDist > width+_DIST_SNAP)
|
|
{
|
|
ptStart.z = ptLoc1.z;
|
|
}
|
|
else
|
|
{
|
|
ptStart.z = ptLoc1.z-height+elev1;
|
|
}
|
|
polyRail.AppendNode(ptStart);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
//if(nLen2>nLen1+_DIST_SNAP && m_nAlignment!=2)
|
|
if(nLenSide2>nLenSide1+_DIST_SNAP)
|
|
{
|
|
ads_polar(ptLoc2, m_nRotation-PI/2, nLen2, ptStart);
|
|
ptStart.z = ptLoc1.z+height;
|
|
|
|
ads_polar(XPoint(ptStart), m_nRotation+PI,
|
|
m_nStartSide==OFFSET_LEFT? (m_nStairWidth-nDistToSide):nDistToSide, ptStart);
|
|
ads_polar(ptStart, m_nStartSide==OFFSET_LEFT? m_nRotation+PI : m_nRotation,
|
|
m_nSpaceWidth-2*m_nStairWidth+2*nDistToSide, ptStart);
|
|
if(nRailDist>m_nRailWidth)
|
|
{
|
|
ptStart.z = ptLoc1.z;
|
|
}
|
|
else
|
|
{
|
|
ads_polar(ptStart, m_nRotation-PI*0.5,nRailDist-m_nRailWidth*(IsConnectRail()?0.5:1), ptStart);
|
|
ptStart.z = ptLoc1.z+height-elev1;
|
|
}
|
|
polyRail.AppendNode(ptStart);
|
|
if(rail1!=NULL)
|
|
{
|
|
polyRail1.AppendNode(ptStart);
|
|
}
|
|
}
|
|
}
|
|
|
|
//一跑下顶点
|
|
if(m_nStartSide==OFFSET_LEFT)
|
|
{
|
|
ads_polar(ptLoc1, m_nRotation, m_nStairWidth-nDistToSide, ptStart);
|
|
}
|
|
else
|
|
{
|
|
ads_polar(ptLoc1, m_nRotation, nDistToSide, ptStart);
|
|
}
|
|
if(m_nStairFlag==SF_TOP)
|
|
{
|
|
if(nRailDist>=m_nRailWidth)
|
|
{
|
|
ptStart.z=ptLoc1.z;
|
|
}
|
|
else
|
|
{
|
|
ads_polar(XPoint(ptStart), m_nRotation-PI/2.0, nRailDist-m_nRailWidth*(IsConnectRail()?0.5:1), ptStart);
|
|
ptStart.z = ptLoc1.z-elev1+height;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ads_polar(XPoint(ptStart), m_nRotation-PI/2.0, nRailDist, ptStart);
|
|
if(nRailDist > width+_DIST_SNAP)
|
|
{
|
|
polyRail.AppendNode(ptStart);
|
|
if(rail1!=NULL)
|
|
{
|
|
polyRail1.AppendNode(ptStart);
|
|
}
|
|
ads_polar(XPoint(ptStart), m_nRotation+PI/2.0, nRailDist-width, ptStart);
|
|
}
|
|
else
|
|
{
|
|
ptStart.z = ptLoc1.z-elev1+height;
|
|
}
|
|
}
|
|
polyRail.AppendNode(ptStart);
|
|
if(rail1!=NULL)
|
|
{
|
|
polyRail1.AppendNode(ptStart);
|
|
}
|
|
|
|
//一跑上顶点
|
|
if(m_nStartSide==OFFSET_LEFT)
|
|
{
|
|
ads_polar(ptLoc1, m_nRotation, m_nStairWidth-nDistToSide, ptStart);
|
|
}
|
|
else
|
|
{
|
|
ads_polar(ptLoc1, m_nRotation, nDistToSide, ptStart);
|
|
}
|
|
if(nRailDistMid > width+_DIST_SNAP)
|
|
{
|
|
ads_polar(XPoint(ptStart), m_nRotation+PI/2.0, nLen1+width, ptStart);
|
|
ptStart.z = ptLoc1.z+stair1.GetStairHeight();
|
|
polyRail.AppendNode(ptStart);
|
|
if(rail1!=NULL)
|
|
{
|
|
polyRail1.AppendNode(ptStart);
|
|
}
|
|
ads_polar(XPoint(ptStart), m_nRotation+PI/2.0, nRailDistMid-width, ptStart);
|
|
}
|
|
else
|
|
{
|
|
ads_polar(XPoint(ptStart), m_nRotation+PI/2.0, nLen1+nRailDistMid, ptStart);
|
|
ptStart.z = ptLoc1.z+stair1.GetStairHeight()-height+elev2;
|
|
}
|
|
polyRail.AppendNode(ptStart);
|
|
if(rail1!=NULL)
|
|
{
|
|
polyRail1.AppendNode(ptStart);
|
|
}
|
|
|
|
/*if(nLen1<nLen2-_DIST_SNAP)
|
|
{
|
|
if(m_nAlignment!=0)
|
|
{//一跑水平段点
|
|
ads_polar(XPoint(ptStart), m_nRotation+PI/2.0,
|
|
(m_nAlignment==1? (nLen2-nLen1)/2.0 : (nLen2-nLen1)), ptStart);
|
|
polyRail.AppendNode(ptStart);
|
|
}
|
|
}
|
|
else if(nLen2<nLen1-_DIST_SNAP)
|
|
{
|
|
if(m_nAlignment!=0)
|
|
{
|
|
ads_polar(XPoint(ptStart), m_nStartSide==OFFSET_LEFT?m_nRotation:m_nRotation+PI,m_nSpaceWidth-m_nStairWidth*2+nDistToSide*2, ptStart);
|
|
if(nRailDistMid < width-_DIST_SNAP)
|
|
{
|
|
ptStart.z = ptLoc2.z+height-elev2;
|
|
}
|
|
polyRail.AppendNode(ptStart);
|
|
}
|
|
}
|
|
ads_polar(XPoint(ptStart), m_nStartSide==OFFSET_LEFT? m_nRotation : (m_nRotation+PI),
|
|
m_nSpaceWidth-m_nStairWidth*2.0+nDistToSide*2, ptStart);
|
|
// polyRail.AppendNode(ptStart);
|
|
*/
|
|
if(GetSlabSize2()<GetSlabSize1()-_DIST_SNAP)
|
|
{
|
|
//一跑水平段点
|
|
ads_polar(XPoint(ptStart), m_nRotation+PI/2.0,GetSlabSize1()-GetSlabSize2(), ptStart);
|
|
polyRail.AppendNode(ptStart);
|
|
if(rail1!=NULL)
|
|
{
|
|
polyRail1.AppendNode(ptStart);
|
|
}
|
|
}
|
|
else if(GetSlabSize1()<GetSlabSize2()-_DIST_SNAP)
|
|
{
|
|
ads_polar(XPoint(ptStart), m_nStartSide==OFFSET_LEFT?m_nRotation:m_nRotation+PI,m_nSpaceWidth-m_nStairWidth*2+nDistToSide*2, ptStart);
|
|
if(nRailDistMid < width-_DIST_SNAP)
|
|
{
|
|
ptStart.z = ptLoc2.z+height-elev2;
|
|
}
|
|
polyRail.AppendNode(ptStart);
|
|
if(rail2!=NULL)
|
|
{
|
|
polyRail2.AppendNode(ptStart);
|
|
}
|
|
}
|
|
|
|
// 二跑下顶点
|
|
if(m_nStartSide==OFFSET_LEFT)
|
|
{
|
|
ads_polar(ptLoc2, m_nRotation+PI, m_nStairWidth-nDistToSide, ptStart);
|
|
}
|
|
else
|
|
{
|
|
ads_polar(ptLoc2, m_nRotation+PI, nDistToSide, ptStart);
|
|
}
|
|
if(nRailDistMid > width+_DIST_SNAP)
|
|
{
|
|
ads_polar(XPoint(ptStart), m_nRotation+PI/2.0,nRailDistMid, ptStart);
|
|
polyRail.AppendNode(ptStart);
|
|
if(rail2!=NULL)
|
|
{
|
|
polyRail2.AppendNode(ptStart);
|
|
}
|
|
ads_polar(XPoint(ptStart), m_nRotation-PI/2.0,nRailDistMid-width, ptStart);
|
|
}
|
|
else
|
|
{
|
|
ads_polar(XPoint(ptStart), m_nRotation+PI/2.0,nRailDistMid, ptStart);
|
|
ptStart.z = ptLoc2.z + height - elev2;
|
|
}
|
|
polyRail.AppendNode(ptStart);
|
|
if(rail2!=NULL)
|
|
{
|
|
polyRail2.AppendNode(ptStart);
|
|
}
|
|
|
|
//二跑上顶点
|
|
if(m_nStartSide==OFFSET_LEFT)
|
|
{
|
|
ads_polar(ptLoc2, m_nRotation+PI, m_nStairWidth-nDistToSide, ptStart);
|
|
}
|
|
else
|
|
{
|
|
ads_polar(ptLoc2, m_nRotation+PI, nDistToSide, ptStart);
|
|
}
|
|
double nRailDistTop=nRailDist; //不连接时顶层扶手伸出
|
|
if(!IsConnectRail()&&m_nStairFlag==SF_TOP)
|
|
{
|
|
nRailDistTop-=m_nRailWidth*0.5;
|
|
}
|
|
if(nRailDistTop > width+_DIST_SNAP)
|
|
{
|
|
ads_polar(XPoint(ptStart), m_nRotation-PI/2.0,nLen2+width, ptStart);
|
|
ptStart.z = ptLoc2.z + stair2.GetStairHeight();
|
|
polyRail.AppendNode(ptStart);
|
|
if(rail2!=NULL)
|
|
{
|
|
polyRail2.AppendNode(ptStart);
|
|
}
|
|
ads_polar(XPoint(ptStart), m_nRotation-PI/2.0,nRailDistTop-width, ptStart);
|
|
}
|
|
else
|
|
{
|
|
ads_polar(XPoint(ptStart), m_nRotation-PI/2.0,nLen2+nRailDistTop, ptStart);
|
|
ptStart.z = ptLoc2.z + stair2.GetStairHeight() - height + elev1;
|
|
}
|
|
polyRail.AppendNode(ptStart);
|
|
if(rail2!=NULL)
|
|
{
|
|
polyRail2.AppendNode(ptStart);
|
|
|
|
if(m_nStairFlag==SF_MIDDLE)
|
|
{
|
|
if(nLenSide2<nLenSide1-_DIST_SNAP)
|
|
{
|
|
if(m_nStartSide==OFFSET_LEFT)
|
|
ads_polar(ptLoc1, m_nRotation, m_nSpaceWidth-m_nStairWidth+nDistToSide, ptStart);
|
|
else
|
|
ads_polar(ptLoc1, m_nRotation+PI, m_nSpaceWidth-2*m_nStairWidth+nDistToSide, ptStart);
|
|
|
|
if(nRailDist > width+_DIST_SNAP)
|
|
{
|
|
ads_polar(XPoint(ptStart), m_nRotation-PI/2.0,width, ptStart);
|
|
ptStart.z = ptLoc2.z + stair2.GetStairHeight();
|
|
polyRail2.AppendNode(ptStart);
|
|
ads_polar(XPoint(ptStart), m_nRotation-PI/2.0,nRailDist-width, ptStart);
|
|
}
|
|
else
|
|
{
|
|
ads_polar(XPoint(ptStart), m_nRotation-PI/2.0,nRailDist, ptStart);
|
|
ptStart.z = ptLoc2.z + stair2.GetStairHeight() - height + elev1;
|
|
}
|
|
polyRail2.AppendNode(ptStart);
|
|
}
|
|
}
|
|
}
|
|
|
|
polyRail.SetFlag(0);
|
|
if(m_nStairFlag==SF_TOP)
|
|
{
|
|
// Add on 2002/1/30 消除顶层楼梯扶手的错误
|
|
// del by xlc on 080716 已在起点处处理
|
|
/*XPoint ptA, ptB;
|
|
ptA = *polyRail.Head();
|
|
ads_polar(ptA, m_nRotation+PI/2, m_nRailWidth*0.5, ptB);
|
|
*polyRail.Head() = ptB;
|
|
*/
|
|
|
|
XPoly2D polyTopRail(0);
|
|
polyTopRail.AppendNode(XPoint(ptStart.x, ptStart.y, GetElevation()));
|
|
//if(nLen2<nLen1-_DIST_SNAP && m_nAlignment!=2)
|
|
if(nLenSide2<nLenSide1-_DIST_SNAP)
|
|
{
|
|
double elev=ptStart.z;
|
|
if(m_nStartSide==OFFSET_LEFT)
|
|
ads_polar(ptLoc1, m_nRotation, m_nSpaceWidth-m_nStairWidth+nDistToSide, ptStart);
|
|
else
|
|
ads_polar(ptLoc1, m_nRotation+PI, m_nSpaceWidth-2*m_nStairWidth+nDistToSide, ptStart);
|
|
|
|
if(nRailDist > width+_DIST_SNAP)
|
|
{
|
|
ads_polar(XPoint(ptStart), m_nRotation-PI/2.0,width, ptStart);
|
|
ptStart.z = elev;
|
|
polyRail.AppendNode(ptStart);
|
|
if(rail2!=NULL)
|
|
{
|
|
polyRail2.AppendNode(ptStart);
|
|
}
|
|
ads_polar(XPoint(ptStart), m_nRotation-PI/2.0,nRailDistTop-width, ptStart);
|
|
}
|
|
else
|
|
{
|
|
ads_polar(XPoint(ptStart), m_nRotation-PI/2.0,nRailDistTop, ptStart);
|
|
ptStart.z = elev;
|
|
}
|
|
|
|
// ads_polar(XPoint(ptStart), m_nRotation-PI/2, m_nStepWidth/2, ptStart);
|
|
ptStart.z = elev;
|
|
polyRail.AppendNode(ptStart);
|
|
if(rail2!=NULL)
|
|
{
|
|
polyRail2.AppendNode(ptStart);
|
|
}
|
|
polyTopRail.AppendNode(XPoint(ptStart.x, ptStart.y, GetElevation()));
|
|
}
|
|
|
|
ads_polar(XPoint(ptStart), m_nStartSide==OFFSET_LEFT? (m_nRotation+PI) : m_nRotation,
|
|
m_nSpaceWidth-m_nStairWidth+nDistToSide, ptStart);
|
|
polyRail.AppendNode(ptStart);
|
|
if(rail2!=NULL)
|
|
{
|
|
polyRail2.AppendNode(ptStart);
|
|
}
|
|
polyTopRail.AppendNode(XPoint(ptStart.x, ptStart.y, GetElevation()));
|
|
polyRail.SetFlag(0);
|
|
rail.SetHas2D(TRUE);
|
|
rail.SetHas3D(FALSE);
|
|
if(pRailTop)
|
|
{
|
|
pRailTop->SetPathPoly(polyTopRail,GetNormal().AsAcGeVector3d());
|
|
pRailTop->SetWidth(m_nRailWidth);
|
|
pRailTop->SetHeight(m_nRailHeight);
|
|
pRailTop->SetStyle(TDbHandRail::RS_RAIL1);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
rail.SetHas2D(TRUE);
|
|
rail.SetHas3D(TRUE);
|
|
}
|
|
/* if(m_nStairFlag==SF_FIRST)
|
|
polyRail.Head()->z += m_nStepHeight;*/
|
|
rail.SetPathPoly(polyRail,GetNormal().AsAcGeVector3d());
|
|
rail.SetWidth(m_nRailWidth);
|
|
rail.SetHeight(m_nRailHeight);
|
|
rail.SetStyle(TDbHandRail::RS_RAIL1);
|
|
|
|
if(rail1!=NULL)
|
|
{
|
|
rail1->SetPathPoly(polyRail1,GetNormal().AsAcGeVector3d());
|
|
rail1->SetWidth(m_nRailWidth);
|
|
rail1->SetHeight(m_nRailHeight);
|
|
rail1->SetStyle(TDbHandRail::RS_RAIL1);
|
|
}
|
|
if(rail2!=NULL)
|
|
{
|
|
rail2->SetPathPoly(polyRail2,GetNormal().AsAcGeVector3d());
|
|
rail2->SetWidth(m_nRailWidth);
|
|
rail2->SetHeight(m_nRailHeight);
|
|
rail2->SetStyle(TDbHandRail::RS_RAIL1);
|
|
}
|
|
|
|
//外侧扶手
|
|
double nDist=m_nStartSide==OFFSET_LEFT?nDistToSide:-nDistToSide;
|
|
if(pRailOut1!=0)
|
|
{
|
|
XLine line=stair1.GetSideCurve2d(m_nStartSide).Offset(nDist,0);
|
|
//modify by xlc on 080630
|
|
/*ads_polar(XPoint(line.EndPoint()),stair1.GetRotation()+PI/2,m_nStepWidth/2.0,line.EndPoint());
|
|
line.EndPoint().z=stair1.GetStairHeight()+GetElevation();
|
|
if(m_nStairFlag==SF_FIRST)
|
|
{
|
|
ads_polar(XPoint(line.StartPoint()),stair1.GetRotation()+PI/2,m_nStepWidth/2.0,line.StartPoint());
|
|
line.StartPoint().z=m_nStepHeight+GetElevation();
|
|
}
|
|
else if(m_nStairFlag==SF_MIDDLE)
|
|
{
|
|
ads_polar(XPoint(line.StartPoint()),stair1.GetRotation()-PI/2,m_nStepWidth/2.0,line.StartPoint());
|
|
line.StartPoint().z=GetElevation();
|
|
}*/
|
|
XPoly2D poly;
|
|
double dist=m_nRailDist;
|
|
if(m_nStairFlag==SF_TOP)
|
|
{
|
|
if(m_nRailDistToSide>=-m_nRailWidth)
|
|
{
|
|
if(m_nRailDist>m_nRailWidth)
|
|
dist=0;
|
|
else
|
|
{
|
|
if(nLenSide2-nLenSide1<=m_nRailWidth&&nLenSide2-nLenSide1>=0)
|
|
{
|
|
dist=m_nRailDist-m_nRailWidth+nLenSide2-nLenSide1;
|
|
}
|
|
else if(nLenSide1-nLenSide2>0)
|
|
{
|
|
dist=m_nRailDist-m_nRailWidth;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if(dist>width+_DIST_SNAP)
|
|
{
|
|
ads_polar(XPoint(line.StartPoint()),stair1.GetRotation()-PI/2,dist,ptStart);
|
|
ptStart.z = GetElevation();
|
|
poly.AppendNode(ptStart);
|
|
|
|
ads_polar(XPoint(ptStart),stair1.GetRotation()+PI/2,dist-width,ptStart);
|
|
}
|
|
else
|
|
{
|
|
ads_polar(XPoint(line.StartPoint()),stair1.GetRotation()-PI/2,dist,ptStart);
|
|
ptStart.z = GetElevation()+height-elev1;
|
|
}
|
|
poly.AppendNode(ptStart);
|
|
|
|
if(nRailDistMid>width+_DIST_SNAP)
|
|
{
|
|
ads_polar(XPoint(line.EndPoint()),stair1.GetRotation()+PI/2,width,ptStart);
|
|
ptStart.z = GetElevation()+stair1.GetStairHeight();
|
|
poly.AppendNode(ptStart);
|
|
|
|
ads_polar(XPoint(ptStart),stair1.GetRotation()+PI/2,nRailDistMid-width,ptStart);
|
|
}
|
|
else
|
|
{
|
|
ads_polar(XPoint(line.EndPoint()),stair1.GetRotation()+PI/2,nRailDistMid,ptStart);
|
|
ptStart.z = GetElevation()+stair1.GetStairHeight()-height+elev2;
|
|
}
|
|
poly.AppendNode(ptStart);
|
|
//poly.AppendNode(line.StartPoint());
|
|
//poly.AppendNode(line.EndPoint());
|
|
pRailOut1->SetPathPoly(poly,GetNormal().AsAcGeVector3d());
|
|
pRailOut1->SetWidth(m_nRailWidth);
|
|
pRailOut1->SetHeight(m_nRailHeight);
|
|
pRailOut1->SetStyle(TDbHandRail::RS_RAIL1);
|
|
}
|
|
if(pRailOut2!=0)
|
|
{
|
|
XLine line=stair2.GetSideCurve2d(m_nStartSide).Offset(nDist,0);
|
|
//modify by xlc on 080630
|
|
/*ads_polar(XPoint(line.EndPoint()),stair2.GetRotation()+PI/2,m_nStepWidth/2.0,line.EndPoint());
|
|
line.EndPoint().z=GetStairHeight()+GetElevation();
|
|
ads_polar(XPoint(line.StartPoint()),stair2.GetRotation()-PI/2,m_nStepWidth/2.0,line.StartPoint());
|
|
line.StartPoint().z=GetElevation()+stair1.GetStairHeight();*/
|
|
XPoly2D poly;
|
|
if(nRailDistMid>width+_DIST_SNAP)
|
|
{
|
|
ads_polar(XPoint(line.StartPoint()),stair2.GetRotation()-PI/2,nRailDistMid,ptStart);
|
|
ptStart.z = GetElevation()+stair1.GetStairHeight();
|
|
poly.AppendNode(ptStart);
|
|
|
|
ads_polar(XPoint(ptStart),stair2.GetRotation()+PI/2,nRailDistMid-width,ptStart);
|
|
}
|
|
else
|
|
{
|
|
ads_polar(XPoint(line.StartPoint()),stair2.GetRotation()-PI/2,nRailDistMid,ptStart);
|
|
ptStart.z = GetElevation()+stair1.GetStairHeight()+height-elev2;
|
|
}
|
|
poly.AppendNode(ptStart);
|
|
|
|
double dist=m_nRailDist;
|
|
|
|
//modify by xlc on 090408 二跑顶层扶手伸出不需回缩
|
|
// if(m_nStairFlag==SF_TOP)
|
|
// dist=m_nRailDist-m_nRailWidth*0.5;
|
|
|
|
if(dist>width+_DIST_SNAP)
|
|
{
|
|
ads_polar(XPoint(line.EndPoint()),stair2.GetRotation()+PI/2,width,ptStart);
|
|
ptStart.z = GetElevation()+GetStairHeight();
|
|
poly.AppendNode(ptStart);
|
|
|
|
ads_polar(XPoint(ptStart),stair2.GetRotation()+PI/2,dist-width,ptStart);
|
|
}
|
|
else
|
|
{
|
|
ads_polar(XPoint(line.EndPoint()),stair2.GetRotation()+PI/2,dist,ptStart);
|
|
ptStart.z = GetElevation()+GetStairHeight()-height+elev1;
|
|
}
|
|
poly.AppendNode(ptStart);
|
|
//poly.AppendNode(line.StartPoint());
|
|
//poly.AppendNode(line.EndPoint());
|
|
pRailOut2->SetPathPoly(poly,GetNormal().AsAcGeVector3d());
|
|
pRailOut2->SetWidth(m_nRailWidth);
|
|
pRailOut2->SetHeight(m_nRailHeight);
|
|
pRailOut2->SetStyle(TDbHandRail::RS_RAIL1);
|
|
}
|
|
|
|
//休息平台
|
|
if(GetSlabSize1()>_DIST_SNAP&&GetSlabSize2()>_DIST_SNAP)
|
|
{
|
|
XPoly2D polySlab(1);
|
|
polySlab.AppendNode(ptLowRight);
|
|
polySlab.AppendNode(ptUpRight, IsArcPlatform()? PI : 0.0);
|
|
polySlab.AppendNode(ptUpLeft);
|
|
polySlab.AppendNode(ptLowLeft);
|
|
|
|
//if(fabs(nLen1-nLen2)>_DIST_SNAP && m_nAlignment!=0)
|
|
if(fabs(GetSlabSize1()-GetSlabSize2())>_DIST_SNAP)
|
|
{
|
|
XPoint ptTemp1, ptTemp2;
|
|
if((m_nStartSide==OFFSET_LEFT && GetSlabSize2()<GetSlabSize1()-_DIST_SNAP) ||
|
|
(m_nStartSide==OFFSET_RIGHT && GetSlabSize1()<GetSlabSize2()-_DIST_SNAP) )
|
|
{
|
|
ads_polar(ptLowLeft, m_nRotation, m_nStairWidth, ptTemp1);
|
|
ads_polar(ptTemp1, m_nRotation+PI/2.0, fabs(GetSlabSize1()-GetSlabSize2()), ptTemp2);
|
|
}
|
|
else
|
|
{
|
|
ads_polar(ptLowLeft, m_nRotation, m_nSpaceWidth-m_nStairWidth, ptTemp1);
|
|
ads_polar(ptTemp1, m_nRotation-PI/2.0, fabs(GetSlabSize1()-GetSlabSize2()), ptTemp2);
|
|
}
|
|
polySlab.AppendNode(ptTemp1);
|
|
polySlab.AppendNode(ptTemp2);
|
|
}
|
|
|
|
if(polySlab.PathArea()>0)
|
|
polySlab.Reverse();
|
|
slab.SetOutline(polySlab);
|
|
slab.SetElevation(ptLoc2.z);
|
|
|
|
if(IsOnGround() && IsAscent())
|
|
slab.SetThickness(GetElevation()-ptLoc2.z);
|
|
else
|
|
slab.SetThickness(-m_nSlabThick);
|
|
}
|
|
|
|
stair1.setPropertiesFrom(this);
|
|
stair2.setPropertiesFrom(this);
|
|
stair1.SetBeamHeight(GetBeamHeight());
|
|
stair2.SetBeamHeight(GetBeamHeight());
|
|
stair1.SetBeamThick(GetBeamThick());
|
|
stair2.SetBeamThick(GetBeamThick());
|
|
slab.setPropertiesFrom(this);
|
|
if(rail1==NULL&&rail2==NULL)
|
|
{
|
|
rail.setPropertiesFrom(this);
|
|
}
|
|
else
|
|
{
|
|
rail1->setPropertiesFrom(this);
|
|
rail2->setPropertiesFrom(this);
|
|
}
|
|
if(pRailTop!=NULL)
|
|
pRailTop->setPropertiesFrom(this);
|
|
if(pRailOut1!=NULL)
|
|
pRailOut1->setPropertiesFrom(this);
|
|
if(pRailOut2!=NULL)
|
|
pRailOut2->setPropertiesFrom(this);
|
|
if(m_idLayerStep3d.isValid())
|
|
{
|
|
slab.setLayer(m_idLayerStep3d);
|
|
stair1.SetLayerStep3d(m_idLayerStep3d);
|
|
stair2.SetLayerStep3d(m_idLayerStep3d);
|
|
}
|
|
if(m_idLayerBeam3d.isValid())
|
|
{
|
|
stair1.SetLayerBeam3d(m_idLayerBeam3d);
|
|
stair2.SetLayerBeam3d(m_idLayerBeam3d);
|
|
}
|
|
if(m_idLayerHand3d.isValid())
|
|
{
|
|
if(rail1==NULL&&rail2==NULL)
|
|
rail.setLayer(m_idLayerHand3d);
|
|
else
|
|
{
|
|
rail1->setLayer(m_idLayerHand3d);
|
|
rail2->setLayer(m_idLayerHand3d);
|
|
}
|
|
if(pRailTop!=NULL)
|
|
pRailTop->setLayer(m_idLayerHand3d);
|
|
if(pRailOut1!=NULL)
|
|
pRailOut1->setLayer(m_idLayerHand3d);
|
|
if(pRailOut2!=NULL)
|
|
pRailOut2->setLayer(m_idLayerHand3d);
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
void TDbRectStair::GetDefaultArrow(TDbSymbArrow*&pArrowUp,TDbSymbArrow*&pArrowDown)const
|
|
{
|
|
TDbLineStair stair1, stair2;
|
|
TDbSlab slab;
|
|
TDbHandRail rail, railTop,railOut1,railOut2;
|
|
ExplodeTo(stair1, stair2, slab, rail);
|
|
if(m_nStairFlag==SF_FIRST)
|
|
{
|
|
pArrowUp=new TDbSymbArrow;
|
|
pArrowDown=NULL;
|
|
}
|
|
else if(m_nStairFlag==SF_TOP)
|
|
{
|
|
pArrowUp=NULL;
|
|
pArrowDown=new TDbSymbArrow;
|
|
}
|
|
else
|
|
{
|
|
pArrowUp=new TDbSymbArrow;
|
|
pArrowDown=new TDbSymbArrow;
|
|
}
|
|
|
|
double nSlabSize=GetSlabSize();
|
|
if(nSlabSize<10&&!IsArcPlatform())
|
|
nSlabSize=1200;
|
|
XPoint pt1,pt2,pt3,pt4,pt5,pt6,pt;
|
|
ads_polar(stair1.GetLocation(),m_nRotation,stair1.GetStairWidth()/2,pt);
|
|
ads_polar(pt,stair1.GetRotation()-PI/2,m_nStepWidth/2,pt1);
|
|
ads_polar(stair2.GetLocation(),stair2.GetRotation(),stair2.GetStairWidth()/2,pt);
|
|
ads_polar(pt,stair2.GetRotation()+PI/2,stair2.GetStairLength()+m_nStepWidth/2,pt6);
|
|
ads_polar(pt1,m_nRotation+PI/2,stair1.GetStairLength()/2,pt2);
|
|
ads_polar(pt2,m_nRotation+PI/2,m_nStepWidth,pt3);
|
|
if(m_nStepNum1>=m_nStepNum2)
|
|
{
|
|
if(IsArcPlatform())
|
|
ads_polar(pt3,m_nRotation+PI/2,stair1.GetStairLength()/2-m_nStepWidth/2+nSlabSize,pt4);
|
|
else
|
|
ads_polar(pt3,m_nRotation+PI/2,stair1.GetStairLength()/2-m_nStepWidth/2+nSlabSize/2,pt4);
|
|
ads_polar(pt4,m_nStartSide==OFFSET_LEFT?m_nRotation:m_nRotation+PI,m_nSpaceWidth-GetStairWidth(),pt5);
|
|
}
|
|
else
|
|
{
|
|
if(IsArcPlatform())
|
|
ads_polar(pt6,m_nRotation+PI/2,stair2.GetStairLength()+m_nStepWidth/2+nSlabSize,pt5);
|
|
else
|
|
ads_polar(pt6,m_nRotation+PI/2,stair2.GetStairLength()+m_nStepWidth/2+nSlabSize/2,pt5);
|
|
ads_polar(pt5,m_nStartSide==OFFSET_LEFT?m_nRotation+PI:m_nRotation,m_nSpaceWidth-GetStairWidth(),pt4);
|
|
}
|
|
if(pArrowUp!=NULL)
|
|
{
|
|
XPoly2D poly;
|
|
poly.AppendNode(pt1);
|
|
poly.AppendNode(pt2);
|
|
pArrowUp->SetPoly2D(poly);
|
|
pArrowUp->SetText(_T("上"));
|
|
pArrowUp->SetTextAlign(TDbSymbArrow::kAtSide);
|
|
pArrowUp->SetTextLocation(pArrowUp->GetDefaultTextLocation());
|
|
pArrowUp->SetTextStyleId(InitTextStyle(TS_DIM,database()));
|
|
pArrowUp->SetTextLayerId(::InitLayer(LAY_TEXT,database()));
|
|
}
|
|
if(pArrowDown!=NULL)
|
|
{
|
|
XPoly2D poly;
|
|
poly.AppendNode(pt6);
|
|
poly.AppendNode(pt5,IsArcPlatform()?(m_nStartSide==OFFSET_LEFT?PI:-PI):0);
|
|
poly.AppendNode(pt4);
|
|
poly.AppendNode(pt3);
|
|
pArrowDown->SetText(_T("下"));
|
|
pArrowDown->SetPoly2D(poly);
|
|
pArrowDown->SetTextAlign(TDbSymbArrow::kAtSide);
|
|
pArrowDown->SetTextLocation(pArrowDown->GetDefaultTextLocation());
|
|
pArrowDown->SetTextStyleId(InitTextStyle(TS_DIM,database()));
|
|
pArrowDown->SetTextLayerId(::InitLayer(LAY_TEXT,database()));
|
|
}
|
|
}
|
|
|
|
|
|
void TDbRectStair::GetDefaultArrow(TDbLineStair &stair1,TDbLineStair &stair2,
|
|
TDbSymbArrow*pArrowUp,TDbSymbArrow*pArrowDown)const
|
|
{
|
|
assertReadEnabled();
|
|
int nSectStair=GetSectStairPos();
|
|
if(m_nStairFlag != SF_TOP && nSectStair == -1)//剖断位置不正确
|
|
return;
|
|
|
|
double nSectStepNum=GetSectStepNum(); //剖断步数
|
|
if(nSectStepNum < 0) //负数调整为正的
|
|
{
|
|
nSectStepNum=GetSectStepNum()+m_nStepNum1+m_nStepNum2+1;
|
|
}
|
|
|
|
double nSlabSize=min(GetSlabSize1(),GetSlabSize2());
|
|
if(nSlabSize<_AS_SYS_UNIT(10)&&!IsArcPlatform())
|
|
nSlabSize=-_AS_SYS_UNIT(1200);
|
|
|
|
else if(IsArcPlatform())
|
|
nSlabSize=-_AS_SYS_UNIT(1200);
|
|
|
|
XPoint pt1,pt2,pt3,pt4,pt5,pt6,pt7,pt8,pt;
|
|
/*----------点相对位置示意----------------------
|
|
_________________________________________________
|
|
*pt4 | *pt5
|
|
| |
|
|
| |
|
|
*pt3 | *pt6
|
|
*pt2 | *pt7
|
|
| |
|
|
| |
|
|
*pt1 | *pt8
|
|
------------------------------------------------*/
|
|
double nStepWidth=m_nStepWidth;
|
|
if(IsAscent())
|
|
nStepWidth=stair1.GetStairLength()/m_nStepNum1;
|
|
else
|
|
{
|
|
if(nSectStepNum==GetStepNum1()||nSectStepNum==GetStepNum1()+GetStepNum2())
|
|
{
|
|
nSectStepNum--;
|
|
}
|
|
}
|
|
ads_polar(stair1.GetLocation(),stair1.GetRotation(),stair1.GetStairWidth()/2,pt);
|
|
ads_polar(pt,stair1.GetRotation()-PI/2,m_nStepWidth*0.5,pt1);
|
|
ads_polar(pt,stair1.GetRotation()+PI/2,(nStepWidth*(nSectStepNum-1)),pt2);
|
|
ads_polar(pt,stair1.GetRotation()+PI/2,(nStepWidth*nSectStepNum),pt3);
|
|
|
|
int nStepNum=m_nStepNum1;
|
|
|
|
ads_polar(stair2.GetLocation(),stair2.GetRotation(),stair2.GetStairWidth()*0.5,pt);
|
|
ads_polar(pt,stair2.GetRotation()+PI/2,(nStepWidth*(nSectStepNum-nStepNum-1)),pt6);
|
|
ads_polar(pt,stair2.GetRotation()+PI/2,(nStepWidth*(nSectStepNum-nStepNum)),pt7);
|
|
ads_polar(pt,stair2.GetRotation()+PI/2,stair2.GetStairLength()+m_nStepWidth*0.5,pt8);
|
|
|
|
ads_polar(GetUpLeft2d(),GetRotation()-PI/2,nSlabSize*0.5,pt);
|
|
ads_polar(pt,GetRotation(),GetStairWidth()*0.5,pt4);
|
|
ads_polar(pt,GetRotation(),GetSpaceWidth()-GetStairWidth()*0.5,pt5);
|
|
if(m_nStartSide!=OFFSET_LEFT)
|
|
{
|
|
pt=pt4;
|
|
pt4=pt5;
|
|
pt5=pt;
|
|
}
|
|
|
|
if(nSectStair==0)
|
|
{
|
|
XPoly2D poly1;
|
|
poly1.AppendNode(pt1);
|
|
poly1.AppendNode(pt2);
|
|
poly1.SetElevation(GetElevation());
|
|
pArrowUp->SetPoly2D(poly1);
|
|
if(m_nStairFlag==SF_MIDDLE)
|
|
{
|
|
XPoly2D poly2;
|
|
poly2.AppendNode(pt8);
|
|
poly2.AppendNode(pt5);
|
|
poly2.AppendNode(pt4);
|
|
poly2.AppendNode(pt3);
|
|
poly2.SetElevation(GetElevation());
|
|
pArrowDown->SetPoly2D(poly2);
|
|
}
|
|
}
|
|
else if(nSectStair==1)
|
|
{
|
|
|
|
XPoly2D poly1;
|
|
poly1.AppendNode(pt1);
|
|
poly1.AppendNode(pt4);
|
|
poly1.AppendNode(pt5);
|
|
poly1.AppendNode(pt6);
|
|
poly1.SetElevation(GetElevation());
|
|
pArrowUp->SetPoly2D(poly1);
|
|
if(m_nStairFlag==SF_MIDDLE)
|
|
{
|
|
XPoly2D poly2;
|
|
poly2.AppendNode(pt8);
|
|
poly2.AppendNode(pt7);
|
|
poly2.SetElevation(GetElevation());
|
|
pArrowDown->SetPoly2D(poly2);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if(m_nStairFlag==SF_TOP)
|
|
{
|
|
XPoly2D poly;
|
|
poly.AppendNode(pt8);
|
|
poly.AppendNode(pt5);
|
|
poly.AppendNode(pt4);
|
|
ads_polar(pt1,m_nRotation+PI/2,m_nStepWidth,pt1);
|
|
poly.AppendNode(pt1);
|
|
poly.SetElevation(GetElevation());
|
|
pArrowDown->SetPoly2D(poly);
|
|
}
|
|
}
|
|
|
|
|
|
{
|
|
pArrowUp->setPropertiesFrom(this);
|
|
|
|
//add by xlc on 090212
|
|
pArrowUp->SetTextHeight(m_dTextHeight);
|
|
|
|
|
|
//modify by xlc on 090205
|
|
pArrowUp->SetLayoutRotation(GetLayoutRotation());
|
|
|
|
//modify by xlc on 090426
|
|
//pArrowUp->SetText(_T("上"));
|
|
pArrowUp->SetText(GetTextUp());
|
|
|
|
pArrowUp->SetTextAlign(TDbSymbArrow::kAtSide);
|
|
pArrowUp->SetTextLocation(pArrowUp->GetDefaultTextLocation());
|
|
pArrowUp->SetTextLayerId(m_idLayerText);
|
|
pArrowUp->SetTextStyleId(m_idTextStyle);
|
|
|
|
pArrowDown->setPropertiesFrom(this);
|
|
|
|
//add by xlc on 090212
|
|
pArrowDown->SetTextHeight(m_dTextHeight);
|
|
|
|
pArrowDown->SetLayoutRotation(GetLayoutRotation());
|
|
|
|
//modify by xlc on 090426
|
|
//pArrowDown->SetText(_T("下"));
|
|
pArrowDown->SetText(GetTextDown());
|
|
|
|
pArrowDown->SetTextAlign(TDbSymbArrow::kAtSide);
|
|
pArrowDown->SetTextLocation(pArrowDown->GetDefaultTextLocation());
|
|
pArrowDown->SetTextLayerId(m_idLayerText);
|
|
pArrowDown->SetTextStyleId(m_idTextStyle);
|
|
|
|
if(m_idLayerArrow.isValid())
|
|
{
|
|
pArrowUp->setLayer(m_idLayerArrow);
|
|
pArrowDown->setLayer(m_idLayerArrow);
|
|
}
|
|
}
|
|
}
|
|
|
|
void TDbRectStair::GetEvaRadius(AcDbArc *pArc, bool bSingle)const
|
|
{
|
|
XPoint ptStart, ptEnd, ptCenter(0,0,0);
|
|
XPoint ptUpLeft=GetUpLeft2d(),
|
|
ptUpRight=GetUpRight2d();
|
|
double nLen1=(IsAscent()? m_nStepNum1 : (m_nStepNum1-1))*m_nStepWidth,
|
|
nLen2=(IsAscent()? m_nStepNum2 : (m_nStepNum2-1))*m_nStepWidth;
|
|
double nLenSide1=nLen1+GetSlabSize1(),
|
|
nLenSide2=nLen2+GetSlabSize2();
|
|
|
|
double dMinSlabSize = (GetSlabSize1() < GetSlabSize2()) ? GetSlabSize1() : GetSlabSize2();
|
|
double dMaxLen = (nLenSide1 > nLenSide2) ? nLenSide1 : nLenSide2;
|
|
|
|
double dLength;
|
|
if (bSingle)
|
|
dLength = dMaxLen;
|
|
else
|
|
dLength = dMinSlabSize;
|
|
|
|
if(m_nStartSide==OFFSET_LEFT)
|
|
{
|
|
ads_polar(ptUpLeft, m_nRotation-PI/2.0, dLength, ptStart);
|
|
ads_polar(ptUpRight, m_nRotation-PI/2.0, dLength, ptEnd);
|
|
}
|
|
else
|
|
{
|
|
ads_polar(ptUpLeft, m_nRotation-PI/2.0, dLength, ptStart);
|
|
ads_polar(ptUpRight, m_nRotation-PI/2.0, dLength, ptEnd);
|
|
}
|
|
|
|
double dWidth = GetSpaceWidth();//梯间宽
|
|
ptCenter.x=(ptStart.x+ptEnd.x)/2.0;
|
|
ptCenter.y=(ptStart.y+ptEnd.y)/2.0;
|
|
ptCenter.z=(ptStart.z+ptEnd.z)/2.0;
|
|
pArc->setCenter(ptCenter);
|
|
if (bSingle)
|
|
{
|
|
pArc->setStartAngle(PI+m_nRotation);
|
|
pArc->setEndAngle(m_nRotation);
|
|
}
|
|
else
|
|
{
|
|
pArc->setStartAngle(m_nRotation);
|
|
pArc->setEndAngle(PI+m_nRotation);
|
|
}
|
|
|
|
pArc->setRadius( dWidth/2.0 );
|
|
if (database())
|
|
pArc->setLinetype(InitLineType(_T("DASH"), database()));
|
|
AcCmColor color = GetEvaRadiusColor();
|
|
pArc->setColor(color);
|
|
if (database())
|
|
{
|
|
AcDbObjectId idLayer = GetLayerIdFromString(LAY_STAIR, database());
|
|
if (idLayer.isValid())
|
|
pArc->setLayer(idLayer);
|
|
}
|
|
}
|
|
|
|
void TDbRectStair::SetEvaRadiusColor(const AcCmColor &color)
|
|
{
|
|
assertWriteEnabled();
|
|
#if ADS > 23
|
|
#if defined(ZWCAD) && (ADS == 24 || defined(R24))
|
|
Adesk::UInt32 nColor = RGB(color.red(), color.green(), color.blue());
|
|
#else
|
|
Adesk::UInt32 nColor = color.getRGB();
|
|
#endif
|
|
#else
|
|
Adesk::UInt32 nColor = color.color();
|
|
#endif
|
|
|
|
TEntityFields &fd = Fields();
|
|
if (fd.SFD(_T("填充真彩颜色"), nColor))
|
|
m_nEvaRadiusColor = (Adesk::Int16)color.colorIndex();
|
|
}
|
|
|
|
AcCmColor TDbRectStair::GetEvaRadiusColor()const //获取疏散半径颜色
|
|
{
|
|
assertReadEnabled();
|
|
AcCmColor color;
|
|
Adesk::UInt32 nColor = 0;
|
|
nColor = m_nEvaRadiusColor;
|
|
|
|
const TEntityFields &fd = GetFields();
|
|
if (fd.GFD(_T("填充真彩颜色"), nColor))
|
|
{
|
|
#if ADS > 23
|
|
#if defined(ZWCAD) && (ADS == 24 || defined(R24))
|
|
color.setRGB(GetRValue(nColor), GetGValue(nColor), GetBValue(nColor));
|
|
#else
|
|
color.setRGB(nColor);
|
|
#endif
|
|
#else
|
|
color.setColor(nColor);
|
|
#endif
|
|
}
|
|
else
|
|
{
|
|
color.setColorIndex(m_nEvaRadiusColor);
|
|
}
|
|
|
|
return color;
|
|
}
|
|
|
|
Acad::ErrorStatus
|
|
TDbRectStair::ExplodeOrDraw3d(XExplodeDraw &dc) const
|
|
{
|
|
if(m_nViewCtrl==1)
|
|
return Acad::eOk; //三维被禁止
|
|
|
|
assertReadEnabled();
|
|
|
|
TDbLineStair stair1, stair2;
|
|
TDbSlab slab;
|
|
TDbHandRail rail, rail1, rail2, railTop,railOut1,railOut2;
|
|
if(IsConnectRail())
|
|
ExplodeTo(stair1, stair2, slab, rail,NULL,NULL, &railTop,&railOut1,&railOut2);
|
|
else
|
|
ExplodeTo(stair1, stair2, slab, rail,&rail1,&rail2, &railTop,&railOut1,&railOut2);
|
|
|
|
BOOL bSide1=stair1.GetSideBeam(0);
|
|
if(m_nStairFlag==SF_TOP) {
|
|
{
|
|
TPushProperty vProp(&railTop, dc);
|
|
if(dc.IsFullExplode())
|
|
railTop.ExplodeOrDraw3d(dc);
|
|
else
|
|
dc.DrawEntity(railTop);
|
|
}
|
|
|
|
// 栏杆
|
|
if(IsAutoRail()) {
|
|
dc.SetColorLayer(colorIndex(), m_idLayerRail3d);
|
|
double nStepWidth=m_nStepWidth;
|
|
if(IsAscent())
|
|
nStepWidth=300;
|
|
XPoly2D polyPath=railTop.GetOutline();
|
|
double nTotalDist=polyPath.Distance2d();
|
|
int nRailNum=AS_INT(nTotalDist/nStepWidth);
|
|
if(nRailNum<1)
|
|
nRailNum=1;
|
|
double nStepW=nTotalDist/nRailNum;
|
|
for(int iRail=0; iRail<nRailNum; iRail++) {
|
|
double nDist=nStepW/2.0 + iRail*nStepW;
|
|
XPoint pt;
|
|
double nDir=0.0;
|
|
polyPath.Polar2d(nDist, pt, &nDir);
|
|
XRectAngle box(pt, 40, 40);
|
|
XPoly2D poly2d;
|
|
box.AsPoly2D(poly2d);
|
|
dc.DrawMesh(poly2d, XVector3D(0,0,m_nRailHeight-20));
|
|
}
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
{
|
|
TPushProperty vProp(&stair1, dc);
|
|
if(dc.IsFullExplode())
|
|
stair1.ExplodeOrDraw3d(dc);
|
|
else
|
|
dc.DrawEntity(stair1);
|
|
}
|
|
|
|
{
|
|
TPushProperty vProp(&stair2, dc);
|
|
if(dc.IsFullExplode())
|
|
stair2.ExplodeOrDraw3d(dc);
|
|
else
|
|
dc.DrawEntity(stair2);
|
|
}
|
|
|
|
if(IsShowSlab())
|
|
{
|
|
if(GetSlabSize1()>_DIST_SNAP&&GetSlabSize2()>_DIST_SNAP)
|
|
{
|
|
TPushProperty vProp(&slab, dc);
|
|
if(dc.IsFullExplode())
|
|
slab.ExplodeOrDraw3d(dc);
|
|
else
|
|
dc.DrawEntity(slab);
|
|
}
|
|
}
|
|
|
|
{
|
|
if(IsOutRail())
|
|
{
|
|
if(dc.IsFullExplode())
|
|
{
|
|
railOut1.ExplodeOrDraw3d(dc);
|
|
railOut2.ExplodeOrDraw3d(dc);
|
|
}
|
|
else
|
|
{
|
|
dc.DrawEntity(railOut1);
|
|
dc.DrawEntity(railOut2);
|
|
}
|
|
|
|
// add by xlc on 080711 外侧栏杆
|
|
if(IsAutoOutRail())
|
|
{
|
|
dc.SetColorLayer(colorIndex(), m_idLayerRail3d);
|
|
XPoly2D polyPath=railOut1.GetOutline();
|
|
|
|
//add by xlc on 090121 修改栏杆画法,不作为坡道时,只在踏步中间画
|
|
double nDistToSide=((GetSpaceWidth()-2*GetStairWidth())<_DIST_SNAP*2 &&m_nRailDistToSide<0)?
|
|
_AS_SYS_UNIT(0) : m_nRailDistToSide;
|
|
nDistToSide += m_nRailWidth/2;
|
|
double nDist=m_nStartSide==OFFSET_LEFT?nDistToSide:-nDistToSide;
|
|
if(!IsAscent()) //非坡道时
|
|
{
|
|
GetRailPolyFromStair(stair1,nDist,m_nRailDist,0,m_nStartSide,polyPath);
|
|
}
|
|
|
|
DrawRail(polyPath,m_nStepWidth,dc);
|
|
|
|
polyPath=railOut2.GetOutline();
|
|
|
|
//add by xlc on 090121
|
|
if(!IsAscent()) //非坡道时
|
|
{
|
|
GetRailPolyFromStair(stair2,nDist,0,m_nRailDist,m_nStartSide,polyPath);
|
|
}
|
|
|
|
DrawRail(polyPath,m_nStepWidth,dc);
|
|
}
|
|
}
|
|
|
|
extern BOOL g_bInElevProcess;
|
|
if(IsConnectRail())
|
|
{
|
|
TPushProperty vProp(&rail, dc);
|
|
if(g_bInElevProcess) {
|
|
XPoly2D polyPath;
|
|
AcGeVector3d normal;
|
|
rail.GetPathPoly(polyPath,normal);
|
|
for(int mm=0; mm<polyPath.TotalSegments(); mm++) {
|
|
XDirectionCurve cv;
|
|
polyPath.Nth(mm, cv);
|
|
if(fabs(cv.StartPoint().z-cv.EndPoint().z)>_DIST_SNAP) {
|
|
XPoly2D poly3d(0);
|
|
poly3d.AppendNode(cv.StartPoint(), cv.GetBulge());
|
|
poly3d.AppendNode(cv.EndPoint());
|
|
rail.SetPathPoly(poly3d,normal);
|
|
if(dc.IsFullExplode())
|
|
rail.ExplodeOrDraw3d(dc);
|
|
else
|
|
dc.DrawEntity(rail);
|
|
}
|
|
}
|
|
rail.SetPathPoly(polyPath,normal);
|
|
|
|
}
|
|
else
|
|
{
|
|
if(dc.IsFullExplode())
|
|
rail.ExplodeOrDraw3d(dc);
|
|
else
|
|
dc.DrawEntity(rail);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
TPushProperty vProp(&rail1, dc);
|
|
if(dc.IsFullExplode())
|
|
rail1.ExplodeOrDraw3d(dc);
|
|
else
|
|
dc.DrawEntity(rail1);
|
|
|
|
TPushProperty vProp2(&rail2, dc);
|
|
if(dc.IsFullExplode())
|
|
rail2.ExplodeOrDraw3d(dc);
|
|
else
|
|
dc.DrawEntity(rail2);
|
|
}
|
|
|
|
}
|
|
|
|
// 栏杆
|
|
if(IsAutoRail())
|
|
{
|
|
dc.SetColorLayer(colorIndex(), m_idLayerRail3d);
|
|
|
|
//modify by xlc on 090122 修改栏杆画法,不作为坡道时,只在踏步中间画
|
|
if(IsAscent()) //坡道时
|
|
{
|
|
if(IsConnectRail())
|
|
{
|
|
XPoly2D polyPath=rail.GetOutline();
|
|
// modify by xlc on 080711
|
|
/*double nTotalDist=polyPath.Distance2d();
|
|
int nRailNum=AS_INT(nTotalDist/(IsAscent()? 300.0 : m_nStepWidth));
|
|
if(nRailNum<1)
|
|
nRailNum=1;
|
|
double nStepW=nTotalDist/nRailNum;
|
|
for(int iRail=1; iRail<nRailNum; iRail++) {
|
|
double nDist=iRail*nStepW;
|
|
XPoint pt;
|
|
double nDir=0.0;
|
|
polyPath.Polar2d(nDist, pt, &nDir);
|
|
XRectAngle box(pt, 40, 40);
|
|
XPoly2D poly2d;
|
|
box.AsPoly2D(poly2d);
|
|
dc.DrawMesh(poly2d, XVector3D(0,0,m_nRailHeight-20));
|
|
}*/
|
|
DrawRail(polyPath,m_nStepWidth,dc);
|
|
}
|
|
else
|
|
{
|
|
XPoly2D polyPath=rail1.GetOutline();
|
|
DrawRail(polyPath,m_nStepWidth,dc);
|
|
polyPath=rail2.GetOutline();
|
|
DrawRail(polyPath,m_nStepWidth,dc);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
double nDistToSide=((GetSpaceWidth()-2*GetStairWidth())<_DIST_SNAP*2 &&m_nRailDistToSide<0)?
|
|
_AS_SYS_UNIT(0) : m_nRailDistToSide;
|
|
nDistToSide += m_nRailWidth/2;
|
|
double nDist=m_nStartSide==OFFSET_LEFT?-nDistToSide:nDistToSide;
|
|
|
|
XPoly2D polyPath;
|
|
GetRailPolyFromStair(stair1,nDist,m_nRailDist,0,!m_nStartSide,polyPath);
|
|
DrawRail(polyPath,m_nStepWidth,dc);
|
|
|
|
GetRailPolyFromStair(stair2,nDist,0,m_nRailDist,!m_nStartSide,polyPath);
|
|
DrawRail(polyPath,m_nStepWidth,dc);
|
|
}
|
|
|
|
}
|
|
if(IsOnGround() && IsAscent()) { //补充平台
|
|
double nTopElev=stair2.GetElevation();
|
|
double nBotElev=GetElevation();
|
|
XPoint pt[4];
|
|
pt[0]=stair2.GetLowLeft2d();
|
|
pt[1]=stair2.GetLowRight2d();
|
|
pt[2]=stair2.GetUpRight2d();
|
|
pt[3]=stair2.GetUpLeft2d();
|
|
XPoly2D polyOutline(1);
|
|
for(int k=0; k<4; k++)
|
|
polyOutline.AppendNode(pt[k]);
|
|
TDbSlab slab;
|
|
slab.setPropertiesFrom(this);
|
|
slab.SetOutline(polyOutline);
|
|
slab.SetElevation(nBotElev);
|
|
slab.SetThickness(nTopElev-nBotElev);
|
|
TPushProperty vProp(&slab, dc);
|
|
if(dc.IsFullExplode()) {
|
|
slab.ExplodeOrDraw3d(dc);
|
|
} else {
|
|
dc.DrawEntity(slab);
|
|
}
|
|
}
|
|
|
|
}
|
|
bSide1=stair1.GetSideBeam(0);
|
|
|
|
return Acad::eOk;
|
|
}
|
|
|
|
//add by xlc on 090122 获得梯段扶手线的位置
|
|
void TDbRectStair::GetRailPolyFromStair(TDbLineStair &stair, //[in]操作梯段
|
|
double dOffset, //[in]偏移距离
|
|
double dDistS, //[in]起始端伸出距离
|
|
double dDistE, //[in]终端伸出距离
|
|
BOOL bRight, //[in]扶手侧
|
|
XPoly2D &poly //[out]扶手线
|
|
)const
|
|
{
|
|
poly.Reset();
|
|
XLine line=stair.GetSideCurve2d(bRight).Offset(dOffset,0);
|
|
XPoint pt=line.StartPoint();
|
|
pt.z=stair.GetElevation()+0.5*m_nStepHeight;
|
|
if(dDistS<-0.5*m_nStepWidth+_DIST_SNAP)
|
|
{
|
|
int num=(int)fabs((dDistS-0.5*m_nStepWidth)/m_nStepWidth);
|
|
ads_polar(pt, stair.GetRotation()+PI/2,m_nStepWidth*num, pt);
|
|
pt.z+=m_nStepHeight*num;
|
|
}
|
|
poly.AppendNode(pt);
|
|
|
|
pt=line.EndPoint();
|
|
pt.z=stair.GetElevation()+stair.GetStairHeight()-0.5*m_nStepHeight;
|
|
if(dDistE<-0.5*m_nStepWidth+_DIST_SNAP)
|
|
{
|
|
int num=(int)fabs((dDistE-0.5*m_nStepWidth)/m_nStepWidth);
|
|
ads_polar(pt, stair.GetRotation()-PI/2,m_nStepWidth*num, pt);
|
|
pt.z-=m_nStepHeight*num;
|
|
}
|
|
poly.AppendNode(pt);
|
|
}
|
|
|
|
//add by xlc on 080711 画栏杆
|
|
void TDbRectStair::DrawRail(XPoly2D polyPath,double nStepWidth,XExplodeDraw &dc) const
|
|
{
|
|
double nTotalDist=polyPath.Distance2d();
|
|
int nRailNum=AS_INT(nTotalDist/nStepWidth);
|
|
if(nRailNum<1)
|
|
nRailNum=1;
|
|
double nStepW=nTotalDist/nRailNum;
|
|
double nRailHeight=m_nRailHeight-_AS_SYS_UNIT(20);
|
|
if(m_nRailDistToSide < -_DIST_SNAP)//扶手偏移距离为负时栏杆增加一个踏步高
|
|
nRailHeight += m_nStepHeight;
|
|
|
|
for(int iRail=0; iRail<nRailNum; iRail++)
|
|
{
|
|
double nDist=nStepW/2.0 + iRail*nStepW;
|
|
XPoint pt;
|
|
double nDir=0.0;
|
|
polyPath.Polar2d(nDist, pt, &nDir);
|
|
XRectAngle box(pt, _AS_SYS_UNIT(40), _AS_SYS_UNIT(40));
|
|
XPoly2D poly2d;
|
|
box.AsPoly2D(poly2d);
|
|
if(m_nRailDistToSide < -_DIST_SNAP)//扶手偏移距离为负时栏杆增加一个踏步高
|
|
{
|
|
for(int i = 0; i < poly2d.Length(); i++)
|
|
{
|
|
poly2d[i]->z -= m_nStepHeight;
|
|
}
|
|
}
|
|
dc.DrawMesh(poly2d, XVector3D(0,0,nRailHeight));
|
|
}
|
|
}
|
|
|
|
bool TDbRectStair::IsClipMe(const TEntityBase* pEnt)const
|
|
{
|
|
if(TDbEntity::IsClipMe(pEnt))
|
|
return true;
|
|
|
|
if(pEnt->GetMe()->isKindOf(TDbColumn::desc()))
|
|
return true;
|
|
|
|
return false;
|
|
}
|
|
Acad::ErrorStatus TDbRectStair::DownGradeSave(int nDrawMode, AcDbVoidPtrArray &entSet, BOOL *bErase)
|
|
{
|
|
Acad::ErrorStatus es=Acad::eOk;
|
|
//modify by xlc on 080715
|
|
//if((g_nSaveTArchVer<7&&IsOutRail())||(g_nSaveTArchVer<8&&g_nVersion>3))//7.0开始才有外侧扶手 //8.0有改进
|
|
//{
|
|
// explode(entSet);
|
|
// if(bErase)
|
|
// *bErase=TRUE;
|
|
//}
|
|
//else
|
|
if((g_nSaveTArchVer<7&&IsOutRail()) //7.0开始才有外侧扶手 //8.0有改进
|
|
||(g_nSaveTArchVer<8&&(!IsConnectRail ()))) //8.0增加扶手不连接功能modify by xlc on 090525
|
|
{
|
|
subExplode(entSet);
|
|
if(bErase)
|
|
*bErase=TRUE;
|
|
return es;
|
|
}
|
|
else if(g_nSaveTArchVer==5||g_nSaveTArchVer==6||g_nSaveTArchVer==7)
|
|
{
|
|
BOOL bFlag=FALSE;
|
|
int nAlignment=GetAlignment();
|
|
if(nAlignment==3) //自由对齐
|
|
{
|
|
if(fabs(GetSlabSize1()-GetSlabSize2())<_DIST_SNAP)//可以转化为齐平台
|
|
{
|
|
nAlignment=0;
|
|
}
|
|
else if(fabs(GetSlabSize1()-GetSlabSize2()+0.5*GetStepWidth()*(GetStepNum1()-GetStepNum2()))<_DIST_SNAP)//可以转化为居中对齐
|
|
{
|
|
nAlignment=1;
|
|
}
|
|
else if(fabs(GetSlabSize1()-GetSlabSize2()+GetStepWidth()*(GetStepNum1()-GetStepNum2()))<_DIST_SNAP)//可以转化为齐楼板
|
|
{
|
|
nAlignment=2;
|
|
}
|
|
else
|
|
{
|
|
bFlag=TRUE;
|
|
}
|
|
}
|
|
if(bFlag)
|
|
{
|
|
subExplode(entSet);
|
|
if(bErase)
|
|
*bErase=TRUE;
|
|
return es;
|
|
}
|
|
else
|
|
{
|
|
TDbRectStair *pNewSet=NULL;
|
|
{
|
|
XPushMemVar<int> vTemp(g_nSaveTArchVer,_TCH_VERSION);//add by XLC on 090325,解决8导出7崩溃问题
|
|
pNewSet=(TDbRectStair*)clone();
|
|
}
|
|
pNewSet->SetManualSectPos(TRUE);
|
|
pNewSet->SetArrow(FALSE);
|
|
pNewSet->SetConnectRail (TRUE);
|
|
pNewSet->SetAlignment(nAlignment);
|
|
if (!IsShowSlab())
|
|
{
|
|
XPoint ptLoc=GetLocation();
|
|
ads_polar(ptLoc, m_nRotation-PI/2, GetSlabSize(), ptLoc);
|
|
pNewSet->SetLocation(ptLoc);
|
|
pNewSet->SetSlabSize(0);
|
|
}
|
|
entSet.append(pNewSet);
|
|
|
|
if(IsArrow()&& nDrawMode == DRAW_2D)
|
|
{
|
|
TDbLineStair stair1, stair2;
|
|
TDbSlab slab;
|
|
TDbHandRail rail,rail1,rail2,railOut1,railOut2;
|
|
ExplodeTo(stair1, stair2, slab, rail);
|
|
|
|
TDbSymbArrow pArrowUp,pArrowDown;
|
|
if(IsArrow()) //画箭头
|
|
{
|
|
GetDefaultArrow(stair1,stair2,&pArrowUp,&pArrowDown);
|
|
if(&pArrowUp)
|
|
{
|
|
XPushMemVar<int> vTemp(g_nSaveTArchVer,_TCH_VERSION);//add by xlc on 090427,解决8导出7崩溃问题
|
|
entSet.append((TDbSymbArrow*)(&pArrowUp)->clone());
|
|
}
|
|
if(&pArrowDown)
|
|
{
|
|
XPushMemVar<int> vTemp(g_nSaveTArchVer,_TCH_VERSION);//add by xlc on 090427,解决8导出7崩溃问题
|
|
entSet.append((TDbSymbArrow*)(&pArrowDown)->clone());
|
|
}
|
|
}
|
|
}
|
|
//add by jsx on 20160614 疏散半径
|
|
if(IsEvaRadius())
|
|
{
|
|
AcDbArc arcSingle, arcDouble;
|
|
if(IsSingleEvaRadius())
|
|
{
|
|
GetEvaRadius(&arcSingle);
|
|
entSet.append((AcDbArc*)(&arcSingle)->clone());
|
|
}
|
|
else if (IsDoubleEvaRadius())
|
|
{
|
|
GetEvaRadius(&arcSingle);
|
|
entSet.append((AcDbArc*)(&arcSingle)->clone());
|
|
GetEvaRadius(&arcDouble, false);
|
|
entSet.append((AcDbArc*)(&arcDouble)->clone());
|
|
}
|
|
}
|
|
|
|
if(bErase)
|
|
*bErase=TRUE;
|
|
return es;
|
|
}
|
|
}
|
|
else if(g_nSaveTArchVer < 11)
|
|
{
|
|
TDbRectStair *pNewSet=NULL;
|
|
{
|
|
XPushMemVar<int> vTemp(g_nSaveTArchVer,_TCH_VERSION);
|
|
pNewSet=(TDbRectStair*)clone();
|
|
pNewSet->SetSingleEvaRadius(FALSE);
|
|
pNewSet->SetDoubleEvaRadius(FALSE);
|
|
|
|
}
|
|
entSet.append(pNewSet);
|
|
|
|
if(IsEvaRadius())
|
|
{
|
|
AcDbArc arcSingle, arcDouble;
|
|
if(IsSingleEvaRadius())
|
|
{
|
|
GetEvaRadius(&arcSingle);
|
|
entSet.append((AcDbArc*)(&arcSingle)->clone());
|
|
}
|
|
else if (IsDoubleEvaRadius())
|
|
{
|
|
GetEvaRadius(&arcSingle);
|
|
entSet.append((AcDbArc*)(&arcSingle)->clone());
|
|
GetEvaRadius(&arcDouble, false);
|
|
entSet.append((AcDbArc*)(&arcDouble)->clone());
|
|
}
|
|
}
|
|
if(bErase)
|
|
*bErase=TRUE;
|
|
return es;
|
|
}
|
|
|
|
es=TDbEntity::DownGradeSave(nDrawMode,entSet,bErase);
|
|
return es;
|
|
}
|
|
|
|
// 分解为ACAD对象后, 遮挡关系被破坏? 不会
|
|
Acad::ErrorStatus
|
|
TDbRectStair::ExplodeOrDraw2d(XExplodeDraw &dc) const
|
|
{
|
|
if(m_nViewCtrl==2)
|
|
return Acad::eOk; //二维被禁止
|
|
|
|
assertReadEnabled();
|
|
if(_tcscmp(dc.Desc(), XAcGiViewDraw::Descriptor())==0 ||
|
|
g_bOsnapExpl) {
|
|
XPushMemVar<BOOL> bExpl(g_bOsnapExpl, FALSE);
|
|
XPushMemVar<BOOL> bFull(XExplodeStream::m_bFullExplode, TRUE);
|
|
AcDbVoidPtrArray entSet;
|
|
XExplodeStream dcExp(entSet);
|
|
dcExp.SetPropertiesFrom(this); //add by whl on 060404
|
|
ExplodeOrDraw2d(dcExp);
|
|
INT_PTR nQuickMarker=GetQuickMarker();
|
|
int nGsMarker=1;
|
|
int nCount=entSet.length();
|
|
for(int i=0; i<nCount; i++) {
|
|
AcDbEntity *pEnt=(AcDbEntity *)entSet[i];
|
|
dc.SetSelectionMarker(nGsMarker);
|
|
nGsMarker++;
|
|
if(nQuickMarker && (nGsMarker-1)!=nQuickMarker) //用于捕捉时加速
|
|
continue;
|
|
|
|
dc.DrawEntity(*pEnt);
|
|
if(nQuickMarker && (nGsMarker-1)==nQuickMarker)
|
|
break;
|
|
}
|
|
ReleaseEntSet(entSet);
|
|
} else {
|
|
TDbLineStair stair1, stair2;
|
|
TDbSlab slab;
|
|
TDbHandRail rail,rail1,rail2,railOut1,railOut2;
|
|
if(IsConnectRail())
|
|
ExplodeTo(stair1, stair2, slab, rail,NULL,NULL,NULL,&railOut1,&railOut2);
|
|
else
|
|
ExplodeTo(stair1, stair2, slab, rail,&rail1,&rail2,NULL,&railOut1,&railOut2);
|
|
|
|
TDbSymbArrow pArrowUp,pArrowDown;
|
|
if(IsArrow()) //画箭头
|
|
{
|
|
GetDefaultArrow(stair1,stair2,&pArrowUp,&pArrowDown);
|
|
if(dc.IsFullExplode())
|
|
{
|
|
TPushProperty vProp(&pArrowUp,dc);
|
|
pArrowUp.ExplodeOrDraw2d(dc);
|
|
pArrowDown.ExplodeOrDraw2d(dc);
|
|
}
|
|
else
|
|
{
|
|
dc.DrawEntity(pArrowUp);
|
|
dc.DrawEntity(pArrowDown);
|
|
}
|
|
}
|
|
if(IsEvaRadius())
|
|
{
|
|
AcDbArc arcSingle, arcDouble;
|
|
if(IsDoubleEvaRadius())
|
|
{
|
|
GetEvaRadius(&arcSingle);
|
|
dc.DrawEntity(arcSingle);
|
|
|
|
GetEvaRadius(&arcDouble, false);
|
|
dc.DrawEntity(arcDouble);
|
|
}
|
|
else if (IsSingleEvaRadius())
|
|
{
|
|
GetEvaRadius(&arcSingle);
|
|
dc.DrawEntity(arcSingle);
|
|
}
|
|
}
|
|
if(IsConnectRail())
|
|
{
|
|
stair1.AddTempRail(&rail);
|
|
stair2.AddTempRail(&rail);
|
|
}
|
|
else
|
|
{
|
|
stair1.AddTempRail(&rail1);
|
|
stair2.AddTempRail(&rail2);
|
|
|
|
//add by xlc on 090408
|
|
if(m_nStairFlag==SF_TOP&&m_nRailDist<m_nRailWidth)
|
|
stair1.AddTempRail(&rail2);
|
|
}
|
|
|
|
if(IsOutRail())
|
|
{
|
|
stair1.AddTempRail(&railOut1);
|
|
railOut1.SetTempStair(&stair1);
|
|
stair2.AddTempRail(&railOut2);
|
|
railOut2.SetTempStair(&stair2);
|
|
}
|
|
|
|
//modify by xlc on 080703
|
|
/*int nHitLeft=0, nHitRight=0;
|
|
XPoint ptSectLeft2d, ptSectRight2d;
|
|
if(IsManualSectPos()) {
|
|
nHitLeft=HitTestSectPos(0, ptSectLeft2d);
|
|
nHitRight=HitTestSectPos(1, ptSectRight2d);
|
|
if(nHitLeft!=nHitRight)
|
|
nHitLeft=nHitRight=0;
|
|
}
|
|
if((nHitLeft==1 && nHitRight==1) ||
|
|
(nHitLeft==2 && nHitRight==2)) {
|
|
XDirectionCurve cvLeft=(nHitLeft==1? stair1.GetSideCurve2d(0) : stair2.GetSideCurve2d(0));
|
|
XDirectionCurve cvRight=(nHitRight==1? stair1.GetSideCurve2d(1) : stair2.GetSideCurve2d(1));
|
|
double nLeftPos=cvLeft.PathDistance(ptSectLeft2d)/cvLeft.Length();
|
|
double nRightPos=cvRight.PathDistance(ptSectRight2d)/cvRight.Length();
|
|
if(nHitLeft==1) {
|
|
stair1.SetSectionPos(0, nLeftPos);
|
|
stair1.SetSectionPos(1, nRightPos);
|
|
} else {
|
|
stair2.SetSectionPos(0, nLeftPos);
|
|
stair2.SetSectionPos(1, nRightPos);
|
|
stair2.Set2DFlag(stair1.Get2DFlag());
|
|
stair1.Set2DFlag(SF_NOSECT);
|
|
}
|
|
}*/
|
|
|
|
XPoint ptSectLeft2d, ptSectRight2d;
|
|
int nSectStair=GetSectStairPos();
|
|
double lSectPos,rSectPos;
|
|
XPoint ptLeft2d,ptRight2d;
|
|
if(CalSectPos(lSectPos,rSectPos,ptLeft2d,ptRight2d))
|
|
{
|
|
if(nSectStair==0)
|
|
{
|
|
stair1.SetSectionPos(0, lSectPos);
|
|
stair1.SetSectionPos(1, rSectPos);
|
|
|
|
stair2.Set2DFlag(SF_NOSECT);
|
|
}
|
|
else if(nSectStair==1)
|
|
{
|
|
stair2.SetSectionPos(0, lSectPos);
|
|
stair2.SetSectionPos(1, rSectPos);
|
|
|
|
stair1.Set2DFlag(SF_NOSECT);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
stair1.Set2DFlag(SF_NOSECT);
|
|
stair2.Set2DFlag(SF_NOSECT);
|
|
}
|
|
|
|
|
|
if(dc.IsFullExplode())
|
|
stair1.ExplodeOrDraw2d(dc);
|
|
else
|
|
dc.DrawEntity(stair1);
|
|
|
|
if(m_nStairFlag!=SF_FIRST || nSectStair>0) {
|
|
if(dc.IsFullExplode())
|
|
stair2.ExplodeOrDraw2d(dc);
|
|
else
|
|
dc.DrawEntity(stair2);
|
|
}
|
|
|
|
if(IsConnectRail())
|
|
{
|
|
rail.SetTempStair(nSectStair>0? &stair2 : &stair1);
|
|
rail.setPropertiesFrom(this);
|
|
if(dc.IsFullExplode())
|
|
rail.ExplodeOrDraw2d(dc);
|
|
else
|
|
dc.DrawEntity(rail);
|
|
}
|
|
else
|
|
{
|
|
rail1.setPropertiesFrom(this);
|
|
rail2.setPropertiesFrom(this);
|
|
if(nSectStair==0)
|
|
{
|
|
rail1.SetTempStair(&stair1);
|
|
}
|
|
else if(nSectStair==1)
|
|
{
|
|
rail2.SetTempStair(&stair2);
|
|
}
|
|
if(dc.IsFullExplode())
|
|
rail1.ExplodeOrDraw2d(dc);
|
|
else
|
|
dc.DrawEntity(rail1);
|
|
if(!(m_nStairFlag==SF_FIRST&&nSectStair==0))
|
|
{
|
|
if(dc.IsFullExplode())
|
|
{
|
|
rail2.ExplodeOrDraw2d(dc);
|
|
}
|
|
else
|
|
{
|
|
dc.DrawEntity(rail2);
|
|
}
|
|
}
|
|
}
|
|
|
|
if(IsOutRail())
|
|
{
|
|
railOut1.setPropertiesFrom(this);
|
|
railOut2.setPropertiesFrom(this);
|
|
if(dc.IsFullExplode())
|
|
{
|
|
railOut1.ExplodeOrDraw2d(dc);
|
|
if(m_nStairFlag!=SF_FIRST||(m_nStairFlag==SF_FIRST&&nSectStair>0))
|
|
railOut2.ExplodeOrDraw2d(dc);
|
|
}
|
|
else
|
|
{
|
|
dc.DrawEntity(railOut1);
|
|
if(m_nStairFlag!=SF_FIRST||(m_nStairFlag==SF_FIRST&&nSectStair>0))
|
|
dc.DrawEntity(railOut2);
|
|
}
|
|
}
|
|
|
|
|
|
if(m_nStairFlag!=SF_FIRST || nSectStair>0)
|
|
{
|
|
double nLen1=stair1.GetStairLength(),
|
|
nLen2=stair2.GetStairLength();
|
|
|
|
double nLenSide1=nLen1+GetSlabSize1(),nLenSide2=nLen2+GetSlabSize2(); //梯段与平台总长,判断是否齐楼板
|
|
if(GetSlabSize1()>_DIST_SNAP&&GetSlabSize2()>_DIST_SNAP)
|
|
{
|
|
if(IsShowSlab())
|
|
{
|
|
if(IsConnectRail())
|
|
slab.AddTempRail(&rail);
|
|
else
|
|
{
|
|
slab.AddTempRail(&rail1);
|
|
slab.AddTempRail(&rail2);
|
|
}
|
|
if(IsOutRail())
|
|
{
|
|
slab.AddTempRail(&railOut1);
|
|
slab.AddTempRail(&railOut2);
|
|
}
|
|
|
|
if(dc.IsFullExplode())
|
|
slab.ExplodeOrDraw2d(dc);
|
|
else
|
|
dc.DrawEntity(slab);
|
|
}
|
|
}
|
|
else if(m_nSpaceWidth-2*m_nStairWidth>_DIST_SNAP)
|
|
{
|
|
//绘制平台线
|
|
XPoint ptFrom=m_nStartSide==OFFSET_LEFT? stair1.GetUpRight2d() : stair1.GetUpLeft2d();
|
|
XPoint ptTo=m_nStartSide==OFFSET_LEFT? stair2.GetLowRight2d() : stair2.GetLowLeft2d();
|
|
|
|
//if(fabs(nLen1-nLen2)>_DIST_SNAP && m_nAlignment!=0)
|
|
if(fabs(GetSlabSize1()-GetSlabSize2())>_DIST_SNAP)
|
|
{
|
|
double nIdent=GetSlabSize1()-GetSlabSize2();
|
|
XPoint ptTemp;
|
|
if(nIdent>0) ads_polar(ptFrom, m_nRotation+PI/2, nIdent, ptTemp);
|
|
else ads_polar(ptTo, m_nRotation+PI/2, fabs(nIdent), ptTemp);
|
|
dc << XLine(ptFrom, ptTemp) << XLine(ptTemp, ptTo);
|
|
} else {
|
|
dc << XLine(ptFrom, ptTo);
|
|
}
|
|
}
|
|
|
|
// 绘制楼板线
|
|
if(m_nStairFlag!=SF_FIRST)
|
|
{
|
|
XPoint ptFrom=m_nStartSide==OFFSET_LEFT? stair1.GetLowRight2d() : stair1.GetLowLeft2d();
|
|
XPoint ptTo=m_nStartSide==OFFSET_LEFT? stair2.GetUpRight2d() : stair2.GetUpLeft2d();
|
|
|
|
//if(fabs(nLen1-nLen2)>_DIST_SNAP && m_nAlignment!=2)
|
|
if(fabs(nLenSide1-nLenSide2)>_DIST_SNAP)
|
|
{
|
|
double nIdent=nLenSide2-nLenSide1;
|
|
XPoint ptTemp;
|
|
if(nIdent>0) //二跑长
|
|
{
|
|
ads_polar(ptFrom, m_nRotation-PI/2, nIdent, ptTemp);
|
|
if((m_nRailDistToSide>=0&&((m_nRailDist>m_nRailWidth&&(IsConnectRail()||(!IsConnectRail()&&m_nStairFlag==SF_TOP)))))
|
|
||(m_nRailDistToSide<=-m_nRailWidth&&m_nRailDist<0)
|
|
||m_nRailDist<-fabs(nIdent)) //楼板线不被遮挡
|
|
{
|
|
if(!(m_nStairFlag==SF_TOP&&m_nRailDist>0&&m_nRailDist<m_nRailWidth))
|
|
dc << XLine(ptTemp, ptTo);
|
|
if(m_nStairFlag==SF_TOP&&m_nRailDist<0&&m_nRailDist>=-nIdent+m_nRailWidth)
|
|
{
|
|
XPoint ptTmp;
|
|
ads_polar(ptTemp, m_nRotation-PI*0.5, m_nRailDist, ptTmp);
|
|
dc << XLine(ptTmp, ptTemp);
|
|
|
|
ads_polar(ptTmp, m_nRotation+PI*0.5, m_nRailWidth, ptTmp);
|
|
dc << XLine(ptFrom, ptTmp);
|
|
}
|
|
else if(m_nStairFlag==SF_TOP&&m_nRailDist>-nIdent&&m_nRailDist<-nIdent+m_nRailWidth)
|
|
{
|
|
XPoint ptTmp;
|
|
ads_polar(ptTemp, m_nRotation-PI*0.5, m_nRailDist, ptTmp);
|
|
dc << XLine(ptTmp, ptTemp);
|
|
}
|
|
else
|
|
{
|
|
dc << XLine(ptFrom, ptTemp);
|
|
}
|
|
}
|
|
else if(m_nRailDistToSide>=0&&m_nRailDist<=m_nRailWidth&&(IsConnectRail()||(!IsConnectRail()&&m_nStairFlag==SF_TOP)))
|
|
{
|
|
XPoint ptL,ptR;
|
|
ads_polar(ptFrom, m_nRotation-PI/2, nIdent+m_nRailDist-m_nRailWidth, ptL);
|
|
dc<<XLine(ptFrom,ptL);
|
|
|
|
if(m_nRailDist<0)
|
|
{
|
|
ads_polar(ptTemp, m_nRotation+PI/2, fabs(m_nRailDist), ptFrom);
|
|
dc << XLine(ptFrom, ptTemp) << XLine(ptTemp, ptTo);
|
|
}
|
|
}
|
|
else if(m_nRailDistToSide<=-m_nRailWidth&&m_nRailDist>=0)//楼板线被扶手线打断
|
|
{
|
|
if((m_nStairFlag==SF_TOP&&m_nRailDist<=m_nRailWidth))
|
|
{
|
|
XPoint ptTmp;
|
|
ads_polar(ptTemp, m_nRotation-PI*0.5, m_nRailDist-m_nRailWidth, ptTmp);
|
|
dc << XLine(ptTmp, ptFrom);
|
|
}
|
|
else
|
|
dc << XLine(ptTemp, ptFrom);
|
|
XPoint ptL,ptR;
|
|
ads_polar(ptTo, m_nRotation+m_nStartSide==OFFSET_LEFT?PI:0, fabs(m_nRailDistToSide+m_nRailWidth), ptL);
|
|
dc << XLine(ptTo, ptL);
|
|
ads_polar(ptTemp, m_nRotation+m_nStartSide==OFFSET_LEFT?0:PI, fabs(m_nRailDistToSide+m_nRailWidth), ptR);
|
|
if(!(m_nStairFlag==SF_TOP&&m_nRailDist<=m_nRailWidth))
|
|
dc << XLine(ptTemp, ptR);
|
|
if((m_nRailDist>=m_nRailWidth)
|
|
||(m_nRailDist>=0&&!IsConnectRail()&&m_nStairFlag!=SF_TOP))
|
|
{
|
|
ads_polar(ptL, m_nRotation+m_nStartSide==OFFSET_LEFT?PI:0, m_nRailWidth, ptL);
|
|
ads_polar(ptR, m_nRotation+m_nStartSide==OFFSET_LEFT?0:PI, m_nRailWidth, ptR);
|
|
dc << XLine(ptL, ptR);
|
|
}
|
|
}
|
|
else if(m_nRailDistToSide<=0&&m_nRailDistToSide>=-m_nRailWidth)//楼板线两端被扶手遮挡
|
|
{
|
|
if(((m_nRailDist>=m_nRailWidth)||(m_nRailDist>=0&&m_nStairFlag!=SF_TOP&&!IsConnectRail()))||m_nRailDist<=0)
|
|
{
|
|
XPoint ptL,ptR;
|
|
if(m_nRailDist<=0)
|
|
{
|
|
dc << XLine(ptTo, ptTemp);
|
|
ads_polar(ptTemp, m_nRotation+PI/2, fabs(m_nRailDist), ptL);
|
|
dc<<XLine(ptTemp,ptL);
|
|
}
|
|
else
|
|
{
|
|
ads_polar(ptTo, m_nRotation+m_nStartSide==OFFSET_LEFT?PI:0, fabs(m_nRailDistToSide), ptL);
|
|
ads_polar(ptTemp, m_nRotation+m_nStartSide==OFFSET_LEFT?0:PI, fabs(m_nRailDistToSide), ptR);
|
|
dc << XLine(ptL, ptR);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ads_polar(ptTo, m_nRotation-PI/2, fabs(nIdent), ptTemp);
|
|
if((m_nRailDistToSide>=0&&((m_nRailDist>m_nRailWidth&&(IsConnectRail()||(!IsConnectRail()&&m_nStairFlag==SF_TOP)))))
|
|
||(m_nRailDistToSide<=-m_nRailWidth&&m_nRailDist<0)
|
|
||m_nRailDist<-fabs(nIdent)) //楼板线不被遮挡
|
|
{
|
|
if((m_nRailDist>0&&m_nRailDist<m_nRailWidth&&m_nStairFlag==SF_TOP))
|
|
{
|
|
XPoint ptTmp;
|
|
ads_polar(ptTemp, m_nRotation-PI*0.5, m_nRailDist-m_nRailWidth, ptTmp);
|
|
dc << XLine(ptTmp, ptTo);
|
|
}
|
|
else if((m_nRailDistToSide>=0&&m_nRailDist<0&&m_nRailDist>nIdent+m_nRailWidth&&m_nStairFlag==SF_TOP))
|
|
{
|
|
XPoint ptTmp;
|
|
ads_polar(ptTemp, m_nRotation-PI*0.5, m_nRailDist, ptTmp);
|
|
dc << XLine(ptTmp, ptTemp);
|
|
ads_polar(ptTemp, m_nRotation+PI*0.5, m_nRailWidth, ptTmp);
|
|
dc << XLine(ptTmp, ptTo);
|
|
}
|
|
else if((m_nRailDist>-m_nRailWidth&&m_nRailDist<0&&m_nStairFlag==SF_TOP&&m_nRailDistToSide>=0))
|
|
{
|
|
XPoint ptTmp;
|
|
ads_polar(ptTemp, m_nRotation-PI*0.5, m_nRailDist, ptTmp);
|
|
dc << XLine(ptTmp, ptTemp);
|
|
}
|
|
else
|
|
{
|
|
dc << XLine(ptFrom, ptTemp) << XLine(ptTemp, ptTo);
|
|
}
|
|
}
|
|
else if(m_nRailDistToSide>=0&&m_nRailDist<m_nRailWidth&&(IsConnectRail()||(!IsConnectRail()&&m_nStairFlag==SF_TOP)))
|
|
{
|
|
XPoint ptL,ptR;
|
|
ads_polar(ptTo, m_nRotation-PI/2, fabs(nIdent)+m_nRailDist-m_nRailWidth, ptL);
|
|
dc<<XLine(ptTo,ptL);
|
|
if(m_nRailDist<0)
|
|
{
|
|
ads_polar(ptTemp, m_nRotation+PI/2, fabs(m_nRailDist), ptTo);
|
|
dc << XLine(ptFrom, ptTemp) << XLine(ptTemp, ptTo);
|
|
}
|
|
|
|
}
|
|
else if(m_nRailDistToSide<=-m_nRailWidth&&m_nRailDist>=0)//楼板线被扶手线打断
|
|
{
|
|
dc << XLine(ptTemp, ptTo);
|
|
XPoint ptL,ptR;
|
|
ads_polar(ptTemp, m_nRotation+m_nStartSide==OFFSET_LEFT?PI:0, fabs(m_nRailDistToSide+m_nRailWidth), ptL);
|
|
dc << XLine(ptTemp, ptL);
|
|
ads_polar(ptFrom, m_nRotation+m_nStartSide==OFFSET_LEFT?0:PI, fabs(m_nRailDistToSide+m_nRailWidth), ptR);
|
|
|
|
if(!(m_nStairFlag==SF_TOP&&m_nRailDist<m_nRailWidth))
|
|
dc << XLine(ptFrom, ptR);
|
|
if((m_nRailDist>=m_nRailWidth)
|
|
||(m_nRailDist>=0&&!IsConnectRail()&&m_nStairFlag!=SF_TOP))
|
|
{
|
|
ads_polar(ptL, m_nRotation+m_nStartSide==OFFSET_LEFT?PI:0, m_nRailWidth, ptL);
|
|
ads_polar(ptR, m_nRotation+m_nStartSide==OFFSET_LEFT?0:PI, m_nRailWidth, ptR);
|
|
dc << XLine(ptL, ptR);
|
|
}
|
|
}
|
|
else if(m_nRailDistToSide<=0&&m_nRailDistToSide>=-m_nRailWidth)//楼板线两端被扶手遮挡
|
|
{
|
|
if(((m_nRailDist>=m_nRailWidth)||(m_nRailDist>=0&&m_nStairFlag!=SF_TOP&&!IsConnectRail()))||m_nRailDist<=0)
|
|
{
|
|
XPoint ptL,ptR;
|
|
if(m_nRailDist<=0)
|
|
{
|
|
dc << XLine(ptFrom, ptTemp);
|
|
ads_polar(ptTemp, m_nRotation+PI/2, fabs(m_nRailDist), ptL);
|
|
dc<<XLine(ptTemp,ptL);
|
|
}
|
|
else
|
|
{
|
|
ads_polar(ptTemp, m_nRotation+m_nStartSide==OFFSET_LEFT?PI:0, fabs(m_nRailDistToSide), ptL);
|
|
ads_polar(ptFrom, m_nRotation+m_nStartSide==OFFSET_LEFT?0:PI, fabs(m_nRailDistToSide), ptR);
|
|
dc << XLine(ptL, ptR);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if((m_nRailDist<=0)
|
|
||(((!IsConnectRail())||(IsConnectRail()&&m_nRailDist>=m_nRailWidth))&&m_nRailDistToSide>=0)
|
|
)//楼板线不被扶手遮挡
|
|
{
|
|
if(!(m_nRailDist>0&&m_nRailDist<m_nRailWidth&&m_nStairFlag==SF_TOP))
|
|
dc << XLine(ptFrom, ptTo);
|
|
}
|
|
else if(m_nRailDist>=0&&m_nRailDistToSide<=-m_nRailWidth)//楼板线被扶手打断
|
|
{
|
|
XPoint ptL,ptR;
|
|
ads_polar(ptFrom, m_nRotation+m_nStartSide==OFFSET_LEFT?0:PI, fabs(m_nRailDistToSide+m_nRailWidth), ptL);
|
|
if(!(m_nStairFlag==SF_TOP&&m_nRailDist<m_nRailWidth))
|
|
dc << XLine(ptFrom, ptL);
|
|
ads_polar(ptTo, m_nRotation+m_nStartSide==OFFSET_LEFT?PI:0, fabs(m_nRailDistToSide+m_nRailWidth), ptR);
|
|
dc << XLine(ptTo, ptR);
|
|
if(m_nRailDist>=m_nRailWidth
|
|
||(!IsConnectRail()&&m_nRailDist>=0&&m_nStairFlag!=SF_TOP)
|
|
)
|
|
{
|
|
ads_polar(ptL, m_nRotation+m_nStartSide==OFFSET_LEFT?0:PI, m_nRailWidth, ptL);
|
|
ads_polar(ptR, m_nRotation+m_nStartSide==OFFSET_LEFT?PI:0, m_nRailWidth, ptR);
|
|
dc << XLine(ptL, ptR);
|
|
}
|
|
}
|
|
else if(((m_nRailDist>=m_nRailWidth)
|
|
||(m_nRailDist>=0&&m_nStairFlag!=SF_TOP&&!IsConnectRail()))
|
|
&&m_nRailDistToSide>=-m_nRailWidth&&m_nRailDistToSide<=0)//楼板线两端被扶手遮挡
|
|
{
|
|
XPoint ptL,ptR;
|
|
ads_polar(ptFrom, m_nRotation+m_nStartSide==OFFSET_LEFT?0:PI, fabs(m_nRailDistToSide), ptL);
|
|
ads_polar(ptTo, m_nRotation+m_nStartSide==OFFSET_LEFT?PI:0, fabs(m_nRailDistToSide), ptR);
|
|
dc << XLine(ptL, ptR);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//del by xlc on 080704 箭头在对象内部时删除
|
|
/*if(!objectId()) {
|
|
XPoint ptFrom, ptTo, ptEnd;
|
|
XPoint ptLoc1=stair1.GetLocation();
|
|
ptLoc1.z=0;
|
|
ads_polar(ptLoc1, m_nRotation, m_nStairWidth/2.0, ptFrom);
|
|
ads_polar(ptFrom, m_nRotation+PI/2.0, stair1.GetStairLength()/2.0, ptTo);
|
|
double nDirection=m_nRotation+PI/2.0;
|
|
ads_polar(ptTo, nDirection, 1.6*GetPScale(), ptEnd);
|
|
XPoint ptA, ptB;
|
|
ads_polar(ptTo, nDirection-PI/2.0, 0.5*GetPScale(), ptA);
|
|
ads_polar(ptTo, nDirection+PI/2.0, 0.5*GetPScale(), ptB);
|
|
dc << XLine(ptFrom, ptEnd) << XLine(ptEnd, ptA) << XLine(ptEnd, ptB);
|
|
}*/
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
|
|
// From TDbPolyPathEnt
|
|
Acad::ErrorStatus
|
|
TDbRectStair::GetPathPoly(XPoly2D &polyPath,AcGeVector3d&normal) const
|
|
{
|
|
assertReadEnabled();
|
|
TDbLineStair stair1, stair2;
|
|
TDbSlab slab;
|
|
TDbHandRail rail, railTop;
|
|
ExplodeTo(stair1, stair2, slab, rail,NULL,NULL, &railTop);
|
|
if(m_nStairFlag==SF_TOP)
|
|
railTop.GetBindPath(polyPath,normal);
|
|
else
|
|
rail.GetBindPath(polyPath,normal);
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus
|
|
TDbRectStair::SetPathPoly(const XPoly2D &polyPath,const AcGeVector3d&normal)
|
|
{
|
|
return Acad::eNotApplicable;
|
|
}
|
|
|
|
BOOL TDbRectStair::CalSectPos(double &lSectPos,double &rSectPos,XPoint &ptLeft2d,XPoint &ptRight2d)const
|
|
{
|
|
if(m_nStairFlag == SF_TOP)
|
|
return FALSE;
|
|
|
|
int nSectStair=GetSectStairPos();
|
|
if(nSectStair == -1) //剖断位置不正确
|
|
return FALSE;
|
|
|
|
TDbLineStair stair1, stair2, stair3;
|
|
TDbSlab slab;
|
|
TDbHandRail rail;
|
|
ExplodeTo(stair1, stair2, slab, rail);
|
|
|
|
XDirectionCurve cvLeft1,cvRight1;
|
|
double width=0; //剖断楼梯宽
|
|
double len=0; //剖断位置距楼梯起始点的距离
|
|
double length=0; //剖切梯段楼梯总长
|
|
double nSectStepNum=GetSectStepNum(); //剖断步数
|
|
if(nSectStepNum < 0) //负数调整为正的
|
|
{
|
|
nSectStepNum=GetSectStepNum()+m_nStepNum1+m_nStepNum2+1;
|
|
}
|
|
double nStepWidth=m_nStepWidth;
|
|
if(IsAscent())
|
|
nStepWidth=stair1.GetStairLength()/m_nStepNum1;
|
|
else
|
|
{
|
|
if(nSectStepNum==GetStepNum1()+GetStepNum2())
|
|
{
|
|
nSectStepNum-=2;
|
|
}
|
|
else if(nSectStepNum>=GetStepNum1())
|
|
{
|
|
nSectStepNum--;
|
|
}
|
|
}
|
|
|
|
len=(nSectStepNum-0.5)*nStepWidth;
|
|
if(nSectStair==0)
|
|
{
|
|
cvLeft1=stair1.GetSideCurve2d(0);
|
|
cvRight1=stair1.GetSideCurve2d(1);
|
|
width=stair1.GetStairWidth()*0.5;
|
|
length=stair1.GetStairLength();
|
|
}
|
|
else if(nSectStair==1)
|
|
{
|
|
cvLeft1=stair2.GetSideCurve2d(0);
|
|
cvRight1=stair2.GetSideCurve2d(1);
|
|
width=stair2.GetStairWidth()*0.5;
|
|
length=stair2.GetStairLength();
|
|
len-=stair1.GetStairLength();
|
|
}
|
|
else
|
|
{
|
|
return FALSE;
|
|
}
|
|
|
|
double dLen=0; //投影长
|
|
if(fabs(cos(m_dSectRotation))>_DIST_SNAP)
|
|
{
|
|
dLen=width*tan(m_dSectRotation);
|
|
}
|
|
else
|
|
{
|
|
return FALSE;
|
|
}
|
|
|
|
if((len+fabs(dLen)+nStepWidth/3.0 )>length
|
|
||(len-fabs(dLen)-nStepWidth/3.0 )<_DIST_SNAP) //剖断线转角过大,不能与梯段两边都相交
|
|
{
|
|
double dist=(len<length-len)?len:length-len;
|
|
dist -= nStepWidth/2;
|
|
|
|
if(tan(m_dSectRotation)>_DIST_SNAP)
|
|
{
|
|
dLen=dist;
|
|
}
|
|
else
|
|
{
|
|
dLen=-dist;
|
|
}
|
|
}
|
|
|
|
lSectPos=(len-dLen)/length;
|
|
rSectPos=(len+dLen)/length;
|
|
|
|
XPointDir2d pt;
|
|
cvLeft1.Polar(len-dLen, pt);
|
|
ptLeft2d=pt;
|
|
cvRight1.Polar(len+dLen, pt);
|
|
ptRight2d=pt;
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
//获得剖断线所在梯段:0,一跑梯段;1,二跑梯段;-1,没有剖断
|
|
int TDbRectStair::GetSectStairPos()const
|
|
{
|
|
if(m_nStairFlag==SF_TOP)
|
|
return -1;
|
|
|
|
/*int num=m_nStepNum1+m_nStepNum2;
|
|
if(!IsAscent())
|
|
num -= 2;
|
|
if(fabs(m_nSectStepNum)<1|| fabs(m_nSectStepNum)>num)
|
|
{
|
|
return -1;
|
|
}
|
|
|
|
int nSectStepNum=m_nSectStepNum; //剖断步数
|
|
if(nSectStepNum < 0) //负数调整为正的
|
|
{
|
|
if(IsAscent())
|
|
{
|
|
nSectStepNum=m_nSectStepNum+m_nStepNum1+m_nStepNum2+1;
|
|
}
|
|
else
|
|
{
|
|
nSectStepNum=m_nSectStepNum+m_nStepNum1+m_nStepNum2-1;
|
|
}
|
|
}
|
|
|
|
int nSectStair=0; //剖切梯段,默认一跑剖切
|
|
if(IsAscent())
|
|
{
|
|
if(nSectStepNum>m_nStepNum1)
|
|
{
|
|
nSectStair = 1; //二跑剖切
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if(nSectStepNum>m_nStepNum1-1)
|
|
{
|
|
nSectStair = 1; //二跑剖切
|
|
}
|
|
}
|
|
return nSectStair;*/
|
|
double dSectElev=m_dSectElev;
|
|
double height1=m_nStepHeight*m_nStepNum1;
|
|
if(IsAscent()&&fabs(dSectElev-height1)<0.3*GetStepHeight())
|
|
{
|
|
if(dSectElev-height1>_DIST_SNAP)
|
|
{
|
|
dSectElev=height1+0.5*GetStepHeight();
|
|
}
|
|
else
|
|
{
|
|
dSectElev=height1-0.5*GetStepHeight();
|
|
}
|
|
}
|
|
if(dSectElev>0&&dSectElev<m_nStepHeight*m_nStepNum1+_DIST_SNAP)//一跑剖切
|
|
return 0;
|
|
else if(dSectElev>m_nStepHeight*m_nStepNum1&&dSectElev<GetStairHeight())//二跑剖切
|
|
return 1;
|
|
else //无剖切
|
|
return -1;
|
|
}
|
|
// 由平面二维点推算剖切步数
|
|
int TDbRectStair::HitSectPosByPoint2d(XPoint ptHit2d) const
|
|
{
|
|
TDbLineStair stair1, stair2,stair3;
|
|
TDbSlab slab;
|
|
TDbHandRail rail;
|
|
ExplodeTo(stair1, stair2, slab, rail);
|
|
XDirectionCurve cvLeft1=stair1.GetSideCurve2d(0);
|
|
XDirectionCurve cvRight1=stair1.GetSideCurve2d(1);
|
|
XPoly2D poly1(1);
|
|
poly1.AppendNode(cvLeft1.StartPoint());
|
|
poly1.AppendNode(cvRight1.StartPoint());
|
|
poly1.AppendNode(cvRight1.EndPoint());
|
|
poly1.AppendNode(cvLeft1.EndPoint());
|
|
ptHit2d.z=0;
|
|
int nPosHit=-1;
|
|
if((ptHit2d&poly1)!=PR_OUTSIDE) //一跑梯段
|
|
{
|
|
XPoint ptPrj;
|
|
cvLeft1.ProjectToMe(ptHit2d, ptPrj);
|
|
nPosHit=(int)(ptPrj.Distance2d(cvLeft1.StartPoint())/m_nStepWidth);
|
|
nPosHit += 1;
|
|
}
|
|
else
|
|
{
|
|
XDirectionCurve cvLeft2=stair2.GetSideCurve2d(0);
|
|
XDirectionCurve cvRight2=stair2.GetSideCurve2d(1);
|
|
|
|
XPoly2D poly2(1);
|
|
poly2.AppendNode(cvLeft2.StartPoint());
|
|
poly2.AppendNode(cvRight2.StartPoint());
|
|
poly2.AppendNode(cvRight2.EndPoint());
|
|
poly2.AppendNode(cvLeft2.EndPoint());
|
|
if((ptHit2d&poly2)!=PR_OUTSIDE) //二跑梯段
|
|
{
|
|
XPoint ptPrj;
|
|
cvLeft2.ProjectToMe(ptHit2d, ptPrj);
|
|
nPosHit=(int)(ptPrj.Distance2d(cvLeft2.StartPoint())/m_nStepWidth);
|
|
nPosHit += m_nStepNum1;
|
|
}
|
|
}
|
|
|
|
return nPosHit;
|
|
}
|
|
//看剖切位置命中的目标,ptHit为剖切位置,返回值:0-没有命中,否则为命中的第n个梯段
|
|
// 1-第一个梯段;2-第2个梯段
|
|
int TDbRectStair::HitTestSectPos(int nSide, XPoint &ptHit2d) const
|
|
{
|
|
double nElev=nSide? m_rSectPos : m_lSectPos; //相对标高
|
|
if(!IsManualSectPos())
|
|
{
|
|
double nStairHeight1=GetStepNum1()*GetStepHeight();
|
|
nElev=nSide?0.6*nStairHeight1:0.4*nStairHeight1;
|
|
}
|
|
if(LessEqual(nElev, 0.0) ||
|
|
GreatEqual(nElev, GetStairHeight()))
|
|
return 0;
|
|
|
|
TDbLineStair stair1, stair2;
|
|
TDbSlab slab;
|
|
TDbHandRail rail;
|
|
ExplodeTo(stair1, stair2, slab, rail);
|
|
double nElev1=stair1.GetStairHeight();
|
|
|
|
int nRet=0;
|
|
XDirectionCurve cvHit;
|
|
double nDist=0.0;
|
|
if(LessThan(nElev, nElev1)) {
|
|
cvHit=stair1.GetSideCurve2d(nSide);
|
|
nDist=nElev/nElev1*cvHit.GetLength();
|
|
nRet=1;
|
|
} else if(GreatThan(nElev, nElev1)) {
|
|
cvHit=stair2.GetSideCurve2d(nSide);
|
|
nDist=(nElev-nElev1)/stair2.GetStairHeight()*cvHit.GetLength();
|
|
nRet=2;
|
|
} else
|
|
return 0;
|
|
XPointDir2d pt;
|
|
cvHit.Polar(nDist, pt);
|
|
ptHit2d=pt;
|
|
return nRet;
|
|
}
|
|
|
|
// 由平面二维点推算命中的相对高度
|
|
double TDbRectStair::HitElevationByPoint2d(XPoint ptHit2d) const
|
|
{
|
|
TDbLineStair stair1, stair2;
|
|
TDbSlab slab;
|
|
TDbHandRail rail;
|
|
ExplodeTo(stair1, stair2, slab, rail);
|
|
XDirectionCurve cvLeft1=stair1.GetSideCurve2d(0);
|
|
XDirectionCurve cvRight1=stair1.GetSideCurve2d(1);
|
|
XPoly2D poly1(1);
|
|
poly1.AppendNode(cvLeft1.StartPoint());
|
|
poly1.AppendNode(cvRight1.StartPoint());
|
|
poly1.AppendNode(cvRight1.EndPoint());
|
|
poly1.AppendNode(cvLeft1.EndPoint());
|
|
double nElevHit=0.0;
|
|
if((ptHit2d&poly1)!=PR_OUTSIDE)
|
|
{
|
|
XPoint ptPrj;
|
|
cvLeft1.ProjectToMe(ptHit2d, ptPrj);
|
|
if(IsAscent())
|
|
nElevHit=ptPrj.Distance2d(cvLeft1.StartPoint())/cvLeft1.GetLength()*stair1.GetStairHeight();
|
|
else
|
|
{
|
|
double h=ptPrj.Distance2d(cvLeft1.StartPoint())/cvLeft1.GetLength()*stair1.GetStairHeight();
|
|
double height=GetStepHeight();
|
|
double num=GetStepNum1();
|
|
for(int k=0;k<num;k++)
|
|
{
|
|
if(h>height*k&&h<height*(k+1)+_DIST_SNAP)
|
|
{
|
|
nElevHit+=height*(k+0.5);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
XDirectionCurve cvLeft2=stair2.GetSideCurve2d(0);
|
|
XDirectionCurve cvRight2=stair2.GetSideCurve2d(1);
|
|
|
|
XPoly2D poly2(1);
|
|
poly2.AppendNode(cvLeft2.StartPoint());
|
|
poly2.AppendNode(cvRight2.StartPoint());
|
|
poly2.AppendNode(cvRight2.EndPoint());
|
|
poly2.AppendNode(cvLeft2.EndPoint());
|
|
if((ptHit2d&poly2)!=PR_OUTSIDE)
|
|
{
|
|
XPoint ptPrj;
|
|
cvLeft2.ProjectToMe(ptHit2d, ptPrj);
|
|
if(IsAscent())
|
|
nElevHit=stair1.GetStairHeight() + ptPrj.Distance2d(cvLeft2.StartPoint())/cvLeft2.GetLength()*stair2.GetStairHeight();
|
|
else
|
|
{
|
|
double h=ptPrj.Distance2d(cvLeft2.StartPoint())/cvLeft2.GetLength()*stair2.GetStairHeight();
|
|
double height=GetStepHeight();
|
|
double num=GetStepNum2();
|
|
for(int k=0;k<num;k++)
|
|
{
|
|
if(h>height*k&&h<height*(k+1)+_DIST_SNAP)
|
|
{
|
|
nElevHit+=height*(k+0.5);
|
|
break;
|
|
}
|
|
}
|
|
nElevHit+=stair1.GetStairHeight();
|
|
}
|
|
}
|
|
}
|
|
return nElevHit;
|
|
}
|
|
|
|
void TDbRectStair::SetDefaultSectPos()
|
|
{
|
|
assertWriteEnabled();
|
|
double nStairHeight1=GetStepNum1()*GetStepHeight();
|
|
m_lSectPos = 0.4*nStairHeight1;
|
|
m_rSectPos = 0.6*nStairHeight1;
|
|
}
|
|
|
|
|
|
// Attribute Access method
|
|
Adesk::UInt8
|
|
TDbRectStair::GetStepNum1() const
|
|
{
|
|
assertReadEnabled();
|
|
return m_nStepNum1;
|
|
}
|
|
|
|
Adesk::UInt8
|
|
TDbRectStair::GetStepNum2() const
|
|
{
|
|
assertReadEnabled();
|
|
return m_nStepNum2;
|
|
}
|
|
|
|
double
|
|
TDbRectStair::GetStepHeight() const
|
|
{
|
|
assertReadEnabled();
|
|
return m_nStepHeight;
|
|
}
|
|
|
|
|
|
void
|
|
TDbRectStair::SetStepNum1(Adesk::UInt8 n)
|
|
{
|
|
assertWriteEnabled();
|
|
m_nStepNum1=n;
|
|
}
|
|
|
|
void
|
|
TDbRectStair::SetStepNum2(Adesk::UInt8 n)
|
|
{
|
|
assertWriteEnabled();
|
|
m_nStepNum2=n;
|
|
}
|
|
|
|
double
|
|
TDbRectStair::GetSlabSize() const
|
|
{
|
|
assertReadEnabled();
|
|
return m_nSlabSize;
|
|
}
|
|
|
|
double
|
|
TDbRectStair::GetRailHeight() const
|
|
{
|
|
assertReadEnabled();
|
|
return m_nRailHeight;
|
|
}
|
|
|
|
double
|
|
TDbRectStair::GetRailWidth() const
|
|
{
|
|
assertReadEnabled();
|
|
return m_nRailWidth;
|
|
}
|
|
|
|
double
|
|
TDbRectStair::GetRailDistToSide() const
|
|
{
|
|
assertReadEnabled();
|
|
return m_nRailDistToSide;
|
|
}
|
|
|
|
|
|
double
|
|
TDbRectStair::GetSpaceWidth() const
|
|
{
|
|
assertReadEnabled();
|
|
return m_nSpaceWidth;
|
|
}
|
|
|
|
double
|
|
TDbRectStair::GetStairWidth() const
|
|
{
|
|
assertReadEnabled();
|
|
return m_nStairWidth;
|
|
}
|
|
|
|
double
|
|
TDbRectStair::GetStepWidth() const
|
|
{
|
|
assertReadEnabled();
|
|
return m_nStepWidth;
|
|
}
|
|
|
|
Adesk::UInt8
|
|
TDbRectStair::GetStairFlag() const
|
|
{
|
|
assertReadEnabled();
|
|
return m_nStairFlag;
|
|
}
|
|
|
|
double
|
|
TDbRectStair::GetElevation() const
|
|
{
|
|
assertReadEnabled();
|
|
return m_ptLocation.z;
|
|
}
|
|
|
|
XPoint
|
|
TDbRectStair::GetLocation() const
|
|
{
|
|
assertReadEnabled();
|
|
return m_ptLocation;
|
|
}
|
|
|
|
double
|
|
TDbRectStair::GetRotation() const
|
|
{
|
|
assertReadEnabled();
|
|
return m_nRotation;
|
|
}
|
|
|
|
int
|
|
TDbRectStair::GetStartSide() const
|
|
{
|
|
assertReadEnabled();
|
|
return m_nStartSide;
|
|
}
|
|
|
|
int
|
|
TDbRectStair::GetAlignment() const
|
|
{
|
|
assertReadEnabled();
|
|
return m_nAlignment;
|
|
}
|
|
|
|
|
|
XPoint
|
|
TDbRectStair::GetUpRight2d() const
|
|
{
|
|
assertReadEnabled();
|
|
XPoint pt=GetUpLeft2d();
|
|
ads_polar(XPoint(pt), m_nRotation, m_nSpaceWidth, pt);
|
|
return pt;
|
|
}
|
|
|
|
XPoint
|
|
TDbRectStair::GetUpLeft2d() const
|
|
{
|
|
assertReadEnabled();
|
|
XPoint pt=m_ptLocation;
|
|
pt.z=0;
|
|
return pt;
|
|
}
|
|
|
|
void
|
|
TDbRectStair::SetSlabSize(double s)
|
|
{
|
|
assertWriteEnabled();
|
|
m_nSlabSize=s;
|
|
}
|
|
|
|
void
|
|
TDbRectStair::SetRailHeight(double l)
|
|
{
|
|
assertWriteEnabled();
|
|
m_nRailHeight=l;
|
|
}
|
|
|
|
void
|
|
TDbRectStair::SetRailWidth(double w)
|
|
{
|
|
assertWriteEnabled();
|
|
m_nRailWidth=w;
|
|
}
|
|
|
|
void
|
|
TDbRectStair::SetRailDistToSide(double l)
|
|
{
|
|
assertWriteEnabled();
|
|
m_nRailDistToSide=l;
|
|
}
|
|
|
|
|
|
void
|
|
TDbRectStair::SetStairFlag(Adesk::UInt8 flag)
|
|
{
|
|
assertWriteEnabled();
|
|
m_nStairFlag=flag;
|
|
}
|
|
|
|
void
|
|
TDbRectStair::SetSpaceWidth(double w)
|
|
{
|
|
assertWriteEnabled();
|
|
m_nSpaceWidth=w;
|
|
}
|
|
void
|
|
TDbRectStair::SetStepWidth(double w)
|
|
{
|
|
assertWriteEnabled();
|
|
m_nStepWidth=w;
|
|
}
|
|
void
|
|
TDbRectStair::SetStairWidth(double w)
|
|
{
|
|
assertWriteEnabled();
|
|
m_nStairWidth=w;
|
|
}
|
|
|
|
void
|
|
TDbRectStair::SetElevation(double elev)
|
|
{
|
|
assertWriteEnabled();
|
|
m_ptLocation.z = elev;
|
|
}
|
|
|
|
void
|
|
TDbRectStair::SetLocation(const XPoint &pt)
|
|
{
|
|
assertWriteEnabled();
|
|
m_ptLocation = pt;
|
|
}
|
|
|
|
void
|
|
TDbRectStair::SetRotation(double rot)
|
|
{
|
|
assertWriteEnabled();
|
|
m_nRotation=rot;
|
|
}
|
|
|
|
void
|
|
TDbRectStair::SetStartSide(int nSide)
|
|
{
|
|
assertWriteEnabled();
|
|
m_nStartSide=nSide;
|
|
}
|
|
|
|
void
|
|
TDbRectStair::SetAlignment(int nSide)
|
|
{
|
|
assertWriteEnabled();
|
|
m_nAlignment=nSide;
|
|
}
|
|
|
|
void
|
|
TDbRectStair::SetStepHeight(double h)
|
|
{
|
|
assertWriteEnabled();
|
|
m_nStepHeight=h;
|
|
}
|
|
|
|
|
|
// TArch6 memeber
|
|
BOOL TDbRectStair::IsAutoRail() const
|
|
{
|
|
return ((m_nFlagEx&SFEX_AUTORAIL)!=0);
|
|
}
|
|
|
|
BOOL TDbRectStair::IsOutRail()const
|
|
{
|
|
return (m_nFlagEx&SFEX_OUTRAIL)!=0;
|
|
}
|
|
void TDbRectStair::SetOutRail(BOOL bTrue)
|
|
{
|
|
if(bTrue)
|
|
m_nFlagEx|=SFEX_OUTRAIL;
|
|
else
|
|
m_nFlagEx&=~SFEX_OUTRAIL;
|
|
}
|
|
BOOL TDbRectStair::IsArcPlatform() const
|
|
{
|
|
return ((m_nFlagEx&SFEX_ARCPLAT)!=0);
|
|
}
|
|
|
|
BOOL TDbRectStair::HasSideBeam(int nSide) const
|
|
{
|
|
int nBitFlag=nSide? SFEX_RBEAM : SFEX_LBEAM;
|
|
return ((m_nFlagEx&nBitFlag)!=0);
|
|
}
|
|
|
|
BOOL TDbRectStair::IsAscent() const
|
|
{
|
|
return ((m_nFlagEx&SFEX_ASCENT)!=0);
|
|
}
|
|
|
|
BOOL TDbRectStair::IsOnGround() const
|
|
{
|
|
return ((m_nFlagEx&SFEX_GROUND)!=0);
|
|
}
|
|
|
|
BOOL TDbRectStair::HasSlant() const
|
|
{
|
|
return ((m_nFlagEx&SFEX_SLANT)!=0);
|
|
}
|
|
|
|
void TDbRectStair::SetAutoRail(BOOL bTrue)
|
|
{
|
|
assertWriteEnabled();
|
|
if(bTrue)
|
|
m_nFlagEx |= SFEX_AUTORAIL;
|
|
else
|
|
m_nFlagEx &= ~SFEX_AUTORAIL;
|
|
}
|
|
|
|
void TDbRectStair::SetAscent(BOOL bTrue)
|
|
{
|
|
assertWriteEnabled();
|
|
if(bTrue)
|
|
m_nFlagEx |= SFEX_ASCENT;
|
|
else
|
|
m_nFlagEx &= ~SFEX_ASCENT;
|
|
}
|
|
|
|
void TDbRectStair::SetOnGround(BOOL bTrue)
|
|
{
|
|
assertWriteEnabled();
|
|
if(bTrue)
|
|
m_nFlagEx |= SFEX_GROUND;
|
|
else
|
|
m_nFlagEx &= ~SFEX_GROUND;
|
|
}
|
|
|
|
void TDbRectStair::SetSlant(BOOL bTrue)
|
|
{
|
|
assertWriteEnabled();
|
|
if(bTrue)
|
|
m_nFlagEx |= SFEX_SLANT;
|
|
else
|
|
m_nFlagEx &= ~SFEX_SLANT;
|
|
}
|
|
|
|
void TDbRectStair::SetArcPlatform(BOOL bTrue)
|
|
{
|
|
assertWriteEnabled();
|
|
if(bTrue)
|
|
m_nFlagEx |= SFEX_ARCPLAT;
|
|
else
|
|
m_nFlagEx &= ~SFEX_ARCPLAT;
|
|
}
|
|
|
|
void TDbRectStair::SetSideBeam(int nSide, BOOL bTrue)
|
|
{
|
|
assertWriteEnabled();
|
|
int nBitFlag=nSide? SFEX_RBEAM : SFEX_LBEAM;
|
|
if(bTrue)
|
|
m_nFlagEx |= nBitFlag;
|
|
else
|
|
m_nFlagEx &= ~nBitFlag;
|
|
}
|
|
|
|
|
|
double TDbRectStair::GetBeamHeight() const
|
|
{
|
|
return m_nBeamHeight;
|
|
}
|
|
|
|
double TDbRectStair::GetBeamThick() const
|
|
{
|
|
return m_nBeamThick;
|
|
}
|
|
|
|
double TDbRectStair::GetSlabThick() const
|
|
{
|
|
return m_nSlabThick;
|
|
}
|
|
|
|
AcDbObjectId TDbRectStair::GetLayerBeam3d() const
|
|
{
|
|
return m_idLayerBeam3d;
|
|
}
|
|
|
|
AcDbObjectId TDbRectStair::GetLayerStep3d() const
|
|
{
|
|
return m_idLayerStep3d;
|
|
}
|
|
|
|
AcDbObjectId TDbRectStair::GetLayerHand3d() const
|
|
{
|
|
return m_idLayerHand3d;
|
|
}
|
|
|
|
AcDbObjectId TDbRectStair::GetLayerRail3d() const
|
|
{
|
|
return m_idLayerRail3d;
|
|
}
|
|
|
|
void TDbRectStair::SetBeamHeight(double val)
|
|
{
|
|
assertWriteEnabled();
|
|
m_nBeamHeight = val;
|
|
}
|
|
|
|
void TDbRectStair::SetSlabThick(double val)
|
|
{
|
|
assertWriteEnabled();
|
|
m_nSlabThick=val;
|
|
}
|
|
|
|
void TDbRectStair::SetBeamThick(double val)
|
|
{
|
|
assertWriteEnabled();
|
|
m_nBeamThick=val;
|
|
}
|
|
|
|
void TDbRectStair::SetLayerBeam3d(AcDbObjectId idLayer)
|
|
{
|
|
assertWriteEnabled();
|
|
m_idLayerBeam3d=idLayer;
|
|
}
|
|
|
|
void TDbRectStair::SetLayerStep3d(AcDbObjectId idLayer)
|
|
{
|
|
assertWriteEnabled();
|
|
m_idLayerStep3d=idLayer;
|
|
}
|
|
|
|
|
|
void TDbRectStair::SetLayerHand3d(AcDbObjectId idLayer)
|
|
{
|
|
assertWriteEnabled();
|
|
m_idLayerHand3d=idLayer;
|
|
}
|
|
|
|
void TDbRectStair::SetLayerRail3d(AcDbObjectId idLayer)
|
|
{
|
|
assertWriteEnabled();
|
|
m_idLayerRail3d=idLayer;
|
|
}
|
|
|
|
// TArch8 memeber
|
|
void
|
|
TDbRectStair::SetSlabSize2(double s)
|
|
{
|
|
assertWriteEnabled();
|
|
m_nSlabSize2=s;
|
|
}
|
|
|
|
double
|
|
TDbRectStair::GetSlabSize2() const
|
|
{
|
|
assertReadEnabled();
|
|
double nSlabSize2=m_nSlabSize2;
|
|
if(GetAlignment()!=3)
|
|
{
|
|
if(GetAlignment()!=0)
|
|
{
|
|
double nLen1=(IsAscent()? m_nStepNum1 : (m_nStepNum1-1))*m_nStepWidth,
|
|
nLen2=(IsAscent()? m_nStepNum2 : (m_nStepNum2-1))*m_nStepWidth;
|
|
double dist=nLen1-nLen2;
|
|
if(dist>_DIST_SNAP)
|
|
{
|
|
nSlabSize2=GetSlabSize()+dist*(GetAlignment()==1?0.5:1);
|
|
}
|
|
else
|
|
{
|
|
nSlabSize2=GetSlabSize();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
nSlabSize2=GetSlabSize();
|
|
}
|
|
}
|
|
return nSlabSize2;
|
|
}
|
|
|
|
void
|
|
TDbRectStair::SetSlabSize1(double s)
|
|
{
|
|
assertWriteEnabled();
|
|
m_nSlabSize1=s;
|
|
}
|
|
|
|
double
|
|
TDbRectStair::GetSlabSize1() const
|
|
{
|
|
assertReadEnabled();
|
|
double nSlabSize1=m_nSlabSize1;
|
|
if(GetAlignment()!=3)
|
|
{
|
|
if(GetAlignment()!=0)
|
|
{
|
|
double nLen1=(IsAscent()? m_nStepNum1 : (m_nStepNum1-1))*m_nStepWidth,
|
|
nLen2=(IsAscent()? m_nStepNum2 : (m_nStepNum2-1))*m_nStepWidth;
|
|
double dist=nLen1-nLen2;
|
|
if(dist>_DIST_SNAP)
|
|
{
|
|
nSlabSize1=GetSlabSize();
|
|
}
|
|
else
|
|
{
|
|
nSlabSize1=GetSlabSize()-dist*(GetAlignment()==1?0.5:1);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
nSlabSize1=GetSlabSize();
|
|
}
|
|
}
|
|
return nSlabSize1;
|
|
}
|
|
|
|
double TDbRectStair::GetSectElev()const
|
|
{
|
|
return m_dSectElev;
|
|
}
|
|
void TDbRectStair::SetSectElev(double r)
|
|
{
|
|
assertWriteEnabled();
|
|
m_dSectElev = r;
|
|
}
|
|
BOOL TDbRectStair::IsAutoOutRail() const
|
|
{
|
|
return ((m_nFlagEx&SFEX_AUTOOUTRAIL)!=0);
|
|
}
|
|
void TDbRectStair::SetAutoOutRail(BOOL bTrue)
|
|
{
|
|
assertWriteEnabled();
|
|
if(bTrue)
|
|
m_nFlagEx |= SFEX_AUTOOUTRAIL;
|
|
else
|
|
m_nFlagEx &= ~SFEX_AUTOOUTRAIL;
|
|
}
|
|
double TDbRectStair::GetTextHeight()const
|
|
{
|
|
return m_dTextHeight;
|
|
}
|
|
void TDbRectStair::SetTextHeight(double h)
|
|
{
|
|
assertWriteEnabled();
|
|
m_dTextHeight=h;
|
|
}
|
|
double TDbRectStair::GetSectRotation()const
|
|
{
|
|
return m_dSectRotation;
|
|
}
|
|
void TDbRectStair::SetSectRotation(double r)
|
|
{
|
|
assertWriteEnabled();
|
|
m_dSectRotation=r;
|
|
}
|
|
double TDbRectStair::GetSectStepNum()const
|
|
{
|
|
double nLen1=m_nStepWidth*(IsAscent()?m_nStepNum1:m_nStepNum1-1),
|
|
nLen2=m_nStepWidth*(IsAscent()?m_nStepNum2:m_nStepNum2-1),
|
|
height1=m_nStepHeight*m_nStepNum1,
|
|
height2=m_nStepHeight*m_nStepNum2;
|
|
|
|
double nStepWidth=nLen1/m_nStepNum1;
|
|
double nSectStepNum=0;
|
|
double dSectElev=m_dSectElev;
|
|
if(IsAscent()&&fabs(dSectElev-height1)<0.3*GetStepHeight())
|
|
{
|
|
if(dSectElev-height1>_DIST_SNAP)
|
|
{
|
|
dSectElev=height1+0.5*GetStepHeight();
|
|
}
|
|
else
|
|
{
|
|
dSectElev=height1-0.5*GetStepHeight();
|
|
}
|
|
}
|
|
if(dSectElev>height1)
|
|
{
|
|
if(IsAscent())
|
|
{
|
|
nSectStepNum=nLen2*(dSectElev-height1)/(height2*nStepWidth);
|
|
nSectStepNum+=m_nStepNum1;
|
|
}
|
|
else
|
|
{
|
|
nSectStepNum=dSectElev/m_nStepHeight;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if(IsAscent())
|
|
nSectStepNum=nLen1*dSectElev/(height1*nStepWidth);
|
|
else
|
|
nSectStepNum=dSectElev/m_nStepHeight;
|
|
}
|
|
return nSectStepNum+0.5;
|
|
}
|
|
void TDbRectStair::SetSectStepNum(double n)
|
|
{
|
|
assertWriteEnabled();
|
|
|
|
double nSectStepNum=(int)(GetStepNum1()/2);
|
|
if(n>0&&n<=GetStepNum1()+GetStepNum2())
|
|
{
|
|
nSectStepNum=n;
|
|
}
|
|
m_dSectElev=(nSectStepNum-0.5)*m_nStepHeight;
|
|
}
|
|
double TDbRectStair::GetRailDistMid() const
|
|
{
|
|
return m_nRailDistMid;
|
|
}
|
|
void TDbRectStair::SetRailDistMid(double w)
|
|
{
|
|
assertWriteEnabled();
|
|
m_nRailDistMid=w;
|
|
}
|
|
double TDbRectStair::GetRailDist() const
|
|
{
|
|
return m_nRailDist;
|
|
}
|
|
void TDbRectStair::SetRailDist(double w)
|
|
{
|
|
assertWriteEnabled();
|
|
m_nRailDist=w;
|
|
}
|
|
|
|
void TDbRectStair::SetArrow(BOOL bTrue)
|
|
{
|
|
assertWriteEnabled();
|
|
if(bTrue)
|
|
m_nFlagEx|=SFEX_ARROW;
|
|
else
|
|
m_nFlagEx&=~SFEX_ARROW;
|
|
}
|
|
BOOL TDbRectStair::IsArrow() const
|
|
{
|
|
return ((m_nFlagEx&SFEX_ARROW)!=0);
|
|
}
|
|
|
|
void TDbRectStair::SetSingleEvaRadius(BOOL bTrue)//设置单侧疏散半径
|
|
{
|
|
assertWriteEnabled();
|
|
if(bTrue)
|
|
m_nFlagEx|=SFEX_SEVARADIUS;
|
|
else
|
|
m_nFlagEx&=~SFEX_SEVARADIUS;
|
|
}
|
|
void TDbRectStair::SetDoubleEvaRadius(BOOL bTrue)//设置双侧疏散半径
|
|
{
|
|
assertWriteEnabled();
|
|
if(bTrue)
|
|
m_nFlagEx|=SFEX_DEVARADIUS;
|
|
else
|
|
m_nFlagEx&=~SFEX_DEVARADIUS;
|
|
}
|
|
|
|
BOOL TDbRectStair::IsSingleEvaRadius() const//是否有单侧疏散半径
|
|
{
|
|
return ((m_nFlagEx&SFEX_SEVARADIUS)!=0);
|
|
}
|
|
BOOL TDbRectStair::IsDoubleEvaRadius() const //是否有双侧疏散半径
|
|
{
|
|
return ((m_nFlagEx&SFEX_DEVARADIUS)!=0);
|
|
}
|
|
BOOL TDbRectStair::IsEvaRadius() const //是否有疏散半径
|
|
{
|
|
if (IsSingleEvaRadius() == FALSE && IsDoubleEvaRadius() == FALSE)
|
|
return FALSE;
|
|
else
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
double TDbRectStair::GetSlopeLength1()const
|
|
{
|
|
assertReadEnabled();
|
|
return m_dSlopeLength1;
|
|
}
|
|
double TDbRectStair::GetSlopeLength2()const
|
|
{
|
|
assertReadEnabled();
|
|
return m_dSlopeLength2;
|
|
}
|
|
void TDbRectStair::SetSlopeLength1(double l)
|
|
{
|
|
assertWriteEnabled();
|
|
m_dSlopeLength1=l;
|
|
}
|
|
void TDbRectStair::SetSlopeLength2(double l)
|
|
{
|
|
assertWriteEnabled();
|
|
m_dSlopeLength2=l;
|
|
}
|
|
AcDbObjectId TDbRectStair::GetLayerText() const
|
|
{
|
|
return m_idLayerText;
|
|
}
|
|
AcDbObjectId TDbRectStair::GetTextStyle() const
|
|
{
|
|
return m_idTextStyle;
|
|
}
|
|
AcDbObjectId TDbRectStair::GetLayerArrow() const
|
|
{
|
|
return m_idLayerArrow;
|
|
}
|
|
void TDbRectStair::SetLayerText(AcDbObjectId idLayer)
|
|
{
|
|
assertWriteEnabled();
|
|
m_idLayerText=idLayer;
|
|
}
|
|
void TDbRectStair::SetTextStyle(AcDbObjectId idStyle)
|
|
{
|
|
assertWriteEnabled();
|
|
m_idTextStyle=idStyle;
|
|
}
|
|
void TDbRectStair::SetLayerArrow(AcDbObjectId idLayer)
|
|
{
|
|
assertWriteEnabled();
|
|
m_idLayerArrow=idLayer;
|
|
}
|
|
|
|
//add by xlc 090426,箭头文字,动态数据
|
|
CString TDbRectStair::GetTextUp() const
|
|
{
|
|
assertReadEnabled();
|
|
CString sVal(_T("上"));
|
|
const TEntityFields &fd = GetFields();
|
|
fd.GFD(_T("上楼箭头文字"), sVal);
|
|
return sVal;
|
|
}
|
|
|
|
void TDbRectStair::SetTextUp(const TCHAR *sVal)
|
|
{
|
|
assertWriteEnabled();
|
|
TEntityFields &fd = Fields();
|
|
fd.SFD(_T("上楼箭头文字"), sVal);
|
|
}
|
|
CString TDbRectStair::GetTextDown() const
|
|
{
|
|
assertReadEnabled();
|
|
CString sVal(_T("下"));
|
|
const TEntityFields &fd = GetFields();
|
|
fd.GFD(_T("下楼箭头文字"), sVal);
|
|
return sVal;
|
|
}
|
|
|
|
void TDbRectStair::SetTextDown(const TCHAR *sVal)
|
|
{
|
|
assertWriteEnabled();
|
|
TEntityFields &fd = Fields();
|
|
fd.SFD(_T("下楼箭头文字"), sVal);
|
|
}
|
|
|
|
// sg add 100722,支持统一标高
|
|
bool TDbRectStair::UnifyElevation(double dElevation)
|
|
{
|
|
SetElevation(dElevation);
|
|
return true;
|
|
}
|
|
|
|
// cet 2013.9.5 add
|
|
CString TDbRectStair::GetXml(const AcGeMatrix3d& mat) const
|
|
{
|
|
CString sXml;
|
|
AcDbVoidPtrArray arrEnts;
|
|
explode(arrEnts);
|
|
int nSize = arrEnts.length();
|
|
for (int i = 0; i < nSize; ++i)
|
|
{
|
|
AcDbEntity *pEnt = (AcDbEntity*)arrEnts[i];
|
|
if (pEnt == NULL)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
TDbLineStair *pLineStair = TDbLineStair::cast(pEnt);
|
|
if (pLineStair != NULL)
|
|
{
|
|
sXml += pLineStair->GetXml(mat);
|
|
continue;
|
|
}
|
|
|
|
TDbSlab *pSlab = TDbSlab::cast(pEnt);
|
|
if (pSlab != NULL)
|
|
{
|
|
sXml += pSlab->GetXml(mat);
|
|
}
|
|
}
|
|
ReleaseEntSet(arrEnts);
|
|
return sXml;
|
|
}
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|