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

82 lines
2.2 KiB
C++

//-----------------------------------------------------------------------------+
// Copyright (C), 1998-2007, Beijing Tangent Software Co. Ltd.
// = FileName : TGGePface 类
// = Version : ver2.0
// = Author : wlw
// = CreateDate : 2002-09-09
// = Description: TGGePface 类定义
// = Maintainers:
//
//-----------------------------------------------------------------------------+
#include "StdAfx.h"
#include "TGGePface.h"
#include "TGGePolyFacet.h"
#include "TchGlobalFunc.h"
TGGePface::~TGGePface()
{
}
int TGGePface::Make(const TCHAR *pszLay)
{
TGGePolyFacet a(1,2,3);
TCHAR clayer[80] = _T("");
TGGetVar(_T("CLAYER"), clayer);
const TCHAR * layer = pszLay ? pszLay : clayer;
TADSGePoint3d pp;
int vtNum = Length();
MakeEntity(RTDXF0, _T("POLYLINE"), 10, &pp, 66, 1,
8, layer, 70, 64, 71, vtNum, 72, 1, NULL);
TGGePface &pface = *this;
for (int i = 0; i < vtNum; i++)
{
MakeEntity(RTDXF0, _T("VERTEX"), 8, layer, 10, pface[i], 70, 192, NULL);
}
int nFaceNum = faces.Length();
for (i = 0; i < nFaceNum; i++)
{
faces[i]->Make(layer);
}
return MakeEntity(RTDXF0, _T("SEQEND"), NULL);
}
GEOAPI TGGePface * ConstructPolyFace(const AcDbVoidPtrArray &entSet)
{
TGGePface *pMesh = new TGGePface;
TGGePface &faces = *pMesh;
int nCount = entSet.length();
for (int n = 0; n<nCount; n++)
{
AcDbEntity *pEnt = (AcDbEntity *)entSet[n];
AcDbFace *pFace = AcDbFace::cast(pEnt);
if (pFace)
{
TADSGePoint3d vertex[4];
int vertice[4];
for (int idx = 0; idx<4; idx++)
{
VERIFY(pFace->getVertexAt(idx, vertex[idx]) == Acad::eOk);
Adesk::Boolean bVis = Adesk::kTrue;
VERIFY(pFace->isEdgeVisibleAt(idx, bVis) == Acad::eOk);
vertice[idx] = faces.NewAppend(vertex[idx])+1;
if (!bVis)
{
vertice[idx] = -vertice[idx];
}
}
pMesh->faces.Append(new TGGePolyFacet(vertice[0], vertice[1], vertice[2], vertice[3]));
}
}
if (pMesh->Length() == 0 || pMesh->faces.Length() == 0)
{
delete pMesh;
pMesh = NULL;
}
return pMesh;
}