KiCad PCB EDA Suite
Loading...
Searching...
No Matches
array_options.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24#ifndef PCBNEW_ARRAY_OPTIONS__H
25#define PCBNEW_ARRAY_OPTIONS__H
26
27#include <kicommon.h>
28#include <math/vector2d.h>
29#include <array_axis.h>
30#include <geometry/eda_angle.h>
31
39{
40public:
46
48 m_type( aType ),
49 m_shouldNumber( false ),
50 m_arrangeSelection( false ),
53 {
54 }
55
56 virtual ~ARRAY_OPTIONS(){};
57
66
74 virtual TRANSFORM GetTransform( int aN, const VECTOR2I& aPos ) const = 0;
75
79 virtual int GetArraySize() const = 0;
80
87 virtual wxString GetItemNumber( int n ) const = 0;
88
92 bool ShouldNumberItems() const
93 {
94 return m_shouldNumber;
95 }
96
97 void SetShouldNumber( bool aShouldNumber )
98 {
99 m_shouldNumber = aShouldNumber;
100 }
101
106 {
107 return m_arrangeSelection;
108 }
109
110 void SetShouldArrangeSelection( bool aShouldArrange )
111 {
112 m_arrangeSelection = aShouldArrange;
113 }
114
120 {
122 }
123
124 void SetSShouldReannotateFootprints( bool aShouldReannotate )
125 {
126 m_reannotateFootprints = aShouldReannotate;
127 }
128
138
139 void SetNumberingStartIsSpecified( bool aIsSpecified )
140 {
141 m_numberingStartIsSpecified = aIsSpecified;
142 }
143
144protected:
145
147
150
154
157
161};
162
163
165{
168 m_centred( false ),
169 m_nx( 0 ),
170 m_ny( 0 ),
173 m_stagger( 0 ),
174 m_stagger_rows( true ),
175 m_2dArrayNumbering( false )
176 {
177 }
178
179 // Are the grid positions relative to item (0, 0), or the grid center?
181 long m_nx, m_ny;
189
190 TRANSFORM GetTransform( int aN, const VECTOR2I& aPos ) const override;
191 int GetArraySize() const override;
192 wxString GetItemNumber( int n ) const override;
193
194private:
195 VECTOR2I gtItemPosRelativeToItem0( int n ) const;
196 VECTOR2I getGridCoords( int n ) const;
197};
198
199
201{
204 m_nPts( 0 ),
205 m_angle( ANGLE_0 ),
207 m_clockwise( false ),
208 m_rotateItems( false )
209 {
210 }
211
213 long m_nPts;
214
222
223 TRANSFORM GetTransform( int aN, const VECTOR2I& aPos ) const override;
224 int GetArraySize() const override;
225 wxString GetItemNumber( int n ) const override;
226};
227
228
229#endif // PCBNEW_ARRAY_OPTIONS__H
Class that contains information about a single array axis and the numbering of items along that axis.
Definition array_axis.h:40
virtual int GetArraySize() const =0
The number of points in this array.
void SetSShouldReannotateFootprints(bool aShouldReannotate)
bool m_shouldNumber
True if this array numbers the new items.
bool ShouldNumberItems() const
virtual wxString GetItemNumber(int n) const =0
Get the position number (name) for the n'th array point.
virtual TRANSFORM GetTransform(int aN, const VECTOR2I &aPos) const =0
Get the transform of the n-th point in the array.
void SetShouldNumber(bool aShouldNumber)
bool ShouldReannotateFootprints() const
bool ShouldArrangeSelection() const
void SetNumberingStartIsSpecified(bool aIsSpecified)
bool m_arrangeSelection
True if this array should arrange the selected items instead of creating an array of copies of the se...
bool GetNumberingStartIsSpecified() const
virtual ~ARRAY_OPTIONS()
@ ARRAY_CIRCULAR
A circular array.
@ ARRAY_GRID
A grid (x*y) array.
void SetShouldArrangeSelection(bool aShouldArrange)
ARRAY_OPTIONS(ARRAY_TYPE_T aType)
bool m_numberingStartIsSpecified
True if this array's number starts from the preset point False if the array numbering starts from som...
ARRAY_TYPE_T m_type
bool m_reannotateFootprints
True if this array will rename any footprints to be unique.
static constexpr EDA_ANGLE ANGLE_0
Definition eda_angle.h:411
#define KICOMMON_API
Definition kicommon.h:28
long m_nPts
number of point in the array
EDA_ANGLE m_angle
angle between points, or 0 for each point separated by this value (decideg)
wxString GetItemNumber(int n) const override
Get the position number (name) for the n'th array point.
int GetArraySize() const override
The number of points in this array.
TRANSFORM GetTransform(int aN, const VECTOR2I &aPos) const override
Get the transform of the n-th point in the array.
VECTOR2I getGridCoords(int n) const
wxString GetItemNumber(int n) const override
Get the position number (name) for the n'th array point.
VECTOR2I gtItemPosRelativeToItem0(int n) const
int GetArraySize() const override
The number of points in this array.
TRANSFORM GetTransform(int aN, const VECTOR2I &aPos) const override
Get the transform of the n-th point in the array.
Transform applied to an object by this array.
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:695