Files
gjm 164968b62e chore
把非utf8-bom编码的cpp/h文件改为 utf8 bom 编码, msvc识别utf8编码时,如果不是bom格式的,会使用当前cp_oem来解码.
2026-10-04 00:04:20 +08:00

2967 lines
72 KiB
C++

#include "stdafx.h"
#include "TDbColumn.h"
//////////////////////////////////////////////////
// ver: 0-TArch8
const Adesk::UInt8 TDbAutoStair::g_nVersion = 0;
ACRX_DXF_DEFINE_MEMBERS(ATSAutoStair, ATSPolyPathEnt, AcDb::kDHL_CURRENT, AcDb::kMReleaseCurrent,
1, ATS_AUTOSTAIR, "ATS_AUTOSTAIR图形无法解析, 请下载上华软件|网址: www.shanghuasoft.com");
IMPLEMENT_TENTBASE(TDbAutoStair);
TDbAutoStair::TDbAutoStair()
{
m_nStepHeight=_AS_SYS_UNIT(220.0); //踏步高
m_nStepWidth=_AS_SYS_UNIT(300); //踏步宽
m_nStairWidth=_AS_SYS_UNIT(1200); //梯段宽
m_nRotation=0.0; //旋转角度
m_nRailHeight=_AS_SYS_UNIT(900); //扶手高
m_nStairFlag=1; //楼层标记
m_nRailWidth=_AS_SYS_UNIT(60.0); //扶手宽度
m_nStepDist=_AS_SYS_UNIT(949); //平步伸出距离
m_nSlabSize=_AS_SYS_UNIT(2200); //平台尺寸
m_nStartSide=OFFSET_LEFT; //双梯起步的一侧
m_nFlagEx=0;
m_nSlabThick=_AS_SYS_UNIT(120); //板厚或梁厚
m_nViewCtrl=0; //自动确定
m_dTextHeight=3.5;
m_dFloorHeight=_AS_SYS_UNIT(3000);
m_dSlopeAngle=30;
m_dSlopeLength=_AS_SYS_UNIT(6000);
m_dSpaceWidth=_AS_SYS_UNIT(100);
m_dHoleLength=m_nSlabSize;
m_rSectPos=0.6; //右侧剖切位置
m_lSectPos=0.4; //左侧剖切位置
}
TDbAutoStair::~TDbAutoStair()
{
}
BOOL TDbAutoStair::IsValid() const
{
BOOL bRet=TDbEntity::IsValid();
if(!bRet)
return bRet;
bRet=(m_nStepWidth>_DIST_SNAP && //踏步宽
m_nStairWidth>_DIST_SNAP && //梯段宽
m_nRailHeight>_DIST_SNAP && //扶手高
m_nRailWidth>_DIST_SNAP && //扶手宽
m_dTextHeight>0&& //字高
m_dFloorHeight>0&& //楼层高
m_nSlabSize>_DIST_SNAP&& //平台宽
m_dSlopeLength>_DIST_SNAP&& //坡道长
GreatEqual(m_nStepDist, 0.0)&& //平步距离
GreatEqual(m_dSpaceWidth, 0.0)&&//双梯间距
GreatEqual(m_nSlabThick, 0.0)); //休息台厚
if(bRet)
{
if(m_nStairFlag!=SF_TOP) //剖切位置
{
bRet=(m_lSectPos>0&&
m_lSectPos<1&&
m_rSectPos>0&&
m_rSectPos<1);
}
}
return bRet;
}
// 提供对格式刷的支持
void TDbAutoStair::CopyPropertiesFrom(AcDbEntity *pSrcEntity, unsigned gMatchFlag)
{
assertWriteEnabled();
TDbPolyPathEnt::CopyPropertiesFrom(pSrcEntity, gMatchFlag);
TDbAutoStair *pSrc=TDbAutoStair::cast(pSrcEntity);
if(pSrc) {
m_nStepHeight=pSrc->m_nStepHeight;
m_nStepWidth=pSrc->m_nStepWidth;
m_nStairWidth=pSrc->m_nStairWidth;
m_dSpaceWidth=pSrc->m_dSpaceWidth;
m_nRailHeight=pSrc->m_nRailHeight;
m_nRailWidth=pSrc->m_nRailWidth;
m_nStairFlag=pSrc->m_nStairFlag;
m_nStartSide=pSrc->m_nStartSide;
m_nStepDist=pSrc->m_nStepDist;
m_nSlabSize=pSrc->m_nSlabSize;
m_dTextHeight=pSrc->m_dTextHeight;
m_dFloorHeight=pSrc->m_dFloorHeight;
m_dSlopeAngle=pSrc->m_dSlopeAngle;
m_dSlopeLength=pSrc->m_dSlopeLength;
m_dHoleLength=pSrc->m_dHoleLength;
m_lSectPos=pSrc->m_lSectPos;
m_rSectPos=pSrc->m_rSectPos;
m_nFlagEx=pSrc->m_nFlagEx;
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_idLayerStep3d=pSrc->m_idLayerStep3d;
m_idLayerArrow=pSrc->m_idLayerArrow;
m_idLayerText=pSrc->m_idLayerText;
m_idTextStyle=pSrc->m_idTextStyle;
}
m_nViewCtrl=pSrc->m_nViewCtrl;
}
}
Acad::ErrorStatus
TDbAutoStair::subGetClassID(CLSID* pClsid) const
{
return Acad::eOk;
}
// 从DWG读入数据:
Acad::ErrorStatus
TDbAutoStair::dwgInFields (AcDbDwgFiler* pFiler)
{
assertWriteEnabled();
Acad::ErrorStatus es = TDbPolyPathEnt::dwgInFields(pFiler);
if(es != Acad::eOk) return es;
Adesk::UInt8 nVer;
pFiler->readItem(&nVer);
if(nVer>g_nVersion) {// Version is too new
return Acad::eMakeMeProxy;
}
pFiler->readItem((AcGePoint3d *)&m_ptLocation);
pFiler->readItem(&m_nRotation); //旋转角度
pFiler->readItem(&m_nStepHeight); //踏步高
pFiler->readItem(&m_nStepWidth); //踏步宽
pFiler->readItem(&m_nStairWidth); //梯段宽
pFiler->readItem(&m_nSlabSize); //休息平台尺寸
pFiler->readItem(&m_dSpaceWidth); //梯段间距
pFiler->readItem(&m_nRailHeight); //扶手高
pFiler->readItem(&m_nStairFlag); //楼层标记
pFiler->readItem(&m_nRailWidth); //扶手宽
pFiler->readItem(&m_lSectPos); //左侧剖切位置
pFiler->readItem(&m_rSectPos); //右侧剖切位置
pFiler->readItem(&m_nStepDist); //平步伸出距离
pFiler->readItem(&m_dTextHeight); //字高
pFiler->readItem(&m_dFloorHeight); //楼层高
pFiler->readItem(&m_dSlopeAngle); //坡角(角度值)
pFiler->readItem(&m_dSlopeLength); //坡长
pFiler->readItem(&m_dHoleLength); //洞口长度
pFiler->readItem(&m_nStartSide); //双梯起步侧
pFiler->readItem(&m_nFlagEx);
pFiler->readItem(&m_nSlabThick);
pFiler->readItem(&m_idLayerStep3d);
pFiler->readItem(&m_idLayerText);
pFiler->readItem(&m_idTextStyle);
pFiler->readItem(&m_idLayerArrow);
pFiler->readItem(&m_nViewCtrl);
return pFiler->filerStatus();
}
Acad::ErrorStatus
TDbAutoStair::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_nSlabSize); //平台尺寸
pFiler->writeItem(m_dSpaceWidth); //梯段间距
pFiler->writeItem(m_nRailHeight); //扶手高度
pFiler->writeItem(m_nStairFlag); //楼层标记
pFiler->writeItem(m_nRailWidth); //扶手宽
pFiler->writeItem(m_lSectPos); //左侧剖切位置
pFiler->writeItem(m_rSectPos); //右侧剖切位置
pFiler->writeItem(m_nStepDist); //平步伸出距离
pFiler->writeItem(m_dTextHeight); //字高
pFiler->writeItem(m_dFloorHeight); //楼层高
pFiler->writeItem(m_dSlopeAngle); //坡角(角度值)
pFiler->writeItem(m_dSlopeLength); //坡长
pFiler->writeItem(m_dHoleLength); //洞口长度
pFiler->writeItem(m_nStartSide); //双梯起步侧
pFiler->writeItem(m_nFlagEx);
pFiler->writeItem(m_nSlabThick);
pFiler->writeItem(m_idLayerStep3d);
pFiler->writeItem(m_idLayerText);
pFiler->writeItem(m_idTextStyle);
pFiler->writeItem(m_idLayerArrow);
pFiler->writeItem(m_nViewCtrl);
return pFiler->filerStatus();
}
Acad::ErrorStatus
TDbAutoStair::dxfInFields (AcDbDxfFiler* pFiler)
{
assertWriteEnabled();
Acad::ErrorStatus es = TDbPolyPathEnt::dxfInFields(pFiler);
if(es!=Acad::eOk)
return es;
if (!pFiler->atSubclassData(_T("TDbAutoStair"))) {
return Acad::eBadDxfSequence;
}
Adesk::Int32 fieldsFlags=0;
resbuf rb;
double r1, r2, r3, r4, r5, r6, r7, r9;
int i1;
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:
m_dSlopeAngle=rb.resval.rreal;
break;
case AcDb::kDxfReal+8:
m_dSlopeLength=rb.resval.rreal;
break;
case AcDb::kDxfReal+9:
m_nStepDist=rb.resval.rreal;
break;
case AcDb::kDxfReal+11:
m_dFloorHeight=rb.resval.rreal;
break;
case AcDb::kDxfReal+12:
m_dTextHeight=rb.resval.rreal;
break;
case AcDb::kDxfReal+13:
m_lSectPos=rb.resval.rreal;
break;
case AcDb::kDxfReal+14:
m_rSectPos=rb.resval.rreal;
break;
case AcDb::kDxfReal+15:
m_dHoleLength=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:
m_nStartSide=(Adesk::UInt8)rb.resval.rint;
break;
case AcDb::kDxfInt16+2:
m_nViewCtrl=(Adesk::UInt8)rb.resval.rint;
break;
case 90:
m_nFlagEx=rb.resval.rlong;
break;
case 147:
m_nSlabThick=rb.resval.rreal;
break;
case 412:
m_idLayerStep3d=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;
}
m_ptLocation=pt;
SetStepHeight(r1);
SetSpaceWidth(r2);
SetSlabSize(r3);
SetStepWidth(r4);
SetStairWidth(r5);
if(fieldsFlags&0x40)
SetRailHeight(r6);
if(fieldsFlags&0x80)
SetRailWidth(r7);
if(fieldsFlags&0x200)
SetRotation(r9);
if(fieldsFlags&0x400)
SetStairFlag(i1);
return pFiler->filerStatus();
}
Acad::ErrorStatus
TDbAutoStair::dxfOutFields(AcDbDxfFiler* pFiler) const
{
assertReadEnabled();
Acad::ErrorStatus es;
es = TDbPolyPathEnt::dxfOutFields(pFiler);
assert(es == Acad::eOk);
es = pFiler->writeItem(AcDb::kDxfSubclass,_T("TDbAutoStair"));
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, GetSlopeAngle());
pFiler->writeDouble(AcDb::kDxfReal+8, GetSlopeLength());
pFiler->writeDouble(AcDb::kDxfReal+11, GetFloorHeight());
pFiler->writeDouble(AcDb::kDxfReal+12, GetTextHeight());
pFiler->writeDouble(AcDb::kDxfReal+13, GetLSectPos());
pFiler->writeDouble(AcDb::kDxfReal+14, GetRSectPos());
pFiler->writeDouble(AcDb::kDxfReal+15, GetHoleLength());
pFiler->writeDouble(AcDb::kDxfReal+9, GetStepDist());
pFiler->writeDouble(AcDb::kDxfAngle, GetRotation());
pFiler->writeInt16(AcDb::kDxfInt16, GetStairFlag());
pFiler->writeInt16(AcDb::kDxfInt16+1, GetStartSide());
pFiler->writeInt16(AcDb::kDxfInt16+2, m_nViewCtrl);
pFiler->writeInt32(90, m_nFlagEx);
pFiler->writeDouble(147, m_nSlabThick);
pFiler->writeString(412, (const TCHAR *)LayerId2String(m_idLayerStep3d));
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
TDbAutoStair::subGetGripPoints(AcGePoint3dArray& gripPoints,
AcDbIntArray& osnapModes,
AcDbIntArray& geomIds) const
{
assertReadEnabled();
double dWidth=_AS_SYS_UNIT(205.5);
double dLength=GetLength();
XPoint ptLocation; //扶梯定位点
ads_polar(GetUpLeft2d(),m_nRotation-PI/2,m_nSlabSize+dLength,ptLocation);
ads_polar(ptLocation,m_nRotation,dWidth*4/3+m_nStairWidth*0.5,ptLocation);
XPoint ptMid;
// 0,1--扶梯长度
ads_polar(ptLocation, m_nRotation-PI*0.5, m_nSlabSize, ptMid);
gripPoints.append(ptMid);
ads_polar(ptLocation, m_nRotation+PI*0.5, dLength+m_nSlabSize, ptMid);
gripPoints.append(ptMid);
// 2,3--梯段宽度
ads_polar(ptLocation, m_nRotation+PI, m_nStairWidth*0.5+dWidth*4.0/3, ptMid);
ads_polar(ptMid, m_nRotation+PI*0.5, dLength*0.5, ptMid);
gripPoints.append(ptMid);
if(IsSingleStair())
{
ads_polar(ptMid, m_nRotation, m_nStairWidth+dWidth*8.0/3, ptMid);
}
else
{
ads_polar(ptMid, m_nRotation, m_nStairWidth*2+dWidth*16.0/3+m_dSpaceWidth, ptMid);
}
gripPoints.append(ptMid);
// 4,5,6,7--移动梯段
gripPoints.append(GetUpLeft2d());
gripPoints.append(GetUpRight2d());
XPoint ptLeft, ptRight;
ads_polar(GetUpLeft2d(), m_nRotation-PI/2.0, GetTotalLength(), ptLeft);
ads_polar(GetUpRight2d(), m_nRotation-PI/2.0, GetTotalLength(), ptRight);
gripPoints.append(ptLeft);
gripPoints.append(ptRight);
// 8,9--平步距离
if(!(IsAscent()&&GetSlopeAngle()<_DIST_SNAP)) //步道时没有平步
{
ads_polar(ptLocation, m_nRotation-PI*0.5, m_nStepDist, ptMid);
gripPoints.append(ptMid);
ads_polar(ptLocation, m_nRotation+PI*0.5, dLength+m_nStepDist, ptMid);
gripPoints.append(ptMid);
}
if(!IsSingleStair())
{
// 梯段间距
ads_polar(ptLocation, m_nRotation, m_nStairWidth*0.5+dWidth*4.0/3+m_dSpaceWidth, ptMid);
ads_polar(ptMid, m_nRotation-PI*0.5, m_nSlabSize, ptMid);
gripPoints.append(ptMid);
ads_polar(ptMid, m_nRotation+PI*0.5, m_nSlabSize*2+dLength, ptMid);
gripPoints.append(ptMid);
// 扶梯长度
ads_polar(GetUpRight2d(), m_nRotation-PI, m_nStairWidth*0.5+dWidth*4/3, ptMid);
gripPoints.append(ptMid);
ads_polar(ptMid, m_nRotation-PI*0.5, dLength+m_nSlabSize*2, ptMid);
gripPoints.append(ptMid);
// 平步距离
if(!(IsAscent()&&GetSlopeAngle()<_DIST_SNAP)) //步道时有平步
{
ads_polar(GetUpRight2d(), m_nRotation-PI, m_nStairWidth*0.5+dWidth*4/3, ptMid);
ads_polar(ptMid, m_nRotation-PI*0.5, m_nSlabSize-m_nStepDist, ptMid);
gripPoints.append(ptMid);
ads_polar(ptMid, m_nRotation-PI*0.5, dLength+m_nStepDist*2, ptMid);
gripPoints.append(ptMid);
}
}
if(m_nStairFlag==SF_TOP&&(IsSingleStair()||(!IsSingleStair()&&!IsCross()))&&(!(IsAscent()&&GetSlopeAngle()<_DIST_SNAP)))
{
double length=0;
if(IsHasHole())
length=m_dHoleLength;
ads_polar(ptLeft, m_nRotation, m_nStairWidth+dWidth*4/3, ptLeft);
ads_polar(ptLeft, m_nRotation+PI*0.5, length, ptLeft);
gripPoints.append(ptLeft);
}
// 剖切位置
if(m_nStairFlag!=SF_TOP)
{
ads_polar(ptLocation, m_nRotation+PI, m_nStairWidth*0.5+dWidth*4.0/3, ptMid);
ads_polar(ptMid, m_nRotation+PI*0.5, dLength*m_lSectPos, ptMid);
gripPoints.append(ptMid);
if(IsSingleStair())
{
ads_polar(ptLocation, m_nRotation, m_nStairWidth*0.5+dWidth*4.0/3, ptMid);
}
else
{
ads_polar(ptLocation, m_nRotation, m_nStairWidth*1.5+dWidth*4.0+m_dSpaceWidth, ptMid);
}
ads_polar(ptMid, m_nRotation+PI*0.5, dLength*m_rSectPos, ptMid);
gripPoints.append(ptMid);
}
return Acad::eOk;
}
Acad::ErrorStatus
TDbAutoStair::subGetStretchPoints(AcGePoint3dArray & stretchPoints) const
{
assertReadEnabled();
XPoint ptUpLeft=GetLocation();
stretchPoints.append(ptUpLeft);
return Acad::eOk;
}
Acad::ErrorStatus
TDbAutoStair::GetGripText(int i, CString &cs) const
{
BOOL bStepDist=!(IsAscent()&&GetSlopeAngle()<_DIST_SNAP);
switch(i) {
case 0:
case 1:
cs=_T("改平台距离");
break;
case 2:
case 3:
cs=_T("改梯段宽度");
break;
case 4:
case 6:
cs=_T("移动楼梯");
break;
case 5:
case 7:
if(!bStepDist)
cs=_T("改步道长");
else
cs=_T("移动楼梯");
break;
case 8:
case 9:
if(bStepDist)//有平步
{
cs=_T("改平步距离");
break;
}
else
{
if(!IsSingleStair())
{
cs=_T("改梯段间距");
break;
}
}
case 10:
case 11:
if(bStepDist)//有平步
{
if(!IsSingleStair())
{
cs=_T("改梯段间距");
break;
}
}
else
{
if(!IsSingleStair())
{
cs=_T("改平台距离");
break;
}
}
case 12:
case 13:
if(bStepDist)//有平步
{
if(!IsSingleStair())
{
cs=_T("改平台距离");
break;
}
}
case 14:
case 15:
if(bStepDist)//有平步
{
if(!IsSingleStair())
{
cs=_T("改平步距离");
break;
}
}
case 16:
if(bStepDist&&m_nStairFlag==SF_TOP&&(IsSingleStair()||(!IsSingleStair()&&!IsCross())))
{
cs=_T("改洞口长度");
break;
}
case 17:
cs=_T("移动剖切位置");
break;
default:
break;
}
return Acad::eOk;
}
Acad::ErrorStatus
TDbAutoStair::subTransformBy(const AcGeMatrix3d& xform)
{
assertWriteEnabled();
TDbEntity::subTransformBy(xform);
double dWidth=_AS_SYS_UNIT(205.5);
double dTotalWidth=dWidth*8/3+m_nStairWidth;
if(!IsSingleStair())
{
dTotalWidth = dTotalWidth*2+m_dSpaceWidth;
}
XPoint ptX, ptY;
ads_polar(m_ptLocation, m_nRotation, dTotalWidth, 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);
double dSectPos=m_lSectPos;
m_lSectPos=m_rSectPos;
m_rSectPos=dSectPos;
if(!IsSingleStair())
{
m_nStartSide = !m_nStartSide;
}
}
m_nRotation = ads_angle(m_ptLocation, ptX);
return Acad::eOk;
}
Acad::ErrorStatus
TDbAutoStair::subMoveGripPointsAt(const AcDbIntArray& indices,
const AcGeVector3d& offset)
{
assertWriteEnabled();
XPoint vtOffset=*(XPoint *)&offset;
vtOffset.z = 0;
double dWidth=_AS_SYS_UNIT(205.5);
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();
BOOL bStepDist=!(IsAscent()&&GetSlopeAngle()<_DIST_SNAP);
for (int i = 0; i < nLen; i++) {
int idx = indices[i];
switch(idx) {
case 0: //改扶梯长度
if(m_nSlabSize-nIncLen*0.5 > m_nStepDist+dWidth+m_nRailHeight*0.5+_DIST_SNAP)
{
m_nSlabSize -= nIncLen*0.5;
}
else
{
m_nSlabSize = m_nStepDist+dWidth+m_nRailHeight*0.5;
}
break;
case 1: //改扶梯长度
{
double dist=nIncLen;
if(m_nSlabSize+nIncLen*0.5 > m_nStepDist+dWidth+m_nRailHeight*0.5+_DIST_SNAP)
{
m_nSlabSize += nIncLen*0.5;
}
else
{
dist = -(m_nSlabSize - m_nStepDist-dWidth-m_nRailHeight*0.5)*2;
m_nSlabSize = m_nStepDist+dWidth+m_nRailHeight*0.5;
}
ads_polar(m_ptLocation, m_nRotation+PI*0.5, dist, m_ptLocation);
}
break;
case 2: //改梯段宽度
if(IsSingleStair())
{
if(m_nStairWidth-nIncWidth > _DIST_SNAP)
{
m_nStairWidth -= nIncWidth;
ads_polar(m_ptLocation, m_nRotation, nIncWidth, m_ptLocation);
}
}
else
{
if(m_nStairWidth-nIncWidth*0.5 > _DIST_SNAP)
{
m_nStairWidth -= nIncWidth*0.5;
ads_polar(m_ptLocation, m_nRotation, nIncWidth, m_ptLocation);
}
}
break;
case 3: //改梯段宽度
if(IsSingleStair())
{
if(m_nStairWidth+nIncWidth > _DIST_SNAP)
{
m_nStairWidth += nIncWidth;
}
}
else
{
if(m_nStairWidth+nIncWidth*0.5 > _DIST_SNAP)
{
m_nStairWidth += nIncWidth*0.5;
}
}
break;
case 4:
case 6: //移动楼梯
if(nLen==1) {
m_ptLocation += vtOffset;
}
break;
case 5:
case 7:
if(!bStepDist) //改步道长
{
int nScale=idx==5?1:(-1);
double dMinLength=_AS_SYS_UNIT(1000);
if(m_dSlopeLength+nIncLen*nScale>dMinLength+_DIST_SNAP)
{
m_dSlopeLength+=nIncLen*nScale;
if(idx==5)
ads_polar(m_ptLocation, m_nRotation+PI*0.5, nIncLen, m_ptLocation);
}
else
{
if(idx==5)
ads_polar(m_ptLocation, m_nRotation+PI*0.5, dMinLength-m_dSlopeLength, m_ptLocation);
m_dSlopeLength=dMinLength;
}
}
else
{
//移动楼梯
if(nLen==1)
{
m_ptLocation += vtOffset;
}
}
break;
case 8:
if(bStepDist)//改平步距离
{
if(m_nStepDist-nIncLen > _DIST_SNAP&&m_nStepDist-nIncLen<m_nSlabSize-m_nRailHeight*0.5-dWidth-_DIST_SNAP)
{
m_nStepDist -= nIncLen;
}
else if(m_nStepDist-nIncLen < _DIST_SNAP)
{
m_nStepDist = 0;
}
else
{
m_nStepDist = m_nSlabSize-m_nRailHeight*0.5-dWidth;
}
break;
}
case 9:
if(bStepDist)//改平步距离
{
if(m_nStepDist+nIncLen > _DIST_SNAP&&m_nStepDist+nIncLen<m_nSlabSize-m_nRailHeight*0.5-dWidth-_DIST_SNAP)
{
m_nStepDist += nIncLen;
}
else if(m_nStepDist+nIncLen < _DIST_SNAP)
{
m_nStepDist = 0;
}
else
{
m_nStepDist = m_nSlabSize-m_nRailHeight*0.5-dWidth;
}
break;
}
else
{
if(!IsSingleStair())
{
//改楼梯间距
if(m_dSpaceWidth+nIncWidth > _DIST_SNAP)
{
m_dSpaceWidth += nIncWidth;
}
else
{
m_dSpaceWidth = 0;
}
break;
}
}
case 10:
case 11:
if(bStepDist)//改平步距离
{
if(!IsSingleStair())
{
//改楼梯间距
if(m_dSpaceWidth+nIncWidth > _DIST_SNAP)
{
m_dSpaceWidth += nIncWidth;
}
else
{
m_dSpaceWidth = 0;
}
break;
}
}
else
{
if(!IsSingleStair())
{
if(idx==10)
{
// 平台长度
double dist=nIncLen;
if(m_nSlabSize+nIncLen*0.5 > m_nStepDist+dWidth+m_nRailHeight*0.5+_DIST_SNAP)
{
m_nSlabSize += nIncLen*0.5;
}
else
{
dist = -(m_nSlabSize - m_nStepDist-dWidth-m_nRailHeight*0.5)*2;
m_nSlabSize = m_nStepDist+dWidth+m_nRailHeight*0.5;
}
ads_polar(m_ptLocation, m_nRotation+PI*0.5, dist, m_ptLocation);
}
else
{
// 平台长度
if(m_nSlabSize-nIncLen*0.5 > m_nStepDist+dWidth+m_nRailHeight*0.5+_DIST_SNAP)
{
m_nSlabSize -= nIncLen*0.5;
}
else
{
m_nSlabSize = m_nStepDist+dWidth+m_nRailHeight*0.5;
}
}
break;
}
}
case 12:
if(!IsSingleStair()&&bStepDist)
{
// 平台长度
double dist=nIncLen;
if(m_nSlabSize+nIncLen*0.5 > m_nStepDist+dWidth+m_nRailHeight*0.5+_DIST_SNAP)
{
m_nSlabSize += nIncLen*0.5;
}
else
{
dist = -(m_nSlabSize - m_nStepDist-dWidth-m_nRailHeight*0.5)*2;
m_nSlabSize = m_nStepDist+dWidth+m_nRailHeight*0.5;
}
ads_polar(m_ptLocation, m_nRotation+PI*0.5, dist, m_ptLocation);
break;
}
case 13:
if(!IsSingleStair()&&bStepDist)
{
// 平台长度
if(m_nSlabSize-nIncLen*0.5 > m_nStepDist+dWidth+m_nRailHeight*0.5+_DIST_SNAP)
{
m_nSlabSize -= nIncLen*0.5;
}
else
{
m_nSlabSize = m_nStepDist+dWidth+m_nRailHeight*0.5;
}
break;
}
case 14:
if(!IsSingleStair()&&bStepDist)
{
if(!(IsAscent()&&GetSlopeAngle()<_DIST_SNAP))//改平步距离
{
if(m_nStepDist+nIncLen > _DIST_SNAP&&m_nStepDist+nIncLen<m_nSlabSize-m_nRailHeight*0.5-dWidth-_DIST_SNAP)
{
m_nStepDist += nIncLen;
}
else if(m_nStepDist+nIncLen < _DIST_SNAP)
{
m_nStepDist = 0;
}
else
{
m_nStepDist = m_nSlabSize-m_nRailHeight*0.5-dWidth;
}
break;
}
}
case 15:
if(!IsSingleStair()&&bStepDist)
{
if(!(IsAscent()&&GetSlopeAngle()<_DIST_SNAP))//改平步距离
{
if(m_nStepDist-nIncLen > _DIST_SNAP&&m_nStepDist-nIncLen<m_nSlabSize-m_nRailHeight*0.5-dWidth-_DIST_SNAP)
{
m_nStepDist -= nIncLen;
}
else if(m_nStepDist-nIncLen < _DIST_SNAP)
{
m_nStepDist = 0;
}
else
{
m_nStepDist = m_nSlabSize-m_nRailHeight*0.5-dWidth;
}
break;
}
}
case 16:
if(bStepDist&&m_nStairFlag==SF_TOP&&(IsSingleStair()||(!IsSingleStair()&&!IsCross())))
{
double length=0;
if(IsHasHole())
{
length=m_dHoleLength;
}
if(length+nIncLen>_DIST_SNAP && length<m_nSlabSize+GetLength())
{
m_dHoleLength=length+nIncLen;
SetHasHole(TRUE);
}
else if(length+nIncLen<_DIST_SNAP)
{
m_dHoleLength=0;
}
else if(length>m_nSlabSize+GetLength())
{
m_dHoleLength=m_nSlabSize+GetLength();
SetHasHole(TRUE);
}
break;
}
case 17: //剖切位置
if(m_nStairFlag!=SF_TOP)
{
double dSectPos=0;
if(idx%2==0)
{
dSectPos=m_lSectPos;
}
else
{
dSectPos=m_rSectPos;
}
double dLength=GetLength();
double dist=dLength*dSectPos+nIncLen;
if(dist<dLength-_DIST_SNAP&&dist>_DIST_SNAP)
{
dSectPos=dist/dLength;
if(idx%2==0)
{
m_lSectPos=dSectPos;
}
else
{
m_rSectPos=dSectPos;
}
}
break;
}
break;
default:
break;
}
}
return Acad::eOk;
//return TDbEntity::moveGripPointsAt(indices, offset);
}
Acad::ErrorStatus
TDbAutoStair::subMoveStretchPointsAt(const AcDbIntArray& indices,
const AcGeVector3d& offset)
{
assertWriteEnabled();
if(indices.length()) {
AcGeMatrix3d mat;
mat.setToTranslation(offset);
subTransformBy(mat);
}
return Acad::eOk;
}
const TCHAR *
TDbAutoStair::GetDefaultLayer() const
{
return LAY_STAIR;
}
void
TDbAutoStair::GetTips(DList<TObjInfoUnit> &lstInfo) const
{
lstInfo.Append(new TObjInfoUnit(_T("对象类型"), _T("自动扶梯")));
if(IsAscent())
{
lstInfo.Append(new TObjInfoUnit(_T("坡道长"), Dist2Str(GetSlopeLength())));
}
else
{
lstInfo.Append(new TObjInfoUnit(_T("楼层高"), Dist2Str(GetFloorHeight())));
}
// sg modify 100412,保持与对象特性表及对话框中的表达一致
// lstInfo.Append(new TObjInfoUnit(_T("梯阶宽度"), Dist2Str(GetStairWidth())));
lstInfo.Append(new TObjInfoUnit(_T("梯段宽度"), Dist2Str(GetStairWidth())));
// sg modify 100322,保持与对象特性表及对话框中的表达一致
// lstInfo.Append(new TObjInfoUnit(_T("总长"), Dist2Str(GetTotalLength())));
lstInfo.Append(new TObjInfoUnit(_T("水平长度"), Dist2Str(GetTotalLength())));
// lstInfo.Append(new TObjInfoUnit(_T("总宽"), Dist2Str(GetTotalWidth())));
lstInfo.Append(new TObjInfoUnit(_T("扶梯总宽"), Dist2Str(GetTotalWidth())));
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));
}
Acad::ErrorStatus
TDbAutoStair::ExplodeTo(TDbLineStair &stair1, //[in/out]左梯段
TDbLineStair &stair2 //[in/out]右梯段
) const
{
assertReadEnabled();
//设置梯段宽度
stair1.SetStairWidth(m_nStairWidth);
stair2.SetStairWidth(m_nStairWidth);
//设置踏步高度
stair1.SetStepHeight(m_nStepHeight);
stair2.SetStepHeight(m_nStepHeight);
//设置踏步宽度
stair1.SetStepWidth(m_nStepWidth);
stair2.SetStepWidth(m_nStepWidth);
double length=GetLength();
int nStepNum=(int)(length/m_nStepWidth);
if(!IsAscent())
{
nStepNum += 1;
}
//设置踏步数
stair1.SetStepNum(nStepNum);
stair2.SetStepNum(nStepNum);
stair1.SetAscent(IsAscent());
stair2.SetAscent(IsAscent());
//设置踏步旋转角度
stair1.SetRotation(m_nRotation);
if(!IsSingleStair())
{
if(IsCross())
{
stair2.SetRotation(CT_std_angle(m_nRotation-PI));
}
else
{
stair2.SetRotation(m_nRotation);
}
}
double dLength=GetLength();
//计算梯段位置
XPoint ptLoc1, ptLoc2;
double dWidth=_AS_SYS_UNIT(205.5);
if(IsSingleStair()||(!IsSingleStair()&&m_nStartSide==OFFSET_LEFT))
{
ads_polar(GetUpLeft2d(), m_nRotation-PI*0.5, m_nSlabSize+dLength, ptLoc1);
ads_polar(ptLoc1, m_nRotation, dWidth*4/3, ptLoc1);
ptLoc1.z=m_ptLocation.z;
if(IsCross())
{
ads_polar(GetUpRight2d(), m_nRotation+PI, dWidth*4/3, ptLoc2);
ads_polar(ptLoc2, m_nRotation-PI*0.5, m_nSlabSize, ptLoc2);
ptLoc2.z=m_ptLocation.z;
}
else
{
ads_polar(ptLoc1, stair1.GetRotation(), m_nStairWidth+dWidth*8/3+m_dSpaceWidth, ptLoc2);
}
}
else
{
ads_polar(GetUpRight2d(), m_nRotation-PI*0.5, m_nSlabSize+dLength, ptLoc1);
ads_polar(ptLoc1, m_nRotation+PI, dWidth*4/3+m_nStairWidth, ptLoc1);
ptLoc1.z=m_ptLocation.z;
if(IsCross())
{
ads_polar(GetUpLeft2d(), m_nRotation, dWidth*4/3+m_nStairWidth, ptLoc2);
ads_polar(ptLoc2, m_nRotation-PI*0.5, m_nSlabSize, ptLoc2);
ptLoc2.z=m_ptLocation.z;
}
else
{
ads_polar(ptLoc1, stair1.GetRotation()+PI, m_nStairWidth+dWidth*8/3+m_dSpaceWidth, ptLoc2);
}
}
//设置梯段位置
stair1.SetLocation(ptLoc1);
stair2.SetLocation(ptLoc2);
//设置梯段标记
stair1.Set3DFlag(m_nStairFlag==SF_TOP? 0 : SF_HAS3D);
stair2.Set3DFlag(m_nStairFlag==SF_TOP? 0 : SF_HAS3D);
stair1.Set2DFlag(SF_NOSECT);
stair2.Set2DFlag(SF_NOSECT);
if(m_nStairFlag==SF_FIRST) //首层
{
stair1.Set2DFlag(SF_1SECT);
stair2.Set2DFlag(SF_1SECT);
}
else if(m_nStairFlag==SF_MIDDLE) //中间层
{
stair1.Set2DFlag(SF_2SECT);
stair2.Set2DFlag(SF_2SECT);
}
stair1.setPropertiesFrom(this);
stair2.setPropertiesFrom(this);
if(m_idLayerStep3d.isValid())
{
stair1.SetLayerStep3d(m_idLayerStep3d);
stair2.SetLayerStep3d(m_idLayerStep3d);
}
return Acad::eOk;
}
void TDbAutoStair::GetDefaultArrow(TDbSymbArrow*pArrowUp,TDbSymbArrow*pArrowUp2,
TDbSymbArrow*pArrowDown,TDbSymbArrow*pArrowDown2)const
{
assertReadEnabled();
double dWidth=_AS_SYS_UNIT(205.5);
double dLength=GetLength();
XPoint pt1,pt2,pt3,pt4,pt5,pt6,pt7,pt8,pt9,pt10,pt11,pt12,pt;
/*----------点相对位置示意----------------------
_________________________________________________
*pt1----------*pt2 *pt3--------------*pt4
*
*pt5-------------*pt6 *pt7-----------*pt8
------------------------------------------------*/
{ XPoint ptLocation; //扶梯定位点
ads_polar(GetUpLeft2d(),m_nRotation-PI/2,m_nSlabSize+dLength,ptLocation);
ads_polar(ptLocation,m_nRotation,dWidth*4/3+m_nStairWidth*0.5,ptLocation);
ads_polar(ptLocation,m_nRotation-PI/2,m_nStepDist+m_nRailHeight*0.5+dWidth,pt1);
ads_polar(ptLocation,m_nRotation+PI/2,dLength+m_nStepDist+m_nRailHeight*0.5+dWidth,pt4);
ads_polar(pt1,m_nRotation,m_nStairWidth+m_dSpaceWidth+dWidth*8/3,pt5);
ads_polar(pt4,m_nRotation,m_nStairWidth+m_dSpaceWidth+dWidth*8/3,pt8);
if(m_nStairFlag!=SF_TOP)
{
if(IsSingleStair())
{
ads_polar(ptLocation,m_nRotation+PI/2,dLength*(m_lSectPos+m_rSectPos)*0.5-m_nStepWidth,pt2);
ads_polar(pt2,m_nRotation+PI/2,m_nStepWidth*2,pt3);
}
else
{
double rSect=(m_rSectPos-m_lSectPos)*(m_nStairWidth+dWidth*8.0/3)/(m_nStairWidth*2+dWidth*16.0/3+m_dSpaceWidth)+m_lSectPos,
lSect=(m_rSectPos-m_lSectPos)*(m_nStairWidth+dWidth*8.0/3+m_dSpaceWidth)/(m_nStairWidth*2+dWidth*16.0/3+m_dSpaceWidth)+m_lSectPos;
ads_polar(ptLocation,m_nRotation+PI/2,dLength*(m_lSectPos+rSect)*0.5-m_nStepWidth,pt2);
ads_polar(pt2,m_nRotation+PI/2,m_nStepWidth*2,pt3);
ads_polar(ptLocation,m_nRotation,m_nStairWidth+m_dSpaceWidth+dWidth*8/3,pt);
ads_polar(pt,m_nRotation+PI/2,dLength*(lSect+m_rSectPos)*0.5-m_nStepWidth,pt6);
ads_polar(pt6,m_nRotation+PI/2,m_nStepWidth*2,pt7);
}
}
else
{
if(IsHasHole()&&(IsSingleStair()||(!IsSingleStair()&&!IsCross()))&&m_dHoleLength>m_nSlabSize)//存在洞口时箭头随洞口移动
{
ads_polar(ptLocation,m_nRotation+PI/2,m_nStepWidth+m_dHoleLength-m_nSlabSize,pt2);
ads_polar(pt2,m_nRotation,m_nStairWidth+m_dSpaceWidth+dWidth*8/3,pt6);
}
else
{
if(!IsSingleStair()&&IsCross())
{
if(m_nStartSide==OFFSET_LEFT)
{
ads_polar(ptLocation,m_nRotation+PI/2,m_nStepWidth,pt2);
ads_polar(ptLocation,m_nRotation+PI/2,dLength-m_nStepWidth,pt);
ads_polar(pt,m_nRotation,m_nStairWidth+m_dSpaceWidth+dWidth*8/3,pt6);
}
else
{
ads_polar(ptLocation,m_nRotation+PI/2,dLength-m_nStepWidth,pt2);
ads_polar(ptLocation,m_nRotation+PI/2,m_nStepWidth,pt);
ads_polar(pt,m_nRotation,m_nStairWidth+m_dSpaceWidth+dWidth*8/3,pt6);
}
}
else
{
ads_polar(ptLocation,m_nRotation+PI/2,m_nStepWidth,pt2);
if(IsCross())
{
ads_polar(ptLocation,m_nRotation+PI/2,dLength-m_nStepWidth,pt);
ads_polar(pt,m_nRotation,m_nStairWidth+m_dSpaceWidth+dWidth*8/3,pt6);
}
else
{
ads_polar(pt2,m_nRotation,m_nStairWidth+m_dSpaceWidth+dWidth*8/3,pt6);
}
}
}
}
}
XPoly2D poly;
if(IsSameDir()) //上下同向(顶层时同为下楼)
{
if(m_nStairFlag!=SF_TOP) //首层或中间层
{
if(!IsSingleStair()&&m_nStartSide!=OFFSET_LEFT)//镜像后右侧起步
{
poly.AppendNode(pt5);
poly.AppendNode(pt6);
pArrowUp->SetPoly2D(poly);
if(m_nStairFlag==SF_MIDDLE)
{
XPoly2D poly2;
poly2.AppendNode(pt7);
poly2.AppendNode(pt8);
pArrowUp2->SetPoly2D(poly2);
}
}
else
{
poly.AppendNode(pt1);
poly.AppendNode(pt2);
pArrowUp->SetPoly2D(poly);
if(m_nStairFlag==SF_MIDDLE)
{
XPoly2D poly2;
poly2.AppendNode(pt3);
poly2.AppendNode(pt4);
pArrowUp2->SetPoly2D(poly2);
}
}
}
else
{
if(!IsSingleStair()&&m_nStartSide!=OFFSET_LEFT)//镜像后右侧起步
{
poly.AppendNode(pt8);
poly.AppendNode(pt6);
pArrowDown->SetPoly2D(poly);
}
else
{
poly.AppendNode(pt4);
poly.AppendNode(pt2);
pArrowDown->SetPoly2D(poly);
}
}
if(!IsSingleStair())
{
if(IsCross()) //交叉放置
{
XPoly2D poly1;
if(m_nStartSide==OFFSET_LEFT)
{
if(m_nStairFlag!=SF_TOP)
{
poly1.AppendNode(pt8);
poly1.AppendNode(pt7);
//modify by xlc on 090114首层同为上行方向
if(m_nStairFlag==SF_FIRST)
{
pArrowUp2->SetPoly2D(poly1);
}
else
{
poly1.Reverse();
pArrowDown->SetPoly2D(poly1);
}
if(m_nStairFlag==SF_MIDDLE)
{
XPoly2D poly2;
poly2.AppendNode(pt5);
poly2.AppendNode(pt6);
pArrowDown2->SetPoly2D(poly2);
}
}
else
{
XPoly2D poly1;
poly1.AppendNode(pt5);
poly1.AppendNode(pt6);
pArrowDown2->SetPoly2D(poly1);
}
}
else //镜像后右侧起步
{
if(m_nStairFlag!=SF_TOP)
{
poly1.AppendNode(pt4);
poly1.AppendNode(pt3);
//modify by xlc on 090114首层同为上行方向
if(m_nStairFlag==SF_FIRST)
{
pArrowUp2->SetPoly2D(poly1);
}
else
{
poly1.Reverse();
pArrowDown->SetPoly2D(poly1);
}
if(m_nStairFlag==SF_MIDDLE)
{
XPoly2D poly2;
poly2.AppendNode(pt1);
poly2.AppendNode(pt2);
pArrowDown2->SetPoly2D(poly2);
}
}
else
{
XPoly2D poly1;
poly1.AppendNode(pt1);
poly1.AppendNode(pt2);
pArrowDown2->SetPoly2D(poly1);
}
}
}
else //并列放置
{
XPoly2D poly1;
if(m_nStartSide==OFFSET_LEFT)
{
if(m_nStairFlag!=SF_TOP)
{
//modify by xlc on 090114 首层同为上行方向
if(m_nStairFlag==SF_FIRST)
{
poly1.AppendNode(pt5);
poly1.AppendNode(pt6);
pArrowUp2->SetPoly2D(poly1);
}
else
{
poly1.AppendNode(pt6);
poly1.AppendNode(pt5);
pArrowDown->SetPoly2D(poly1);
}
if(m_nStairFlag==SF_MIDDLE)
{
XPoly2D poly2;
poly2.AppendNode(pt8);
poly2.AppendNode(pt7);
pArrowDown2->SetPoly2D(poly2);
}
}
else
{
XPoly2D poly1;
poly1.AppendNode(pt8);
poly1.AppendNode(pt6);
pArrowDown2->SetPoly2D(poly1);
}
}
else //镜像后右侧起步
{
if(m_nStairFlag!=SF_TOP)
{
//modify by xlc on 090114 首层同为上行方向
if(m_nStairFlag==SF_FIRST)
{
poly1.AppendNode(pt1);
poly1.AppendNode(pt2);
pArrowUp2->SetPoly2D(poly1);
}
else
{
poly1.AppendNode(pt2);
poly1.AppendNode(pt1);
pArrowDown->SetPoly2D(poly1);
}
if(m_nStairFlag==SF_MIDDLE)
{
XPoly2D poly2;
poly2.AppendNode(pt4);
poly2.AppendNode(pt3);
pArrowDown2->SetPoly2D(poly2);
}
}
else
{
XPoly2D poly1;
poly1.AppendNode(pt4);
poly1.AppendNode(pt2);
pArrowDown2->SetPoly2D(poly1);
}
}
}
}
}
else //上下梯逆向
{
if(m_nStairFlag!=SF_TOP)
{
if(!IsSingleStair()&&m_nStartSide!=OFFSET_LEFT)//镜像后右侧起步
{
poly.AppendNode(pt5);
poly.AppendNode(pt6);
pArrowUp->SetPoly2D(poly);
if(m_nStairFlag==SF_MIDDLE)
{
XPoly2D poly2;
poly2.AppendNode(pt8);
poly2.AppendNode(pt7);
pArrowDown->SetPoly2D(poly2);
}
}
else
{
poly.AppendNode(pt1);
poly.AppendNode(pt2);
pArrowUp->SetPoly2D(poly);
if(m_nStairFlag==SF_MIDDLE)
{
XPoly2D poly2;
poly2.AppendNode(pt4);
poly2.AppendNode(pt3);
pArrowDown->SetPoly2D(poly2);
}
}
}
else
{
if(!IsSingleStair()&&m_nStartSide!=OFFSET_LEFT)//镜像后右侧起步
{
poly.AppendNode(pt8);
poly.AppendNode(pt6);
pArrowDown->SetPoly2D(poly);
}
else
{
poly.AppendNode(pt4);
poly.AppendNode(pt2);
pArrowDown->SetPoly2D(poly);
}
}
if(!IsSingleStair()) //第二个梯段
{
if(IsCross()) //交叉放置
{
XPoly2D poly1;
if(m_nStartSide==OFFSET_LEFT)
{
if(m_nStairFlag!=SF_TOP)
{
//modify by xlc on 090114 首层不同为上行方向
if(m_nStairFlag==SF_FIRST)
{
poly1.AppendNode(pt7);
poly1.AppendNode(pt8);
pArrowDown2->SetPoly2D(poly1);
}
else
{
//modify by xlc on 090601 交叉放置不同向时上行方向
poly1.AppendNode(pt7);
poly1.AppendNode(pt8);
//pArrowUp2->SetPoly2D(poly1);
pArrowDown2->SetPoly2D(poly1);
}
if(m_nStairFlag==SF_MIDDLE)
{
XPoly2D poly2;
poly2.AppendNode(pt6);
poly2.AppendNode(pt5);
//pArrowDown2->SetPoly2D(poly2);
pArrowUp2->SetPoly2D(poly2);
}
}
else
{
XPoly2D poly1;
//modify by xlc on 090114 顶层不同为上行方向
// poly1.AppendNode(pt5);
// poly1.AppendNode(pt6);
// pArrowDown2->SetPoly2D(poly1);
poly1.AppendNode(pt6);
poly1.AppendNode(pt5);
pArrowUp2->SetPoly2D(poly1);
}
}
else //镜像后右侧起步
{
if(m_nStairFlag!=SF_TOP)
{
//modify by xlc on 090114 首层不同为上行方向
if(m_nStairFlag==SF_FIRST)
{
poly1.AppendNode(pt3);
poly1.AppendNode(pt4);
pArrowDown2->SetPoly2D(poly1);
}
else
{
poly1.AppendNode(pt3);
poly1.AppendNode(pt4);
//pArrowUp2->SetPoly2D(poly1);
pArrowDown2->SetPoly2D(poly1);
}
if(m_nStairFlag==SF_MIDDLE)
{
XPoly2D poly2;
poly2.AppendNode(pt2);
poly2.AppendNode(pt1);
//pArrowDown2->SetPoly2D(poly2);
pArrowUp2->SetPoly2D(poly2);
}
}
else
{
XPoly2D poly1;
//modify by xlc on 090114 顶层不同为上行方向
// poly1.AppendNode(pt1);
// poly1.AppendNode(pt2);
// pArrowDown2->SetPoly2D(poly1);
poly1.AppendNode(pt2);
poly1.AppendNode(pt1);
pArrowUp2->SetPoly2D(poly1);
}
}
}
else //并列放置
{
XPoly2D poly1;
if(m_nStartSide==OFFSET_LEFT)
{
if(m_nStairFlag!=SF_TOP)
{
poly1.AppendNode(pt6);
poly1.AppendNode(pt5);
pArrowDown2->SetPoly2D(poly1);
if(m_nStairFlag==SF_MIDDLE)
{
XPoly2D poly2;
poly2.AppendNode(pt7);
poly2.AppendNode(pt8);
pArrowUp2->SetPoly2D(poly2);
}
}
else
{
XPoly2D poly1;
poly1.AppendNode(pt6);
poly1.AppendNode(pt8);
pArrowUp2->SetPoly2D(poly1);
}
}
else
{
if(m_nStairFlag!=SF_TOP)
{
poly1.AppendNode(pt1);
poly1.AppendNode(pt2);
pArrowDown2->SetPoly2D(poly1);
if(m_nStairFlag==SF_MIDDLE)
{
XPoly2D poly2;
poly2.AppendNode(pt3);
poly2.AppendNode(pt4);
pArrowUp2->SetPoly2D(poly2);
}
}
else
{
XPoly2D poly1;
poly1.AppendNode(pt2);
poly1.AppendNode(pt4);
pArrowUp2->SetPoly2D(poly1);
}
}
}
}
}
//modify by xlc on 090205
//XString upText=_T("上"),downText=_T("下");
XString upText=GetTextUp(),downText=GetTextDown();
if(IsAscent()&&GetSlopeAngle()<_DIST_SNAP)
{
upText=_T("");
downText=_T("");
}
double dist=((DocGetText2Base()+m_dTextHeight))*GetPScale();
{
pArrowUp->setPropertiesFrom(this);
//modify by xlc on 090205
pArrowUp->SetLayoutRotation(GetLayoutRotation());
pArrowUp->SetText(upText);
pArrowUp->SetTextHeight(m_dTextHeight);
pArrowUp->SetTextAlign(TDbSymbArrow::kAtSide);
pArrowUp->SetTextLocation(pArrowUp->GetDefaultTextLocation());
pArrowUp->SetTextLayerId(m_idLayerText);
pArrowUp->SetTextStyleId(m_idTextStyle);
pArrowUp2->setPropertiesFrom(this);
pArrowUp2->SetLayoutRotation(GetLayoutRotation());
pArrowUp2->SetText(upText);
pArrowUp2->SetTextHeight(m_dTextHeight);
pArrowUp2->SetTextAlign(TDbSymbArrow::kAtSide);
if(IsSameDir())
{
XPoint pt=pt4;
if(!IsSingleStair()&&m_nStairFlag==SF_FIRST)
{
pt=pArrowUp2->GetDefaultTextLocation();
}
else if(!IsSingleStair()&&m_nStartSide!=OFFSET_LEFT)
{
ads_polar(pt8,m_nRotation+PI*0.5,dist,pt);
}
else
{
ads_polar(pt4,m_nRotation+PI*0.5,dist,pt);
}
pArrowUp2->SetTextLocation(pt);
}
else
{
if(!IsSingleStair()&&!IsCross()&&m_nStartSide==OFFSET_LEFT)
{
XPoint pt=pt8;
ads_polar(pt,m_nRotation+PI*0.5,dist,pt);
pArrowUp2->SetTextLocation(pt);
}
else if(!IsSingleStair()&&!IsCross()&& !IsSameDir()&&m_nStartSide!=OFFSET_LEFT)
{
XPoint pt=pt4;
ads_polar(pt,m_nRotation+PI*0.5,dist,pt);
pArrowUp2->SetTextLocation(pt);
}
//modify by xlc on 090414 交叉放置时顶层增加上下方向运行
else if(!IsSingleStair()&&IsCross()&&m_nStairFlag!=SF_FIRST&&(!IsSameDir()))
{
XPoint pt=pt1;
if(m_nStartSide==OFFSET_LEFT)
{
pt=pt5;
}
ads_polar(pt,m_nRotation-PI*0.5,dist,pt);
pArrowUp2->SetTextLocation(pt);
}
else if(!IsSingleStair()&&IsCross()&&m_nStairFlag==SF_FIRST&&(!IsSameDir()))
{
XPoint pt=pt1;
if(m_nStartSide==OFFSET_LEFT)
{
pt=pt8;
}
ads_polar(pt,m_nRotation-PI*0.5,dist,pt);
pArrowUp2->SetTextLocation(pt);
}
else
{
pArrowUp2->SetTextLocation(pArrowUp2->GetDefaultTextLocation());
}
}
pArrowUp2->SetTextLayerId(m_idLayerText);
pArrowUp2->SetTextStyleId(m_idTextStyle);
pArrowDown->setPropertiesFrom(this);
pArrowDown->SetLayoutRotation(GetLayoutRotation());
pArrowDown->SetText(downText);
pArrowDown->SetTextHeight(m_dTextHeight);
pArrowDown->SetTextAlign(TDbSymbArrow::kAtSide);
if(!IsSingleStair()&&IsSameDir()&&!IsCross()&&m_nStairFlag!=SF_TOP)
{
XPoint pt=pt5;
if(m_nStartSide!=OFFSET_LEFT)
pt=pt1;
ads_polar(pt,m_nRotation-PI*0.5,dist,pt);
pArrowDown->SetTextLocation(pt);
}
//modify by xlc on 090601 交叉放置同向时下行方向
else if(!IsSingleStair()&&IsSameDir()&&IsCross()&&m_nStairFlag==SF_MIDDLE)
{
XPoint pt=pt8;
if(m_nStartSide!=OFFSET_LEFT)
pt=pt4;
ads_polar(pt,m_nRotation+PI*0.5,dist,pt);
pArrowDown->SetTextLocation(pt);
}
else
{
pArrowDown->SetTextLocation(pArrowDown->GetDefaultTextLocation());
}
pArrowDown->SetTextLayerId(m_idLayerText);
pArrowDown->SetTextStyleId(m_idTextStyle);
pArrowDown2->setPropertiesFrom(this);
pArrowDown2->SetLayoutRotation(GetLayoutRotation());
pArrowDown2->SetText(downText);
pArrowDown2->SetTextHeight(m_dTextHeight);
pArrowDown2->SetTextAlign(TDbSymbArrow::kAtSide);
//modify by xlc on 090601 交叉放置同向时下行方向
/*if(!IsSingleStair()&&IsSameDir()&&IsCross()&&m_nStairFlag!=SF_TOP)
{
XPoint pt=pt5;
if(m_nStartSide!=OFFSET_LEFT)
pt=pt1;
ads_polar(pt,m_nRotation-PI*0.5,dist,pt);
pArrowDown2->SetTextLocation(pt);
}
else */if(!IsSingleStair()&&!IsSameDir()&&!IsCross()&&m_nStartSide==OFFSET_LEFT)
{
XPoint pt=pt5;
ads_polar(pt,m_nRotation-PI*0.5,dist,pt);
pArrowDown2->SetTextLocation(pt);
}
//modify by xlc on 090414
else if(!IsSingleStair()&&!IsSameDir()&&IsCross()&&m_nStartSide!=OFFSET_LEFT&&m_nStairFlag==SF_FIRST)
{
XPoint pt=pt4;
ads_polar(pt,m_nRotation+PI*0.5,dist,pt);
pArrowDown2->SetTextLocation(pt);
}
else if(!IsSingleStair()&&!IsSameDir()&&m_nStartSide==OFFSET_LEFT&&m_nStairFlag==SF_FIRST)
{
XPoint pt=pt8;
ads_polar(pt,m_nRotation+PI*0.5,dist,pt);
pArrowDown2->SetTextLocation(pt);
}
else if(!IsSingleStair()&&!IsSameDir()&&IsCross()&&m_nStairFlag==SF_MIDDLE)
{
XPoint pt=pt4;
if (m_nStartSide==OFFSET_LEFT)
{
pt=pt8;
}
ads_polar(pt,m_nRotation+PI*0.5,dist,pt);
pArrowDown2->SetTextLocation(pt);
}
else
{
pArrowDown2->SetTextLocation(pArrowDown2->GetDefaultTextLocation());
}
pArrowDown2->SetTextLayerId(m_idLayerText);
pArrowDown2->SetTextStyleId(m_idTextStyle);
if(m_idLayerArrow.isValid())
{
pArrowUp->setLayer(m_idLayerArrow);
pArrowUp2->setLayer(m_idLayerArrow);
pArrowDown->setLayer(m_idLayerArrow);
pArrowDown2->setLayer(m_idLayerArrow);
}
}
}
Acad::ErrorStatus
TDbAutoStair::ExplodeOrDraw3d(XExplodeDraw &dc) const
{
if(m_nViewCtrl==1)
return Acad::eOk; //三维被禁止
assertReadEnabled();
return Acad::eOk;
}
bool TDbAutoStair::IsClipMe(const TEntityBase* pEnt)const
{
if(TDbEntity::IsClipMe(pEnt))
return true;
if(pEnt->GetMe()->isKindOf(TDbColumn::desc()))
return true;
return false;
}
Acad::ErrorStatus TDbAutoStair::DownGradeSave(int nDrawMode, AcDbVoidPtrArray &entSet, BOOL *bErase)
{
Acad::ErrorStatus es=Acad::eOk;
es=TDbEntity::DownGradeSave(nDrawMode,entSet,bErase);
return es;
}
Acad::ErrorStatus
TDbAutoStair::ExplodeOrDraw2d(XExplodeDraw &dc) const
{
if(m_nViewCtrl==2)
return Acad::eOk; //二维被禁止
assertReadEnabled();
if(_tcscmp(dc.Desc(), XAcGiViewDraw::Descriptor())==0 ||
g_bOsnapExpl)
{
XPushMemVar<BOOL> bExpl(g_bOsnapExpl, FALSE);
XPushMemVar<BOOL> bFull(XExplodeStream::m_bFullExplode, TRUE);
AcDbVoidPtrArray entSet;
XExplodeStream dcExp(entSet);
dcExp.SetPropertiesFrom(this);
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;
ExplodeTo(stair1, stair2);
int nFlag2d=stair1.Get2DFlag();
if(nFlag2d==SF_NO2D)
return Acad::eOk;
stair1.Set2DFlag(SF_NOSECT);
stair2.Set2DFlag(SF_NOSECT);
TDbSymbArrow pArrowUp,pArrowUp2,pArrowDown,pArrowDown2;
if(IsArrow()) //画箭头
{
GetDefaultArrow(&pArrowUp,&pArrowUp2,&pArrowDown,&pArrowDown2);
if(dc.IsFullExplode())
{
TPushProperty vProp(&pArrowUp, dc);
pArrowUp.ExplodeOrDraw2d(dc);
pArrowDown.ExplodeOrDraw2d(dc);
pArrowUp2.ExplodeOrDraw2d(dc);
pArrowDown2.ExplodeOrDraw2d(dc);
}
else
{
dc.DrawEntity(pArrowUp);
dc.DrawEntity(pArrowUp2);
dc.DrawEntity(pArrowDown);
dc.DrawEntity(pArrowDown2);
}
}
double dLength=GetLength();
double dWidth=_AS_SYS_UNIT(205.5);
double dist=_AS_SYS_UNIT(99); //内侧垫板宽度
double distOut=_AS_SYS_UNIT(86); //外侧垫板宽度
long clipCount=0;
XPoint ptLocation; //扶梯定位点
ads_polar(GetUpLeft2d(),m_nRotation-PI/2,m_nSlabSize+dLength,ptLocation);
ads_polar(ptLocation,m_nRotation,dWidth*4/3+m_nStairWidth*0.5,ptLocation);
XPoly polyDown,polyUp,polyMid,polyDown1,polyUp1,polyMid1;
if(nFlag2d==SF_NOSECT)
{
if(m_nStairFlag==SF_TOP)
{
if(IsHasHole() && (IsSingleStair()||(!IsSingleStair() && !IsCross())))//顶层开洞
{
if(m_dHoleLength>_DIST_SNAP)
{
XPoint ptLeft,ptRight;
ads_polar(GetUpLeft2d(), m_nRotation-PI*0.5, m_nSlabSize*2+GetLength(), ptLeft);
ads_polar(GetUpRight2d(), m_nRotation-PI*0.5, m_nSlabSize*2+GetLength(), ptRight);
XPoly2D poly(1);
poly.AppendNode(ptLeft);
poly.AppendNode(ptRight);
ads_polar(ptRight, m_nRotation+PI*0.5, m_dHoleLength, ptRight);
ads_polar(ptLeft, m_nRotation+PI*0.5, m_dHoleLength, ptLeft);
poly.AppendNode(ptRight);
poly.AppendNode(ptLeft);
if(poly.Length()>0)
{
dc.PushClip(poly);
clipCount++;
}
}
}
}
}
else
{
//计算剖切线
if(IsSingleStair())
{
GetSectionPoly(m_lSectPos,m_rSectPos,0,polyDown,polyUp,polyMid);
}
else
{
double rSect=(m_rSectPos-m_lSectPos)*(m_nStairWidth+dWidth*8.0/3)/(m_nStairWidth*2+dWidth*16.0/3+m_dSpaceWidth)+m_lSectPos,
lSect=(m_rSectPos-m_lSectPos)*(m_nStairWidth+dWidth*8.0/3+m_dSpaceWidth)/(m_nStairWidth*2+dWidth*16.0/3+m_dSpaceWidth)+m_lSectPos;
GetSectionPoly(m_lSectPos,rSect,0,polyDown,polyUp,polyMid);
GetSectionPoly(lSect,m_rSectPos,2,polyDown1,polyUp1,polyMid1);
}
{
//画剖切线
if(nFlag2d==SF_2SECT)
{
if(polyDown.Length()==5&&polyUp.Length()==5)
{
dc<<XLine(*polyDown[0],*polyDown[1])
<<XLine(*polyDown[3],*polyUp[2])
<<XLine(*polyUp[2],*polyDown[2])
<<XLine(*polyDown[2],*polyUp[3])
<<XLine(*polyUp[3],*polyUp[4])
<<XLine(*polyUp[0],*polyUp[1])
<<XLine(*polyDown[3],*polyDown[4]);
}
if(!IsSingleStair()&&polyDown1.Length()==5&&polyUp1.Length()==5)
{
dc<<XLine(*polyDown1[0],*polyDown1[1])
<<XLine(*polyDown1[3],*polyUp1[2])
<<XLine(*polyUp1[2],*polyDown1[2])
<<XLine(*polyDown1[2],*polyUp1[3])
<<XLine(*polyUp1[3],*polyUp1[4])
<<XLine(*polyUp1[0],*polyUp1[1])
<<XLine(*polyDown1[3],*polyDown1[4])
<<XLine(*polyDown1[polyDown1.Length()-1],*polyDown[0])
<<XLine(*polyUp[polyUp.Length()-1],*polyUp1[0]);
}
}
else
{
for(int i=0;i<polyMid.Length()-1;i++)
dc<<XLine(*polyMid[i],*polyMid[i+1]);
if(!IsSingleStair())
{
for(i=0;i<polyMid1.Length()-1;i++)
dc<<XLine(*polyMid1[i],*polyMid1[i+1]);
if(polyMid1.Length()>0&&polyMid.Length()>0)
dc<<XLine(*polyMid1[polyMid1.Length()-1],*polyMid[0]);
}
}
}
XPoly2D poly(1);
poly.Reset();
XDirectionCurve lCurve=GetSideCurve2d(OFFSET_LEFT),
rCurve=GetSideCurve2d(OFFSET_RIGHT);
//隐藏不可见线
if(nFlag2d==SF_2SECT)
{
for(int i=0;i<polyDown.Length();i++)
poly.AppendNode(*polyDown[i]);
for(i=0;i<polyUp.Length();i++)
poly.AppendNode(*polyUp[i]);
if(poly.Length()>0)
{
dc.PushClip(poly);
clipCount++;
}
if(!IsSingleStair())
{
poly.Reset();
for(int i=0;i<polyDown1.Length();i++)
poly.AppendNode(*polyDown1[i]);
for(i=0;i<polyUp1.Length();i++)
poly.AppendNode(*polyUp1[i]);
if(poly.Length()>0)
{
dc.PushClip(poly);
clipCount++;
}
}
}
else
{
for(int i=0;i<polyMid.Length();i++)
poly.AppendNode(*polyMid[i]);
XPoint pt;
if(!IsSingleStair()&&IsCross()&&m_nStartSide==OFFSET_RIGHT)
{
ads_polar(lCurve.StartPoint(), m_nRotation-PI*0.5, m_nSlabSize, pt);
poly.AppendNode(pt);
ads_polar(rCurve.StartPoint(), m_nRotation-PI*0.5, m_nSlabSize, pt);
poly.AppendNode(pt);
}
else
{
ads_polar(lCurve.EndPoint(), m_nRotation+PI*0.5, m_nSlabSize, pt);
poly.AppendNode(pt);
ads_polar(rCurve.EndPoint(), m_nRotation+PI*0.5, m_nSlabSize, pt);
poly.AppendNode(pt);
}
if(poly.Length()>2)
{
dc.PushClip(poly);
clipCount++;
}
if(!IsSingleStair())
{
poly.Reset();
for(int i=0;i<polyMid1.Length();i++)
poly.AppendNode(*polyMid1[i]);
lCurve=GetSideCurve2d(2);
rCurve=GetSideCurve2d(3);
if(IsCross())
{
if(m_nStartSide==OFFSET_LEFT)
{
ads_polar(lCurve.StartPoint(), m_nRotation-PI*0.5, m_nSlabSize, pt);
poly.AppendNode(pt);
ads_polar(rCurve.StartPoint(), m_nRotation-PI*0.5, m_nSlabSize, pt);
poly.AppendNode(pt);
}
else
{
ads_polar(lCurve.EndPoint(), m_nRotation+PI*0.5, m_nSlabSize, pt);
poly.AppendNode(pt);
ads_polar(rCurve.EndPoint(), m_nRotation+PI*0.5, m_nSlabSize, pt);
poly.AppendNode(pt);
}
}
else
{
ads_polar(lCurve.EndPoint(), m_nRotation+PI, m_dSpaceWidth+dWidth/3, pt);
poly.AppendNode(pt);
ads_polar(lCurve.EndPoint(), m_nRotation+PI, m_dSpaceWidth+dWidth/3, pt);
ads_polar(pt, m_nRotation+PI*0.5, m_nSlabSize, pt);
poly.AppendNode(pt);
ads_polar(rCurve.EndPoint(), m_nRotation+PI*0.5, m_nSlabSize, pt);
poly.AppendNode(pt);
}
if(poly.Length()>2)
{
dc.PushClip(poly);
clipCount++;
}
}
}
}
//显示梯段
if(!IsAscent())
{
stair1.ExplodeOrDraw2d(dc);
if(!IsSingleStair())
stair2.ExplodeOrDraw2d(dc);
}
// 扶手线和垫板线
XPoint ptS,ptE,ptTmp;
ads_polar(ptLocation, m_nRotation+PI, m_nStairWidth*0.5, ptS);
ads_polar(ptS, m_nRotation+PI*0.5, dLength, ptE);
XPoint ptLeft,ptRight;
ads_polar(ptS, m_nRotation-PI*0.5, m_nStepDist, ptLeft);
ads_polar(ptLeft, m_nRotation, m_nStairWidth, ptRight);
dc<<XLine(ptLeft,ptRight); //平步线
ads_polar(ptE, m_nRotation+PI*0.5, m_nStepDist, ptLeft);
ads_polar(ptLeft, m_nRotation, m_nStairWidth, ptRight);
dc<<XLine(ptLeft,ptRight); //平步线
//左侧梯段
DrawRailLine(ptS,ptE,m_nRotation+PI*0.5,dWidth,dc);
DrawInSlabLine(ptS,ptE,m_nRotation+PI*0.5,dWidth,dc);
DrawOutSlabLine(ptS,ptE,m_nRotation+PI*0.5,dWidth,TRUE,dc);
XPoint pt1=ptS,pt2=ptE;
ads_polar(ptLocation, m_nRotation, m_nStairWidth*0.5, ptE);
ads_polar(ptE, m_nRotation+PI*0.5, dLength, ptS);
if(!(IsAscent()&&fabs(m_dSlopeAngle)<1.0e-5))
{
dc<<XLine(ptE,pt1)<<XLine(ptS,pt2);
}
DrawRailLine(ptS,ptE,m_nRotation-PI*0.5,dWidth,dc);
DrawInSlabLine(ptS,ptE,m_nRotation-PI*0.5,dWidth,dc);
DrawOutSlabLine(ptS,ptE,m_nRotation-PI*0.5,dWidth,TRUE,dc);
XPoint ptLowLeft,ptLowRight,ptUpLeft,ptUpRight;
ads_polar(ptLocation, m_nRotation-PI*0.5, m_nSlabSize, ptS);
ads_polar(ptS, m_nRotation+PI, m_nStairWidth*0.5+dWidth*4/3, ptLowLeft);
ads_polar(ptLowLeft, m_nRotation+PI*0.5, m_nSlabSize*2+dLength, ptUpLeft);
ads_polar(ptS, m_nRotation, m_nStairWidth*0.5+dWidth*4/3, ptLowRight);
ads_polar(ptLowRight, m_nRotation+PI*0.5, m_nSlabSize*2+dLength, ptUpRight);
dc<<XLine(ptLowLeft,ptLowRight)<<XLine(ptUpRight,ptUpLeft)<<XLine(ptUpLeft,ptLowLeft);
if(IsSingleStair()||(!IsSingleStair()&&IsCross()))
{
dc<<XLine(ptLowRight,ptUpRight);
}
else //双梯并列
{
double dRailDist=m_nStepDist+m_nRailHeight*0.5+dWidth;
XPoint ptLow,ptUp,ptTmp;
ads_polar(ptLowRight, m_nRotation+PI*0.5, m_nSlabSize-m_nStepDist-dWidth+distOut, ptLow);
ads_polar(ptUpRight, m_nRotation-PI*0.5, m_nSlabSize-m_nStepDist-dWidth+distOut, ptUp);
dc<<XLine(ptLowRight,ptLow)<<XLine(ptUp,ptUpRight);
ads_polar(ptLow, m_nRotation+PI, dWidth*4/3-dist-distOut-m_nRailWidth, ptLow);
ads_polar(ptLow, m_nRotation, (dWidth*4/3-dist-distOut-m_nRailWidth)*2+m_dSpaceWidth, ptTmp);
dc<<XLine(ptLow,ptTmp);
ads_polar(ptUp, m_nRotation+PI, dWidth*4/3-dist-distOut-m_nRailWidth, ptUp);
ads_polar(ptUp, m_nRotation,(dWidth*4/3-dist-distOut-m_nRailWidth)*2+m_dSpaceWidth, ptTmp);
dc<<XLine(ptUp,ptTmp);
}
//右侧梯段
if(!IsSingleStair())
{
ads_polar(ptLowLeft, m_nRotation, m_nStairWidth+dWidth*8/3+m_dSpaceWidth, ptLowLeft);
ads_polar(ptUpLeft, m_nRotation, m_nStairWidth+dWidth*8/3+m_dSpaceWidth, ptUpLeft);
ads_polar(ptLowLeft, m_nRotation, m_nStairWidth+dWidth*8/3, ptLowRight);
ads_polar(ptLowRight, m_nRotation+PI*0.5, m_nSlabSize*2+dLength, ptUpRight);
dc<<XLine(ptLowLeft,ptLowRight)<<XLine(ptLowRight,ptUpRight)<<XLine(ptUpRight,ptUpLeft);
if(IsCross())
{
dc<<XLine(ptUpLeft,ptLowLeft);
}
else
{
double dRailDist=m_nStepDist+m_nRailHeight*0.5+dWidth;
XPoint ptLow,ptUp;
ads_polar(ptLowLeft, m_nRotation+PI*0.5, m_nSlabSize-m_nStepDist-dWidth+distOut, ptLow);
ads_polar(ptUpLeft, m_nRotation-PI*0.5, m_nSlabSize-m_nStepDist-dWidth+distOut, ptUp);
dc<<XLine(ptLowLeft,ptLow)<<XLine(ptUp,ptUpLeft);
}
ads_polar(ptLocation, m_nRotation, m_nStairWidth*0.5+dWidth*8/3+m_dSpaceWidth, ptS);
ads_polar(ptS, m_nRotation+PI*0.5, dLength, ptE);
ads_polar(ptS, m_nRotation-PI*0.5, m_nStepDist, ptLeft);
ads_polar(ptLeft, m_nRotation, m_nStairWidth, ptRight);
dc<<XLine(ptLeft,ptRight); //平步线
ads_polar(ptE, m_nRotation+PI*0.5, m_nStepDist, ptLeft);
ads_polar(ptLeft, m_nRotation, m_nStairWidth, ptRight);
dc<<XLine(ptLeft,ptRight); //平步线
DrawRailLine(ptS,ptE,m_nRotation+PI*0.5,dWidth,dc);
DrawInSlabLine(ptS,ptE,m_nRotation+PI*0.5,dWidth,dc);
DrawOutSlabLine(ptS,ptE,m_nRotation+PI*0.5,dWidth,TRUE,dc);
pt1=ptS,pt2=ptE;
ads_polar(ptS, m_nRotation, m_nStairWidth, ptE);
ads_polar(ptE, m_nRotation+PI*0.5, dLength, ptS);
if(!(IsAscent()&&fabs(m_dSlopeAngle)<1.0e-5))
{
dc<<XLine(ptE,pt1)<<XLine(ptS,pt2);
}
DrawRailLine(ptS,ptE,m_nRotation-PI*0.5,dWidth,dc);
DrawInSlabLine(ptS,ptE,m_nRotation-PI*0.5,dWidth,dc);
DrawOutSlabLine(ptS,ptE,m_nRotation-PI*0.5,dWidth,TRUE,dc);
}
for(long i=0;i<clipCount;i++)
dc.PopClip();
}
return Acad::eOk;
}
//扶手线
void
TDbAutoStair::DrawRailLine(XPoint ptS,XPoint ptE,double rot,double dWidth,XExplodeDraw &dc)const
{
double dist=_AS_SYS_UNIT(99); //内侧垫板宽度
double dRailDist=m_nStepDist+m_nRailHeight*0.5+dWidth;
XPoint ptLow1,ptUp1,ptLow2,ptUp2,ptTmp;
ads_polar(ptS, rot+PI*0.5, dist, ptTmp);
ads_polar(ptTmp, rot-PI, dRailDist, ptLow1);
ads_polar(ptLow1, rot+PI*0.5, m_nRailWidth, ptLow2);
ads_polar(ptE, rot+PI*0.5, dist, ptTmp);
ads_polar(ptTmp, rot, dRailDist, ptUp1);
ads_polar(ptUp1, rot+PI*0.5, m_nRailWidth, ptUp2);
dc<<XLine(ptLow1,ptLow2)<<XLine(ptLow2,ptUp2)<<XLine(ptUp2,ptUp1)<<XLine(ptUp1,ptLow1);
}
//内侧垫板线
void
TDbAutoStair::DrawInSlabLine(XPoint ptS,XPoint ptE,double rot,double dWidth,XExplodeDraw &dc)const
{
double dist=_AS_SYS_UNIT(99); //内侧垫板宽度
double dRailDist=m_nStepDist+m_nRailHeight*0.5+dWidth;
XPoint ptLow1,ptUp1,ptLow2,ptUp2,ptTmp;
ads_polar(ptS, rot+PI*0.5, dist, ptTmp);
ads_polar(ptTmp, rot+PI, dRailDist-m_nRailHeight*0.5, ptLow1);
ads_polar(ptS, rot+PI, dRailDist-(dWidth-m_nRailWidth+m_nRailHeight)*0.5, ptLow2);
ads_polar(ptE, rot+PI*0.5, dist, ptTmp);
ads_polar(ptTmp, rot, dRailDist-m_nRailHeight*0.5, ptUp1);
ads_polar(ptE, rot, dRailDist-(dWidth-m_nRailWidth+m_nRailHeight)*0.5, ptUp2);
dc<<XLine(ptLow1,ptLow2)<<XLine(ptLow2,ptUp2)<<XLine(ptUp2,ptUp1);
}
//外侧垫板线
void
TDbAutoStair::DrawOutSlabLine(XPoint ptS,XPoint ptE,double rot,double dWidth,BOOL bConnect,XExplodeDraw &dc)const
{
double dist=_AS_SYS_UNIT(99); //内侧垫板宽度
double distOut=_AS_SYS_UNIT(86); //外侧垫板宽度
double dRailDist=m_nStepDist+m_nRailHeight*0.5+dWidth;
XPoint ptLow1,ptUp1,ptLow2,ptUp2,ptTmp;
ads_polar(ptS, rot+PI*0.5, dist+m_nRailWidth, ptTmp);
ads_polar(ptTmp, rot+PI, dRailDist-m_nRailHeight*0.5, ptLow1);
ads_polar(ptE, rot+PI*0.5, dist+m_nRailWidth, ptTmp);
ads_polar(ptTmp, rot, dRailDist-m_nRailHeight*0.5, ptUp1);
ads_polar(ptLow1, rot+PI*0.5, distOut, ptLow2);
ads_polar(ptUp1, rot+PI*0.5, distOut, ptUp2);
if(bConnect)
{
ads_polar(ptLow2, rot, distOut, ptLow2);
ads_polar(ptUp2, rot+PI, distOut, ptUp2);
dc<<XLine(ptLow1,ptLow2)<<XLine(ptLow2,ptUp2)<<XLine(ptUp2,ptUp1);
}
else
{
dc<<XLine(ptLow1,ptLow2)<<XLine(ptUp1,ptUp2);
}
}
XDirectionCurve
TDbAutoStair::GetSideCurve2d(int nSide) const
{
assertReadEnabled();
XPoint pt[8];
double dWidth=_AS_SYS_UNIT(205.5);
double dLength=GetLength();
ads_polar(GetUpLeft2d(),m_nRotation-PI/2,m_nSlabSize+dLength, pt[0]);
pt[0].z=0;
ads_polar(pt[0], m_nRotation+PI/2.0, dLength, pt[3]);
ads_polar(pt[0], m_nRotation, m_nStairWidth+dWidth*8.0/3, pt[1]);
ads_polar(pt[3], m_nRotation, m_nStairWidth+dWidth*8.0/3, pt[2]);
if(!IsSingleStair())
{
ads_polar(pt[1], m_nRotation, m_dSpaceWidth, pt[4]);
ads_polar(pt[2], m_nRotation, m_dSpaceWidth, pt[5]);
{
ads_polar(pt[4], m_nRotation, m_nStairWidth+dWidth*8.0/3, pt[7]);
ads_polar(pt[5], m_nRotation, m_nStairWidth+dWidth*8.0/3, pt[6]);
}
}
XDirectionCurve cv;
if(nSide==OFFSET_LEFT)
cv = XDirectionCurve(pt[0], pt[3], 0.0);
else if(nSide==OFFSET_RIGHT)
cv = XDirectionCurve(pt[1], pt[2], 0.0);
else if(nSide==2)
{
cv = XDirectionCurve(pt[4], pt[5], 0.0);
}
else
{
cv = XDirectionCurve(pt[7], pt[6], 0.0);
}
return cv;
}
BOOL
TDbAutoStair::GetSectionPoly(double lSectionPos,double rSectionPos,int nSide,XPoly &polyDown, XPoly &polyUp, XPoly &polyMid) const
{
double nAng = PI/8.0;
XDirectionCurve lCurve=GetSideCurve2d(nSide),
rCurve=GetSideCurve2d(nSide+1);
lCurve.SetLineFlag(LS_FINITE);
rCurve.SetLineFlag(LS_FINITE);
XPoint ptFrom, ptTo;
ptFrom = XLine(lCurve.StartPoint(), rCurve.StartPoint()).MidPoint();
ptTo = XLine(lCurve.EndPoint(), rCurve.EndPoint()).MidPoint();
int nIntNum;
XPoint ptInter[2];
XPointDir2d ptTemp1, ptTemp2;
lCurve.Polar(lCurve.GetLength()*lSectionPos, ptTemp1);
rCurve.Polar(rCurve.GetLength()*rSectionPos, ptTemp2);
XLine lnCen(ptTemp1, ptTemp2);
XPoint ptCen;
ptCen = lnCen.MidPoint();
double nSectDir=lnCen.Direction();
double nOffDist = _AS_SYS_UNIT(50.0);
XLine lnDown=lnCen.Offset(nOffDist),
lnUp=lnCen.Offset(-nOffDist);
nIntNum=lCurve.Intersection(lnUp, ptInter[0], ptInter[1]);
if(!nIntNum) return FALSE;
else if(nIntNum==1) lnUp.StartPoint()=ptInter[0];
else lnUp.StartPoint()=XLine(ptInter[0], ptInter[1]).NearPoint(ptTemp1);
nIntNum=rCurve.Intersection(lnUp, ptInter[0], ptInter[1]);
if(!nIntNum) return FALSE;
else if(nIntNum==1) lnUp.EndPoint()=ptInter[0];
else lnUp.EndPoint()=XLine(ptInter[0], ptInter[1]).NearPoint(ptTemp2);
nIntNum=lCurve.Intersection(lnDown, ptInter[0], ptInter[1]);
if(!nIntNum) return FALSE;
else if(nIntNum==1) lnDown.StartPoint()=ptInter[0];
else lnDown.StartPoint()=XLine(ptInter[0], ptInter[1]).NearPoint(ptTemp1);
nIntNum=rCurve.Intersection(lnDown, ptInter[0], ptInter[1]);
if(!nIntNum) return FALSE;
else if(nIntNum==1) lnDown.EndPoint()=ptInter[0];
else lnDown.EndPoint()=XLine(ptInter[0], ptInter[1]).NearPoint(ptTemp2);
XPoint ptUp1, ptUp2, ptDown1, ptDown2, ptUp, ptDown, ptMid1, ptMid2;
ads_polar(ptCen, nSectDir+115.0/180.0*PI, _AS_SYS_UNIT(270.0)/2.0, ptUp);
ads_polar(ptCen, nSectDir-75.0/180*PI, _AS_SYS_UNIT(270.0)/2.0, ptDown);
XLine lnLeft(ptUp, CT_std_angle(nSectDir+75.0/180*PI));
XLine lnRight(ptDown, CT_std_angle(nSectDir+75.0/180*PI));
if(lnUp.Intersection(&lnLeft, ptUp1)!=1 ||
lnUp.Intersection(&lnRight, ptUp2)!=1)
return FALSE;
if(lnDown.Intersection(&lnLeft, ptDown1)!=1 ||
lnDown.Intersection(&lnRight, ptDown2)!=1)
return FALSE;
if(lnCen.Intersection(&lnLeft, ptMid1)!=1 ||
lnCen.Intersection(&lnRight, ptMid2)!=1)
return FALSE;
polyDown.Reset();
polyUp.Reset();
polyMid.Reset();
polyUp.Append(new XPoint(lnUp.StartPoint()));
polyUp.Append(new XPoint(ptUp1));
polyUp.Append(new XPoint(ptUp));
polyUp.Append(new XPoint(ptUp2));
polyUp.Append(new XPoint(lnUp.EndPoint()));
polyDown.Append(new XPoint(lnDown.EndPoint()));
polyDown.Append(new XPoint(ptDown2));
polyDown.Append(new XPoint(ptDown));
polyDown.Append(new XPoint(ptDown1));
polyDown.Append(new XPoint(lnDown.StartPoint()));
polyMid.Append(new XPoint(lnCen.EndPoint()));
polyMid.Append(new XPoint(ptMid2));
polyMid.Append(new XPoint(ptDown));
polyMid.Append(new XPoint(ptUp));
polyMid.Append(new XPoint(ptMid1));
polyMid.Append(new XPoint(lnCen.StartPoint()));
return TRUE;
}
double
TDbAutoStair::GetStepHeight() const
{
assertReadEnabled();
return m_nStepHeight;
}
double
TDbAutoStair::GetLength()const
{
if(!IsAscent())
{
if(fabs(tan(m_dSlopeAngle*PI/180))>_DIST_SNAP)
{
double length=m_dFloorHeight/tan(m_dSlopeAngle*PI/180);
int num=(int)(length/m_nStepWidth);
return m_nStepWidth*num;
}
}
return m_dSlopeLength;
}
double
TDbAutoStair::GetRailHeight() const
{
assertReadEnabled();
return m_nRailHeight;
}
double
TDbAutoStair::GetRailWidth() const
{
assertReadEnabled();
return m_nRailWidth;
}
double
TDbAutoStair::GetStepDist() const
{
assertReadEnabled();
return m_nStepDist;
}
double
TDbAutoStair::GetStairWidth() const
{
assertReadEnabled();
return m_nStairWidth;
}
double
TDbAutoStair::GetStepWidth() const
{
assertReadEnabled();
return m_nStepWidth;
}
Adesk::UInt8
TDbAutoStair::GetStairFlag() const
{
assertReadEnabled();
return m_nStairFlag;
}
double
TDbAutoStair::GetElevation() const
{
assertReadEnabled();
return m_ptLocation.z;
}
XPoint
TDbAutoStair::GetLocation() const
{
assertReadEnabled();
return m_ptLocation;
}
XPoint
TDbAutoStair::GetUpRight2d() const
{
assertReadEnabled();
XPoint pt=GetUpLeft2d();
double dWidth=_AS_SYS_UNIT(205.5);
double dTotalWidth=dWidth*8/3+m_nStairWidth;
if(!IsSingleStair())
{
dTotalWidth = dTotalWidth*2+m_dSpaceWidth;
}
ads_polar(XPoint(pt), m_nRotation, dTotalWidth, pt);
return pt;
}
XPoint
TDbAutoStair::GetUpLeft2d() const
{
assertReadEnabled();
XPoint pt=m_ptLocation;
pt.z=0;
return pt;
}
double
TDbAutoStair::GetRotation() const
{
assertReadEnabled();
return m_nRotation;
}
double
TDbAutoStair::GetSlabSize() const
{
assertReadEnabled();
return m_nSlabSize;
}
void
TDbAutoStair::SetSlabSize(double s)
{
assertWriteEnabled();
m_nSlabSize=s;
}
double
TDbAutoStair::GetFloorHeight()const
{
assertReadEnabled();
return m_dFloorHeight;
}
void
TDbAutoStair::SetFloorHeight(double h)
{
assertWriteEnabled();
m_dFloorHeight=h;
}
double
TDbAutoStair::GetTextHeight()const
{
assertReadEnabled();
return m_dTextHeight;
}
void
TDbAutoStair::SetTextHeight(double h)
{
assertWriteEnabled();
m_dTextHeight=h;
}
double
TDbAutoStair::GetSlopeAngle()const
{
assertReadEnabled();
return m_dSlopeAngle;
}
void
TDbAutoStair::SetSlopeAngle(double a)
{
assertWriteEnabled();
m_dSlopeAngle=a;
}
double
TDbAutoStair::GetHoleLength()const
{
assertReadEnabled();
return m_dHoleLength;
}
void
TDbAutoStair::SetHoleLength(double a)
{
assertWriteEnabled();
m_dHoleLength=a;
}
double
TDbAutoStair::GetSlopeLength()const
{
assertReadEnabled();
return m_dSlopeLength;
}
void
TDbAutoStair::SetSlopeLength(double a)
{
assertWriteEnabled();
m_dSlopeLength=a;
}
double
TDbAutoStair::GetLSectPos()const
{
assertReadEnabled();
return m_lSectPos;
}
double
TDbAutoStair::GetRSectPos()const
{
assertReadEnabled();
return m_rSectPos;
}
void
TDbAutoStair::SetLSectPos(double l)
{
assertWriteEnabled();
m_lSectPos=l;
}
void
TDbAutoStair::SetRSectPos(double l)
{
assertWriteEnabled();
m_rSectPos=l;
}
double
TDbAutoStair::GetSpaceWidth() const
{
assertReadEnabled();
return m_dSpaceWidth;
}
void
TDbAutoStair::SetSpaceWidth(double w)
{
assertWriteEnabled();
m_dSpaceWidth=w;
}
int
TDbAutoStair::GetStartSide() const
{
assertReadEnabled();
return m_nStartSide;
}
void
TDbAutoStair::SetStartSide(int nSide)
{
assertWriteEnabled();
m_nStartSide=nSide;
}
void
TDbAutoStair::SetRailHeight(double l)
{
assertWriteEnabled();
m_nRailHeight=l;
}
void
TDbAutoStair::SetRailWidth(double w)
{
assertWriteEnabled();
m_nRailWidth=w;
}
void
TDbAutoStair::SetStepDist(double l)
{
assertWriteEnabled();
m_nStepDist=l;
}
void
TDbAutoStair::SetStairFlag(Adesk::UInt8 flag)
{
assertWriteEnabled();
m_nStairFlag=flag;
}
void
TDbAutoStair::SetStepWidth(double w)
{
assertWriteEnabled();
m_nStepWidth=w;
}
void
TDbAutoStair::SetStairWidth(double w)
{
assertWriteEnabled();
m_nStairWidth=w;
}
void
TDbAutoStair::SetElevation(double elev)
{
assertWriteEnabled();
m_ptLocation.z = elev;
}
void
TDbAutoStair::SetLocation(const XPoint &pt)
{
assertWriteEnabled();
m_ptLocation = pt;
}
void
TDbAutoStair::SetRotation(double rot)
{
assertWriteEnabled();
m_nRotation=rot;
}
void
TDbAutoStair::SetStepHeight(double h)
{
assertWriteEnabled();
m_nStepHeight=h;
}
void TDbAutoStair::SetArrow(BOOL bTrue)
{
assertWriteEnabled();
if(bTrue)
m_nFlagEx|=SFEX_ARROW;
else
m_nFlagEx&=~SFEX_ARROW;
}
BOOL TDbAutoStair::IsArrow() const
{
return ((m_nFlagEx&SFEX_ARROW)!=0);
}
BOOL TDbAutoStair::IsHasHole()const
{
return ((m_nFlagEx&SFEX_HASHOLE)!=0);
}
void TDbAutoStair::SetHasHole(BOOL bTrue)
{
assertWriteEnabled();
if(bTrue)
m_nFlagEx|=SFEX_HASHOLE;
else
m_nFlagEx&=~SFEX_HASHOLE;
}
BOOL TDbAutoStair::IsCross()const
{
return ((m_nFlagEx&SFEX_CROSSSTAIR)!=0);
}
void TDbAutoStair::SetCross(BOOL bTrue)
{
assertWriteEnabled();
if(bTrue)
m_nFlagEx|=SFEX_CROSSSTAIR;
else
m_nFlagEx&=~SFEX_CROSSSTAIR;
}
BOOL TDbAutoStair::IsSameDir()const
{
return ((m_nFlagEx&SFEX_SAMEDIR)!=0);
}
void TDbAutoStair::SetSameDir(BOOL bTrue)
{
assertWriteEnabled();
if(bTrue)
m_nFlagEx|=SFEX_SAMEDIR;
else
m_nFlagEx&=~SFEX_SAMEDIR;
}
BOOL TDbAutoStair::IsSingleStair()const
{
return ((m_nFlagEx&SFEX_SINGLESTAIR)!=0);
}
void TDbAutoStair::SetSingleStair(BOOL bTrue)
{
assertWriteEnabled();
if(bTrue)
m_nFlagEx|=SFEX_SINGLESTAIR;
else
m_nFlagEx&=~SFEX_SINGLESTAIR;
}
BOOL TDbAutoStair::IsAscent() const
{
return ((m_nFlagEx&SFEX_ASCENT)!=0);
}
BOOL TDbAutoStair::IsOnGround() const
{
return ((m_nFlagEx&SFEX_GROUND)!=0);
}
BOOL TDbAutoStair::HasSlant() const
{
return ((m_nFlagEx&SFEX_SLANT)!=0);
}
void TDbAutoStair::SetAscent(BOOL bTrue)
{
assertWriteEnabled();
if(bTrue)
m_nFlagEx |= SFEX_ASCENT;
else
m_nFlagEx &= ~SFEX_ASCENT;
}
void TDbAutoStair::SetOnGround(BOOL bTrue)
{
assertWriteEnabled();
if(bTrue)
m_nFlagEx |= SFEX_GROUND;
else
m_nFlagEx &= ~SFEX_GROUND;
}
void TDbAutoStair::SetSlant(BOOL bTrue)
{
assertWriteEnabled();
if(bTrue)
m_nFlagEx |= SFEX_SLANT;
else
m_nFlagEx &= ~SFEX_SLANT;
}
double TDbAutoStair::GetSlabThick() const
{
return m_nSlabThick;
}
AcDbObjectId TDbAutoStair::GetLayerStep3d() const
{
return m_idLayerStep3d;
}
AcDbObjectId TDbAutoStair::GetLayerText() const
{
return m_idLayerText;
}
AcDbObjectId TDbAutoStair::GetTextStyle() const
{
return m_idTextStyle;
}
AcDbObjectId TDbAutoStair::GetLayerArrow() const
{
return m_idLayerArrow;
}
void TDbAutoStair::SetSlabThick(double val)
{
assertWriteEnabled();
m_nSlabThick=val;
}
void TDbAutoStair::SetLayerStep3d(AcDbObjectId idLayer)
{
assertWriteEnabled();
m_idLayerStep3d=idLayer;
}
void TDbAutoStair::SetLayerText(AcDbObjectId idLayer)
{
assertWriteEnabled();
m_idLayerText=idLayer;
}
void TDbAutoStair::SetTextStyle(AcDbObjectId idStyle)
{
assertWriteEnabled();
m_idTextStyle=idStyle;
}
void TDbAutoStair::SetLayerArrow(AcDbObjectId idLayer)
{
assertWriteEnabled();
m_idLayerArrow=idLayer;
}
//add by xlc 090426,箭头文字,动态数据
CString TDbAutoStair::GetTextUp() const
{
assertReadEnabled();
CString sVal(_T("上"));
const TEntityFields &fd = GetFields();
fd.GFD(_T("上楼箭头文字"), sVal);
return sVal;
}
void TDbAutoStair::SetTextUp(const TCHAR *sVal)
{
assertWriteEnabled();
TEntityFields &fd = Fields();
fd.SFD(_T("上楼箭头文字"), sVal);
}
CString TDbAutoStair::GetTextDown() const
{
assertReadEnabled();
CString sVal(_T("下"));
const TEntityFields &fd = GetFields();
fd.GFD(_T("下楼箭头文字"), sVal);
return sVal;
}
void TDbAutoStair::SetTextDown(const TCHAR *sVal)
{
assertWriteEnabled();
TEntityFields &fd = Fields();
fd.SFD(_T("下楼箭头文字"), sVal);
}
//////////////////////////////////////////////////
void InitDbAutoStair(BOOL bTrue)
{
if(bTrue)
{
TDbAutoStair::rxInit();
acrxBuildClassHierarchy();
TDbAutoStair::InitMatchProtocol(TRUE);
}
else
{
TDbAutoStair::InitMatchProtocol(FALSE);
deleteAcRxClass(TDbAutoStair::desc());
}
}