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

101 lines
1.7 KiB
C++

#include "StdAfx.h"
#include "GeTrianglePface.h"
#include "ADSGePoint3d.h"
#include "GePolyFacet.h"
#include "GePface.h"
#include "globalFunc.h"
GeTrianglePface::~GeTrianglePface()
{
}
int GeTrianglePface::MakeSolid(const TCHAR *pszLay)
{
TCHAR szLayer[80] = _T("");
if (pszLay)
{
_tcscpy(szLayer, pszLay);
}
else
{
GlobalFunc::TGGetVar(_T("CLAYER"), szLayer);
}
int nLen = Length();
int nRet = RTERROR;
for (int i = 0; i < nLen; i++)
{
GeTriangle *pTri = (*this)[i];
nRet = GlobalFunc::MakeEntity(RTDXF0, _T("SOLID"), 8, szLayer, 10, &pTri->vertex1, 11, &pTri->vertex2,
12, &pTri->vertex3, 13, &pTri->vertex3, NULL);
}
return nRet;
}
// 创建 Pface
int GeTrianglePface::MakePolyface(const TCHAR *pszLay)
{
GePface pface;
int nLen = Length();
for (int i = 0; i < nLen; i++)
{
GeTriangle *pTri = (*this)[i];
int nIndex1, nIndex2, nIndex3;
if (pface.FindPoint(pTri->vertex1))
{
nIndex1 = pface.CurPosition()+1;
}
else
{
pface.Append(new ADSGePoint3d(pTri->vertex1));
nIndex1 = pface.Length();
}
if (pface.FindPoint(pTri->vertex2))
{
nIndex2 = pface.CurPosition() + 1;
}
else
{
pface.Append(new ADSGePoint3d(pTri->vertex2));
nIndex2 = pface.Length();
}
if (pface.FindPoint(pTri->vertex3))
{
nIndex3 = pface.CurPosition() + 1;
}
else
{
pface.Append(new ADSGePoint3d(pTri->vertex3));
nIndex3 = pface.Length();
}
if (pTri->m_nFlag & SIDE1_INVISIBLE)
{
nIndex1 = -nIndex1;
}
if (pTri->m_nFlag & SIDE2_INVISIBLE)
{
nIndex2 = -nIndex2;
}
if (pTri->m_nFlag & SIDE3_INVISIBLE)
{
nIndex3 = -nIndex3;
}
pface.faces.Append(new GePolyFacet(nIndex1, nIndex2, nIndex3));
}
return pface.Make(pszLay);
}