//--------------------------------------------------------- bool CShapes_Buffer::Get_Buffer_Points(CSG_Shape *pPoints, CSG_Shape *pBuffer, double Distance) { CSG_Shapes Part(SHAPE_TYPE_Polygon); CSG_Shape *pPart = Part.Add_Shape(); for(int iPart=0; iPart<pPoints->Get_Part_Count(); iPart++) { for(int iPoint=0; iPoint<pPoints->Get_Point_Count(iPart); iPoint++) { if( pBuffer->Get_Part_Count() == 0 ) { Add_Arc(pBuffer, pPoints->Get_Point(iPoint), Distance, 0.0, M_PI_360); } else { Add_Arc(pPart , pPoints->Get_Point(iPoint), Distance, 0.0, M_PI_360); SG_Polygon_Union(pBuffer, pPart); pPart->Del_Parts(); } } } return( true ); }
//--------------------------------------------------------- void CDXF_Import::addCircle(const DL_CircleData &data) { if( !Check_Layer(attributes.getLayer().c_str()) ) return; CSG_Shape *pCircle = m_pCircles->Add_Shape(); Add_Arc(pCircle, data.cx, data.cy, data.radius, 0.0, 360.0); }
//--------------------------------------------------------- void CDXF_Import::addArc(const DL_ArcData &data) { if( !Check_Layer(attributes.getLayer().c_str()) ) return; CSG_Shape *pArc = m_pPolyLine ? m_pPolyLine : m_pPolyLines->Add_Shape(); Add_Arc(pArc, data.cx, data.cy, data.radius, data.angle1, data.angle2); if( pArc != m_pPolyLine ) { pArc->Set_Value(TBL_POLYOBJ_LAYER, CSG_String(attributes.getLayer().c_str())); } }
//--------------------------------------------------------- inline void CShapes_Buffer::Add_Arc(CSG_Shape *pBuffer, const TSG_Point &Center, double Distance, const TSG_Point &A, const TSG_Point &B) { double alpha, beta; alpha = Get_Direction(A, Center); beta = Get_Direction(B, Center); if( alpha - beta >= M_PI_180 ) { beta += M_PI_360; } Add_Arc(pBuffer, Center, Distance, alpha, beta); }
//--------------------------------------------------------- bool CShapes_Buffer::Get_Buffer_Point(CSG_Shape *pPoint, CSG_Shape *pBuffer, double Distance) { Add_Arc(pBuffer, pPoint->Get_Point(0), Distance, 0.0, M_PI_360); return( true ); }