KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcb_drill_chart.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 The 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, see <https://www.gnu.org/licenses/>.
18 */
19
20#ifndef PCB_DRILL_CHART_H
21#define PCB_DRILL_CHART_H
22
23#include <map>
24#include <optional>
25#include <vector>
26
30#include <drill/drill_span.h>
32#include <pcb_generated_table.h>
33
34
39{
40 std::vector<std::optional<int>> m_RowShapes;
42};
43
44
52{
53 explicit DRILL_PROFILE_PENDING( BOARD& aBoard );
54
55 void Commit( BOARD& aBoard ) override;
56
58};
59
60
68{
69public:
70 PCB_DRILL_CHART( BOARD_ITEM* aParent );
71
72 PCB_DRILL_CHART( const PCB_DRILL_CHART& aOther );
73
74 ~PCB_DRILL_CHART() override = default;
75
77
78 static inline bool ClassOf( const EDA_ITEM* aItem )
79 {
80 return aItem && PCB_DRILL_CHART_T == aItem->Type();
81 }
82
83 wxString GetClass() const override { return wxT( "PCB_DRILL_CHART" ); }
84
85 EDA_ITEM* Clone() const override { return new PCB_DRILL_CHART( *this ); }
86
87 const GENERATED_TABLE_SCHEMA& Schema() const override { return DrillChartSchema(); }
88
90 const DRILL_CHART_FILTER& Filter() const { return m_filter; }
91
92 bool GetShowTotals() const { return m_showTotals; }
93 void SetShowTotals( bool aShow ) { m_showTotals = aShow; }
94
99 uint64_t GetBuiltGeneration() const { return m_builtGeneration; }
100
104 void ApplyTemplate( const DRILL_CHART_TEMPLATE& aTemplate );
105
109 bool IsStale( const BOARD& aBoard ) const override;
110
118 const std::map<int, int>& RowShapes() const { return m_rowShapes; }
119 std::map<int, int>& RowShapes() { return m_rowShapes; }
120
124 bool IsDataRow( int aRow ) const override;
125
129 int GetSymbolColumn() const { return m_symbolColumn; }
130 void SetSymbolColumn( int aCol ) { m_symbolColumn = aCol; }
131
132 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
133
134 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
135
136 double Similarity( const BOARD_ITEM& aOther ) const override;
137
138 bool operator==( const BOARD_ITEM& aOther ) const override;
139
140 void Serialize( google::protobuf::Any& aContainer ) const override;
141 bool Deserialize( const google::protobuf::Any& aContainer ) override;
142
143protected:
144 std::unique_ptr<GENERATED_TABLE_CONTENT> generate( const BOARD& aBoard,
145 GENERATED_TABLE_REFRESH* aRefresh ) const override;
146
147 void onRebuilt( const BOARD& aBoard, const GENERATED_TABLE_CONTENT& aContent ) override;
148
149 void swapData( BOARD_ITEM* aImage ) override;
150
151private:
155 std::vector<DRILL_CHART_GROUP> buildGroups( const BOARD& aBoard, const DRILL_SYMBOL_PROFILE& aProfile ) const;
156
161 DRILL_CHART_COLUMN_ID columnId( int aCol ) const;
162
164
166
167 std::map<int, int> m_rowShapes;
169
171};
172
173#endif // PCB_DRILL_CHART_H
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition board_item.h:84
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:410
The column set and formatting a new chart starts from.
Grouping rules and symbol assignments, shared by reference so a chart and its map can never disagree ...
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition eda_item.h:98
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:110
Board state a table rebuild wants to change, held back until the whole refresh has succeeded.
One pass of rebuilding tables.
The columns one generator (the drill chart, a stackup table, ...) can produce, and the units and prec...
double Similarity(const BOARD_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
~PCB_DRILL_CHART() override=default
PCB_DRILL_CHART(BOARD_ITEM *aParent)
void SetSymbolColumn(int aCol)
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
static bool ClassOf(const EDA_ITEM *aItem)
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
const GENERATED_TABLE_SCHEMA & Schema() const override
void ApplyTemplate(const DRILL_CHART_TEMPLATE &aTemplate)
Copy a template's formatting.
const std::map< int, int > & RowShapes() const
Curated shape index for each generated row, by table row.
std::map< int, int > & RowShapes()
void swapData(BOARD_ITEM *aImage) override
uint64_t GetBuiltGeneration() const
Board drill generation the cells were built at.
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
void onRebuilt(const BOARD &aBoard, const GENERATED_TABLE_CONTENT &aContent) override
Called once the cells are laid out, with the content they were built from.
std::map< int, int > m_rowShapes
wxString GetClass() const override
Return the class name.
PCB_DRILL_CHART & operator=(const PCB_DRILL_CHART &)=delete
uint64_t m_builtGeneration
void SetShowTotals(bool aShow)
bool operator==(const BOARD_ITEM &aOther) const override
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
std::unique_ptr< GENERATED_TABLE_CONTENT > generate(const BOARD &aBoard, GENERATED_TABLE_REFRESH *aRefresh) const override
The rows this table reports.
std::vector< DRILL_CHART_GROUP > buildGroups(const BOARD &aBoard, const DRILL_SYMBOL_PROFILE &aProfile) const
The board data this chart reports on, as chart rows grouped the way aProfile says.
bool IsDataRow(int aRow) const override
True for a row that reports a drill group, false for the title, heading and totals.
bool GetShowTotals() const
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
DRILL_CHART_FILTER & Filter()
const DRILL_CHART_FILTER & Filter() const
int GetSymbolColumn() const
Table column the symbol is drawn in, or -1 when the chart has no symbol column.
bool IsStale(const BOARD &aBoard) const override
One integer comparison, so a board with nothing drill related changed pays nothing.
DRILL_CHART_COLUMN_ID columnId(int aCol) const
The typed id a column at this index holds, so generate's switch stays exhaustive even though a stored...
DRILL_CHART_FILTER m_filter
PCB_GENERATED_TABLE(BOARD_ITEM *aParent, KICAD_T aType, int aLineWidth)
const GENERATED_TABLE_SCHEMA & DrillChartSchema()
Every column the drill chart schema knows how to build, in the order the schema lists them.
DRILL_CHART_COLUMN_ID
Hole classification and drill span, shared by the drill model and the drill writers.
A drill chart's rows, with the symbol each one is drawn with.
std::vector< std::optional< int > > m_RowShapes
Per m_Rows entry, empty when the mark is not a shape.
Which holes a chart reports on.
DRILL_SYMBOL_PROFILE m_Profile
void Commit(BOARD &aBoard) override
DRILL_PROFILE_PENDING(BOARD &aBoard)
What a generated table reports, one entry per cell below the heading row.
@ PCB_DRILL_CHART_T
class PCB_DRILL_CHART, a live drill chart derived from PCB_TABLE
Definition typeinfo.h:239