4402 lines
123 KiB
C++
4402 lines
123 KiB
C++
#include "stdafx.h"
|
||
#include "TDbColumn.h"
|
||
|
||
////////////////////////////////////////////////////////////////////////////
|
||
|
||
// ver: 0-TArch8
|
||
const Adesk::UInt8 TDbParallelStair::g_nVersion = 0;
|
||
|
||
|
||
ACRX_DXF_DEFINE_MEMBERS(ATSParallelStair, ATSPolyPathEnt, AcDb::kDHL_CURRENT, AcDb::kMReleaseCurrent,
|
||
1, ATS_PARALLELSTAIR, "ATS_PARALLELSTAIR图形无法解析, 请下载上华软件|网址: www.shanghuasoft.com");
|
||
|
||
IMPLEMENT_TENTBASE(TDbParallelStair);
|
||
|
||
TDbParallelStair::TDbParallelStair()
|
||
{
|
||
m_nStepHeight=_AS_SYS_UNIT(220.0); //踏步高
|
||
m_nStepWidth=_AS_SYS_UNIT(300); //踏步宽
|
||
m_nStairWidth=_AS_SYS_UNIT(1200); //边梯段宽
|
||
m_nMStairWidth=_AS_SYS_UNIT(1200); //中梯段宽
|
||
m_nSlabSize=_AS_SYS_UNIT(1200); //休息平台尺寸
|
||
m_nSlabSizeSide=_AS_SYS_UNIT(1200); //休息平台边段尺寸
|
||
m_nSlabSizeMid=_AS_SYS_UNIT(1200); //休息平台中段尺寸
|
||
m_nRotation=0.0; //旋转角度
|
||
m_nStepNum1=m_nStepNum2=0; //一跑和二跑步数
|
||
m_nSpaceWidth=_AS_SYS_UNIT(3600.0); //楼梯间尺寸
|
||
m_nRailHeight=_AS_SYS_UNIT(900);
|
||
m_nStairFlag=1; //楼层标记
|
||
m_nStartSide=OFFSET_MID; //中梯起步
|
||
m_nAlignment=0; //踏步取齐: 0--齐休息平台, 1--齐中间, 2--齐楼板
|
||
|
||
m_nRailWidth=_AS_SYS_UNIT(60.0); //扶手宽度
|
||
m_nRailDistMid=m_nStepWidth*0.5; //层间转角处扶手伸出距离
|
||
m_nRailDist=m_nStepWidth*0.5; //层与层连接处扶手伸出距离
|
||
m_dSectRotation=PI/6.0; //剖断线旋转角度
|
||
|
||
m_nFlagEx=0;
|
||
m_nBeamHeight=_AS_SYS_UNIT(200); //边梁高,坡道专用
|
||
m_nBeamThick=_AS_SYS_UNIT(120); //边梁厚度
|
||
m_nSlabThick=_AS_SYS_UNIT(120); //板厚或梁厚
|
||
|
||
m_nViewCtrl=0; //自动确定
|
||
m_nFlagEx |= SFEX_SECTPOS;
|
||
m_dTextHeight=3.5;
|
||
}
|
||
|
||
|
||
TDbParallelStair::~TDbParallelStair()
|
||
{
|
||
}
|
||
|
||
BOOL TDbParallelStair::IsValid() const
|
||
{
|
||
BOOL bRet=TDbEntity::IsValid();
|
||
if(!bRet)
|
||
return bRet;
|
||
|
||
bRet=(m_nStepHeight>_DIST_SNAP && //踏步高
|
||
m_nStepWidth>_DIST_SNAP && //踏步宽
|
||
m_nStairWidth>_DIST_SNAP && //边梯段宽
|
||
m_nMStairWidth>_DIST_SNAP && //中梯段宽
|
||
m_dTextHeight>0&& //字高
|
||
m_nStepNum1>1 && //边梯步数
|
||
m_nStepNum2>1 && //中梯步数
|
||
m_nSpaceWidth-2*m_nStairWidth-m_nMStairWidth>-_DIST_SNAP && //楼梯间尺寸
|
||
m_nRailHeight>_DIST_SNAP && //扶手高
|
||
m_nRailWidth>_DIST_SNAP && //扶手宽
|
||
GreatEqual(m_nRailDistToSide,-(m_nSpaceWidth-m_nStairWidth*2-m_nMStairWidth)/4.0) && //扶手距边
|
||
GreatEqual(m_nBeamHeight, 0.0) &&//边梁高
|
||
GreatEqual(m_nBeamThick, 0.0) &&//边梁厚
|
||
GreatEqual(m_nSlabThick, 0.0) &&//休息台厚
|
||
m_nStairWidth>m_nRailWidth+m_nRailDistToSide); //扶手高度
|
||
return bRet;
|
||
}
|
||
|
||
// 提供对格式刷的支持
|
||
void TDbParallelStair::CopyPropertiesFrom(AcDbEntity *pSrcEntity, unsigned gMatchFlag)
|
||
{
|
||
assertWriteEnabled();
|
||
TDbPolyPathEnt::CopyPropertiesFrom(pSrcEntity, gMatchFlag);
|
||
TDbParallelStair *pSrc=TDbParallelStair::cast(pSrcEntity);
|
||
if(pSrc) {
|
||
m_nStepHeight=pSrc->m_nStepHeight;
|
||
m_nStepWidth=pSrc->m_nStepWidth;
|
||
m_nStairWidth=pSrc->m_nStairWidth;
|
||
m_nMStairWidth=pSrc->m_nMStairWidth;
|
||
m_nSlabSize=pSrc->m_nSlabSize;
|
||
m_nSlabSizeSide=pSrc->m_nSlabSizeSide;
|
||
m_nSlabSizeMid=pSrc->m_nSlabSizeMid;
|
||
m_nStepNum1=pSrc->m_nStepNum1;
|
||
m_nStepNum2=pSrc->m_nStepNum2;
|
||
m_dTextHeight=pSrc->m_dTextHeight;
|
||
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;
|
||
m_nRailDistMid=pSrc->m_nRailDistMid;
|
||
m_nRailDist=pSrc->m_nRailDist;
|
||
m_dSectRotation=pSrc->m_dSectRotation;
|
||
m_nSectStepNum=pSrc->m_nSectStepNum;
|
||
m_nStartSide=pSrc->m_nStartSide;
|
||
|
||
m_nFlagEx=pSrc->m_nFlagEx;
|
||
m_nBeamHeight=pSrc->m_nBeamHeight; //边梁高,坡道专用
|
||
m_nBeamThick=pSrc->m_nBeamThick; //边梁厚度
|
||
m_nSlabThick=pSrc->m_nSlabThick; //板厚或梁厚
|
||
|
||
//add by xlc on 090426箭头文字
|
||
SetTextUp(pSrc->GetTextUp());
|
||
SetTextDown(pSrc->GetTextDown());
|
||
|
||
if(database()==NULL||
|
||
pSrcEntity->database()==NULL||
|
||
database()==pSrcEntity->database())
|
||
{
|
||
m_idLayerHand3d=pSrc->m_idLayerHand3d;
|
||
m_idLayerStep3d=pSrc->m_idLayerStep3d;
|
||
m_idLayerBeam3d=pSrc->m_idLayerBeam3d;
|
||
m_idLayerRail3d=pSrc->m_idLayerRail3d;
|
||
m_idLayerArrow=pSrc->m_idLayerArrow;
|
||
m_idLayerText=pSrc->m_idLayerText;
|
||
m_idTextStyle=pSrc->m_idTextStyle;
|
||
}
|
||
|
||
m_nViewCtrl=pSrc->m_nViewCtrl;
|
||
}
|
||
}
|
||
|
||
Acad::ErrorStatus
|
||
TDbParallelStair::subGetClassID(CLSID* pClsid) const
|
||
{
|
||
return Acad::eOk;
|
||
}
|
||
|
||
// 从DWG读入数据:
|
||
Acad::ErrorStatus
|
||
TDbParallelStair::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_nMStairWidth); //中梯段宽
|
||
pFiler->readItem(&m_nSlabSize); //休息平台尺寸
|
||
pFiler->readItem(&m_nSlabSizeSide); //休息平台边段尺寸
|
||
pFiler->readItem(&m_nSlabSizeMid); //休息平台中段尺寸
|
||
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); //扶手距离边
|
||
pFiler->readItem(&m_nRailDistMid); //层间转角处扶手伸出距离
|
||
pFiler->readItem(&m_nRailDist); //层与层连接处扶手伸出距离
|
||
pFiler->readItem(&m_nSectStepNum); //剖断步数
|
||
pFiler->readItem(&m_dSectRotation); //剖断转角
|
||
pFiler->readItem(&m_dTextHeight); //字高
|
||
|
||
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);
|
||
pFiler->readItem(&m_idLayerText);
|
||
pFiler->readItem(&m_idTextStyle);
|
||
pFiler->readItem(&m_idLayerArrow);
|
||
pFiler->readItem(&m_nViewCtrl);
|
||
|
||
return pFiler->filerStatus();
|
||
}
|
||
|
||
Acad::ErrorStatus
|
||
TDbParallelStair::dwgOutFields(AcDbDwgFiler* pFiler) const
|
||
{
|
||
assertReadEnabled();
|
||
Acad::ErrorStatus es = TDbPolyPathEnt::dwgOutFields(pFiler);
|
||
if(es != Acad::eOk) return es;
|
||
|
||
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_nMStairWidth); //中梯段宽
|
||
pFiler->writeItem(m_nSlabSize); //休息平台尺寸
|
||
pFiler->writeItem(m_nSlabSizeSide); //休息平台边段尺寸
|
||
pFiler->writeItem(m_nSlabSizeMid); //休息平台中段尺寸
|
||
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); //扶手距离边
|
||
|
||
//TArch8
|
||
pFiler->writeItem(m_nRailDistMid); //层间转角处扶手伸出距离
|
||
pFiler->writeItem(m_nRailDist); //层与层连接处扶手伸出距离
|
||
pFiler->writeItem(m_nSectStepNum); //剖断步数
|
||
pFiler->writeItem(m_dSectRotation); //剖断转角
|
||
pFiler->writeItem(m_dTextHeight); //字高
|
||
|
||
pFiler->writeItem(m_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_idLayerText);
|
||
pFiler->writeItem(m_idTextStyle);
|
||
pFiler->writeItem(m_idLayerArrow);
|
||
pFiler->writeItem(m_nViewCtrl);
|
||
|
||
return pFiler->filerStatus();
|
||
}
|
||
|
||
|
||
Acad::ErrorStatus
|
||
TDbParallelStair::dxfInFields (AcDbDxfFiler* pFiler)
|
||
{
|
||
assertWriteEnabled();
|
||
|
||
Acad::ErrorStatus es = TDbPolyPathEnt::dxfInFields(pFiler);
|
||
if(es!=Acad::eOk)
|
||
return es;
|
||
|
||
if (!pFiler->atSubclassData(_T("TDbParallelStair"))) {
|
||
return Acad::eBadDxfSequence;
|
||
}
|
||
|
||
Adesk::Int32 fieldsFlags=0;
|
||
resbuf rb;
|
||
double r1, r2, r3, r4, r5, r6, r7, r8, r9,r10;
|
||
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::kDxfReal+8:
|
||
r10=rb.resval.rreal;
|
||
fieldsFlags |= 0x10000;
|
||
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_nSlabSizeMid=rb.resval.rreal;
|
||
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;
|
||
|
||
case 75:
|
||
m_nViewCtrl=(Adesk::UInt8)rb.resval.rint;
|
||
break;
|
||
case 76:
|
||
m_nSectStepNum=(int)rb.resval.rint;
|
||
break;
|
||
case 90:
|
||
m_nFlagEx=rb.resval.rlong;
|
||
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;
|
||
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&0x10000)) {
|
||
pFiler->setError(Acad::eMissingDxfField, _T("\nMissing DXF group code: 49"));
|
||
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);
|
||
SetMStairWidth(r10);
|
||
|
||
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
|
||
TDbParallelStair::dxfOutFields(AcDbDxfFiler* pFiler) const
|
||
{
|
||
assertReadEnabled();
|
||
Acad::ErrorStatus es;
|
||
|
||
es = TDbPolyPathEnt::dxfOutFields(pFiler);
|
||
assert(es == Acad::eOk);
|
||
|
||
es = pFiler->writeItem(AcDb::kDxfSubclass,_T("TDbParallelStair"));
|
||
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::kDxfReal+8, GetMStairWidth());
|
||
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, GetSlabSizeMid());
|
||
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->writeInt16(AcDb::kDxfInt16+6, m_nSectStepNum);
|
||
pFiler->writeInt32(90, m_nFlagEx);
|
||
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));
|
||
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
|
||
TDbParallelStair::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 nDist=GetSlabSizeSide()+(m_nStepNum1-1)*m_nStepWidth/2.0;
|
||
ads_polar(ptUpLeft, m_nRotation-PI/2.0, nDist, ptLeft);
|
||
ads_polar(ptUpRight, m_nRotation-PI/2.0, nDist, 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);
|
||
|
||
double dStairWidth=0.0; //井宽
|
||
dStairWidth = (GetSpaceWidth() - GetStairWidth()*2.0-GetMStairWidth())/2.0;
|
||
if(dStairWidth < _DIST_SNAP)
|
||
{
|
||
dStairWidth=0.0;
|
||
}
|
||
// 6,7--楼梯中梯宽度
|
||
XPoint ptLeft2, ptRight2;
|
||
ads_polar(ptLeft1, m_nRotation, dStairWidth, ptLeft2);
|
||
ads_polar(ptLeft2, m_nRotation-PI*0.5, m_nStepWidth, ptLeft2);
|
||
ads_polar(ptRight1, m_nRotation+PI, dStairWidth, ptRight2);
|
||
ads_polar(ptRight2, m_nRotation-PI*0.5, m_nStepWidth, ptRight2);
|
||
gripPoints.append(ptLeft2);
|
||
gripPoints.append(ptRight2);
|
||
|
||
// 8--休息平台
|
||
Midpoint(ptUpLeft,ptUpRight,ptLeft2);
|
||
gripPoints.append(ptLeft2);
|
||
|
||
// 9--中梯段位置
|
||
ads_polar(ptLeft2, m_nRotation-PI/2.0, GetSlabSizeMid(), ptLeft2);
|
||
gripPoints.append(ptLeft2);
|
||
|
||
// 10,11--边梯段位置
|
||
XPoint ptSlabLeft, ptSlabRight;
|
||
ads_polar(ptUpLeft, m_nRotation-PI/2.0, GetSlabSizeSide(), ptSlabLeft);
|
||
ads_polar(ptUpRight, m_nRotation-PI/2.0, GetSlabSizeSide(), ptSlabRight);
|
||
gripPoints.append(ptSlabLeft);
|
||
gripPoints.append(ptSlabRight);
|
||
|
||
{
|
||
XPoint ptTmp;
|
||
//12,13--休息平台段扶手伸出距离
|
||
ads_polar(ptUpLeft, m_nRotation-PI/2, min(GetSlabSizeSide(),GetSlabSizeMid())-m_nRailDistMid, ptTmp);
|
||
ads_polar(ptTmp, m_nRotation, m_nStairWidth+dStairWidth*0.5, ptTmp);
|
||
gripPoints.append(ptTmp);
|
||
ads_polar(ptTmp, m_nRotation, m_nMStairWidth+dStairWidth, ptTmp);
|
||
gripPoints.append(ptTmp);
|
||
|
||
double nLenSide=GetStepWidth()*(GetStepNum1()-1)+GetSlabSizeSide(),
|
||
nLenMid=GetStepWidth()*(GetStepNum2()-1)+GetSlabSizeMid(); //梯段与平台总长
|
||
//14,15--楼层连接段扶手伸出距离
|
||
ads_polar(ptUpLeft, m_nRotation-PI/2, m_nRailDist+max(nLenMid,nLenSide), ptTmp);
|
||
ads_polar(ptTmp, m_nRotation, m_nStairWidth+dStairWidth*0.5, ptTmp);
|
||
gripPoints.append(ptTmp);
|
||
ads_polar(ptTmp, m_nRotation, m_nMStairWidth+dStairWidth, ptTmp);
|
||
gripPoints.append(ptTmp);
|
||
|
||
}
|
||
|
||
{ //剖切线
|
||
XPoint ptLeft, ptRight;
|
||
double lSectPos,rSectPos;
|
||
if(CalSectPos(lSectPos,rSectPos,ptLeft,ptRight))
|
||
{
|
||
XPoint ptMid;
|
||
Midpoint(ptLeft,ptRight,ptMid);
|
||
gripPoints.append(ptMid);
|
||
gripPoints.append(ptLeft);
|
||
gripPoints.append(ptRight);
|
||
|
||
int nSectStair=GetSectStairPos();
|
||
if(nSectStair==1)//边梯有两段剖切线
|
||
{
|
||
ads_polar(ptLeft, m_nRotation, (GetSpaceWidth() - GetStairWidth()), ptLeft);
|
||
ads_polar(ptRight, m_nRotation, (GetSpaceWidth() - GetStairWidth()), ptRight);
|
||
gripPoints.append(ptLeft);
|
||
gripPoints.append(ptRight);
|
||
Midpoint(ptLeft,ptRight,ptMid);
|
||
gripPoints.append(ptMid);
|
||
}
|
||
}
|
||
}
|
||
|
||
return Acad::eOk;
|
||
}
|
||
|
||
Acad::ErrorStatus
|
||
TDbParallelStair::subGetStretchPoints(AcGePoint3dArray & stretchPoints) const
|
||
{
|
||
assertReadEnabled();
|
||
XPoint ptUpLeft=GetUpLeft2d();
|
||
stretchPoints.append(ptUpLeft);
|
||
return Acad::eOk;
|
||
}
|
||
|
||
Acad::ErrorStatus
|
||
TDbParallelStair::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:
|
||
case 7:
|
||
cs=_T("改中梯段宽度");
|
||
break;
|
||
case 8:
|
||
cs=_T("改平台宽");
|
||
break;
|
||
case 9:
|
||
cs=_T("改中梯段位置");
|
||
break;
|
||
case 10:
|
||
case 11:
|
||
cs=_T("改边梯段位置");
|
||
break;
|
||
case 12:
|
||
case 13:
|
||
case 14:
|
||
case 15:
|
||
cs=_T("改扶手伸出距离");
|
||
break;
|
||
case 16:
|
||
case 21:
|
||
cs=_T("移动剖切位置");
|
||
break;
|
||
case 17:
|
||
case 18:
|
||
case 19:
|
||
case 20:
|
||
cs=_T("修改剖切角度");
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
return Acad::eOk;
|
||
}
|
||
|
||
|
||
Acad::ErrorStatus
|
||
TDbParallelStair::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_dSectRotation=-m_dSectRotation;
|
||
}
|
||
m_nRotation = ads_angle(m_ptLocation, ptX);
|
||
return Acad::eOk;
|
||
}
|
||
|
||
Acad::ErrorStatus
|
||
TDbParallelStair::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) {
|
||
m_ptLocation += vtOffset;
|
||
}
|
||
break;
|
||
case 2: //改楼梯间宽度
|
||
if(m_nSpaceWidth-nIncWidth > _DIST_SNAP && -1.0E-6<m_nSpaceWidth-nIncWidth-m_nStairWidth*2-m_nMStairWidth)
|
||
{
|
||
m_nSpaceWidth -= nIncWidth;
|
||
ads_polar(XPoint(m_ptLocation), m_nRotation, nIncWidth, m_ptLocation);
|
||
}
|
||
else if(m_nSpaceWidth-nIncWidth-m_nStairWidth*2-m_nMStairWidth<_DIST_SNAP)
|
||
{
|
||
double width=m_nSpaceWidth-m_nStairWidth*2-m_nMStairWidth;
|
||
ads_polar(XPoint(m_ptLocation), m_nRotation, width/2, m_ptLocation);
|
||
m_nSpaceWidth = m_nStairWidth*2+m_nMStairWidth;
|
||
}
|
||
break;
|
||
case 3: //改楼梯间宽度
|
||
if(m_nSpaceWidth+nIncWidth > _DIST_SNAP && -1.0E-6<m_nSpaceWidth+nIncWidth-2*m_nStairWidth-m_nMStairWidth)
|
||
{
|
||
m_nSpaceWidth += nIncWidth;
|
||
}
|
||
else if(m_nSpaceWidth-nIncWidth-m_nStairWidth*2-m_nMStairWidth<_DIST_SNAP)
|
||
{
|
||
m_nSpaceWidth = m_nStairWidth*2+m_nMStairWidth;
|
||
}
|
||
break;
|
||
case 4: //改边梯段宽度
|
||
if(m_nStairWidth+nIncWidth > _DIST_SNAP && -1.0E-6<m_nSpaceWidth-2*(m_nStairWidth+nIncWidth)-m_nMStairWidth)
|
||
m_nStairWidth += nIncWidth;
|
||
break;
|
||
case 5: //改边梯段宽度
|
||
if(m_nStairWidth-nIncWidth > _DIST_SNAP && -1.0E-6<m_nSpaceWidth-2*(m_nStairWidth-nIncWidth)-m_nMStairWidth)
|
||
m_nStairWidth -= nIncWidth;
|
||
break;
|
||
case 6: //改中梯段宽度
|
||
if(m_nMStairWidth-2*nIncWidth > _DIST_SNAP && -1.0E-6<m_nSpaceWidth-2*(m_nStairWidth-nIncWidth)-m_nMStairWidth)
|
||
m_nMStairWidth -= (2*nIncWidth);
|
||
break;
|
||
case 7: //改中梯段宽度
|
||
if(m_nMStairWidth+2*nIncWidth > _DIST_SNAP && -1.0E-6<m_nSpaceWidth-2*(m_nStairWidth+nIncWidth)-m_nMStairWidth)
|
||
m_nMStairWidth += (2*nIncWidth);
|
||
break;
|
||
case 8: //改休息平台尺寸
|
||
if(GetSlabSizeSide()+nIncLen>_DIST_SNAP&&GetSlabSizeMid()+nIncLen>_DIST_SNAP)
|
||
{
|
||
m_nSlabSizeSide = GetSlabSizeSide()+nIncLen;
|
||
m_nSlabSizeMid = GetSlabSizeMid()+nIncLen;
|
||
m_nSlabSize += nIncLen;
|
||
ads_polar(XPoint(m_ptLocation), m_nRotation+PI*0.5, nIncLen, m_ptLocation);
|
||
}
|
||
else
|
||
{
|
||
double nSize=GetSlabSizeSide()>GetSlabSizeMid()?GetSlabSizeMid():GetSlabSizeSide();
|
||
m_nSlabSizeSide = GetSlabSizeSide()-nSize;
|
||
m_nSlabSizeMid = GetSlabSizeMid()-nSize;
|
||
m_nSlabSize -= nSize;
|
||
ads_polar(XPoint(m_ptLocation), m_nRotation+PI*0.5, -nSize, m_ptLocation);
|
||
}
|
||
break;
|
||
case 9: //改中梯段位置
|
||
if(GetSlabSizeMid()-nIncLen>_DIST_SNAP)
|
||
m_nSlabSizeMid = GetSlabSizeMid()-nIncLen;
|
||
else
|
||
m_nSlabSizeMid = 0;
|
||
|
||
//modify xlc on 090730 预览显示不正确
|
||
//if(GetSlabSizeMid()<GetSlabSizeSide())
|
||
// m_nSlabSize = m_nSlabSizeMid;
|
||
if(m_nSlabSizeMid<GetSlabSizeSide())
|
||
{
|
||
m_nSlabSize = m_nSlabSizeMid;
|
||
}
|
||
else
|
||
{
|
||
m_nSlabSize = GetSlabSizeSide();
|
||
}
|
||
m_nAlignment=3;
|
||
break;
|
||
case 10:
|
||
case 11:
|
||
if(GetSlabSizeSide()-nIncLen>_DIST_SNAP)
|
||
m_nSlabSizeSide = GetSlabSizeSide()-nIncLen;
|
||
else
|
||
m_nSlabSizeSide = 0;
|
||
//modify xlc on 090730 预览显示不正确
|
||
//if(GetSlabSizeSide()<GetSlabSizeMid())
|
||
// m_nSlabSize = m_nSlabSizeSide;
|
||
if(m_nSlabSizeSide<GetSlabSizeMid())
|
||
m_nSlabSize = m_nSlabSizeSide;
|
||
else
|
||
m_nSlabSize = GetSlabSizeMid();
|
||
m_nAlignment=3;
|
||
break;
|
||
case 12:
|
||
case 13:
|
||
if(m_nRailDistMid+nIncLen>_DIST_SNAP)
|
||
m_nRailDistMid += nIncLen;
|
||
else
|
||
m_nRailDistMid = 0;
|
||
break;
|
||
case 14:
|
||
case 15:
|
||
if(m_nRailDist-nIncLen>-0.5*(m_nStepNum1>m_nStepNum2?m_nStepNum2:m_nStepNum1)*m_nStepWidth-_DIST_SNAP)
|
||
m_nRailDist -= nIncLen;
|
||
break;
|
||
case 16:
|
||
case 17:
|
||
case 18:
|
||
case 19:
|
||
case 20:
|
||
case 21: //剖切位置
|
||
{
|
||
double lSectPos,rSectPos;
|
||
XPoint ptLeft2d,ptRight2d;
|
||
double angle=m_dSectRotation;
|
||
if(CalSectPos(lSectPos,rSectPos,ptLeft2d,ptRight2d))
|
||
{
|
||
XPoint ptMid;
|
||
Midpoint(ptLeft2d,ptRight2d,ptMid);
|
||
if(idx==16||idx==21)
|
||
{
|
||
XPoint ptHit2d;
|
||
if(idx==16)
|
||
ptHit2d=ptMid;
|
||
else
|
||
ads_polar(ptMid, m_nRotation, (GetSpaceWidth() - GetStairWidth()), ptHit2d);
|
||
ptHit2d += vtOffset;
|
||
int nPosHit=HitSectPosByPoint2d(ptHit2d);
|
||
if(nPosHit!=-1)
|
||
{
|
||
m_nSectStepNum = nPosHit;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
|
||
XPoint ptTmp;
|
||
ads_polar(ptMid, m_nRotation, m_nMStairWidth, ptTmp);
|
||
AcGeVector3d vectFrom,vectTo;
|
||
vectFrom=ptMid-ptTmp;
|
||
if((idx-15)%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
|
||
TDbParallelStair::subMoveStretchPointsAt(const AcDbIntArray& indices,
|
||
const AcGeVector3d& offset)
|
||
{
|
||
assertWriteEnabled();
|
||
if(indices.length()) {
|
||
AcGeMatrix3d mat;
|
||
mat.setToTranslation(offset);
|
||
subTransformBy(mat);
|
||
}
|
||
return Acad::eOk;
|
||
}
|
||
|
||
const TCHAR *
|
||
TDbParallelStair::GetDefaultLayer() const
|
||
{
|
||
return LAY_STAIR;
|
||
}
|
||
|
||
void
|
||
TDbParallelStair::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(GetMStairWidth())));
|
||
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==1)
|
||
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("中跑")));
|
||
}
|
||
//中跑起步时的内侧扶手
|
||
void TDbParallelStair::GetRailFromMid(TDbLineStair &stair1, //[in/out]边跑左梯段
|
||
TDbLineStair &stair2, //[in/out]中跑梯段
|
||
TDbLineStair &stair3, //[in/out]边跑右梯段
|
||
XPoly2D &polyRail, //[in/out]内侧左扶手
|
||
XPoly2D &polyRail2, //[in/out]内侧右扶手
|
||
XPoint &ptStart, //[in/out]左侧扶手顶点
|
||
XPoint &ptStart2 //[in/out]右侧扶手顶点
|
||
)const
|
||
{
|
||
double nDistToSide=((GetSpaceWidth()-2*GetStairWidth()-GetMStairWidth())<_DIST_SNAP*2&&m_nRailDistToSide<0) ?
|
||
_AS_SYS_UNIT(0) : m_nRailDistToSide;
|
||
nDistToSide += m_nRailWidth/2;
|
||
|
||
double dStairWidth=0.0; //井宽
|
||
dStairWidth = (m_nSpaceWidth - m_nStairWidth*2.0-m_nMStairWidth)/2.0;
|
||
if(dStairWidth < _DIST_SNAP)
|
||
{
|
||
dStairWidth=0.0;
|
||
}
|
||
|
||
//梯段位置
|
||
XPoint ptLoc1, ptLoc2, ptLoc3;
|
||
ptLoc1 = stair1.GetLocation();
|
||
ptLoc2 = stair2.GetLocation();
|
||
ptLoc3 = stair3.GetLocation();
|
||
|
||
//梯段长度
|
||
double nLen1=(m_nStepNum1-1)*m_nStepWidth,
|
||
nLen2=(m_nStepNum2-1)*m_nStepWidth;
|
||
|
||
double nRailDist=m_nRailDist-m_nRailWidth*0.5,
|
||
nRailDistMid=m_nRailDistMid-m_nRailWidth*0.5; //扶手有连接时回缩半个扶手宽度
|
||
//扶手伸出距离为负时产生的高差
|
||
double elev1=(nRailDist/nLen2)*(stair2.GetStairHeight()-m_nStepHeight),
|
||
elev2=(nRailDistMid/nLen2)*(stair2.GetStairHeight()-m_nStepHeight);
|
||
|
||
double nLenSide=nLen1+GetSlabSizeSide(),nLenMid=nLen2+GetSlabSizeMid(); //梯段与平台总长,判断是否齐楼板
|
||
if(m_nStairFlag!=SF_TOP)
|
||
{
|
||
BOOL bFlag=FALSE;
|
||
//if(m_nStairFlag!=SF_FIRST && nLen2<nLen1-_DIST_SNAP && m_nAlignment!=2)// 踏步不与楼板取齐
|
||
if(m_nStairFlag!=SF_FIRST && nLenMid<nLenSide-_DIST_SNAP)// 踏步不与楼板取齐
|
||
{
|
||
//扶手在边梯起点
|
||
ads_polar(ptLoc1, m_nRotation-PI/2, nLen1+nRailDist, ptStart);
|
||
ads_polar(XPoint(ptStart), m_nRotation+PI, nDistToSide, ptStart);
|
||
|
||
ads_polar(ptLoc3, m_nRotation-PI/2, nLen1+nRailDist, ptStart2);
|
||
ads_polar(XPoint(ptStart2), m_nRotation+PI, m_nStairWidth-nDistToSide, ptStart2);
|
||
if(nRailDist > m_nStepWidth*0.5+_DIST_SNAP)
|
||
{
|
||
ptStart.z = ptLoc2.z;
|
||
}
|
||
else
|
||
{
|
||
ptStart.z = ptLoc2.z-m_nStepHeight*0.5+elev1;
|
||
}
|
||
polyRail.AppendNode(ptStart);
|
||
ptStart2.z = ptStart.z;
|
||
polyRail2.AppendNode(ptStart2);
|
||
|
||
//中梯与边梯下对齐点
|
||
ads_polar(XPoint(ptStart), m_nRotation, dStairWidth + nDistToSide*2, ptStart);
|
||
ads_polar(XPoint(ptStart2), m_nRotation+PI, dStairWidth + nDistToSide*2, ptStart2);
|
||
if(nRailDist > m_nStepWidth*0.5+_DIST_SNAP)
|
||
{
|
||
ptStart.z = ptLoc2.z;
|
||
}
|
||
else
|
||
{
|
||
ptStart.z = ptLoc2.z+m_nStepHeight*0.5-elev1;
|
||
}
|
||
ptStart2.z = ptStart.z;
|
||
polyRail.AppendNode(ptStart);
|
||
polyRail2.AppendNode(ptStart2);
|
||
bFlag=TRUE;
|
||
|
||
}
|
||
if(m_nStairFlag==SF_MIDDLE)
|
||
{
|
||
//if(nLen2>nLen1+_DIST_SNAP && m_nAlignment!=2)
|
||
if(nLenMid>nLenSide+_DIST_SNAP)
|
||
{
|
||
//扶手在边梯起点
|
||
ads_polar(ptLoc1, m_nRotation-PI/2, nLen1+nRailDist, ptStart);
|
||
ads_polar(XPoint(ptStart), m_nRotation+PI, nDistToSide, ptStart);
|
||
|
||
ads_polar(ptLoc3, m_nRotation-PI/2, nLen1+nRailDist, ptStart2);
|
||
ads_polar(XPoint(ptStart2), m_nRotation+PI,
|
||
m_nStairWidth-nDistToSide, ptStart2);
|
||
if(nRailDist > m_nStepWidth*0.5+_DIST_SNAP)
|
||
{
|
||
ptStart.z = ptLoc2.z;
|
||
}
|
||
else
|
||
{
|
||
ptStart.z = ptLoc2.z-m_nStepHeight*0.5+elev1;
|
||
}
|
||
|
||
ptStart2.z = ptStart.z;
|
||
polyRail.AppendNode(ptStart);
|
||
polyRail2.AppendNode(ptStart2);
|
||
|
||
// 边梯下水平段顶点
|
||
//ads_polar(XPoint(ptStart), m_nRotation-PI/2.0, (m_nAlignment==1? (nLen2-nLen1)/2.0 : (nLen2-nLen1)), ptStart);
|
||
//ads_polar(XPoint(ptStart2), m_nRotation-PI/2.0, (m_nAlignment==1? (nLen2-nLen1)/2.0 : (nLen2-nLen1)), ptStart2);
|
||
ads_polar(XPoint(ptStart), m_nRotation-PI/2.0, nLenMid-nLenSide, ptStart);
|
||
ads_polar(XPoint(ptStart2), m_nRotation-PI/2.0, nLenMid-nLenSide, ptStart2);
|
||
|
||
polyRail.AppendNode(ptStart);
|
||
polyRail2.AppendNode(ptStart2);
|
||
}
|
||
else
|
||
{
|
||
if(!bFlag)
|
||
{
|
||
//扶手在边梯起点
|
||
ads_polar(ptLoc2, m_nRotation+PI, dStairWidth + nDistToSide, ptStart);
|
||
ads_polar(ptLoc2, m_nRotation, m_nMStairWidth + dStairWidth + nDistToSide, ptStart2);
|
||
|
||
ads_polar(XPoint(ptStart), m_nRotation-PI/2.0, nRailDist, ptStart);
|
||
ads_polar(XPoint(ptStart2), m_nRotation-PI/2.0,nRailDist, ptStart2);
|
||
if(nRailDist < m_nStepWidth*0.5-_DIST_SNAP)
|
||
{
|
||
ptStart.z = ptLoc2.z-m_nStepHeight*0.5+elev1;
|
||
}
|
||
|
||
ptStart2.z = ptStart.z;
|
||
polyRail.AppendNode(ptStart);
|
||
polyRail2.AppendNode(ptStart2);
|
||
|
||
}
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
//中梯下水平段点
|
||
/*if(nLen2<nLen1-_DIST_SNAP && m_nAlignment!=2)
|
||
{
|
||
double dDist=m_nAlignment==1?(nLen1-nLen2)*0.5:(nLen1-nLen2);
|
||
ads_polar(ptLoc2, m_nRotation, nDistToSide, ptStart);
|
||
ads_polar(XPoint(ptStart), m_nRotation-PI/2.0,dDist+nRailDist, ptStart);
|
||
|
||
ads_polar(ptLoc2, m_nRotation, m_nMStairWidth-nDistToSide, ptStart2);
|
||
ads_polar(XPoint(ptStart2), m_nRotation-PI/2.0, dDist+nRailDist, ptStart2);
|
||
|
||
if(nRailDist < m_nStepWidth*0.5-_DIST_SNAP)
|
||
{
|
||
ptStart.z = ptLoc2.z+m_nStepHeight*0.5-elev1;
|
||
}
|
||
|
||
ptStart2.z = ptStart.z;
|
||
polyRail.AppendNode(ptStart);
|
||
polyRail2.AppendNode(ptStart2);
|
||
}*/
|
||
}
|
||
|
||
//中梯扶手下顶点
|
||
ads_polar(ptLoc2, m_nRotation, nDistToSide, ptStart);
|
||
ads_polar(ptLoc2, m_nRotation, m_nMStairWidth-nDistToSide, ptStart2);
|
||
if(m_nStairFlag == SF_TOP)
|
||
{
|
||
if(nLenMid<nLenSide)
|
||
{
|
||
ads_polar(stair1.GetUpLeft2d(), m_nRotation, dStairWidth+nDistToSide, ptStart);
|
||
ads_polar(stair3.GetUpRight2d(), m_nRotation+PI, dStairWidth+nDistToSide, ptStart2);
|
||
|
||
if(nRailDist>=m_nRailWidth)
|
||
{
|
||
ptStart.z = ptLoc2.z+m_nStepHeight*0.5;
|
||
ptStart2.z = ptLoc2.z+m_nStepHeight*0.5;
|
||
}
|
||
else
|
||
{
|
||
ads_polar(XPoint(ptStart), m_nRotation-PI/2.0,nRailDist-m_nRailWidth*0.5, ptStart);
|
||
ads_polar(XPoint(ptStart2), m_nRotation-PI/2.0, nRailDist-m_nRailWidth*0.5, ptStart2);
|
||
ptStart.z = ptLoc2.z-elev1+m_nStepHeight*0.5;
|
||
ptStart2.z = ptLoc2.z-elev1+m_nStepHeight*0.5;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if(nRailDist>=m_nRailWidth)
|
||
{
|
||
ptStart.z = ptLoc2.z+m_nStepHeight*0.5;
|
||
ptStart2.z = ptLoc2.z+m_nStepHeight*0.5;
|
||
}
|
||
else
|
||
{
|
||
ads_polar(XPoint(ptStart), m_nRotation-PI/2.0,nRailDist-m_nRailWidth*0.5, ptStart);
|
||
ads_polar(XPoint(ptStart2), m_nRotation-PI/2.0, nRailDist-m_nRailWidth*0.5, ptStart2);
|
||
ptStart.z = ptLoc2.z-elev1+m_nStepHeight*0.5;
|
||
ptStart2.z = ptLoc2.z-elev1+m_nStepHeight*0.5;
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if(nRailDist > m_nStepWidth*0.5+_DIST_SNAP)
|
||
{
|
||
ads_polar(XPoint(ptStart), m_nRotation-PI/2.0, nRailDist, ptStart);
|
||
polyRail.AppendNode(ptStart);
|
||
ads_polar(XPoint(ptStart), m_nRotation+PI/2.0, nRailDist-m_nStepWidth*0.5, ptStart);
|
||
|
||
ads_polar(XPoint(ptStart2), m_nRotation-PI/2.0, nRailDist, ptStart2);
|
||
polyRail2.AppendNode(ptStart2);
|
||
ads_polar(XPoint(ptStart2), m_nRotation+PI/2.0, nRailDist-m_nStepWidth*0.5, ptStart2);
|
||
}
|
||
else
|
||
{
|
||
ads_polar(XPoint(ptStart), m_nRotation-PI/2.0,nRailDist, ptStart);
|
||
ads_polar(XPoint(ptStart2), m_nRotation-PI/2.0, nRailDist, ptStart2);
|
||
ptStart.z = ptLoc2.z-elev1+m_nStepHeight*0.5;
|
||
ptStart2.z = ptLoc2.z-elev1+m_nStepHeight*0.5;
|
||
}
|
||
}
|
||
|
||
|
||
polyRail.AppendNode(ptStart);
|
||
polyRail2.AppendNode(ptStart2);
|
||
|
||
//中梯扶手上顶点
|
||
ads_polar(ptLoc2, m_nRotation, nDistToSide, ptStart);
|
||
ads_polar(ptLoc2, m_nRotation, m_nMStairWidth-nDistToSide, ptStart2);
|
||
if(nRailDistMid > m_nStepWidth*0.5+_DIST_SNAP)
|
||
{
|
||
ads_polar(XPoint(ptStart), m_nRotation+PI/2.0, nLen2+m_nStepWidth*0.5, ptStart);
|
||
ptStart.z = ptLoc2.z+stair2.GetStairHeight();
|
||
polyRail.AppendNode(ptStart);
|
||
ads_polar(XPoint(ptStart), m_nRotation+PI/2.0, nRailDistMid-m_nStepWidth*0.5, ptStart);
|
||
|
||
ads_polar(XPoint(ptStart2), m_nRotation+PI/2.0, nLen2+m_nStepWidth*0.5, ptStart2);
|
||
ptStart2.z = ptLoc2.z+stair2.GetStairHeight();
|
||
polyRail2.AppendNode(ptStart2);
|
||
ads_polar(XPoint(ptStart2), m_nRotation+PI/2.0, nRailDistMid-m_nStepWidth*0.5, ptStart2);
|
||
}
|
||
else
|
||
{
|
||
ads_polar(XPoint(ptStart), m_nRotation+PI/2.0, nLen2+nRailDistMid, ptStart);
|
||
ptStart.z = ptLoc2.z+stair2.GetStairHeight()-m_nStepHeight*0.5+elev2;
|
||
ads_polar(XPoint(ptStart2), m_nRotation+PI/2.0, nLen2+nRailDistMid, ptStart2);
|
||
ptStart2.z = ptLoc2.z+stair2.GetStairHeight()-m_nStepHeight*0.5+elev2;
|
||
}
|
||
polyRail.AppendNode(ptStart);
|
||
polyRail2.AppendNode(ptStart2);
|
||
|
||
/*if(nLen1<nLen2-_DIST_SNAP)
|
||
{
|
||
if(m_nAlignment!=0)
|
||
{
|
||
//边梯休息台水平段顶点
|
||
ads_polar(XPoint(ptStart), m_nRotation+PI,dStairWidth+nDistToSide*2, ptStart);
|
||
if(nRailDistMid < m_nStepWidth*0.5-_DIST_SNAP)
|
||
{
|
||
ptStart.z = ptLoc1.z+m_nStepHeight*0.5-elev2;
|
||
}
|
||
polyRail.AppendNode(ptStart);
|
||
ads_polar(XPoint(ptStart2), m_nRotation,dStairWidth+nDistToSide*2, ptStart2);
|
||
ptStart2.z = ptStart.z;
|
||
polyRail2.AppendNode(ptStart2);
|
||
}
|
||
}
|
||
else if(nLen2<nLen1-_DIST_SNAP)
|
||
{
|
||
if(m_nAlignment!=0)
|
||
{
|
||
//中梯休息台水平段顶点
|
||
ads_polar(XPoint(ptStart), m_nRotation+PI/2.0,
|
||
(m_nAlignment==1? (nLen1-nLen2)/2.0 : (nLen1-nLen2)), ptStart);
|
||
polyRail.AppendNode(ptStart);
|
||
ads_polar(XPoint(ptStart2), m_nRotation+PI/2.0,
|
||
(m_nAlignment==1? (nLen1-nLen2)/2.0 : (nLen1-nLen2)), ptStart2);
|
||
polyRail2.AppendNode(ptStart2);
|
||
}
|
||
}*/
|
||
|
||
if(GetSlabSizeSide()>GetSlabSizeMid()+_DIST_SNAP)
|
||
{
|
||
//边梯休息台水平段顶点
|
||
ads_polar(XPoint(ptStart), m_nRotation+PI,dStairWidth+nDistToSide*2, ptStart);
|
||
if(nRailDistMid < m_nStepWidth*0.5-_DIST_SNAP)
|
||
{
|
||
ptStart.z = ptLoc1.z+m_nStepHeight*0.5-elev2;
|
||
}
|
||
polyRail.AppendNode(ptStart);
|
||
ads_polar(XPoint(ptStart2), m_nRotation,dStairWidth+nDistToSide*2, ptStart2);
|
||
ptStart2.z = ptStart.z;
|
||
polyRail2.AppendNode(ptStart2);
|
||
}
|
||
else if(GetSlabSizeMid()>GetSlabSizeSide()+_DIST_SNAP)
|
||
{
|
||
//中梯休息台水平段顶点
|
||
ads_polar(XPoint(ptStart), m_nRotation+PI/2.0,GetSlabSizeMid()-GetSlabSizeSide(), ptStart);
|
||
polyRail.AppendNode(ptStart);
|
||
ads_polar(XPoint(ptStart2), m_nRotation+PI/2.0,GetSlabSizeMid()-GetSlabSizeSide(), ptStart2);
|
||
polyRail2.AppendNode(ptStart2);
|
||
}
|
||
|
||
//边梯扶手上顶点
|
||
ads_polar(XPoint(ptLoc1), m_nRotation+PI,nDistToSide, ptStart);
|
||
ads_polar(XPoint(ptLoc3), m_nRotation+PI,m_nStairWidth-nDistToSide, ptStart2);
|
||
if(nRailDistMid > m_nStepWidth*0.5+_DIST_SNAP)
|
||
{
|
||
ads_polar(XPoint(ptStart), m_nRotation+PI/2.0,nRailDistMid, ptStart);
|
||
ads_polar(XPoint(ptStart2), m_nRotation+PI/2.0,nRailDistMid, ptStart2);
|
||
|
||
polyRail.AppendNode(ptStart);
|
||
polyRail2.AppendNode(ptStart2);
|
||
|
||
ads_polar(XPoint(ptStart), m_nRotation-PI/2.0,nRailDistMid-m_nStepWidth*0.5, ptStart);
|
||
ads_polar(XPoint(ptStart2), m_nRotation-PI/2.0,nRailDistMid-m_nStepWidth*0.5, ptStart2);
|
||
}
|
||
else
|
||
{
|
||
ads_polar(XPoint(ptStart), m_nRotation+PI/2.0,nRailDistMid, ptStart);
|
||
ads_polar(XPoint(ptStart2), m_nRotation+PI/2.0,nRailDistMid, ptStart2);
|
||
|
||
ptStart.z = ptLoc1.z + m_nStepHeight*0.5 - elev2;
|
||
ptStart2.z = ptStart.z;
|
||
}
|
||
polyRail.AppendNode(ptStart);
|
||
polyRail2.AppendNode(ptStart2);
|
||
|
||
//边梯扶手下顶点
|
||
ads_polar(ptLoc1, stair1.GetRotation(), nDistToSide, ptStart);
|
||
ads_polar(ptLoc3, stair1.GetRotation(), m_nStairWidth - nDistToSide, ptStart2);
|
||
if(nRailDist > m_nStepWidth*0.5+_DIST_SNAP)
|
||
{
|
||
ads_polar(XPoint(ptStart), stair1.GetRotation()+PI/2.0, nLen1+m_nStepWidth*0.5, ptStart);
|
||
ptStart.z = ptLoc1.z+stair1.GetStairHeight();
|
||
polyRail.AppendNode(ptStart);
|
||
ads_polar(XPoint(ptStart), stair1.GetRotation()+PI/2.0, nRailDist-m_nStepWidth*0.5, ptStart);
|
||
|
||
ads_polar(XPoint(ptStart2), stair3.GetRotation()+PI/2.0, nLen1+m_nStepWidth*0.5, ptStart2);
|
||
ptStart2.z = ptStart.z;
|
||
polyRail2.AppendNode(ptStart2);
|
||
ads_polar(XPoint(ptStart2), stair3.GetRotation()+PI/2.0, nRailDist-m_nStepWidth*0.5, ptStart2);
|
||
}
|
||
else
|
||
{
|
||
ads_polar(XPoint(ptStart), stair1.GetRotation()+PI/2.0, nLen1+nRailDist, ptStart);
|
||
ptStart.z = ptLoc1.z+stair1.GetStairHeight()-m_nStepHeight*0.5+elev1;
|
||
|
||
ads_polar(XPoint(ptStart2), stair3.GetRotation()+PI/2.0, nLen1+nRailDist, ptStart2);
|
||
ptStart2.z = ptStart.z;
|
||
}
|
||
polyRail.AppendNode(ptStart);
|
||
polyRail2.AppendNode(ptStart2);
|
||
|
||
}
|
||
//边跑起步时的内侧扶手
|
||
void TDbParallelStair::GetRailFromSide(TDbLineStair &stair1, //[in/out]边跑左梯段
|
||
TDbLineStair &stair2, //[in/out]中跑梯段
|
||
TDbLineStair &stair3, //[in/out]边跑右梯段
|
||
XPoly2D &polyRail, //[in/out]内侧左扶手
|
||
XPoly2D &polyRail2, //[in/out]内侧右扶手
|
||
XPoint &ptStart, //[in/out]左侧扶手顶点
|
||
XPoint &ptStart2 //[in/out]右侧扶手顶点
|
||
)const
|
||
{
|
||
double nDistToSide=((GetSpaceWidth()-2*GetStairWidth()-GetMStairWidth())<_DIST_SNAP*2&&m_nRailDistToSide<0) ?
|
||
_AS_SYS_UNIT(0) : m_nRailDistToSide;
|
||
nDistToSide += m_nRailWidth/2;
|
||
|
||
double dStairWidth=0.0; //井宽
|
||
dStairWidth = (m_nSpaceWidth - m_nStairWidth*2.0-m_nMStairWidth)/2.0;
|
||
if(dStairWidth < _DIST_SNAP)
|
||
{
|
||
dStairWidth=0.0;
|
||
}
|
||
|
||
//梯段位置
|
||
XPoint ptLoc1, ptLoc2, ptLoc3;
|
||
ptLoc1 = stair1.GetLocation();
|
||
ptLoc2 = stair2.GetLocation();
|
||
ptLoc3 = stair3.GetLocation();
|
||
|
||
//梯段长度
|
||
double nLen1=(m_nStepNum1-1)*m_nStepWidth,
|
||
nLen2=(m_nStepNum2-1)*m_nStepWidth;
|
||
|
||
double nRailDist=m_nRailDist-m_nRailWidth*0.5,
|
||
nRailDistMid=m_nRailDistMid-m_nRailWidth*0.5; //扶手有连接时回缩半个扶手宽度
|
||
//扶手伸出距离为负时产生的高差
|
||
double elev1=(nRailDist/nLen1)*(stair1.GetStairHeight()-m_nStepHeight),
|
||
elev2=(nRailDistMid/nLen1)*(stair1.GetStairHeight()-m_nStepHeight);
|
||
|
||
double nLenSide=nLen1+GetSlabSizeSide(),nLenMid=nLen2+GetSlabSizeMid(); //梯段与平台总长,判断是否齐楼板
|
||
if(m_nStairFlag!=SF_TOP) //首层或中间层
|
||
{
|
||
BOOL bFlag=FALSE; //
|
||
//if(m_nStairFlag!=SF_FIRST && nLen2<nLen1-_DIST_SNAP && m_nAlignment!=2)// 踏步不与楼板取齐
|
||
if(m_nStairFlag!=SF_FIRST && nLenMid<nLenSide-_DIST_SNAP)// 踏步不与楼板取齐
|
||
{
|
||
//扶手从中梯开始
|
||
ads_polar(ptLoc2, m_nRotation-PI/2, nLen2+nRailDist, ptStart);
|
||
ads_polar(XPoint(ptStart), m_nRotation+PI, m_nMStairWidth - nDistToSide, ptStart);
|
||
if(nRailDist > m_nStepWidth*0.5+_DIST_SNAP)
|
||
{
|
||
ptStart.z = ptLoc1.z;
|
||
}
|
||
else
|
||
{
|
||
ptStart.z = ptLoc1.z - m_nStepHeight * 0.5 + elev1;
|
||
}
|
||
polyRail.AppendNode(ptStart);
|
||
|
||
ads_polar(ptLoc2, m_nRotation-PI/2, nLen2+nRailDist, ptStart2);
|
||
ads_polar(XPoint(ptStart2), m_nRotation+PI, nDistToSide, ptStart2);
|
||
ptStart2.z = ptStart.z;
|
||
polyRail2.AppendNode(ptStart2);
|
||
|
||
//中梯下水平段顶点
|
||
//ads_polar(XPoint(ptStart), m_nRotation-PI/2.0,(m_nAlignment==1? (nLen1-nLen2)/2.0 : (nLen1-nLen2)), ptStart);
|
||
//ads_polar(XPoint(ptStart2), m_nRotation-PI/2.0,(m_nAlignment==1? (nLen1-nLen2)/2.0 : (nLen1-nLen2)), ptStart2);
|
||
ads_polar(XPoint(ptStart), m_nRotation-PI/2.0,nLenSide-nLenMid, ptStart);
|
||
ads_polar(XPoint(ptStart2), m_nRotation-PI/2.0,nLenSide-nLenMid, ptStart2);
|
||
|
||
polyRail.AppendNode(ptStart);
|
||
polyRail2.AppendNode(ptStart2);
|
||
|
||
bFlag=TRUE;
|
||
}
|
||
if(m_nStairFlag==SF_MIDDLE)
|
||
{
|
||
//if(nLen2>nLen1+_DIST_SNAP && m_nAlignment!=2)
|
||
if(nLenMid>nLenSide+_DIST_SNAP)
|
||
{
|
||
//扶手从中梯开始
|
||
ads_polar(ptLoc2, m_nRotation-PI/2, nLen2+nRailDist, ptStart);
|
||
ads_polar(XPoint(ptStart), m_nRotation+PI, m_nMStairWidth - nDistToSide, ptStart);
|
||
if(nRailDist > m_nStepWidth*0.5+_DIST_SNAP)
|
||
{
|
||
ptStart.z = ptLoc1.z;
|
||
}
|
||
else
|
||
{
|
||
ptStart.z = ptLoc1.z - m_nStepHeight * 0.5 + elev1;
|
||
}
|
||
polyRail.AppendNode(ptStart);
|
||
|
||
ads_polar(ptLoc2, m_nRotation-PI/2, nLen2+nRailDist, ptStart2);
|
||
ads_polar(XPoint(ptStart2), m_nRotation+PI, nDistToSide, ptStart2);
|
||
ptStart2.z = ptStart.z;
|
||
polyRail2.AppendNode(ptStart2);
|
||
|
||
//边梯与中梯的对齐点
|
||
ads_polar(XPoint(ptStart), m_nRotation+PI, dStairWidth + nDistToSide*2, ptStart);
|
||
ads_polar(XPoint(ptStart2), m_nRotation,
|
||
dStairWidth + nDistToSide*2, ptStart2);
|
||
|
||
if(nRailDist < m_nStepWidth*0.5-_DIST_SNAP)
|
||
{
|
||
ptStart.z = ptLoc1.z + m_nStepHeight * 0.5 - elev1;
|
||
}
|
||
|
||
polyRail.AppendNode(ptStart);
|
||
polyRail2.AppendNode(ptStart2);
|
||
}
|
||
else
|
||
{
|
||
if(!bFlag)
|
||
{
|
||
//中梯起点
|
||
ads_polar(ptLoc2, m_nRotation-PI/2, nLen2+nRailDist, ptStart);
|
||
ads_polar(XPoint(ptStart), m_nRotation+PI, m_nMStairWidth - nDistToSide, ptStart);
|
||
|
||
ads_polar(ptLoc2, m_nRotation-PI/2, nLen2+nRailDist, ptStart2);
|
||
ads_polar(XPoint(ptStart2), m_nRotation+PI, nDistToSide, ptStart2);
|
||
|
||
if(nRailDist > m_nStepWidth*0.5+_DIST_SNAP)
|
||
{
|
||
ptStart.z = ptLoc1.z;
|
||
}
|
||
else
|
||
{
|
||
ptStart.z = ptLoc1.z - m_nStepHeight * 0.5 + elev1;
|
||
}
|
||
ptStart2.z = ptStart.z;
|
||
|
||
polyRail.AppendNode(ptStart);
|
||
polyRail2.AppendNode(ptStart2);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
/*if(nLen2>nLen1+_DIST_SNAP&&m_nAlignment!=2)
|
||
{
|
||
//边梯起点
|
||
ads_polar(ptLoc2, m_nRotation, dStairWidth + nDistToSide, ptStart2);
|
||
ads_polar(XPoint(ptStart2), m_nRotation-PI/2.0,nLen2+nRailDist, ptStart2);
|
||
|
||
ads_polar(ptLoc2, m_nRotation+PI,m_nMStairWidth+dStairWidth+ nDistToSide, ptStart);
|
||
ads_polar(XPoint(ptStart), m_nRotation-PI/2.0, nLen2+nRailDist, ptStart);
|
||
if(nRailDist > m_nStepWidth*0.5+_DIST_SNAP)
|
||
{
|
||
ptStart.z = ptLoc1.z;
|
||
}
|
||
else
|
||
{
|
||
ptStart.z = ptLoc1.z - m_nStepHeight * 0.5 + elev1;
|
||
}
|
||
ptStart2.z = ptStart.z;
|
||
polyRail.AppendNode(ptStart);
|
||
polyRail2.AppendNode(ptStart2);
|
||
}*/
|
||
}
|
||
|
||
|
||
//边梯下顶点
|
||
ads_polar(ptLoc1, m_nRotation, m_nStairWidth - nDistToSide, ptStart);
|
||
ads_polar(ptLoc3, m_nRotation, nDistToSide, ptStart2);
|
||
if(m_nStairFlag==SF_TOP)
|
||
{
|
||
if(nLenSide<nLenMid)
|
||
{
|
||
ads_polar(stair2.GetUpRight2d(), m_nRotation+PI, dStairWidth + nDistToSide, ptStart);
|
||
ads_polar(stair2.GetUpLeft2d(), m_nRotation, dStairWidth+nDistToSide, ptStart2);
|
||
if(nRailDist>=m_nRailWidth)
|
||
{
|
||
ptStart.z = ptLoc1.z + m_nStepHeight * 0.5;
|
||
ptStart2.z = ptLoc1.z + m_nStepHeight * 0.5;
|
||
}
|
||
else
|
||
{
|
||
ads_polar(XPoint(ptStart2), m_nRotation-PI/2.0, nRailDist-m_nRailWidth*0.5, ptStart2);
|
||
ads_polar(XPoint(ptStart), m_nRotation-PI/2.0, nRailDist-m_nRailWidth*0.5, ptStart);
|
||
ptStart.z = ptLoc1.z + m_nStepHeight * 0.5 - elev1;
|
||
ptStart2.z = ptLoc1.z + m_nStepHeight * 0.5 - elev1;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if(nRailDist>=m_nRailWidth)
|
||
{
|
||
ptStart.z = ptLoc1.z + m_nStepHeight * 0.5;
|
||
ptStart2.z = ptLoc1.z + m_nStepHeight * 0.5;
|
||
}
|
||
else
|
||
{
|
||
ads_polar(XPoint(ptStart2), m_nRotation-PI/2.0, nRailDist-m_nRailWidth*0.5, ptStart2);
|
||
ads_polar(XPoint(ptStart), m_nRotation-PI/2.0, nRailDist-m_nRailWidth*0.5, ptStart);
|
||
ptStart.z = ptLoc1.z + m_nStepHeight * 0.5 - elev1;
|
||
ptStart2.z = ptLoc1.z + m_nStepHeight * 0.5 - elev1;
|
||
}
|
||
}
|
||
|
||
}
|
||
else
|
||
{
|
||
ads_polar(XPoint(ptStart2), m_nRotation-PI/2.0, nRailDist, ptStart2);
|
||
ads_polar(XPoint(ptStart), m_nRotation-PI/2.0, nRailDist, ptStart);
|
||
if(nRailDist > m_nStepWidth*0.5+_DIST_SNAP)
|
||
{
|
||
polyRail.AppendNode(ptStart);
|
||
polyRail2.AppendNode(ptStart2);
|
||
|
||
ads_polar(XPoint(ptStart), m_nRotation+PI/2.0, nRailDist-m_nStepWidth*0.5, ptStart);
|
||
ads_polar(XPoint(ptStart2), m_nRotation+PI/2.0, nRailDist-m_nStepWidth*0.5, ptStart2);
|
||
}
|
||
else
|
||
{
|
||
ptStart.z = ptLoc1.z + m_nStepHeight * 0.5 - elev1;
|
||
ptStart2.z = ptLoc1.z + m_nStepHeight * 0.5 - elev1;
|
||
}
|
||
}
|
||
|
||
polyRail.AppendNode(ptStart);
|
||
polyRail2.AppendNode(ptStart2);
|
||
|
||
//边梯上顶点
|
||
ads_polar(ptLoc1, m_nRotation, m_nStairWidth - nDistToSide, ptStart);
|
||
ads_polar(ptLoc3, m_nRotation, nDistToSide, ptStart2);
|
||
if(nRailDistMid > m_nStepWidth*0.5+_DIST_SNAP)
|
||
{
|
||
ads_polar(XPoint(ptStart), m_nRotation+PI/2.0, nLen1+m_nStepWidth*0.5, ptStart);
|
||
ads_polar(XPoint(ptStart2), m_nRotation+PI/2.0, nLen1+m_nStepWidth*0.5, ptStart2);
|
||
ptStart.z = ptLoc1.z + stair1.GetStairHeight();
|
||
ptStart2.z = ptLoc1.z + stair1.GetStairHeight();
|
||
polyRail.AppendNode(ptStart);
|
||
polyRail2.AppendNode(ptStart2);
|
||
|
||
ads_polar(XPoint(ptStart), m_nRotation+PI/2.0, nRailDistMid-m_nStepWidth*0.5, ptStart);
|
||
ads_polar(XPoint(ptStart2), m_nRotation+PI/2.0, nRailDistMid-m_nStepWidth*0.5, ptStart2);
|
||
}
|
||
else
|
||
{
|
||
ads_polar(XPoint(ptStart), m_nRotation+PI/2.0, nLen1+nRailDistMid, ptStart);
|
||
ads_polar(XPoint(ptStart2), m_nRotation+PI/2.0, nLen1+nRailDistMid, ptStart2);
|
||
ptStart.z = ptLoc1.z + stair1.GetStairHeight() - m_nStepHeight*0.5 + elev2;
|
||
ptStart2.z = ptLoc1.z + stair1.GetStairHeight() - m_nStepHeight*0.5 + elev2;
|
||
}
|
||
polyRail.AppendNode(ptStart);
|
||
polyRail2.AppendNode(ptStart2);
|
||
|
||
/*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);
|
||
ads_polar(XPoint(ptStart2), m_nRotation+PI/2.0,
|
||
(m_nAlignment==1? (nLen2-nLen1)/2.0 : (nLen2-nLen1)), ptStart2);
|
||
polyRail2.AppendNode(ptStart2);
|
||
}
|
||
}*/
|
||
if(GetSlabSizeSide()>GetSlabSizeMid()+_DIST_SNAP)
|
||
{
|
||
// 边梯上水平段顶点
|
||
ads_polar(XPoint(ptStart), m_nRotation+PI/2.0,GetSlabSizeSide()-GetSlabSizeMid(), ptStart);
|
||
ads_polar(XPoint(ptStart2), m_nRotation+PI/2.0,GetSlabSizeSide()-GetSlabSizeMid(), ptStart2);
|
||
polyRail.AppendNode(ptStart);
|
||
polyRail2.AppendNode(ptStart2);
|
||
}
|
||
|
||
//中梯与边梯对齐点
|
||
ads_polar(XPoint(ptStart), m_nRotation, dStairWidth+nDistToSide*2, ptStart);
|
||
ads_polar(XPoint(ptStart2),(m_nRotation+PI),dStairWidth+nDistToSide*2, ptStart2);
|
||
if(nRailDistMid < m_nStepWidth*0.5-_DIST_SNAP)
|
||
{
|
||
ptStart.z = ptLoc2.z + m_nStepHeight*0.5 - elev2;
|
||
}
|
||
ptStart2.z = ptStart.z;
|
||
polyRail.AppendNode(ptStart);
|
||
polyRail2.AppendNode(ptStart2);
|
||
|
||
|
||
/*if(nLen2<nLen1-_DIST_SNAP)
|
||
{
|
||
if(m_nAlignment!=0)
|
||
{
|
||
// 中梯上水平段顶点
|
||
ads_polar(XPoint(ptStart), m_nRotation-PI/2.0,
|
||
(m_nAlignment==1? (nLen1-nLen2)/2.0 : (nLen1-nLen2)), ptStart);
|
||
polyRail.AppendNode(ptStart);
|
||
ads_polar(XPoint(ptStart2), m_nRotation-PI/2.0,
|
||
(m_nAlignment==1? (nLen1-nLen2)/2.0 : (nLen1-nLen2)), ptStart2);
|
||
polyRail2.AppendNode(ptStart2);
|
||
}
|
||
}*/
|
||
if(GetSlabSizeSide()<GetSlabSizeMid()-_DIST_SNAP)
|
||
{
|
||
// 中梯上水平段顶点
|
||
ads_polar(XPoint(ptStart), m_nRotation-PI/2.0,GetSlabSizeMid()-GetSlabSizeSide(), ptStart);
|
||
polyRail.AppendNode(ptStart);
|
||
ads_polar(XPoint(ptStart2), m_nRotation-PI/2.0,GetSlabSizeMid()-GetSlabSizeSide(), ptStart2);
|
||
polyRail2.AppendNode(ptStart2);
|
||
}
|
||
|
||
if(nRailDistMid > m_nStepWidth*0.5+_DIST_SNAP)
|
||
{
|
||
ads_polar(ptLoc2, stair2.GetRotation(), m_nMStairWidth-nDistToSide, ptStart);
|
||
ads_polar(XPoint(ptStart), stair2.GetRotation()-PI/2.0, m_nStepWidth*0.5, ptStart);
|
||
ads_polar(ptLoc2, stair2.GetRotation(), nDistToSide, ptStart2);
|
||
ads_polar(XPoint(ptStart2), stair2.GetRotation()-PI/2.0, m_nStepWidth*0.5, ptStart2);
|
||
ptStart.z = ptLoc2.z;
|
||
ptStart2.z = ptLoc2.z;
|
||
polyRail.AppendNode(ptStart);
|
||
polyRail2.AppendNode(ptStart2);
|
||
}
|
||
|
||
// 中梯下顶点
|
||
ads_polar(ptLoc2, stair2.GetRotation(), m_nMStairWidth-nDistToSide, ptStart);
|
||
ads_polar(ptLoc2, stair2.GetRotation(), nDistToSide, ptStart2);
|
||
if(nRailDist > m_nStepWidth*0.5+_DIST_SNAP)
|
||
{
|
||
ads_polar(XPoint(ptStart), stair2.GetRotation()+PI/2.0, nLen2+m_nStepWidth*0.5, ptStart);
|
||
ptStart.z = ptLoc2.z+stair2.GetStairHeight();
|
||
polyRail.AppendNode(ptStart);
|
||
ads_polar(XPoint(ptStart), stair2.GetRotation()+PI/2.0, nRailDist-m_nStepWidth*0.5, ptStart);
|
||
|
||
ads_polar(XPoint(ptStart2), stair2.GetRotation()+PI/2.0, nLen2+m_nStepWidth*0.5, ptStart2);
|
||
ptStart2.z = ptLoc2.z+stair2.GetStairHeight();
|
||
polyRail2.AppendNode(ptStart2);
|
||
ads_polar(XPoint(ptStart2), stair2.GetRotation()+PI/2.0, nRailDist-m_nStepWidth*0.5, ptStart2);
|
||
}
|
||
else
|
||
{
|
||
ads_polar(XPoint(ptStart), stair2.GetRotation()+PI/2.0, nLen2+nRailDist, ptStart);
|
||
ptStart.z = ptLoc2.z+stair2.GetStairHeight()-0.5*m_nStepHeight+elev1;
|
||
|
||
ads_polar(XPoint(ptStart2), stair2.GetRotation()+PI/2.0, nLen2+nRailDist, ptStart2);
|
||
ptStart2.z = ptStart.z;
|
||
}
|
||
polyRail.AppendNode(ptStart);
|
||
polyRail2.AppendNode(ptStart2);
|
||
}
|
||
|
||
Acad::ErrorStatus
|
||
TDbParallelStair::ExplodeTo(TDbLineStair &stair1, //[in/out]边跑左梯段
|
||
TDbLineStair &stair2, //[in/out]中跑梯段
|
||
TDbLineStair &stair3, //[in/out]边跑右梯段
|
||
TDbSlab &slab, //[in/out]休息平台
|
||
TDbHandRail &rail, //[in/out]中跑左扶手
|
||
TDbHandRail &rail2, //[in/out]中跑右扶手
|
||
TDbHandRail *pRailTop, //[out]顶层扶手(中间或左侧)
|
||
TDbHandRail *pRailTop2, //[out]顶层扶手(右侧)
|
||
TDbHandRail *pRailOut1, //[out]边跑左梯段外侧扶手
|
||
TDbHandRail*pRailOut2 //[out]边跑右梯段外侧扶手
|
||
) const
|
||
{
|
||
assertReadEnabled();
|
||
int nSectStair=GetSectStairPos();
|
||
|
||
XPoint ptUpLeft=GetUpLeft2d(),
|
||
ptUpRight=GetUpRight2d(),ptUpMid;
|
||
Midpoint(ptUpLeft,ptUpRight,ptUpMid);
|
||
|
||
XPoint ptLowLeft, ptLowMid, ptLowRight; //休息平台板的顶点
|
||
|
||
double nLen1=(m_nStepNum1-1)*m_nStepWidth,
|
||
nLen2=(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);
|
||
ads_polar(ptLowLeft, m_nRotation, m_nSpaceWidth*0.5, ptLowMid);
|
||
}
|
||
else
|
||
{
|
||
double nTemp=(m_nAlignment==1)? 2.0 : 1.0;
|
||
if(nLen1>nLen2) //边梯长
|
||
{
|
||
ads_polar(ptUpLeft, m_nRotation-PI/2, m_nSlabSize, ptLowLeft);
|
||
ads_polar(ptUpRight,m_nRotation-PI/2, m_nSlabSize, ptLowRight);
|
||
ads_polar(ptUpLeft, m_nRotation, m_nSpaceWidth*0.5, ptLowMid);
|
||
ads_polar(ptLowMid,m_nRotation-PI/2, m_nSlabSize+(nLen1-nLen2)/nTemp, ptLowMid);
|
||
}
|
||
else //中梯长
|
||
{
|
||
ads_polar(ptUpLeft, m_nRotation-PI/2, m_nSlabSize+(nLen2-nLen1)/nTemp, ptLowLeft);
|
||
ads_polar(ptUpRight,m_nRotation-PI/2, m_nSlabSize+(nLen2-nLen1)/nTemp, ptLowRight);
|
||
ads_polar(ptUpLeft, m_nRotation, m_nSpaceWidth*0.5, ptLowMid);
|
||
ads_polar(ptLowMid,m_nRotation-PI/2, m_nSlabSize, ptLowMid);
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
ads_polar(ptUpLeft, m_nRotation-PI/2.0, m_nSlabSize, ptLowLeft);
|
||
ads_polar(ptUpRight, m_nRotation-PI/2.0, m_nSlabSize, ptLowRight);
|
||
ads_polar(ptLowLeft, m_nRotation, m_nSpaceWidth*0.5, ptLowMid);
|
||
}
|
||
*/
|
||
ads_polar(ptUpLeft, m_nRotation-PI/2, GetSlabSizeSide(), ptLowLeft);
|
||
ads_polar(ptUpRight, m_nRotation-PI/2,GetSlabSizeSide(), ptLowRight);
|
||
ads_polar(ptUpMid, m_nRotation-PI/2, GetSlabSizeMid(), ptLowMid);
|
||
|
||
|
||
//设置梯段宽度
|
||
stair1.SetStairWidth(m_nStairWidth);
|
||
stair2.SetStairWidth(m_nMStairWidth);
|
||
stair3.SetStairWidth(m_nStairWidth);
|
||
|
||
//设置踏步高度
|
||
stair1.SetStepHeight(m_nStepHeight);
|
||
stair2.SetStepHeight(m_nStepHeight);
|
||
stair3.SetStepHeight(m_nStepHeight);
|
||
|
||
//设置踏步宽度
|
||
stair1.SetStepWidth(m_nStepWidth);
|
||
stair2.SetStepWidth(m_nStepWidth);
|
||
stair3.SetStepWidth(m_nStepWidth);
|
||
|
||
//设置踏步数
|
||
stair1.SetStepNum(m_nStepNum1);
|
||
stair2.SetStepNum(m_nStepNum2);
|
||
stair3.SetStepNum(m_nStepNum1);
|
||
|
||
//设置踏步旋转角度
|
||
if(m_nStartSide == OFFSET_MID)
|
||
{
|
||
stair1.SetRotation(CT_std_angle(m_nRotation+PI));
|
||
stair2.SetRotation(m_nRotation);
|
||
stair3.SetRotation(CT_std_angle(m_nRotation+PI));
|
||
}
|
||
else
|
||
{
|
||
stair1.SetRotation(m_nRotation);
|
||
stair2.SetRotation(CT_std_angle(m_nRotation+PI));
|
||
stair3.SetRotation(m_nRotation);
|
||
}
|
||
|
||
|
||
//计算梯段位置
|
||
XPoint ptLoc1, ptLoc2, ptLoc3;
|
||
if(m_nStartSide==OFFSET_MID) //中跑上楼
|
||
{
|
||
ads_polar(ptLowLeft, m_nRotation, m_nStairWidth, ptLoc1);
|
||
XPoint ptTmp;
|
||
ads_polar(ptLowMid, m_nRotation+PI, m_nMStairWidth*0.5, ptTmp);
|
||
ads_polar(ptTmp, m_nRotation-PI/2, nLen2, ptLoc2);
|
||
ptLoc3=ptLowRight;
|
||
ptLoc2.z = m_ptLocation.z;
|
||
ptLoc1.z = ptLoc3.z = ptLoc2.z + m_nStepNum2*m_nStepHeight;
|
||
}
|
||
else
|
||
{
|
||
ads_polar(ptLowLeft, m_nRotation-PI/2, nLen1, ptLoc1);
|
||
ads_polar(ptLowMid, m_nRotation, m_nMStairWidth*0.5, ptLoc2);
|
||
XPoint ptTmp;
|
||
ads_polar(ptLowRight, m_nRotation+PI, m_nStairWidth, ptTmp);
|
||
ads_polar(ptTmp, m_nRotation-PI/2, nLen1, ptLoc3);
|
||
ptLoc1.z = ptLoc3.z = m_ptLocation.z;
|
||
ptLoc2.z = ptLoc1.z + m_nStepNum1*m_nStepHeight;
|
||
}
|
||
//设置梯段位置
|
||
stair1.SetLocation(ptLoc1);
|
||
stair2.SetLocation(ptLoc2);
|
||
stair3.SetLocation(ptLoc3);
|
||
|
||
//设置梯段标记
|
||
stair1.Set3DFlag(m_nStairFlag==SF_TOP? 0 : SF_HAS3D);
|
||
stair2.Set3DFlag(m_nStairFlag==SF_TOP? 0 : SF_HAS3D);
|
||
stair3.Set3DFlag(m_nStairFlag==SF_TOP? 0 : SF_HAS3D);
|
||
if(m_nStairFlag==SF_FIRST) //首层
|
||
{
|
||
if(nSectStair==0) //中梯剖断
|
||
{
|
||
stair2.Set2DFlag(SF_1SECT);
|
||
if(m_nStartSide!=OFFSET_MID)//边梯起步
|
||
{
|
||
stair1.Set2DFlag(SF_NOSECT);
|
||
stair3.Set2DFlag(SF_NOSECT);
|
||
}
|
||
}
|
||
else if(nSectStair==1) //边梯剖断
|
||
{
|
||
stair1.Set2DFlag(SF_1SECT);
|
||
stair3.Set2DFlag(SF_1SECT);
|
||
if(m_nStartSide==OFFSET_MID)//中梯上楼
|
||
stair2.Set2DFlag(SF_NOSECT);
|
||
|
||
}
|
||
}
|
||
else if(m_nStairFlag==SF_MIDDLE) //中间层
|
||
{
|
||
if(nSectStair==0) //中梯剖断
|
||
{
|
||
stair2.Set2DFlag(SF_2SECT);
|
||
stair1.Set2DFlag(SF_NOSECT);
|
||
stair3.Set2DFlag(SF_NOSECT);
|
||
}
|
||
else if(nSectStair==1) //边梯剖断
|
||
{
|
||
stair1.Set2DFlag(SF_2SECT);
|
||
stair3.Set2DFlag(SF_2SECT);
|
||
stair2.Set2DFlag(SF_NOSECT);
|
||
}
|
||
}
|
||
else //顶层
|
||
{
|
||
stair1.Set2DFlag(SF_NOSECT);
|
||
stair2.Set2DFlag(SF_NOSECT);
|
||
stair3.Set2DFlag(SF_NOSECT);
|
||
}
|
||
|
||
// 设置边梁属性
|
||
/*for(int nSide=0; nSide<2; nSide++)
|
||
{
|
||
stair1.SetSideBeam(nSide, HasSideBeam(nSide));
|
||
stair2.SetSideBeam(nSide, HasSideBeam(nSide));
|
||
stair3.SetSideBeam(nSide, HasSideBeam(nSide));
|
||
}*/
|
||
|
||
stair2.SetSideBeam(0, IsInSideBeam());
|
||
stair2.SetSideBeam(1, IsInSideBeam());
|
||
if(m_nStartSide==OFFSET_MID)
|
||
{
|
||
stair1.SetSideBeam(1, IsOutSideBeam());
|
||
stair3.SetSideBeam(0, IsOutSideBeam());
|
||
stair1.SetSideBeam(0, IsInSideBeam());
|
||
stair3.SetSideBeam(1, IsInSideBeam());
|
||
}
|
||
else
|
||
{
|
||
stair1.SetSideBeam(0, IsOutSideBeam());
|
||
stair3.SetSideBeam(1, IsOutSideBeam());
|
||
stair1.SetSideBeam(1, IsInSideBeam());
|
||
stair3.SetSideBeam(0, IsInSideBeam());
|
||
}
|
||
|
||
/////////////////////////////////////////////////////////////////
|
||
//扶手, 考虑了详图画法
|
||
double nDistToSide=((GetSpaceWidth()-2*GetStairWidth()-GetMStairWidth())<_DIST_SNAP*2 &&m_nRailDistToSide<0)?
|
||
_AS_SYS_UNIT(0) : m_nRailDistToSide;
|
||
nDistToSide += m_nRailWidth/2;
|
||
|
||
double dStairWidth=0.0; //井宽
|
||
dStairWidth = (m_nSpaceWidth - m_nStairWidth*2.0-m_nMStairWidth)/2.0;
|
||
if(dStairWidth < _DIST_SNAP)
|
||
{
|
||
dStairWidth=0.0;
|
||
}
|
||
|
||
XPoly2D polyRail,polyRail2; //左右内侧扶手
|
||
XPoint ptStart,ptStart2;
|
||
if(m_nStartSide==OFFSET_MID) //中跑上楼
|
||
{
|
||
GetRailFromMid(stair1,stair2,stair3,polyRail,polyRail2,ptStart,ptStart2);
|
||
}
|
||
else //边跑上楼
|
||
{
|
||
GetRailFromSide(stair1,stair2,stair3,polyRail,polyRail2,ptStart,ptStart2);
|
||
}
|
||
|
||
polyRail.SetFlag(0);
|
||
polyRail2.SetFlag(0);
|
||
if(m_nStairFlag==SF_TOP) //顶层
|
||
{
|
||
//处理扶手端点
|
||
/*XPoint ptA, ptB;
|
||
ptA = *polyRail.Head();
|
||
ads_polar(ptA, m_nRotation+PI/2, m_nStepWidth*0.5, ptB);
|
||
*polyRail.Head() = ptB;
|
||
ptA = *polyRail2.Head();
|
||
ads_polar(ptA, m_nRotation+PI/2, m_nStepWidth*0.5, ptB);
|
||
*polyRail2.Head() = ptB;*/
|
||
|
||
//顶端扶手
|
||
XPoly2D polyTopRail(0);
|
||
polyTopRail.AppendNode(XPoint(ptStart.x, ptStart.y, GetElevation()));//顶端扶手起点
|
||
|
||
double nLenSide=nLen1+GetSlabSizeSide(),nLenMid=nLen2+GetSlabSizeMid(); //梯段与平台总长,判断是否齐楼板
|
||
//if(nLen2<nLen1-_DIST_SNAP && m_nAlignment!=2)
|
||
if(nLenMid<nLenSide-_DIST_SNAP)
|
||
{
|
||
if(m_nStartSide==OFFSET_MID)
|
||
{
|
||
//顶端扶手终点
|
||
ads_polar(ptStart, m_nRotation, m_nMStairWidth+dStairWidth*2.0+nDistToSide*2.0, ptStart);
|
||
}
|
||
else
|
||
{
|
||
double elev=ptStart.z;
|
||
ads_polar(ptLoc1, m_nRotation, m_nStairWidth+dStairWidth+nDistToSide, ptStart);
|
||
ads_polar(ptStart, m_nRotation-PI/2.0, m_nRailDist-m_nRailWidth*0.5, ptStart); //扶手下水平段点
|
||
|
||
ptStart.z = elev;
|
||
polyRail.AppendNode(ptStart);
|
||
polyTopRail.AppendNode(XPoint(ptStart.x, ptStart.y, GetElevation()));
|
||
|
||
//顶端扶手左侧对齐点
|
||
ads_polar(ptStart, m_nRotation+PI, m_nStairWidth+dStairWidth+nDistToSide, ptStart);
|
||
}
|
||
|
||
polyRail.AppendNode(ptStart);
|
||
polyTopRail.AppendNode(XPoint(ptStart.x, ptStart.y, GetElevation()));
|
||
}
|
||
else
|
||
{
|
||
if(m_nStartSide==OFFSET_MID)
|
||
{
|
||
//if(nLen2>nLen1+_DIST_SNAP && m_nAlignment!=2)
|
||
if(nLenMid>nLenSide+_DIST_SNAP)
|
||
{
|
||
XPoint ptTmp=ptStart;
|
||
double elev=ptStart.z;
|
||
ads_polar(ptLoc2, m_nRotation+PI, dStairWidth+nDistToSide, ptStart);
|
||
ads_polar(ptStart, m_nRotation-PI/2.0, m_nRailDist-m_nRailWidth*0.5, ptStart);//扶手左侧下水平段点
|
||
|
||
ptStart.z = elev;
|
||
polyRail.AppendNode(ptStart);
|
||
polyTopRail.AppendNode(XPoint(ptStart.x, ptStart.y, GetElevation()));
|
||
|
||
//扶手右侧下水平段点
|
||
ads_polar(ptStart, m_nRotation, m_nMStairWidth+dStairWidth*2.0+nDistToSide*2.0, ptStart);
|
||
|
||
polyRail.AppendNode(ptStart);
|
||
polyTopRail.AppendNode(XPoint(ptStart.x, ptStart.y, GetElevation()));
|
||
|
||
//扶手右侧水平段齐边梯点
|
||
ads_polar(ptTmp, m_nRotation, m_nMStairWidth+dStairWidth*2.0+nDistToSide*2.0, ptTmp);
|
||
polyTopRail.AppendNode(XPoint(ptTmp.x, ptTmp.y, GetElevation()));
|
||
}
|
||
else
|
||
{
|
||
//顶端扶手终点
|
||
ads_polar(ptStart, m_nRotation, m_nMStairWidth+dStairWidth*2.0+nDistToSide*2.0, ptStart);
|
||
polyTopRail.AppendNode(XPoint(ptStart.x, ptStart.y, GetElevation()));
|
||
}
|
||
|
||
}
|
||
else
|
||
{
|
||
//顶端扶手终点
|
||
ads_polar(ptStart, m_nRotation+PI, m_nStairWidth+dStairWidth+nDistToSide, ptStart);
|
||
|
||
polyRail.AppendNode(ptStart);
|
||
polyTopRail.AppendNode(XPoint(ptStart.x, ptStart.y, GetElevation()));
|
||
}
|
||
}
|
||
|
||
if(m_nStartSide==OFFSET_MID)
|
||
{
|
||
//合并扶手
|
||
for(int i=polyRail2.Length()-1;i>=0;i--)
|
||
{
|
||
XPoint pt=*polyRail2[i];
|
||
polyRail.AppendNode(pt);
|
||
}
|
||
}
|
||
|
||
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);
|
||
}
|
||
|
||
if(m_nStartSide != OFFSET_MID) //存在两个顶层扶手
|
||
{
|
||
XPoly2D polyTopRail2(0);
|
||
polyTopRail2.AppendNode(XPoint(ptStart2.x, ptStart2.y, GetElevation()));//右侧顶端扶手在中梯起点
|
||
|
||
//if(nLen2<nLen1-_DIST_SNAP && m_nAlignment!=2)
|
||
if(nLenMid<nLenSide-_DIST_SNAP)
|
||
{
|
||
double elev=ptStart2.z;
|
||
ads_polar(ptLoc3, m_nRotation+PI, dStairWidth+nDistToSide, ptStart2);
|
||
ads_polar(XPoint(ptStart2), m_nRotation-PI/2,m_nRailDist-m_nRailWidth*0.5, ptStart2);//右侧顶端扶手在中梯下水平段点
|
||
ptStart2.z = elev;
|
||
polyRail2.AppendNode(ptStart2);
|
||
polyTopRail2.AppendNode(XPoint(ptStart2.x, ptStart2.y, GetElevation()));
|
||
}
|
||
//右侧顶端扶手在边梯对齐点
|
||
ads_polar(XPoint(ptStart2), m_nRotation,m_nStairWidth+dStairWidth+nDistToSide, ptStart2);
|
||
polyRail2.AppendNode(ptStart2);
|
||
polyTopRail2.AppendNode(XPoint(ptStart2.x, ptStart2.y, GetElevation()));
|
||
polyRail2.SetFlag(0);
|
||
rail2.SetHas2D(TRUE);
|
||
rail2.SetHas3D(FALSE);
|
||
if(pRailTop2)
|
||
{
|
||
pRailTop2->SetPathPoly(polyTopRail2,GetNormal().AsAcGeVector3d());
|
||
pRailTop2->SetWidth(m_nRailWidth);
|
||
pRailTop2->SetHeight(m_nRailHeight);
|
||
pRailTop2->SetStyle(TDbHandRail::RS_RAIL1);
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
rail.SetHas2D(TRUE);
|
||
rail.SetHas3D(TRUE);
|
||
rail2.SetHas2D(TRUE);
|
||
rail2.SetHas3D(TRUE);
|
||
}
|
||
|
||
rail.SetPathPoly(polyRail,GetNormal().AsAcGeVector3d());
|
||
rail.SetWidth(m_nRailWidth);
|
||
rail.SetHeight(m_nRailHeight);
|
||
rail.SetStyle(TDbHandRail::RS_RAIL1);
|
||
rail2.SetPathPoly(polyRail2,GetNormal().AsAcGeVector3d());
|
||
rail2.SetWidth(m_nRailWidth);
|
||
rail2.SetHeight(m_nRailHeight);
|
||
rail2.SetStyle(TDbHandRail::RS_RAIL1);
|
||
|
||
|
||
//外侧扶手
|
||
double nDist=m_nStartSide==OFFSET_MID?nDistToSide:-nDistToSide;
|
||
if(pRailOut1!=0) //左边梯外侧扶手
|
||
{
|
||
XPoly2D poly;
|
||
XLine line=stair1.GetSideCurve2d(m_nStartSide==OFFSET_MID?1:0).Offset(-nDist,0);
|
||
if(m_nStartSide==OFFSET_MID)
|
||
GetRailPoly(stair1,line,m_nRailDistMid,m_nRailDist,poly);
|
||
else
|
||
{
|
||
GetRailPoly(stair1,line,m_nStairFlag==SF_TOP?(m_nRailDist>m_nRailWidth?0:m_nRailDist-m_nRailWidth):m_nRailDist,m_nRailDistMid,poly);
|
||
}
|
||
|
||
|
||
pRailOut1->SetPathPoly(poly,GetNormal().AsAcGeVector3d());
|
||
pRailOut1->SetWidth(m_nRailWidth);
|
||
pRailOut1->SetHeight(m_nRailHeight);
|
||
pRailOut1->SetStyle(TDbHandRail::RS_RAIL1);
|
||
}
|
||
if(pRailOut2!=0) //右边梯外侧扶手
|
||
{
|
||
XLine line=stair3.GetSideCurve2d(m_nStartSide==OFFSET_MID?0:1).Offset(nDist,0);
|
||
XPoly2D poly;
|
||
if(m_nStartSide==OFFSET_MID)
|
||
GetRailPoly(stair3,line,m_nRailDistMid,m_nRailDist,poly);
|
||
else
|
||
GetRailPoly(stair3,line,m_nStairFlag==SF_TOP?(m_nRailDist>m_nRailWidth?0:m_nRailDist-m_nRailWidth):m_nRailDist,m_nRailDistMid,poly);
|
||
|
||
pRailOut2->SetPathPoly(poly,GetNormal().AsAcGeVector3d());
|
||
pRailOut2->SetWidth(m_nRailWidth);
|
||
pRailOut2->SetHeight(m_nRailHeight);
|
||
pRailOut2->SetStyle(TDbHandRail::RS_RAIL1);
|
||
}
|
||
|
||
//休息平台
|
||
if(GetSlabSizeSide()>_DIST_SNAP&&GetSlabSizeMid()>_DIST_SNAP&&IsShowSlab())
|
||
{
|
||
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(GetSlabSizeSide()-GetSlabSizeMid())>_DIST_SNAP)
|
||
{
|
||
XPoint ptTemp1, ptTemp2,ptTemp3, ptTemp4;
|
||
if(GetSlabSizeMid()-GetSlabSizeSide()>_DIST_SNAP)
|
||
{
|
||
ads_polar(ptLowLeft, m_nRotation, m_nStairWidth+dStairWidth, ptTemp1);
|
||
ads_polar(ptLowMid, m_nRotation+PI, 0.5*m_nMStairWidth, ptTemp2);
|
||
ads_polar(ptLowMid, m_nRotation, 0.5*m_nMStairWidth, ptTemp3);
|
||
ads_polar(ptLowRight, m_nRotation+PI, m_nStairWidth+dStairWidth, ptTemp4);
|
||
}
|
||
else
|
||
{
|
||
ads_polar(ptLowLeft, m_nRotation, m_nStairWidth, ptTemp1);
|
||
ads_polar(ptLowMid, m_nRotation+PI, m_nSpaceWidth*0.5-m_nStairWidth, ptTemp2);
|
||
ads_polar(ptLowMid, m_nRotation, m_nSpaceWidth*0.5-m_nStairWidth, ptTemp3);
|
||
ads_polar(ptLowRight, m_nRotation+PI, m_nStairWidth, ptTemp4);
|
||
}
|
||
|
||
polySlab.AppendNode(ptTemp1);
|
||
polySlab.AppendNode(ptTemp2);
|
||
polySlab.AppendNode(ptTemp3);
|
||
polySlab.AppendNode(ptTemp4);
|
||
}
|
||
if(polySlab.PathArea()>0)
|
||
polySlab.Reverse();
|
||
slab.SetOutline(polySlab);
|
||
if(m_nStartSide==OFFSET_MID)
|
||
slab.SetElevation(ptLoc1.z);
|
||
else
|
||
slab.SetElevation(ptLoc2.z);
|
||
|
||
slab.SetThickness(-m_nSlabThick);
|
||
}
|
||
|
||
stair1.setPropertiesFrom(this);
|
||
stair2.setPropertiesFrom(this);
|
||
stair3.setPropertiesFrom(this);
|
||
|
||
stair1.SetBeamHeight(GetBeamHeight());
|
||
stair2.SetBeamHeight(GetBeamHeight());
|
||
stair3.SetBeamHeight(GetBeamHeight());
|
||
|
||
stair1.SetBeamThick(GetBeamThick());
|
||
stair2.SetBeamThick(GetBeamThick());
|
||
stair3.SetBeamThick(GetBeamThick());
|
||
|
||
slab.setPropertiesFrom(this);
|
||
rail.setPropertiesFrom(this);
|
||
rail2.setPropertiesFrom(this);
|
||
|
||
if(pRailTop!=NULL)
|
||
pRailTop->setPropertiesFrom(this);
|
||
if(pRailTop2!=NULL)
|
||
pRailTop2->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);
|
||
stair3.SetLayerStep3d(m_idLayerStep3d);
|
||
}
|
||
if(m_idLayerBeam3d.isValid())
|
||
{
|
||
stair1.SetLayerBeam3d(m_idLayerBeam3d);
|
||
stair2.SetLayerBeam3d(m_idLayerBeam3d);
|
||
stair3.SetLayerBeam3d(m_idLayerBeam3d);
|
||
}
|
||
if(m_idLayerHand3d.isValid())
|
||
{
|
||
rail.setLayer(m_idLayerHand3d);
|
||
rail2.setLayer(m_idLayerHand3d);
|
||
if(pRailTop!=NULL)
|
||
pRailTop->setLayer(m_idLayerHand3d);
|
||
if(pRailTop2!=NULL)
|
||
pRailTop2->setLayer(m_idLayerHand3d);
|
||
if(pRailOut1!=NULL)
|
||
pRailOut1->setLayer(m_idLayerHand3d);
|
||
if(pRailOut2!=NULL)
|
||
pRailOut2->setLayer(m_idLayerHand3d);
|
||
}
|
||
return Acad::eOk;
|
||
}
|
||
void TDbParallelStair::GetRailPoly(TDbLineStair &stair1,XLine line,double lengthS,double lengthE,XPoly2D &poly)const
|
||
{
|
||
XPoint ptTemp;
|
||
if(lengthS > m_nStepWidth*0.5 + _DIST_SNAP) //扶手伸出
|
||
{
|
||
ads_polar(XPoint(line.StartPoint()),stair1.GetRotation()-PI/2,lengthS,ptTemp);
|
||
ptTemp.z=stair1.GetLocation().z;
|
||
poly.AppendNode(ptTemp); //扶手伸出点
|
||
ads_polar(XPoint(line.StartPoint()),stair1.GetRotation()-PI/2,m_nStepWidth*0.5,ptTemp);
|
||
ptTemp.z=stair1.GetLocation().z;
|
||
poly.AppendNode(ptTemp); //扶手拐点
|
||
}
|
||
else //扶手缩回
|
||
{
|
||
ads_polar(XPoint(line.StartPoint()),stair1.GetRotation()-PI/2,lengthS,ptTemp);
|
||
double elev=0,length=0;
|
||
length=stair1.GetStairLength()+m_nStepWidth;
|
||
elev=lengthS/length*stair1.GetStairHeight();
|
||
ptTemp.z =stair1.GetLocation().z+m_nStepHeight*0.5-elev;;
|
||
poly.AppendNode(ptTemp); //扶手缩回点
|
||
}
|
||
|
||
|
||
if(lengthE > m_nStepWidth*0.5 + _DIST_SNAP) //扶手伸出
|
||
{
|
||
ads_polar(XPoint(line.EndPoint()),stair1.GetRotation()+PI/2,m_nStepWidth*0.5,ptTemp);
|
||
ptTemp.z = stair1.GetLocation().z+stair1.GetStairHeight();
|
||
poly.AppendNode(ptTemp); //拐点
|
||
|
||
ads_polar(XPoint(ptTemp),stair1.GetRotation()+PI/2,lengthE-m_nStepWidth*0.5,ptTemp);
|
||
poly.AppendNode(ptTemp); //伸出点
|
||
|
||
}
|
||
else //扶手回缩
|
||
{
|
||
ptTemp=line.EndPoint();
|
||
ads_polar(XPoint(ptTemp),stair1.GetRotation()+PI/2,lengthE,ptTemp);
|
||
double elev=0,length=0;
|
||
length=stair1.GetStairLength()+m_nStepWidth;
|
||
elev=lengthE/length*stair1.GetStairHeight();
|
||
ptTemp.z = stair1.GetLocation().z+stair1.GetStairHeight()-m_nStepHeight*0.5+elev;
|
||
poly.AppendNode(ptTemp);
|
||
}
|
||
}
|
||
|
||
void TDbParallelStair::GetDefaultArrow(TDbLineStair &stair1,TDbLineStair &stair2,TDbLineStair &stair3,
|
||
TDbSymbArrow*pArrowUp1,TDbSymbArrow*pArrowUp2,
|
||
TDbSymbArrow*pArrowDown1,TDbSymbArrow*pArrowDown2)const
|
||
{
|
||
assertReadEnabled();
|
||
int nSectStair=GetSectStairPos();
|
||
if(m_nStairFlag != SF_TOP && nSectStair == -1)//剖断位置不正确
|
||
return;
|
||
|
||
int nSectStepNum=m_nSectStepNum; //剖断步数
|
||
if(nSectStepNum < 0) //负数调整为正的
|
||
{
|
||
nSectStepNum=m_nSectStepNum+m_nStepNum1+m_nStepNum2+1;
|
||
}
|
||
if((nSectStair==0&&m_nStartSide!=SF_MIDDLE&&nSectStepNum==m_nStepNum1)
|
||
||(nSectStair==1&&m_nStartSide==SF_MIDDLE&&nSectStepNum==m_nStepNum2)
|
||
||nSectStepNum==m_nStepNum1+m_nStepNum2)
|
||
{
|
||
nSectStepNum--;
|
||
}
|
||
|
||
double nSlabSize=min(GetSlabSizeSide(),GetSlabSizeMid());
|
||
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,pt9,pt10,pt11,pt12,pt;
|
||
/*----------点相对位置示意----------------------
|
||
_________________________________________________
|
||
*pt4 | *pt5 | *pt12
|
||
| |
|
||
| |
|
||
*pt3 | *pt6 | *pt11
|
||
*pt2 | *pt7 | *pt10
|
||
| |
|
||
| |
|
||
*pt1 | *pt8 | *pt9
|
||
------------------------------------------------*/
|
||
|
||
ads_polar(stair1.GetLocation(),stair1.GetRotation(),stair1.GetStairWidth()/2,pt);
|
||
if(m_nStartSide==OFFSET_MID) //中跑起步
|
||
{
|
||
ads_polar(pt,stair1.GetRotation()+PI/2,(stair1.GetStairLength()+m_nStepWidth*0.5),pt1);
|
||
ads_polar(pt,stair1.GetRotation()+PI/2,(m_nStepWidth*(nSectStepNum-m_nStepNum2)),pt2);
|
||
ads_polar(pt,stair1.GetRotation()+PI/2,(m_nStepWidth*(nSectStepNum-m_nStepNum2-1)),pt3);
|
||
ads_polar(stair2.GetLocation(),stair2.GetRotation(),stair2.GetStairWidth()*0.5,pt);
|
||
ads_polar(pt,stair2.GetRotation()-PI/2,m_nStepWidth/2,pt8);
|
||
ads_polar(pt,stair2.GetRotation()+PI/2,(m_nStepWidth*(nSectStepNum-1)),pt7);
|
||
ads_polar(pt,stair2.GetRotation()+PI/2,(m_nStepWidth*nSectStepNum),pt6);
|
||
ads_polar(stair3.GetLocation(),stair3.GetRotation(),stair3.GetStairWidth()*0.5,pt);
|
||
ads_polar(pt,stair3.GetRotation()+PI/2,(stair3.GetStairLength()+m_nStepWidth*0.5),pt9);
|
||
ads_polar(pt,stair3.GetRotation()+PI/2,(m_nStepWidth*(nSectStepNum-m_nStepNum2)),pt10);
|
||
ads_polar(pt,stair3.GetRotation()+PI/2,(m_nStepWidth*(nSectStepNum-m_nStepNum2-1)),pt11);
|
||
}
|
||
else //边跑起步
|
||
{
|
||
ads_polar(pt,stair1.GetRotation()-PI/2,m_nStepWidth*0.5,pt1);
|
||
ads_polar(pt,stair1.GetRotation()+PI/2,(m_nStepWidth*(nSectStepNum-1)),pt2);
|
||
ads_polar(pt,stair1.GetRotation()+PI/2,(m_nStepWidth*nSectStepNum),pt3);
|
||
ads_polar(stair2.GetLocation(),stair2.GetRotation(),stair2.GetStairWidth()*0.5,pt);
|
||
ads_polar(pt,stair2.GetRotation()+PI/2,stair2.GetStairLength()+m_nStepWidth*0.5,pt8);
|
||
ads_polar(pt,stair2.GetRotation()+PI/2,(m_nStepWidth*(nSectStepNum-m_nStepNum1)),pt7);
|
||
ads_polar(pt,stair2.GetRotation()+PI/2,(m_nStepWidth*(nSectStepNum-m_nStepNum1-1)),pt6);
|
||
ads_polar(stair3.GetLocation(),stair3.GetRotation(),stair3.GetStairWidth()*0.5,pt);
|
||
ads_polar(pt,stair3.GetRotation()-PI/2,m_nStepWidth*0.5,pt9);
|
||
ads_polar(pt,stair3.GetRotation()+PI/2,(m_nStepWidth*(nSectStepNum-1)),pt10);
|
||
ads_polar(pt,stair3.GetRotation()+PI/2,(m_nStepWidth*nSectStepNum),pt11);
|
||
}
|
||
|
||
ads_polar(GetUpLeft2d(),GetRotation()-PI/2,nSlabSize*0.5,pt);
|
||
ads_polar(pt,GetRotation(),GetStairWidth()*0.5,pt4);
|
||
ads_polar(pt,GetRotation(),GetSpaceWidth()*0.5,pt5);
|
||
ads_polar(pt,GetRotation(),GetSpaceWidth()-GetStairWidth()*0.5,pt12);
|
||
|
||
if(m_nStairFlag==SF_TOP) //顶层
|
||
{
|
||
XPoly2D poly1;
|
||
XPoly2D poly2;
|
||
if(m_nStartSide==OFFSET_MID) //中梯起跑
|
||
{
|
||
poly1.AppendNode(pt1);
|
||
poly1.AppendNode(pt4);
|
||
poly1.AppendNode(pt5);
|
||
ads_polar(pt8,m_nRotation+PI/2,m_nStepWidth,pt8);
|
||
poly1.AppendNode(pt8);
|
||
|
||
poly2.AppendNode(pt9);
|
||
poly2.AppendNode(pt12);
|
||
poly2.AppendNode(pt5);
|
||
poly2.AppendNode(pt8);
|
||
}
|
||
else //边梯起跑
|
||
{
|
||
poly1.AppendNode(pt8);
|
||
poly1.AppendNode(pt5);
|
||
poly1.AppendNode(pt4);
|
||
ads_polar(pt1,m_nRotation+PI/2,m_nStepWidth,pt1);
|
||
poly1.AppendNode(pt1);
|
||
|
||
poly2.AppendNode(pt8);
|
||
poly2.AppendNode(pt5);
|
||
poly2.AppendNode(pt12);
|
||
ads_polar(pt9,m_nRotation+PI/2,m_nStepWidth,pt9);
|
||
poly2.AppendNode(pt9);
|
||
}
|
||
poly1.SetElevation(GetElevation());
|
||
poly2.SetElevation(GetElevation());
|
||
pArrowDown1->SetPoly2D(poly1);
|
||
pArrowDown2->SetPoly2D(poly2);
|
||
}
|
||
else //首层和中间层
|
||
{
|
||
XPoly2D poly,poly3;
|
||
if(m_nStartSide==OFFSET_MID) //中跑上楼
|
||
{
|
||
if(nSectStair==0) //中梯剖断
|
||
{
|
||
poly.AppendNode(pt8);
|
||
poly.AppendNode(pt7);
|
||
poly.SetElevation(GetElevation());
|
||
pArrowUp1->SetPoly2D(poly);
|
||
|
||
if(m_nStairFlag == SF_MIDDLE) //中间层
|
||
{
|
||
poly3.AppendNode(pt1);
|
||
poly3.AppendNode(pt4);
|
||
poly3.AppendNode(pt5);
|
||
poly3.AppendNode(pt6);
|
||
poly3.SetElevation(GetElevation());
|
||
pArrowDown1->SetPoly2D(poly3);
|
||
|
||
XPoly2D poly4;
|
||
poly4.AppendNode(pt9);
|
||
poly4.AppendNode(pt12);
|
||
poly4.AppendNode(pt5);
|
||
poly4.AppendNode(pt6);
|
||
poly4.SetElevation(GetElevation());
|
||
pArrowDown2->SetPoly2D(poly4);
|
||
}
|
||
}
|
||
else if(nSectStair==1) //边梯剖断
|
||
{
|
||
poly.AppendNode(pt8);
|
||
poly.AppendNode(pt5);
|
||
poly.AppendNode(pt4);
|
||
poly.AppendNode(pt3);
|
||
poly.SetElevation(GetElevation());
|
||
pArrowUp1->SetPoly2D(poly);
|
||
|
||
XPoly2D poly2;
|
||
poly2.AppendNode(pt8);
|
||
poly2.AppendNode(pt5);
|
||
poly2.AppendNode(pt12);
|
||
poly2.AppendNode(pt11);
|
||
poly2.SetElevation(GetElevation());
|
||
pArrowUp2->SetPoly2D(poly2);
|
||
|
||
if(m_nStairFlag == SF_MIDDLE) //中间层
|
||
{
|
||
poly3.AppendNode(pt1);
|
||
poly3.AppendNode(pt2);
|
||
poly3.SetElevation(GetElevation());
|
||
pArrowDown1->SetPoly2D(poly3);
|
||
|
||
XPoly2D poly4;
|
||
poly4.AppendNode(pt9);
|
||
poly4.AppendNode(pt10);
|
||
poly4.SetElevation(GetElevation());
|
||
pArrowDown2->SetPoly2D(poly4);
|
||
}
|
||
}
|
||
}
|
||
else //边跑上楼
|
||
{
|
||
if(nSectStair==0) //中梯剖断
|
||
{
|
||
poly.AppendNode(pt1);
|
||
poly.AppendNode(pt4);
|
||
poly.AppendNode(pt5);
|
||
poly.AppendNode(pt6);
|
||
poly.SetElevation(GetElevation());
|
||
pArrowUp1->SetPoly2D(poly);
|
||
|
||
XPoly2D poly2;
|
||
poly2.AppendNode(pt9);
|
||
poly2.AppendNode(pt12);
|
||
poly2.AppendNode(pt5);
|
||
poly2.AppendNode(pt6);
|
||
poly2.SetElevation(GetElevation());
|
||
pArrowUp2->SetPoly2D(poly2);
|
||
|
||
if(m_nStairFlag == SF_MIDDLE) //中间层
|
||
{
|
||
poly3.AppendNode(pt8);
|
||
poly3.AppendNode(pt7);
|
||
poly3.SetElevation(GetElevation());
|
||
pArrowDown1->SetPoly2D(poly3);
|
||
}
|
||
}
|
||
else if(nSectStair==1) //边梯剖断
|
||
{
|
||
poly.AppendNode(pt1);
|
||
poly.AppendNode(pt2);
|
||
poly.SetElevation(GetElevation());
|
||
pArrowUp1->SetPoly2D(poly);
|
||
|
||
XPoly2D poly4;
|
||
poly4.AppendNode(pt9);
|
||
poly4.AppendNode(pt10);
|
||
poly4.SetElevation(GetElevation());
|
||
pArrowUp2->SetPoly2D(poly4);
|
||
|
||
if(m_nStairFlag == SF_MIDDLE) //中间层
|
||
{
|
||
poly3.AppendNode(pt8);
|
||
poly3.AppendNode(pt5);
|
||
poly3.AppendNode(pt4);
|
||
poly3.AppendNode(pt3);
|
||
poly3.SetElevation(GetElevation());
|
||
pArrowDown1->SetPoly2D(poly3);
|
||
|
||
XPoly2D poly2;
|
||
poly2.AppendNode(pt8);
|
||
poly2.AppendNode(pt5);
|
||
poly2.AppendNode(pt12);
|
||
poly2.AppendNode(pt11);
|
||
poly2.SetElevation(GetElevation());
|
||
pArrowDown2->SetPoly2D(poly2);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
{
|
||
pArrowUp1->setPropertiesFrom(this);
|
||
|
||
//add by xlc on 090212
|
||
pArrowUp1->SetTextHeight(m_dTextHeight);
|
||
|
||
|
||
//modify by xlc on 090205
|
||
//pArrowUp1->SetLayoutRotation(Ucs2Wcs(0));
|
||
pArrowUp1->SetLayoutRotation(GetLayoutRotation());
|
||
|
||
//modify by xlc on 090426
|
||
//pArrowUp1->SetText(_T("上"));
|
||
pArrowUp1->SetText(GetTextUp());
|
||
|
||
pArrowUp1->SetTextAlign(TDbSymbArrow::kAtSide);
|
||
pArrowUp1->SetTextLocation(pArrowUp1->GetDefaultTextLocation());
|
||
pArrowUp1->SetTextLayerId(m_idLayerText);
|
||
pArrowUp1->SetTextStyleId(m_idTextStyle);
|
||
|
||
pArrowUp2->setPropertiesFrom(this);
|
||
|
||
//add by xlc on 090212
|
||
pArrowUp2->SetTextHeight(m_dTextHeight);
|
||
|
||
pArrowUp2->SetLayoutRotation(GetLayoutRotation());
|
||
|
||
//modify by xlc on 090426
|
||
//pArrowUp2->SetText(_T("上"));
|
||
pArrowUp2->SetText(GetTextUp());
|
||
|
||
pArrowUp2->SetTextAlign(TDbSymbArrow::kAtSide);
|
||
pArrowUp2->SetTextLocation(pArrowUp2->GetDefaultTextLocation());
|
||
pArrowUp2->SetTextLayerId(m_idLayerText);
|
||
pArrowUp2->SetTextStyleId(m_idTextStyle);
|
||
|
||
pArrowDown1->setPropertiesFrom(this);
|
||
|
||
//add by xlc on 090212
|
||
pArrowDown1->SetTextHeight(m_dTextHeight);
|
||
|
||
pArrowDown1->SetLayoutRotation(GetLayoutRotation());
|
||
|
||
//modify by xlc on 090426
|
||
//pArrowDown1->SetText(_T("下"));
|
||
pArrowDown1->SetText(GetTextDown());
|
||
|
||
pArrowDown1->SetTextAlign(TDbSymbArrow::kAtSide);
|
||
pArrowDown1->SetTextLocation(pArrowDown1->GetDefaultTextLocation());
|
||
pArrowDown1->SetTextLayerId(m_idLayerText);
|
||
pArrowDown1->SetTextStyleId(m_idTextStyle);
|
||
|
||
pArrowDown2->setPropertiesFrom(this);
|
||
|
||
//add by xlc on 090212
|
||
pArrowDown2->SetTextHeight(m_dTextHeight);
|
||
|
||
pArrowDown2->SetLayoutRotation(GetLayoutRotation());
|
||
|
||
//modify by xlc on 090426
|
||
//pArrowDown2->SetText(_T("下"));
|
||
pArrowDown2->SetText(GetTextDown());
|
||
|
||
pArrowDown2->SetTextAlign(TDbSymbArrow::kAtSide);
|
||
pArrowDown2->SetTextLocation(pArrowDown2->GetDefaultTextLocation());
|
||
pArrowDown2->SetTextLayerId(m_idLayerText);
|
||
pArrowDown2->SetTextStyleId(m_idTextStyle);
|
||
|
||
if(m_idLayerArrow.isValid())
|
||
{
|
||
pArrowUp1->setLayer(m_idLayerArrow);
|
||
pArrowUp2->setLayer(m_idLayerArrow);
|
||
pArrowDown1->setLayer(m_idLayerArrow);
|
||
pArrowDown2->setLayer(m_idLayerArrow);
|
||
}
|
||
|
||
}
|
||
}
|
||
|
||
//add by xlc on 090122 获得梯段扶手线的位置
|
||
void TDbParallelStair::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);
|
||
}
|
||
|
||
void TDbParallelStair::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));
|
||
}
|
||
}
|
||
Acad::ErrorStatus
|
||
TDbParallelStair::ExplodeOrDraw3d(XExplodeDraw &dc) const
|
||
{
|
||
if(m_nViewCtrl==1)
|
||
return Acad::eOk; //三维被禁止
|
||
|
||
assertReadEnabled();
|
||
|
||
TDbLineStair stair1, stair2, stair3;
|
||
TDbSlab slab;
|
||
TDbHandRail rail, rail2, railTop, railTop2,railOut1,railOut2;
|
||
ExplodeTo(stair1, stair2, stair3, slab, rail, rail2, &railTop, &railTop2,&railOut1,&railOut2);
|
||
|
||
if(m_nStairFlag==SF_TOP)
|
||
{
|
||
{
|
||
TPushProperty vProp(&railTop, dc);
|
||
if(dc.IsFullExplode())
|
||
railTop.ExplodeOrDraw3d(dc);
|
||
else
|
||
dc.DrawEntity(railTop);
|
||
}
|
||
|
||
if(m_nStartSide != OFFSET_MID)
|
||
{
|
||
TPushProperty vProp(&railTop2, dc);
|
||
if(dc.IsFullExplode())
|
||
railTop2.ExplodeOrDraw3d(dc);
|
||
else
|
||
dc.DrawEntity(railTop2);
|
||
}
|
||
|
||
// 内侧栏杆
|
||
if(IsAutoRail())
|
||
{
|
||
dc.SetColorLayer(colorIndex(), m_idLayerRail3d);
|
||
XPoly2D polyPath=railTop.GetOutline();
|
||
DrawRail(polyPath,m_nStepWidth,dc);
|
||
|
||
if(m_nStartSide != OFFSET_MID)//顶层右边栏杆
|
||
{
|
||
XPoly2D polyPath=railTop2.GetOutline();
|
||
DrawRail(polyPath,m_nStepWidth,dc);
|
||
}
|
||
}
|
||
}
|
||
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);
|
||
}
|
||
//右边梯段
|
||
{
|
||
TPushProperty vProp(&stair3, dc);
|
||
if(dc.IsFullExplode())
|
||
stair3.ExplodeOrDraw3d(dc);
|
||
else
|
||
dc.DrawEntity(stair3);
|
||
}
|
||
|
||
//休息平台
|
||
if(GetSlabSizeSide()>_DIST_SNAP&&GetSlabSizeMid()>_DIST_SNAP&&IsShowSlab())
|
||
{
|
||
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);
|
||
}
|
||
|
||
// 外侧栏杆
|
||
if(IsAutoOutRail())
|
||
{
|
||
dc.SetColorLayer(colorIndex(), m_idLayerRail3d);
|
||
XPoly2D polyPath=railOut1.GetOutline();
|
||
|
||
//modify by xlc on 090122 修改栏杆画法,不作为坡道时,只在踏步中间画
|
||
double nDistToSide=((GetSpaceWidth()-2*GetStairWidth()-GetMStairWidth())<_DIST_SNAP*2&&m_nRailDistToSide<0) ?
|
||
_AS_SYS_UNIT(0) : m_nRailDistToSide;
|
||
nDistToSide += m_nRailWidth/2;
|
||
double nDist=m_nStartSide==OFFSET_MID?nDistToSide:-nDistToSide;
|
||
if(m_nStartSide==OFFSET_MID)
|
||
{
|
||
GetRailPolyFromStair(stair1,-nDist,0,m_nRailDist,1,polyPath);
|
||
DrawRail(polyPath,m_nStepWidth,dc);
|
||
polyPath=railOut2.GetOutline();
|
||
GetRailPolyFromStair(stair3,nDist,0,m_nRailDist,0,polyPath);
|
||
DrawRail(polyPath,m_nStepWidth,dc);
|
||
}
|
||
else
|
||
{
|
||
GetRailPolyFromStair(stair1,-nDist,m_nRailDist,0,0,polyPath);
|
||
DrawRail(polyPath,m_nStepWidth,dc);
|
||
polyPath=railOut2.GetOutline();
|
||
GetRailPolyFromStair(stair3,nDist,m_nRailDist,0,1,polyPath);
|
||
DrawRail(polyPath,m_nStepWidth,dc);
|
||
}
|
||
}
|
||
}
|
||
|
||
//内侧扶手
|
||
extern BOOL g_bInElevProcess;
|
||
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);
|
||
}
|
||
TPushProperty vProp2(&rail2, dc);
|
||
if(g_bInElevProcess)
|
||
{
|
||
XPoly2D polyPath;
|
||
AcGeVector3d normal;
|
||
rail2.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());
|
||
rail2.SetPathPoly(poly3d,normal);
|
||
if(dc.IsFullExplode())
|
||
rail2.ExplodeOrDraw3d(dc);
|
||
else
|
||
dc.DrawEntity(rail2);
|
||
}
|
||
}
|
||
rail2.SetPathPoly(polyPath,normal);
|
||
|
||
}
|
||
else
|
||
{
|
||
if(dc.IsFullExplode())
|
||
rail2.ExplodeOrDraw3d(dc);
|
||
else
|
||
dc.DrawEntity(rail2);
|
||
}
|
||
}
|
||
|
||
// 内侧栏杆
|
||
if(IsAutoRail())
|
||
{
|
||
dc.SetColorLayer(colorIndex(), m_idLayerRail3d);
|
||
XPoly2D polyPath=rail.GetOutline();
|
||
|
||
//modify by xlc on 090122 修改栏杆画法,不作为坡道时,只在踏步中间画
|
||
// DrawRail(polyPath,m_nStepWidth,dc);
|
||
//
|
||
// polyPath=rail2.GetOutline();
|
||
// DrawRail(polyPath,m_nStepWidth,dc);
|
||
double nDistToSide=((GetSpaceWidth()-2*GetStairWidth()-GetMStairWidth())<_DIST_SNAP*2 &&m_nRailDistToSide<0)?
|
||
_AS_SYS_UNIT(0) : m_nRailDistToSide;
|
||
nDistToSide += m_nRailWidth/2;
|
||
|
||
if(m_nStartSide==OFFSET_MID)
|
||
{
|
||
GetRailPolyFromStair(stair2,nDistToSide,m_nRailDist,0,0,polyPath);
|
||
DrawRail(polyPath,m_nStepWidth,dc);
|
||
|
||
GetRailPolyFromStair(stair2,-nDistToSide,m_nRailDist,0,1,polyPath);
|
||
DrawRail(polyPath,m_nStepWidth,dc);
|
||
|
||
GetRailPolyFromStair(stair1,nDistToSide,0,m_nRailDist,0,polyPath);
|
||
DrawRail(polyPath,m_nStepWidth,dc);
|
||
polyPath=railOut2.GetOutline();
|
||
GetRailPolyFromStair(stair3,-nDistToSide,0,m_nRailDist,1,polyPath);
|
||
DrawRail(polyPath,m_nStepWidth,dc);
|
||
}
|
||
else
|
||
{
|
||
GetRailPolyFromStair(stair2,nDistToSide,0,m_nRailDist,0,polyPath);
|
||
DrawRail(polyPath,m_nStepWidth,dc);
|
||
|
||
GetRailPolyFromStair(stair2,-nDistToSide,0,m_nRailDist,1,polyPath);
|
||
DrawRail(polyPath,m_nStepWidth,dc);
|
||
|
||
GetRailPolyFromStair(stair1,-nDistToSide,m_nRailDist,0,1,polyPath);
|
||
DrawRail(polyPath,m_nStepWidth,dc);
|
||
polyPath=railOut2.GetOutline();
|
||
GetRailPolyFromStair(stair3,nDistToSide,m_nRailDist,0,0,polyPath);
|
||
DrawRail(polyPath,m_nStepWidth,dc);
|
||
}
|
||
}
|
||
}
|
||
|
||
return Acad::eOk;
|
||
}
|
||
bool TDbParallelStair::IsClipMe(const TEntityBase* pEnt)const
|
||
{
|
||
if(TDbEntity::IsClipMe(pEnt))
|
||
return true;
|
||
|
||
if(pEnt->GetMe()->isKindOf(TDbColumn::desc()))
|
||
return true;
|
||
|
||
return false;
|
||
}
|
||
|
||
Acad::ErrorStatus
|
||
TDbParallelStair::ExplodeOrDraw2d(XExplodeDraw &dc) const
|
||
{
|
||
if(m_nViewCtrl==2)
|
||
return Acad::eOk; //二维被禁止
|
||
|
||
assertReadEnabled();
|
||
CString s1=dc.Desc(),s2=XAcGiViewDraw::Descriptor();
|
||
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);
|
||
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,stair3;
|
||
TDbSlab slab;
|
||
TDbHandRail rail,rail2,railOut1,railOut2;
|
||
ExplodeTo(stair1, stair2, stair3, slab, rail,rail2,NULL,NULL,&railOut1,&railOut2);
|
||
|
||
TDbSymbArrow pArrowUp1,pArrowUp2,pArrowDown1,pArrowDown2;
|
||
if(IsArrow()) //画箭头
|
||
{
|
||
GetDefaultArrow(stair1,stair2,stair3,&pArrowUp1,&pArrowUp2,&pArrowDown1,&pArrowDown2);
|
||
|
||
if(dc.IsFullExplode())
|
||
{
|
||
TPushProperty vProp(&pArrowUp1, dc);
|
||
pArrowUp1.ExplodeOrDraw2d(dc);
|
||
pArrowDown1.ExplodeOrDraw2d(dc);
|
||
pArrowUp2.ExplodeOrDraw2d(dc);
|
||
pArrowDown2.ExplodeOrDraw2d(dc);
|
||
}
|
||
else
|
||
{
|
||
dc.DrawEntity(pArrowUp1);
|
||
dc.DrawEntity(pArrowUp2);
|
||
dc.DrawEntity(pArrowDown1);
|
||
dc.DrawEntity(pArrowDown2);
|
||
}
|
||
}
|
||
|
||
stair1.AddTempRail(&rail);
|
||
stair2.AddTempRail(&rail);
|
||
stair2.AddTempRail(&rail2);
|
||
stair3.AddTempRail(&rail2);
|
||
if(m_nStairFlag==SF_TOP&&m_nStartSide==OFFSET_MID)
|
||
{
|
||
stair3.AddTempRail(&rail);
|
||
}
|
||
|
||
if(IsOutRail()) //外侧扶手
|
||
{
|
||
stair1.AddTempRail(&railOut1);
|
||
railOut1.SetTempStair(&stair1);
|
||
stair3.AddTempRail(&railOut2);
|
||
railOut2.SetTempStair(&stair3);
|
||
}
|
||
|
||
XPoint ptSectLeft2d, ptSectRight2d;
|
||
int nSectStair=GetSectStairPos();
|
||
double lSectPos,rSectPos;
|
||
XPoint ptLeft2d,ptRight2d;
|
||
if(CalSectPos(lSectPos,rSectPos,ptLeft2d,ptRight2d))
|
||
{
|
||
if(nSectStair==0)
|
||
{
|
||
stair2.SetSectionPos(0, lSectPos);
|
||
stair2.SetSectionPos(1, rSectPos);
|
||
|
||
stair1.Set2DFlag(SF_NOSECT);
|
||
stair3.Set2DFlag(SF_NOSECT);
|
||
}
|
||
else if(nSectStair==1)
|
||
{
|
||
stair1.SetSectionPos(0, lSectPos);
|
||
stair1.SetSectionPos(1, rSectPos);
|
||
|
||
stair3.SetSectionPos(0, lSectPos);
|
||
stair3.SetSectionPos(1, rSectPos);
|
||
stair2.Set2DFlag(SF_NOSECT);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
stair1.Set2DFlag(SF_NOSECT);
|
||
stair2.Set2DFlag(SF_NOSECT);
|
||
stair3.Set2DFlag(SF_NOSECT);
|
||
}
|
||
HitSectPosByPoint2d(ptLeft2d);
|
||
|
||
//显示梯段
|
||
if(dc.IsFullExplode())
|
||
{
|
||
if(m_nStairFlag!=SF_FIRST)
|
||
{
|
||
stair1.ExplodeOrDraw2d(dc);
|
||
stair2.ExplodeOrDraw2d(dc);
|
||
stair3.ExplodeOrDraw2d(dc);
|
||
}
|
||
else
|
||
{
|
||
if(m_nStartSide == OFFSET_MID)
|
||
{
|
||
stair2.ExplodeOrDraw2d(dc);
|
||
if(nSectStair==1) //剖切边梯
|
||
{
|
||
stair1.ExplodeOrDraw2d(dc);
|
||
stair3.ExplodeOrDraw2d(dc);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
stair1.ExplodeOrDraw2d(dc);
|
||
stair3.ExplodeOrDraw2d(dc);
|
||
if(nSectStair == 0) //剖切中梯
|
||
{
|
||
stair2.ExplodeOrDraw2d(dc);
|
||
}
|
||
}
|
||
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if(m_nStairFlag!=SF_FIRST)
|
||
{
|
||
dc.DrawEntity(stair1);
|
||
dc.DrawEntity(stair2);
|
||
dc.DrawEntity(stair3);
|
||
}
|
||
else
|
||
{
|
||
if(m_nStartSide == OFFSET_MID)
|
||
{
|
||
dc.DrawEntity(stair2);
|
||
if(nSectStair == 1) //剖切边梯
|
||
{
|
||
dc.DrawEntity(stair1);
|
||
dc.DrawEntity(stair3);
|
||
}
|
||
}
|
||
else //剖切中梯
|
||
{
|
||
dc.DrawEntity(stair1);
|
||
dc.DrawEntity(stair3);
|
||
if(nSectStair == 0)
|
||
{
|
||
dc.DrawEntity(stair2);
|
||
}
|
||
}
|
||
|
||
}
|
||
}
|
||
|
||
// 设置内侧扶手
|
||
if(m_nStartSide == OFFSET_MID)
|
||
{
|
||
if(nSectStair==0)
|
||
{
|
||
rail.SetTempStair(&stair2);
|
||
rail.setPropertiesFrom(this);
|
||
if(m_nStairFlag != SF_TOP) //扶手未合并
|
||
{
|
||
rail2.SetTempStair(&stair2);
|
||
rail2.setPropertiesFrom(this);
|
||
}
|
||
}
|
||
else if(nSectStair==1)
|
||
{
|
||
rail.SetTempStair(&stair1);
|
||
rail.setPropertiesFrom(this);
|
||
|
||
if(m_nStairFlag != SF_TOP) //扶手合并
|
||
{
|
||
rail2.SetTempStair(&stair3);
|
||
rail2.setPropertiesFrom(this);
|
||
}
|
||
}
|
||
else if(m_nStairFlag==SF_TOP)
|
||
{
|
||
rail.AddTempStair(&stair1);
|
||
rail.setPropertiesFrom(this);
|
||
rail.AddTempStair(&stair2);
|
||
rail.setPropertiesFrom(this);
|
||
rail.AddTempStair(&stair3);
|
||
rail.setPropertiesFrom(this);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if(nSectStair==0)
|
||
{
|
||
rail.SetTempStair(&stair2);
|
||
rail.setPropertiesFrom(this);
|
||
rail2.SetTempStair(&stair2);
|
||
rail2.setPropertiesFrom(this);
|
||
}
|
||
else if(nSectStair==1)
|
||
{
|
||
rail.SetTempStair(&stair1);
|
||
rail.setPropertiesFrom(this);
|
||
rail2.SetTempStair(&stair3);
|
||
rail2.setPropertiesFrom(this);
|
||
|
||
}
|
||
}
|
||
// 内侧扶手
|
||
rail.setPropertiesFrom(this);
|
||
rail2.setPropertiesFrom(this);
|
||
if(dc.IsFullExplode())
|
||
{
|
||
rail.ExplodeOrDraw2d(dc);
|
||
if(!(m_nStairFlag == SF_TOP&&m_nStartSide==OFFSET_MID))
|
||
{
|
||
rail2.ExplodeOrDraw2d(dc);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
dc.DrawEntity(rail);
|
||
if(!(m_nStairFlag == SF_TOP&&m_nStartSide==OFFSET_MID))
|
||
{
|
||
dc.DrawEntity(rail2);
|
||
}
|
||
}
|
||
|
||
//外侧扶手
|
||
if(IsOutRail())
|
||
{
|
||
railOut1.setPropertiesFrom(this);
|
||
railOut2.setPropertiesFrom(this);
|
||
if(dc.IsFullExplode())
|
||
{
|
||
//首层中梯起步中梯剖断时不画外侧扶手
|
||
if(!(m_nStairFlag==SF_FIRST &&m_nStartSide==OFFSET_MID&&nSectStair==0))
|
||
{
|
||
railOut1.ExplodeOrDraw2d(dc);
|
||
railOut2.ExplodeOrDraw2d(dc);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
//首层中梯起步中梯剖断时不画外侧扶手
|
||
if(!(m_nStairFlag==SF_FIRST&&m_nStartSide==OFFSET_MID&&nSectStair==0))
|
||
{
|
||
dc.DrawEntity(railOut1);
|
||
dc.DrawEntity(railOut2);
|
||
}
|
||
}
|
||
}
|
||
|
||
//休息平台
|
||
if(!(m_nStairFlag==SF_FIRST&&(
|
||
(nSectStair==0&&m_nStartSide==OFFSET_MID)
|
||
||(nSectStair==1&&m_nStartSide!=OFFSET_MID))))//首层中梯上楼中梯剖断与边梯上楼边梯剖断不画休息台
|
||
{
|
||
double nLen1=stair1.GetStairLength(),
|
||
nLen2=stair2.GetStairLength();
|
||
double nLenSide=nLen1+GetSlabSizeSide(),nLenMid=nLen2+GetSlabSizeMid(); //梯段与平台总长,判断是否齐楼板
|
||
if(GetSlabSizeSide()>_DIST_SNAP&&GetSlabSizeMid()>_DIST_SNAP)
|
||
{
|
||
if(IsShowSlab())
|
||
{
|
||
slab.AddTempRail(&rail);
|
||
if(!(m_nStairFlag == SF_TOP&&m_nStartSide==OFFSET_MID))
|
||
{
|
||
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-m_nMStairWidth>_DIST_SNAP)
|
||
{
|
||
//绘制平台线
|
||
XPoint ptFromL=m_nStartSide==OFFSET_MID? stair2.GetUpLeft2d() : stair2.GetLowRight2d();
|
||
XPoint ptToL=m_nStartSide==OFFSET_MID? stair1.GetLowLeft2d() : stair1.GetUpRight2d();
|
||
XPoint ptFromR=m_nStartSide==OFFSET_MID? stair2.GetUpRight2d() : stair2.GetLowLeft2d();
|
||
XPoint ptToR=m_nStartSide==OFFSET_MID? stair3.GetLowRight2d() : stair3.GetUpLeft2d();
|
||
|
||
//if(fabs(nLen1-nLen2)>_DIST_SNAP && m_nAlignment!=0)
|
||
if(fabs(GetSlabSizeSide()-GetSlabSizeMid())>_DIST_SNAP)
|
||
{
|
||
double nIdent=GetSlabSizeSide()-GetSlabSizeMid();
|
||
XPoint ptTempL,ptTempR;
|
||
if(nIdent>0)
|
||
{
|
||
ads_polar(ptToL, m_nRotation+PI/2, nIdent, ptTempL);
|
||
ads_polar(ptToR, m_nRotation+PI/2, nIdent, ptTempR);
|
||
}
|
||
else
|
||
{
|
||
ads_polar(ptFromL, m_nRotation+PI/2, fabs(nIdent), ptTempL);
|
||
ads_polar(ptFromR, m_nRotation+PI/2, fabs(nIdent), ptTempR);
|
||
}
|
||
dc << XLine(ptFromL, ptTempL) << XLine(ptTempL, ptToL)
|
||
<< XLine(ptFromR, ptTempR) << XLine(ptTempR, ptToR);
|
||
}
|
||
else
|
||
{
|
||
dc << XLine(ptFromL, ptToL)<< XLine(ptFromR, ptToR);
|
||
}
|
||
}
|
||
|
||
// 绘制楼板线
|
||
if(m_nStairFlag!=SF_FIRST)
|
||
{
|
||
XPoint ptFromL=m_nStartSide==OFFSET_MID? stair2.GetLowLeft2d() : stair2.GetUpRight2d();
|
||
XPoint ptToL=m_nStartSide==OFFSET_MID? stair1.GetUpLeft2d() : stair1.GetLowRight2d();
|
||
XPoint ptFromR=m_nStartSide==OFFSET_MID? stair2.GetLowRight2d() : stair2.GetUpLeft2d();
|
||
XPoint ptToR=m_nStartSide==OFFSET_MID? stair3.GetUpRight2d() : stair3.GetLowLeft2d();
|
||
|
||
//if(fabs(nLen1-nLen2)>_DIST_SNAP && m_nAlignment!=2)
|
||
if(fabs(nLenSide-nLenMid)>_DIST_SNAP)
|
||
{
|
||
double nIdent=nLenMid-nLenSide;
|
||
XPoint ptTempL,ptTempR;
|
||
if(nIdent>0)//中梯长
|
||
{
|
||
ads_polar(ptToL, m_nRotation-PI/2, nIdent, ptTempL);
|
||
ads_polar(ptToR, m_nRotation-PI/2, nIdent, ptTempR);
|
||
if((m_nRailDistToSide>=0&&m_nRailDist>m_nRailWidth)
|
||
||(m_nRailDistToSide<=-m_nRailWidth&&m_nRailDist<0)
|
||
||m_nRailDist<-nIdent) //楼板线不被遮挡
|
||
{
|
||
dc << XLine(ptFromL, ptTempL)<< XLine(ptFromR, ptTempR);
|
||
if(m_nStairFlag==SF_TOP&&m_nStartSide!=OFFSET_MID&&m_nRailDistToSide<=-m_nRailWidth&&m_nRailDist<0&&m_nRailDist>-fabs(nIdent))
|
||
{
|
||
XPoint ptTmpL,ptTmpR;
|
||
ads_polar(ptTempL, m_nRotation-PI/2, m_nRailDist, ptTmpL);
|
||
ads_polar(ptTempR, m_nRotation-PI/2, m_nRailDist, ptTmpR);
|
||
dc << XLine(ptTempL, ptTmpL)<< XLine(ptTempR, ptTmpR);
|
||
ads_polar(ptTempL, m_nRotation-PI/2, m_nRailDist-m_nRailWidth, ptTmpL);
|
||
ads_polar(ptTempR, m_nRotation-PI/2, m_nRailDist-m_nRailWidth, ptTmpR);
|
||
dc << XLine(ptTmpL, ptToL)<< XLine(ptTmpR, ptToR);
|
||
}
|
||
else
|
||
{
|
||
dc << XLine(ptTempL, ptToL) << XLine(ptTempR, ptToR) ;
|
||
}
|
||
}
|
||
else if(m_nRailDistToSide>=0&&m_nRailDist<=m_nRailWidth)
|
||
{
|
||
XPoint ptL,ptR;
|
||
ads_polar(ptToL, m_nRotation-PI/2, nIdent+m_nRailDist-m_nRailWidth, ptL);
|
||
ads_polar(ptToR, m_nRotation-PI/2, nIdent+m_nRailDist-m_nRailWidth, ptR);
|
||
dc<<XLine(ptToL,ptL)<<XLine(ptToR,ptR);
|
||
if(m_nRailDist<0)
|
||
{
|
||
ads_polar(ptTempL, m_nRotation+PI/2, fabs(m_nRailDist), ptToL);
|
||
ads_polar(ptTempR, m_nRotation+PI/2, fabs(m_nRailDist), ptToR);
|
||
dc << XLine(ptFromL, ptTempL) << XLine(ptTempL, ptToL)
|
||
<< XLine(ptFromR, ptTempR) << XLine(ptTempR, ptToR);
|
||
}
|
||
}
|
||
else if(m_nRailDistToSide<=-m_nRailWidth&&m_nRailDist>=0)//楼板线被扶手线打断
|
||
{
|
||
if(m_nStairFlag==SF_TOP&&m_nStartSide!=OFFSET_MID&&m_nRailDist<=m_nRailWidth)
|
||
{
|
||
XPoint ptTmpL,ptTmpR;
|
||
ads_polar(ptTempL, m_nRotation-PI/2, m_nRailDist-m_nRailWidth, ptTmpL);
|
||
ads_polar(ptTempR, m_nRotation-PI/2, m_nRailDist-m_nRailWidth, ptTmpR);
|
||
dc << XLine(ptTmpL, ptToL)<< XLine(ptTmpR, ptToR);
|
||
}
|
||
else
|
||
{
|
||
dc << XLine(ptTempL, ptToL)<< XLine(ptTempR, ptToR);
|
||
}
|
||
XPoint ptL,ptR;
|
||
ads_polar(ptFromL, m_nRotation, m_nRailDistToSide+m_nRailWidth, ptL);
|
||
if(!(m_nStairFlag==SF_TOP&&m_nStartSide==OFFSET_MID&&m_nRailDist<=m_nRailWidth))
|
||
{
|
||
dc << XLine(ptFromL, ptL);
|
||
}
|
||
ads_polar(ptTempL, m_nRotation, fabs(m_nRailDistToSide+m_nRailWidth), ptR);
|
||
if(!(m_nStairFlag==SF_TOP&&m_nStartSide!=OFFSET_MID&&m_nRailDist<=m_nRailWidth))
|
||
{
|
||
dc << XLine(ptTempL, ptR);
|
||
}
|
||
if(m_nRailDist>m_nRailWidth)
|
||
{
|
||
ads_polar(ptL, m_nRotation+PI, m_nRailWidth, ptL);
|
||
ads_polar(ptR, m_nRotation, m_nRailWidth, ptR);
|
||
dc << XLine(ptL, ptR);
|
||
}
|
||
|
||
ads_polar(ptFromR, m_nRotation, fabs(m_nRailDistToSide+m_nRailWidth), ptL);
|
||
if(!(m_nStairFlag==SF_TOP&&m_nStartSide==OFFSET_MID&&m_nRailDist<=m_nRailWidth))
|
||
{
|
||
dc << XLine(ptFromR, ptL);
|
||
}
|
||
ads_polar(ptTempR, m_nRotation, m_nRailDistToSide+m_nRailWidth, ptR);
|
||
if(!(m_nStairFlag==SF_TOP&&m_nStartSide!=OFFSET_MID&&m_nRailDist<=m_nRailWidth))
|
||
{
|
||
dc << XLine(ptTempR, ptR);
|
||
}
|
||
if(m_nRailDist>m_nRailWidth)
|
||
{
|
||
ads_polar(ptL, m_nRotation, m_nRailWidth, ptL);
|
||
ads_polar(ptR, m_nRotation+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)
|
||
{
|
||
XPoint ptL,ptR;
|
||
if(m_nRailDist<=0)
|
||
{
|
||
dc<<XLine(ptTempL,ptFromL)<<XLine(ptTempR,ptFromR);
|
||
ads_polar(ptTempL, m_nRotation+PI/2, fabs(m_nRailDist), ptL);
|
||
ads_polar(ptTempR, m_nRotation+PI/2, fabs(m_nRailDist), ptR);
|
||
|
||
dc<<XLine(ptTempL,ptL)<<XLine(ptTempR,ptR);
|
||
}
|
||
else
|
||
{
|
||
ads_polar(ptFromL, m_nRotation+PI, fabs(m_nRailDistToSide), ptL);
|
||
ads_polar(ptTempL, m_nRotation, fabs(m_nRailDistToSide), ptR);
|
||
dc << XLine(ptL, ptR);
|
||
|
||
ads_polar(ptFromR, m_nRotation, fabs(m_nRailDistToSide), ptL);
|
||
ads_polar(ptTempR, m_nRotation+PI, fabs(m_nRailDistToSide), ptR);
|
||
dc << XLine(ptL, ptR);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
ads_polar(ptFromL, m_nRotation-PI/2, fabs(nIdent), ptTempL);
|
||
ads_polar(ptFromR, m_nRotation-PI/2, fabs(nIdent), ptTempR);
|
||
|
||
if((m_nRailDistToSide>=0&&m_nRailDist>m_nRailWidth)
|
||
||(m_nRailDistToSide<=-m_nRailWidth&&m_nRailDist<0)
|
||
||m_nRailDist<-fabs(nIdent)) //楼板线不被遮挡
|
||
{
|
||
dc<< XLine(ptTempL, ptToL) << XLine(ptTempR, ptToR);
|
||
if(m_nStairFlag==SF_TOP&&m_nStartSide==OFFSET_MID&&m_nRailDistToSide<=-m_nRailWidth&&m_nRailDist<0&&m_nRailDist>-fabs(nIdent))
|
||
{
|
||
XPoint ptTmpL,ptTmpR;
|
||
ads_polar(ptTempL, m_nRotation-PI/2, m_nRailDist, ptTmpL);
|
||
ads_polar(ptTempR, m_nRotation-PI/2, m_nRailDist, ptTmpR);
|
||
dc << XLine(ptTempL, ptTmpL)<< XLine(ptTempR, ptTmpR);
|
||
ads_polar(ptTempL, m_nRotation-PI/2, m_nRailDist-m_nRailWidth, ptTmpL);
|
||
ads_polar(ptTempR, m_nRotation-PI/2, m_nRailDist-m_nRailWidth, ptTmpR);
|
||
dc << XLine(ptTmpL, ptFromL)<< XLine(ptTmpR, ptFromR);
|
||
}
|
||
else
|
||
{
|
||
dc << XLine(ptFromL, ptTempL) << XLine(ptFromR, ptTempR);
|
||
}
|
||
}
|
||
else if(m_nRailDistToSide>=0&&m_nRailDist<=m_nRailWidth)
|
||
{
|
||
XPoint ptL,ptR;
|
||
ads_polar(ptFromL, m_nRotation-PI/2, -nIdent+m_nRailDist-m_nRailWidth, ptL);
|
||
ads_polar(ptFromR, m_nRotation-PI/2, -nIdent+m_nRailDist-m_nRailWidth, ptR);
|
||
dc<<XLine(ptFromL,ptL)<<XLine(ptFromR,ptR);
|
||
|
||
if(m_nRailDist<0)
|
||
{
|
||
ads_polar(ptTempL, m_nRotation+PI/2, fabs(m_nRailDist), ptFromL);
|
||
ads_polar(ptTempR, m_nRotation+PI/2, fabs(m_nRailDist), ptFromR);
|
||
dc << XLine(ptFromL, ptTempL) << XLine(ptTempL, ptToL)
|
||
<< XLine(ptFromR, ptTempR) << XLine(ptTempR, ptToR);
|
||
}
|
||
}
|
||
else if(m_nRailDistToSide<=-m_nRailWidth&&m_nRailDist>=0)//楼板线被扶手线打断
|
||
{
|
||
if(m_nStairFlag==SF_TOP&&m_nStartSide==OFFSET_MID&&m_nRailDist<=m_nRailWidth)
|
||
{
|
||
XPoint ptTmpL,ptTmpR;
|
||
ads_polar(ptTempL, m_nRotation-PI/2, m_nRailDist-m_nRailWidth, ptTmpL);
|
||
ads_polar(ptTempR, m_nRotation-PI/2, m_nRailDist-m_nRailWidth, ptTmpR);
|
||
dc << XLine(ptTmpL, ptFromL)<< XLine(ptTmpR, ptFromR);
|
||
}
|
||
else
|
||
{
|
||
dc << XLine(ptTempL, ptFromL)<< XLine(ptTempR, ptFromR);
|
||
}
|
||
XPoint ptL,ptR;
|
||
ads_polar(ptToL, m_nRotation, fabs(m_nRailDistToSide+m_nRailWidth), ptL);
|
||
if(!(m_nStairFlag==SF_TOP&&m_nStartSide!=OFFSET_MID&&m_nRailDist<=m_nRailWidth))
|
||
{
|
||
dc << XLine(ptToL, ptL);
|
||
}
|
||
ads_polar(ptTempL, m_nRotation, m_nRailDistToSide+m_nRailWidth, ptR);
|
||
if(!(m_nStairFlag==SF_TOP&&m_nStartSide==OFFSET_MID&&m_nRailDist<=m_nRailWidth))
|
||
{
|
||
dc << XLine(ptTempL, ptR);
|
||
}
|
||
if(m_nRailDist>m_nRailWidth)
|
||
{
|
||
ads_polar(ptL, m_nRotation, m_nRailWidth, ptL);
|
||
ads_polar(ptR, m_nRotation+PI, m_nRailWidth, ptR);
|
||
dc << XLine(ptL, ptR);
|
||
}
|
||
|
||
ads_polar(ptToR, m_nRotation, m_nRailDistToSide+m_nRailWidth, ptL);
|
||
if(!(m_nStairFlag==SF_TOP&&m_nStartSide!=OFFSET_MID&&m_nRailDist<=m_nRailWidth))
|
||
{
|
||
dc << XLine(ptToR, ptL);
|
||
}
|
||
ads_polar(ptTempR, m_nRotation, fabs(m_nRailDistToSide+m_nRailWidth), ptR);
|
||
if(!(m_nStairFlag==SF_TOP&&m_nStartSide==OFFSET_MID&&m_nRailDist<=m_nRailWidth))
|
||
{
|
||
dc << XLine(ptTempR, ptR);
|
||
}
|
||
if(m_nRailDist>m_nRailWidth)
|
||
{
|
||
ads_polar(ptL, m_nRotation+PI, m_nRailWidth, ptL);
|
||
ads_polar(ptR, m_nRotation, m_nRailWidth, ptR);
|
||
dc << XLine(ptL, ptR);
|
||
}
|
||
|
||
}
|
||
else if(m_nRailDistToSide<=0&&m_nRailDistToSide>=-m_nRailWidth)//楼板线两端被扶手遮挡
|
||
{
|
||
if(m_nRailDist>=m_nRailWidth||m_nRailDist<=0)
|
||
{
|
||
XPoint ptL,ptR;
|
||
if(m_nRailDist<=0)
|
||
{
|
||
dc << XLine(ptToL, ptTempL)<<XLine(ptToR,ptTempR);
|
||
ads_polar(ptTempL, m_nRotation+PI/2, fabs(m_nRailDist), ptL);
|
||
ads_polar(ptTempR, m_nRotation+PI/2, fabs(m_nRailDist), ptR);
|
||
|
||
dc<<XLine(ptTempL,ptL)<<XLine(ptTempR,ptR);
|
||
}
|
||
else
|
||
{
|
||
ads_polar(ptToL, m_nRotation, fabs(m_nRailDistToSide), ptL);
|
||
ads_polar(ptTempL, m_nRotation+PI, fabs(m_nRailDistToSide), ptR);
|
||
dc << XLine(ptL, ptR);
|
||
|
||
ads_polar(ptToR, m_nRotation+PI, fabs(m_nRailDistToSide), ptL);
|
||
ads_polar(ptTempR, m_nRotation, fabs(m_nRailDistToSide), ptR);
|
||
dc << XLine(ptL, ptR);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if((m_nRailDist<0)||(m_nRailDist>m_nRailWidth&&m_nRailDistToSide>=0))//楼板线不被扶手遮挡
|
||
{
|
||
dc << XLine(ptFromL, ptToL)<< XLine(ptFromR, ptToR);
|
||
}
|
||
else if(m_nRailDist>=0&&m_nRailDistToSide<=-m_nRailWidth)//楼板线被扶手打断
|
||
{
|
||
XPoint ptL,ptR;
|
||
ads_polar(ptFromL, m_nRotation, m_nRailDistToSide+m_nRailWidth, ptL);
|
||
if(!(m_nStairFlag==SF_TOP&&m_nStartSide==OFFSET_MID&&m_nRailDist<=m_nRailWidth))
|
||
{
|
||
dc << XLine(ptFromL, ptL);
|
||
}
|
||
ads_polar(ptToL, m_nRotation, fabs(m_nRailDistToSide+m_nRailWidth), ptR);
|
||
if(!(m_nStairFlag==SF_TOP&&m_nStartSide!=OFFSET_MID&&m_nRailDist<=m_nRailWidth))
|
||
{
|
||
dc << XLine(ptToL, ptR);
|
||
}
|
||
if(m_nRailDist>m_nRailWidth)
|
||
{
|
||
ads_polar(ptL, m_nRotation+PI, m_nRailWidth, ptL);
|
||
ads_polar(ptR, m_nRotation, m_nRailWidth, ptR);
|
||
dc << XLine(ptL, ptR);
|
||
}
|
||
|
||
|
||
ads_polar(ptFromR, m_nRotation, fabs(m_nRailDistToSide+m_nRailWidth), ptL);
|
||
if(!(m_nStairFlag==SF_TOP&&m_nStartSide==OFFSET_MID&&m_nRailDist<=m_nRailWidth))
|
||
{
|
||
dc << XLine(ptFromR, ptL);
|
||
}
|
||
ads_polar(ptToR, m_nRotation, m_nRailDistToSide+m_nRailWidth, ptR);
|
||
if(!(m_nStairFlag==SF_TOP&&m_nStartSide!=OFFSET_MID&&m_nRailDist<=m_nRailWidth))
|
||
{
|
||
dc << XLine(ptToR, ptR);
|
||
}
|
||
if(m_nRailDist>m_nRailWidth)
|
||
{
|
||
ads_polar(ptL, m_nRotation, m_nRailWidth, ptL);
|
||
ads_polar(ptR, m_nRotation+PI, m_nRailWidth, ptR);
|
||
dc << XLine(ptL, ptR);
|
||
}
|
||
}
|
||
else if(m_nRailDist>m_nRailWidth&&m_nRailDistToSide>=-m_nRailWidth&&m_nRailDistToSide<=0)//楼板线两端被扶手遮挡
|
||
{
|
||
XPoint ptL,ptR;
|
||
ads_polar(ptFromL, m_nRotation+PI, fabs(m_nRailDistToSide), ptL);
|
||
ads_polar(ptToL, m_nRotation, fabs(m_nRailDistToSide), ptR);
|
||
dc << XLine(ptL, ptR);
|
||
|
||
ads_polar(ptFromR, m_nRotation, fabs(m_nRailDistToSide), ptL);
|
||
ads_polar(ptToR, m_nRotation+PI, fabs(m_nRailDistToSide), ptR);
|
||
dc << XLine(ptL, ptR);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
return Acad::eOk;
|
||
}
|
||
|
||
|
||
// From TDbPolyPathEnt
|
||
Acad::ErrorStatus
|
||
TDbParallelStair::GetPathPoly(XPoly2D &polyPath,AcGeVector3d&normal) const
|
||
{
|
||
assertReadEnabled();
|
||
TDbLineStair stair1, stair2,stair3;
|
||
TDbSlab slab;
|
||
TDbHandRail rail, rail2, railTop,railTop2;
|
||
ExplodeTo(stair1, stair2, stair3, slab, rail, rail2, &railTop,&railTop2);
|
||
if(m_nStairFlag==SF_TOP)
|
||
railTop.GetBindPath(polyPath,normal);
|
||
else
|
||
rail.GetBindPath(polyPath,normal);
|
||
return Acad::eOk;
|
||
}
|
||
|
||
Acad::ErrorStatus
|
||
TDbParallelStair::SetPathPoly(const XPoly2D &polyPath,const AcGeVector3d&normal)
|
||
{
|
||
return Acad::eNotApplicable;
|
||
}
|
||
|
||
BOOL TDbParallelStair::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, rail2, railTop,railTop2;
|
||
ExplodeTo(stair1, stair2, stair3, slab, rail, rail2, &railTop,&railTop2);
|
||
|
||
XDirectionCurve cvLeft1,cvRight1;
|
||
double width=0; //剖断楼梯宽
|
||
double len=0; //剖断位置距楼梯起始点的距离
|
||
double length=0; //剖切梯段楼梯总长
|
||
int nSectStepNum=m_nSectStepNum; //剖断步数
|
||
if(nSectStepNum < 0) //负数调整为正的
|
||
{
|
||
nSectStepNum=m_nSectStepNum+m_nStepNum1+m_nStepNum2+1;
|
||
}
|
||
if((nSectStair==0&&m_nStartSide!=SF_MIDDLE&&nSectStepNum==m_nStepNum1)
|
||
||(nSectStair==1&&m_nStartSide==SF_MIDDLE&&nSectStepNum==m_nStepNum2)
|
||
||nSectStepNum==m_nStepNum1+m_nStepNum2)
|
||
{
|
||
nSectStepNum--;
|
||
}
|
||
|
||
|
||
len=(nSectStepNum-0.5)*m_nStepWidth;
|
||
if(nSectStair==0)
|
||
{
|
||
cvLeft1=stair2.GetSideCurve2d(0);
|
||
cvRight1=stair2.GetSideCurve2d(1);
|
||
width=stair2.GetStairWidth()*0.5;
|
||
length=stair2.GetStairLength();
|
||
if(m_nStartSide!=OFFSET_MID)
|
||
{
|
||
len-=m_nStepWidth*m_nStepNum1;
|
||
}
|
||
}
|
||
else if(nSectStair==1)
|
||
{
|
||
cvLeft1=stair1.GetSideCurve2d(0);
|
||
cvRight1=stair1.GetSideCurve2d(1);
|
||
width=stair1.GetStairWidth()*0.5;
|
||
length=stair1.GetStairLength();
|
||
if(m_nStartSide==OFFSET_MID)
|
||
{
|
||
len-=m_nStepWidth*m_nStepNum2;
|
||
}
|
||
}
|
||
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)+m_nStepWidth/3.0 )>length
|
||
||(len-fabs(dLen)-m_nStepWidth/3.0 )<_DIST_SNAP) //剖断线转角过大,不能与梯段两边都相交
|
||
{
|
||
double dist=(len<length-len)?len:length-len;
|
||
dist -= m_nStepWidth/2;
|
||
|
||
if(tan(m_dSectRotation)>_DIST_SNAP)
|
||
{
|
||
dLen=dist;
|
||
}
|
||
else
|
||
{
|
||
dLen=-dist;
|
||
}
|
||
}
|
||
|
||
double nStairHeight1=0,nStairHeight2=0;
|
||
nStairHeight1=GetStepNum1()*GetStepHeight(); //边梯高
|
||
nStairHeight2=GetStepNum2()*GetStepHeight(); //中梯高
|
||
|
||
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 TDbParallelStair::GetSectStairPos()const
|
||
{
|
||
if(m_nStairFlag==SF_TOP)
|
||
return -1;
|
||
|
||
if(abs(m_nSectStepNum)<1|| abs(m_nSectStepNum)>m_nStepNum1+m_nStepNum2)
|
||
{
|
||
return -1;
|
||
}
|
||
|
||
int nSectStepNum=m_nSectStepNum; //剖断步数
|
||
if(nSectStepNum < 0) //负数调整为正的
|
||
{
|
||
nSectStepNum=m_nSectStepNum+m_nStepNum1+m_nStepNum2+1;
|
||
}
|
||
|
||
int nSectStair;
|
||
if((m_nStartSide==OFFSET_MID&&nSectStepNum<=m_nStepNum2)
|
||
||(m_nStartSide!=OFFSET_MID&&nSectStepNum>m_nStepNum1)
|
||
)
|
||
{
|
||
nSectStair=0; //剖断在中梯
|
||
}
|
||
else
|
||
{
|
||
nSectStair=1; //剖断在边梯
|
||
}
|
||
return nSectStair;
|
||
}
|
||
|
||
// 由平面二维点推算剖切步数
|
||
int TDbParallelStair::HitSectPosByPoint2d(XPoint ptHit2d) const
|
||
{
|
||
TDbLineStair stair1, stair2,stair3;
|
||
TDbSlab slab;
|
||
TDbHandRail rail, rail2;
|
||
ExplodeTo(stair1, stair2, stair3, slab, rail, rail2);
|
||
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);
|
||
if(m_nStartSide == OFFSET_MID)
|
||
{
|
||
nPosHit += m_nStepNum2+1;
|
||
}
|
||
else
|
||
{
|
||
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);
|
||
if(m_nStartSide == OFFSET_MID)
|
||
{
|
||
nPosHit += 1;
|
||
}
|
||
else
|
||
{
|
||
nPosHit += m_nStepNum1+1;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
XDirectionCurve cvLeft3=stair3.GetSideCurve2d(0);
|
||
XDirectionCurve cvRight3=stair3.GetSideCurve2d(1);
|
||
|
||
XPoly2D poly3(1);
|
||
poly3.AppendNode(cvLeft3.StartPoint());
|
||
poly3.AppendNode(cvRight3.StartPoint());
|
||
poly3.AppendNode(cvRight3.EndPoint());
|
||
poly3.AppendNode(cvLeft3.EndPoint());
|
||
if((ptHit2d&poly3)!=PR_OUTSIDE)
|
||
{
|
||
XPoint ptPrj;
|
||
cvLeft3.ProjectToMe(ptHit2d, ptPrj);
|
||
nPosHit=(int)(ptPrj.Distance2d(cvLeft3.StartPoint())/m_nStepWidth);
|
||
if(m_nStartSide == OFFSET_MID)
|
||
{
|
||
nPosHit += m_nStepNum2+1;
|
||
}
|
||
else
|
||
{
|
||
nPosHit += 1;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
return nPosHit;
|
||
}
|
||
|
||
|
||
double
|
||
TDbParallelStair::GetTextHeight()const
|
||
{
|
||
assertReadEnabled();
|
||
return m_dTextHeight;
|
||
}
|
||
void
|
||
TDbParallelStair::SetTextHeight(double h)
|
||
{
|
||
assertWriteEnabled();
|
||
m_dTextHeight=h;
|
||
}
|
||
|
||
Adesk::UInt8
|
||
TDbParallelStair::GetStepNum1() const
|
||
{
|
||
assertReadEnabled();
|
||
return m_nStepNum1;
|
||
}
|
||
|
||
Adesk::UInt8
|
||
TDbParallelStair::GetStepNum2() const
|
||
{
|
||
assertReadEnabled();
|
||
return m_nStepNum2;
|
||
}
|
||
|
||
double
|
||
TDbParallelStair::GetStepHeight() const
|
||
{
|
||
assertReadEnabled();
|
||
return m_nStepHeight;
|
||
}
|
||
|
||
|
||
void
|
||
TDbParallelStair::SetStepNum1(Adesk::UInt8 n)
|
||
{
|
||
assertWriteEnabled();
|
||
m_nStepNum1=n;
|
||
}
|
||
|
||
void
|
||
TDbParallelStair::SetStepNum2(Adesk::UInt8 n)
|
||
{
|
||
assertWriteEnabled();
|
||
m_nStepNum2=n;
|
||
}
|
||
|
||
double
|
||
TDbParallelStair::GetSlabSize() const
|
||
{
|
||
assertReadEnabled();
|
||
return m_nSlabSize;
|
||
}
|
||
|
||
double
|
||
TDbParallelStair::GetSlabSizeMid() const
|
||
{
|
||
assertReadEnabled();
|
||
double nSlabSizeMid=m_nSlabSizeMid;
|
||
if(GetAlignment()!=3)
|
||
{
|
||
if(GetAlignment()!=0)
|
||
{
|
||
double nLen1=m_nStepNum1*m_nStepWidth,
|
||
nLen2=m_nStepNum2*m_nStepWidth;
|
||
double dist=nLen1-nLen2;
|
||
if(dist>_DIST_SNAP)
|
||
{
|
||
nSlabSizeMid=GetSlabSize()+dist*(GetAlignment()==1?0.5:1);
|
||
}
|
||
else
|
||
{
|
||
nSlabSizeMid=GetSlabSize();
|
||
}
|
||
}
|
||
else
|
||
{
|
||
nSlabSizeMid=GetSlabSize();
|
||
}
|
||
}
|
||
return nSlabSizeMid;
|
||
}
|
||
|
||
|
||
double
|
||
TDbParallelStair::GetSlabSizeSide() const
|
||
{
|
||
assertReadEnabled();
|
||
double nSlabSizeSide=m_nSlabSizeSide;
|
||
if(GetAlignment()!=3)
|
||
{
|
||
if(GetAlignment()!=0)
|
||
{
|
||
double nLen1=m_nStepNum1*m_nStepWidth,
|
||
nLen2=m_nStepNum2*m_nStepWidth;
|
||
double dist=nLen1-nLen2;
|
||
if(dist>_DIST_SNAP)
|
||
{
|
||
nSlabSizeSide=GetSlabSize();
|
||
}
|
||
else
|
||
{
|
||
nSlabSizeSide=GetSlabSize()-dist*(GetAlignment()==1?0.5:1);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
nSlabSizeSide=GetSlabSize();
|
||
}
|
||
}
|
||
return nSlabSizeSide;
|
||
}
|
||
|
||
double
|
||
TDbParallelStair::GetRailHeight() const
|
||
{
|
||
assertReadEnabled();
|
||
return m_nRailHeight;
|
||
}
|
||
|
||
double
|
||
TDbParallelStair::GetRailWidth() const
|
||
{
|
||
assertReadEnabled();
|
||
return m_nRailWidth;
|
||
}
|
||
|
||
double
|
||
TDbParallelStair::GetRailDistToSide() const
|
||
{
|
||
assertReadEnabled();
|
||
return m_nRailDistToSide;
|
||
}
|
||
|
||
double
|
||
TDbParallelStair::GetRailDistMid() const
|
||
{
|
||
assertReadEnabled();
|
||
return m_nRailDistMid;
|
||
}
|
||
|
||
double
|
||
TDbParallelStair::GetRailDist() const
|
||
{
|
||
assertReadEnabled();
|
||
return m_nRailDist;
|
||
}
|
||
|
||
|
||
double
|
||
TDbParallelStair::GetSpaceWidth() const
|
||
{
|
||
assertReadEnabled();
|
||
return m_nSpaceWidth;
|
||
}
|
||
|
||
double
|
||
TDbParallelStair::GetStairWidth() const
|
||
{
|
||
assertReadEnabled();
|
||
return m_nStairWidth;
|
||
}
|
||
double
|
||
TDbParallelStair::GetMStairWidth() const
|
||
{
|
||
assertReadEnabled();
|
||
return m_nMStairWidth;
|
||
}
|
||
double
|
||
TDbParallelStair::GetStepWidth() const
|
||
{
|
||
assertReadEnabled();
|
||
return m_nStepWidth;
|
||
}
|
||
|
||
Adesk::UInt8
|
||
TDbParallelStair::GetStairFlag() const
|
||
{
|
||
assertReadEnabled();
|
||
return m_nStairFlag;
|
||
}
|
||
|
||
int
|
||
TDbParallelStair::GetSectStepNum()const
|
||
{
|
||
assertReadEnabled();
|
||
return m_nSectStepNum;
|
||
}
|
||
|
||
double
|
||
TDbParallelStair::GetElevation() const
|
||
{
|
||
assertReadEnabled();
|
||
return m_ptLocation.z;
|
||
}
|
||
|
||
XPoint
|
||
TDbParallelStair::GetLocation() const
|
||
{
|
||
assertReadEnabled();
|
||
return m_ptLocation;
|
||
}
|
||
|
||
double
|
||
TDbParallelStair::GetRotation() const
|
||
{
|
||
assertReadEnabled();
|
||
return m_nRotation;
|
||
}
|
||
|
||
int
|
||
TDbParallelStair::GetStartSide() const
|
||
{
|
||
assertReadEnabled();
|
||
return m_nStartSide;
|
||
}
|
||
|
||
int
|
||
TDbParallelStair::GetAlignment() const
|
||
{
|
||
assertReadEnabled();
|
||
return m_nAlignment;
|
||
}
|
||
|
||
|
||
XPoint
|
||
TDbParallelStair::GetUpRight2d() const
|
||
{
|
||
assertReadEnabled();
|
||
XPoint pt=GetUpLeft2d();
|
||
ads_polar(XPoint(pt), m_nRotation, m_nSpaceWidth, pt);
|
||
return pt;
|
||
}
|
||
|
||
XPoint
|
||
TDbParallelStair::GetUpLeft2d() const
|
||
{
|
||
assertReadEnabled();
|
||
XPoint pt=m_ptLocation;
|
||
pt.z=0;
|
||
return pt;
|
||
}
|
||
|
||
void
|
||
TDbParallelStair::SetSlabSize(double s)
|
||
{
|
||
assertWriteEnabled();
|
||
m_nSlabSize=s;
|
||
}
|
||
|
||
void
|
||
TDbParallelStair::SetSlabSizeSide(double s)
|
||
{
|
||
assertWriteEnabled();
|
||
m_nSlabSizeSide=s;
|
||
}
|
||
void
|
||
TDbParallelStair::SetSlabSizeMid(double s)
|
||
{
|
||
assertWriteEnabled();
|
||
m_nSlabSizeMid=s;
|
||
}
|
||
|
||
void
|
||
TDbParallelStair::SetRailHeight(double l)
|
||
{
|
||
assertWriteEnabled();
|
||
m_nRailHeight=l;
|
||
}
|
||
|
||
void
|
||
TDbParallelStair::SetRailWidth(double w)
|
||
{
|
||
assertWriteEnabled();
|
||
m_nRailWidth=w;
|
||
}
|
||
|
||
|
||
void
|
||
TDbParallelStair::SetRailDistToSide(double l)
|
||
{
|
||
assertWriteEnabled();
|
||
m_nRailDistToSide=l;
|
||
}
|
||
void
|
||
TDbParallelStair::SetRailDistMid(double l)
|
||
{
|
||
assertWriteEnabled();
|
||
m_nRailDistMid=l;
|
||
}
|
||
|
||
|
||
void
|
||
TDbParallelStair::SetRailDist(double l)
|
||
{
|
||
assertWriteEnabled();
|
||
m_nRailDist=l;
|
||
}
|
||
|
||
void
|
||
TDbParallelStair::SetStairFlag(Adesk::UInt8 flag)
|
||
{
|
||
assertWriteEnabled();
|
||
m_nStairFlag=flag;
|
||
}
|
||
|
||
void
|
||
TDbParallelStair::SetSpaceWidth(double w)
|
||
{
|
||
assertWriteEnabled();
|
||
m_nSpaceWidth=w;
|
||
}
|
||
void
|
||
TDbParallelStair::SetStepWidth(double w)
|
||
{
|
||
assertWriteEnabled();
|
||
m_nStepWidth=w;
|
||
}
|
||
void
|
||
TDbParallelStair::SetStairWidth(double w)
|
||
{
|
||
assertWriteEnabled();
|
||
m_nStairWidth=w;
|
||
}
|
||
|
||
void
|
||
TDbParallelStair::SetMStairWidth(double w)
|
||
{
|
||
assertWriteEnabled();
|
||
m_nMStairWidth=w;
|
||
}
|
||
|
||
void
|
||
TDbParallelStair::SetElevation(double elev)
|
||
{
|
||
assertWriteEnabled();
|
||
m_ptLocation.z = elev;
|
||
}
|
||
|
||
void
|
||
TDbParallelStair::SetLocation(const XPoint &pt)
|
||
{
|
||
assertWriteEnabled();
|
||
m_ptLocation = pt;
|
||
}
|
||
|
||
void
|
||
TDbParallelStair::SetRotation(double rot)
|
||
{
|
||
assertWriteEnabled();
|
||
m_nRotation=rot;
|
||
}
|
||
|
||
void
|
||
TDbParallelStair::SetStartSide(int nSide)
|
||
{
|
||
assertWriteEnabled();
|
||
m_nStartSide=nSide;
|
||
}
|
||
|
||
void
|
||
TDbParallelStair::SetAlignment(int nSide)
|
||
{
|
||
assertWriteEnabled();
|
||
m_nAlignment=nSide;
|
||
}
|
||
|
||
void
|
||
TDbParallelStair::SetStepHeight(double h)
|
||
{
|
||
assertWriteEnabled();
|
||
m_nStepHeight=h;
|
||
}
|
||
void TDbParallelStair::SetArrow(BOOL bTrue)
|
||
{
|
||
assertWriteEnabled();
|
||
if(bTrue)
|
||
m_nFlagEx|=SFEX_ARROW;
|
||
else
|
||
m_nFlagEx&=~SFEX_ARROW;
|
||
}
|
||
BOOL TDbParallelStair::IsArrow() const
|
||
{
|
||
return ((m_nFlagEx&SFEX_ARROW)!=0);
|
||
}
|
||
BOOL TDbParallelStair::IsAutoOutRail() const
|
||
{
|
||
return ((m_nFlagEx&SFEX_AUTOOUTRAIL)!=0);
|
||
}
|
||
// TArch6 memeber
|
||
BOOL TDbParallelStair::IsAutoRail() const
|
||
{
|
||
return ((m_nFlagEx&SFEX_AUTORAIL)!=0);
|
||
}
|
||
|
||
BOOL TDbParallelStair::IsOutRail()const
|
||
{
|
||
return (m_nFlagEx&SFEX_OUTRAIL)!=0;
|
||
}
|
||
void TDbParallelStair::SetOutRail(BOOL bTrue)
|
||
{
|
||
assertWriteEnabled();
|
||
if(bTrue)
|
||
m_nFlagEx|=SFEX_OUTRAIL;
|
||
else
|
||
m_nFlagEx&=~SFEX_OUTRAIL;
|
||
}
|
||
BOOL TDbParallelStair::IsArcPlatform() const
|
||
{
|
||
return ((m_nFlagEx&SFEX_ARCPLAT)!=0);
|
||
}
|
||
|
||
BOOL TDbParallelStair::HasSideBeam(int nSide) const
|
||
{
|
||
int nBitFlag=nSide? SFEX_RBEAM : SFEX_LBEAM;
|
||
return ((m_nFlagEx&nBitFlag)!=0);
|
||
}
|
||
|
||
BOOL TDbParallelStair::IsAscent() const
|
||
{
|
||
return ((m_nFlagEx&SFEX_ASCENT)!=0);
|
||
}
|
||
|
||
BOOL TDbParallelStair::IsOnGround() const
|
||
{
|
||
return ((m_nFlagEx&SFEX_GROUND)!=0);
|
||
}
|
||
|
||
BOOL TDbParallelStair::HasSlant() const
|
||
{
|
||
return ((m_nFlagEx&SFEX_SLANT)!=0);
|
||
}
|
||
void TDbParallelStair::SetAutoOutRail(BOOL bTrue)
|
||
{
|
||
assertWriteEnabled();
|
||
if(bTrue)
|
||
m_nFlagEx |= SFEX_AUTOOUTRAIL;
|
||
else
|
||
m_nFlagEx &= ~SFEX_AUTOOUTRAIL;
|
||
}
|
||
void TDbParallelStair::SetAutoRail(BOOL bTrue)
|
||
{
|
||
assertWriteEnabled();
|
||
if(bTrue)
|
||
m_nFlagEx |= SFEX_AUTORAIL;
|
||
else
|
||
m_nFlagEx &= ~SFEX_AUTORAIL;
|
||
}
|
||
|
||
void TDbParallelStair::SetAscent(BOOL bTrue)
|
||
{
|
||
assertWriteEnabled();
|
||
if(bTrue)
|
||
m_nFlagEx |= SFEX_ASCENT;
|
||
else
|
||
m_nFlagEx &= ~SFEX_ASCENT;
|
||
}
|
||
|
||
void TDbParallelStair::SetOnGround(BOOL bTrue)
|
||
{
|
||
assertWriteEnabled();
|
||
if(bTrue)
|
||
m_nFlagEx |= SFEX_GROUND;
|
||
else
|
||
m_nFlagEx &= ~SFEX_GROUND;
|
||
}
|
||
|
||
void TDbParallelStair::SetSlant(BOOL bTrue)
|
||
{
|
||
assertWriteEnabled();
|
||
if(bTrue)
|
||
m_nFlagEx |= SFEX_SLANT;
|
||
else
|
||
m_nFlagEx &= ~SFEX_SLANT;
|
||
}
|
||
|
||
void TDbParallelStair::SetArcPlatform(BOOL bTrue)
|
||
{
|
||
assertWriteEnabled();
|
||
if(bTrue)
|
||
m_nFlagEx |= SFEX_ARCPLAT;
|
||
else
|
||
m_nFlagEx &= ~SFEX_ARCPLAT;
|
||
}
|
||
|
||
void TDbParallelStair::SetSideBeam(int nSide, BOOL bTrue)
|
||
{
|
||
assertWriteEnabled();
|
||
int nBitFlag=nSide? SFEX_RBEAM : SFEX_LBEAM;
|
||
if(bTrue)
|
||
m_nFlagEx |= nBitFlag;
|
||
else
|
||
m_nFlagEx &= ~nBitFlag;
|
||
}
|
||
|
||
|
||
double TDbParallelStair::GetBeamHeight() const
|
||
{
|
||
return m_nBeamHeight;
|
||
}
|
||
|
||
double TDbParallelStair::GetBeamThick() const
|
||
{
|
||
return m_nBeamThick;
|
||
}
|
||
|
||
double TDbParallelStair::GetSlabThick() const
|
||
{
|
||
return m_nSlabThick;
|
||
}
|
||
|
||
AcDbObjectId TDbParallelStair::GetLayerBeam3d() const
|
||
{
|
||
return m_idLayerBeam3d;
|
||
}
|
||
|
||
AcDbObjectId TDbParallelStair::GetLayerStep3d() const
|
||
{
|
||
return m_idLayerStep3d;
|
||
}
|
||
|
||
AcDbObjectId TDbParallelStair::GetLayerHand3d() const
|
||
{
|
||
return m_idLayerHand3d;
|
||
}
|
||
|
||
AcDbObjectId TDbParallelStair::GetLayerRail3d() const
|
||
{
|
||
return m_idLayerRail3d;
|
||
}
|
||
AcDbObjectId TDbParallelStair::GetLayerText() const
|
||
{
|
||
return m_idLayerText;
|
||
}
|
||
AcDbObjectId TDbParallelStair::GetTextStyle() const
|
||
{
|
||
return m_idTextStyle;
|
||
}
|
||
AcDbObjectId TDbParallelStair::GetLayerArrow() const
|
||
{
|
||
return m_idLayerArrow;
|
||
}
|
||
void TDbParallelStair::SetBeamHeight(double val)
|
||
{
|
||
assertWriteEnabled();
|
||
m_nBeamHeight = val;
|
||
}
|
||
|
||
void TDbParallelStair::SetSlabThick(double val)
|
||
{
|
||
assertWriteEnabled();
|
||
m_nSlabThick=val;
|
||
}
|
||
|
||
void TDbParallelStair::SetBeamThick(double val)
|
||
{
|
||
assertWriteEnabled();
|
||
m_nBeamThick=val;
|
||
}
|
||
|
||
void TDbParallelStair::SetLayerBeam3d(AcDbObjectId idLayer)
|
||
{
|
||
assertWriteEnabled();
|
||
m_idLayerBeam3d=idLayer;
|
||
}
|
||
|
||
void TDbParallelStair::SetLayerStep3d(AcDbObjectId idLayer)
|
||
{
|
||
assertWriteEnabled();
|
||
m_idLayerStep3d=idLayer;
|
||
}
|
||
|
||
|
||
void TDbParallelStair::SetLayerHand3d(AcDbObjectId idLayer)
|
||
{
|
||
assertWriteEnabled();
|
||
m_idLayerHand3d=idLayer;
|
||
}
|
||
|
||
void TDbParallelStair::SetLayerRail3d(AcDbObjectId idLayer)
|
||
{
|
||
assertWriteEnabled();
|
||
m_idLayerRail3d=idLayer;
|
||
}
|
||
void TDbParallelStair::SetLayerText(AcDbObjectId idLayer)
|
||
{
|
||
assertWriteEnabled();
|
||
m_idLayerText=idLayer;
|
||
}
|
||
void TDbParallelStair::SetTextStyle(AcDbObjectId idStyle)
|
||
{
|
||
assertWriteEnabled();
|
||
m_idTextStyle=idStyle;
|
||
}
|
||
void TDbParallelStair::SetLayerArrow(AcDbObjectId idLayer)
|
||
{
|
||
assertWriteEnabled();
|
||
m_idLayerArrow=idLayer;
|
||
}
|
||
|
||
void TDbParallelStair::SetSectStepNum(int n)
|
||
{
|
||
assertWriteEnabled();
|
||
m_nSectStepNum=n;
|
||
}
|
||
|
||
double TDbParallelStair::GetSectRotation()const
|
||
{
|
||
return m_dSectRotation;
|
||
}
|
||
|
||
void TDbParallelStair::SetSectRotation(double r)
|
||
{
|
||
assertWriteEnabled();
|
||
m_dSectRotation=r;
|
||
}
|
||
|
||
//add by xlc 090426,箭头文字,动态数据
|
||
CString TDbParallelStair::GetTextUp() const
|
||
{
|
||
assertReadEnabled();
|
||
CString sVal(_T("上"));
|
||
const TEntityFields &fd = GetFields();
|
||
fd.GFD(_T("上楼箭头文字"), sVal);
|
||
return sVal;
|
||
}
|
||
|
||
void TDbParallelStair::SetTextUp(const TCHAR *sVal)
|
||
{
|
||
assertWriteEnabled();
|
||
TEntityFields &fd = Fields();
|
||
fd.SFD(_T("上楼箭头文字"), sVal);
|
||
}
|
||
CString TDbParallelStair::GetTextDown() const
|
||
{
|
||
assertReadEnabled();
|
||
CString sVal(_T("下"));
|
||
const TEntityFields &fd = GetFields();
|
||
fd.GFD(_T("下楼箭头文字"), sVal);
|
||
return sVal;
|
||
}
|
||
|
||
void TDbParallelStair::SetTextDown(const TCHAR *sVal)
|
||
{
|
||
assertWriteEnabled();
|
||
TEntityFields &fd = Fields();
|
||
fd.SFD(_T("下楼箭头文字"), sVal);
|
||
}
|
||
|
||
// sg add 100722,支持统一标高
|
||
bool TDbParallelStair::UnifyElevation(double dElevation)
|
||
{
|
||
SetElevation(dElevation);
|
||
return true;
|
||
}
|
||
|
||
// cet 2013.9.5 add
|
||
CString TDbParallelStair::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;
|
||
}
|
||
|
||
/////////////////////////////////////////////////////////////////////////////
|
||
|
||
void InitDbParallelStair(BOOL bTrue)
|
||
{
|
||
if(bTrue)
|
||
{
|
||
TDbParallelStair::rxInit();
|
||
acrxBuildClassHierarchy();
|
||
TDbParallelStair::InitMatchProtocol(TRUE);
|
||
}
|
||
else
|
||
{
|
||
TDbParallelStair::InitMatchProtocol(FALSE);
|
||
|
||
deleteAcRxClass(TDbParallelStair::desc());
|
||
}
|
||
} |