//-----------------------------------------------------------------------------+ // Copyright (C), 1998-2007, Beijing Tangent Software Co. Ltd. // = FileName : TGGiCustomWorldGeometry.cpp // = Version : ver2.0 // = Author : xlc // = CreateDate : 2002-09-09 // = Description: 类的定义 // = Maintainers: // //-----------------------------------------------------------------------------+ #include "StdAfx.h" #include "TGGiCustomWorldGeometry.h" #include "TchGlobalCurveFunc.h" ACRX_DEFINE_MEMBERS(TGGiCustomWorldGeometry); TGGiCustomWorldGeometry::TGGiCustomWorldGeometry(TGGiCustomWorldDraw* pWorldDraw) { m_pCustomWorldDraw = pWorldDraw; } TGGiCustomWorldGeometry::~TGGiCustomWorldGeometry() { } void TGGiCustomWorldGeometry::getModelToWorldTransform(AcGeMatrix3d &pMatrix) const { } void TGGiCustomWorldGeometry::getWorldToModelTransform(AcGeMatrix3d &pMatrix) const { } void TGGiCustomWorldGeometry::setExtents(AcGePoint3d *pNewExtents) const { } Adesk::Boolean TGGiCustomWorldGeometry::circle(const AcGePoint3d& center, const double radius, const AcGeVector3d& normal ) const { if (normal == AcGeVector3d(0,0,1)) { m_pCustomWorldDraw->curveData() << TGGeCircle(TADSGePoint3d(center), radius); return Adesk::kTrue; } return Adesk::kFalse; } Adesk::Boolean TGGiCustomWorldGeometry::circle(const AcGePoint3d& pt1, const AcGePoint3d& pt2, const AcGePoint3d& pt3 ) const { m_pCustomWorldDraw->curveData() << TGGeCircle(TADSGePoint3d(pt1), TADSGePoint3d(pt2), TADSGePoint3d(pt3)); return Adesk::kTrue; } Adesk::Boolean TGGiCustomWorldGeometry::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(TADSGePoint3d(), TADSGePoint3d(startVector[0], startVector[1])); m_pCustomWorldDraw->curveData() << TGGeArc(TADSGePoint3d(center), radius, nAng1, nAng1 + sweepAngle); return Adesk::kTrue; } return Adesk::kFalse; } Adesk::Boolean TGGiCustomWorldGeometry::circularArc(const AcGePoint3d& start, const AcGePoint3d& point, const AcGePoint3d& end, const AcGiArcType arcType ) const { m_pCustomWorldDraw->curveData() << TGGeArc(start, point, end); return Adesk::kTrue; } Adesk::Boolean TGGiCustomWorldGeometry::polyline(const Adesk::UInt32 nbPoints, const AcGePoint3d* pVertexList, const AcGeVector3d* pNormal, Adesk::LongPtr lBaseSubEntMarker ) const { if (!pNormal || (*pNormal) == AcGeVector3d(0,0,1)) { for (Adesk::UInt32 i = 0; i < nbPoints - 1; i++) { m_pCustomWorldDraw->curveData() << TGGeLine(TADSGePoint3d(pVertexList[i]), TADSGePoint3d(pVertexList[i + 1])); } return Adesk::kTrue; } return Adesk::kFalse; } Adesk::Boolean TGGiCustomWorldGeometry::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() << TGGeLine(TADSGePoint3d(pVertexList[i]), TADSGePoint3d(pVertexList[iNext])); } return Adesk::kTrue; } Adesk::Boolean TGGiCustomWorldGeometry::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 TGGiCustomWorldGeometry::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 { TGGiShellData *pShell=new TGGiShellData; // 复制进入的边界数据并将其分配给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 TGGiCustomWorldGeometry::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 TGGiCustomWorldGeometry::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 TGGiCustomWorldGeometry::xline(const AcGePoint3d& one_xline_point, const AcGePoint3d& a_different_xline_point ) const { return Adesk::kFalse; } Adesk::Boolean TGGiCustomWorldGeometry::pline(const AcDbPolyline& lwBuf, Adesk::UInt32 fromIndex, Adesk::UInt32 numSegs ) const { if (lwBuf.normal() == AcGeVector3d(0,0,1)) { TGGePoly2D poly2d; PolyConvert(lwBuf, poly2d); for (Adesk::UInt32 i = fromIndex; i < fromIndex + numSegs; i++) { TGGeCurveSegment seg; poly2d.Nth(i, seg); m_pCustomWorldDraw->curveData() << seg; } return Adesk::kTrue; } return Adesk::kFalse; } Adesk::Boolean TGGiCustomWorldGeometry::ray(const AcGePoint3d& rays_starting_point, const AcGePoint3d& a_different_ray_point ) const { return Adesk::kFalse; } Adesk::Boolean TGGiCustomWorldGeometry::pushModelTransform(const AcGeVector3d & vNormal) { return Adesk::kFalse; } Adesk::Boolean TGGiCustomWorldGeometry::pushModelTransform(const AcGeMatrix3d & xMat) { return Adesk::kFalse; } Adesk::Boolean TGGiCustomWorldGeometry::popModelTransform() { return Adesk::kFalse; } Adesk::Boolean TGGiCustomWorldGeometry::draw(AcGiDrawable*) const { return Adesk::kFalse; } Adesk::Boolean TGGiCustomWorldGeometry::pushClipBoundary(AcGiClipBoundary * pBoundary) { return Adesk::kFalse; } void TGGiCustomWorldGeometry::popClipBoundary() { } Adesk::Boolean TGGiCustomWorldGeometry::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 TGGiCustomWorldGeometry::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 { TGGiShellData *pShell=new TGGiShellData; // 复制进入的边界数据并将其分配给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 ADS>17 AcGeMatrix3d TGGiCustomWorldGeometry::pushPositionTransform (AcGiPositionTransformBehavior behavior, const AcGePoint3d& offset) { return AcGeMatrix3d::kIdentity; } AcGeMatrix3d TGGiCustomWorldGeometry::pushPositionTransform (AcGiPositionTransformBehavior behavior, const AcGePoint2d& offset) { return AcGeMatrix3d::kIdentity; } AcGeMatrix3d TGGiCustomWorldGeometry::pushScaleTransform (AcGiScaleTransformBehavior behavior, const AcGePoint3d& extents) { return AcGeMatrix3d::kIdentity; } AcGeMatrix3d TGGiCustomWorldGeometry::pushScaleTransform (AcGiScaleTransformBehavior behavior, const AcGePoint2d& extents) { return AcGeMatrix3d::kIdentity; } AcGeMatrix3d TGGiCustomWorldGeometry::pushOrientationTransform (AcGiOrientationTransformBehavior behavior) { return AcGeMatrix3d::kIdentity; } Adesk::Boolean TGGiCustomWorldGeometry::polyline(const AcGiPolyline& polylineObj) const { return polyline(polylineObj.points(), polylineObj.vertexList(), polylineObj.normal(), polylineObj.baseSubEntMarker()); } Adesk::Boolean TGGiCustomWorldGeometry::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 TGGiCustomWorldGeometry::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 TGGiCustomWorldGeometry::image(const AcGiImageBGRA32& imageSource, const AcGePoint3d& position, const AcGeVector3d& u, const AcGeVector3d& v, TransparencyMode transparencyMode )const { return Adesk::kFalse; } Adesk::Boolean TGGiCustomWorldGeometry::rowOfDots(int count,const AcGePoint3d& start,const AcGeVector3d& step) const { return Adesk::kFalse; } Adesk::Boolean TGGiCustomWorldGeometry::ellipticalArc(const AcGePoint3d& center, const AcGeVector3d& normal, double majorAxisLength, double minorAxisLength, double startDegreeInRads, double endDegreeInRads, double tiltDegreeInRads, AcGiArcType arcType) const { return Adesk::kFalse; } #endif