Files
envi-code/SourceCode/Code2026/tg_shs/shs_kernal/dbDoubleMulStair.cpp
T
2026-09-28 15:28:50 +08:00

4574 lines
122 KiB
C++

#include "stdafx.h"
#include "TDbColumn.h"
////////////////////////////////////////////////////////////////////////////
// ver: 0-TArch8
const Adesk::UInt8 TDbDoubleMulStair::g_nVersion = 0;
ACRX_DXF_DEFINE_MEMBERS(ATSDoubleMulStair, ATSPolyPathEnt, AcDb::kDHL_CURRENT, AcDb::kMReleaseCurrent,
1, ATS_DOUBLEMULSTAIR, "ATS_DOUBLEMULSTAIR图形无法解析, 请下载上华软件|网址: www.shanghuasoft.com");
IMPLEMENT_TENTBASE(TDbDoubleMulStair);
TDbDoubleMulStair::TDbDoubleMulStair()
{
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_nStairWidth2=_AS_SYS_UNIT(1200); //二跑梯段宽
m_nSlabSize=_AS_SYS_UNIT(1200); //休息平台尺寸
m_nSlabWidth=_AS_SYS_UNIT(1200); //边休息平台宽
m_nSlabWidthM=_AS_SYS_UNIT(1300); //中休息平台宽
m_nRotation=0.0; //旋转角度
m_nStepNum1=m_nStepNum2=m_nStepNum3=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_nRailDist=m_nStepWidth*0.5; //中梯扶手伸出距离
m_nRailDistSide=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;
}
TDbDoubleMulStair::~TDbDoubleMulStair()
{
}
BOOL TDbDoubleMulStair::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_nStairWidth2>_DIST_SNAP && //二跑梯段宽
m_nSlabWidth>m_nStairWidth-_DIST_SNAP && //边休息平台宽
m_nSlabWidthM>m_nMStairWidth-_DIST_SNAP*2 && //中休息平台宽
m_nSlabSize>m_nStairWidth2-_DIST_SNAP && //休息平台尺寸
m_nSlabSizeM>m_nStairWidth2-_DIST_SNAP && //休息平台尺寸
m_nStepNum1>1 && //边梯步数
m_nStepNum2>1 && //中梯步数
m_nStepNum3>1 && //二跑步数
m_dTextHeight>0&& //字高
m_nRailHeight>_DIST_SNAP && //扶手高
m_nRailWidth>_DIST_SNAP && //扶手宽
m_nRailDistToSide>-(m_nSlabWidth-m_nStairWidth+m_nSlabWidthM*0.5-m_nMStairWidth*0.5+m_nStepWidth*(m_nStepNum3-1))*0.5 && //扶手距边
GreatEqual(m_nBeamHeight, 0.0) &&//边梁高
GreatEqual(m_nBeamThick, 0.0) &&//边梁厚
GreatEqual(m_nSlabThick, 0.0) &&//休息台厚
m_nStairWidth>m_nRailWidth+m_nRailDistToSide); //扶手高度
return bRet;
}
// 提供对格式刷的支持
void TDbDoubleMulStair::CopyPropertiesFrom(AcDbEntity *pSrcEntity, unsigned gMatchFlag)
{
assertWriteEnabled();
TDbPolyPathEnt::CopyPropertiesFrom(pSrcEntity, gMatchFlag);
TDbDoubleMulStair *pSrc=TDbDoubleMulStair::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_nStairWidth2=pSrc->m_nStairWidth2;
m_nSlabSize=pSrc->m_nSlabSize;
m_nSlabSizeM=pSrc->m_nSlabSizeM;
m_nStepNum1=pSrc->m_nStepNum1;
m_nStepNum2=pSrc->m_nStepNum2;
m_nStepNum3=pSrc->m_nStepNum3;
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_nRailDist=pSrc->m_nRailDist;
m_nRailDistSide=pSrc->m_nRailDistSide;
m_dSectRotation=pSrc->m_dSectRotation;
m_nSectStepNum=pSrc->m_nSectStepNum;
m_nStartSide=pSrc->m_nStartSide;
m_nSlabWidth=pSrc->m_nSlabWidth;
m_nSlabWidthM=pSrc->m_nSlabWidthM;
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
TDbDoubleMulStair::subGetClassID(CLSID* pClsid) const
{
return Acad::eOk;
}
// 从DWG读入数据:
Acad::ErrorStatus
TDbDoubleMulStair::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_nStairWidth2); //二跑梯段宽
pFiler->readItem(&m_nSlabSize); //边休息平台尺寸
pFiler->readItem(&m_nSlabSizeM); //中休息平台尺寸
pFiler->readItem(&m_nStepNum1); //边梯步数
pFiler->readItem(&m_nStepNum2); //中梯步数
pFiler->readItem(&m_nStepNum3); //二跑步数
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_nRailDist); //中梯扶手伸出距离
pFiler->readItem(&m_nRailDistSide); //边梯梯扶手伸出距离
pFiler->readItem(&m_nSectStepNum); //剖断步数
pFiler->readItem(&m_dSectRotation); //剖断转角
pFiler->readItem(&m_nSlabWidth); //边休息台宽
pFiler->readItem(&m_nSlabWidthM); //中休息台宽
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
TDbDoubleMulStair::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_nStairWidth2); //二跑梯段宽
pFiler->writeItem(m_nSlabSize); //边休息平台尺寸
pFiler->writeItem(m_nSlabSizeM); //中休息平台尺寸
pFiler->writeItem(m_nStepNum1); //边梯步数
pFiler->writeItem(m_nStepNum2); //中梯步数
pFiler->writeItem(m_nStepNum3); //二跑步数
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); //扶手距离边
pFiler->writeItem(m_nRailDist); //中梯扶手伸出距离
pFiler->writeItem(m_nRailDistSide); //边梯梯扶手伸出距离
pFiler->writeItem(m_nSectStepNum); //剖断步数
pFiler->writeItem(m_dSectRotation); //剖断转角
pFiler->writeItem(m_nSlabWidth); //边休息台宽
pFiler->writeItem(m_nSlabWidthM); //中休息台宽
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
TDbDoubleMulStair::dxfInFields (AcDbDxfFiler* pFiler)
{
assertWriteEnabled();
Acad::ErrorStatus es = TDbPolyPathEnt::dxfInFields(pFiler);
if(es!=Acad::eOk)
return es;
if (!pFiler->atSubclassData(_T("TDbDoubleMulStair"))) {
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_nSlabWidth=rb.resval.rreal;
break;
case AcDb::kDxfReal+12:
m_nSlabWidthM=rb.resval.rreal;
break;
case AcDb::kDxfReal+11:
m_nRailDist=rb.resval.rreal;
break;
case AcDb::kDxfReal+13:
m_nStairWidth2=rb.resval.rreal;
break;
case AcDb::kDxfReal+14:
m_dTextHeight=rb.resval.rreal;
break;
case AcDb::kDxfReal+15:
m_nSlabSizeM=rb.resval.rreal;
break;
case AcDb::kDxfReal+16:
m_nRailDistSide=rb.resval.rreal;
break;
case AcDb::kDxfReal+17:
m_dSectRotation=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 77:
m_nStepNum3=(Adesk::UInt8)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
TDbDoubleMulStair::dxfOutFields(AcDbDxfFiler* pFiler) const
{
assertReadEnabled();
Acad::ErrorStatus es;
es = TDbPolyPathEnt::dxfOutFields(pFiler);
assert(es == Acad::eOk);
es = pFiler->writeItem(AcDb::kDxfSubclass,_T("TDbDoubleMulStair"));
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, GetSlabWidthM());
pFiler->writeDouble(AcDb::kDxfReal+12, GetSlabWidth());
pFiler->writeDouble(AcDb::kDxfReal+11, GetRailDist());
pFiler->writeDouble(AcDb::kDxfReal+13, GetStairWidth2());
pFiler->writeDouble(AcDb::kDxfReal+14, GetTextHeight());
pFiler->writeDouble(AcDb::kDxfReal+15, GetSlabSizeM());
pFiler->writeDouble(AcDb::kDxfReal+16, GetRailDistSide());
pFiler->writeDouble(AcDb::kDxfReal+17, GetSectRotation());
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->writeInt16(AcDb::kDxfInt16+7, m_nStepNum3);
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
TDbDoubleMulStair::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;
ads_polar(ptUpLeft, m_nRotation-PI/2.0, 0.5*m_nStairWidth2, ptLeft);
ads_polar(ptUpRight, m_nRotation-PI/2.0, 0.5*m_nStairWidth2, ptRight);
gripPoints.append(ptLeft);
gripPoints.append(ptRight);
//4,5--中休息台宽
ads_polar(GetUpMid2d(), m_nRotation-PI/2.0, 0.5*m_nStairWidth2, ptLeft);
ads_polar(ptLeft, m_nRotation+PI, 0.5*m_nSlabWidthM, ptLeft);
ads_polar(ptLeft, m_nRotation, m_nSlabWidthM, ptRight);
gripPoints.append(ptLeft);
gripPoints.append(ptRight);
// 6,7--楼梯边梯宽度
double nDist=GetSlabSize()+(m_nStepNum1>m_nStepNum2?m_nStepNum1:m_nStepNum2-1)*m_nStepWidth/2.0;
ads_polar(ptUpLeft, m_nRotation-PI*0.5, nDist, ptLeft);
ads_polar(ptLeft, m_nRotation, m_nStairWidth, ptLeft);
ads_polar(ptUpRight, m_nRotation-PI*0.5, nDist, ptRight);
ads_polar(ptRight, m_nRotation+PI, m_nStairWidth, ptRight);
gripPoints.append(ptLeft);
gripPoints.append(ptRight);
//8,9--楼梯二跑梯段宽度
XPoint ptLeft1, ptRight1;
nDist=m_nSlabWidth+0.5*(m_nStepNum3-1)*m_nStepWidth;
ads_polar(ptUpLeft, m_nRotation-PI*0.5, m_nStairWidth2, ptLeft1);
ads_polar(ptLeft1, m_nRotation, nDist, ptLeft1);
ads_polar(ptUpRight, m_nRotation-PI*0.5, m_nStairWidth2, ptRight1);
ads_polar(ptRight1, m_nRotation+PI, nDist, ptRight1);
gripPoints.append(ptLeft1);
gripPoints.append(ptRight1);
double dStairWidth=0.0; //井宽
dStairWidth = (m_nStepNum3-1)*m_nStepWidth+m_nSlabWidth-m_nStairWidth+(m_nSlabWidthM - m_nMStairWidth)/2.0;
// 10,11--楼梯中梯宽度
nDist=GetSlabSize()+(m_nStepNum1>m_nStepNum2?m_nStepNum1:m_nStepNum2-1)*m_nStepWidth/2.0;
ads_polar(GetUpMid2d(), m_nRotation-PI/2.0, nDist, ptLeft);
ads_polar(ptLeft, m_nRotation+PI, 0.5*m_nMStairWidth, ptLeft);
ads_polar(ptLeft, m_nRotation, m_nMStairWidth, ptRight);
gripPoints.append(ptLeft);
gripPoints.append(ptRight);
// 12,13--边休息平台尺寸
XPoint ptSlabLeft, ptSlabRight;
ads_polar(ptUpLeft, m_nRotation-PI/2.0, GetSlabSize(), ptSlabLeft);
ads_polar(ptUpRight, m_nRotation-PI/2.0, GetSlabSize(), ptSlabRight);
gripPoints.append(ptSlabLeft);
gripPoints.append(ptSlabRight);
// 14--中休息台尺寸
Midpoint(ptUpLeft,ptUpRight,ptSlabLeft);
ads_polar(ptSlabLeft, m_nRotation-PI/2.0, GetSlabSizeM(), ptSlabLeft);
gripPoints.append(ptSlabLeft);
{
double nDistToSide=m_nRailDistToSide+m_nRailWidth/2;
XPoint ptTmp;
double dLen=((m_nStepNum1>m_nStepNum2)?(m_nStepNum1-1):(m_nStepNum2-1))*m_nStepWidth;
// 15,16--中梯扶手伸出距离
ads_polar(ptSlabLeft, m_nRotation-PI/2, m_nRailDist+(m_nStepNum2-1)*m_nStepWidth, ptTmp);
ads_polar(ptTmp, m_nRotation+PI, m_nMStairWidth*0.5-nDistToSide, ptTmp);
gripPoints.append(ptTmp);
ads_polar(ptTmp, m_nRotation, m_nMStairWidth-nDistToSide*2, ptTmp);
gripPoints.append(ptTmp);
// 17,18--边梯扶手伸出距离
ads_polar(ptUpLeft, m_nRotation-PI/2, GetSlabSize()+m_nRailDistSide+(m_nStepNum1-1)*m_nStepWidth, ptTmp);
ads_polar(ptTmp, m_nRotation, m_nStairWidth-nDistToSide, ptTmp);
gripPoints.append(ptTmp);
ads_polar(ptUpRight, m_nRotation-PI/2, GetSlabSize()+m_nRailDistSide+(m_nStepNum1-1)*m_nStepWidth, ptTmp);
ads_polar(ptTmp, m_nRotation+PI, m_nStairWidth-nDistToSide, ptTmp);
gripPoints.append(ptTmp);
}
{ //19,20--调整二跑梯段位置
ads_polar(ptUpLeft, m_nRotation-PI/2.0, 0.5*m_nStairWidth2, ptLeft);
ads_polar(ptLeft, m_nRotation, m_nSlabWidth, ptLeft);
ads_polar(ptUpRight, m_nRotation-PI/2.0, 0.5*m_nStairWidth2, ptRight);
ads_polar(ptRight, m_nRotation-PI, m_nSlabWidth, ptRight);
gripPoints.append(ptLeft);
gripPoints.append(ptRight);
}
{ //剖切线
XPoint ptLeft, ptRight;
double lSectPos,rSectPos;
if(CalSectPos(lSectPos,rSectPos,ptLeft,ptRight,ptLeft1, ptRight1))
{
XPoint ptMid;
Midpoint(ptLeft,ptRight,ptMid);
gripPoints.append(ptMid);
gripPoints.append(ptLeft);
gripPoints.append(ptRight);
int nSectStair=GetSectStairPos();
if(nSectStair==1)//边梯有两段剖切线
{
gripPoints.append(ptLeft1);
gripPoints.append(ptRight1);
Midpoint(ptLeft1,ptRight1,ptMid);
gripPoints.append(ptMid);
}
else if(nSectStair==2)//二跑有两段剖切线
{
gripPoints.append(ptRight1);
gripPoints.append(ptLeft1);
Midpoint(ptLeft1,ptRight1,ptMid);
gripPoints.append(ptMid);
}
}
}
return Acad::eOk;
}
Acad::ErrorStatus
TDbDoubleMulStair::subGetStretchPoints(AcGePoint3dArray & stretchPoints) const
{
assertReadEnabled();
XPoint ptUpLeft=GetUpLeft2d();
stretchPoints.append(ptUpLeft);
return Acad::eOk;
}
Acad::ErrorStatus
TDbDoubleMulStair::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:
case 9:
cs=_T("改二跑梯段宽度");
break;
case 10:
case 11:
cs=_T("改中梯段宽度");
break;
case 12:
case 13:
cs=_T("改边平台长");
break;
case 14:
cs=_T("改中平台长");
break;
case 15:
case 16:
cs=_T("改中梯扶手伸出距离");
break;
case 17:
case 18:
cs=_T("改边梯扶手伸出距离");
break;
case 19:
case 20:
cs=_T("改二跑梯段位置");
break;
case 21:
case 26:
cs=_T("移动剖切位置");
break;
case 22:
case 23:
case 24:
case 25:
cs=_T("移动剖切角度");
break;
default:
break;
}
return Acad::eOk;
}
Acad::ErrorStatus
TDbDoubleMulStair::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
TDbDoubleMulStair::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_nSlabWidth-nIncWidth*0.5 > m_nStairWidth+_DIST_SNAP)
{
m_nSlabWidth -= nIncWidth*0.5;
ads_polar(m_ptLocation, m_nRotation, nIncWidth, m_ptLocation);
}
else
{
ads_polar(m_ptLocation, m_nRotation, (m_nSlabWidth-m_nStairWidth)*2, m_ptLocation);
m_nSlabWidth = m_nStairWidth;
}
break;
case 3: //改边休息台宽度
if(m_nSlabWidth+nIncWidth*0.5 > m_nStairWidth+_DIST_SNAP)
{
m_nSlabWidth += nIncWidth*0.5;
}
else
{
m_nSlabWidth = m_nStairWidth;
}
break;
case 4: //改中休息台宽度
if(m_nSlabWidthM-nIncWidth*2 > m_nMStairWidth+_DIST_SNAP*2)
{
m_nSlabWidthM -= nIncWidth*2;
ads_polar(m_ptLocation, m_nRotation, nIncWidth*2, m_ptLocation);
}
else
{
ads_polar(m_ptLocation, m_nRotation, m_nSlabWidthM-m_nMStairWidth, m_ptLocation);
m_nSlabWidthM = m_nMStairWidth;
}
break;
case 5: //改中休息台宽度
if(m_nSlabWidthM+nIncWidth*2 > m_nMStairWidth+_DIST_SNAP*2)
{
m_nSlabWidthM += nIncWidth*2;
}
else
{
m_nSlabWidthM = m_nMStairWidth;
}
break;
case 6: //改边梯段宽度
if(m_nStairWidth+nIncWidth > _DIST_SNAP && m_nStairWidth+nIncWidth < m_nSlabWidth-_DIST_SNAP)
{
m_nStairWidth += nIncWidth;
}
else
{
m_nStairWidth = m_nSlabWidth;
}
break;
case 7: //改边梯段宽度
if(m_nStairWidth-nIncWidth > _DIST_SNAP && m_nStairWidth-nIncWidth < m_nSlabWidth-_DIST_SNAP)
{
m_nStairWidth -= nIncWidth;
}
else
{
m_nStairWidth = m_nSlabWidth;
}
break;
case 8:
case 9: //改二跑梯段宽度
{
double nSlabSize=m_nSlabSize<m_nSlabSizeM?m_nSlabSize:m_nSlabSizeM;
if(m_nStairWidth2-nIncLen > _DIST_SNAP && m_nStairWidth2-nIncLen < nSlabSize-_DIST_SNAP)
{
m_nStairWidth2 -= nIncLen;
}
else
{
m_nStairWidth2 = nSlabSize;
}
}
break;
case 10: //改中梯段宽度
if(m_nMStairWidth-2*nIncWidth > _DIST_SNAP && m_nMStairWidth-nIncWidth*2<m_nSlabWidthM-_DIST_SNAP*2)
{
m_nMStairWidth -= (2*nIncWidth);
}
else
{
m_nMStairWidth = m_nSlabWidthM;
}
break;
case 11: //改中梯段宽度
if(m_nMStairWidth+2*nIncWidth > _DIST_SNAP && m_nMStairWidth+nIncWidth*2<m_nSlabWidthM-_DIST_SNAP*2)
m_nMStairWidth += (2*nIncWidth);
else
{
m_nMStairWidth = m_nSlabWidthM;
}
break;
case 12:
case 13: //改边休息平台尺寸
if(m_nSlabSize-nIncLen>m_nStairWidth2+_DIST_SNAP)
m_nSlabSize -= nIncLen;
else
m_nSlabSize = m_nStairWidth2;
break;
case 14: //改中休息平台尺寸
if(m_nSlabSizeM-nIncLen>m_nStairWidth2+_DIST_SNAP)
m_nSlabSizeM -= nIncLen;
else
m_nSlabSizeM = m_nStairWidth2;
break;
case 15:
case 16: //中梯扶手伸出距离
if(m_nRailDist-nIncLen>-(m_nStepNum2-1)*m_nStepWidth-_DIST_SNAP)
m_nRailDist -= nIncLen;
break;
case 17:
case 18: //边梯扶手伸出距离
if(m_nRailDistSide-nIncLen>-(m_nStepNum1-1)*m_nStepWidth-_DIST_SNAP)
m_nRailDistSide -= nIncLen;
break;
case 19: //调整二跑梯段位置
if(m_nSlabWidth+nIncWidth>m_nStairWidth+_DIST_SNAP && m_nSlabWidthM-nIncWidth*2>m_nMStairWidth+_DIST_SNAP*2)
{
m_nSlabWidth += nIncWidth;
m_nSlabWidthM -= nIncWidth*2;
}
else if(m_nSlabWidth+nIncWidth>m_nStairWidth+_DIST_SNAP && m_nSlabWidthM-nIncWidth*2<m_nMStairWidth+_DIST_SNAP*2)
{
m_nSlabWidth += (m_nSlabWidthM-m_nMStairWidth)*0.5;
m_nSlabWidthM =m_nMStairWidth;
}
else if(m_nSlabWidth+nIncWidth<m_nStairWidth+_DIST_SNAP && m_nSlabWidthM-nIncWidth*2>m_nMStairWidth+_DIST_SNAP*2)
{
m_nSlabWidthM += (m_nSlabWidth-m_nStairWidth)*2;
m_nSlabWidth = m_nStairWidth;
}
break;
case 20: //调整二跑梯段位置
if(m_nSlabWidth-nIncWidth>m_nStairWidth+_DIST_SNAP && m_nSlabWidthM+nIncWidth*2>m_nMStairWidth+_DIST_SNAP*2)
{
m_nSlabWidth -= nIncWidth;
m_nSlabWidthM += nIncWidth*2;
}
else if(m_nSlabWidth-nIncWidth>m_nStairWidth+_DIST_SNAP && m_nSlabWidthM+nIncWidth*2<m_nMStairWidth+_DIST_SNAP*2)
{
m_nSlabWidth += (m_nSlabWidthM-m_nMStairWidth)*0.5;
m_nSlabWidthM =m_nMStairWidth;
}
else if(m_nSlabWidth-nIncWidth<m_nStairWidth+_DIST_SNAP && m_nSlabWidthM+nIncWidth*2>m_nMStairWidth+_DIST_SNAP*2)
{
m_nSlabWidthM += (m_nSlabWidth-m_nStairWidth)*2;
m_nSlabWidth = m_nStairWidth;
}
break;
case 21:
case 22:
case 23:
case 24:
case 25:
case 26: //剖切位置
{
double lSectPos,rSectPos;
XPoint ptLeft2d,ptRight2d,ptLeft2, ptRight2;
double angle=m_dSectRotation;
if(CalSectPos(lSectPos,rSectPos,ptLeft2d,ptRight2d,ptLeft2, ptRight2))
{
XPoint ptMid;
Midpoint(ptLeft2d,ptRight2d,ptMid);
if(idx==21||idx==26)
{
XPoint ptHit2d;
if(idx==21)
ptHit2d=ptMid;
else
Midpoint(ptLeft2, ptRight2, ptHit2d);
ptHit2d += vtOffset;
int nPosHit=HitSectPosByPoint2d(ptHit2d);
if(nPosHit!=-1)
{
m_nSectStepNum = nPosHit;
}
}
else
{
XPoint ptTmp;
int nSectStair=GetSectStairPos();
if(nSectStair==2)
{
ads_polar(ptMid, m_nRotation+PI*0.5, m_nMStairWidth, ptTmp);
}
else
{
ads_polar(ptMid, m_nRotation, m_nMStairWidth, ptTmp);
}
AcGeVector3d vectFrom,vectTo;
vectFrom=ptMid-ptTmp;
if((idx-22)%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
TDbDoubleMulStair::subMoveStretchPointsAt(const AcDbIntArray& indices,
const AcGeVector3d& offset)
{
assertWriteEnabled();
if(indices.length()) {
AcGeMatrix3d mat;
mat.setToTranslation(offset);
subTransformBy(mat);
}
return Acad::eOk;
}
const TCHAR *
TDbDoubleMulStair::GetDefaultLayer() const
{
return LAY_STAIR;
}
void
TDbDoubleMulStair::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("二跑步数"), XString(_T("%d"), int(GetStepNum3()))));
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(GetStairWidth2())));
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(GetSlabSizeM())));
lstInfo.Append(new TObjInfoUnit(_T("边平台宽"), Dist2Str(GetSlabWidth())));
lstInfo.Append(new TObjInfoUnit(_T("中平台宽"), Dist2Str(GetSlabWidthM())));
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));
lstInfo.Append(new TObjInfoUnit(_T("上楼位置"), m_nStartSide? _T("边梯") : _T("中梯")));
}
//中跑起步时的内侧扶手
void TDbDoubleMulStair::GetRailFromMid(TDbLineStair &stair1, //[in/out]边跑左梯段
TDbLineStair &stair2, //[in/out]中跑梯段
TDbLineStair &stair3, //[in/out]边跑右梯段
TDbLineStair &stair4, //[in/out]二跑左梯段
TDbLineStair &stair5, //[in/out]二跑右梯段
XPoly2D &polyRail, //[in/out]内侧左扶手
XPoly2D &polyRail2, //[in/out]内侧右扶手
XPoint &ptStart, //[in/out]左侧扶手顶点
XPoint &ptStart2 //[in/out]右侧扶手顶点
)const
{
double nDistToSide=m_nRailDistToSide+m_nRailWidth/2;
//梯段位置
XPoint ptLoc1, ptLoc2, ptLoc3, ptLoc4, ptLoc5;
ptLoc1 = stair1.GetLocation();
ptLoc2 = stair2.GetLocation();
ptLoc3 = stair3.GetLocation();
ptLoc4 = stair4.GetLocation();
ptLoc5 = stair5.GetLocation();
//梯段长度
double nLen1=(m_nStepNum1-1)*m_nStepWidth,
nLen2=(m_nStepNum2-1)*m_nStepWidth,
nLen3=(m_nStepNum3-1)*m_nStepWidth;
double dStairWidth=0.0; //井宽
dStairWidth = nLen3+m_nSlabWidth-m_nStairWidth+(m_nSlabWidthM - m_nMStairWidth)/2.0;
//扶手伸出距离产生的高差
double elev1=(m_nRailDist/nLen2)*(stair2.GetStairHeight()-m_nStepHeight),
elevSide=(m_nRailDistSide/nLen1)*(stair1.GetStairHeight()-m_nStepHeight);
double nSlabSize(0),nSlabSizeM(0);//休息平台尺寸
nSlabSize=m_nSlabSize;
nSlabSizeM=m_nSlabSizeM;
//del by xlc on 080624 增加中休息台宽
/*if(fabs(nLen1-nLen2)>_DIST_SNAP)
{
if(m_nAlignment!=0)
{
double nTemp=(m_nAlignment==1)? 2.0 : 1.0;
if(nLen1>nLen2) //边梯长
{
nSlabSizeM=m_nSlabSize+(nLen1-nLen2)/nTemp;
}
else
{
nSlabSize=m_nSlabSize+(nLen2-nLen1)/nTemp;
}
}
}*/
//del by xlc on 080624 删除水平段
/*if(m_nStairFlag!=SF_TOP)
{
BOOL bFlag=FALSE;
if(m_nStairFlag!=SF_FIRST && nLen2<nLen1-_DIST_SNAP && m_nAlignment!=2)// 踏步不与楼板取齐
{
//扶手在边梯起点
ads_polar(ptLoc1, m_nRotation-PI/2, nLen1+m_nRailDist, ptStart);
ads_polar(XPoint(ptStart), m_nRotation+PI, nDistToSide, ptStart);
ads_polar(ptLoc3, m_nRotation-PI/2, nLen1+m_nRailDist, ptStart2);
ads_polar(XPoint(ptStart2), m_nRotation+PI, m_nStairWidth-nDistToSide, ptStart2);
if(m_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(m_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)
{
//扶手在边梯起点
ads_polar(ptLoc1, m_nRotation-PI/2, nLen1+m_nRailDist, ptStart);
ads_polar(XPoint(ptStart), m_nRotation+PI, nDistToSide, ptStart);
ads_polar(ptLoc3, m_nRotation-PI/2, nLen1+m_nRailDist, ptStart2);
ads_polar(XPoint(ptStart2), m_nRotation+PI,
m_nStairWidth-nDistToSide, ptStart2);
if(m_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);
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, m_nRailDist, ptStart);
ads_polar(XPoint(ptStart2), m_nRotation-PI/2.0,m_nRailDist, ptStart2);
if(m_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+m_nRailDist, ptStart);
ads_polar(ptLoc2, m_nRotation, m_nMStairWidth-nDistToSide, ptStart2);
ads_polar(XPoint(ptStart2), m_nRotation-PI/2.0, dDist+m_nRailDist, ptStart2);
if(m_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_nRailDist > m_nStepWidth*0.5+_DIST_SNAP)
{
ads_polar(XPoint(ptStart), m_nRotation-PI/2.0, m_nRailDist, ptStart);
polyRail.AppendNode(ptStart);
ads_polar(XPoint(ptStart), m_nRotation+PI/2.0, m_nRailDist-m_nStepWidth*0.5, ptStart);
ads_polar(XPoint(ptStart2), m_nRotation-PI/2.0, m_nRailDist, ptStart2);
polyRail2.AppendNode(ptStart2);
ads_polar(XPoint(ptStart2), m_nRotation+PI/2.0, m_nRailDist-m_nStepWidth*0.5, ptStart2);
}
else
{
ads_polar(XPoint(ptStart), m_nRotation-PI/2.0,m_nRailDist, ptStart);
ads_polar(XPoint(ptStart2), m_nRotation-PI/2.0, m_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);
double nDistMid=nSlabSizeM-m_nStairWidth2+nDistToSide; //中间梯段与二跑梯段间的垂直距离
if(nDistMid > 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, nDistMid-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, nDistMid-m_nStepWidth*0.5, ptStart2);
}
else
{
ads_polar(XPoint(ptStart), m_nRotation+PI/2.0, nLen2+nDistMid, ptStart);
ads_polar(XPoint(ptStart2), m_nRotation+PI/2.0, nLen2+nDistMid, ptStart2);
double elev2=(nDistMid/nLen2)*(stair2.GetStairHeight()-m_nStepHeight);
ptStart.z = ptStart2.z = ptLoc2.z+stair2.GetStairHeight()-0.5*m_nStepHeight+elev2;
}
polyRail.AppendNode(ptStart);
polyRail2.AppendNode(ptStart2);
//二跑梯段下顶点
ads_polar(XPoint(ptLoc4), m_nRotation+PI*0.5,nDistToSide, ptStart);
ads_polar(XPoint(ptLoc5), m_nRotation-PI*0.5,m_nStairWidth2-nDistToSide, ptStart2);
double dDist2=(m_nSlabWidthM-m_nMStairWidth)/2+nDistToSide; //中间梯段与二跑梯段间的水平距离
if(dDist2 > m_nStepWidth*0.5+_DIST_SNAP)
{
ads_polar(XPoint(ptStart), m_nRotation,m_nStepWidth*0.5, ptStart);
ads_polar(XPoint(ptStart2), m_nRotation+PI,m_nStepWidth*0.5, ptStart2);
ptStart.z = ptStart2.z = ptLoc4.z;
polyRail.AppendNode(ptStart);
polyRail2.AppendNode(ptStart2);
}
//二跑梯段上顶点
ads_polar(XPoint(ptLoc4), m_nRotation+PI*0.5,nDistToSide, ptStart);
ads_polar(XPoint(ptLoc5), m_nRotation-PI*0.5,m_nStairWidth2-nDistToSide, ptStart2);
double dDist3=m_nSlabWidth-m_nStairWidth+nDistToSide; //边梯段与二跑梯段间的水平距离
if(dDist3 > m_nStepWidth*0.5+_DIST_SNAP)
{
ads_polar(XPoint(ptStart), m_nRotation+PI,nLen3+m_nStepWidth*0.5, ptStart);
ads_polar(XPoint(ptStart2), m_nRotation,nLen3+m_nStepWidth*0.5, ptStart2);
ptStart.z = ptStart2.z = ptLoc4.z + stair4.GetStairHeight();
polyRail.AppendNode(ptStart);
polyRail2.AppendNode(ptStart2);
ads_polar(XPoint(ptStart), m_nRotation+PI,dDist3-m_nStepWidth*0.5, ptStart);
ads_polar(XPoint(ptStart2), m_nRotation,dDist3-m_nStepWidth*0.5, ptStart2);
}
else
{
ads_polar(XPoint(ptStart), m_nRotation+PI,nLen3+dDist3, ptStart);
ads_polar(XPoint(ptStart2), m_nRotation,nLen3+dDist3, ptStart2);
double elev2=(dDist3/nLen2)*(stair2.GetStairHeight()-m_nStepHeight);
ptStart.z = ptStart2.z = ptLoc4.z + stair4.GetStairHeight()-m_nStepHeight*0.5+elev2;
}
polyRail.AppendNode(ptStart);
polyRail2.AppendNode(ptStart2);
//边梯扶手上顶点
double dDist4=nSlabSize-m_nStairWidth2+nDistToSide; //边梯段与二跑梯段间的垂直距离
ads_polar(XPoint(ptLoc1), m_nRotation+PI,nDistToSide, ptStart);
ads_polar(XPoint(ptLoc3), m_nRotation+PI,m_nStairWidth-nDistToSide, ptStart2);
if(dDist4 > m_nStepWidth*0.5+_DIST_SNAP)
{
ads_polar(XPoint(ptStart), m_nRotation+PI/2.0,m_nStepWidth*0.5, ptStart);
ads_polar(XPoint(ptStart2), m_nRotation+PI/2.0,m_nStepWidth*0.5, ptStart2);
polyRail.AppendNode(ptStart);
polyRail2.AppendNode(ptStart2);
}
//边梯扶手下顶点
ads_polar(ptLoc1, stair1.GetRotation(), nDistToSide, ptStart);
ads_polar(ptLoc3, stair1.GetRotation(), m_nStairWidth - nDistToSide, ptStart2);
if(m_nRailDistSide > 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, m_nRailDistSide-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, m_nRailDistSide-m_nStepWidth*0.5, ptStart2);
}
else
{
ads_polar(XPoint(ptStart), stair1.GetRotation()+PI/2.0, nLen1+m_nRailDistSide, ptStart);
ptStart.z = ptLoc1.z+stair1.GetStairHeight()-m_nStepHeight*0.5+elevSide;
ads_polar(XPoint(ptStart2), stair3.GetRotation()+PI/2.0, nLen1+m_nRailDistSide, ptStart2);
ptStart2.z = ptStart.z;
}
polyRail.AppendNode(ptStart);
polyRail2.AppendNode(ptStart2);
}
//边跑起步时的内侧扶手
void TDbDoubleMulStair::GetRailFromSide(TDbLineStair &stair1, //[in/out]边跑左梯段
TDbLineStair &stair2, //[in/out]中跑梯段
TDbLineStair &stair3, //[in/out]边跑右梯段
TDbLineStair &stair4, //[in/out]二跑左梯段
TDbLineStair &stair5, //[in/out]二跑右梯段
XPoly2D &polyRail, //[in/out]内侧左扶手
XPoly2D &polyRail2, //[in/out]内侧右扶手
XPoint &ptStart, //[in/out]左侧扶手顶点
XPoint &ptStart2 //[in/out]右侧扶手顶点
)const
{
double nDistToSide=m_nRailDistToSide+m_nRailWidth/2;
//梯段位置
XPoint ptLoc1, ptLoc2, ptLoc3, ptLoc4, ptLoc5;
ptLoc1 = stair1.GetLocation();
ptLoc2 = stair2.GetLocation();
ptLoc3 = stair3.GetLocation();
ptLoc4 = stair4.GetLocation();
ptLoc5 = stair5.GetLocation();
//梯段长度
double nLen1=(m_nStepNum1-1)*m_nStepWidth,
nLen2=(m_nStepNum2-1)*m_nStepWidth,
nLen3=(m_nStepNum3-1)*m_nStepWidth;
double dStairWidth=0.0; //井宽
dStairWidth = nLen3+m_nSlabWidth-m_nStairWidth+(m_nSlabWidthM - m_nMStairWidth)/2.0;
//扶手伸出距离为负时产生的高差
double elev1=(m_nRailDist/nLen1)*(stair1.GetStairHeight()-m_nStepHeight),
elevSide=(m_nRailDistSide/nLen1)*(stair1.GetStairHeight()-m_nStepHeight);
//modify by xlc on 080624 增加中休息台长
double nSlabSize(0),nSlabSizeM(0);//休息台尺寸
nSlabSize=m_nSlabSize;
nSlabSizeM=m_nSlabSizeM;
/*if(fabs(nLen1-nLen2)>_DIST_SNAP)
{
if(m_nAlignment!=0)
{
double nTemp=(m_nAlignment==1)? 2.0 : 1.0;
if(nLen1>nLen2) //边梯长
{
nSlabSizeM=m_nSlabSize+(nLen1-nLen2)/nTemp;
}
else
{
nSlabSize=m_nSlabSize+(nLen2-nLen1)/nTemp;
}
}
}*/
//del by xlc on 080624 删除水平段
/*if(m_nStairFlag!=SF_TOP) //首层或中间层
{
BOOL bFlag=FALSE; //
if(m_nStairFlag!=SF_FIRST && nLen2<nLen1-_DIST_SNAP && m_nAlignment!=2)// 踏步不与楼板取齐
{
//扶手从中梯开始
ads_polar(ptLoc2, m_nRotation-PI/2, nLen2+m_nRailDist, ptStart);
ads_polar(XPoint(ptStart), m_nRotation+PI, m_nMStairWidth - nDistToSide, ptStart);
if(m_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+m_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);
polyRail.AppendNode(ptStart);
polyRail2.AppendNode(ptStart2);
bFlag=TRUE;
}
if(m_nStairFlag==SF_MIDDLE)
{
if(nLen2>nLen1+_DIST_SNAP && m_nAlignment!=2)
{
//扶手从中梯开始
ads_polar(ptLoc2, m_nRotation-PI/2, nLen2+m_nRailDist, ptStart);
ads_polar(XPoint(ptStart), m_nRotation+PI, m_nMStairWidth - nDistToSide, ptStart);
if(m_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+m_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(m_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+m_nRailDist, ptStart);
ads_polar(XPoint(ptStart), m_nRotation+PI, m_nMStairWidth - nDistToSide, ptStart);
ads_polar(ptLoc2, m_nRotation-PI/2, nLen2+m_nRailDist, ptStart2);
ads_polar(XPoint(ptStart2), m_nRotation+PI, nDistToSide, ptStart2);
if(m_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+m_nRailDist, ptStart2);
ads_polar(ptLoc2, m_nRotation+PI,m_nMStairWidth+dStairWidth+ nDistToSide, ptStart);
ads_polar(XPoint(ptStart), m_nRotation-PI/2.0, nLen2+m_nRailDist, ptStart);
if(m_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(XPoint(ptStart), m_nRotation-PI/2.0, m_nRailDistSide, ptStart);
ads_polar(ptLoc3, m_nRotation, nDistToSide, ptStart2);
ads_polar(XPoint(ptStart2), m_nRotation-PI/2.0, m_nRailDistSide, ptStart2);
if(m_nRailDistSide > m_nStepWidth*0.5+_DIST_SNAP)
{
polyRail.AppendNode(ptStart);
polyRail2.AppendNode(ptStart2);
ads_polar(XPoint(ptStart), m_nRotation+PI/2.0, m_nRailDistSide-m_nStepWidth*0.5, ptStart);
ads_polar(XPoint(ptStart2), m_nRotation+PI/2.0, m_nRailDistSide-m_nStepWidth*0.5, ptStart2);
}
else
{
ptStart.z = ptLoc1.z + m_nStepHeight * 0.5 - elevSide;
ptStart2.z = ptLoc1.z + m_nStepHeight * 0.5 - elevSide;
}
polyRail.AppendNode(ptStart);
polyRail2.AppendNode(ptStart2);
//边梯上顶点
ads_polar(ptLoc1, m_nRotation, m_nStairWidth - nDistToSide, ptStart);
ads_polar(ptLoc3, m_nRotation, nDistToSide, ptStart2);
double dDist1=nSlabSize-m_nStairWidth2+nDistToSide;//边梯段到二跑梯段的垂直距离
if(dDist1 > 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 = ptStart2.z = ptLoc1.z + stair1.GetStairHeight();
polyRail.AppendNode(ptStart);
polyRail2.AppendNode(ptStart2);
ads_polar(XPoint(ptStart), m_nRotation+PI/2.0, dDist1-m_nStepWidth*0.5, ptStart);
ads_polar(XPoint(ptStart2), m_nRotation+PI/2.0, dDist1-m_nStepWidth*0.5, ptStart2);
}
else
{
ads_polar(XPoint(ptStart), m_nRotation+PI/2.0, nLen1+dDist1, ptStart);
ads_polar(XPoint(ptStart2), m_nRotation+PI/2.0, nLen1+dDist1, ptStart2);
double elev2=(dDist1/nLen1)*(stair1.GetStairHeight()-m_nStepHeight);
ptStart.z = ptStart2.z = ptLoc1.z + stair1.GetStairHeight() - m_nStepHeight*0.5 + elev2;
}
polyRail.AppendNode(ptStart);
polyRail2.AppendNode(ptStart2);
double dDist2=m_nSlabWidth-m_nStairWidth+nDistToSide; //边梯段与二跑梯段间的水平距离
//二跑下顶点
ads_polar(XPoint(ptLoc4), m_nRotation-PI*0.5,m_nStairWidth2-nDistToSide, ptStart);
ads_polar(XPoint(ptLoc5), m_nRotation+PI*0.5,nDistToSide, ptStart2);
if(dDist2 > m_nStepWidth*0.5+_DIST_SNAP)
{
ads_polar(XPoint(ptStart), m_nRotation+PI,m_nStepWidth*0.5, ptStart);
ads_polar(XPoint(ptStart2), m_nRotation,m_nStepWidth*0.5, ptStart2);
ptStart.z = ptStart2.z = ptLoc4.z;
polyRail.AppendNode(ptStart);
polyRail2.AppendNode(ptStart2);
}
double dDist3=(m_nSlabWidthM-m_nMStairWidth)*0.5+nDistToSide; //中间梯段与二跑梯段间的水平距离
//二跑上顶点
ads_polar(XPoint(ptLoc4), m_nRotation-PI*0.5,m_nStairWidth2-nDistToSide, ptStart);
ads_polar(XPoint(ptLoc5), m_nRotation+PI*0.5,nDistToSide, ptStart2);
if(dDist3 > m_nStepWidth*0.5+_DIST_SNAP)
{
ads_polar(XPoint(ptStart), m_nRotation,nLen3+m_nStepWidth*0.5, ptStart);
ads_polar(XPoint(ptStart2), m_nRotation+PI,nLen3+m_nStepWidth*0.5, ptStart2);
ptStart.z = ptStart2.z = ptLoc4.z+stair4.GetStairHeight();
polyRail.AppendNode(ptStart);
polyRail2.AppendNode(ptStart2);
ads_polar(XPoint(ptStart), m_nRotation,dDist3-m_nStepWidth*0.5, ptStart);
ads_polar(XPoint(ptStart2), m_nRotation+PI,dDist3-m_nStepWidth*0.5, ptStart2);
}
else
{
ads_polar(XPoint(ptStart), m_nRotation,nLen3+dDist3, ptStart);
ads_polar(XPoint(ptStart2), m_nRotation+PI,nLen3+dDist3, ptStart2);
double elev2=(dDist3/nLen1)*(stair1.GetStairHeight()-m_nStepHeight);
ptStart.z = ptStart2.z = ptLoc4.z+stair4.GetStairHeight()-m_nStepHeight*0.5+elev2;
}
polyRail.AppendNode(ptStart);
polyRail2.AppendNode(ptStart2);
double dDist4=nSlabSizeM-m_nStairWidth2+nDistToSide; //中间梯段与二跑梯段间的垂直距离
//中梯顶点
if(dDist4 > 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 = 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(m_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, m_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, m_nRailDist-m_nStepWidth*0.5, ptStart2);
}
else
{
ads_polar(XPoint(ptStart), stair2.GetRotation()+PI/2.0, nLen2+m_nRailDist, ptStart);
ptStart.z = ptLoc2.z+stair2.GetStairHeight()-0.5*m_nStepHeight+elev1;
ads_polar(XPoint(ptStart2), stair2.GetRotation()+PI/2.0, nLen2+m_nRailDist, ptStart2);
ptStart2.z = ptStart.z;
}
polyRail.AppendNode(ptStart);
polyRail2.AppendNode(ptStart2);
}
Acad::ErrorStatus
TDbDoubleMulStair::ExplodeTo(TDbLineStair &stair1, //[in/out]边跑左梯段
TDbLineStair &stair2, //[in/out]中跑梯段
TDbLineStair &stair3, //[in/out]边跑右梯段
TDbLineStair &stair4, //[in/out]二跑左梯段
TDbLineStair &stair5, //[in/out]二跑右梯段
TDbSlab &slab, //[in/out]中休息平台
TDbSlab &slabL, //[in/out]左休息平台
TDbSlab &slabR, //[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=GetUpMid2d();
XPoint ptLowLeft, ptLowMid, ptLowRight; //休息平台板的顶点
double nLen1=(m_nStepNum1-1)*m_nStepWidth,
nLen2=(m_nStepNum2-1)*m_nStepWidth,
nLen3=(m_nStepNum3-1)*m_nStepWidth;
//modify by xlc on 080624 增加中休息台尺寸
double nSlabSize(0),nSlabSizeM(0);//休息台尺寸
nSlabSize=m_nSlabSize;
nSlabSizeM=m_nSlabSizeM;
/*if(fabs(nLen1-nLen2)>_DIST_SNAP)
{
if(m_nAlignment!=0)
{
double nTemp=(m_nAlignment==1)? 2.0 : 1.0;
if(nLen1>nLen2) //边梯长
{
nSlabSizeM=m_nSlabSize+(nLen1-nLen2)/nTemp;
}
else
{
nSlabSize=m_nSlabSize+(nLen2-nLen1)/nTemp;
}
}
}
*/
ads_polar(ptUpLeft, m_nRotation-PI/2.0, nSlabSize, ptLowLeft);
ads_polar(ptUpRight, m_nRotation-PI/2.0, nSlabSize, ptLowRight);
ads_polar(ptUpMid, m_nRotation-PI/2.0, nSlabSizeM, ptLowMid);
//设置梯段宽度
stair1.SetStairWidth(m_nStairWidth);
stair2.SetStairWidth(m_nMStairWidth);
stair3.SetStairWidth(m_nStairWidth);
stair4.SetStairWidth(m_nStairWidth2);
stair5.SetStairWidth(m_nStairWidth2);
//设置踏步高度
stair1.SetStepHeight(m_nStepHeight);
stair2.SetStepHeight(m_nStepHeight);
stair3.SetStepHeight(m_nStepHeight);
stair4.SetStepHeight(m_nStepHeight);
stair5.SetStepHeight(m_nStepHeight);
//设置踏步宽度
stair1.SetStepWidth(m_nStepWidth);
stair2.SetStepWidth(m_nStepWidth);
stair3.SetStepWidth(m_nStepWidth);
stair4.SetStepWidth(m_nStepWidth);
stair5.SetStepWidth(m_nStepWidth);
//设置踏步数
stair1.SetStepNum(m_nStepNum1);
stair2.SetStepNum(m_nStepNum2);
stair3.SetStepNum(m_nStepNum1);
stair4.SetStepNum(m_nStepNum3);
stair5.SetStepNum(m_nStepNum3);
//设置踏步旋转角度
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));
stair4.SetRotation(CT_std_angle(m_nRotation+PI/2.0));
stair5.SetRotation(CT_std_angle(m_nRotation-PI/2.0));
}
else
{
stair1.SetRotation(m_nRotation);
stair2.SetRotation(CT_std_angle(m_nRotation+PI));
stair3.SetRotation(m_nRotation);
stair4.SetRotation(CT_std_angle(m_nRotation-PI/2.0));
stair5.SetRotation(CT_std_angle(m_nRotation+PI/2.0));
}
//计算梯段位置
XPoint ptLoc1, ptLoc2, ptLoc3,ptLoc4,ptLoc5;
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;
ads_polar(GetUpMid2d(), m_nRotation-PI/2, m_nStairWidth2, ptTmp);
ads_polar(ptTmp, m_nRotation+PI, m_nSlabWidthM*0.5, ptLoc4);
ads_polar(GetUpMid2d(), m_nRotation, m_nSlabWidthM*0.5, ptLoc5);
ptLoc2.z = m_ptLocation.z;
ptLoc4.z = ptLoc5.z = ptLoc2.z + stair2.GetStairHeight();
ptLoc1.z = ptLoc3.z = ptLoc4.z + stair4.GetStairHeight();
}
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);
ads_polar(GetUpLeft2d(), m_nRotation, m_nSlabWidth, ptLoc4);
ads_polar(GetUpRight2d(), m_nRotation-PI/2, m_nStairWidth2, ptTmp);
ads_polar(ptTmp, m_nRotation+PI, m_nSlabWidth, ptLoc5);
ptLoc1.z = ptLoc3.z = m_ptLocation.z;
ptLoc4.z = ptLoc5.z = ptLoc1.z + stair1.GetStairHeight();
ptLoc2.z = ptLoc4.z + stair4.GetStairHeight();
}
//设置梯段位置
stair1.SetLocation(ptLoc1);
stair2.SetLocation(ptLoc2);
stair3.SetLocation(ptLoc3);
stair4.SetLocation(ptLoc4);
stair5.SetLocation(ptLoc5);
//设置梯段标记
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);
stair4.Set3DFlag(m_nStairFlag==SF_TOP? 0 : SF_HAS3D);
stair5.Set3DFlag(m_nStairFlag==SF_TOP? 0 : SF_HAS3D);
stair1.Set2DFlag(SF_NOSECT);
stair2.Set2DFlag(SF_NOSECT);
stair3.Set2DFlag(SF_NOSECT);
stair4.Set2DFlag(SF_NOSECT);
stair5.Set2DFlag(SF_NOSECT);
if(m_nStairFlag==SF_FIRST) //首层
{
if(nSectStair==0) //中梯剖断
{
stair2.Set2DFlag(SF_1SECT);
}
else if(nSectStair==1) //边梯剖断
{
stair1.Set2DFlag(SF_1SECT);
stair3.Set2DFlag(SF_1SECT);
}
else if(nSectStair==2)
{
stair4.Set2DFlag(SF_1SECT);
stair5.Set2DFlag(SF_1SECT);
}
}
else if(m_nStairFlag==SF_MIDDLE) //中间层
{
if(nSectStair==0) //中梯剖断
{
stair2.Set2DFlag(SF_2SECT);
}
else if(nSectStair==1) //边梯剖断
{
stair1.Set2DFlag(SF_2SECT);
stair3.Set2DFlag(SF_2SECT);
}
else if(nSectStair==2)
{
stair4.Set2DFlag(SF_2SECT);
stair5.Set2DFlag(SF_2SECT);
}
}
// 设置边梁属性
/*for(int nSide=0; nSide<2; nSide++)
{
stair1.SetSideBeam(nSide, HasSideBeam(nSide));
stair2.SetSideBeam(nSide, HasSideBeam(nSide));
stair3.SetSideBeam(nSide, HasSideBeam(nSide));
stair4.SetSideBeam(nSide, HasSideBeam(nSide));
stair5.SetSideBeam(nSide, HasSideBeam(nSide));
}*/
stair2.SetSideBeam(0, IsInSideBeam());
stair2.SetSideBeam(1, IsInSideBeam());
if(m_nStartSide==OFFSET_MID)
{
stair1.SetSideBeam(1, IsOutSideBeam());
stair1.SetSideBeam(0, IsInSideBeam());
stair3.SetSideBeam(0, IsOutSideBeam());
stair3.SetSideBeam(1, IsInSideBeam());
stair4.SetSideBeam(1, IsOutSideBeam());
stair4.SetSideBeam(0, IsInSideBeam());
stair5.SetSideBeam(1, IsInSideBeam());
stair5.SetSideBeam(0, IsOutSideBeam());
}
else
{
stair1.SetSideBeam(0, IsOutSideBeam());
stair1.SetSideBeam(1, IsInSideBeam());
stair3.SetSideBeam(1, IsOutSideBeam());
stair3.SetSideBeam(0, IsInSideBeam());
stair4.SetSideBeam(0, IsOutSideBeam());
stair4.SetSideBeam(1, IsInSideBeam());
stair5.SetSideBeam(0, IsInSideBeam());
stair5.SetSideBeam(1, IsOutSideBeam());
}
/////////////////////////////////////////////////////////////////
//扶手, 考虑了详图画法
double nDistToSide=m_nRailDistToSide+m_nRailWidth/2;
double dStairWidth=0.0; //井宽
dStairWidth = nLen3+m_nSlabWidth-m_nStairWidth+(m_nSlabWidthM - m_nMStairWidth)/2.0;
XPoly2D polyRail,polyRail2; //左右内侧扶手
XPoint ptStart,ptStart2;
if(m_nStartSide==OFFSET_MID) //中跑上楼
{
GetRailFromMid(stair1,stair2,stair3,stair4,stair5,polyRail,polyRail2,ptStart,ptStart2);
}
else //边跑上楼
{
GetRailFromSide(stair1,stair2,stair3,stair4,stair5,polyRail,polyRail2,ptStart,ptStart2);
}
polyRail.SetFlag(0);
polyRail2.SetFlag(0);
//del by xlc on 080624 删除水平段
/*if(m_nStairFlag==SF_TOP) //顶层
{
//处理扶手端点
XPoint ptA, ptB;
ptA = *polyRail.Head();
ads_polar(ptA, m_nRotation+PI/2, m_nRailWidth*0.5, ptB);
*polyRail.Head() = ptB;
ptA = *polyRail2.Head();
ads_polar(ptA, m_nRotation+PI/2, m_nRailWidth*0.5, ptB);
*polyRail2.Head() = ptB;
//顶端扶手
XPoly2D polyTopRail(0);
polyTopRail.AppendNode(XPoint(ptStart.x, ptStart.y, GetElevation()));//顶端扶手起点
if(nLen2<nLen1-_DIST_SNAP && m_nAlignment!=2)
{
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, 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)
{
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, 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.flag=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)
{
double elev=ptStart2.z;
ads_polar(ptLoc3, m_nRotation+PI, dStairWidth+nDistToSide, ptStart2);
ads_polar(XPoint(ptStart2), m_nRotation-PI/2,m_nRailDist, 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.flag=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);
}
polyRail.Compress(false);
polyRail2.Compress(false);
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);
//外侧扶手
if(IsOutRail())
{
double nDist=m_nStartSide==OFFSET_MID?nDistToSide:-nDistToSide;
XPoly2D poly,poly2;
XLine line=stair1.GetSideCurve2d(m_nStartSide==OFFSET_MID?1:0).Offset(-nDist,0);
XLine line2=stair3.GetSideCurve2d(m_nStartSide==OFFSET_MID?0:1).Offset(nDist,0);
if(m_nStartSide==OFFSET_MID)
{
GetRailPoly(stair1,line,m_nStepWidth*0.5,m_nRailDistSide,poly);
GetRailPoly(stair3,line2,m_nStepWidth*0.5,m_nRailDistSide,poly2);
poly.Reverse();
poly2.Reverse();
}
else
{
GetRailPoly(stair1,line,m_nRailDistSide,m_nStepWidth*0.5,poly);
GetRailPoly(stair3,line2,m_nRailDistSide,m_nStepWidth*0.5,poly2);
}
XPoint ptTmp=*poly.Tail();
ads_polar(ptTmp, m_nRotation+PI*0.5,nSlabSize-m_nStepWidth*0.5-nDistToSide, ptTmp);
poly.AppendNode(ptTmp);
ads_polar(ptTmp, m_nRotation,m_nSlabWidth-m_nStepWidth*0.5-nDistToSide, ptTmp);
poly.AppendNode(ptTmp);
ads_polar(ptTmp, m_nRotation,m_nStepNum3*m_nStepWidth, ptTmp);
if(m_nStartSide == OFFSET_MID)
{
ptTmp.z = ptLoc4.z;
}
else
{
ptTmp.z = ptLoc4.z+stair4.GetStairHeight();
}
poly.AppendNode(ptTmp);
ptTmp=*poly2.Tail();
ads_polar(ptTmp, m_nRotation+PI*0.5,nSlabSize-m_nStepWidth*0.5-nDistToSide, ptTmp);
poly2.AppendNode(ptTmp);
ads_polar(ptTmp, m_nRotation+PI,m_nSlabWidth-m_nStepWidth*0.5-nDistToSide, ptTmp);
poly2.AppendNode(ptTmp);
ads_polar(ptTmp, m_nRotation+PI,m_nStepNum3*m_nStepWidth, ptTmp);
if(m_nStartSide == OFFSET_MID)
{
ptTmp.z = ptLoc4.z;
}
else
{
ptTmp.z = ptLoc4.z+stair4.GetStairHeight();
}
poly2.AppendNode(ptTmp);
if(m_nStairFlag == SF_FIRST)
{
XPoint pt=*poly.Tail();
poly2.AppendNode(pt);
if(m_nStartSide == OFFSET_MID)
{
poly.Reverse();
poly2.Reverse();
}
}
else
{
for(int i=poly2.Length()-1;i>=0;i--)
{
XPoint pt=*poly2[i];
poly.AppendNode(pt);
}
}
if(pRailOut1!=0) //左边梯外侧扶手
{
/*if(m_nStairFlag == SF_TOP && m_nStartSide != OFFSET_MID)
{
//处理扶手端点
XPoint ptA, ptB;
ptA = *poly.Head();
ads_polar(ptA, m_nRotation+PI/2, m_nRailWidth*0.5, ptB);
*poly.Head() = ptB;
ptA = *poly.Tail();
ads_polar(ptA, m_nRotation+PI/2, m_nRailWidth*0.5, ptB);
*poly.Tail() = ptB;
}*/
pRailOut1->SetPathPoly(poly,GetNormal().AsAcGeVector3d());
pRailOut1->SetWidth(m_nRailWidth);
pRailOut1->SetHeight(m_nRailHeight);
pRailOut1->SetStyle(TDbHandRail::RS_RAIL1);
}
if(m_nStairFlag == SF_FIRST)
{
if(pRailOut2!=0) //右边梯外侧扶手
{
pRailOut2->SetPathPoly(poly2,GetNormal().AsAcGeVector3d());
pRailOut2->SetWidth(m_nRailWidth);
pRailOut2->SetHeight(m_nRailHeight);
pRailOut2->SetStyle(TDbHandRail::RS_RAIL1);
}
}
}
//休息平台
if(m_nSlabSize>_DIST_SNAP)
{
XPoly2D polySlab(1),polySlabL(1),polySlabR(1);
XPoint ptTmp;
//中间休息台
ads_polar(GetUpMid2d(), m_nRotation, 0.5*m_nSlabWidthM, ptTmp);
ads_polar(ptTmp, m_nRotation-PI*0.5, m_nStairWidth2, ptTmp);
polySlab.AppendNode(ptTmp);
ads_polar(GetUpMid2d(), m_nRotation, 0.5*m_nSlabWidthM, ptTmp);
polySlab.AppendNode(ptTmp);
ads_polar(GetUpMid2d(), m_nRotation+PI, 0.5*m_nSlabWidthM, ptTmp);
polySlab.AppendNode(ptTmp);
ads_polar(ptTmp, m_nRotation-PI*0.5, m_nStairWidth2, ptTmp);
polySlab.AppendNode(ptTmp);
if(nSlabSizeM > m_nStairWidth2+_DIST_SNAP)
{
ads_polar(ptTmp, m_nRotation, (m_nSlabWidthM-m_nMStairWidth)*0.5, ptTmp);
polySlab.AppendNode(ptTmp);
ads_polar(ptLowMid, m_nRotation+PI, 0.5*m_nMStairWidth, ptTmp);
polySlab.AppendNode(ptTmp);
ads_polar(ptLowMid, m_nRotation, 0.5*m_nMStairWidth, ptTmp);
polySlab.AppendNode(ptTmp);
ads_polar(ptTmp, m_nRotation+PI*0.5, nSlabSizeM-m_nStairWidth2, ptTmp);
polySlab.AppendNode(ptTmp);
}
//左侧休息台
ads_polar(GetUpLeft2d(), m_nRotation, m_nSlabWidth, ptTmp);
ads_polar(ptTmp, m_nRotation-PI*0.5, m_nStairWidth2, ptTmp);
polySlabL.AppendNode(ptTmp);
ads_polar(GetUpLeft2d(), m_nRotation, m_nSlabWidth, ptTmp);
polySlabL.AppendNode(ptTmp);
ptTmp=GetUpLeft2d();
polySlabL.AppendNode(ptTmp);
ads_polar(ptTmp, m_nRotation-PI*0.5, nSlabSize, ptTmp);
polySlabL.AppendNode(ptTmp);
if(nSlabSize > m_nStairWidth2+_DIST_SNAP)
{
ads_polar(ptTmp, m_nRotation, m_nStairWidth, ptTmp);
polySlabL.AppendNode(ptTmp);
}
if(nSlabSize > m_nStairWidth2+_DIST_SNAP&&m_nSlabWidth > m_nStairWidth+_DIST_SNAP)
{
ads_polar(ptTmp, m_nRotation+PI*0.5, nSlabSize-m_nStairWidth2, ptTmp);
polySlabL.AppendNode(ptTmp);
}
//右侧休息台
ads_polar(GetUpRight2d(), m_nRotation+PI, m_nSlabWidth, ptTmp);
ads_polar(ptTmp, m_nRotation-PI*0.5, m_nStairWidth2, ptTmp);
polySlabR.AppendNode(ptTmp);
ads_polar(GetUpRight2d(), m_nRotation+PI, m_nSlabWidth, ptTmp);
polySlabR.AppendNode(ptTmp);
ptTmp=GetUpRight2d();
polySlabR.AppendNode(ptTmp);
ads_polar(ptTmp, m_nRotation-PI*0.5, nSlabSize, ptTmp);
polySlabR.AppendNode(ptTmp);
if(nSlabSize > m_nStairWidth2+_DIST_SNAP)
{
ads_polar(ptTmp, m_nRotation+PI, m_nStairWidth, ptTmp);
polySlabR.AppendNode(ptTmp);
}
if(nSlabSize > m_nStairWidth2+_DIST_SNAP&&m_nSlabWidth > m_nStairWidth+_DIST_SNAP)
{
ads_polar(ptTmp, m_nRotation+PI*0.5, nSlabSize-m_nStairWidth2, ptTmp);
polySlabR.AppendNode(ptTmp);
}
if(polySlab.PathArea()>0)
polySlab.Reverse();
if(polySlabL.PathArea()>0)
polySlabL.Reverse();
if(polySlabR.PathArea()>0)
polySlabR.Reverse();
slab.SetOutline(polySlab);
slabL.SetOutline(polySlabL);
slabR.SetOutline(polySlabR);
if(m_nStartSide==OFFSET_MID)
{
slab.SetElevation(ptLoc4.z);
slabL.SetElevation(ptLoc1.z);
slabR.SetElevation(ptLoc1.z);
}
else
{
slab.SetElevation(ptLoc2.z);
slabL.SetElevation(ptLoc4.z);
slabR.SetElevation(ptLoc4.z);
}
slab.SetThickness(-m_nSlabThick);
slabL.SetThickness(-m_nSlabThick);
slabR.SetThickness(-m_nSlabThick);
}
stair1.setPropertiesFrom(this);
stair2.setPropertiesFrom(this);
stair3.setPropertiesFrom(this);
stair4.setPropertiesFrom(this);
stair5.setPropertiesFrom(this);
stair1.SetBeamHeight(GetBeamHeight());
stair2.SetBeamHeight(GetBeamHeight());
stair3.SetBeamHeight(GetBeamHeight());
stair4.SetBeamHeight(GetBeamHeight());
stair5.SetBeamHeight(GetBeamHeight());
stair1.SetBeamThick(GetBeamThick());
stair2.SetBeamThick(GetBeamThick());
stair3.SetBeamThick(GetBeamThick());
stair4.SetBeamThick(GetBeamThick());
stair5.SetBeamThick(GetBeamThick());
slab.setPropertiesFrom(this);
slabL.setPropertiesFrom(this);
slabR.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);
slabL.setLayer(m_idLayerStep3d);
slabR.setLayer(m_idLayerStep3d);
stair1.SetLayerStep3d(m_idLayerStep3d);
stair2.SetLayerStep3d(m_idLayerStep3d);
stair3.SetLayerStep3d(m_idLayerStep3d);
stair4.SetLayerStep3d(m_idLayerStep3d);
stair5.SetLayerStep3d(m_idLayerStep3d);
}
if(m_idLayerBeam3d.isValid())
{
stair1.SetLayerBeam3d(m_idLayerBeam3d);
stair2.SetLayerBeam3d(m_idLayerBeam3d);
stair3.SetLayerBeam3d(m_idLayerBeam3d);
stair4.SetLayerBeam3d(m_idLayerBeam3d);
stair5.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 TDbDoubleMulStair::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 TDbDoubleMulStair::GetDefaultArrow(TDbLineStair &stair1,TDbLineStair &stair2,TDbLineStair &stair3,TDbLineStair &stair4,TDbLineStair &stair5,
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+m_nStepNum3+1;
}
if((nSectStair==1&&m_nStartSide!=OFFSET_MID&&nSectStepNum==m_nStepNum1)
||(nSectStair==0&&m_nStartSide==OFFSET_MID&&nSectStepNum==m_nStepNum2)
||(nSectStair==2&&(nSectStepNum==(m_nStepNum3+(m_nStartSide==OFFSET_MID?m_nStepNum2:m_nStepNum1))))
||nSectStepNum==m_nStepNum1+m_nStepNum2+m_nStepNum3)
{
nSectStepNum--;
}
XPoint pt1,pt2,pt3,pt4,pt5,pt6,pt7,pt8,pt9,pt10,pt11,pt12,pt13,pt14,pt15,pt16,pt;
/*----------点相对位置示意----------------------
_________________________________________________
*pt4---*pt13*pt14---*pt5---*pt15*pt16---*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-m_nStepNum3)),pt2);
ads_polar(pt,stair1.GetRotation()+PI/2,(m_nStepWidth*(nSectStepNum-m_nStepNum2-m_nStepNum3-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-m_nStepNum3)),pt10);
ads_polar(pt,stair3.GetRotation()+PI/2,(m_nStepWidth*(nSectStepNum-m_nStepNum2-m_nStepNum3-1)),pt11);
ads_polar(stair4.GetLocation(),stair4.GetRotation(),stair4.GetStairWidth()*0.5,pt);
ads_polar(pt,stair4.GetRotation()+PI/2,(m_nStepWidth*(nSectStepNum-m_nStepNum2)),pt13);
ads_polar(pt,stair4.GetRotation()+PI/2,(m_nStepWidth*(nSectStepNum-m_nStepNum2-1)),pt14);
ads_polar(stair5.GetLocation(),stair5.GetRotation(),stair4.GetStairWidth()*0.5,pt);
ads_polar(pt,stair5.GetRotation()+PI/2,(m_nStepWidth*(nSectStepNum-m_nStepNum2-1)),pt15);
ads_polar(pt,stair5.GetRotation()+PI/2,(m_nStepWidth*(nSectStepNum-m_nStepNum2)),pt16);
}
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-m_nStepNum3)),pt7);
ads_polar(pt,stair2.GetRotation()+PI/2,(m_nStepWidth*(nSectStepNum-m_nStepNum1-m_nStepNum3-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(stair4.GetLocation(),stair4.GetRotation(),stair4.GetStairWidth()*0.5,pt);
ads_polar(pt,stair4.GetRotation()+PI/2,(m_nStepWidth*(nSectStepNum-m_nStepNum1-1)),pt13);
ads_polar(pt,stair4.GetRotation()+PI/2,(m_nStepWidth*(nSectStepNum-m_nStepNum1)),pt14);
ads_polar(stair5.GetLocation(),stair5.GetRotation(),stair4.GetStairWidth()*0.5,pt);
ads_polar(pt,stair5.GetRotation()+PI/2,(m_nStepWidth*(nSectStepNum-m_nStepNum1)),pt15);
ads_polar(pt,stair5.GetRotation()+PI/2,(m_nStepWidth*(nSectStepNum-m_nStepNum1-1)),pt16);
}
ads_polar(GetUpLeft2d(),GetRotation()-PI/2,GetStairWidth2()*0.5,pt);
ads_polar(pt,GetRotation(),GetStairWidth()*0.5,pt4);
ads_polar(GetUpMid2d(),GetRotation()-PI/2,GetStairWidth2()*0.5,pt5);
ads_polar(GetUpRight2d(),GetRotation()-PI/2,GetStairWidth2()*0.5,pt);
ads_polar(pt,GetRotation()+PI,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*0.5,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*0.5,m_nStepWidth,pt1);
poly1.AppendNode(pt1);
poly2.AppendNode(pt8);
poly2.AppendNode(pt5);
poly2.AppendNode(pt12);
ads_polar(pt9,m_nRotation+PI*0.5,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);
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);
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==2) //二跑剖断
{
poly.AppendNode(pt8);
poly.AppendNode(pt5);
poly.AppendNode(pt14);
XPoly2D poly2;
poly2.AppendNode(pt8);
poly2.AppendNode(pt5);
poly2.AppendNode(pt15);
poly2.SetElevation(GetElevation());
pArrowUp2->SetPoly2D(poly2);
if(m_nStairFlag==SF_MIDDLE) //中间层
{
poly3.AppendNode(pt1);
poly3.AppendNode(pt4);
poly3.AppendNode(pt13);
poly3.SetElevation(GetElevation());
pArrowDown1->SetPoly2D(poly3);
XPoly2D poly4;
poly4.AppendNode(pt9);
poly4.AppendNode(pt12);
poly4.AppendNode(pt16);
poly4.SetElevation(GetElevation());
pArrowDown2->SetPoly2D(poly4);
}
}
}
else //边跑上楼
{
if(nSectStair==0) //中梯剖断
{
poly.AppendNode(pt1);
poly.AppendNode(pt4);
poly.AppendNode(pt5);
poly.AppendNode(pt6);
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);
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);
}
}
else if(nSectStair==2) //二跑剖断
{
poly.AppendNode(pt1);
poly.AppendNode(pt4);
poly.AppendNode(pt13);
XPoly2D poly4;
poly4.AppendNode(pt9);
poly4.AppendNode(pt12);
poly4.AppendNode(pt16);
poly4.SetElevation(GetElevation());
pArrowUp2->SetPoly2D(poly4);
if(m_nStairFlag==SF_MIDDLE) //中间层
{
poly3.AppendNode(pt8);
poly3.AppendNode(pt5);
poly3.AppendNode(pt14);
poly3.SetElevation(GetElevation());
pArrowDown1->SetPoly2D(poly3);
XPoly2D poly2;
poly2.AppendNode(pt8);
poly2.AppendNode(pt5);
poly2.AppendNode(pt15);
poly2.SetElevation(GetElevation());
pArrowDown2->SetPoly2D(poly2);
}
}
}
poly.SetElevation(GetElevation());
pArrowUp1->SetPoly2D(poly);
}
{
pArrowUp1->setPropertiesFrom(this);
//add by xlc on 090212
pArrowUp1->SetTextHeight(m_dTextHeight);
//modify by xlc on 090205
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 TDbDoubleMulStair::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 TDbDoubleMulStair::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
TDbDoubleMulStair::ExplodeOrDraw3d(XExplodeDraw &dc) const
{
if(m_nViewCtrl==1)
return Acad::eOk; //三维被禁止
assertReadEnabled();
TDbLineStair stair1, stair2, stair3, stair4, stair5;
TDbSlab slab, slabL, slabR;
TDbHandRail rail, rail2, railTop, railTop2,railOut1,railOut2;
ExplodeTo(stair1, stair2, stair3, stair4, stair5, slab, slabL, slabR, rail, rail2, &railTop, &railTop2,&railOut1,&railOut2);
if(m_nStairFlag==SF_TOP)
{
//del by xlc on 080624 删除水平段
/*{
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);
}
//二跑梯段
{
TPushProperty vProp(&stair4, dc);
if(dc.IsFullExplode())
{
stair4.ExplodeOrDraw3d(dc);
stair5.ExplodeOrDraw3d(dc);
}
else
{
dc.DrawEntity(stair4);
dc.DrawEntity(stair5);
}
}
//休息平台
if(m_nSlabSize>_DIST_SNAP)
{
TPushProperty vProp(&slab, dc);
if(dc.IsFullExplode())
{
slab.ExplodeOrDraw3d(dc);
slabL.ExplodeOrDraw3d(dc);
slabR.ExplodeOrDraw3d(dc);
}
else
{
dc.DrawEntity(slab);
dc.DrawEntity(slabL);
dc.DrawEntity(slabR);
}
}
{
//外侧扶手
if(IsOutRail())
{
if(dc.IsFullExplode())
{
railOut1.ExplodeOrDraw3d(dc);
if(m_nStairFlag==SF_FIRST)
railOut2.ExplodeOrDraw3d(dc);
}
else
{
dc.DrawEntity(railOut1);
if(m_nStairFlag==SF_FIRST)
dc.DrawEntity(railOut2);
}
// 外侧栏杆
if(IsAutoOutRail())
{
dc.SetColorLayer(colorIndex(), m_idLayerRail3d);
XPoly2D polyPath=railOut1.GetOutline();
//modify by xlc on 090122 修改栏杆画法,只在踏步中间画
// DrawRail(polyPath,m_nStepWidth,dc);
//
// polyPath=railOut2.GetOutline();
// DrawRail(polyPath,m_nStepWidth,dc);
double nDistToSide=m_nRailDistToSide+m_nRailWidth/2;
if(m_nStartSide==OFFSET_MID)
{
GetRailPolyFromStair(stair1,-nDistToSide,0,m_nRailDist,1,polyPath);
DrawRail(polyPath,m_nStepWidth,dc);
GetRailPolyFromStair(stair3,nDistToSide,0,m_nRailDist,0,polyPath);
DrawRail(polyPath,m_nStepWidth,dc);
GetRailPolyFromStair(stair4,-nDistToSide,0,0,1,polyPath);
DrawRail(polyPath,m_nStepWidth,dc);
GetRailPolyFromStair(stair5,nDistToSide,0,0,0,polyPath);
DrawRail(polyPath,m_nStepWidth,dc);
}
else
{
GetRailPolyFromStair(stair1,nDistToSide,m_nRailDistSide,0,0,polyPath);
DrawRail(polyPath,m_nStepWidth,dc);
GetRailPolyFromStair(stair3,-nDistToSide,m_nRailDistSide,0,1,polyPath);
DrawRail(polyPath,m_nStepWidth,dc);
GetRailPolyFromStair(stair4,nDistToSide,0,0,0,polyPath);
DrawRail(polyPath,m_nStepWidth,dc);
GetRailPolyFromStair(stair5,-nDistToSide,0,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=m_nRailDistToSide+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(stair4,nDistToSide,0,0,0,polyPath);
DrawRail(polyPath,m_nStepWidth,dc);
GetRailPolyFromStair(stair5,-nDistToSide,0,0,1,polyPath);
DrawRail(polyPath,m_nStepWidth,dc);
GetRailPolyFromStair(stair1,nDistToSide,0,m_nRailDistSide,0,polyPath);
DrawRail(polyPath,m_nStepWidth,dc);
GetRailPolyFromStair(stair3,-nDistToSide,0,m_nRailDistSide,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(stair4,-nDistToSide,0,0,1,polyPath);
DrawRail(polyPath,m_nStepWidth,dc);
GetRailPolyFromStair(stair5,nDistToSide,0,0,0,polyPath);
DrawRail(polyPath,m_nStepWidth,dc);
GetRailPolyFromStair(stair1,-nDistToSide,m_nRailDistSide,0,1,polyPath);
DrawRail(polyPath,m_nStepWidth,dc);
GetRailPolyFromStair(stair3,nDistToSide,m_nRailDistSide,0,0,polyPath);
DrawRail(polyPath,m_nStepWidth,dc);
}
}
}
}
return Acad::eOk;
}
bool TDbDoubleMulStair::IsClipMe(const TEntityBase* pEnt)const
{
if(TDbEntity::IsClipMe(pEnt))
return true;
if(pEnt->GetMe()->isKindOf(TDbColumn::desc()))
return true;
return false;
}
Acad::ErrorStatus
TDbDoubleMulStair::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, stair4, stair5;
TDbSlab slab, slabL, slabR;
TDbHandRail rail, rail2, railTop, railTop2,railOut1,railOut2;
ExplodeTo(stair1, stair2, stair3, stair4, stair5, slab, slabL, slabR, rail, rail2, NULL, NULL,&railOut1,&railOut2);
TDbSymbArrow pArrowUp1,pArrowUp2,pArrowDown1,pArrowDown2;
if(IsArrow()) //画箭头
{
GetDefaultArrow(stair1,stair2,stair3, stair4, stair5,&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);
stair4.AddTempRail(&rail);
stair2.AddTempRail(&rail2);
stair3.AddTempRail(&rail2);
stair5.AddTempRail(&rail2);
int nSectStair=GetSectStairPos();
if(IsOutRail()) //外侧扶手
{
stair4.AddTempRail(&railOut1);
railOut1.AddTempStair(&stair4);
if(m_nStairFlag == SF_FIRST)
{
stair5.AddTempRail(&railOut2);
railOut2.AddTempStair(&stair5);
stair1.AddTempRail(&railOut1);
railOut1.AddTempStair(&stair1);
stair3.AddTempRail(&railOut2);
railOut2.AddTempStair(&stair3);
}
else
{
stair5.AddTempRail(&railOut1);
railOut1.AddTempStair(&stair5);
stair1.AddTempRail(&railOut1);
railOut1.AddTempStair(&stair1);
stair3.AddTempRail(&railOut1);
railOut1.AddTempStair(&stair3);
}
}
double lSectPos,rSectPos;
XPoint ptLeft1,ptRight1,ptLeft2,ptRight2;
if(CalSectPos(lSectPos,rSectPos,ptLeft1,ptRight1,ptLeft2,ptRight2))
{
if(nSectStair == 0)
{
stair2.SetSectionPos(0, lSectPos);
stair2.SetSectionPos(1, rSectPos);
stair1.Set2DFlag(SF_NOSECT);
stair3.Set2DFlag(SF_NOSECT);
stair4.Set2DFlag(SF_NOSECT);
stair5.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);
stair4.Set2DFlag(SF_NOSECT);
stair5.Set2DFlag(SF_NOSECT);
}
else if(nSectStair == 2)
{
stair4.SetSectionPos(0, lSectPos);
stair4.SetSectionPos(1, rSectPos);
stair5.SetSectionPos(0, lSectPos);
stair5.SetSectionPos(1, rSectPos);
stair2.Set2DFlag(SF_NOSECT);
stair1.Set2DFlag(SF_NOSECT);
stair3.Set2DFlag(SF_NOSECT);
}
}
else
{
stair1.Set2DFlag(SF_NOSECT);
stair2.Set2DFlag(SF_NOSECT);
stair3.Set2DFlag(SF_NOSECT);
stair4.Set2DFlag(SF_NOSECT);
stair5.Set2DFlag(SF_NOSECT);
}
//显示梯段
if(dc.IsFullExplode())
{
if(m_nStairFlag!=SF_FIRST)
{
stair1.ExplodeOrDraw2d(dc);
stair2.ExplodeOrDraw2d(dc);
stair3.ExplodeOrDraw2d(dc);
stair4.ExplodeOrDraw2d(dc);
stair5.ExplodeOrDraw2d(dc);
}
else
{
if(m_nStartSide == OFFSET_MID)
{
stair2.ExplodeOrDraw2d(dc);
if(nSectStair==1) //剖切边梯
{
stair1.ExplodeOrDraw2d(dc);
stair3.ExplodeOrDraw2d(dc);
stair4.ExplodeOrDraw2d(dc);
stair5.ExplodeOrDraw2d(dc);
}
else if(nSectStair==2) //剖断二跑
{
stair4.ExplodeOrDraw2d(dc);
stair5.ExplodeOrDraw2d(dc);
}
}
else
{
stair1.ExplodeOrDraw2d(dc);
stair3.ExplodeOrDraw2d(dc);
if(nSectStair == 0) //剖切中梯
{
stair2.ExplodeOrDraw2d(dc);
stair4.ExplodeOrDraw2d(dc);
stair5.ExplodeOrDraw2d(dc);
}
else if(nSectStair==2) //剖断二跑
{
stair4.ExplodeOrDraw2d(dc);
stair5.ExplodeOrDraw2d(dc);
}
}
}
}
else
{
if(m_nStairFlag!=SF_FIRST)
{
dc.DrawEntity(stair1);
dc.DrawEntity(stair2);
dc.DrawEntity(stair3);
dc.DrawEntity(stair4);
dc.DrawEntity(stair5);
}
else
{
if(m_nStartSide == OFFSET_MID)
{
dc.DrawEntity(stair2);
if(nSectStair == 1) //剖切边梯
{
dc.DrawEntity(stair1);
dc.DrawEntity(stair3);
dc.DrawEntity(stair4);
dc.DrawEntity(stair5);
}
else if(nSectStair==2) //剖断二跑
{
dc.DrawEntity(stair4);
dc.DrawEntity(stair5);
}
}
else
{
dc.DrawEntity(stair1);
dc.DrawEntity(stair3);
if(nSectStair == 0) //剖切中梯
{
dc.DrawEntity(stair2);
dc.DrawEntity(stair4);
dc.DrawEntity(stair5);
}
else if(nSectStair==2) //剖断二跑
{
dc.DrawEntity(stair4);
dc.DrawEntity(stair5);
}
}
}
}
// 设置内侧扶手
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(nSectStair==2)
{
rail.SetTempStair(&stair4);
rail.setPropertiesFrom(this);
//if(m_nStairFlag != SF_TOP) //扶手合并
{
rail2.SetTempStair(&stair5);
rail2.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);
}
else if(nSectStair==2)
{
rail.SetTempStair(&stair4);
rail.setPropertiesFrom(this);
rail2.SetTempStair(&stair5);
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);
if(m_nStairFlag==SF_FIRST)
{
railOut2.ExplodeOrDraw2d(dc);
}
}
}
else
{
//首层中梯起步中梯剖断时不画外侧扶手
if(!(m_nStairFlag==SF_FIRST&&m_nStartSide==OFFSET_MID&&nSectStair==0))
{
dc.DrawEntity(railOut1);
if(m_nStairFlag==SF_FIRST)
{
dc.DrawEntity(railOut2);
}
}
}
}
//休息平台
if(m_nStairFlag!=SF_FIRST
||(m_nStairFlag==SF_FIRST && ((m_nStartSide == OFFSET_MID && nSectStair != 0)
||(m_nStartSide != OFFSET_MID && nSectStair == 0))))//中间休息台
{
slab.AddTempRail(&rail);
slab.AddTempRail(&rail2);
if(IsOutRail())
{
slab.AddTempRail(&railOut1);
if(m_nStairFlag==SF_FIRST)
slab.AddTempRail(&railOut2);
}
if(dc.IsFullExplode())
{
slab.ExplodeOrDraw2d(dc);
}
else
{
dc.DrawEntity(slab);
}
}
if(m_nStairFlag!=SF_FIRST
||(m_nStairFlag==SF_FIRST && ((m_nStartSide == OFFSET_MID && nSectStair == 1)
||(m_nStartSide != OFFSET_MID && nSectStair != 1))))//两侧休息台
{
slabL.AddTempRail(&rail);
slabR.AddTempRail(&rail2);
if(IsOutRail())
{
slabL.AddTempRail(&railOut1);
if(m_nStairFlag==SF_FIRST)
{
slabR.AddTempRail(&railOut2);
}
else
{
slabR.AddTempRail(&railOut1);
}
}
if(dc.IsFullExplode())
{
slabL.ExplodeOrDraw2d(dc);
slabR.ExplodeOrDraw2d(dc);
}
else
{
dc.DrawEntity(slabL);
dc.DrawEntity(slabR);
}
}
}
return Acad::eOk;
}
// From TDbPolyPathEnt
Acad::ErrorStatus
TDbDoubleMulStair::GetPathPoly(XPoly2D &polyPath,AcGeVector3d&normal) const
{
assertReadEnabled();
TDbLineStair stair1, stair2, stair3, stair4, stair5;
TDbSlab slab, slabL, slabR;
TDbHandRail rail, rail2, railTop, railTop2;
ExplodeTo(stair1, stair2, stair3, stair4, stair5, slab, slabL, slabR, rail, rail2, &railTop, &railTop2);
/* if(m_nStairFlag==SF_TOP)
railTop.GetBindPath(polyPath,normal);
else */
rail.GetBindPath(polyPath,normal);
return Acad::eOk;
}
Acad::ErrorStatus
TDbDoubleMulStair::SetPathPoly(const XPoly2D &polyPath,const AcGeVector3d&normal)
{
return Acad::eNotApplicable;
}
BOOL TDbDoubleMulStair::CalSectPos(double &lSectPos,double &rSectPos,XPoint &ptLeft1,XPoint &ptRight1,XPoint &ptLeft2,XPoint &ptRight2)const
{
if(m_nStairFlag == SF_TOP)
return FALSE;
int nSectStair=GetSectStairPos();
if(nSectStair == -1) //剖断位置不正确
return FALSE;
TDbLineStair stair1, stair2, stair3, stair4, stair5;
TDbSlab slab, slabL, slabR;
TDbHandRail rail, rail2;
ExplodeTo(stair1, stair2, stair3, stair4, stair5, slab, slabL, slabR, rail, rail2);
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+m_nStepNum3+1;
}
if((nSectStair==1&&m_nStartSide!=OFFSET_MID&&nSectStepNum==m_nStepNum1)
||(nSectStair==0&&m_nStartSide==OFFSET_MID&&nSectStepNum==m_nStepNum2)
||(nSectStair==2&&(nSectStepNum==(m_nStepNum3+(m_nStartSide==OFFSET_MID?m_nStepNum2:m_nStepNum1))))
||nSectStepNum==m_nStepNum1+m_nStepNum2+m_nStepNum3)
{
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+m_nStepNum3);
}
}
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+m_nStepNum3);
}
}
else if(nSectStair == 2)//二跑梯段
{
cvLeft1=stair4.GetSideCurve2d(0);
cvRight1=stair4.GetSideCurve2d(1);
width=stair4.GetStairWidth()*0.5;
length=stair4.GetStairLength();
if(m_nStartSide==OFFSET_MID)
{
len-=m_nStepWidth*(m_nStepNum2);
}
else
{
len-=m_nStepWidth*(m_nStepNum1);
}
}
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;
}
}
lSectPos=(len-dLen)/length;
rSectPos=(len+dLen)/length;
XPointDir2d pt;
cvLeft1.Polar(len-dLen, pt);
ptLeft1=pt;
cvRight1.Polar(len+dLen, pt);
ptRight1=pt;
if(nSectStair == 1)
{
XDirectionCurve cvLeft2,cvRight2;
cvLeft2=stair3.GetSideCurve2d(0);
cvRight2=stair3.GetSideCurve2d(1);
cvLeft2.Polar(len-dLen, pt);
ptLeft2=pt;
cvRight2.Polar(len+dLen, pt);
ptRight2=pt;
}
else if(nSectStair == 2)
{
XDirectionCurve cvLeft2,cvRight2;
cvLeft2=stair5.GetSideCurve2d(0);
cvRight2=stair5.GetSideCurve2d(1);
cvLeft2.Polar(len-dLen, pt);
ptLeft2=pt;
cvRight2.Polar(len+dLen, pt);
ptRight2=pt;
}
return TRUE;
}
//获得剖断线所在梯段:0,中梯段;1,边梯段;2,二跑;-1,没有剖断
int TDbDoubleMulStair::GetSectStairPos()const
{
if(m_nStairFlag==SF_TOP)
return -1;
if(abs(m_nSectStepNum)<1|| abs(m_nSectStepNum)>m_nStepNum1+m_nStepNum2+m_nStepNum3)
{
return -1;
}
int nSectStepNum=m_nSectStepNum; //剖断步数
if(nSectStepNum < 0) //负数调整为正的
{
nSectStepNum=m_nSectStepNum+m_nStepNum1+m_nStepNum2+m_nStepNum3+1;
}
int nSectStair;
if((m_nStartSide==OFFSET_MID&&nSectStepNum<=m_nStepNum2)
||(m_nStartSide!=OFFSET_MID&&nSectStepNum>m_nStepNum1+m_nStepNum3)
)
{
nSectStair=0; //剖断在中梯
}
else if((m_nStartSide!=OFFSET_MID&&nSectStepNum<=m_nStepNum1)
||(m_nStartSide==OFFSET_MID&&nSectStepNum>m_nStepNum2+m_nStepNum3))
{
nSectStair=1; //剖断在边梯
}
else
{
nSectStair=2; //剖断在二跑
}
return nSectStair;
}
// 由平面二维点推算剖切步数
int TDbDoubleMulStair::HitSectPosByPoint2d(XPoint ptHit2d) const
{
TDbLineStair stair1, stair2,stair3,stair4,stair5;
TDbSlab slab,slabL,slabR;
TDbHandRail rail, rail2;
ExplodeTo(stair1, stair2, stair3,stair4,stair5, slab,slabL,slabR, 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+m_nStepNum3+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+m_nStepNum3+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+m_nStepNum3+1;
}
else
{
nPosHit += 1;
}
}
else
{
XDirectionCurve cvLeft4=stair4.GetSideCurve2d(0);
XDirectionCurve cvRight4=stair4.GetSideCurve2d(1);
XPoly2D poly4(1);
poly4.AppendNode(cvLeft4.StartPoint());
poly4.AppendNode(cvRight4.StartPoint());
poly4.AppendNode(cvRight4.EndPoint());
poly4.AppendNode(cvLeft4.EndPoint());
if((ptHit2d&poly4)!=PR_OUTSIDE)//剖切二跑左梯段
{
XPoint ptPrj;
cvLeft4.ProjectToMe(ptHit2d, ptPrj);
nPosHit=(int)(ptPrj.Distance2d(cvLeft4.StartPoint())/m_nStepWidth);
if(m_nStartSide == OFFSET_MID)
{
nPosHit += m_nStepNum2+1;
}
else
{
nPosHit += m_nStepNum1+1;
}
}
else
{
XDirectionCurve cvLeft5=stair5.GetSideCurve2d(0);
XDirectionCurve cvRight5=stair5.GetSideCurve2d(1);
XPoly2D poly5(1);
poly5.AppendNode(cvLeft5.StartPoint());
poly5.AppendNode(cvRight5.StartPoint());
poly5.AppendNode(cvRight5.EndPoint());
poly5.AppendNode(cvLeft5.EndPoint());
if((ptHit2d&poly5)!=PR_OUTSIDE)//剖切二跑右梯段
{
XPoint ptPrj;
cvLeft5.ProjectToMe(ptHit2d, ptPrj);
nPosHit=(int)(ptPrj.Distance2d(cvLeft5.StartPoint())/m_nStepWidth);
if(m_nStartSide == OFFSET_MID)
{
nPosHit += m_nStepNum2+1;
}
else
{
nPosHit += m_nStepNum1+1;
}
}
}
}
}
}
return nPosHit;
}
double
TDbDoubleMulStair::GetTextHeight()const
{
assertReadEnabled();
return m_dTextHeight;
}
void
TDbDoubleMulStair::SetTextHeight(double h)
{
assertWriteEnabled();
m_dTextHeight=h;
}
Adesk::UInt8
TDbDoubleMulStair::GetStepNum1() const
{
assertReadEnabled();
return m_nStepNum1;
}
Adesk::UInt8
TDbDoubleMulStair::GetStepNum2() const
{
assertReadEnabled();
return m_nStepNum2;
}
Adesk::UInt8
TDbDoubleMulStair::GetStepNum3() const
{
assertReadEnabled();
return m_nStepNum3;
}
double
TDbDoubleMulStair::GetStepHeight() const
{
assertReadEnabled();
return m_nStepHeight;
}
void
TDbDoubleMulStair::SetStepNum1(Adesk::UInt8 n)
{
assertWriteEnabled();
m_nStepNum1=n;
}
void
TDbDoubleMulStair::SetStepNum2(Adesk::UInt8 n)
{
assertWriteEnabled();
m_nStepNum2=n;
}
void
TDbDoubleMulStair::SetStepNum3(Adesk::UInt8 n)
{
assertWriteEnabled();
m_nStepNum3=n;
}
double
TDbDoubleMulStair::GetSlabSize() const
{
assertReadEnabled();
return m_nSlabSize;
}
double
TDbDoubleMulStair::GetSlabSizeM() const
{
assertReadEnabled();
return m_nSlabSizeM;
}
double
TDbDoubleMulStair::GetSlabWidth() const
{
assertReadEnabled();
return m_nSlabWidth;
}
double
TDbDoubleMulStair::GetSlabWidthM() const
{
assertReadEnabled();
return m_nSlabWidthM;
}
double
TDbDoubleMulStair::GetRailHeight() const
{
assertReadEnabled();
return m_nRailHeight;
}
double
TDbDoubleMulStair::GetRailWidth() const
{
assertReadEnabled();
return m_nRailWidth;
}
double
TDbDoubleMulStair::GetRailDistToSide() const
{
assertReadEnabled();
return m_nRailDistToSide;
}
double
TDbDoubleMulStair::GetRailDist() const
{
assertReadEnabled();
return m_nRailDist;
}
double
TDbDoubleMulStair::GetRailDistSide() const
{
assertReadEnabled();
return m_nRailDistSide;
}
double
TDbDoubleMulStair::GetSpaceWidth() const
{
assertReadEnabled();
return m_nSlabWidth*2+m_nSlabWidthM+m_nStepWidth*(m_nStepNum3-1)*2;
}
double
TDbDoubleMulStair::GetStairWidth() const
{
assertReadEnabled();
return m_nStairWidth;
}
double
TDbDoubleMulStair::GetMStairWidth() const
{
assertReadEnabled();
return m_nMStairWidth;
}
double
TDbDoubleMulStair::GetStairWidth2() const
{
assertReadEnabled();
return m_nStairWidth2;
}
double
TDbDoubleMulStair::GetStepWidth() const
{
assertReadEnabled();
return m_nStepWidth;
}
Adesk::UInt8
TDbDoubleMulStair::GetStairFlag() const
{
assertReadEnabled();
return m_nStairFlag;
}
int
TDbDoubleMulStair::GetSectStepNum()const
{
assertReadEnabled();
return m_nSectStepNum;
}
double
TDbDoubleMulStair::GetElevation() const
{
assertReadEnabled();
return m_ptLocation.z;
}
XPoint
TDbDoubleMulStair::GetLocation() const
{
assertReadEnabled();
return m_ptLocation;
}
double
TDbDoubleMulStair::GetRotation() const
{
assertReadEnabled();
return m_nRotation;
}
int
TDbDoubleMulStair::GetStartSide() const
{
assertReadEnabled();
return m_nStartSide;
}
int
TDbDoubleMulStair::GetAlignment() const
{
assertReadEnabled();
return m_nAlignment;
}
XPoint
TDbDoubleMulStair::GetUpRight2d() const
{
assertReadEnabled();
XPoint pt=GetUpMid2d();
double dWidth=m_nSlabWidth+m_nSlabWidthM*0.5+(m_nStepNum3-1)*m_nStepWidth;
ads_polar(XPoint(pt), m_nRotation, dWidth, pt);
return pt;
}
XPoint
TDbDoubleMulStair::GetUpLeft2d() const
{
assertReadEnabled();
XPoint pt=m_ptLocation;
pt.z=0;
return pt;
}
XPoint
TDbDoubleMulStair::GetUpMid2d() const
{
assertReadEnabled();
XPoint pt=GetUpLeft2d();
double dWidth=m_nSlabWidth+m_nSlabWidthM*0.5+(m_nStepNum3-1)*m_nStepWidth;
ads_polar(XPoint(pt), m_nRotation, dWidth, pt);
return pt;
}
void
TDbDoubleMulStair::SetSlabSize(double s)
{
assertWriteEnabled();
m_nSlabSize=s;
}
void
TDbDoubleMulStair::SetSlabSizeM(double s)
{
assertWriteEnabled();
m_nSlabSizeM=s;
}
void
TDbDoubleMulStair::SetSlabWidth(double s)
{
assertWriteEnabled();
m_nSlabWidth=s;
}
void
TDbDoubleMulStair::SetSlabWidthM(double s)
{
assertWriteEnabled();
m_nSlabWidthM=s;
}
void
TDbDoubleMulStair::SetRailHeight(double l)
{
assertWriteEnabled();
m_nRailHeight=l;
}
void
TDbDoubleMulStair::SetRailWidth(double w)
{
assertWriteEnabled();
m_nRailWidth=w;
}
void
TDbDoubleMulStair::SetRailDistToSide(double l)
{
assertWriteEnabled();
m_nRailDistToSide=l;
}
void
TDbDoubleMulStair::SetRailDist(double l)
{
assertWriteEnabled();
m_nRailDist=l;
}
void
TDbDoubleMulStair::SetRailDistSide(double l)
{
assertWriteEnabled();
m_nRailDistSide=l;
}
void
TDbDoubleMulStair::SetStairFlag(Adesk::UInt8 flag)
{
assertWriteEnabled();
m_nStairFlag=flag;
}
void
TDbDoubleMulStair::SetSpaceWidth(double w)
{
assertWriteEnabled();
m_nSpaceWidth=w;
}
void
TDbDoubleMulStair::SetStepWidth(double w)
{
assertWriteEnabled();
m_nStepWidth=w;
}
void
TDbDoubleMulStair::SetStairWidth(double w)
{
assertWriteEnabled();
m_nStairWidth=w;
}
void
TDbDoubleMulStair::SetMStairWidth(double w)
{
assertWriteEnabled();
m_nMStairWidth=w;
}
void
TDbDoubleMulStair::SetStairWidth2(double w)
{
assertWriteEnabled();
m_nStairWidth2=w;
}
void
TDbDoubleMulStair::SetElevation(double elev)
{
assertWriteEnabled();
m_ptLocation.z = elev;
}
void
TDbDoubleMulStair::SetLocation(const XPoint &pt)
{
assertWriteEnabled();
m_ptLocation = pt;
}
void
TDbDoubleMulStair::SetRotation(double rot)
{
assertWriteEnabled();
m_nRotation=rot;
}
void
TDbDoubleMulStair::SetStartSide(int nSide)
{
assertWriteEnabled();
m_nStartSide=nSide;
}
void
TDbDoubleMulStair::SetAlignment(int nSide)
{
assertWriteEnabled();
m_nAlignment=nSide;
}
void
TDbDoubleMulStair::SetStepHeight(double h)
{
assertWriteEnabled();
m_nStepHeight=h;
}
void TDbDoubleMulStair::SetArrow(BOOL bTrue)
{
assertWriteEnabled();
if(bTrue)
m_nFlagEx|=SFEX_ARROW;
else
m_nFlagEx&=~SFEX_ARROW;
}
BOOL TDbDoubleMulStair::IsArrow() const
{
return ((m_nFlagEx&SFEX_ARROW)!=0);
}
BOOL TDbDoubleMulStair::IsAutoOutRail() const
{
return ((m_nFlagEx&SFEX_AUTOOUTRAIL)!=0);
}
BOOL TDbDoubleMulStair::IsAutoRail() const
{
return ((m_nFlagEx&SFEX_AUTORAIL)!=0);
}
BOOL TDbDoubleMulStair::IsOutRail()const
{
return (m_nFlagEx&SFEX_OUTRAIL)!=0;
}
void TDbDoubleMulStair::SetOutRail(BOOL bTrue)
{
assertWriteEnabled();
if(bTrue)
m_nFlagEx|=SFEX_OUTRAIL;
else
m_nFlagEx&=~SFEX_OUTRAIL;
}
BOOL TDbDoubleMulStair::IsArcPlatform() const
{
return ((m_nFlagEx&SFEX_ARCPLAT)!=0);
}
BOOL TDbDoubleMulStair::HasSideBeam(int nSide) const
{
int nBitFlag=nSide? SFEX_RBEAM : SFEX_LBEAM;
return ((m_nFlagEx&nBitFlag)!=0);
}
BOOL TDbDoubleMulStair::IsAscent() const
{
return ((m_nFlagEx&SFEX_ASCENT)!=0);
}
BOOL TDbDoubleMulStair::IsOnGround() const
{
return ((m_nFlagEx&SFEX_GROUND)!=0);
}
BOOL TDbDoubleMulStair::HasSlant() const
{
return ((m_nFlagEx&SFEX_SLANT)!=0);
}
void TDbDoubleMulStair::SetAutoOutRail(BOOL bTrue)
{
assertWriteEnabled();
if(bTrue)
m_nFlagEx |= SFEX_AUTOOUTRAIL;
else
m_nFlagEx &= ~SFEX_AUTOOUTRAIL;
}
void TDbDoubleMulStair::SetAutoRail(BOOL bTrue)
{
assertWriteEnabled();
if(bTrue)
m_nFlagEx |= SFEX_AUTORAIL;
else
m_nFlagEx &= ~SFEX_AUTORAIL;
}
void TDbDoubleMulStair::SetAscent(BOOL bTrue)
{
assertWriteEnabled();
if(bTrue)
m_nFlagEx |= SFEX_ASCENT;
else
m_nFlagEx &= ~SFEX_ASCENT;
}
void TDbDoubleMulStair::SetOnGround(BOOL bTrue)
{
assertWriteEnabled();
if(bTrue)
m_nFlagEx |= SFEX_GROUND;
else
m_nFlagEx &= ~SFEX_GROUND;
}
void TDbDoubleMulStair::SetSlant(BOOL bTrue)
{
assertWriteEnabled();
if(bTrue)
m_nFlagEx |= SFEX_SLANT;
else
m_nFlagEx &= ~SFEX_SLANT;
}
void TDbDoubleMulStair::SetArcPlatform(BOOL bTrue)
{
assertWriteEnabled();
if(bTrue)
m_nFlagEx |= SFEX_ARCPLAT;
else
m_nFlagEx &= ~SFEX_ARCPLAT;
}
void TDbDoubleMulStair::SetSideBeam(int nSide, BOOL bTrue)
{
assertWriteEnabled();
int nBitFlag=nSide? SFEX_RBEAM : SFEX_LBEAM;
if(bTrue)
m_nFlagEx |= nBitFlag;
else
m_nFlagEx &= ~nBitFlag;
}
double TDbDoubleMulStair::GetBeamHeight() const
{
return m_nBeamHeight;
}
double TDbDoubleMulStair::GetBeamThick() const
{
return m_nBeamThick;
}
double TDbDoubleMulStair::GetSlabThick() const
{
return m_nSlabThick;
}
AcDbObjectId TDbDoubleMulStair::GetLayerBeam3d() const
{
return m_idLayerBeam3d;
}
AcDbObjectId TDbDoubleMulStair::GetLayerStep3d() const
{
return m_idLayerStep3d;
}
AcDbObjectId TDbDoubleMulStair::GetLayerHand3d() const
{
return m_idLayerHand3d;
}
AcDbObjectId TDbDoubleMulStair::GetLayerRail3d() const
{
return m_idLayerRail3d;
}
AcDbObjectId TDbDoubleMulStair::GetLayerText() const
{
return m_idLayerText;
}
AcDbObjectId TDbDoubleMulStair::GetTextStyle() const
{
return m_idTextStyle;
}
AcDbObjectId TDbDoubleMulStair::GetLayerArrow() const
{
return m_idLayerArrow;
}
void TDbDoubleMulStair::SetBeamHeight(double val)
{
assertWriteEnabled();
m_nBeamHeight = val;
}
void TDbDoubleMulStair::SetSlabThick(double val)
{
assertWriteEnabled();
m_nSlabThick=val;
}
void TDbDoubleMulStair::SetBeamThick(double val)
{
assertWriteEnabled();
m_nBeamThick=val;
}
void TDbDoubleMulStair::SetLayerBeam3d(AcDbObjectId idLayer)
{
assertWriteEnabled();
m_idLayerBeam3d=idLayer;
}
void TDbDoubleMulStair::SetLayerStep3d(AcDbObjectId idLayer)
{
assertWriteEnabled();
m_idLayerStep3d=idLayer;
}
void TDbDoubleMulStair::SetLayerHand3d(AcDbObjectId idLayer)
{
assertWriteEnabled();
m_idLayerHand3d=idLayer;
}
void TDbDoubleMulStair::SetLayerRail3d(AcDbObjectId idLayer)
{
assertWriteEnabled();
m_idLayerRail3d=idLayer;
}
void TDbDoubleMulStair::SetLayerText(AcDbObjectId idLayer)
{
assertWriteEnabled();
m_idLayerText=idLayer;
}
void TDbDoubleMulStair::SetTextStyle(AcDbObjectId idStyle)
{
assertWriteEnabled();
m_idTextStyle=idStyle;
}
void TDbDoubleMulStair::SetLayerArrow(AcDbObjectId idLayer)
{
assertWriteEnabled();
m_idLayerArrow=idLayer;
}
void TDbDoubleMulStair::SetSectStepNum(int n)
{
assertWriteEnabled();
m_nSectStepNum=n;
}
double TDbDoubleMulStair::GetSectRotation()const
{
return m_dSectRotation;
}
void TDbDoubleMulStair::SetSectRotation(double r)
{
assertWriteEnabled();
m_dSectRotation=r;
}
//add by xlc 090426,箭头文字,动态数据
CString TDbDoubleMulStair::GetTextUp() const
{
assertReadEnabled();
CString sVal(_T("上"));
const TEntityFields &fd = GetFields();
fd.GFD(_T("上楼箭头文字"), sVal);
return sVal;
}
void TDbDoubleMulStair::SetTextUp(const TCHAR *sVal)
{
assertWriteEnabled();
TEntityFields &fd = Fields();
fd.SFD(_T("上楼箭头文字"), sVal);
}
CString TDbDoubleMulStair::GetTextDown() const
{
assertReadEnabled();
CString sVal(_T("下"));
const TEntityFields &fd = GetFields();
fd.GFD(_T("下楼箭头文字"), sVal);
return sVal;
}
void TDbDoubleMulStair::SetTextDown(const TCHAR *sVal)
{
assertWriteEnabled();
TEntityFields &fd = Fields();
fd.SFD(_T("下楼箭头文字"), sVal);
}
// sg add 101115,支持统一标高
bool TDbDoubleMulStair::UnifyElevation(double dElevation)
{
assertWriteEnabled();
SetElevation(dElevation);
return true;
}
// cet 2013.9.5 add
CString TDbDoubleMulStair::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 InitDbDoubleMulStair(BOOL bTrue)
{
if(bTrue)
{
TDbDoubleMulStair::rxInit();
acrxBuildClassHierarchy();
TDbDoubleMulStair::InitMatchProtocol(TRUE);
}
else
{
TDbDoubleMulStair::InitMatchProtocol(FALSE);
deleteAcRxClass(TDbDoubleMulStair::desc());
}
}