KiCad PCB EDA Suite
|
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. | |
Static Public Member Functions | |
static bool | TypeIsNumeric (NUMBERING_TYPE type) |
Check if a numbering type is a numeric type. | |
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 |
int | m_step |
Skip every 'n' numbers. | |
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.
Definition at line 42 of file array_axis.h.
ARRAY_AXIS::ARRAY_AXIS | ( | ) |
Definition at line 40 of file array_axis.cpp.
const wxString & ARRAY_AXIS::GetAlphabet | ( | ) | const |
Get the alphabet for the current numbering scheme.
type | the numbering scheme. |
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().
wxString ARRAY_AXIS::GetItemNumber | ( | int | n | ) | const |
Get the position number (name) for the n'th axis point.
n | array point index, from 0. |
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(), ARRAY_CIRCULAR_OPTIONS::GetItemNumber(), and DIALOG_CREATE_ARRAY::OnAxisNumberingChange().
|
private |
Get the numbering offset for a given numbering string.
str | is a numbering string, say "B" or "5". |
Definition at line 67 of file array_axis.cpp.
References GetAlphabet(), m_type, and schemeNonUnitColsStartAt0().
Referenced by SetOffset().
int ARRAY_AXIS::GetOffset | ( | ) | const |
Get the numbering offset for the axis.
Definition at line 123 of file array_axis.cpp.
References m_offset.
Referenced by BOOST_AUTO_TEST_CASE().
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(), DIALOG_CREATE_ARRAY::OnAxisNumberingChange(), and validateAxisOptions().
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(), DIALOG_CREATE_ARRAY::OnAxisNumberingChange(), SetOffset(), and validateAxisOptions().
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).
aOffset | offset of the first item in the. |
Definition at line 117 of file array_axis.cpp.
References m_offset.
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().
|
inlinestatic |
Check if a numbering type is a numeric type.
Definition at line 60 of file array_axis.h.
Referenced by DIALOG_CREATE_ARRAY::OnAxisNumberingChange().
|
private |
Definition at line 124 of file array_axis.h.
Referenced by GetItemNumber(), GetOffset(), and SetOffset().
|
private |
Skip every 'n' numbers.
Definition at line 127 of file array_axis.h.
Referenced by GetItemNumber(), and SetStep().
|
private |
Definition at line 123 of file array_axis.h.
Referenced by GetAlphabet(), GetItemNumber(), getNumberingOffset(), and SetAxisType().