//-----------------------------------------------------------------------------+ // Copyright (C), 1998-2007, Beijing Tangent Software Co. Ltd. // = FileName : TDbGripAngleDim.cpp // = Version : ver2.0 // = Author : xlc // = CreateDate : 2002-09-09 // = Description: 夹点角度标注类的定义 // = Maintainers: // //-----------------------------------------------------------------------------+ #include "StdAfx.h" #include "TDbGripAngleDim.h" #if ADS > 15 TDbGripAngleDim::TDbGripAngleDim(int flag,bool bHover) :TDbGripDim(flag,bHover) { } TDbGripAngleDim::~TDbGripAngleDim() { } void TDbGripAngleDim::SetData(AcGePoint3d ptCenter,AcGePoint3d ptStart,AcGePoint3d ptEnd,AcGePoint3d ptArc) { m_ptCenter = ptCenter; m_ptStart = ptStart; m_ptEnd = ptEnd; m_ptArc = ptArc; } AcDbDimension* TDbGripAngleDim::CreateDimEnt()const { return new AcDb3PointAngularDimension; } void TDbGripAngleDim::SetData(AcGePoint3d ptCenter,AcGePoint3d ptStart,AcGePoint3d ptEnd) { AcGePoint3d ptMid; Midpoint(ptStart,ptEnd,ptMid); AcGeVector3d vt1 = ptStart - ptCenter,vt2 = ptEnd - ptCenter, vt3 = ptMid - ptCenter; m_ptCenter = ptCenter; m_ptStart = ptCenter + vt1.normal(); m_ptEnd = ptCenter + vt2.normal(); m_ptArc = ptCenter + vt3.normal() * vt1.length(); } void TDbGripAngleDim::SetData(TGGeCurveSegment arc,double dist) { m_ptCenter = arc.GetArc().GetCenterPt().AsAcGePoint3d(); m_ptStart = arc.GetStartPoint().AsAcGePoint3d(); m_ptEnd = arc.GetEndPoint().AsAcGePoint3d(); if(dist<0) { dist = m_fDimScale * 0.5; } m_ptArc = arc.Offset(dist,OFFSET_RIGHT).MidPoint().AsAcGePoint3d(); } void TDbGripAngleDim::UpdateDimEnt() { TDbGripDim::UpdateDimEnt(); AcDb3PointAngularDimension*pDim = AcDb3PointAngularDimension::cast(DimEnt()); if(pDim == NULL) { return; } pDim->setCenterPoint(m_ptCenter); pDim->setArcPoint(m_ptArc); pDim->setXLine1Point(m_ptStart); pDim->setXLine2Point(m_ptEnd); } #endif