KiCad PCB EDA Suite
Loading...
Searching...
No Matches
ARRAY_AXIS Class Reference

Class that contains information about a single array axis and the numbering of items along that axis. More...

#include <array_axis.h>

Public Types

enum  NUMBERING_TYPE { NUMBERING_NUMERIC = 0 , NUMBERING_HEX , NUMBERING_ALPHA_NO_IOSQXZ , NUMBERING_ALPHA_FULL }
 

Public Member Functions

 ARRAY_AXIS ()
 
const wxString & GetAlphabet () const
 Get the alphabet for the current numbering scheme.
 
void SetAxisType (NUMBERING_TYPE aType)
 Set the axis numbering type.
 
bool SetOffset (const wxString &aOffsetName)
 Set the axis start (as a string, which should decode to a valid index in the alphabet)
 
void SetOffset (int aOffset)
 Set the start offset for the series (e.g.
 
int GetOffset () const
 Get the numbering offset for the axis.
 
void SetStep (int aStep)
 Set the skip between consecutive numbers (useful when doing a partial array, e.g.
 
wxString GetItemNumber (int n) const
 Get the position number (name) for the n'th axis point.
 

Private Member Functions

std::optional< int > getNumberingOffset (const wxString &str) const
 Get the numbering offset for a given numbering string.
 

Private Attributes

NUMBERING_TYPE m_type
 
int m_offset
 Skip every 'n' numbers.
 
int m_step
 

Detailed Description

Class that contains information about a single array axis and the numbering of items along that axis.

For example, a rectangular grid has two axes, X and Y, but a circular array has only one, that runs around the circle.

Definition at line 39 of file array_axis.h.

Member Enumeration Documentation

◆ NUMBERING_TYPE

Enumerator
NUMBERING_NUMERIC 

Arabic numerals: 0,1,2,3,4,5,6,7,8,9,10,11...

NUMBERING_HEX 
NUMBERING_ALPHA_NO_IOSQXZ 

Alphabet, excluding IOSQXZ

                            Per ASME Y14.35M-1997 sec. 5.2 (previously MIL-STD-100 sec. 406.5)
                            as these can be confused with numerals and are often not used
                            for pin numbering on BGAs, etc
NUMBERING_ALPHA_FULL 

Full 26-character alphabet.

Definition at line 42 of file array_axis.h.

Constructor & Destructor Documentation

◆ ARRAY_AXIS()

ARRAY_AXIS::ARRAY_AXIS ( )

Definition at line 40 of file array_axis.cpp.

Member Function Documentation

◆ GetAlphabet()

const wxString & ARRAY_AXIS::GetAlphabet ( ) const

Get the alphabet for the current numbering scheme.

Parameters
typethe numbering scheme
Returns
the alphabet (as a string)

Definition at line 45 of file array_axis.cpp.

References m_type, NUMBERING_ALPHA_FULL, NUMBERING_ALPHA_NO_IOSQXZ, NUMBERING_HEX, and NUMBERING_NUMERIC.

Referenced by GetItemNumber(), getNumberingOffset(), and validateAxisOptions().

◆ GetItemNumber()

wxString ARRAY_AXIS::GetItemNumber ( int  n) const

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

Parameters
narray point index, from 0
Returns
the point's name

Definition at line 135 of file array_axis.cpp.

References AlphabeticFromIndex(), GetAlphabet(), m_offset, m_step, m_type, and schemeNonUnitColsStartAt0().

Referenced by BOOST_AUTO_TEST_CASE(), ARRAY_GRID_OPTIONS::GetItemNumber(), and ARRAY_CIRCULAR_OPTIONS::GetItemNumber().

◆ getNumberingOffset()

std::optional< int > ARRAY_AXIS::getNumberingOffset ( const wxString &  str) const
private

Get the numbering offset for a given numbering string.

Parameters
stra numbering string, say "B" or "5"
Returns
the offset, if found, else empty

Definition at line 67 of file array_axis.cpp.

References GetAlphabet(), m_type, and schemeNonUnitColsStartAt0().

Referenced by SetOffset().

◆ GetOffset()

int ARRAY_AXIS::GetOffset ( ) const

Get the numbering offset for the axis.

Returns
the current offset

Definition at line 123 of file array_axis.cpp.

References m_offset.

Referenced by BOOST_AUTO_TEST_CASE().

◆ SetAxisType()

void ARRAY_AXIS::SetAxisType ( NUMBERING_TYPE  aType)

Set the axis numbering type.

Definition at line 98 of file array_axis.cpp.

References m_type.

Referenced by BOOST_AUTO_TEST_CASE(), and validateAxisOptions().

◆ SetOffset() [1/2]

bool ARRAY_AXIS::SetOffset ( const wxString &  aOffsetName)

Set the axis start (as a string, which should decode to a valid index in the alphabet)

Definition at line 104 of file array_axis.cpp.

References getNumberingOffset(), and SetOffset().

Referenced by BOOST_AUTO_TEST_CASE(), SetOffset(), and validateAxisOptions().

◆ SetOffset() [2/2]

void ARRAY_AXIS::SetOffset ( int  aOffset)

Set the start offset for the series (e.g.

0 to start at 0/A, 4 to start at 4/E).

Parameters
aOffsetoffset of the first item in the

Definition at line 117 of file array_axis.cpp.

References m_offset.

◆ SetStep()

void ARRAY_AXIS::SetStep ( int  aStep)

Set the skip between consecutive numbers (useful when doing a partial array, e.g.

only one side of a connector)

Definition at line 129 of file array_axis.cpp.

References m_step.

Referenced by BOOST_AUTO_TEST_CASE(), and validateAxisOptions().

Member Data Documentation

◆ m_offset

int ARRAY_AXIS::m_offset
private

Skip every 'n' numbers.

Definition at line 114 of file array_axis.h.

Referenced by GetItemNumber(), GetOffset(), and SetOffset().

◆ m_step

int ARRAY_AXIS::m_step
private

Definition at line 117 of file array_axis.h.

Referenced by GetItemNumber(), and SetStep().

◆ m_type

NUMBERING_TYPE ARRAY_AXIS::m_type
private

Definition at line 113 of file array_axis.h.

Referenced by GetAlphabet(), GetItemNumber(), getNumberingOffset(), and SetAxisType().


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