/* * KiRouter - a push-and-(sometimes-)shove PCB router * * Copyright (C) 2019 CERN * Author: Seth Hillbrand * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see . */ #ifndef __PNS_ARC_H #define __PNS_ARC_H #include #include #include #include #include "pns_line.h" #include "pns_linked_item.h" namespace PNS { class NODE; class ARC : public LINKED_ITEM { public: ARC() : LINKED_ITEM( ARC_T ) {} ARC( const SHAPE_ARC& aArc, int aNet ) : LINKED_ITEM( ARC_T ), m_arc( aArc ) { m_net = aNet; } ARC( const ARC& aParentArc, const SHAPE_ARC& aArc ) : LINKED_ITEM( ARC_T ), m_arc( aArc ) { m_net = aParentArc.Net(); m_layers = aParentArc.Layers(); m_marker = aParentArc.Marker(); m_rank = aParentArc.Rank(); } ARC( const LINE& aParentLine, const SHAPE_ARC& aArc ) : LINKED_ITEM( ARC_T ), m_arc( aArc.GetCenter(), aArc.GetP0(), aArc.GetCentralAngle(), aParentLine.Width() ) { m_net = aParentLine.Net(); m_layers = aParentLine.Layers(); m_marker = aParentLine.Marker(); m_rank = aParentLine.Rank(); } static inline bool ClassOf( const ITEM* aItem ) { return aItem && ARC_T == aItem->Kind(); } ARC* Clone() const override; const SHAPE* Shape() const override { return static_cast( &m_arc ); } void SetWidth( int aWidth ) override { m_arc.SetWidth(aWidth); } int Width() const override { return m_arc.GetWidth(); } const SHAPE_LINE_CHAIN CLine() const { return SHAPE_LINE_CHAIN( m_arc ); } const SHAPE_LINE_CHAIN Hull( int aClearance, int aWalkaroundThickness ) const override; virtual VECTOR2I Anchor( int n ) const override { if( n == 0 ) return m_arc.GetP0(); else return m_arc.GetP1(); } virtual int AnchorCount() const override { return 2; } OPT_BOX2I ChangedArea( const ARC* aOther ) const; private: SHAPE_ARC m_arc; }; } #endif