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

109 lines
1.7 KiB
C++

#include "stdafx.h"
#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)
{
//从小到大
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)
{
if (m_nDir == 0) // 平行 X
{
return (m_ptGe[0].y < bLine.m_ptGe[0].y ) ? true : false;
}
if (m_nDir == 1)// 平行 Y
{
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);
}