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

110 lines
2.1 KiB
C++

//-----------------------------------------------------------------------------+
// Copyright (C), 1998-2007, SH Software Co. Ltd.
// = FileName : XTrianglePface 类
// = Version : ver2.0
// = Author : zjq
// = CreateDate : 2002-09-09
// = Description: XTrianglePface 类声明
// = Maintainers:
//
//-----------------------------------------------------------------------------+
#include "StdAfx.h"
#include "XTrianglePface.h"
#include "XPoint.h"
#include "XPolyFacet.h"
#include "XPface.h"
#include "XGlobalFunc.h"
XTrianglePface::~XTrianglePface()
{
}
int XTrianglePface::MakeSolid(const TCHAR *pszLay)
{
TCHAR szLayer[80] = _T("");
if (pszLay)
{
_tcscpy(szLayer, pszLay);
}
else
{
xg_getvar(_T("CLAYER"), szLayer);
}
int nLen = Length();
int nRet = RTERROR;
for (int i = 0; i < nLen; i++)
{
XTriangle *pTri = (*this)[i];
nRet = MakeEntity(RTDXF0, _T("SOLID"), 8, szLayer, 10, &pTri->vertex1, 11, &pTri->vertex2,
12, &pTri->vertex3, 13, &pTri->vertex3, NULL);
}
return nRet;
}
// 创建 Pface
int XTrianglePface::MakePolyface(const TCHAR *pszLay)
{
XPface pface;
int nLen = Length();
for (int i = 0; i < nLen; i++)
{
XTriangle *pTri = (*this)[i];
int nIndex1, nIndex2, nIndex3;
if (pface.FindPoint(pTri->vertex1))
{
nIndex1 = pface.CurPosition()+1;
}
else
{
pface.Append(new XPoint(pTri->vertex1));
nIndex1 = pface.Length();
}
if (pface.FindPoint(pTri->vertex2))
{
nIndex2 = pface.CurPosition() + 1;
}
else
{
pface.Append(new XPoint(pTri->vertex2));
nIndex2 = pface.Length();
}
if (pface.FindPoint(pTri->vertex3))
{
nIndex3 = pface.CurPosition() + 1;
}
else
{
pface.Append(new XPoint(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 XPolyFacet(nIndex1, nIndex2, nIndex3));
}
return pface.Make(pszLay);
}