KiCad PCB EDA Suite
DIALOG_CREATE_ARRAY::ARRAY_CIRCULAR_OPTIONS Struct Reference

#include <dialog_create_array.h>

Inheritance diagram for DIALOG_CREATE_ARRAY::ARRAY_CIRCULAR_OPTIONS:
DIALOG_CREATE_ARRAY::ARRAY_OPTIONS

Public Member Functions

 ARRAY_CIRCULAR_OPTIONS ()
 
void TransformItem (int n, BOARD_ITEM *item, const wxPoint &rotPoint) const override
 
int GetArraySize () const override
 
wxString GetItemNumber (int n) const override
 
virtual wxString InterpolateNumberIntoString (int n, const wxString &pattern) const
 
bool ShouldNumberItems () const
 
bool NumberingStartIsSpecified () const
 

Public Attributes

long m_nPts
 
double m_angle
 
wxPoint m_centre
 
bool m_rotateItems
 
ARRAY_NUMBERING_TYPE_T m_numberingType
 
long m_numberingOffset
 
ARRAY_TYPE_T m_type
 

Static Protected Member Functions

static wxString getCoordinateNumber (int n, ARRAY_NUMBERING_TYPE_T type)
 

Protected Attributes

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 295 of file dialog_create_array.h.

Constructor & Destructor Documentation

DIALOG_CREATE_ARRAY::ARRAY_CIRCULAR_OPTIONS::ARRAY_CIRCULAR_OPTIONS ( )
inline

Member Function Documentation

int DIALOG_CREATE_ARRAY::ARRAY_CIRCULAR_OPTIONS::GetArraySize ( ) const
overridevirtual

Implements DIALOG_CREATE_ARRAY::ARRAY_OPTIONS.

Definition at line 581 of file dialog_create_array.cpp.

wxString DIALOG_CREATE_ARRAY::ARRAY_OPTIONS::getCoordinateNumber ( int  n,
ARRAY_NUMBERING_TYPE_T  type 
)
staticprotectedinherited

Definition at line 469 of file dialog_create_array.cpp.

References alphabetFromNumberingScheme(), and schemeNonUnitColsStartAt0().

471 {
472  wxString itemNum;
473  const wxString& alphabet = alphabetFromNumberingScheme( type );
474 
475  const bool nonUnitColsStartAt0 = schemeNonUnitColsStartAt0( type );
476 
477  bool firstRound = true;
478  int radix = alphabet.Length();
479 
480  do {
481  int modN = n % radix;
482 
483  if( nonUnitColsStartAt0 && !firstRound )
484  modN--; // Start the "tens/hundreds/etc column" at "Ax", not "Bx"
485 
486  itemNum.insert( 0, 1, alphabet[modN] );
487 
488  n /= radix;
489  firstRound = false;
490  } while( n );
491 
492  return itemNum;
493 }
static bool schemeNonUnitColsStartAt0(DIALOG_CREATE_ARRAY::ARRAY_NUMBERING_TYPE_T type)
static const wxString & alphabetFromNumberingScheme(DIALOG_CREATE_ARRAY::ARRAY_NUMBERING_TYPE_T type)
wxString DIALOG_CREATE_ARRAY::ARRAY_CIRCULAR_OPTIONS::GetItemNumber ( int  n) const
overridevirtual

Implements DIALOG_CREATE_ARRAY::ARRAY_OPTIONS.

Definition at line 607 of file dialog_create_array.cpp.

608 {
610 }
static wxString getCoordinateNumber(int n, ARRAY_NUMBERING_TYPE_T type)
wxString DIALOG_CREATE_ARRAY::ARRAY_OPTIONS::InterpolateNumberIntoString ( int  n,
const wxString &  pattern 
) const
virtualinherited

Definition at line 496 of file dialog_create_array.cpp.

498 {
499  wxString newStr( aPattern );
500  newStr.Replace( "%s", GetItemNumber( aN ), false );
501 
502  return newStr;
503 }
virtual wxString GetItemNumber(int n) const =0
bool DIALOG_CREATE_ARRAY::ARRAY_OPTIONS::NumberingStartIsSpecified ( ) 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 242 of file dialog_create_array.h.

Referenced by ARRAY_CREATOR::Invoke().

243  {
245  }
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.
bool DIALOG_CREATE_ARRAY::ARRAY_OPTIONS::ShouldNumberItems ( ) const
inlineinherited
Returns
are the items in this array numberred, or are all the items numbered the same

Definition at line 232 of file dialog_create_array.h.

Referenced by ARRAY_CREATOR::Invoke().

233  {
234  return m_shouldNumber;
235  }
bool m_shouldNumber
True if this array numbers the new items.
void DIALOG_CREATE_ARRAY::ARRAY_CIRCULAR_OPTIONS::TransformItem ( int  n,
BOARD_ITEM item,
const wxPoint rotPoint 
) const
overridevirtual

Function GetArrayPositions Returns the set of points that represent the array in order, if that is important

TODO: Can/should this be done with some sort of iterator?

Implements DIALOG_CREATE_ARRAY::ARRAY_OPTIONS.

Definition at line 587 of file dialog_create_array.cpp.

References PNS::angle(), BOARD_ITEM::GetCenter(), and BOARD_ITEM::Rotate().

589 {
590  double angle;
591 
592  if( m_angle == 0 )
593  // angle is zero, divide evenly into m_nPts
594  angle = 3600.0 * n / double( m_nPts );
595  else
596  // n'th step
597  angle = m_angle * n;
598 
599  item->Rotate( m_centre, angle );
600 
601  // take off the rotation (but not the translation) if needed
602  if( !m_rotateItems )
603  item->Rotate( item->GetCenter(), -angle );
604 }
virtual const wxPoint GetCenter() const
Function GetCenter()
virtual void Rotate(const wxPoint &aRotCentre, double aAngle)
Function Rotate Rotate this object.
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)

Member Data Documentation

double DIALOG_CREATE_ARRAY::ARRAY_CIRCULAR_OPTIONS::m_angle

Definition at line 307 of file dialog_create_array.h.

Referenced by DIALOG_CREATE_ARRAY::OnOkClick().

wxPoint DIALOG_CREATE_ARRAY::ARRAY_CIRCULAR_OPTIONS::m_centre

Definition at line 308 of file dialog_create_array.h.

Referenced by DIALOG_CREATE_ARRAY::OnOkClick().

long DIALOG_CREATE_ARRAY::ARRAY_CIRCULAR_OPTIONS::m_nPts

Definition at line 306 of file dialog_create_array.h.

Referenced by DIALOG_CREATE_ARRAY::OnOkClick().

long DIALOG_CREATE_ARRAY::ARRAY_CIRCULAR_OPTIONS::m_numberingOffset

Definition at line 311 of file dialog_create_array.h.

Referenced by DIALOG_CREATE_ARRAY::OnOkClick().

bool DIALOG_CREATE_ARRAY::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 258 of file dialog_create_array.h.

Referenced by DIALOG_CREATE_ARRAY::OnOkClick().

ARRAY_NUMBERING_TYPE_T DIALOG_CREATE_ARRAY::ARRAY_CIRCULAR_OPTIONS::m_numberingType

Definition at line 310 of file dialog_create_array.h.

Referenced by DIALOG_CREATE_ARRAY::OnOkClick().

bool DIALOG_CREATE_ARRAY::ARRAY_CIRCULAR_OPTIONS::m_rotateItems

Definition at line 309 of file dialog_create_array.h.

Referenced by DIALOG_CREATE_ARRAY::OnOkClick().

bool DIALOG_CREATE_ARRAY::ARRAY_OPTIONS::m_shouldNumber
protectedinherited

True if this array numbers the new items.

Definition at line 254 of file dialog_create_array.h.

Referenced by DIALOG_CREATE_ARRAY::OnOkClick().

ARRAY_TYPE_T DIALOG_CREATE_ARRAY::ARRAY_OPTIONS::m_type
inherited

Definition at line 211 of file dialog_create_array.h.


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