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

424 lines
11 KiB
C++

//-----------------------------------------------------------------------------+
// Copyright (C), 1998-2007, SH Software Co. Ltd.
// = FileName : XAsdkCustomWorldGeometry.cpp
// = Version : ver2.0
// = Author : zjq
// = CreateDate : 2002-09-09
// = Description: 类的定义
// = Maintainers:
//
//-----------------------------------------------------------------------------+
#include "StdAfx.h"
#include "XAsdkCustomWorldGeometry.h"
#include "XGlobalCurveFunc.h"
ACRX_DEFINE_MEMBERS(XAsdkCustomWorldGeometry);
XAsdkCustomWorldGeometry::XAsdkCustomWorldGeometry(XAsdkCustomWorldDraw* pWorldDraw)
{
m_pCustomWorldDraw = pWorldDraw;
}
XAsdkCustomWorldGeometry::~XAsdkCustomWorldGeometry()
{
}
void XAsdkCustomWorldGeometry::getModelToWorldTransform(AcGeMatrix3d &pMatrix) const
{
}
void XAsdkCustomWorldGeometry::getWorldToModelTransform(AcGeMatrix3d &pMatrix) const
{
}
void XAsdkCustomWorldGeometry::setExtents(AcGePoint3d *pNewExtents) const
{
}
Adesk::Boolean XAsdkCustomWorldGeometry::circle(const AcGePoint3d& center,
const double radius,
const AcGeVector3d& normal
) const
{
if (normal == AcGeVector3d(0,0,1))
{
m_pCustomWorldDraw->curveData() << XCircle(XPoint(center), radius);
return Adesk::kTrue;
}
return Adesk::kFalse;
}
Adesk::Boolean XAsdkCustomWorldGeometry::circle(const AcGePoint3d& pt1,
const AcGePoint3d& pt2,
const AcGePoint3d& pt3
) const
{
m_pCustomWorldDraw->curveData() << XCircle(XPoint(pt1), XPoint(pt2), XPoint(pt3));
return Adesk::kTrue;
}
Adesk::Boolean XAsdkCustomWorldGeometry::circularArc(const AcGePoint3d& center,
const double radius,
const AcGeVector3d& normal,
const AcGeVector3d& startVector,
const double sweepAngle,
const AcGiArcType arcType
) const
{
if (normal == AcGeVector3d(0,0,1))
{
double nAng1 = ads_angle(XPoint(), XPoint(startVector[0], startVector[1]));
m_pCustomWorldDraw->curveData() << XArc(XPoint(center), radius, nAng1, nAng1 + sweepAngle);
return Adesk::kTrue;
}
return Adesk::kFalse;
}
Adesk::Boolean XAsdkCustomWorldGeometry::circularArc(const AcGePoint3d& start,
const AcGePoint3d& point,
const AcGePoint3d& end,
const AcGiArcType arcType
) const
{
m_pCustomWorldDraw->curveData() << XArc(start, point, end);
return Adesk::kTrue;
}
Adesk::Boolean XAsdkCustomWorldGeometry::polyline(const Adesk::UInt32 nbPoints,
const AcGePoint3d* pVertexList,
const AcGeVector3d* pNormal,
LONG_PTR lBaseSubEntMarker
) const
{
if (!pNormal || (*pNormal) == AcGeVector3d(0,0,1))
{
for (Adesk::UInt32 i = 0; i < nbPoints - 1; i++)
{
m_pCustomWorldDraw->curveData() << XLine(XPoint(pVertexList[i]), XPoint(pVertexList[i + 1]));
}
return Adesk::kTrue;
}
return Adesk::kFalse;
}
Adesk::Boolean XAsdkCustomWorldGeometry::polygon(const Adesk::UInt32 nbPoints,
const AcGePoint3d* pVertexList
) const
{
for (Adesk::UInt32 i = 0; i < nbPoints; i++)
{
Adesk::UInt32 iNext = i + 1;
if (iNext == nbPoints)
{
iNext = 0;
}
m_pCustomWorldDraw->curveData() << XLine(XPoint(pVertexList[i]), XPoint(pVertexList[iNext]));
}
return Adesk::kTrue;
}
Adesk::Boolean XAsdkCustomWorldGeometry::mesh(const Adesk::UInt32 rows,
const Adesk::UInt32 columns,
const AcGePoint3d* pVertexList,
const AcGiEdgeData* pEdgeData,
const AcGiFaceData* f,
const AcGiVertexData* pVertexData
) const
{
return Adesk::kFalse;
}
Adesk::Boolean XAsdkCustomWorldGeometry::shell(const Adesk::UInt32 nbVertex,
const AcGePoint3d* pVertexList,
const Adesk::UInt32 faceListSize,
const Adesk::Int32* pFaceList,
const AcGiEdgeData* pEdgeData,
const AcGiFaceData* pFaceData ,
const AcGiVertexData* pVertexData,
const struct resbuf* pResBuf
) const
{
XAsdkShellData *pShell=new XAsdkShellData;
// 复制进入的边界数据并将其分配给AsdkShellData的边界数据
// 增加顶点数给AsdkShellData
pShell->mNumVertices = nbVertex;
// 分配内存给顶点数组
pShell->mpVertexList = new AcGePoint3d[nbVertex];
// 增加所有的顶点给AsdkShellData
for (unsigned int i = 0; i < nbVertex; i++)
{
pShell->mpVertexList[i] = (*pVertexList);
++pVertexList;
}
pShell->mFaceListSize = faceListSize;
pShell->mpFaceList = new Adesk::Int32[faceListSize];
for (unsigned int k = 0; k < faceListSize; k++)
{
pShell->mpFaceList[k] = (*pFaceList);
++pFaceList;
}
if (pEdgeData)
{
pShell->setEdgeData(pEdgeData);
}
m_pCustomWorldDraw->shellData().Append(pShell);
return Adesk::kTrue;
}
Adesk::Boolean XAsdkCustomWorldGeometry::text(const AcGePoint3d& position,
const AcGeVector3d& normal,
const AcGeVector3d& direction,
const double height,
const double width,
const double oblique,
const TCHAR* pMsg
) const
{
return Adesk::kFalse;
}
Adesk::Boolean XAsdkCustomWorldGeometry::text(const AcGePoint3d& position,
const AcGeVector3d& normal,
const AcGeVector3d& direction,
const TCHAR* pMsg,
const Adesk::Int32 length,
const Adesk::Boolean raw,
const AcGiTextStyle& pTextStyle
) const
{
return Adesk::kFalse;
}
Adesk::Boolean XAsdkCustomWorldGeometry::xline(const AcGePoint3d& one_xline_point,
const AcGePoint3d& a_different_xline_point
) const
{
return Adesk::kFalse;
}
Adesk::Boolean XAsdkCustomWorldGeometry::pline(const AcDbPolyline& lwBuf,
Adesk::UInt32 fromIndex,
Adesk::UInt32 numSegs
) const
{
if (lwBuf.normal() == AcGeVector3d(0,0,1))
{
XPoly2D poly2d;
PolyConvert(lwBuf, poly2d);
for (Adesk::UInt32 i = fromIndex; i < fromIndex + numSegs; i++)
{
XCurveSegment seg;
poly2d.Nth(i, seg);
m_pCustomWorldDraw->curveData() << seg;
}
return Adesk::kTrue;
}
return Adesk::kFalse;
}
Adesk::Boolean XAsdkCustomWorldGeometry::ray(const AcGePoint3d& rays_starting_point,
const AcGePoint3d& a_different_ray_point
) const
{
return Adesk::kFalse;
}
Adesk::Boolean XAsdkCustomWorldGeometry::pushModelTransform(const AcGeVector3d & vNormal)
{
return Adesk::kFalse;
}
Adesk::Boolean XAsdkCustomWorldGeometry::pushModelTransform(const AcGeMatrix3d & xMat)
{
return Adesk::kFalse;
}
Adesk::Boolean XAsdkCustomWorldGeometry::popModelTransform()
{
return Adesk::kFalse;
}
Adesk::Boolean XAsdkCustomWorldGeometry::draw(AcGiDrawable*) const
{
return Adesk::kFalse;
}
Adesk::Boolean XAsdkCustomWorldGeometry::pushClipBoundary(AcGiClipBoundary * pBoundary)
{
return Adesk::kFalse;
}
void XAsdkCustomWorldGeometry::popClipBoundary()
{
}
Adesk::Boolean XAsdkCustomWorldGeometry::mesh(const Adesk::UInt32 rows,
const Adesk::UInt32 columns,
const AcGePoint3d* pVertexList,
const AcGiEdgeData* pEdgeData ,
const AcGiFaceData* pFaceData ,
const AcGiVertexData* pVertexData ,
const bool bAutoGenerateNormals
) const
{
return Adesk::kFalse;
}
Adesk::Boolean XAsdkCustomWorldGeometry::shell(const Adesk::UInt32 nbVertex,
const AcGePoint3d* pVertexList,
const Adesk::UInt32 faceListSize,
const Adesk::Int32* pFaceList,
const AcGiEdgeData* pEdgeData ,
const AcGiFaceData* pFaceData ,
const AcGiVertexData* pVertexData,
const struct resbuf* pResBuf ,
const bool bAutoGenerateNormals
) const
{
XAsdkShellData *pShell=new XAsdkShellData;
// 复制进入的边界数据并将其分配给AsdkShellData的边界数据
// 增加顶点数给AsdkShellData
pShell->mNumVertices = nbVertex;
// 分配内存给定点数组
pShell->mpVertexList = new AcGePoint3d[nbVertex];
// 增加所有的定点给AsdkShellData
for (unsigned int i = 0; i < nbVertex; i++)
{
pShell->mpVertexList[i] = (*pVertexList);
++pVertexList;
}
pShell->mFaceListSize = faceListSize;
pShell->mpFaceList = new Adesk::Int32[faceListSize];
for (unsigned int k = 0; k < faceListSize; k++)
{
pShell->mpFaceList[k] = (*pFaceList);
++pFaceList;
}
if (pEdgeData)
{
pShell->setEdgeData(pEdgeData);
}
m_pCustomWorldDraw->shellData().Append(pShell);
return Adesk::kTrue;
}
#if ARX > 17
AcGeMatrix3d XAsdkCustomWorldGeometry::pushPositionTransform (AcGiPositionTransformBehavior behavior,
const AcGePoint3d& offset)
{
return AcGeMatrix3d::kIdentity;
}
AcGeMatrix3d XAsdkCustomWorldGeometry::pushPositionTransform (AcGiPositionTransformBehavior behavior,
const AcGePoint2d& offset)
{
return AcGeMatrix3d::kIdentity;
}
AcGeMatrix3d XAsdkCustomWorldGeometry::pushScaleTransform (AcGiScaleTransformBehavior behavior,
const AcGePoint3d& extents)
{
return AcGeMatrix3d::kIdentity;
}
AcGeMatrix3d XAsdkCustomWorldGeometry::pushScaleTransform (AcGiScaleTransformBehavior behavior,
const AcGePoint2d& extents)
{
return AcGeMatrix3d::kIdentity;
}
AcGeMatrix3d XAsdkCustomWorldGeometry::pushOrientationTransform (AcGiOrientationTransformBehavior behavior)
{
return AcGeMatrix3d::kIdentity;
}
Adesk::Boolean XAsdkCustomWorldGeometry::polyline(const AcGiPolyline& polylineObj) const
{
return polyline(polylineObj.points(), polylineObj.vertexList(),
polylineObj.normal(), polylineObj.baseSubEntMarker());
}
Adesk::Boolean XAsdkCustomWorldGeometry::polyPolyline (Adesk::UInt32 nbPolylines,const AcGiPolyline* pPolylines) const
{
Adesk::Boolean bAborting = false;
for (Adesk::UInt32 i = 0; i < nbPolylines && !bAborting; ++i)
{
bAborting = polyline(pPolylines[i]);
}
return bAborting;
}
Adesk::Boolean XAsdkCustomWorldGeometry::polyPolygon(const Adesk::UInt32 numPolygonIndices,
const Adesk::UInt32* numPolygonPositions,
const AcGePoint3d* polygonPositions,
const Adesk::UInt32* numPolygonPoints,
const AcGePoint3d* polygonPoints,
const AcCmEntityColor* outlineColors,
const AcGiLineType* outlineTypes,
const AcCmEntityColor* fillColors,
const AcCmTransparency* fillOpacities) const
{
return Adesk::kFalse;
}
Adesk::Boolean XAsdkCustomWorldGeometry::image(const AcGiImageBGRA32& imageSource,
const AcGePoint3d& position,
const AcGeVector3d& u,
const AcGeVector3d& v,
TransparencyMode transparencyMode
)const
{
return Adesk::kFalse;
}
Adesk::Boolean XAsdkCustomWorldGeometry::rowOfDots(int count,const AcGePoint3d& start,const AcGeVector3d& step) const
{
return Adesk::kFalse;
}
Adesk::Boolean XAsdkCustomWorldGeometry::ellipticalArc(const AcGePoint3d& center,
const AcGeVector3d& normal,
double majorAxisLength,
double minorAxisLength,
double startDegreeInRads,
double endDegreeInRads,
double tiltDegreeInRads,
AcGiArcType arcType) const
{
return Adesk::kFalse;
}
#endif