1419 lines
31 KiB
C++
1419 lines
31 KiB
C++
#include "stdafx.h"
|
|
#include "TDbExtentsEdge.h"
|
|
#include "dbsymutl.h"
|
|
#include "TCoverBooleanOper.h"
|
|
#include "math.h"
|
|
|
|
// 2001.5.9 mcl 绘制设置图层方式dc.SetLayer() 改为SetColorLayer(),
|
|
// SetLayer()方式会导致关闭图层后,仍能打印
|
|
#define COLOR_BYLAYER 256
|
|
|
|
#ifdef _DEBUG
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[]=__FILE__;
|
|
#define new DEBUG_NEW
|
|
#endif
|
|
|
|
static const Adesk::UInt16 kColorByLayer = 256;
|
|
|
|
TComplexCurve::TComplexCurve()
|
|
{
|
|
}
|
|
|
|
TComplexCurve::TComplexCurve(const TComplexCurve& src)
|
|
{
|
|
for (int i = 0;i < src.m_arCurElements.GetSize();i++)
|
|
{
|
|
m_arCurElements.Add(src.at(i));
|
|
}
|
|
}
|
|
|
|
TComplexCurve::~TComplexCurve()
|
|
{
|
|
}
|
|
|
|
TComplexCurve& TComplexCurve::operator = (const TComplexCurve& src)
|
|
{
|
|
if (this != &src)
|
|
{
|
|
for (int i = 0;i < src.m_arCurElements.GetSize();i++)
|
|
{
|
|
m_arCurElements.Add(src.at(i));
|
|
}
|
|
}
|
|
return *this;
|
|
}
|
|
|
|
TDb::TCurveElement TComplexCurve::operator [] (int nIndex)
|
|
{
|
|
ASSERT(nIndex > -1 && nIndex < m_arCurElements.GetSize());
|
|
return m_arCurElements[nIndex];
|
|
}
|
|
|
|
const TDb::TCurveElement TComplexCurve::operator [] (int nIndex) const
|
|
{
|
|
ASSERT(nIndex > -1 && nIndex < m_arCurElements.GetSize());
|
|
return m_arCurElements.GetAt(nIndex);
|
|
}
|
|
|
|
TDb::TCurveElement TComplexCurve::at(int nIndex) const
|
|
{
|
|
ASSERT(nIndex > -1 && nIndex < m_arCurElements.GetSize());
|
|
return m_arCurElements.GetAt(nIndex);
|
|
}
|
|
|
|
TDb::TCurveElement& TComplexCurve::atByRef(int nIndex)
|
|
{
|
|
ASSERT(nIndex > -1 && nIndex < m_arCurElements.GetSize());
|
|
return m_arCurElements.ElementAt(nIndex);
|
|
}
|
|
|
|
TComplexCurve& TComplexCurve::setAt(int nIndex, TDb::TCurveElement& value)
|
|
{
|
|
m_arCurElements.SetAt(nIndex,value);
|
|
return *this;
|
|
}
|
|
|
|
TDb::TCurveElement TComplexCurve::first()
|
|
{
|
|
ASSERT(m_arCurElements.GetSize() > 0);
|
|
return m_arCurElements[0];
|
|
}
|
|
|
|
const TDb::TCurveElement TComplexCurve::first() const
|
|
{
|
|
ASSERT(m_arCurElements.GetSize() > 0);
|
|
return m_arCurElements[0];
|
|
}
|
|
|
|
TDb::TCurveElement TComplexCurve::last()
|
|
{
|
|
ASSERT(m_arCurElements.GetSize() > 0);
|
|
return m_arCurElements[m_arCurElements.GetSize() - 1];
|
|
}
|
|
|
|
const TDb::TCurveElement TComplexCurve::last() const
|
|
{
|
|
ASSERT(m_arCurElements.GetSize() > 0);
|
|
return m_arCurElements.GetAt(m_arCurElements.GetSize() - 1);
|
|
}
|
|
|
|
int TComplexCurve::append(TDb::TCurveElement& value)
|
|
{
|
|
m_arCurElements.Add(value);
|
|
return (int)(m_arCurElements.GetSize() - 1);
|
|
}
|
|
|
|
TComplexCurve& TComplexCurve::append(const TComplexCurve& src)
|
|
{
|
|
TDb::TCurveElement el;
|
|
for (int i = 0;i < src.m_arCurElements.GetSize();i++)
|
|
{
|
|
el = src.at(i);
|
|
m_arCurElements.Add(el);
|
|
}
|
|
return *this;
|
|
}
|
|
|
|
TDb::TCurveElement TComplexCurve::removeAt(int nIndex)
|
|
{
|
|
ASSERT(nIndex > -1 && nIndex < m_arCurElements.GetSize());
|
|
TDb::TCurveElement el = m_arCurElements.GetAt(nIndex);
|
|
m_arCurElements.RemoveAt(nIndex);
|
|
return el;
|
|
}
|
|
|
|
BOOL TComplexCurve::remove(TDb::TCurveElement& value, int start)
|
|
{
|
|
BOOL bSuccess = FALSE;
|
|
TDb::TCurveElement el;
|
|
memset(&el,0,sizeof(TDb::TCurveElement));
|
|
|
|
int i = start;
|
|
while(i < m_arCurElements.GetSize())
|
|
{
|
|
el = m_arCurElements.GetAt(i);
|
|
if (isEqual(el,value))
|
|
{
|
|
m_arCurElements.RemoveAt(i);
|
|
bSuccess = TRUE;
|
|
}
|
|
else
|
|
{
|
|
i++;
|
|
}
|
|
}
|
|
return bSuccess;
|
|
}
|
|
|
|
BOOL TComplexCurve::isEqual(const TDb::TCurveElement& value1,const TDb::TCurveElement& value2) const
|
|
{
|
|
if (value1.ptGe[0].distanceTo(value2.ptGe[0]) < 1.e-6 &&
|
|
value1.ptGe[1].distanceTo(value2.ptGe[1]) < 1.e-6 &&
|
|
value1.ptGe[2].distanceTo(value2.ptGe[2]) < 1.e-6)
|
|
{
|
|
return TRUE;
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
int TComplexCurve::logicalLength() const
|
|
{
|
|
return (int)m_arCurElements.GetSize();
|
|
}
|
|
|
|
void TComplexCurve::setLogicalLength(int nIndex)
|
|
{
|
|
if (nIndex == 0)
|
|
{
|
|
m_arCurElements.RemoveAll();
|
|
}
|
|
}
|
|
|
|
|
|
TDb::TCurveElement TComplexCurve::removeFirst()
|
|
{
|
|
ASSERT(m_arCurElements.GetSize() > 0);
|
|
TDb::TCurveElement el = m_arCurElements.GetAt(0);
|
|
m_arCurElements.RemoveAt(0);
|
|
return el;
|
|
}
|
|
|
|
TDb::TCurveElement TComplexCurve::removeLast()
|
|
{
|
|
ASSERT(m_arCurElements.GetSize() > 0);
|
|
TDb::TCurveElement el = m_arCurElements.GetAt(m_arCurElements.GetSize() - 1);
|
|
m_arCurElements.RemoveAt(0);
|
|
return el;
|
|
}
|
|
|
|
BOOL TComplexCurve::find(const TDb::TCurveElement& value, int& foundAt,int start) const
|
|
{
|
|
BOOL bSuccess = FALSE;
|
|
TDb::TCurveElement el;
|
|
memset(&el,0,sizeof(TDb::TCurveElement));
|
|
|
|
int i = start;
|
|
while(i < m_arCurElements.GetSize())
|
|
{
|
|
el = m_arCurElements.GetAt(i);
|
|
if (isEqual(el,value))
|
|
{
|
|
foundAt = i;
|
|
break;
|
|
}
|
|
else
|
|
{
|
|
i++;
|
|
}
|
|
}
|
|
return bSuccess;
|
|
}
|
|
|
|
int TComplexCurve::length() const
|
|
{
|
|
return (int)m_arCurElements.GetSize();
|
|
}
|
|
|
|
BOOL TComplexCurve::isEmpty() const
|
|
{
|
|
return (m_arCurElements.GetSize() == 0) ? TRUE : FALSE;
|
|
}
|
|
|
|
void TComplexCurve::setSubElementGsMark(int nGsMark)
|
|
{
|
|
for (int i = 0;i < m_arCurElements.GetSize();i++)
|
|
{
|
|
m_arCurElements[i].gsMark = nGsMark;
|
|
}
|
|
}
|
|
|
|
TDbExtentsEdge::TDbExtentsEdge()
|
|
{
|
|
|
|
}
|
|
|
|
TDbExtentsEdge::~TDbExtentsEdge()
|
|
{
|
|
|
|
}
|
|
|
|
TDbExtentsEdge::TDbExtentsEdge(const TDbExtentsEdge& src)
|
|
{
|
|
m_idOwner = src.m_idOwner;
|
|
if (src.m_curEdage.length() > 0)
|
|
{
|
|
m_curEdage = src.m_curEdage;
|
|
}
|
|
}
|
|
|
|
void TDbExtentsEdge::SetOwnerId(AcDbObjectId& id)
|
|
{
|
|
m_idOwner = id;
|
|
}
|
|
|
|
AcDbObjectId TDbExtentsEdge::GetOwnerId()
|
|
{
|
|
return m_idOwner;
|
|
}
|
|
|
|
void TDbExtentsEdge::SetEdage(const TComplexCurve& curEdage)
|
|
{
|
|
m_curEdage.setLogicalLength(0);
|
|
for (int i = 0;i < curEdage.length();i++)
|
|
{
|
|
m_curEdage.append(curEdage.at(i));
|
|
}
|
|
}
|
|
|
|
BOOL TDbExtentsEdge::GetEdage(TComplexCurve& curEdage)
|
|
{
|
|
for (int i = 0;i < m_curEdage.length();i++)
|
|
{
|
|
curEdage.append(m_curEdage.at(i));
|
|
}
|
|
return TRUE;
|
|
}
|
|
|
|
// mcl, add.10.01.22.两端各沿原方向,延长指定距离
|
|
void TDbExtentsEdge::ExtendStartAndEnd(double dExtLen)
|
|
{
|
|
AcGeTol tol;
|
|
tol.setEqualPoint(1);
|
|
AcGeVector3d vtExtent;
|
|
|
|
int i(0);
|
|
for (i = 0;i < m_curEdage.length();i++)
|
|
{
|
|
if (m_curEdage.atByRef(i).ptGe[1].isEqualTo(m_curEdage.atByRef(i).ptGe[2], tol)) // 直线
|
|
{
|
|
vtExtent = (m_curEdage.atByRef(i).ptGe[1] - m_curEdage.atByRef(i).ptGe[0]).normalize() * dExtLen;
|
|
m_curEdage.atByRef(i).ptGe[0] -= vtExtent;
|
|
m_curEdage.atByRef(i).ptGe[1] += vtExtent;
|
|
m_curEdage.atByRef(i).ptGe[2] = m_curEdage.atByRef(i).ptGe[1];
|
|
}
|
|
else // 圆弧,少数情况
|
|
{
|
|
AcGeCircArc3d arc(m_curEdage.atByRef(i).ptGe[0], m_curEdage.atByRef(i).ptGe[1], m_curEdage.atByRef(i).ptGe[2]);
|
|
|
|
// double dPercent = dExtLen / (arc.radius() * 2 * PI);
|
|
// double dRote = PI*2 * dPercent;
|
|
// 换算如下
|
|
double dRote = dExtLen / arc.radius();
|
|
|
|
AcGeVector3d vtNormal = arc.normal();
|
|
AcGePoint3d ptCenter = arc.center();
|
|
m_curEdage.atByRef(i).ptGe[0].rotateBy(-dRote, vtNormal, ptCenter);
|
|
m_curEdage.atByRef(i).ptGe[2].rotateBy(dRote, vtNormal, ptCenter);
|
|
}
|
|
}
|
|
}
|
|
|
|
BOOL TDbExtentsEdge::GetEdage(TComplexCurve& curEdage) const
|
|
{
|
|
for (int i = 0;i < m_curEdage.length();i++)
|
|
{
|
|
curEdage.append(m_curEdage.at(i));
|
|
}
|
|
return TRUE;
|
|
}
|
|
|
|
TDbExtentsEdge& TDbExtentsEdge::operator = (const TDbExtentsEdge& src)
|
|
{
|
|
if (this != &src)
|
|
{
|
|
m_idOwner = src.m_idOwner;
|
|
m_curEdage.setLogicalLength(0);
|
|
for (int i = 0;i < src.m_curEdage.length();i++)
|
|
{
|
|
m_curEdage.append(src.m_curEdage.at(i));
|
|
}
|
|
}
|
|
return *this;
|
|
}
|
|
|
|
Acad::ErrorStatus TDbExtentsEdge::dxfOutFields(AcDbDxfFiler* pFiler) const
|
|
{
|
|
return pFiler->filerStatus();
|
|
}
|
|
|
|
Acad::ErrorStatus TDbExtentsEdge::dxfInFields(AcDbDxfFiler* pFiler)
|
|
{
|
|
return pFiler->filerStatus();
|
|
}
|
|
|
|
Acad::ErrorStatus TDbExtentsEdge::dwgOutFields(AcDbDwgFiler* pFiler) const
|
|
{
|
|
if (pFiler != NULL)
|
|
{
|
|
pFiler->writeSoftPointerId(m_idOwner);
|
|
|
|
Adesk::UInt32 lLen = m_curEdage.length();
|
|
pFiler->writeUInt32(lLen);
|
|
|
|
for (Adesk::UInt32 i = 0;i < lLen;i++)
|
|
{
|
|
pFiler->writePoint3d(m_curEdage.at(i).ptGe[0]);
|
|
pFiler->writePoint3d(m_curEdage.at(i).ptGe[1]);
|
|
pFiler->writePoint3d(m_curEdage.at(i).ptGe[2]);
|
|
pFiler->writeUInt16(m_curEdage.at(i).bHided);
|
|
pFiler->writeUInt32(m_curEdage.at(i).gsMark);
|
|
pFiler->writeDouble(m_curEdage.at(i).dWidth);
|
|
}
|
|
}
|
|
return pFiler->filerStatus();
|
|
}
|
|
|
|
Acad::ErrorStatus TDbExtentsEdge::dwgInFields(AcDbDwgFiler* pFiler)
|
|
{
|
|
if (pFiler != NULL)
|
|
{
|
|
pFiler->readSoftPointerId(&m_idOwner);
|
|
|
|
TDb::TCurveElement curEl;
|
|
memset(&curEl,0,sizeof(TDb::TCurveElement));
|
|
Adesk::UInt32 lLen = 0l;
|
|
|
|
pFiler->readUInt32(&lLen);
|
|
m_curEdage.setLogicalLength(0);
|
|
|
|
for (Adesk::UInt32 i = 0;i < lLen;i++)
|
|
{
|
|
pFiler->readPoint3d(&curEl.ptGe[0]);
|
|
pFiler->readPoint3d(&curEl.ptGe[1]);
|
|
pFiler->readPoint3d(&curEl.ptGe[2]);
|
|
pFiler->readUInt16((Adesk::UInt16*)&curEl.bHided);
|
|
pFiler->readUInt32((Adesk::UInt32*)&curEl.gsMark);
|
|
pFiler->readDouble(&curEl.dWidth);
|
|
m_curEdage.append(curEl);
|
|
}
|
|
}
|
|
return pFiler->filerStatus();
|
|
}
|
|
|
|
void TDbExtentsEdge::OrthProjectEl2XYPlan(TDb::TCurveElement& el)
|
|
{
|
|
AcGePoint3d ptGe;
|
|
for (int i = 0;i < 3;i++)
|
|
{
|
|
ptGe = el.ptGe[i].orthoProject(AcGePlane::kXYPlane);
|
|
el.ptGe[i] = ptGe;
|
|
}
|
|
}
|
|
|
|
Adesk::Boolean TDbExtentsEdge::ExplodeOrDraw2d( XExplodeDraw &dc,const AcDbObjectId& idReal,
|
|
const AcDbObjectId& idDash,const AcDbObjectId& idCen,
|
|
TDb::TCurveElement* pElTmpl,BOOL bWeight,BOOL bCenWeight,
|
|
double dPScale)
|
|
{
|
|
//从注册表中读取显示方式
|
|
AcDbObjectId idOld,idOldLt;
|
|
BOOL bHideDraw = 1;
|
|
GetGlobalContext(KEY_HIDEDRAW,bHideDraw);
|
|
// add by hh 2011-01-05 从图纸中读取遮挡参数 避免全局参数对不同的图纸间的影响
|
|
TAuxTools::GetTHvacDataFromDwg(KEY_HIDEDRAW, bHideDraw);
|
|
|
|
int nColorIndexOld = -1,nCount = 0;
|
|
nColorIndexOld = dc.GetColor();
|
|
|
|
//显示
|
|
TDb::TCurveElement el;
|
|
memset(&el,0,sizeof(TDb::TCurveElement));
|
|
|
|
nColorIndexOld = dc.GetColor();
|
|
// 增加桥架隔板颜色
|
|
dc.SetColor(kColorByLayer);
|
|
for (int i = 0;i < m_curEdage.length();i++)
|
|
{
|
|
el = m_curEdage.at(i);
|
|
// tsj modyf:2010.11.17
|
|
if (el.gsMark == -2)
|
|
{
|
|
dc.SetColor(el.nColorIndex);
|
|
}
|
|
|
|
//画时,把点投影到XY面,在XY面
|
|
OrthProjectEl2XYPlan(el);
|
|
|
|
//复制来自模板的宽度属性等
|
|
if (pElTmpl != NULL)
|
|
{
|
|
el.dWidth = pElTmpl->dWidth;
|
|
}
|
|
|
|
//if (el.ptGe[1].distanceTo(el.ptGe[2]) < AcGeContext::gTol.equalPoint()) //直线
|
|
if (el.ptGe[1].distanceTo(el.ptGe[2]) < g_globalTol.equalPoint()) // modify by cq TFS8208
|
|
{
|
|
if (el.bHided) // 虚线 + 画
|
|
{
|
|
if (bHideDraw)//显示
|
|
{
|
|
if (el.gsMark == -1 )//中心线
|
|
{
|
|
idOldLt = dc.GetLineTypeId();
|
|
idOld = dc.GetLayerId();
|
|
|
|
if (!el.idSubLay.isValid() )
|
|
{
|
|
// dc.SetLayer(idDash); // mcl changed 2011.5.9 SetLayer会导致关闭图层后,仍能打印的问题,下同
|
|
dc.SetColorLayer(COLOR_BYLAYER, idDash);
|
|
}
|
|
else
|
|
{
|
|
// dc.SetLayer(el.idSubLay);
|
|
dc.SetColorLayer(COLOR_BYLAYER, el.idSubLay);
|
|
}
|
|
if (el.idSubLty.isValid())
|
|
{
|
|
dc.SetLineType(el.idSubLty);
|
|
}
|
|
|
|
if (el.dWidth > 1.e-6) //有宽度
|
|
{
|
|
if (bCenWeight) //中心线,且宽度显示
|
|
{
|
|
AcDbPolyline* pPl = NULL;
|
|
MakePolgon(el,pPl);
|
|
|
|
if (pPl != NULL)
|
|
{
|
|
pPl->setConstantWidth(el.dWidth * dPScale);
|
|
dc.Polyline(*pPl);
|
|
delete pPl;
|
|
}
|
|
}
|
|
else //有宽度,但不显示,画单线
|
|
{
|
|
dc.DrawLine(XLine(asDblArray(el.ptGe[0]),asDblArray(el.ptGe[1])));
|
|
}
|
|
}
|
|
else //没有宽度
|
|
{
|
|
dc.DrawLine(XLine(asDblArray(el.ptGe[0]),asDblArray(el.ptGe[1])));
|
|
}
|
|
dc.SetLayer(idOld);
|
|
dc.SetLineType(idOldLt);
|
|
}
|
|
else //非中心线
|
|
{
|
|
idOld = dc.GetLayerId();
|
|
idOldLt = dc.GetLineTypeId();
|
|
|
|
if (!el.idSubLay.isValid() )
|
|
{
|
|
// dc.SetLayer(idDash);
|
|
dc.SetColorLayer(COLOR_BYLAYER, idDash);
|
|
}
|
|
else
|
|
{
|
|
// dc.SetLayer(el.idSubLay);
|
|
dc.SetColorLayer(COLOR_BYLAYER, el.idSubLay);
|
|
}
|
|
if (el.idSubLty.isValid())
|
|
{
|
|
dc.SetLineType(el.idSubLty);
|
|
}
|
|
|
|
if (el.dWidth > 1.e-6) //有宽度
|
|
{
|
|
if (bWeight) //中心线,且宽度显示
|
|
{
|
|
AcDbPolyline* pPl = NULL;
|
|
MakePolgon(el,pPl);
|
|
|
|
if (pPl != NULL)
|
|
{
|
|
if (el.gsMark == -2)
|
|
pPl->setColorIndex(el.nColorIndex);
|
|
|
|
pPl->setConstantWidth(el.dWidth * dPScale);
|
|
dc.Polyline(*pPl);
|
|
delete pPl;
|
|
}
|
|
}
|
|
else //有宽度,但不显示,画单线
|
|
{
|
|
dc.DrawLine(XLine(asDblArray(el.ptGe[0]),asDblArray(el.ptGe[1])));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
dc.DrawLine(XLine(asDblArray(el.ptGe[0]),asDblArray(el.ptGe[1])));
|
|
}
|
|
dc.SetLayer(idOld);
|
|
dc.SetLineType(idOldLt);
|
|
}
|
|
}
|
|
}
|
|
else // 实线
|
|
{
|
|
if (el.gsMark == -1) //中心线
|
|
{
|
|
idOldLt = dc.GetLineTypeId();
|
|
idOld = dc.GetLayerId();
|
|
if (!el.idSubLay.isValid() )
|
|
{
|
|
// dc.SetLayer(idCen);
|
|
dc.SetColorLayer(COLOR_BYLAYER, idCen);
|
|
}
|
|
else
|
|
{
|
|
// dc.SetLayer(el.idSubLay);
|
|
dc.SetColorLayer(COLOR_BYLAYER, el.idSubLay);
|
|
}
|
|
if (el.idSubLty.isValid())
|
|
{
|
|
dc.SetLineType(el.idSubLty);
|
|
}
|
|
|
|
if (el.dWidth > 1.e-6 && bCenWeight)
|
|
{
|
|
AcDbPolyline* pPl = NULL;
|
|
MakePolgon(el,pPl);
|
|
|
|
if (pPl != NULL)
|
|
{
|
|
pPl->setConstantWidth(el.dWidth * dPScale);
|
|
dc.Polyline(*pPl);
|
|
delete pPl;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
dc.DrawLine(XLine(asDblArray(el.ptGe[0]),asDblArray(el.ptGe[1])));
|
|
}
|
|
dc.SetLayer(idOld);
|
|
dc.SetLineType(idOldLt);
|
|
}
|
|
else //非中心线
|
|
{
|
|
if (el.ptGe[0].distanceTo(el.ptGe[1]) > 1.e-10) //不重合
|
|
{
|
|
idOldLt = dc.GetLineTypeId();
|
|
idOld = dc.GetLayerId();
|
|
|
|
if (!el.idSubLay.isValid() )
|
|
{
|
|
// dc.SetLayer(idReal);
|
|
dc.SetColorLayer(COLOR_BYLAYER, idReal);
|
|
if (el.gsMark == -2)
|
|
{
|
|
//隔板线
|
|
dc.SetColorLayer(el.nColorIndex, idReal);
|
|
//隔板线保持 实线
|
|
AcDbObjectId idLineType = GetLinetypeIdFromString(_T("CONTINUOUS"));
|
|
dc.SetLineType(idLineType);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// dc.SetLayer(el.idSubLay);
|
|
dc.SetColorLayer(COLOR_BYLAYER, el.idSubLay);
|
|
if (el.gsMark == -2)
|
|
{
|
|
//隔板线
|
|
dc.SetColorLayer(el.nColorIndex, idReal);
|
|
//隔板线保持 实线
|
|
AcDbObjectId idLineType = GetLinetypeIdFromString(_T("CONTINUOUS"));
|
|
dc.SetLineType(idLineType);
|
|
}
|
|
}
|
|
|
|
if (el.idSubLty.isValid())
|
|
{
|
|
dc.SetLineType(el.idSubLty);
|
|
}
|
|
|
|
if (el.dWidth > 1.e-6 && bWeight)
|
|
{
|
|
AcDbPolyline* pPl = NULL;
|
|
MakePolgon(el,pPl);
|
|
|
|
if (pPl != NULL)
|
|
{
|
|
if (el.gsMark == -2)
|
|
pPl->setColorIndex(el.nColorIndex);
|
|
|
|
pPl->setConstantWidth(el.dWidth * dPScale);
|
|
dc.Polyline(*pPl);
|
|
delete pPl;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
dc.DrawLine(XLine(asDblArray(el.ptGe[0]),asDblArray(el.ptGe[1])));
|
|
}
|
|
|
|
dc.SetLayer(idOld);
|
|
dc.SetLineType(idOldLt);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else //ARC 圆弧
|
|
{
|
|
if (el.bHided)// 虚线 + 画
|
|
{
|
|
if (bHideDraw) //显示
|
|
{
|
|
if (el.gsMark == -1 ) //中心线
|
|
{
|
|
idOldLt = dc.GetLineTypeId();
|
|
idOld = dc.GetLayerId();
|
|
if (!el.idSubLay.isValid() )
|
|
{
|
|
// dc.SetLayer(idDash);
|
|
dc.SetColorLayer(COLOR_BYLAYER, idDash);
|
|
}
|
|
else
|
|
{
|
|
// dc.SetLayer(el.idSubLay);
|
|
dc.SetColorLayer(COLOR_BYLAYER, el.idSubLay);
|
|
}
|
|
if (el.idSubLty.isValid())
|
|
{
|
|
dc.SetLineType(el.idSubLty);
|
|
}
|
|
|
|
if (el.dWidth > 1.e-6 && bCenWeight)
|
|
{
|
|
AcDbPolyline* pPl = NULL;
|
|
MakePolgon(el,pPl,TRUE);
|
|
|
|
if (pPl != NULL)
|
|
{
|
|
pPl->setConstantWidth(el.dWidth * dPScale);
|
|
dc.Polyline(*pPl);
|
|
delete pPl;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
dc.DrawArc(XArc(asDblArray(el.ptGe[0]),asDblArray(el.ptGe[1]),asDblArray(el.ptGe[2])));
|
|
}
|
|
dc.SetLayer(idOld);
|
|
dc.SetLineType(idOldLt);
|
|
}
|
|
else //非中心线
|
|
{
|
|
if (el.ptGe[0].distanceTo(el.ptGe[1]) > 1.e-10) //不重合
|
|
{
|
|
idOldLt = dc.GetLineTypeId();
|
|
idOld = dc.GetLayerId();
|
|
if (!el.idSubLay.isValid() )
|
|
{
|
|
// dc.SetLayer(idDash);
|
|
dc.SetColorLayer(COLOR_BYLAYER, idDash);
|
|
}
|
|
else
|
|
{
|
|
// dc.SetLayer(el.idSubLay);
|
|
dc.SetColorLayer(COLOR_BYLAYER, el.idSubLay);
|
|
}
|
|
if (el.idSubLty.isValid())
|
|
{
|
|
dc.SetLineType(el.idSubLty);
|
|
}
|
|
|
|
if (el.dWidth > 1.e-6 && bWeight) //宽度显示
|
|
{
|
|
AcDbPolyline* pPl = NULL;
|
|
MakePolgon(el,pPl,TRUE);
|
|
|
|
if (pPl != NULL)
|
|
{
|
|
if (el.gsMark == -2)
|
|
pPl->setColorIndex(el.nColorIndex);
|
|
pPl->setConstantWidth(el.dWidth * dPScale);
|
|
dc.Polyline(*pPl);
|
|
delete pPl;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
dc.DrawArc(XArc(asDblArray(el.ptGe[0]),asDblArray(el.ptGe[1]),asDblArray(el.ptGe[2])));
|
|
}
|
|
dc.SetLayer(idOld);
|
|
dc.SetLineType(idOldLt);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else// 实
|
|
{
|
|
if (el.gsMark == -1 ) //中心线
|
|
{
|
|
idOldLt = dc.GetLineTypeId();
|
|
idOld = dc.GetLayerId();
|
|
if (!el.idSubLay.isValid() )
|
|
{
|
|
// dc.SetLayer(idCen);
|
|
dc.SetColorLayer(COLOR_BYLAYER, idCen);
|
|
}
|
|
else
|
|
{
|
|
// dc.SetLayer(el.idSubLay);
|
|
dc.SetColorLayer(COLOR_BYLAYER, el.idSubLay);
|
|
}
|
|
if (el.idSubLty.isValid())
|
|
{
|
|
dc.SetLineType(el.idSubLty);
|
|
}
|
|
|
|
if (el.dWidth > 1.e-6 && bCenWeight)
|
|
{
|
|
AcDbPolyline* pPl = NULL;
|
|
MakePolgon(el,pPl,TRUE);
|
|
|
|
if (pPl != NULL)
|
|
{
|
|
pPl->setConstantWidth(el.dWidth * dPScale);
|
|
dc.Polyline(*pPl);
|
|
delete pPl;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
dc.DrawArc(XArc(asDblArray(el.ptGe[0]),asDblArray(el.ptGe[1]),asDblArray(el.ptGe[2])));
|
|
}
|
|
dc.SetLayer(idOld);
|
|
dc.SetLineType(idOldLt);
|
|
}
|
|
else //非中心线
|
|
{
|
|
idOldLt = dc.GetLineTypeId();
|
|
idOld = dc.GetLayerId();
|
|
if (!el.idSubLay.isValid() )
|
|
{
|
|
// dc.SetLayer(idReal);
|
|
dc.SetColorLayer(COLOR_BYLAYER, idReal);
|
|
if (el.gsMark == -2)
|
|
{
|
|
//隔板线
|
|
dc.SetColorLayer(el.nColorIndex, idReal);
|
|
//隔板线保持 实线
|
|
AcDbObjectId idLineType = GetLinetypeIdFromString(_T("CONTINUOUS"));
|
|
dc.SetLineType(idLineType);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// dc.SetLayer(el.idSubLay);
|
|
dc.SetColorLayer(COLOR_BYLAYER, el.idSubLay);
|
|
}
|
|
|
|
if (el.idSubLty.isValid())
|
|
{
|
|
dc.SetLineType(el.idSubLty);
|
|
}
|
|
|
|
if (el.dWidth > 1.e-6 && bWeight) //宽度显示
|
|
{
|
|
AcDbPolyline* pPl = NULL;
|
|
MakePolgon(el,pPl,TRUE);
|
|
|
|
if (pPl != NULL)
|
|
{
|
|
if (el.gsMark == -2)
|
|
pPl->setColorIndex(el.nColorIndex);
|
|
|
|
pPl->setConstantWidth(el.dWidth * dPScale);
|
|
dc.Polyline(*pPl);
|
|
delete pPl;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
dc.DrawArc(XArc(asDblArray(el.ptGe[0]),asDblArray(el.ptGe[1]),asDblArray(el.ptGe[2])));
|
|
}
|
|
dc.SetLayer(idOld);
|
|
dc.SetLineType(idOldLt);
|
|
}
|
|
}
|
|
}
|
|
|
|
// tsj modyf:2010.11.17
|
|
if (el.gsMark == -2)
|
|
{
|
|
dc.SetColor(kColorByLayer);
|
|
}
|
|
}
|
|
dc.SetColor(nColorIndexOld);
|
|
return Adesk::kTrue;
|
|
}
|
|
|
|
Adesk::Boolean TDbExtentsEdge::explode( AcDbVoidPtrArray& entitySet,const AcDbObjectId& idReal,
|
|
const AcDbObjectId& idDash,const AcDbObjectId& idCen,
|
|
TDb::TCurveElement* pElTmpl,BOOL bWeight,
|
|
BOOL bCenWeight)
|
|
{
|
|
//从注册表中读取显示方式
|
|
AcDbObjectId idOld,idOldLt;
|
|
BOOL bHideDraw = 1;
|
|
GetGlobalContext(KEY_HIDEDRAW,bHideDraw);
|
|
// add by hh 2011-01-05 从图纸中读取遮挡参数 避免全局参数对不同的图纸间的影响
|
|
TAuxTools::GetTHvacDataFromDwg(KEY_HIDEDRAW, bHideDraw);
|
|
|
|
int nColorIndexOld = -1,nCount = 0;
|
|
|
|
//显示
|
|
TDb::TCurveElement el;
|
|
memset(&el,0,sizeof(TDb::TCurveElement));
|
|
|
|
for (int i = 0;i < m_curEdage.length();i++)
|
|
{
|
|
el = m_curEdage.at(i);
|
|
|
|
//复制来自模板的宽度属性等
|
|
if (pElTmpl != NULL)
|
|
{
|
|
el.dWidth = pElTmpl->dWidth;
|
|
}
|
|
|
|
//if (el.ptGe[1].distanceTo(el.ptGe[2]) < AcGeContext::gTol.equalPoint()) //直线
|
|
if (el.ptGe[1].distanceTo(el.ptGe[2]) < g_globalTol.equalPoint()) // modify by cq TFS8208
|
|
{
|
|
if (el.bHided) // 虚线 + 画
|
|
{
|
|
if (bHideDraw)//显示
|
|
{
|
|
if (el.gsMark == -1 )//中心线
|
|
{
|
|
if (el.dWidth > 1.e-6) //有宽度
|
|
{
|
|
if (bCenWeight) //中心线,且宽度显示
|
|
{
|
|
AcDbPolyline* pPl = NULL;
|
|
MakePolgon(el,pPl);
|
|
if (pPl != NULL)
|
|
{
|
|
SetProperty(el,pPl,idReal,idDash,idCen);
|
|
entitySet.append(pPl);
|
|
}
|
|
}
|
|
else //有宽度,但不显示,画单线
|
|
{
|
|
el.dWidth = 0.0;
|
|
AcDbLine* pLine = NULL;
|
|
MakeLine(el,pLine);
|
|
if (pLine != NULL)
|
|
{
|
|
SetProperty(el,pLine,idReal,idDash,idCen);
|
|
entitySet.append(pLine);
|
|
}
|
|
}
|
|
}
|
|
else //没有宽度
|
|
{
|
|
el.dWidth = 0.0;
|
|
AcDbLine* pLine = NULL;
|
|
MakeLine(el,pLine);
|
|
if (pLine != NULL)
|
|
{
|
|
SetProperty(el,pLine,idReal,idDash,idCen);
|
|
entitySet.append(pLine);
|
|
}
|
|
}
|
|
}
|
|
else //非中心线
|
|
{
|
|
if (el.dWidth > 1.e-6) //有宽度
|
|
{
|
|
if (bWeight) //中心线,且宽度显示
|
|
{
|
|
AcDbPolyline* pPl = NULL;
|
|
MakePolgon(el,pPl);
|
|
|
|
if (pPl != NULL)
|
|
{
|
|
SetProperty(el,pPl,idReal,idDash,idCen);
|
|
entitySet.append(pPl);
|
|
}
|
|
}
|
|
else //有宽度,但不显示,画单线
|
|
{
|
|
el.dWidth = 0.0;
|
|
AcDbLine* pLine = NULL;
|
|
MakeLine(el,pLine);
|
|
if (pLine != NULL)
|
|
{
|
|
SetProperty(el,pLine,idReal,idDash,idCen);
|
|
entitySet.append(pLine);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
el.dWidth = 0.0;
|
|
AcDbLine* pLine = NULL;
|
|
MakeLine(el,pLine);
|
|
if (pLine != NULL)
|
|
{
|
|
SetProperty(el,pLine,idReal,idDash,idCen);
|
|
entitySet.append(pLine);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else // 实线
|
|
{
|
|
if (el.gsMark == -1) //中心线
|
|
{
|
|
if (el.dWidth > 1.e-6 && bCenWeight)
|
|
{
|
|
AcDbPolyline* pPl = NULL;
|
|
MakePolgon(el,pPl);
|
|
if (pPl != NULL)
|
|
{
|
|
SetProperty(el,pPl,idReal,idDash,idCen);
|
|
entitySet.append(pPl);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
el.dWidth = 0.0;
|
|
AcDbLine* pLine = NULL;
|
|
MakeLine(el,pLine);
|
|
if (pLine != NULL)
|
|
{
|
|
SetProperty(el,pLine,idReal,idDash,idCen);
|
|
entitySet.append(pLine);
|
|
}
|
|
}
|
|
}
|
|
else //非中心线
|
|
{
|
|
if (el.ptGe[0].distanceTo(el.ptGe[1]) > 1.e-10) //不重合
|
|
{
|
|
if (el.dWidth > 1.e-6 && bWeight)
|
|
{
|
|
AcDbPolyline* pPl = NULL;
|
|
MakePolgon(el,pPl);
|
|
|
|
if (pPl != NULL)
|
|
{
|
|
SetProperty(el,pPl,idReal,idDash,idCen);
|
|
entitySet.append(pPl);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
el.dWidth = 0.0;
|
|
AcDbLine* pLine = NULL;
|
|
MakeLine(el,pLine);
|
|
if (pLine != NULL)
|
|
{
|
|
SetProperty(el,pLine,idReal,idDash,idCen);
|
|
entitySet.append(pLine);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else //ARC 圆弧
|
|
{
|
|
if (el.bHided)// 虚线 + 画
|
|
{
|
|
if (bHideDraw) //显示
|
|
{
|
|
if (el.gsMark == -1 ) //中心线
|
|
{
|
|
if (el.dWidth > 1.e-6 && bCenWeight)
|
|
{
|
|
AcDbPolyline* pPl = NULL;
|
|
MakePolgon(el,pPl,TRUE);
|
|
|
|
if (pPl != NULL)
|
|
{
|
|
SetProperty(el,pPl,idReal,idDash,idCen);
|
|
entitySet.append(pPl);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
el.dWidth = 0.0;
|
|
AcDbArc* pArc = NULL;
|
|
MakeArc(el,pArc);
|
|
if (pArc != NULL)
|
|
{
|
|
SetProperty(el,pArc,idReal,idDash,idCen);
|
|
entitySet.append(pArc);
|
|
}
|
|
}
|
|
}
|
|
else //非中心线
|
|
{
|
|
if (el.ptGe[0].distanceTo(el.ptGe[1]) > 1.e-10) //不重合
|
|
{
|
|
if (el.dWidth > 1.e-6 && bWeight) //宽度显示
|
|
{
|
|
AcDbPolyline* pPl = NULL;
|
|
MakePolgon(el,pPl,TRUE);
|
|
|
|
if (pPl != NULL)
|
|
{
|
|
SetProperty(el,pPl,idReal,idDash,idCen);
|
|
entitySet.append(pPl);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
el.dWidth = 0.0;
|
|
AcDbArc* pArc = NULL;
|
|
MakeArc(el,pArc);
|
|
if (pArc != NULL)
|
|
{
|
|
SetProperty(el,pArc,idReal,idDash,idCen);
|
|
entitySet.append(pArc);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else// 实
|
|
{
|
|
if (el.gsMark == -1 ) //中心线
|
|
{
|
|
if (el.dWidth > 1.e-6 && bCenWeight)
|
|
{
|
|
AcDbPolyline* pPl = NULL;
|
|
MakePolgon(el,pPl,TRUE);
|
|
|
|
if (pPl != NULL)
|
|
{
|
|
SetProperty(el,pPl,idReal,idDash,idCen);
|
|
entitySet.append(pPl);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
el.dWidth = 0.0;
|
|
AcDbArc* pArc = NULL;
|
|
MakeArc(el,pArc);
|
|
if (pArc != NULL)
|
|
{
|
|
SetProperty(el,pArc,idReal,idDash,idCen);
|
|
entitySet.append(pArc);
|
|
}
|
|
}
|
|
}
|
|
else //非中心线
|
|
{
|
|
if (el.dWidth > 1.e-6 && bWeight) //宽度显示
|
|
{
|
|
AcDbPolyline* pPl = NULL;
|
|
MakePolgon(el,pPl,TRUE);
|
|
|
|
if (pPl != NULL)
|
|
{
|
|
SetProperty(el,pPl,idReal,idDash,idCen);
|
|
entitySet.append(pPl);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
el.dWidth = 0.0;
|
|
AcDbArc* pArc = NULL;
|
|
MakeArc(el,pArc);
|
|
if (pArc != NULL)
|
|
{
|
|
SetProperty(el,pArc,idReal,idDash,idCen);
|
|
entitySet.append(pArc);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return Adesk::kTrue;
|
|
}
|
|
|
|
void TDbExtentsEdge::SetProperty(TDb::TCurveElement& el,AcDbEntity* pEnt,const AcDbObjectId& idReal,
|
|
const AcDbObjectId& idDash,const AcDbObjectId& idCen)
|
|
{
|
|
if (pEnt == NULL) return;
|
|
|
|
//从注册表中读取显示方式
|
|
BOOL bHideDraw = 1;
|
|
GetGlobalContext(KEY_HIDEDRAW,bHideDraw);
|
|
// add by hh 2011-01-05 从图纸中读取遮挡参数 避免全局参数对不同的图纸间的影响
|
|
TAuxTools::GetTHvacDataFromDwg(KEY_HIDEDRAW, bHideDraw);
|
|
|
|
//颜色非随块和随层
|
|
if (el.nColorIndex != 0 && el.nColorIndex != 256)
|
|
{
|
|
pEnt->setColorIndex(el.nColorIndex);
|
|
}
|
|
|
|
if (el.bHided) // 虚线 + 画
|
|
{
|
|
if (bHideDraw)//显示
|
|
{
|
|
if (el.gsMark == -1 )//中心线
|
|
{
|
|
if (!el.idSubLay.isValid() )
|
|
{
|
|
pEnt->setLayer(idDash);
|
|
}
|
|
else
|
|
{
|
|
pEnt->setLayer(el.idSubLay);
|
|
}
|
|
if (el.idSubLty.isValid())
|
|
{
|
|
pEnt->setLinetype(el.idSubLty);
|
|
}
|
|
}
|
|
else //非中心线
|
|
{
|
|
if (!el.idSubLay.isValid() )
|
|
{
|
|
pEnt->setLayer(idDash);
|
|
}
|
|
else
|
|
{
|
|
pEnt->setLayer(el.idSubLay);
|
|
}
|
|
if (el.idSubLty.isValid())
|
|
{
|
|
pEnt->setLinetype(el.idSubLty);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else // 实线
|
|
{
|
|
if (el.gsMark == -1) //中心线
|
|
{
|
|
if (!el.idSubLay.isValid() )
|
|
{
|
|
pEnt->setLayer(idCen);
|
|
}
|
|
else
|
|
{
|
|
pEnt->setLayer(el.idSubLay);
|
|
}
|
|
if (el.idSubLty.isValid())
|
|
{
|
|
pEnt->setLinetype(el.idSubLay);
|
|
}
|
|
}
|
|
else //非中心线
|
|
{
|
|
if (el.ptGe[0].distanceTo(el.ptGe[1]) > 1.e-10) //不重合
|
|
{
|
|
if (!el.idSubLay.isValid() )
|
|
{
|
|
pEnt->setLayer(idReal);
|
|
}
|
|
else
|
|
{
|
|
pEnt->setLayer(el.idSubLay);
|
|
}
|
|
if (el.idSubLty.isValid())
|
|
{
|
|
pEnt->setLinetype(el.idSubLty);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
BOOL TDbExtentsEdge::MakeArc(TDb::TCurveElement& el,AcDbArc*& pArc)
|
|
{
|
|
pArc = TCoverBooleanOper::FormatArc(el.ptGe[0],el.ptGe[1],el.ptGe[2]);
|
|
if (pArc != NULL)
|
|
{
|
|
return TRUE;
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TDbExtentsEdge::MakeLine(TDb::TCurveElement& el,AcDbLine*& pLine)
|
|
{
|
|
pLine = new AcDbLine(el.ptGe[0],el.ptGe[1]);
|
|
return TRUE;
|
|
}
|
|
|
|
BOOL TDbExtentsEdge::MakePolgon(TDb::TCurveElement& el,AcDbPolyline*& pPl,BOOL bIsArc)
|
|
{
|
|
if (bIsArc)
|
|
{
|
|
AcDbArc* pArc = TCoverBooleanOper::FormatArc(el.ptGe[0],el.ptGe[1],el.ptGe[2]);
|
|
if (pArc != NULL)
|
|
{
|
|
AcGeVector3d vt = pArc->normal();
|
|
double dSweep = 0.0;
|
|
AcGePoint3d ptGe;
|
|
pArc->getEndPoint(ptGe);
|
|
pArc->getDistAtPoint(ptGe,dSweep);
|
|
dSweep /= pArc->radius();
|
|
|
|
AcGePlane plan;
|
|
plan.set(el.ptGe[0],el.ptGe[1],el.ptGe[2]);
|
|
|
|
AcGePoint3d ptOrth = AcGePoint3d::kOrigin.orthoProject(plan);
|
|
plan.set(ptOrth,plan.normal());
|
|
|
|
double dEl = ptOrth.asVector().length();
|
|
if (!ptOrth.asVector().isCodirectionalTo(plan.normal()))
|
|
{
|
|
dEl *= -1.0;
|
|
}
|
|
|
|
double dBulge = tan(0.25 * dSweep);
|
|
if (!vt.isCodirectionalTo(plan.normal()))
|
|
{
|
|
plan.set(ptOrth,-plan.normal());
|
|
dEl = ptOrth.asVector().length();
|
|
if (!ptOrth.asVector().isCodirectionalTo(plan.normal()))
|
|
{
|
|
dEl *= -1.0;
|
|
}
|
|
}
|
|
|
|
pArc->getStartPoint(ptGe);
|
|
|
|
pPl = new AcDbPolyline;
|
|
pPl->addVertexAt(0,ptGe.convert2d(plan),tan(0.25 * dSweep));
|
|
|
|
pArc->getEndPoint(ptGe);
|
|
pPl->addVertexAt(1,ptGe.convert2d(plan));
|
|
pPl->setElevation(dEl);
|
|
pPl->setNormal(plan.normal());
|
|
delete pArc;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
AcGeVector3d vtNorm = AcGeVector3d::kZAxis;
|
|
AcGeVector3d vtLine = el.ptGe[1] - el.ptGe[0];
|
|
if (!vtLine.isZeroLength()) // tsjadd 2010.5.17,如果vtLine为零向量时04平台程序出现崩溃
|
|
{
|
|
vtNorm = vtNorm.orthoProject(vtLine);
|
|
if (vtNorm.isZeroLength())
|
|
vtNorm = AcGeVector3d::kXAxis;
|
|
|
|
AcGePlane plan;
|
|
plan.set(el.ptGe[0],vtNorm);
|
|
|
|
AcGePoint3d ptOrth = AcGePoint3d::kOrigin.orthoProject(plan);
|
|
plan.set(ptOrth,plan.normal());
|
|
|
|
double dEl = ptOrth.asVector().length();
|
|
if (!ptOrth.asVector().isCodirectionalTo(plan.normal()))
|
|
{
|
|
dEl *= -1.0;
|
|
}
|
|
|
|
pPl = new AcDbPolyline;
|
|
pPl->addVertexAt(0,el.ptGe[0].convert2d(plan));
|
|
pPl->addVertexAt(1,el.ptGe[1].convert2d(plan));
|
|
pPl->setElevation(dEl);
|
|
pPl->setNormal(plan.normal());
|
|
return TRUE;
|
|
}
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
TDbExtentsEdges::TDbExtentsEdges()
|
|
{
|
|
}
|
|
|
|
TDbExtentsEdges::TDbExtentsEdges(const TDbExtentsEdges& src)
|
|
{
|
|
for (int i = 0;i < src.m_arPtrExtEdgePtrs.GetSize();i++)
|
|
{
|
|
Add(src.GetAt(i));
|
|
}
|
|
}
|
|
|
|
TDbExtentsEdges& TDbExtentsEdges::operator = (const TDbExtentsEdges& src)
|
|
{
|
|
if (this != &src)
|
|
{
|
|
for (int i = 0;i < src.m_arPtrExtEdgePtrs.GetSize();i++)
|
|
{
|
|
Add(src.GetAt(i));
|
|
}
|
|
}
|
|
return *this;
|
|
}
|
|
|
|
TDbExtentsEdges::~TDbExtentsEdges()
|
|
{
|
|
RemoveAll();
|
|
}
|
|
|
|
void TDbExtentsEdges::Add(const TDbExtentsEdge& edge)
|
|
{
|
|
TDbExtentsEdge* pEdage = new TDbExtentsEdge;
|
|
pEdage->m_idOwner = edge.m_idOwner;
|
|
if (edge.m_curEdage.length() > 0)
|
|
{
|
|
for (int i = 0;i < edge.m_curEdage.length();i++)
|
|
{
|
|
pEdage->m_curEdage.append(edge.m_curEdage.at(i));
|
|
}
|
|
}
|
|
m_arPtrExtEdgePtrs.Add(pEdage);
|
|
}
|
|
|
|
void TDbExtentsEdges::Add(const TDbExtentsEdges& edges)
|
|
{
|
|
for (int i = 0;i < edges.m_arPtrExtEdgePtrs.GetSize();i++)
|
|
{
|
|
Add(edges.GetAt(i));
|
|
}
|
|
}
|
|
|
|
TDbExtentsEdge& TDbExtentsEdges::GetAt(int nIndex) const
|
|
{
|
|
ASSERT(nIndex > -1 && nIndex < m_arPtrExtEdgePtrs.GetSize());
|
|
TDbExtentsEdge* pEdage = NULL;
|
|
if (nIndex > -1 && nIndex < m_arPtrExtEdgePtrs.GetSize())
|
|
{
|
|
pEdage = (TDbExtentsEdge*)m_arPtrExtEdgePtrs.GetAt(nIndex);
|
|
}
|
|
return *pEdage;
|
|
}
|
|
|
|
TDbExtentsEdge& TDbExtentsEdges::at(int nIndex) const
|
|
{
|
|
return GetAt(nIndex);
|
|
}
|
|
|
|
int TDbExtentsEdges::GetCount() const
|
|
{
|
|
return (int)m_arPtrExtEdgePtrs.GetSize();
|
|
}
|
|
|
|
void TDbExtentsEdges::RemoveAll()
|
|
{
|
|
for (int i = 0;i < m_arPtrExtEdgePtrs.GetSize();i++)
|
|
{
|
|
TDbExtentsEdge* pEdage = (TDbExtentsEdge*)m_arPtrExtEdgePtrs.GetAt(i);
|
|
if (pEdage != NULL)
|
|
{
|
|
delete pEdage;
|
|
}
|
|
}
|
|
m_arPtrExtEdgePtrs.RemoveAll();
|
|
}
|
|
|
|
BOOL TDbExtentsEdges::RemoveAt(int nIndex)
|
|
{
|
|
if (nIndex > -1 && nIndex < m_arPtrExtEdgePtrs.GetSize())
|
|
{
|
|
TDbExtentsEdge* pEdage = (TDbExtentsEdge*)m_arPtrExtEdgePtrs.GetAt(nIndex);
|
|
m_arPtrExtEdgePtrs.RemoveAt(nIndex);
|
|
delete pEdage;
|
|
return TRUE;
|
|
}
|
|
return FALSE;
|
|
}
|