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:
|
2023-04-28 10:03:24 +00:00
|
|
|
HOLE( SHAPE* aShape ) :
|
2022-08-30 12:52:34 +00:00
|
|
|
ITEM( ITEM::HOLE_T ),
|
|
|
|
m_holeShape( aShape ),
|
2023-04-28 10:03:24 +00:00
|
|
|
m_parentPadVia( nullptr )
|
2022-08-30 12:52:34 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2023-04-28 10:03:24 +00:00
|
|
|
HOLE( const ITEM& aOther ) :
|
|
|
|
ITEM( aOther ),
|
|
|
|
m_parentPadVia( nullptr )
|
|
|
|
{
|
|
|
|
}
|
2022-08-30 12:52:34 +00:00
|
|
|
|
|
|
|
virtual ~HOLE();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return a deep copy of the item.
|
|
|
|
*/
|
|
|
|
virtual HOLE* Clone() const override;
|
|
|
|
|
2023-08-22 12:06:33 +00:00
|
|
|
virtual NET_HANDLE Net() const override
|
2023-04-24 17:32:03 +00:00
|
|
|
{
|
|
|
|
if( m_parentPadVia )
|
|
|
|
return m_parentPadVia->Net();
|
|
|
|
|
|
|
|
return m_net;
|
|
|
|
}
|
|
|
|
|
2022-08-30 12:52:34 +00:00
|
|
|
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; }
|
|
|
|
|
2023-04-24 17:32:03 +00:00
|
|
|
void SetParentPadVia( ITEM* aParent ) { m_parentPadVia = aParent; }
|
2023-05-23 13:08:53 +00:00
|
|
|
ITEM* ParentPadVia() const override { return m_parentPadVia; }
|
2022-08-30 12:52:34 +00:00
|
|
|
|
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
|