#include "StdAfx.h" #include "globalFunc.h" #include "TImageDrawDCEx.h" TImageDrawDCEx::TImageDrawDCEx(CDC *pDC, const CRect &rect, COLORREF bkcolor) :TImageDrawDC(pDC, rect, bkcolor) { m_nIT = IT_SLIDE; m_nFrontColor = 7; } TImageDrawDCEx::TImageDrawDCEx() { m_nIT = IT_SLIDE; m_nFrontColor = 7; } void TImageDrawDCEx::Reset() { m_slide.Reset(); } TImageDrawDCEx::~TImageDrawDCEx() { } BOOL TImageDrawDCEx::IsFullExplode() const { return TRUE; } void TImageDrawDCEx::DrawText(const TCHAR *pszContent/* = NULL*/) { } void TImageDrawDCEx::DrawSolid(const GePoly2D &polyOutline) { } void TImageDrawDCEx::DrawHatch(const GePoly2D &polyOutline, const TCHAR *pszPattern, double nScale) { } void TImageDrawDCEx::DrawHatchEx(const GePoly2D &polyOutline, const TCHAR *pszPattern, double nScale,double rotation) { } void TImageDrawDCEx::DrawMesh(const GePoly2D &polyOut, const TVector3D &vtOffset) { } void TImageDrawDCEx::DrawMesh(const GePoly2D &polyRegion1, const GePoly2D &polyRegion2) { } void TImageDrawDCEx::DrawMesh(const Adesk::UInt32 rows, const Adesk::UInt32 columns, const AcGePoint3d* pVertexList, const AcGiEdgeData* pEdgeData) { } void TImageDrawDCEx::DrawShell(const GePoly2D &polyOut, const PtrList &lstPolyIn) { } void TImageDrawDCEx::DrawShell(Adesk::UInt32 nbVertex, const AcGePoint3d* pVertexList, Adesk::UInt32 faceListSize, const Adesk::Int32* pFaceList, const AcGiEdgeData* pEdgeData) { } void TImageDrawDCEx::DrawBody(const GePoly2D &polySrc, const TVector3D &vtOffset) { } void TImageDrawDCEx::DrawBody(const GePoly2D &polyOut, const GePoly2D &polyIn, const TVector3D &vtOffset) { } void TImageDrawDCEx::DrawFace(const Ge3DFace &face) { } void TImageDrawDCEx::DrawBlock(const AcDbBlockTableRecord &blockRec, const ADSGePoint3d &ptInsert, const AcGeScale3d &scales, double nRot, BOOL bMakeBlock) { } void TImageDrawDCEx::DrawXCurve(const GeCurveSegment& curve) { DrawCurve(curve); } void TImageDrawDCEx::DrawXLine(const GeLine& line) { DrawLine(line); } void TImageDrawDCEx::DrawXArc(const GeArc& arc) { DrawArc(arc); } void TImageDrawDCEx::DrawXCircle(const GeCircle& cir) { DrawCircle(cir); } void TImageDrawDCEx::DrawX3DFace(const Ge3DFace& face) { DrawFace(face); } Adesk::UInt16 TImageDrawDCEx::GetColor() const { return m_nFrontColor; } void TImageDrawDCEx::SetColor(Adesk::UInt16 nColor) { if(nColor > 0 && nColor < 256) { m_nFrontColor = nColor; } } void TImageDrawDCEx::DrawLine(const GeLine &ln, double nThickness) { m_slide.Append(new TGGeColorLine(ln.GetStartPoint(), ln.GetEndPoint(), m_nFrontColor)); } void TImageDrawDCEx::Draw(const ADSGePointList &pts) { int nLen = pts.Length(); for(int i = 0; i < nLen - 1; i++) { DrawLine(GeLine(pts[i], pts[i + 1])); } } void TImageDrawDCEx::DrawArc(const GeArc &arc, double nThickness) { int nDiv = 30; ads_real intAng = fabs(arc.Bulge()); int n = (int)(intAng / PI / 2.0 * nDiv); if(n <= 0) { n = 1; } ads_real ang = intAng / n; ADSGePointList pts; ADSGePoint3d vertex; for(int i = 0; i <= n; i++) { ads_real drt = arc.GetStarAngle() + i * ang; ads_polar(arc.GetCenterPt(), drt, arc.GetRadius(), vertex); pts.Append(new ADSGePoint3d(vertex)); } Draw(pts); } void TImageDrawDCEx::DrawCircle(const GeCircle &cir, double nThickness) { int nDiv = 30; ads_real ang = PI * 2.0 / nDiv; ADSGePointList pts; ADSGePoint3d vertex; for(int i = 0; i <= nDiv; i++) { ads_real drt = i * ang; ads_polar(cir.GetCenterPt(), drt, cir.GetRadius(), vertex); pts.Append(new ADSGePoint3d(vertex)); } Draw(pts); } const TCHAR * TImageDrawDCEx::Descriptor() { return _T("TImageDrawDCEx"); } const TCHAR * TImageDrawDCEx::Desc() { return Descriptor(); } AcDbObjectId TImageDrawDCEx::GetLayerId() const { return AcDbObjectId::kNull; } Acad::ErrorStatus TImageDrawDCEx::SetLayer(const AcDbObjectId &id) { return Acad::eNotImplementedYet; } Acad::ErrorStatus TImageDrawDCEx::SetLayer(const TCHAR *pszLay) { return Acad::eNotImplementedYet; } Acad::ErrorStatus TImageDrawDCEx::SetLineType(const TCHAR *pltype) { return Acad::eNotImplementedYet; } Acad::ErrorStatus TImageDrawDCEx::SetMaterial(const TCHAR* sMaterial) { return Acad::eNotImplementedYet; }