2022-08-30 12:52:34 +00:00
|
|
|
/*
|
|
|
|
* KiRouter - a push-and-(sometimes-)shove PCB router
|
|
|
|
*
|
2022-09-11 21:17:45 +00:00
|
|
|
* Copyright (C) 2016-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
2022-08-30 12:52:34 +00:00
|
|
|
*
|
|
|
|
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
|
|
|
*
|
|
|
|
* 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 <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __PNS_HOLE_H
|
|
|
|
#define __PNS_HOLE_H
|
|
|
|
|
|
|
|
#include "pns_item.h"
|
|
|
|
|
|
|
|
#include <geometry/shape.h>
|
|
|
|
#include <geometry/shape_line_chain.h>
|
|
|
|
|
|
|
|
namespace PNS
|
|
|
|
{
|
|
|
|
|
|
|
|
class HOLE : public ITEM
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
HOLE( ITEM* aParentPadVia, SHAPE* aShape ) :
|
|
|
|
ITEM( ITEM::HOLE_T ),
|
|
|
|
m_holeShape( aShape ),
|
|
|
|
m_parentPadVia( aParentPadVia )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
HOLE( const ITEM& aOther ) : ITEM( aOther ) {}
|
|
|
|
|
|
|
|
virtual ~HOLE();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return a deep copy of the item.
|
|
|
|
*/
|
|
|
|
virtual HOLE* Clone() const override;
|
|
|
|
|
|
|
|
virtual const SHAPE_LINE_CHAIN Hull( int aClearance = 0, int aWalkaroundThickness = 0,
|
|
|
|
int aLayer = -1 ) const override;
|
|
|
|
|
2023-04-09 19:25:22 +00:00
|
|
|
int Radius() const;
|
2022-08-30 12:52:34 +00:00
|
|
|
|
|
|
|
const SHAPE* Shape() const override { return m_holeShape; }
|
|
|
|
|
|
|
|
ITEM* ParentPadVia() const { return m_parentPadVia; }
|
|
|
|
|
2023-04-06 16:59:43 +00:00
|
|
|
BOARD_ITEM* BoardItem() const override
|
2022-09-14 21:02:30 +00:00
|
|
|
{
|
2023-04-06 14:05:48 +00:00
|
|
|
if( m_parent )
|
|
|
|
return m_parent;
|
|
|
|
|
|
|
|
if( m_parentPadVia )
|
|
|
|
return m_parentPadVia->Parent();
|
|
|
|
|
|
|
|
return nullptr;
|
2022-09-14 21:02:30 +00:00
|
|
|
}
|
|
|
|
|
2022-08-30 12:52:34 +00:00
|
|
|
void SetCenter( const VECTOR2I& aCenter );
|
|
|
|
void SetRadius( int aRadius );
|
|
|
|
|
|
|
|
void Move( const VECTOR2I& delta );
|
|
|
|
|
|
|
|
static HOLE* MakeCircularHole( const VECTOR2I& pos, int radius );
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
SHAPE* m_holeShape;
|
|
|
|
ITEM* m_parentPadVia;
|
|
|
|
};
|
|
|
|
|
|
|
|
}; // namespace PNS
|
|
|
|
|
|
|
|
#endif
|