KiCad PCB EDA Suite
Loading...
Searching...
No Matches
array_axis.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 (C) 2019 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 ARRAY_AXIS__H
25#define ARRAY_AXIS__H
26
27#include <optional>
28
29#include <wx/string.h>
30
39{
40public:
42 {
52 };
53
54 ARRAY_AXIS();
55
61 const wxString& GetAlphabet() const;
62
66 void SetAxisType( NUMBERING_TYPE aType );
67
72 bool SetOffset( const wxString& aOffsetName );
73
80 void SetOffset( int aOffset );
81
87 int GetOffset() const;
88
93 void SetStep( int aStep );
94
101 wxString GetItemNumber( int n ) const;
102
103private:
110 std::optional<int> getNumberingOffset( const wxString& str ) const;
111
114
117};
118
119#endif // ARRAY_AXIS__H
Class that contains information about a single array axis and the numbering of items along that axis.
Definition: array_axis.h:39
bool SetOffset(const wxString &aOffsetName)
Set the axis start (as a string, which should decode to a valid index in the alphabet)
Definition: array_axis.cpp:102
int m_offset
Skip every 'n' numbers.
Definition: array_axis.h:113
NUMBERING_TYPE m_type
Definition: array_axis.h:112
wxString GetItemNumber(int n) const
Get the position number (name) for the n'th axis point.
Definition: array_axis.cpp:133
const wxString & GetAlphabet() const
Get the alphabet for the current numbering scheme.
Definition: array_axis.cpp:43
void SetAxisType(NUMBERING_TYPE aType)
Set the axis numbering type.
Definition: array_axis.cpp:96
@ NUMBERING_NUMERIC
Arabic numerals: 0,1,2,3,4,5,6,7,8,9,10,11...
Definition: array_axis.h:43
@ NUMBERING_HEX
Definition: array_axis.h:44
@ NUMBERING_ALPHA_NO_IOSQXZ
Definition: array_axis.h:45
@ NUMBERING_ALPHA_FULL
Full 26-character alphabet.
Definition: array_axis.h:51
std::optional< int > getNumberingOffset(const wxString &str) const
Get the numbering offset for a given numbering string.
Definition: array_axis.cpp:65
void SetStep(int aStep)
Set the skip between consecutive numbers (useful when doing a partial array, e.g.
Definition: array_axis.cpp:127
int GetOffset() const
Get the numbering offset for the axis.
Definition: array_axis.cpp:121