KiCad PCB EDA Suite
ARRAY_CIRCULAR_OPTIONS Struct Reference

#include <array_options.h>

Inheritance diagram for ARRAY_CIRCULAR_OPTIONS:
ARRAY_OPTIONS

Public Types

enum  ARRAY_TYPE_T { ARRAY_GRID, ARRAY_CIRCULAR }
 

Public Member Functions

 ARRAY_CIRCULAR_OPTIONS ()
 
TRANSFORM GetTransform (int aN, const VECTOR2I &aPos) const override
 Get the transform of the n-th point in the array. More...
 
int GetArraySize () const override
 The number of points in this array. More...
 
wxString GetItemNumber (int n) const override
 Get the position number (name) for the n'th array point. More...
 
bool ShouldNumberItems () const
 
void SetShouldNumber (bool aShouldNumber)
 
bool GetNumberingStartIsSpecified () const
 
void SetNumberingStartIsSpecified (bool aIsSpecified)
 

Public Attributes

long m_nPts
 number of point in the array More...
 
double m_angle
 angle between points, or 0 for each point separated by this value (decideg) More...
 
VECTOR2I m_centre
 
bool m_rotateItems
 
ARRAY_AXIS m_axis
 

Protected Attributes

ARRAY_TYPE_T m_type
 
bool m_shouldNumber
 True if this array numbers the new items. More...
 
bool m_numberingStartIsSpecified
 True if this array's number starts from the preset point False if the array numbering starts from some externally provided point. More...
 

Detailed Description

Definition at line 155 of file array_options.h.

Member Enumeration Documentation

◆ ARRAY_TYPE_T

Enumerator
ARRAY_GRID 

A grid (x*y) array.

ARRAY_CIRCULAR 

A circular array.

Definition at line 39 of file array_options.h.

40  {
41  ARRAY_GRID,
43  };
A grid (x*y) array.
Definition: array_options.h:41

Constructor & Destructor Documentation

◆ ARRAY_CIRCULAR_OPTIONS()

ARRAY_CIRCULAR_OPTIONS::ARRAY_CIRCULAR_OPTIONS ( )
inline

Definition at line 157 of file array_options.h.

159  m_nPts( 0 ),
160  m_angle( 0.0f ),
161  m_rotateItems( false )
162  {
163  }
ARRAY_OPTIONS(ARRAY_TYPE_T aType)
Definition: array_options.h:45
long m_nPts
number of point in the array
double m_angle
angle between points, or 0 for each point separated by this value (decideg)

Member Function Documentation

◆ GetArraySize()

int ARRAY_CIRCULAR_OPTIONS::GetArraySize ( ) const
overridevirtual

The number of points in this array.

Implements ARRAY_OPTIONS.

Definition at line 102 of file array_options.cpp.

103 {
104  return m_nPts;
105 }
long m_nPts
number of point in the array

References m_nPts.

◆ GetItemNumber()

wxString ARRAY_CIRCULAR_OPTIONS::GetItemNumber ( int  n) const
overridevirtual

Get the position number (name) for the n'th array point.

Parameters
narray point index, from 0 to GetArraySize() - 1
Returns
the point's name

Implements ARRAY_OPTIONS.

Definition at line 130 of file array_options.cpp.

131 {
132  return m_axis.GetItemNumber( aN );
133 }
wxString GetItemNumber(int n) const
Get the position number (name) for the n'th axis point.
Definition: array_axis.cpp:133

References ARRAY_AXIS::GetItemNumber(), and m_axis.

◆ GetNumberingStartIsSpecified()

bool ARRAY_OPTIONS::GetNumberingStartIsSpecified ( ) const
inlineinherited
Returns
is the numbering is enabled and should start at a point specified in these options or is it implicit according to the calling code?

Definition at line 100 of file array_options.h.

101  {
103  }
bool m_numberingStartIsSpecified
True if this array's number starts from the preset point False if the array numbering starts from som...
bool m_shouldNumber
True if this array numbers the new items.

References ARRAY_OPTIONS::m_numberingStartIsSpecified, and ARRAY_OPTIONS::m_shouldNumber.

Referenced by ARRAY_PAD_NAME_PROVIDER::ARRAY_PAD_NAME_PROVIDER().

◆ GetTransform()

ARRAY_OPTIONS::TRANSFORM ARRAY_CIRCULAR_OPTIONS::GetTransform ( int  aN,
const VECTOR2I aPos 
) const
overridevirtual

Get the transform of the n-th point in the array.

Parameters
aNthe index of the array point (0 is the original point)
aPosthe existing item position
Returns
a transform (an offset and a rotation)

Implements ARRAY_OPTIONS.

Definition at line 108 of file array_options.cpp.

109 {
110  double angle;
111 
112  if( m_angle == 0 )
113  // angle is zero, divide evenly into m_nPts
114  angle = 10 * 360.0 * n / double( m_nPts );
115  else
116  // n'th step
117  angle = m_angle * n;
118 
119  VECTOR2I new_pos = aPos;
120  RotatePoint( new_pos, m_centre, angle );
121 
122  // take off the rotation (but not the translation) if needed
123  if( !m_rotateItems )
124  angle = 0;
125 
126  return { new_pos - aPos, angle / 10.0 };
127 }
VECTOR2 defines a general 2D-vector/point.
Definition: vector2d.h:61
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
long m_nPts
number of point in the array
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
double m_angle
angle between points, or 0 for each point separated by this value (decideg)

References PNS::angle(), m_angle, m_centre, m_nPts, m_rotateItems, and RotatePoint().

◆ SetNumberingStartIsSpecified()

void ARRAY_OPTIONS::SetNumberingStartIsSpecified ( bool  aIsSpecified)
inlineinherited

Definition at line 105 of file array_options.h.

106  {
107  m_numberingStartIsSpecified = aIsSpecified;
108  }
bool m_numberingStartIsSpecified
True if this array's number starts from the preset point False if the array numbering starts from som...

References ARRAY_OPTIONS::m_numberingStartIsSpecified.

◆ SetShouldNumber()

void ARRAY_OPTIONS::SetShouldNumber ( bool  aShouldNumber)
inlineinherited

Definition at line 90 of file array_options.h.

91  {
92  m_shouldNumber = aShouldNumber;
93  }
bool m_shouldNumber
True if this array numbers the new items.

References ARRAY_OPTIONS::m_shouldNumber.

◆ ShouldNumberItems()

bool ARRAY_OPTIONS::ShouldNumberItems ( ) const
inlineinherited
Returns
are the items in this array numbered, or are all the items numbered the same?

Definition at line 85 of file array_options.h.

86  {
87  return m_shouldNumber;
88  }
bool m_shouldNumber
True if this array numbers the new items.

References ARRAY_OPTIONS::m_shouldNumber.

Member Data Documentation

◆ m_angle

double ARRAY_CIRCULAR_OPTIONS::m_angle

angle between points, or 0 for each point separated by this value (decideg)

Definition at line 168 of file array_options.h.

Referenced by BOOST_AUTO_TEST_CASE(), and GetTransform().

◆ m_axis

ARRAY_AXIS ARRAY_CIRCULAR_OPTIONS::m_axis

Definition at line 171 of file array_options.h.

Referenced by GetItemNumber().

◆ m_centre

VECTOR2I ARRAY_CIRCULAR_OPTIONS::m_centre

Definition at line 169 of file array_options.h.

Referenced by BOOST_AUTO_TEST_CASE(), and GetTransform().

◆ m_nPts

long ARRAY_CIRCULAR_OPTIONS::m_nPts

number of point in the array

Definition at line 166 of file array_options.h.

Referenced by BOOST_AUTO_TEST_CASE(), GetArraySize(), and GetTransform().

◆ m_numberingStartIsSpecified

bool ARRAY_OPTIONS::m_numberingStartIsSpecified
protectedinherited

True if this array's number starts from the preset point False if the array numbering starts from some externally provided point.

Definition at line 119 of file array_options.h.

Referenced by ARRAY_OPTIONS::GetNumberingStartIsSpecified(), and ARRAY_OPTIONS::SetNumberingStartIsSpecified().

◆ m_rotateItems

bool ARRAY_CIRCULAR_OPTIONS::m_rotateItems

Definition at line 170 of file array_options.h.

Referenced by BOOST_AUTO_TEST_CASE(), and GetTransform().

◆ m_shouldNumber

bool ARRAY_OPTIONS::m_shouldNumber
protectedinherited

True if this array numbers the new items.

Definition at line 115 of file array_options.h.

Referenced by ARRAY_OPTIONS::GetNumberingStartIsSpecified(), ARRAY_OPTIONS::SetShouldNumber(), and ARRAY_OPTIONS::ShouldNumberItems().

◆ m_type

ARRAY_TYPE_T ARRAY_OPTIONS::m_type
protectedinherited

Definition at line 112 of file array_options.h.


The documentation for this struct was generated from the following files: