KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pns_hole.h
Go to the documentation of this file.
1/*
2 * KiRouter - a push-and-(sometimes-)shove PCB router
3 *
4 * Copyright (C) 2016-2023 KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * @author Tomasz Wlostowski <[email protected]>
7 *
8 * This program is free software: you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation, either version 3 of the License, or (at your
11 * option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#ifndef __PNS_HOLE_H
23#define __PNS_HOLE_H
24
25#include "pns_item.h"
26
27#include <geometry/shape.h>
29
30namespace PNS
31{
32
33class HOLE : public ITEM
34{
35public:
36 HOLE( SHAPE* aShape ) :
37 ITEM( ITEM::HOLE_T ),
38 m_holeShape( aShape ),
39 m_parentPadVia( nullptr )
40 {
41 }
42
43 HOLE( const ITEM& aOther ) :
44 ITEM( aOther ),
45 m_parentPadVia( nullptr )
46 {
47 }
48
49 virtual ~HOLE();
50
54 virtual HOLE* Clone() const override;
55
56 virtual NET_HANDLE Net() const override
57 {
58 if( m_parentPadVia )
59 return m_parentPadVia->Net();
60
61 return m_net;
62 }
63
64 virtual const SHAPE_LINE_CHAIN Hull( int aClearance = 0, int aWalkaroundThickness = 0,
65 int aLayer = -1 ) const override;
66
67 int Radius() const;
68
69 const SHAPE* Shape() const override { return m_holeShape; }
70
71 void SetParentPadVia( ITEM* aParent ) { m_parentPadVia = aParent; }
72 ITEM* ParentPadVia() const override { return m_parentPadVia; }
73
74 BOARD_ITEM* BoardItem() const override
75 {
76 if( m_parent )
77 return m_parent;
78
79 if( m_parentPadVia )
80 return m_parentPadVia->Parent();
81
82 return nullptr;
83 }
84
85 void SetCenter( const VECTOR2I& aCenter );
86 void SetRadius( int aRadius );
87
88 void Move( const VECTOR2I& delta );
89
90 static HOLE* MakeCircularHole( const VECTOR2I& pos, int radius );
91
92
93private:
96};
97
98}; // namespace PNS
99
100#endif
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:77
void Move(const VECTOR2I &delta)
Definition: pns_hole.cpp:125
HOLE(SHAPE *aShape)
Definition: pns_hole.h:36
virtual const SHAPE_LINE_CHAIN Hull(int aClearance=0, int aWalkaroundThickness=0, int aLayer=-1) const override
Definition: pns_hole.cpp:57
int Radius() const
Definition: pns_hole.cpp:103
void SetCenter(const VECTOR2I &aCenter)
Definition: pns_hole.cpp:111
const SHAPE * Shape() const override
Return the geometrical shape of the item.
Definition: pns_hole.h:69
void SetRadius(int aRadius)
Definition: pns_hole.cpp:118
virtual NET_HANDLE Net() const override
Definition: pns_hole.h:56
BOARD_ITEM * BoardItem() const override
Definition: pns_hole.h:74
static HOLE * MakeCircularHole(const VECTOR2I &pos, int radius)
Definition: pns_hole.cpp:131
virtual HOLE * Clone() const override
Return a deep copy of the item.
Definition: pns_hole.cpp:41
ITEM * ParentPadVia() const override
Definition: pns_hole.h:72
SHAPE * m_holeShape
Definition: pns_hole.h:94
void SetParentPadVia(ITEM *aParent)
Definition: pns_hole.h:71
virtual ~HOLE()
Definition: pns_hole.cpp:35
HOLE(const ITEM &aOther)
Definition: pns_hole.h:43
ITEM * m_parentPadVia
Definition: pns_hole.h:95
Base class for PNS router board items.
Definition: pns_item.h:97
BOARD_ITEM * Parent() const
Definition: pns_item.h:185
virtual NET_HANDLE Net() const
Definition: pns_item.h:193
NET_HANDLE m_net
Definition: pns_item.h:290
BOARD_ITEM * m_parent
Definition: pns_item.h:286
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
An abstract shape on 2D plane.
Definition: shape.h:126
Push and Shove diff pair dimensions (gap) settings dialog.
void * NET_HANDLE
Definition: pns_item.h:54
constexpr int delta