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  m_pos = aCenter;
84  }
85 
86  int GetPadToDie() const
87  {
88  return m_padToDie;
89  }
90 
91  void SetPadToDie( int aLen )
92  {
93  m_padToDie = aLen;
94  }
95 
96  virtual VECTOR2I Anchor( int aN ) const override
97  {
98  return m_pos;
99  }
100 
101  virtual int AnchorCount() const override
102  {
103  return 1;
104  }
105 
106  VECTOR2I Offset() const
107  {
108  return m_offset;
109  }
110 
111  void SetOffset( const VECTOR2I& aOffset )
112  {
113  m_offset = aOffset;
114  }
115 
116 private:
121 };
122 
123 }
124 
125 #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:106
void SetPos(const VECTOR2I &aCenter)
Definition: pns_solid.h:81
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:254
void SetOffset(const VECTOR2I &aOffset)
Definition: pns_solid.h:111
SHAPE * m_shape
Definition: pns_solid.h:118
int m_padToDie
Definition: pns_solid.h:120
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:86
void SetPadToDie(int aLen)
Definition: pns_solid.h:91
void SetShape(SHAPE *shape)
Definition: pns_solid.h:68
virtual SHAPE * Clone() const
Function Clone()
Definition: shape.h:96
SHAPE.
Definition: shape.h:60
virtual int AnchorCount() const override
Definition: pns_solid.h:101
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:119
SHAPE_LINE_CHAIN.
virtual VECTOR2I Anchor(int aN) const override
Definition: pns_solid.h:96
PnsKind Kind() const
Function Kind()
Definition: pns_item.h:122
Push and Shove diff pair dimensions (gap) settings dialog.
VECTOR2I m_pos
Definition: pns_solid.h:117