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

204 lines
4.7 KiB
C++

// TDoubleLineJig.cpp: implementation of the TDoubleLineJig class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "TDoubleLineJig.h"
#include "Twt_pump.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CDoubleLinePreview::CDoubleLinePreview(XPoint ptStart, XPoint ptEnd, double nRoadWidth)
{
m_ptStart = ptStart;
m_ptEnd = ptEnd;
m_nRoadWidth = nRoadWidth;
}
CDoubleLinePreview::~CDoubleLinePreview()
{
}
Adesk::Boolean CDoubleLinePreview::subWorldDraw(AcGiWorldDraw *pWd)
{
double nAng = ads_angle(m_ptStart, m_ptEnd);
XPoint ptS1, ptS2, ptE1, ptE2;
ads_polar(m_ptStart, nAng + PI/2, m_nRoadWidth/2, ptS1);
ads_polar(m_ptStart, nAng - PI/2, m_nRoadWidth/2, ptS2);
ads_polar(m_ptEnd, nAng + PI/2, m_nRoadWidth/2, ptE1);
ads_polar(m_ptEnd, nAng - PI/2, m_nRoadWidth/2, ptE2);
AcDbLine line1(m_ptStart, m_ptEnd);
line1.worldDraw(pWd);
AcDbLine line2(ptS1, ptE1);
line2.worldDraw(pWd);
AcDbLine line3(ptS2, ptE2);
line3.worldDraw(pWd);
double nDist = ads_distance(m_ptStart, m_ptEnd);
XPoint ptText;
if (nAng > PI/2 && nAng <= PI+PI/2)
ads_polar(m_ptStart, nAng, nDist/2+300, ptText);
else
ads_polar(m_ptStart, nAng, nDist/2-300, ptText);
ads_polar(ptText, nAng+PI/2, 100, ptText);
if (nAng > PI/2 && nAng <= PI+PI/2) {
ads_polar(ptText, nAng-PI/2, 100*2, ptText);
nAng += PI;
}
CString csDist;
csDist.Format(_T("%.0f"), nDist);
AcDbText text;
text.setRotation(nAng);
text.setHeight(m_nRoadWidth/2);
text.setTextString(csDist);
text.setTextStyle(GetTextStyleId(_T("STANDARD")));
text.setPosition(ptText);
text.setAlignmentPoint(ptText);
text.worldDraw(pWd);
return Adesk::kTrue;
}
TDoubleLineJig::TDoubleLineJig(XPoint pt1, double nRoadWidth)
{
m_ptStart = pt1;
m_ptEnd = pt1;
m_nDist = 0;
m_nRoadWidth = nRoadWidth;
m_pDrawEnt = new CDoubleLinePreview(m_ptStart, m_ptEnd, m_nRoadWidth);
}
TDoubleLineJig::~TDoubleLineJig()
{
if(m_pDrawEnt)
delete m_pDrawEnt;
}
void TDoubleLineJig::SetStartPoint(XPoint pt)
{
m_ptStart = pt;
m_pDrawEnt->m_ptStart = m_ptStart;
}
AcEdJig::DragStatus
TDoubleLineJig::GetPoint(XPoint &pt)
{
return acquirePoint(pt, m_ptStart.AsAcGePoint3d());
}
int TDoubleLineJig::DoIt(int *keyIndex)
{
int nRet = TSymbEdJig::DoIt(keyIndex);
return nRet;
}
// 更新实体数据
Adesk::Boolean TDoubleLineJig::update()
{
Adesk::Boolean bRet=Adesk::kTrue;
// if(m_nDist > g_nSprinklerRadius){
// double nAng = ads_angle(m_ptStart, m_ptResult);
// ads_polar(m_ptStart, nAng, m_nDist, m_ptResult);
// }
// if(g_nDoubleDist > 0)
// m_nRoadWidth = g_nDoubleDist;
m_pDrawEnt->m_nRoadWidth = m_nRoadWidth;
m_pDrawEnt->m_ptEnd = m_ptResult;
return bRet;
}
AcDbEntity* TDoubleLineJig::entity() const
{
return (AcDbEntity *)m_pDrawEnt;
}
//地热盘管
///////////////////////////////////////////////////////////////////////////////////
TFloorPipeJig::TFloorPipeJig(CPipeFloorDlg *pDlg, XPoint ptStart, XPoint ptEnd,
int nLeftDist, int nRightDist, int nTopDist, int nBottomDist,
double dbPGAngle,int nEntryType,int nPipeType)
{
m_pDlg = pDlg;
m_ptStart = ptStart;
m_ptEnd = ptEnd;
m_dbPGAngle = dbPGAngle;
m_nEntryType = nEntryType;
m_nLeftDist = nLeftDist;
m_nRightDist = nRightDist;
m_nTopDist = nTopDist;
m_nBottomDist = nBottomDist;
m_nPipeType = nPipeType;
m_pDrawEnt = new TDbFloorPipe();
m_pDrawEnt->SetParam(ptStart, ptEnd, m_nLeftDist, m_nRightDist, m_nTopDist, m_nBottomDist, dbPGAngle, nEntryType, nPipeType);
}
TFloorPipeJig::~TFloorPipeJig()
{
if(m_pDrawEnt)
delete m_pDrawEnt;
}
AcEdJig::DragStatus
TFloorPipeJig::GetPoint(XPoint &pt)
{
return acquirePoint(pt, m_ptStart.AsAcGePoint3d());
}
int TFloorPipeJig::DoIt(int *keyIndex)
{
int nRet = TSymbEdJig::DoIt(keyIndex);
return nRet;
}
// 更新实体数据
Adesk::Boolean TFloorPipeJig::update()
{
Adesk::Boolean bRet=Adesk::kTrue;
m_pDlg->UpdateData(TRUE);
m_pDrawEnt->SetEntryType(m_pDlg->m_iDirection+1);
m_pDrawEnt->SetAngle(A2R(m_pDlg->m_nAngle));
m_pDrawEnt->SetPipeLeftDist(m_pDlg->m_iLeftDist);
m_pDrawEnt->SetPipeRightDist(m_pDlg->m_iRightDist);
m_pDrawEnt->SetPipeTopDist(m_pDlg->m_iTopDist);
m_pDrawEnt->SetPipeBottomDist(m_pDlg->m_iBottomDist);
m_pDrawEnt->m_ptEnd = m_ptResult;
return bRet;
}
AcDbEntity* TFloorPipeJig::entity() const
{
return (AcDbEntity *)m_pDrawEnt;
}