1145 lines
30 KiB
C++
1145 lines
30 KiB
C++
/////////////////////////////////////////////
|
||
// TDbDrawingName custom object.
|
||
|
||
#include "StdAfx.h"
|
||
|
||
|
||
// sg add 120313,增加符号文字导出所在图层设置
|
||
extern int g_nSymbTextT3Layer;
|
||
|
||
// nVersion=1:5.0-7.0;nVersion=2:8.0的Beta1;nVersion=2:8.0的Beta2起
|
||
// Adesk::Int16 TDbDrawingName::g_nVersion = 1; // sg modify 090112
|
||
// Adesk::Int16 TDbDrawingName::g_nVersion = 2; // sg modify 090325
|
||
Adesk::Int16 TDbDrawingName::g_nVersion = 3;
|
||
|
||
ACRX_DXF_DEFINE_MEMBERS(ATSDrawingName, ATSEntity, AcDb::kDHL_CURRENT,
|
||
AcDb::kMReleaseCurrent, 1 ,ATS_DRAWINGNAME,
|
||
"ATS_DRAWINGNAME图形无法解析, 请下载上华软件|网址: www.shanghuasoft.com");
|
||
IMPLEMENT_TENTBASE(TDbDrawingName);
|
||
|
||
#define DRAWINGNAME_REGIONPL _T("DNREGION")
|
||
|
||
// Constructor / Destructor
|
||
TDbDrawingName::TDbDrawingName()
|
||
{
|
||
m_dRotation = 0.0;
|
||
m_dNameHeight = 7.0;
|
||
m_dScaleHeight = 5.0;
|
||
m_dLineWidth = 0.7;
|
||
// m_dMultiple = 1.0;
|
||
m_dMultiple = 0.6; // modified by whl on 020613
|
||
// sg modify 120106,给“TS_DRAWINGNAME”独立出来一个文字样式
|
||
//m_idNameStyle = InitTextStyle(TS_STANDARD);
|
||
//m_idScaleStyle = InitTextStyle(TS_STANDARD);
|
||
m_idNameStyle = InitTextStyle(TS_DRAWINGNAME);
|
||
m_idScaleStyle = InitTextStyle(TS_DRAWINGNAME);
|
||
m_bShowScale = TRUE;
|
||
m_iDrawStyle = 1;
|
||
m_colorText = 7;
|
||
m_bShowRegion = FALSE;
|
||
}
|
||
|
||
Acad::ErrorStatus
|
||
TDbDrawingName::subGetClassID(CLSID* pClsid) const
|
||
{
|
||
return Acad::eOk;
|
||
}
|
||
|
||
Acad::ErrorStatus
|
||
TDbDrawingName::dwgInFields(AcDbDwgFiler* filer)
|
||
{
|
||
assertWriteEnabled();
|
||
Acad::ErrorStatus es;
|
||
if ((es = TDbEntity::dwgInFields(filer)) != Acad::eOk)
|
||
return es;
|
||
|
||
Adesk::Int16 version;
|
||
filer->readItem(&version);
|
||
if (version > g_nVersion)
|
||
return Acad::eMakeMeProxy;
|
||
|
||
// switch(version)
|
||
// {
|
||
// case 1:
|
||
// {
|
||
// AcGePoint3d ptLoc;
|
||
// filer->readItem(&ptLoc);
|
||
// m_ptLocation = ptLoc;
|
||
// ReadString(filer, m_szNameText);
|
||
// ReadString(filer, m_szScaleText);
|
||
// filer->readItem(&m_dRotation);
|
||
// filer->readItem(&m_dNameHeight);
|
||
// filer->readItem(&m_dScaleHeight);
|
||
// filer->readItem(&m_dLineWidth);
|
||
// filer->readItem(&m_dMultiple);
|
||
// filer->readItem(&m_idNameStyle);
|
||
// filer->readItem(&m_idScaleStyle);
|
||
// filer->readItem(&m_bShowScale);
|
||
// filer->readItem(&m_iDrawStyle);
|
||
// filer->readItem(&m_colorText);
|
||
// break;
|
||
// }
|
||
// default:
|
||
// assert(false);
|
||
// }
|
||
|
||
AcGePoint3d ptLoc; // sg modify 090112
|
||
filer->readItem(&ptLoc);
|
||
m_ptLocation = ptLoc;
|
||
ReadString(filer, m_szNameText);
|
||
ReadString(filer, m_szScaleText);
|
||
filer->readItem(&m_dRotation);
|
||
filer->readItem(&m_dNameHeight);
|
||
filer->readItem(&m_dScaleHeight);
|
||
filer->readItem(&m_dLineWidth);
|
||
filer->readItem(&m_dMultiple);
|
||
filer->readItem(&m_idNameStyle);
|
||
filer->readItem(&m_idScaleStyle);
|
||
filer->readItem(&m_bShowScale);
|
||
filer->readItem(&m_iDrawStyle);
|
||
filer->readItem(&m_colorText);
|
||
|
||
if (version > 1) // sg add 090112,8.0起
|
||
{
|
||
filer->readItem((AcGePoint3d *)&m_ptMidLoc);
|
||
if (version == 2) // sg add 090325,处理8.0的Beta1版本
|
||
{
|
||
GetCenterPtIncludeScale(); // 转化为Beta2中的包括比例部分的居中对齐点
|
||
// sg add 090325,8.0的BETA2起,将“文字转角”并入“布局转角”
|
||
m_nLayoutRotation = m_nLayoutRotation + m_dRotation;
|
||
m_dRotation = 0;
|
||
}
|
||
}
|
||
else // 处理8.0以前版本
|
||
{
|
||
GetBottomCenterPt(); // 将7.5中的m_ptLocation点转化为m_ptMidLoc
|
||
// sg add 090320,8.0的BETA2起,将“文字转角”并入“布局转角”
|
||
m_nLayoutRotation = m_nLayoutRotation + m_dRotation;
|
||
m_dRotation = 0;
|
||
}
|
||
return filer->filerStatus();
|
||
}
|
||
|
||
Acad::ErrorStatus
|
||
TDbDrawingName::dwgOutFields(AcDbDwgFiler* filer) const
|
||
{
|
||
assertReadEnabled();
|
||
if (!IsValid())
|
||
return Acad::eNotApplicable;
|
||
|
||
Acad::ErrorStatus es;
|
||
if ((es = TDbEntity::dwgOutFields(filer)) != Acad::eOk)
|
||
return es;
|
||
|
||
Adesk::Int16 version = g_nVersion;
|
||
// filer->writeItem(version);
|
||
if (g_nSaveTArchVer < 8) // 7.5及以前,版本号为1,sg modify 090112
|
||
filer->writeItem((Adesk::UInt16)1);
|
||
else // 8.0的BETA2,版本号为3
|
||
filer->writeItem(g_nVersion);
|
||
|
||
filer->writeItem(m_ptLocation.AsAcGePoint3d());
|
||
filer->writeItem(m_szNameText);
|
||
filer->writeItem(m_szScaleText);
|
||
filer->writeItem(m_dRotation);
|
||
filer->writeItem(m_dNameHeight);
|
||
filer->writeItem(m_dScaleHeight);
|
||
filer->writeItem(m_dLineWidth);
|
||
filer->writeItem(m_dMultiple);
|
||
filer->writeItem(m_idNameStyle);
|
||
filer->writeItem(m_idScaleStyle);
|
||
filer->writeItem(m_bShowScale);
|
||
filer->writeItem(m_iDrawStyle);
|
||
filer->writeItem(m_colorText);
|
||
|
||
if (g_nSaveTArchVer > 7) // sg add 090112
|
||
{
|
||
filer->writeItem(m_ptMidLoc.AsAcGePoint3d());
|
||
}
|
||
return filer->filerStatus();
|
||
}
|
||
|
||
Acad::ErrorStatus
|
||
TDbDrawingName::dxfInFields(AcDbDxfFiler* filer)
|
||
{
|
||
assertWriteEnabled();
|
||
Acad::ErrorStatus es = Acad::eOk;
|
||
resbuf rb;
|
||
if (TDbEntity::dxfInFields(filer) != Acad::eOk ||
|
||
!filer->atSubclassData(_T("TDbDrawingName")))
|
||
{
|
||
return filer->filerStatus();
|
||
}
|
||
|
||
Adesk::Int16 version;
|
||
filer->readItem(&rb);
|
||
if (rb.restype != AcDb::kDxfInt16)
|
||
{
|
||
filer->pushBackItem();
|
||
filer->setError(Acad::eInvalidDxfCode, _T("\n错误:需要组码%d(version)"), AcDb::kDxfInt16);
|
||
return filer->filerStatus();
|
||
}
|
||
|
||
version = rb.resval.rint;
|
||
if (version > g_nVersion)
|
||
return Acad::eMakeMeProxy;
|
||
|
||
while((es == Acad::eOk) && ((es = filer->readResBuf(&rb)) == Acad::eOk))
|
||
{
|
||
switch(rb.restype) {
|
||
case AcDb::kDxfXCoord:
|
||
m_ptLocation = asPnt3d(rb.resval.rpoint);
|
||
break;
|
||
case AcDb::kDxfText:
|
||
m_szNameText = rb.resval.rstring;
|
||
break;
|
||
case AcDb::kDxfText+1:
|
||
m_szScaleText = rb.resval.rstring;
|
||
break;
|
||
case AcDb::kDxfAngle:
|
||
m_dRotation = rb.resval.rreal;
|
||
break;
|
||
case AcDb::kDxfReal:
|
||
m_dNameHeight = rb.resval.rreal;
|
||
break;
|
||
case AcDb::kDxfReal+1:
|
||
m_dScaleHeight = rb.resval.rreal;
|
||
break;
|
||
case AcDb::kDxfReal+2:
|
||
m_dLineWidth = rb.resval.rreal;
|
||
break;
|
||
case AcDb::kDxfReal+3:
|
||
m_dMultiple = rb.resval.rreal;
|
||
break;
|
||
case AcDb::kDxfHardPointerId:
|
||
acdbGetObjectId(m_idNameStyle, rb.resval.rlname);
|
||
break;
|
||
case AcDb::kDxfHardPointerId+1:
|
||
acdbGetObjectId(m_idScaleStyle, rb.resval.rlname);
|
||
break;
|
||
case AcDb::kDxfBool:
|
||
m_bShowScale = rb.resval.rint;
|
||
break;
|
||
case AcDb::kDxfInt16+1:
|
||
m_iDrawStyle = rb.resval.rint;
|
||
break;
|
||
default:
|
||
filer->pushBackItem();
|
||
es = Acad::eEndOfFile;
|
||
break;
|
||
}
|
||
}
|
||
|
||
if (es != Acad::eEndOfFile)
|
||
return Acad::eInvalidResBuf;
|
||
return filer->filerStatus();
|
||
}
|
||
|
||
Acad::ErrorStatus
|
||
TDbDrawingName::dxfOutFields(AcDbDxfFiler* filer) const
|
||
{
|
||
assertReadEnabled();
|
||
if (!IsValid())
|
||
return Acad::eNotApplicable;
|
||
|
||
Acad::ErrorStatus es;
|
||
if ((es = TDbEntity::dxfOutFields(filer)) != Acad::eOk)
|
||
{
|
||
return es;
|
||
}
|
||
filer->writeItem(AcDb::kDxfSubclass, _T("TDbDrawingName"));
|
||
|
||
Adesk::UInt16 version = g_nVersion;
|
||
filer->writeInt16(AcDb::kDxfInt16, version);
|
||
filer->writePoint3d(AcDb::kDxfXCoord, m_ptLocation);
|
||
filer->writeString(AcDb::kDxfText, m_szNameText);
|
||
filer->writeString(AcDb::kDxfText+1, m_szScaleText);
|
||
filer->writeDouble(AcDb::kDxfAngle, m_dRotation);
|
||
filer->writeDouble(AcDb::kDxfReal, m_dNameHeight);
|
||
filer->writeDouble(AcDb::kDxfReal+1, m_dScaleHeight);
|
||
filer->writeDouble(AcDb::kDxfReal+2, m_dLineWidth);
|
||
filer->writeDouble(AcDb::kDxfReal+3, m_dMultiple);
|
||
filer->writeObjectId(AcDb::kDxfHardPointerId, m_idNameStyle);
|
||
filer->writeObjectId(AcDb::kDxfHardPointerId+1, m_idScaleStyle);
|
||
filer->writeInt16(AcDb::kDxfBool, m_bShowScale);
|
||
filer->writeInt16(AcDb::kDxfInt16+1, m_iDrawStyle);
|
||
return filer->filerStatus();
|
||
}
|
||
|
||
|
||
Acad::ErrorStatus TDbDrawingName::GetGripText(int idx, CString &cs) const
|
||
{
|
||
assertReadEnabled();
|
||
Acad::ErrorStatus es = Acad::eOk;
|
||
switch(idx) {
|
||
case 0:
|
||
cs = _T("移动图名标注");
|
||
break;
|
||
case 1:
|
||
cs = _T("移动比例位置");
|
||
break;
|
||
default:
|
||
es = Acad::eInvalidIndex;
|
||
break;
|
||
}
|
||
return es;
|
||
}
|
||
|
||
Acad::ErrorStatus
|
||
TDbDrawingName::subGetGripPoints(AcGePoint3dArray& gripPoints,
|
||
AcDbIntArray& osnapModes,
|
||
AcDbIntArray& geomIds) const
|
||
{
|
||
assertReadEnabled();
|
||
// gripPoints.append(m_ptLocation); // sg modify 090112,改为居中对齐点
|
||
gripPoints.append(m_ptMidLoc);
|
||
if (m_bShowScale) // 显示比例
|
||
{
|
||
XPoint ptScaleLoc = GetScaleLocation();
|
||
gripPoints.append(ptScaleLoc);
|
||
}
|
||
|
||
// add by hh 2013-10-15 增加区域线条夹点
|
||
TGGePoly2D poly;
|
||
if(GetRegionPoly(&poly))
|
||
{
|
||
for(int i = 0; i < poly.Length(); i++)
|
||
{
|
||
gripPoints.append(*(poly[i]));
|
||
}
|
||
}
|
||
// add end
|
||
|
||
return Acad::eOk;
|
||
}
|
||
|
||
Acad::ErrorStatus
|
||
TDbDrawingName::subGetOsnapPoints(AcDb::OsnapMode osnapMode,
|
||
INT_PTR gsSelectionMark,
|
||
const AcGePoint3d& pickPoint,
|
||
const AcGePoint3d& lastPoint,
|
||
const AcGeMatrix3d& viewXform,
|
||
AcGePoint3dArray& snapPoints,
|
||
AcDbIntArray& geomIds) const
|
||
{
|
||
assertReadEnabled();
|
||
Acad::ErrorStatus es = Acad::eNotApplicable;
|
||
switch(osnapMode) {
|
||
case AcDb::kOsModeIns:
|
||
{
|
||
// snapPoints.append(m_ptLocation); // sg modify 090112,改为居中对齐点
|
||
snapPoints.append(m_ptMidLoc);
|
||
if (m_bShowScale) // 显示比例
|
||
{
|
||
XPoint ptScaleLoc = GetScaleLocation();
|
||
snapPoints.append(ptScaleLoc);
|
||
}
|
||
es = Acad::eOk;
|
||
}
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
return es;
|
||
}
|
||
|
||
Acad::ErrorStatus
|
||
TDbDrawingName::subMoveGripPointsAt(const AcDbIntArray& indices,
|
||
const AcGeVector3d& offset)
|
||
{
|
||
if (indices.length()==0 || offset.isZeroLength())
|
||
return Acad::eOk;
|
||
|
||
assertWriteEnabled();
|
||
|
||
TDbXDataMap* pXData = GetSpecialtyData();
|
||
AcGePoint3dArray arPts;
|
||
pXData->GetAt(DRAWINGNAME_REGIONPL, arPts);
|
||
|
||
for (int i = 0; i < indices.length(); i++)
|
||
{
|
||
int idx = indices[i];
|
||
switch(idx) {
|
||
case 0:
|
||
// m_ptLocation += offset; // sg modify 090112,改为居中对齐点
|
||
m_ptMidLoc += offset;
|
||
break;
|
||
case 1:
|
||
{
|
||
if (m_bShowScale) // 显示比例
|
||
{
|
||
AcGeVector3d vtUnit(AcGeVector3d::kXAxis);
|
||
// sg modify 090320,8.0起将文字转角并入布局转角
|
||
// vtUnit.rotateBy(m_dRotation + GetLayoutRotation(), AcGeVector3d::kZAxis);
|
||
vtUnit.rotateBy(GetLayoutRotation(), AcGeVector3d::kZAxis);
|
||
|
||
double dAngle = vtUnit.angleTo(offset); // 将变化量投影到布局转角方向
|
||
m_dMultiple += offset.length() * cos(dAngle) / GetPScale() / m_dNameHeight;
|
||
}
|
||
}
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
|
||
// add by hh 2013-10-15 增加区域夹点的处理
|
||
if(0 != arPts.length())
|
||
{
|
||
if(m_bShowScale)
|
||
idx -= 2;
|
||
else
|
||
idx -= 1;
|
||
if(0 <= idx && idx < arPts.length())
|
||
{
|
||
arPts[idx] += offset;
|
||
SetRegionPoly(arPts);
|
||
}
|
||
}
|
||
// add end
|
||
}
|
||
return Acad::eOk;
|
||
}
|
||
|
||
Acad::ErrorStatus
|
||
TDbDrawingName::subTransformBy(const AcGeMatrix3d& xform)
|
||
{
|
||
assertWriteEnabled();
|
||
Acad::ErrorStatus es;
|
||
if ((es = TDbEntity::subTransformBy(xform)) != Acad::eOk)
|
||
return es;
|
||
|
||
// m_ptLocation.TransformBy(xform); // sg modify 090112,改为居中对齐点
|
||
m_ptMidLoc.TransformBy(xform);
|
||
|
||
// add by hh 2013-10-15 区域PL
|
||
TDbXDataMap* pXData = GetSpecialtyData();
|
||
if(NULL != pXData)
|
||
{
|
||
AcGePoint3dArray arPts;
|
||
if(pXData->GetAt(DRAWINGNAME_REGIONPL, arPts))
|
||
{
|
||
int nLen = arPts.length();
|
||
for(int i = 0; i < nLen; i++)
|
||
{
|
||
arPts[i].transformBy(xform);
|
||
}
|
||
SetRegionPoly(arPts);
|
||
}
|
||
}
|
||
// add end
|
||
|
||
// sg delete 090325,图名的位置点调整到整个符号的居中对齐,镜像时,不再需要调整
|
||
// AcGeVector3d vtRotation = GetVector();
|
||
// vtRotation.transformBy(xform);
|
||
// if (IsMirrorMatrix(xform))
|
||
// {
|
||
// AcGeVector3d vec = vtRotation;
|
||
// vec.rotateBy(Wcs2Ucs(0.0), AcGeVector3d::kZAxis);
|
||
// if (vec.x < 0.0)
|
||
// {
|
||
// m_ptLocation += vtRotation;
|
||
// vtRotation.negate();
|
||
// }
|
||
// else
|
||
// m_ptLocation -= m_dNameHeight * GetPScale() * vtRotation.perpVector();
|
||
// }
|
||
|
||
// modified by whl on 060707,只改变布局转角
|
||
// double dAngle = vtRotation.angleTo(AcGeVector3d::kXAxis);
|
||
// if (vtRotation.y < 0.0)
|
||
// dAngle = 2 * PI - dAngle;
|
||
// m_dRotation = dAngle - GetLayoutRotation();
|
||
return Acad::eOk;
|
||
}
|
||
|
||
// sg add 090327,获取整个符号长度/线长(沿布局转角方向)
|
||
double TDbDrawingName::GetTotalLen() const
|
||
{
|
||
assertReadEnabled();
|
||
TDbText text;
|
||
text.setPropertiesFrom(this);
|
||
text.SetRotation(0.0);
|
||
text.SetAlignment(XExplodeDraw::kBottomLeft);
|
||
text.SetHeight(m_dNameHeight);
|
||
text.SetStyleId(m_idNameStyle);
|
||
text.SetText(m_szNameText); // 图名文字
|
||
text.SetLocation(XPoint());
|
||
|
||
double dNameX(0.0), dNameY(0.0);
|
||
text.GetExtents(&dNameX, &dNameY);
|
||
|
||
double dRet = dNameX;
|
||
if (m_bShowScale) // 显示比例
|
||
{
|
||
text.SetHeight(m_dScaleHeight);
|
||
text.SetStyleId(m_idScaleStyle);
|
||
text.SetText(m_szScaleText); // 比例文字
|
||
text.SetLocation(XPoint());
|
||
|
||
double dScaleX(0.0), dScaleY(0.0);
|
||
text.GetExtents(&dScaleX, &dScaleY);
|
||
dRet += m_dMultiple * m_dNameHeight * GetPScale() + dScaleX;
|
||
if (m_iDrawStyle == 0) // 传统样式
|
||
dRet += 0.2 * m_dScaleHeight * GetPScale();
|
||
}
|
||
else // 不显示比例
|
||
dRet += 0.2 * m_dNameHeight * GetPScale();
|
||
return dRet;
|
||
}
|
||
|
||
double TDbDrawingName::GetLineLen() const
|
||
{
|
||
assertReadEnabled();
|
||
TDbText text;
|
||
text.setPropertiesFrom(this);
|
||
text.SetRotation(0.0);
|
||
text.SetAlignment(XExplodeDraw::kBottomLeft);
|
||
text.SetHeight(m_dNameHeight);
|
||
text.SetStyleId(m_idNameStyle);
|
||
text.SetText(m_szNameText); // 图名文字
|
||
text.SetLocation(XPoint());
|
||
|
||
double dNameX(0.0), dNameY(0.0);
|
||
text.GetExtents(&dNameX, &dNameY);
|
||
|
||
double dRet = dNameX;
|
||
if (m_bShowScale && m_iDrawStyle==0) // 传统样式,显示比例
|
||
{
|
||
text.SetHeight(m_dScaleHeight);
|
||
text.SetStyleId(m_idScaleStyle);
|
||
text.SetText(m_szScaleText); // 比例文字
|
||
text.SetLocation(XPoint());
|
||
|
||
double dScaleX(0.0), dScaleY(0.0);
|
||
text.GetExtents(&dScaleX, &dScaleY);
|
||
dRet += m_dMultiple * m_dNameHeight * GetPScale() + dScaleX;
|
||
dRet += 0.2 * m_dScaleHeight * GetPScale();
|
||
}
|
||
else // 不显示比例
|
||
dRet += 0.2 * m_dNameHeight * GetPScale();
|
||
return dRet;
|
||
}
|
||
|
||
// 根据m_ptMidLoc点,计算“图名”、“比例”绘制点
|
||
XPoint TDbDrawingName::GetNameDrawPt() const // sg add 090325,图名绘制点
|
||
{
|
||
assertReadEnabled();
|
||
AcGeVector3d vtUnit(AcGeVector3d::kXAxis);
|
||
// 8.0起,文字转角并入布局转角
|
||
vtUnit.rotateBy(GetLayoutRotation(), AcGeVector3d::kZAxis);
|
||
|
||
XPoint ptRet;
|
||
double dDist = GetTotalLen() * 0.5;
|
||
ptRet = m_ptMidLoc - dDist * vtUnit;
|
||
return ptRet;
|
||
}
|
||
|
||
XPoint TDbDrawingName::GetScaleLocation() const // 比例绘制点
|
||
{
|
||
assertReadEnabled();
|
||
AcGeVector3d vtUnit(AcGeVector3d::kXAxis);
|
||
// sg modify 090320,8.0起将文字转角并入布局转角
|
||
// vtUnit.rotateBy(m_dRotation+GetLayoutRotation(), AcGeVector3d::kZAxis);
|
||
vtUnit.rotateBy(GetLayoutRotation(), AcGeVector3d::kZAxis);
|
||
|
||
TDbText text;
|
||
text.setPropertiesFrom(this);
|
||
text.SetRotation(0.0);
|
||
text.SetAlignment(XExplodeDraw::kBottomLeft);
|
||
text.SetHeight(m_dNameHeight);
|
||
text.SetStyleId(m_idNameStyle);
|
||
text.SetText(m_szNameText); // 图名
|
||
text.SetLocation(XPoint());
|
||
|
||
double dNameX(0.0), dNameY(0.0);
|
||
text.GetExtents(&dNameX, &dNameY);
|
||
|
||
// sg delete 090327,调用GetTotalLen函数处理
|
||
// text.SetAlignment(XExplodeDraw::kBottomLeft);
|
||
// text.SetHeight(m_dScaleHeight);
|
||
// text.SetStyleId(m_idScaleStyle);
|
||
// text.SetText(m_szScaleText); // 比例
|
||
// text.SetLocation(XPoint());
|
||
// double dScaleX(0.0), dScaleY(0.0);
|
||
// text.GetExtents(&dScaleX, &dScaleY);
|
||
|
||
XPoint ptRet;
|
||
double dDist = GetTotalLen() * 0.5; // sg add 090327
|
||
// ptRet = m_ptLocation + (dNameX + m_dMultiple * dNameY) * vtUnit; // sg modify 090112
|
||
ptRet = m_ptMidLoc + (dNameX + m_dMultiple*dNameY - dDist) * vtUnit;
|
||
return ptRet;
|
||
}
|
||
|
||
|
||
// 8.0的Beta2起,该函数未使用,原设计意图是处理镜像时,整个符号的位置点
|
||
AcGeVector3d TDbDrawingName::GetVector() const
|
||
{
|
||
AcGeVector3d vtUnit(AcGeVector3d::kXAxis);
|
||
// sg modify 090320,8.0起将文字转角并入布局转角
|
||
// vtUnit.rotateBy(m_dRotation+GetLayoutRotation(), AcGeVector3d::kZAxis);
|
||
vtUnit.rotateBy(GetLayoutRotation(), AcGeVector3d::kZAxis);
|
||
|
||
TDbText text;
|
||
text.setPropertiesFrom(this);
|
||
text.SetRotation(0.0);
|
||
text.SetAlignment(XExplodeDraw::kBottomLeft);
|
||
text.SetHeight(m_dNameHeight);
|
||
text.SetStyleId(m_idNameStyle);
|
||
text.SetText(m_szNameText); // 图名
|
||
XPoint ptNameLoc;
|
||
text.SetLocation(ptNameLoc);
|
||
|
||
double dNameX(0.0), dNameY(0.0);
|
||
text.GetExtents(&dNameX, &dNameY);
|
||
// vtRotation = dNameX * vtUnit; // sg delete 090113
|
||
|
||
AcGeVector3d vtRotation;
|
||
double dScaleX(0.0), dScaleY(0.0);
|
||
if (m_bShowScale) // 比例
|
||
{
|
||
XPoint ptScaleLoc;
|
||
ptScaleLoc.x = ptNameLoc.x + (dNameX * 0.5 + m_dMultiple * dNameY);
|
||
ptScaleLoc.y = ptNameLoc.y;
|
||
text.SetHeight(m_dScaleHeight);
|
||
text.SetStyleId(m_idScaleStyle);
|
||
text.SetText(m_szScaleText);
|
||
text.SetLocation(ptScaleLoc);
|
||
text.SetAlignment(XExplodeDraw::kBottomLeft); // sg add 090112
|
||
text.GetExtents(&dScaleX, &dScaleY);
|
||
// vtRotation += (m_dMultiple * dNameY + dScaleX) * vtUnit;
|
||
vtRotation = (m_dMultiple * dNameY + dScaleX) * vtUnit; // sg modify 090113
|
||
}
|
||
return vtRotation;
|
||
}
|
||
|
||
double TDbDrawingName::GetOffset() const // ExplodeOrDraw2d函数中调用
|
||
{
|
||
TDbText text;
|
||
text.setPropertiesFrom(this);
|
||
text.SetLayoutRotation(0);
|
||
text.SetRotation(0.0);
|
||
text.SetAlignment(XExplodeDraw::kBottomLeft);
|
||
text.SetHeight(m_dNameHeight);
|
||
text.SetStyleId(m_idNameStyle);
|
||
text.SetText(m_szNameText);
|
||
text.SetLocation(XPoint());
|
||
|
||
XPoint ptLow, ptUp;
|
||
text.GetExtents2d(ptLow, ptUp);
|
||
return -ptLow.y;
|
||
}
|
||
|
||
|
||
// sg add 090112,将7.5中的m_ptLocation点转化为m_ptMidLoc
|
||
void TDbDrawingName::GetBottomCenterPt()
|
||
{
|
||
assertWriteEnabled();
|
||
AcGeVector3d vtUnit(AcGeVector3d::kXAxis);
|
||
// sg modify 090320,8.0起将文字转角并入布局转角
|
||
// vtUnit.rotateBy(m_dRotation+GetLayoutRotation(), AcGeVector3d::kZAxis);
|
||
vtUnit.rotateBy(GetLayoutRotation(), AcGeVector3d::kZAxis);
|
||
|
||
double dDist = GetTotalLen() * 0.5; // sg modify 090327
|
||
m_ptMidLoc = m_ptLocation + dDist * vtUnit;
|
||
}
|
||
|
||
XPoint TDbDrawingName::GetBottomLeftPt() const
|
||
{
|
||
AcGeVector3d vtUnit(AcGeVector3d::kXAxis);
|
||
// sg modify 090320,8.0起将文字转角并入布局转角
|
||
// vtUnit.rotateBy(m_dRotation+GetLayoutRotation(), AcGeVector3d::kZAxis);
|
||
vtUnit.rotateBy(GetLayoutRotation(), AcGeVector3d::kZAxis);
|
||
|
||
double dDist = GetTotalLen() * 0.5; // sg modify 090327
|
||
XPoint ptRet = m_ptMidLoc - dDist * vtUnit;
|
||
return ptRet;
|
||
}
|
||
|
||
// sg add 090325,根据Beta1中的图名居中对齐点,得到Beta2中的包括比例部分的居中对齐点
|
||
void TDbDrawingName::GetCenterPtIncludeScale()
|
||
{
|
||
assertWriteEnabled();
|
||
AcGeVector3d vtUnit(AcGeVector3d::kXAxis);
|
||
vtUnit.rotateBy(GetLayoutRotation(), AcGeVector3d::kZAxis);
|
||
|
||
TDbText text;
|
||
text.setPropertiesFrom(this);
|
||
text.SetRotation(0.0);
|
||
text.SetAlignment(XExplodeDraw::kBottomLeft);
|
||
text.SetHeight(m_dNameHeight);
|
||
text.SetStyleId(m_idNameStyle);
|
||
text.SetText(m_szNameText);
|
||
text.SetLocation(XPoint());
|
||
|
||
double dNameX(0.0), dNameY(0.0);
|
||
text.GetExtents(&dNameX, &dNameY);
|
||
double dDist = (GetTotalLen() - dNameX) * 0.5;
|
||
m_ptMidLoc = m_ptMidLoc + dDist * vtUnit;
|
||
}
|
||
|
||
Acad::ErrorStatus TDbDrawingName::DownGradeSave(int nDrawMode, AcDbVoidPtrArray &entSet,
|
||
BOOL *bErase)
|
||
{
|
||
// if (g_nSaveTArchVer < 7) // 7.0开始才有圆圈文字,sg modify 090729
|
||
if (g_nSaveTArchVer<7 && g_nSaveTArchVer>3) // 7.0开始才有圆圈文字
|
||
{
|
||
BOOL bHasCircle = FALSE;
|
||
long num = GetSubTextNum();
|
||
for (long i=0; i<num; i++)
|
||
{
|
||
TSubText* pSubText = GetSubText(i);
|
||
if (pSubText != NULL)
|
||
{
|
||
CString sText = pSubText->GetText();
|
||
delete pSubText;
|
||
|
||
if (sText.Find(_T("^C")) != -1)
|
||
{
|
||
bHasCircle = TRUE;
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
// sg modify 091109,解决含有圆圈文字时,文字图层错误的问题
|
||
// if (bHasCircle)
|
||
// {
|
||
// XPushMemVar<BOOL> vTemp(XExplodeStream::m_bFullExplode, TRUE); // 完全分解
|
||
XPushMemVar<BOOL> vTemp(XExplodeStream::m_bFullExplode, bHasCircle);
|
||
XExplodeStream dc(entSet);
|
||
if (!OnExplodeOrDraw(dc))
|
||
return Acad::eOk;
|
||
|
||
Acad::ErrorStatus es = Acad::eOk;
|
||
dc.SetPropertiesFrom(this);
|
||
if (nDrawMode == DRAW_2D)
|
||
es = ExplodeOrDraw2d(dc);
|
||
else
|
||
es = ExplodeOrDraw3d(dc);
|
||
|
||
AcDbObjectId idLayer = ::InitLayer(LAY_TEXT, database());
|
||
for(i=0; i<entSet.length(); i++) // sg add 090729,解决导出T6后,图层不正常的问题
|
||
{
|
||
AcDbEntity *pEnt = (AcDbEntity*)entSet[i];
|
||
if (!!idLayer && pEnt!=NULL)
|
||
{
|
||
if (pEnt->isKindOf(TDbText::desc()))
|
||
{
|
||
TDbText *pText = TDbText::cast(pEnt);
|
||
// sg add 120313,分解出来的文字的图层和颜色要随“高级选项”中的设置来处理
|
||
if (g_nSymbTextT3Layer == 1)
|
||
{
|
||
pText->setLayer(idLayer);
|
||
pText->setColorIndex(colorIndex());
|
||
}
|
||
else
|
||
pText->setColorIndex(m_colorText);
|
||
}
|
||
else if (pEnt->isKindOf(AcDbText::desc()))
|
||
{
|
||
AcDbText *pText = AcDbText::cast(pEnt);
|
||
// sg add 120313,分解出来的文字的图层和颜色要随“高级选项”中的设置来处理
|
||
if (g_nSymbTextT3Layer == 1)
|
||
{
|
||
pText->setLayer(idLayer);
|
||
pText->setColorIndex(colorIndex());
|
||
}
|
||
else
|
||
pText->setColorIndex(m_colorText);
|
||
}
|
||
else if (pEnt->isKindOf(AcDbCircle::desc()))
|
||
{
|
||
AcDbCircle *pCircle = AcDbCircle::cast(pEnt);
|
||
// sg add 120313,分解出来的文字的图层和颜色要随“高级选项”中的设置来处理
|
||
if (g_nSymbTextT3Layer == 1)
|
||
{
|
||
pCircle->setLayer(idLayer);
|
||
pCircle->setColorIndex(colorIndex());
|
||
}
|
||
else
|
||
pCircle->setColorIndex(m_colorText);
|
||
}
|
||
// sg modify 091217,解决同时有钢筋符号和圆圈文字,导出T6图层、颜色错误
|
||
// 注:只有图名标注才可以这么做,因为图名标注中的显示线,是PLINE
|
||
else if (pEnt->isKindOf(AcDbLine::desc()))
|
||
{
|
||
AcDbLine *pLine = AcDbLine::cast(pEnt);
|
||
// sg add 120313,分解出来的文字的图层和颜色要随“高级选项”中的设置来处理
|
||
if (g_nSymbTextT3Layer == 1)
|
||
{
|
||
pLine->setLayer(idLayer);
|
||
pLine->setColorIndex(colorIndex());
|
||
}
|
||
else
|
||
pLine->setColorIndex(m_colorText);
|
||
}
|
||
}
|
||
}
|
||
if (bErase)
|
||
*bErase = TRUE;
|
||
return es;
|
||
// }
|
||
}
|
||
else if (g_nSaveTArchVer == 7) // sg add 090113,sg modify 090325,防止崩溃
|
||
{
|
||
TDbDrawingName *pDrawingName = NULL;
|
||
{
|
||
XPushMemVar<int> vTemp(g_nSaveTArchVer, _TCH_VERSION);
|
||
pDrawingName = (TDbDrawingName*)clone();
|
||
}
|
||
|
||
XPoint ptLoc = GetBottomLeftPt();
|
||
pDrawingName->SetLocation(ptLoc);
|
||
entSet.append(pDrawingName);
|
||
if (bErase)
|
||
*bErase = TRUE;
|
||
return Acad::eOk;
|
||
}
|
||
return TDbEntity::DownGradeSave(nDrawMode, entSet, bErase);
|
||
}
|
||
|
||
///////////////////////////////////////////////////////
|
||
Acad::ErrorStatus
|
||
TDbDrawingName::ExplodeOrDraw2d(XExplodeDraw &dc) const
|
||
{
|
||
assertReadEnabled();
|
||
if (!IsValid())
|
||
return Acad::eNotApplicable;
|
||
|
||
AcGeVector3d vtUnit(AcGeVector3d::kXAxis);
|
||
double layRotation = GetLayoutRotation();
|
||
// sg modify 090320,8.0起将文字转角并入布局转角
|
||
// vtUnit.rotateBy(m_dRotation + layRotation, AcGeVector3d::kZAxis);
|
||
vtUnit.rotateBy(layRotation, AcGeVector3d::kZAxis);
|
||
|
||
TDbText text; // 文字
|
||
text.setPropertiesFrom(this);
|
||
// sg add 120313,分解出来的文字的图层和颜色要随“高级选项”中的设置来处理
|
||
if (dc.IsExportTch4() && g_nSymbTextT3Layer==1)
|
||
{
|
||
text.setLayer(::InitLayer(LAY_TEXT, database()));
|
||
}
|
||
else
|
||
text.setColorIndex(m_colorText); // sg add 090608,文字和标注放在同一层,文字的颜色为白色
|
||
text.SetAlignment(XExplodeDraw::kBottomLeft);
|
||
text.SetHeight(m_dNameHeight);
|
||
text.SetStyleId(m_idNameStyle);
|
||
text.SetText(m_szNameText); // 图名
|
||
|
||
// XPoint ptNameLoc = m_ptLocation; // sg modify 090112
|
||
XPoint ptNameLoc = GetNameDrawPt();
|
||
text.SetLocation(ptNameLoc);
|
||
// sg delete 090320,8.0起将文字转角并入布局转角
|
||
// text.SetRotation(m_dRotation);
|
||
double dNameX = 0, dNameY = 0;
|
||
text.GetExtents(&dNameX, &dNameY);
|
||
if (dc.IsFullExplode())
|
||
{
|
||
TPushProperty vProp(&text, dc);
|
||
text.ExplodeOrDraw2d(dc);
|
||
}
|
||
else
|
||
dc.DrawEntity(text);
|
||
|
||
double dScaleX = 0, dScaleY = 0;
|
||
if (m_bShowScale) // 显示比例
|
||
{
|
||
// sg modify 090112
|
||
// XPoint ptScaleLoc = m_ptLocation + (dNameX + m_dMultiple * m_dNameHeight * GetPScale()) * vtUnit;
|
||
XPoint ptScaleLoc = GetScaleLocation();
|
||
text.SetHeight(m_dScaleHeight);
|
||
text.SetStyleId(m_idScaleStyle);
|
||
text.SetText(m_szScaleText);
|
||
text.SetLocation(ptScaleLoc);
|
||
text.GetExtents(&dScaleX, &dScaleY);
|
||
if (dc.IsFullExplode())
|
||
{
|
||
TPushProperty vProp(&text, dc);
|
||
text.ExplodeOrDraw2d(dc);
|
||
}
|
||
else
|
||
dc.DrawEntity(text);
|
||
}
|
||
|
||
// add by whl on 060313
|
||
if (dNameX < 1E-5)
|
||
dNameX = 100;
|
||
if (dScaleX < 1E-5)
|
||
dScaleX = 100;
|
||
|
||
// 下画线
|
||
// XPoint ptLeft = m_ptLocation; // sg modify 090112
|
||
// XPoint ptRight = m_ptLocation;
|
||
// double dScale = 1.0/5.0 * GetPScale();
|
||
// if (m_bShowScale && m_iDrawStyle==0) // 传统样式
|
||
// ptRight += (dTotalLen*0.5 + m_dScaleHeight*dScale) * vtUnit;
|
||
// else
|
||
// ptRight += (dTotalLen*0.5 + m_dNameHeight*dScale) * vtUnit;
|
||
|
||
XPoint ptLeft = ptNameLoc; // sg modify 090327,整个图名符号长度
|
||
XPoint ptRight = ptNameLoc + GetLineLen() * vtUnit;
|
||
XLine ln(ptLeft, ptRight);
|
||
ln.SetElevation(0.0);
|
||
ln = ln.Offset(GetOffset());
|
||
AcDbPolyline pline;
|
||
pline.setPropertiesFrom(this);
|
||
double dOffset = 2 * m_dLineWidth * GetPScale();
|
||
|
||
XLine lnThick = ln.Offset(dOffset); // 粗线
|
||
pline.addVertexAt(0, lnThick.StartPoint());
|
||
pline.addVertexAt(1, lnThick.EndPoint());
|
||
pline.setConstantWidth(m_dLineWidth * GetPScale());
|
||
dc.DrawEntity(pline);
|
||
|
||
if (m_iDrawStyle == 0) // 传统样式
|
||
{
|
||
XLine lnThin = ln.Offset(2 * dOffset); // 细线
|
||
pline.reset(Adesk::kFalse, 0);
|
||
pline.addVertexAt(0, lnThin.StartPoint());
|
||
pline.addVertexAt(1, lnThin.EndPoint());
|
||
pline.setConstantWidth(0.0);
|
||
dc.DrawEntity(pline);
|
||
}
|
||
|
||
// add by hh 2013-10-15 实体被选中时,绘制其轮廓区域
|
||
AcDbObjectId idMe = objectId();
|
||
BOOL bHighlight = !idMe;
|
||
if(bHighlight || IsShowRegion())
|
||
{
|
||
TGGePoly2D poly;
|
||
if(GetRegionPoly(&poly))
|
||
{
|
||
dc.DrawXPoly(poly);
|
||
}
|
||
}
|
||
|
||
return Acad::eOk;
|
||
}
|
||
|
||
// sg add 110301,支持统一标高
|
||
bool TDbDrawingName::UnifyElevation(double dElevation)
|
||
{
|
||
assertWriteEnabled();
|
||
m_ptMidLoc.z = dElevation;
|
||
m_ptLocation.z = dElevation;
|
||
return true;
|
||
}
|
||
|
||
BOOL TDbDrawingName::IsValid() const
|
||
{
|
||
return TDbEntity::IsValid();
|
||
}
|
||
|
||
// 提供对格式刷的支持
|
||
void TDbDrawingName::CopyPropertiesFrom(AcDbEntity *pSrcEntity, unsigned gMatchFlag)
|
||
{
|
||
assertWriteEnabled();
|
||
TDbEntity::CopyPropertiesFrom(pSrcEntity, gMatchFlag);
|
||
TDbDrawingName *pSrc = TDbDrawingName::cast(pSrcEntity);
|
||
if (pSrc)
|
||
{
|
||
m_dRotation = pSrc->m_dRotation;
|
||
m_dNameHeight = pSrc->m_dNameHeight;
|
||
m_dScaleHeight = pSrc->m_dScaleHeight;
|
||
m_dLineWidth = pSrc->m_dLineWidth;
|
||
m_dMultiple = pSrc->m_dMultiple;
|
||
if (database()==NULL || pSrcEntity->database()==NULL ||
|
||
database()==pSrcEntity->database()) // add by whl on 060317
|
||
{
|
||
m_idNameStyle = pSrc->m_idNameStyle;
|
||
m_idScaleStyle = pSrc->m_idScaleStyle;
|
||
}
|
||
m_bShowScale = pSrc->m_bShowScale;
|
||
m_iDrawStyle = pSrc->m_iDrawStyle;
|
||
m_colorText = pSrc->m_colorText;
|
||
}
|
||
}
|
||
|
||
void TDbDrawingName::GetTips(DList<TObjInfoUnit> &lstInfo) const
|
||
{
|
||
lstInfo.Append(new TObjInfoUnit(_T("对象类型"), _T("图名标注")));
|
||
lstInfo.Append(new TObjInfoUnit(_T("图名内容"), m_szNameText));
|
||
lstInfo.Append(new TObjInfoUnit(_T("图名样式"), GetSymbolName(m_idNameStyle)));
|
||
lstInfo.Append(new TObjInfoUnit(_T("图名高度"), XString(_T("%.1fP"), m_dNameHeight)));
|
||
lstInfo.Append(new TObjInfoUnit(_T("比例内容"), m_szScaleText));
|
||
lstInfo.Append(new TObjInfoUnit(_T("比例样式"), GetSymbolName(m_idScaleStyle)));
|
||
lstInfo.Append(new TObjInfoUnit(_T("比例高度"), XString(_T("%.1fP"), m_dScaleHeight)));
|
||
// sg delete 090320,8.0起将文字转角并入布局转角
|
||
// lstInfo.Append(new TObjInfoUnit(_T("旋转角度"), XString(_T("%.0f"), m_dRotation*180/PI)));
|
||
}
|
||
|
||
const TCHAR *TDbDrawingName::GetDefaultLayer() const
|
||
{
|
||
//::InitLayer(LAY_OTHER_DIM);
|
||
//return LAY_OTHER_DIM;
|
||
::InitLayer(LAY_DRAWINGNAME_DIM);
|
||
return LAY_DRAWINGNAME_DIM;
|
||
}
|
||
|
||
|
||
int TDbDrawingName::ConvertText(TConvertTextPtr ptr, void *pData)
|
||
{
|
||
XString sText;
|
||
int nRet = ptr(m_szNameText, sText, pData);
|
||
if (nRet == RTNORM)
|
||
{
|
||
assertWriteEnabled();
|
||
m_szNameText = sText;
|
||
}
|
||
return nRet;
|
||
}
|
||
|
||
BOOL TDbDrawingName::GetText(int i,TDbText&text)const
|
||
{
|
||
if ((m_bShowScale&&i>=2) || (!m_bShowScale&&i>=1))
|
||
return FALSE;
|
||
|
||
TSubText* pSubText = GetSubText(i);
|
||
if (pSubText == NULL)
|
||
return FALSE;
|
||
|
||
if (pSubText->GetTextEntity() == NULL)
|
||
{
|
||
delete pSubText;
|
||
return FALSE;
|
||
}
|
||
|
||
text.copyFrom(pSubText->GetTextEntity());
|
||
delete pSubText;
|
||
return TRUE;
|
||
}
|
||
|
||
// 返回发现的位置,同时posStart往前移动(以便继续找下一个使用),
|
||
TTextPosition
|
||
TDbDrawingName::FindSubText(const TCHAR *sSubText, TTextPosition &posStart, TTextRange *pRange) const
|
||
{
|
||
TTextPosition pos;
|
||
if (!sSubText || !sSubText[0])
|
||
return pos;
|
||
|
||
TTextPosition posNext = posStart;
|
||
while(1)
|
||
{
|
||
TDbText text;
|
||
if (!GetText(posNext.m_nCookies, text))
|
||
break;
|
||
|
||
TTextPosition posFind = text.FindSubText(sSubText, posNext, pRange);
|
||
if (!posFind)
|
||
{
|
||
posNext.m_nCookies++;
|
||
posNext.m_nTextPos = 0;
|
||
}
|
||
else
|
||
{
|
||
posStart = posNext;
|
||
if (!posStart)
|
||
{
|
||
posStart.m_nCookies++;
|
||
posStart.m_nTextPos = 0;
|
||
}
|
||
posFind.m_nCookies = posNext.m_nCookies;
|
||
pos = posFind;
|
||
break;
|
||
}
|
||
}
|
||
return pos;
|
||
}
|
||
|
||
// 返回下一次查找的开始位置
|
||
TTextPosition
|
||
TDbDrawingName::ReplaceSubText(const TTextPosition &posRep, const TCHAR *sRepText, TTextRange *pRange)
|
||
{
|
||
assertWriteEnabled();
|
||
TTextPosition posNext;
|
||
TDbText text;
|
||
if (!GetText(posRep.m_nCookies, text))
|
||
return posNext;
|
||
posNext = text.ReplaceSubText(posRep, sRepText, pRange);
|
||
|
||
int cookies = posRep.m_nCookies;
|
||
if (cookies == 0)
|
||
{
|
||
m_szNameText = text.GetText();
|
||
}
|
||
else if (cookies == 1)
|
||
{
|
||
m_szScaleText = text.GetText();
|
||
}
|
||
|
||
if (!posNext)
|
||
{
|
||
if (posNext.m_nCookies < (Adesk::UInt32)(GetSubTextNum()-1))
|
||
{
|
||
posNext.m_nCookies = posRep.m_nCookies+1;
|
||
posNext.m_nTextPos = 0;
|
||
}
|
||
}
|
||
return posNext;
|
||
}
|
||
|
||
void TDbDrawingName::SetSubText(long i, CString sText)
|
||
{
|
||
assertWriteEnabled();
|
||
if (i == 0)
|
||
m_szNameText = sText;
|
||
else
|
||
m_szScaleText = sText;
|
||
}
|
||
|
||
// 设置区域轮廓
|
||
void TDbDrawingName::SetRegionPoly(const AcGePoint3dArray& arPts)
|
||
{
|
||
assertWriteEnabled();
|
||
// 将数据保存到TDbXDataMap中
|
||
TDbXDataMap* pXData = GetSpecialtyData();
|
||
if(NULL != pXData)
|
||
{
|
||
pXData->RemoveAt(DRAWINGNAME_REGIONPL);
|
||
pXData->SetAt(DRAWINGNAME_REGIONPL, arPts);
|
||
}
|
||
}
|
||
|
||
// 取得区域Poly
|
||
BOOL TDbDrawingName::GetRegionPoly(TGGePoly2D* pPoly) const
|
||
{
|
||
assertReadEnabled();
|
||
TDbXDataMap* pXData = GetSpecialtyDataReadOnly();
|
||
if(NULL == pXData)
|
||
return FALSE;
|
||
|
||
AcGePoint3dArray arPts;
|
||
if(!pXData->GetAt(DRAWINGNAME_REGIONPL, arPts))
|
||
return FALSE;
|
||
|
||
int nLen = arPts.length();
|
||
if(2 >= nLen)
|
||
return FALSE;
|
||
|
||
if(NULL != pPoly)
|
||
{
|
||
pPoly->Reset();
|
||
for(int i = 0; i < arPts.length(); i++)
|
||
{
|
||
pPoly->AppendNode(arPts[i]);
|
||
}
|
||
pPoly->SetFlag(1); // 闭合
|
||
}
|
||
|
||
return TRUE;
|
||
}
|
||
|
||
void InitDbDrawingName(BOOL bTrue)
|
||
{
|
||
if (bTrue)
|
||
{
|
||
TDbDrawingName::rxInit();
|
||
acrxBuildClassHierarchy();
|
||
TDbDrawingName::InitMatchProtocol(TRUE);
|
||
}
|
||
else
|
||
{
|
||
TDbDrawingName::InitMatchProtocol(FALSE);
|
||
deleteAcRxClass(TDbDrawingName::desc());
|
||
}
|
||
} |