92 lines
1.5 KiB
C++
92 lines
1.5 KiB
C++
#include "stdafx.h"
|
|
#include "UIIBoundary.h"
|
|
#include <algorithm>
|
|
#include "UIIBorderLine.h"
|
|
|
|
CUIIBoundary::CUIIBoundary(void)
|
|
{
|
|
}
|
|
|
|
CUIIBoundary::~CUIIBoundary(void)
|
|
{
|
|
}
|
|
|
|
bool CUIIBoundary::Add(CUIIBorderLine& bLine)
|
|
{
|
|
if (bLine.GetDir() == 0 || bLine.GetDir() == 1)
|
|
{
|
|
m_arBordLines.push_back(bLine);
|
|
Sort();
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
bool CUIIBoundary::Get(int nIndex,CUIIBorderLine& bLine)
|
|
{
|
|
if (nIndex < m_arBordLines.size() && nIndex > -1)
|
|
{
|
|
bLine = m_arBordLines.at(nIndex);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
int CUIIBoundary::GetCount()
|
|
{
|
|
return (int)m_arBordLines.size();
|
|
}
|
|
|
|
AcGePoint3d CUIIBoundary::GetStart()
|
|
{
|
|
if (m_arBordLines.size() > 0)
|
|
{
|
|
return m_arBordLines.at(0).GetStart();
|
|
}
|
|
return AcGePoint3d(0,0,0);
|
|
}
|
|
|
|
AcGePoint3d CUIIBoundary::GetEnd()
|
|
{
|
|
if (m_arBordLines.size() > 0)
|
|
{
|
|
return m_arBordLines.at(m_arBordLines.size() - 1).GetEnd();
|
|
}
|
|
return AcGePoint3d(0,0,0);
|
|
}
|
|
|
|
short CUIIBoundary::GetDir()
|
|
{
|
|
if (!m_arBordLines.empty())
|
|
{
|
|
return m_arBordLines.at(0).GetDir();
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
double CUIIBoundary::GetPos()
|
|
{
|
|
if (!m_arBordLines.empty())
|
|
{
|
|
return m_arBordLines.at(0).GetPos();
|
|
}
|
|
return -1.e-10;
|
|
}
|
|
|
|
void CUIIBoundary::Sort()
|
|
{
|
|
if (m_arBordLines.size() > 2)
|
|
{
|
|
std::sort(m_arBordLines.begin(),m_arBordLines.end());
|
|
}
|
|
}
|
|
|
|
void CUIIBoundary::TransformBy(AcGeMatrix3d& xform)
|
|
{
|
|
typedef std::vector<CUIIBorderLine>::iterator IT;
|
|
|
|
for (IT it = m_arBordLines.begin();it != m_arBordLines.end();it++)
|
|
{
|
|
(*it).TransformBy(xform);
|
|
}
|
|
} |