KiCad PCB EDA Suite
pns_solid.h
Go to the documentation of this file.
1 /*
2  * KiRouter - a push-and-(sometimes-)shove PCB router
3  *
4  * Copyright (C) 2013 CERN
5  * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
6  * Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
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_SOLID_H
23 #define __PNS_SOLID_H
24 
25 #include <math/vector2d.h>
26 
27 #include <geometry/seg.h>
28 #include <geometry/shape.h>
30 
31 #include "pns_item.h"
32 
33 namespace PNS {
34 
35 class SOLID : public ITEM
36 {
37 public:
39  {
40  m_movable = false;
41  m_padToDie = 0;
42  }
43 
45  {
46  delete m_shape;
47  }
48 
49  SOLID( const SOLID& aSolid ) :
50  ITEM( aSolid )
51  {
52  m_shape = aSolid.m_shape->Clone();
53  m_pos = aSolid.m_pos;
54  m_padToDie = aSolid.m_padToDie;
55  }
56 
57  static inline bool ClassOf( const ITEM* aItem )
58  {
59  return aItem && SOLID_T == aItem->Kind();
60  }
61 
62  ITEM* Clone() const override;
63 
64  const SHAPE* Shape() const override { return m_shape; }
65 
66  const SHAPE_LINE_CHAIN Hull( int aClearance = 0, int aWalkaroundThickness = 0 ) const override;
67 
68  void SetShape( SHAPE* shape )
69  {
70  if( m_shape )
71  delete m_shape;
72 
73  m_shape = shape;
74  }
75 
76  const VECTOR2I& Pos() const
77  {
78  return m_pos;
79  }
80 
81  void SetPos( const VECTOR2I& aCenter );
82 
83  int GetPadToDie() const
84  {
85  return m_padToDie;
86  }
87 
88  void SetPadToDie( int aLen )
89  {
90  m_padToDie = aLen;
91  }
92 
93  virtual VECTOR2I Anchor( int aN ) const override
94  {
95  return m_pos;
96  }
97 
98  virtual int AnchorCount() const override
99  {
100  return 1;
101  }
102 
103  VECTOR2I Offset() const
104  {
105  return m_offset;
106  }
107 
108  void SetOffset( const VECTOR2I& aOffset )
109  {
110  m_offset = aOffset;
111  }
112 
113 private:
118 };
119 
120 }
121 
122 #endif
ITEM.
Definition: pns_item.h:53
const SHAPE * Shape() const override
Function Shape()
Definition: pns_solid.h:64
VECTOR2I Offset() const
Definition: pns_solid.h:103
void SetPos(const VECTOR2I &aCenter)
Definition: pns_solid.cpp:82
const SHAPE_LINE_CHAIN Hull(int aClearance=0, int aWalkaroundThickness=0) const override
Definition: pns_solid.cpp:35
bool m_movable
Definition: pns_item.h:255
void SetOffset(const VECTOR2I &aOffset)
Definition: pns_solid.h:108
SHAPE * m_shape
Definition: pns_solid.h:115
int m_padToDie
Definition: pns_solid.h:117
SOLID(const SOLID &aSolid)
Definition: pns_solid.h:49
#define NULL
ITEM * Clone() const override
Function Clone()
Definition: pns_solid.cpp:76
int GetPadToDie() const
Definition: pns_solid.h:83
void SetPadToDie(int aLen)
Definition: pns_solid.h:88
void SetShape(SHAPE *shape)
Definition: pns_solid.h:68
virtual SHAPE * Clone() const
Function Clone()
Definition: shape.h:110
SHAPE.
Definition: shape.h:74
virtual int AnchorCount() const override
Definition: pns_solid.h:98
static bool ClassOf(const ITEM *aItem)
Definition: pns_solid.h:57
const VECTOR2I & Pos() const
Definition: pns_solid.h:76
VECTOR2I m_offset
Definition: pns_solid.h:116
SHAPE_LINE_CHAIN.
virtual VECTOR2I Anchor(int aN) const override
Definition: pns_solid.h:93
PnsKind Kind() const
Function Kind()
Definition: pns_item.h:123
Push and Shove diff pair dimensions (gap) settings dialog.
VECTOR2I m_pos
Definition: pns_solid.h:114