127 lines
2.6 KiB
C++
127 lines
2.6 KiB
C++
#include "stdafx.h"
|
|
#include "TVirtualPipeCanal.h"
|
|
#include "TDbCableWatch.h"
|
|
#include "DbPipeCanal.h"
|
|
|
|
#ifdef _DEBUG
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[]=__FILE__;
|
|
#define new DEBUG_NEW
|
|
#endif
|
|
|
|
TVirtualPipeCanal::TVirtualPipeCanal()
|
|
{
|
|
m_pWatch = new TDbCableWatch;
|
|
m_pCanal = NULL;
|
|
m_bDrawWatch = true; // cet 2012.3.26 add
|
|
}
|
|
|
|
TVirtualPipeCanal::~TVirtualPipeCanal()
|
|
{
|
|
if (m_pWatch != NULL)
|
|
delete m_pWatch;
|
|
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
Acad::ErrorStatus TVirtualPipeCanal::ExplodeOrDraw2d(XExplodeDraw &mode) const
|
|
{
|
|
XAcGiViewDraw* pXDraw = (XAcGiViewDraw*)&mode;
|
|
AcGiCommonDraw* pCDraw = pXDraw->GetCommonDraw();
|
|
if (pCDraw == NULL)
|
|
{
|
|
return Acad::eInvalidInput;
|
|
}
|
|
assertReadEnabled();
|
|
// TODO: implement this function.
|
|
// cet 2012.3.26 modify
|
|
// if (m_pWatch != NULL)
|
|
// m_pWatch->ExplodeOrDraw2d(mode);
|
|
if (m_bDrawWatch && m_pWatch != NULL)
|
|
{
|
|
m_pWatch->ExplodeOrDraw2d(mode);
|
|
}
|
|
|
|
if (m_pCanal != NULL)
|
|
{
|
|
m_pCanal->ExplodeOrDraw2d(mode);
|
|
|
|
XCurveSegment cenCurve = m_pCanal->GetCurve();
|
|
XCurveSegment segUp,segDown;
|
|
XDirectionCurve segDir(cenCurve.StartPoint(), cenCurve.EndPoint(), cenCurve.GetBulge());
|
|
segUp = segDir.Offset(m_pCanal->GetWidth()/2, LS_FINITE);
|
|
segDown = segDir.Offset(-m_pCanal->GetWidth()/2, LS_FINITE);
|
|
|
|
mode << segUp;
|
|
mode << segDown;
|
|
}
|
|
|
|
return TDbCurveEntity::ExplodeOrDraw2d(mode);
|
|
}
|
|
|
|
//设置转盘最小角度
|
|
void TVirtualPipeCanal::SetAverageAng(double dAng)
|
|
{
|
|
if (m_pWatch != NULL)
|
|
m_pWatch->SetAverageAngle(dAng);
|
|
}
|
|
|
|
//设置转盘起始向量
|
|
void TVirtualPipeCanal::SetStartVector(const AcGeVector3d &vt)
|
|
{
|
|
if (m_pWatch != NULL)
|
|
m_pWatch->SetStartVector(vt);
|
|
}
|
|
|
|
//设置表盘起始点
|
|
void TVirtualPipeCanal::SetCenPoint(const AcGePoint3d &pt)
|
|
{
|
|
if (m_pWatch != NULL)
|
|
m_pWatch->SetCenPoint(pt);
|
|
}
|
|
|
|
//设置文字
|
|
void TVirtualPipeCanal::SetText(const AcGePoint3d& pt,LPCTSTR lpText)
|
|
{
|
|
if (m_pWatch != NULL)
|
|
m_pWatch->SetText(pt,lpText);
|
|
}
|
|
|
|
void TVirtualPipeCanal::SetPanState(BOOL bClose)
|
|
{
|
|
if (m_pWatch != NULL)
|
|
m_pWatch->SetPanState(bClose);
|
|
}
|
|
|
|
//得到转盘法向量
|
|
void TVirtualPipeCanal::GetNormal(AcGeVector3d &vtNorm)
|
|
{
|
|
if (m_pWatch != NULL)
|
|
m_pWatch->GetNormal(vtNorm);
|
|
}
|
|
|
|
//传进来方沟指针
|
|
void TVirtualPipeCanal::SetCanalPtr(TDbPipeCanal *&pCanal)
|
|
{
|
|
m_pCanal = pCanal;
|
|
}
|
|
|
|
//设置方沟起点
|
|
void TVirtualPipeCanal::SetCanalStartPt(const AcGePoint3d &pt)
|
|
{
|
|
if (m_pCanal != NULL)
|
|
m_pCanal->SetStartPoint(pt);
|
|
}
|
|
|
|
//设置方沟终点
|
|
void TVirtualPipeCanal::SetCanalEndPt(const AcGePoint3d &pt)
|
|
{
|
|
if (m_pCanal != NULL)
|
|
m_pCanal->SetEndPoint(pt);
|
|
}
|
|
|
|
void TVirtualPipeCanal::EnabelDrawWatch(bool bEnabel)
|
|
{
|
|
m_bDrawWatch = bEnabel;
|
|
}
|