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

856 lines
21 KiB
C++

// CWireDim.cpp: implementation of the CWireDim class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include <dbproxy.h>
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
ACRX_DXF_DEFINE_MEMBERS(CWireDim,AcDbEntity,
AcDb::kDHL_CURRENT, AcDb::kMReleaseCurrent,
AcDbProxyEntity::kEraseAllowed, ATS_WIREDIM, "ATS_WIREDIM,图形无法解析, 请下载上华软件|网址: www.shanghuasoft.com");
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CWireDim::CWireDim()
{
m_bLeft = FALSE;
m_nTextLength = 0.0;
m_csDimContent = _T("abc");
}
CWireDim::~CWireDim()
{
}
void CWireDim::GetExtend(XPoint &ptLow, XPoint &ptUp)
{
ptUp = m_ptTextUp;
ptLow = m_ptTextLow;
}
Adesk::Boolean CWireDim::subWorldDraw(AcGiWorldDraw *pWd)
{
AcDbText text;
text.setPosition(m_ptStart);
text.setHeight(m_nTextHeight);//*DocGetPScale()
text.setTextString(m_csDimContent);
text.setTextStyle(GetTextStyleId(m_csTextStyle));
text.setWidthFactor(m_nWidthFactor);
text.setRotation(0);
AcDbExtents extents;
text.getGeomExtents(extents);
AcGePoint3d pMax = extents.maxPoint();
AcGePoint3d pMin = extents.minPoint();
m_nTextLength = fabs(pMax[0] - pMin[0]) + 50;
if(m_ptStart == m_ptWire){
AcGePoint3d ptText;
ptText = m_ptStart;
double nTextAngle = m_nWireAngle;
if(nTextAngle < 0)
nTextAngle = nTextAngle + 2*PI;
else if(nTextAngle >= PI && nTextAngle <= 3*PI/2) // >= 180 <= 270
nTextAngle = nTextAngle - PI;
else if(nTextAngle>PI/2 && nTextAngle<=PI)
nTextAngle = nTextAngle + PI;
else if(nTextAngle>3*PI/2 && nTextAngle<2*PI)
nTextAngle = nTextAngle;
if(nTextAngle <= PI/2){
ptText.x -= 100;
ptText.y += 100; //距导线距离
}
else{
ptText.x += 50;
ptText.y += 100; //距导线距离
}
text.setRotation(nTextAngle);
ads_polar(asDblArray(ptText), nTextAngle + PI, m_nTextLength/2, asDblArray(ptText));
text.setPosition(ptText);
text.getGeomExtents(extents);
AcGePoint3d pMax = extents.maxPoint();
AcGePoint3d pMin = extents.minPoint();
m_ptTextLow = pMin;
m_ptTextUp = pMax;
text.worldDraw(pWd);
AcDbPoint ptDb;
ptDb.setPosition(m_ptStart);
ptDb.worldDraw(pWd);
}
else{
m_ptEnd = m_ptStart;
if(m_bLeft)
m_ptEnd.x -= m_nTextLength;
else
m_ptEnd.x += m_nTextLength;
AcGePoint3d ptArray[3] = {m_ptWire, m_ptStart, m_ptEnd, };
pWd->geometry().polyline(3, ptArray);
AcGePoint3d ptText;
if(m_bLeft)
ptText = m_ptEnd;
else
ptText = m_ptStart;
ptText.x += 50;
ptText.y += 50;
text.setPosition(ptText);
text.getGeomExtents(extents);
AcGePoint3d pMax = extents.maxPoint();
AcGePoint3d pMin = extents.minPoint();
m_ptTextLow = pMin;
m_ptTextUp = pMax;
text.worldDraw(pWd);
//段斜线
XPoint pt1, pt2;
double ang = ads_angle(asDblArray(m_ptWire), asDblArray(m_ptStart));
ang -= m_nWireAngle;
if(ang < 0)
ang += PI*2;
if(ang > PI)
ang -= PI;
double angTmp(0.0);
if(ang < PI && ang < PI/2)
angTmp = m_nWireAngle + PI/4 + PI/2;
else
angTmp = m_nWireAngle + PI/4;
ads_polar(asDblArray(m_ptWire), angTmp, m_nTextHeight/2, pt1);
ads_polar(pt1, angTmp + PI, m_nTextHeight, pt2);
AcGePoint3d ptArray2[2] = {pt1, pt2,};
pWd->geometry().polyline(2, ptArray2);
}
return Adesk::kTrue;
}
Acad::ErrorStatus
CWireDim::subGetGripPoints(AcGePoint3dArray& gripPoints, AcDbIntArray& osnapModes, AcDbIntArray& geomIds) const
{
assertReadEnabled();
gripPoints.append(m_ptWire);
gripPoints.append(m_ptStart);
gripPoints.append(m_ptEnd);
return Acad::eOk;
}
Acad::ErrorStatus
CWireDim::subMoveGripPointsAt(const AcDbIntArray& indices, const AcGeVector3d& offset)
{
if (indices.length()== 0 || offset.isZeroLength())
return Acad::eOk; //that's easy :-)
assertWriteEnabled();
if (indices.length()> 1){
if(m_ptWire == m_ptStart && indices[0] != 2){
m_ptStart += offset;
}
else
subTransformBy(AcGeMatrix3d::translation(offset));
return Acad::eOk;
}
if (indices[0] == 0) {
m_ptWire += offset;
return Acad::eOk;
}
else if(indices[0] == 1){
m_ptStart += offset;
return Acad::eOk;
}
else if(indices[0] == 2){
m_ptEnd += offset;
if(m_ptEnd.x > m_ptStart.x)
m_bLeft = FALSE;
else
m_bLeft = TRUE;
return Acad::eOk;
}
return Acad::eOk;
}
Acad::ErrorStatus
CWireDim::subExplode(AcDbVoidPtrArray& entitySet) const
{
assertReadEnabled();
{
AcDbText text;
text.setPosition(m_ptStart);
text.setHeight(m_nTextHeight);//*DocGetPScale()
text.setTextString(m_csDimContent);
text.setTextStyle(GetTextStyleId(m_csTextStyle));
text.setWidthFactor(m_nWidthFactor);
text.setRotation(0);
AcDbExtents extents;
text.getGeomExtents(extents);
AcGePoint3d pMax = extents.maxPoint();
AcGePoint3d pMin = extents.minPoint();
(double&)m_nTextLength = fabs(pMax[0] - pMin[0]) + 50;
}
AcDbObjectId idLayer=layerId();
AcDbText *text = new AcDbText;
AcGePoint3d ptText;
if(m_bLeft)
ptText = m_ptEnd;
else
ptText = m_ptStart;
ptText.x += 50;
ptText.y += 50;
text->setLayer(idLayer);
text->setPosition(ptText);
text->setHeight(m_nTextHeight);//*DocGetPScale()
text->setRotation(0);
text->setTextString(m_csDimContent);
text->setTextStyle(GetTextStyleId(m_csTextStyle,database()));
text->setWidthFactor(m_nWidthFactor);
if(m_ptStart != m_ptWire){
entitySet.append(text);
AcGePoint3d ptTmp = m_ptStart;
if(m_bLeft)
ptTmp.x -= m_nTextLength;
else
ptTmp.x += m_nTextLength;
AcDbPolyline *pline = new AcDbPolyline;
pline->addVertexAt(0, m_ptWire.convert2d(AcGePlane::kXYPlane));
pline->addVertexAt(1, m_ptStart.convert2d(AcGePlane::kXYPlane));
pline->addVertexAt(2, ptTmp.convert2d(AcGePlane::kXYPlane));
pline->setLayer(idLayer);
entitySet.append(pline);
//段斜线
AcDbLine *Line = new AcDbLine;
XPoint pt1, pt2;
double ang = ads_angle(asDblArray(m_ptWire), asDblArray(m_ptStart));
ang -= m_nWireAngle;
if(ang < 0)
ang += PI*2;
if(ang > PI)
ang -= PI;
double angTmp(0.0);
if(ang < PI && ang < PI/2)
angTmp = m_nWireAngle + PI/4 + PI/2;
else
angTmp = m_nWireAngle + PI/4;
ads_polar(asDblArray(m_ptWire), angTmp, m_nTextHeight/2, pt1);
ads_polar(pt1, angTmp + PI, m_nTextHeight, pt2);
Line->setStartPoint(pt1);
Line->setEndPoint(pt2);
Line->setLayer(idLayer);
entitySet.append(Line);
}
else{
double nTextAngle = m_nWireAngle;
if(nTextAngle < 0)
nTextAngle = nTextAngle + 2*PI;
else if(nTextAngle >= PI && nTextAngle <= 3*PI/2)
nTextAngle = nTextAngle - PI;
else if(nTextAngle>PI/2 && nTextAngle<=PI)
nTextAngle = nTextAngle + PI;
else if(nTextAngle>3*PI/2 && nTextAngle<2*PI)
nTextAngle = nTextAngle;
text->setRotation(nTextAngle);
AcGePoint3d ptText;
ptText = m_ptStart;
if(nTextAngle <= PI/2){
ptText.x -= 100;
ptText.y += 100; //距导线距离
}
else{
ptText.x += 50;
ptText.y += 100; //距导线距离
}
ads_polar(asDblArray(ptText), nTextAngle + PI, m_nTextLength/2, asDblArray(ptText));
text->setPosition(ptText);
entitySet.append(text);
}
return Acad::eOk;
}
Acad::ErrorStatus
CWireDim::subTransformBy(const AcGeMatrix3d& xform)
{
assertWriteEnabled();
m_ptStart.transformBy(xform);
m_ptWire.transformBy(xform);
return Acad::eOk;
}
Acad::ErrorStatus
CWireDim::dwgOutFields(AcDbDwgFiler* filer) const
{
assertReadEnabled();
Acad::ErrorStatus es;
if ((es = AcDbEntity::dwgOutFields(filer))
!= Acad::eOk)
{
return es;
}
Adesk::Int16 version = 1;
filer->writeItem(version);
filer->writePoint3d(m_ptWire);
filer->writePoint3d(m_ptStart);
filer->writePoint3d(m_ptEnd);
filer->writeBool(m_bLeft);
filer->writeDouble(m_nTextHeight);
filer->writeDouble(m_nWidthFactor);
filer->writeString((LPCTSTR)m_csDimContent);
filer->writeString((LPCTSTR)m_csTextStyle);
filer->writeDouble(m_nWireAngle);
return filer->filerStatus();
}
Acad::ErrorStatus
CWireDim::dwgInFields(AcDbDwgFiler* filer)
{
assertWriteEnabled();
Acad::ErrorStatus es;
if ((es = AcDbEntity::dwgInFields(filer)) != Acad::eOk)
{
return es;
}
// Object Version - must always be the first item.
//
Adesk::Int16 version;
AcGePoint3d ptTmp;
filer->readItem(&version);
if (version > 1)
return Acad::eMakeMeProxy;
switch (version)
{
case 1:
{
filer->readPoint3d(&m_ptWire);
filer->readPoint3d(&m_ptStart);
filer->readPoint3d(&m_ptEnd);
filer->readBool(&m_bLeft);
filer->readDouble(&m_nTextHeight);
filer->readDouble(&m_nWidthFactor);
XString xsContent;
ReadString(filer, xsContent);
m_csDimContent = (const TCHAR*)xsContent;
ReadString(filer, xsContent);
m_csTextStyle = (const TCHAR*)xsContent;
filer->readDouble(&m_nWireAngle);
if(m_nTextHeight < 10)
m_nTextHeight = m_nTextHeight * 100;
break;
}
default:
assert(false);
}
return filer->filerStatus();
}
//********************************************************************************
// CMutiWireDim
//********************************************************************************
ACRX_DXF_DEFINE_MEMBERS(CMutiWireDim,AcDbEntity,
AcDb::kDHL_CURRENT, AcDb::kMReleaseCurrent,
AcDbProxyEntity::kEraseAllowed, ATS_WIREDIM2, "ATS_WIREDIM2,图形无法解析, 请下载上华软件|网址: www.shanghuasoft.com");
CMutiWireDim::CMutiWireDim() :DIST(100)
{
m_iCount = 0;
}
CMutiWireDim::~CMutiWireDim()
{
}
void CMutiWireDim::SetPointArray(XPointList &lstPt)
{
m_iCount = lstPt.Length();
for(int i=0;i<m_iCount;i++){
AcGePoint3d pt = asPnt3d(*lstPt[i]);
m_arrPtWire.append(pt);
m_lstDimContent.Add(_T(""));
}
}
Adesk::Boolean CMutiWireDim::worldText(AcGiWorldDraw *pWd)
{
AcDbText text;
text.setPosition(m_ptStart);
text.setHeight(m_nTextHeight);//*DocGetPScale()
text.setTextString(m_csDimContent);
text.setTextStyle(GetTextStyleId(m_csTextStyle));
text.setWidthFactor(m_nWidthFactor);
text.setRotation(0);
AcDbExtents extents;
text.getGeomExtents(extents);
AcGePoint3d pMax = extents.maxPoint();
AcGePoint3d pMin = extents.minPoint();
m_nTextLength = fabs(pMax[0] - pMin[0]) + DIST;
m_ptEnd = m_ptStart;
if(m_bLeft)
m_ptEnd.x -= m_nTextLength;
else
m_ptEnd.x += m_nTextLength;
AcGePoint3d ptText;
if(m_bLeft)
ptText = m_ptEnd;
else
ptText = m_ptStart;
ptText.x += DIST;
ptText.y += DIST;
text.setPosition(ptText);
text.getGeomExtents(extents);
m_ptTextLow = extents.minPoint();
m_ptTextUp = extents.maxPoint();
if(!pWd->isDragging()){
text.worldDraw(pWd);
}
return Adesk::kTrue;
}
Adesk::Boolean CMutiWireDim::worldText2(AcGiWorldDraw *pWd)
{
double longLength(0.0);
for(int i=0;i<m_iCount;i++){ //计算最长的文字长度
AcDbText text;
text.setPosition(m_ptStart);
text.setHeight(m_nTextHeight);//*DocGetPScale()
text.setTextString(m_lstDimContent[i]);
text.setTextStyle(GetTextStyleId(m_csTextStyle));
text.setWidthFactor(m_nWidthFactor);
text.setRotation(0);
AcDbExtents extents;
text.getGeomExtents(extents);
AcGePoint3d pMax = extents.maxPoint();
AcGePoint3d pMin = extents.minPoint();
double nTmp = fabs(pMax[0] - pMin[0]) + DIST;
if(longLength < nTmp)
longLength = nTmp;
}
m_nTextLength = longLength;
m_ptEnd = m_ptStart;
if(m_bLeft)
m_ptEnd.x -= m_nTextLength;
else
m_ptEnd.x += m_nTextLength;
AcGePoint3d ptText, ptLine, ptTmp, ptIns;
if(m_bLeft){
ptText = m_ptEnd;
ptLine = m_ptStart;
}
else{
ptText = m_ptStart;
ptLine = m_ptEnd;
}
ptTmp = m_ptStart;
ptText.y -= (DIST + m_nTextHeight);//*DocGetPScale()
ptLine.y -= (DIST + m_nTextHeight);//*DocGetPScale()
for(i=0;i<m_iCount;i++){
AcDbText text;
text.setHeight(m_nTextHeight);//*DocGetPScale()
text.setTextString(m_lstDimContent[i]);
text.setTextStyle(GetTextStyleId(m_csTextStyle));
text.setWidthFactor(m_nWidthFactor);
text.setRotation(0);
ptText.y += (DIST + m_nTextHeight);//*DocGetPScale()
ptLine.y += (DIST + m_nTextHeight);//*DocGetPScale()
if(i != 0){//绘制横线,最底下的不画
AcGePoint3d ptArray[2] = {ptText, ptLine, };
pWd->geometry().polyline(2, ptArray);
}
ptText.y += DIST;
ptLine.y += DIST;
ptIns = ptText;
if(!m_bLeft)
ptIns.x += DIST;
text.setPosition(ptIns);
if(!pWd->isDragging()){
text.worldDraw(pWd);
}
}
//绘制竖线
ptTmp.y += (m_nTextHeight*m_iCount + m_iCount*DIST*2);//*DocGetPScale()
AcGePoint3d ptArray2[2] = {m_ptStart, ptTmp, };
pWd->geometry().polyline(2, ptArray2);
return Adesk::kTrue;
}
Adesk::Boolean CMutiWireDim::subWorldDraw(AcGiWorldDraw *pWd)
{
if(m_bPredigest)
worldText(pWd);
else
worldText2(pWd);
//绘制引出线
AcGePoint3d ptArray[4] = {m_arrPtWire[0], m_arrPtWire[m_iCount-1], m_ptStart, m_ptEnd, };
pWd->geometry().polyline(4, ptArray);
//绘制导线交点短斜线
m_ptWire = m_arrPtWire[m_iCount-1];
double ang = ads_angle(asDblArray(m_ptWire), asDblArray(m_ptStart));
ang -= m_nWireAngle;
if(ang < 0)
ang += PI*2;
if(ang > PI)
ang -= PI;
double angTmp(0.0);
if(ang < PI && ang < PI/2)
angTmp = m_nWireAngle + PI/4 + PI/2;
else
angTmp = m_nWireAngle + PI/4;
for(int i=0;i<m_iCount;i++){
XPoint pt1, pt2;
ads_polar(asDblArray(m_arrPtWire[i]), angTmp, m_nTextHeight/2, pt1);
ads_polar(pt1, angTmp + PI, m_nTextHeight, pt2);
AcGePoint3d ptArray2[2] = {pt1, pt2,};
pWd->geometry().polyline(2, ptArray2);
}
return Adesk::kTrue;
}
Acad::ErrorStatus
CMutiWireDim::subGetGripPoints(AcGePoint3dArray& gripPoints, AcDbIntArray& osnapModes, AcDbIntArray& geomIds) const
{
assertReadEnabled();
gripPoints.append(m_ptStart);
gripPoints.append(m_ptEnd);
return Acad::eOk;
}
Acad::ErrorStatus
CMutiWireDim::subMoveGripPointsAt(const AcDbIntArray& indices, const AcGeVector3d& offset)
{
if (indices.length()== 0 || offset.isZeroLength())
return Acad::eOk; //that's easy :-)
if (indices.length()> 1){
subTransformBy(AcGeMatrix3d::translation(offset));
return Acad::eOk;
}
assertWriteEnabled();
if (indices[0] == 0) {
m_ptStart += offset;
return Acad::eOk;
}
else if(indices[0] == 1){
m_ptEnd += offset;
if(m_ptEnd.x > m_ptStart.x)
m_bLeft = FALSE;
else
m_bLeft = TRUE;
return Acad::eOk;
}
return Acad::eOk;
}
Acad::ErrorStatus
CMutiWireDim::subExplode(AcDbVoidPtrArray& entitySet) const
{
assertReadEnabled();
{
AcDbText text;
text.setPosition(m_ptStart);
text.setHeight(m_nTextHeight);//*DocGetPScale()
text.setTextString(m_csDimContent);
text.setTextStyle(GetTextStyleId(m_csTextStyle));
text.setWidthFactor(m_nWidthFactor);
text.setRotation(0);
AcDbExtents extents;
text.getGeomExtents(extents);
AcGePoint3d pMax = extents.maxPoint();
AcGePoint3d pMin = extents.minPoint();
(double&)m_nTextLength = fabs(pMax[0] - pMin[0]) + DIST;
}
AcDbObjectId idLayer=layerId();
AcGePoint3d ptTmp = m_ptStart;
if(m_bLeft)
ptTmp.x -= m_nTextLength;
else
ptTmp.x += m_nTextLength;
AcDbPolyline *pline = new AcDbPolyline;
pline->addVertexAt(0, m_arrPtWire[0].convert2d(AcGePlane::kXYPlane));
pline->addVertexAt(1, m_arrPtWire[m_iCount-1].convert2d(AcGePlane::kXYPlane));
pline->addVertexAt(2, m_ptStart.convert2d(AcGePlane::kXYPlane));
pline->addVertexAt(3, ptTmp.convert2d(AcGePlane::kXYPlane));
pline->setLayer(idLayer);
entitySet.append(pline);
double ang = ads_angle(asDblArray(m_arrPtWire[m_iCount-1]), asDblArray(m_ptStart));
ang -= m_nWireAngle;
if(ang < 0)
ang += PI*2;
if(ang > PI)
ang -= PI;
double angTmp(0.0);
if(ang < PI && ang < PI/2)
angTmp = m_nWireAngle + PI/4 + PI/2;
else
angTmp = m_nWireAngle + PI/4;
//绘制短斜线
for(int i=0;i<m_iCount;i++){
XPoint pt1, pt2;
ads_polar(asDblArray(m_arrPtWire[i]), angTmp, m_nTextHeight/2, pt1);
ads_polar(pt1, angTmp + PI, m_nTextHeight, pt2);
AcDbLine *line = new AcDbLine;
line->setLayer(idLayer);
line->setStartPoint(pt1);
line->setEndPoint(pt2);
entitySet.append(line);
}
if(m_bPredigest){ //简化
AcDbText *text = new AcDbText;
AcGePoint3d ptText;
if(m_bLeft)
ptText = m_ptEnd;
else
ptText = m_ptStart;
ptText.x += DIST;
ptText.y += DIST;
text->setLayer(idLayer);
text->setPosition(ptText);
text->setHeight(m_nTextHeight);//*DocGetPScale()
text->setRotation(0);
text->setTextString(m_csDimContent);
text->setTextStyle(GetTextStyleId(m_csTextStyle,database()));
text->setWidthFactor(m_nWidthFactor);
entitySet.append(text);
}
else {
AcGePoint3d ptText, ptLine, ptTmp, ptIns;
if(m_bLeft){
ptText = m_ptEnd;
ptLine = m_ptStart;
}
else{
ptText = m_ptStart;
ptLine = m_ptEnd;
}
ptTmp = m_ptStart;
ptText.y -= (DIST + m_nTextHeight);//*DocGetPScale()
ptLine.y -= (DIST + m_nTextHeight);//*DocGetPScale()
for(i=0;i<m_iCount;i++){
AcDbText* text = new AcDbText;
text->setLayer(idLayer);
text->setHeight(m_nTextHeight);//*DocGetPScale()
text->setTextString(m_lstDimContent[i]);
text->setTextStyle(GetTextStyleId(m_csTextStyle,database()));
text->setWidthFactor(m_nWidthFactor);
text->setRotation(0);
ptText.y += (DIST + m_nTextHeight);//*DocGetPScale()
ptLine.y += (DIST + m_nTextHeight);//*DocGetPScale()
if(i != 0){//绘制横线,最底下的不画
AcDbLine *line2 = new AcDbLine;
line2->setLayer(idLayer);
line2->setStartPoint(ptText);
line2->setEndPoint(ptLine);
entitySet.append(line2);
}
ptText.y += DIST;
ptLine.y += DIST;
ptIns = ptText;
if(!m_bLeft)
ptIns.x += DIST;
text->setPosition(ptIns);
entitySet.append(text);
}
//绘制竖线
ptTmp.y += (m_nTextHeight*m_iCount + m_iCount*DIST*2);//*DocGetPScale()
AcDbLine *line3 = new AcDbLine;
line3->setLayer(idLayer);
line3->setStartPoint(m_ptStart);
line3->setEndPoint(ptTmp);
entitySet.append(line3);
}
return Acad::eOk;
}
Acad::ErrorStatus
CMutiWireDim::subTransformBy(const AcGeMatrix3d& xform)
{
assertWriteEnabled();
m_ptStart.transformBy(xform);
for(int i=0;i<m_iCount;i++){
AcGePoint3d ptTmp = m_arrPtWire[i];
ptTmp.transformBy(xform);
m_arrPtWire[i] = ptTmp;
}
return Acad::eOk;
}
void CMutiWireDim::GetDimContentList(XStringList &lst)
{
assertReadEnabled();
lst.Reset();
for(int i=0;i<m_iCount;i++){
lst.Append(tstrnew(m_lstDimContent[i]));
}
}
void CMutiWireDim::SetDimContentList(XStringList &lstDimContent)
{
assertWriteEnabled();
m_lstDimContent.RemoveAll();
for(int i=0;i<m_iCount;i++){
CString csTmp = lstDimContent[i];
m_lstDimContent.Add(lstDimContent[i]);
}
}
Acad::ErrorStatus
CMutiWireDim::dwgOutFields(AcDbDwgFiler* filer) const
{
assertReadEnabled();
Acad::ErrorStatus es;
if ((es = AcDbEntity::dwgOutFields(filer))
!= Acad::eOk)
{
return es;
}
Adesk::Int16 version = 1;
Adesk::Int16 val = m_iCount;
filer->writeItem(version);
filer->writePoint3d(m_ptStart);
filer->writePoint3d(m_ptEnd);
filer->writeInt16(val);
for(int i=0;i<m_iCount;i++){
filer->writePoint3d(m_arrPtWire[i]);
}
filer->writeBool(m_bLeft);
filer->writeBool(m_bPredigest);
filer->writeDouble(m_nTextHeight);
filer->writeDouble(m_nWidthFactor);
filer->writeString((LPCTSTR)m_csDimContent);
filer->writeString((LPCTSTR)m_csTextStyle);
filer->writeDouble(m_nWireAngle);
for(i=0;i<m_iCount;i++){
CString csTmp = m_lstDimContent[i];
filer->writeString((LPCTSTR)csTmp);
}
return filer->filerStatus();
}
Acad::ErrorStatus
CMutiWireDim::dwgInFields(AcDbDwgFiler* filer)
{
assertWriteEnabled();
m_lstDimContent.RemoveAll();
Acad::ErrorStatus es;
if ((es = AcDbEntity::dwgInFields(filer)) != Acad::eOk)
{
return es;
}
// Object Version - must always be the first item.
//
Adesk::Int16 version, val;
AcGePoint3d ptTmp;
filer->readItem(&version);
if (version > 1)
return Acad::eMakeMeProxy;
switch (version)
{
case 1:
{
filer->readPoint3d(&m_ptStart);
filer->readPoint3d(&m_ptEnd);
filer->readInt16(&val);
m_iCount = val;
for(int i=0;i<m_iCount;i++){
AcGePoint3d ptTmp;
filer->readPoint3d(&ptTmp);
m_arrPtWire.append(ptTmp);
}
filer->readBool(&m_bLeft);
filer->readBool(&m_bPredigest);
filer->readDouble(&m_nTextHeight);
filer->readDouble(&m_nWidthFactor);
XString xsContent;
ReadString(filer, xsContent);
m_csDimContent = (const TCHAR*)xsContent;
ReadString(filer, xsContent);
m_csTextStyle = (const TCHAR*)xsContent;
filer->readDouble(&m_nWireAngle);
for(i=0;i<m_iCount;i++){
ReadString(filer, xsContent);
m_lstDimContent.Add(xsContent);
}
m_ptWire = m_arrPtWire[m_iCount - 1];
if(m_nTextHeight < 10)
m_nTextHeight = m_nTextHeight * 100;
break;
}
default:
assert(false);
}
return filer->filerStatus();
}
void InitWireDim(BOOL bTrue)
{
if(bTrue) {
CWireDim::rxInit();
CMutiWireDim::rxInit();
} else {
deleteAcRxClass(CMutiWireDim::desc());
deleteAcRxClass(CWireDim::desc());
}
}