2026-10-04 00:04:20 +08:00
|
|
|
#include "stdafx.h"
|
2026-09-28 15:28:50 +08:00
|
|
|
#include "UIIBorderLine.h"
|
|
|
|
|
|
|
|
|
|
CUIIBorderLine::CUIIBorderLine(void)
|
|
|
|
|
{
|
|
|
|
|
m_nDir = -1;
|
|
|
|
|
memset(m_ptGe,0,sizeof(AcGePoint3d) * 2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CUIIBorderLine::~CUIIBorderLine(void)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool CUIIBorderLine::Set(AcGePoint3d ptGe1,AcGePoint3d ptGe2)
|
|
|
|
|
{
|
2026-10-04 00:04:20 +08:00
|
|
|
//从小到大
|
2026-09-28 15:28:50 +08:00
|
|
|
AcGeVector3d vt = ptGe2 - ptGe1;
|
|
|
|
|
if (vt.isParallelTo(AcGeVector3d::kXAxis))
|
|
|
|
|
{
|
|
|
|
|
if (vt.isCodirectionalTo(AcGeVector3d::kXAxis))
|
|
|
|
|
{
|
|
|
|
|
m_ptGe[0] = ptGe1;
|
|
|
|
|
m_ptGe[1] = ptGe2;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_ptGe[0] = ptGe2;
|
|
|
|
|
m_ptGe[1] = ptGe1;
|
|
|
|
|
}
|
|
|
|
|
m_nDir = 0;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (vt.isParallelTo(AcGeVector3d::kYAxis))
|
|
|
|
|
{
|
|
|
|
|
if (vt.isCodirectionalTo(AcGeVector3d::kYAxis))
|
|
|
|
|
{
|
|
|
|
|
m_ptGe[0] = ptGe1;
|
|
|
|
|
m_ptGe[1] = ptGe2;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_ptGe[0] = ptGe2;
|
|
|
|
|
m_ptGe[1] = ptGe1;
|
|
|
|
|
}
|
|
|
|
|
m_nDir = 1;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
short CUIIBorderLine::GetDir()
|
|
|
|
|
{
|
|
|
|
|
return m_nDir;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
double CUIIBorderLine::GetPos()
|
|
|
|
|
{
|
|
|
|
|
if (m_nDir == 0)
|
|
|
|
|
{
|
|
|
|
|
return m_ptGe[0].y;
|
|
|
|
|
}
|
|
|
|
|
else if (m_nDir == 1)
|
|
|
|
|
{
|
|
|
|
|
return m_ptGe[0].x;
|
|
|
|
|
}
|
|
|
|
|
return -1.e10;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AcGePoint3d CUIIBorderLine::GetStart()
|
|
|
|
|
{
|
|
|
|
|
return m_ptGe[0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AcGePoint3d CUIIBorderLine::GetEnd()
|
|
|
|
|
{
|
|
|
|
|
return m_ptGe[1];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CUIIBorderLine& CUIIBorderLine::operator = (const CUIIBorderLine& bLine)
|
|
|
|
|
{
|
|
|
|
|
m_ptGe[0] = bLine.m_ptGe[0];
|
|
|
|
|
m_ptGe[1] = bLine.m_ptGe[1];
|
|
|
|
|
m_nDir = bLine.m_nDir;
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool CUIIBorderLine::operator < (const CUIIBorderLine& bLine)
|
|
|
|
|
{
|
|
|
|
|
if (m_nDir == bLine.m_nDir)
|
|
|
|
|
{
|
2026-10-04 00:04:20 +08:00
|
|
|
if (m_nDir == 0) // 平行 X
|
2026-09-28 15:28:50 +08:00
|
|
|
{
|
|
|
|
|
return (m_ptGe[0].y < bLine.m_ptGe[0].y ) ? true : false;
|
|
|
|
|
}
|
|
|
|
|
|
2026-10-04 00:04:20 +08:00
|
|
|
if (m_nDir == 1)// 平行 Y
|
2026-09-28 15:28:50 +08:00
|
|
|
{
|
|
|
|
|
return (m_ptGe[0].x < bLine.m_ptGe[0].x ) ? true : false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CUIIBorderLine::TransformBy(AcGeMatrix3d& xform)
|
|
|
|
|
{
|
|
|
|
|
m_ptGe[0].transformBy(xform);
|
|
|
|
|
m_ptGe[1].transformBy(xform);
|
|
|
|
|
}
|