KiCad PCB EDA Suite
Loading...
Searching...
No Matches
board_statistics_report.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 modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * 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 PCBNEW_BOARD_STATISTICS_REPORT_H
21#define PCBNEW_BOARD_STATISTICS_REPORT_H
22
23#include <board_statistics.h>
24#include <units_provider.h>
25#include <pcb_track_types.h>
26
27#include <string>
28#include <vector>
29
30class BOARD;
31
38
40{
41 BOARD_STATISTICS_FP_ENTRY( int aMask, int aValue, const wxString& aTitle, const std::string& aJsonKey ) :
42 attributeMask( aMask ),
43 attributeValue( aValue ),
44 title( aTitle ),
45 jsonKey( aJsonKey )
46 {
47 }
48
51 wxString title;
52 std::string jsonKey;
53 int frontCount = 0;
54 int backCount = 0;
55};
56
57template <typename T>
59{
60 BOARD_STATISTICS_INFO_ENTRY( T aAttribute, const wxString& aTitle, const std::string& aJsonKey ) :
61 attribute( aAttribute ),
62 title( aTitle ),
63 jsonKey( aJsonKey )
64 {
65 }
66
68 wxString title;
69 std::string jsonKey;
70 int quantity = 0;
71};
72
74{
76
77 void ResetCounts();
78
82 double boardArea;
93
94 std::vector<BOARD_STATISTICS_FP_ENTRY> footprintEntries;
95 std::vector<BOARD_STATISTICS_INFO_ENTRY<PAD_ATTRIB>> padEntries;
96 std::vector<BOARD_STATISTICS_INFO_ENTRY<PAD_PROP>> padPropertyEntries;
97 std::vector<BOARD_STATISTICS_INFO_ENTRY<VIATYPE>> viaEntries;
98 std::vector<DRILL_LINE_ITEM> drillEntries;
99};
100
102
103void ComputeBoardStatistics( BOARD* aBoard, const BOARD_STATISTICS_OPTIONS& aOptions, BOARD_STATISTICS_DATA& aData );
104
106wxString FormatBoardStatisticsMinimum( int aValue, const UNITS_PROVIDER& aUnitsProvider );
107
108wxString FormatBoardStatisticsReport( const BOARD_STATISTICS_DATA& aData, BOARD* aBoard,
109 const UNITS_PROVIDER& aUnitsProvider, const wxString& aProjectName,
110 const wxString& aBoardName );
111
112wxString FormatBoardStatisticsJson( const BOARD_STATISTICS_DATA& aData, BOARD* aBoard,
113 const UNITS_PROVIDER& aUnitsProvider, const wxString& aProjectName,
114 const wxString& aBoardName );
115
116#endif
wxString FormatBoardStatisticsJson(const BOARD_STATISTICS_DATA &aData, BOARD *aBoard, const UNITS_PROVIDER &aUnitsProvider, const wxString &aProjectName, const wxString &aBoardName)
void ComputeBoardStatistics(BOARD *aBoard, const BOARD_STATISTICS_OPTIONS &aOptions, BOARD_STATISTICS_DATA &aData)
wxString FormatBoardStatisticsReport(const BOARD_STATISTICS_DATA &aData, BOARD *aBoard, const UNITS_PROVIDER &aUnitsProvider, const wxString &aProjectName, const wxString &aBoardName)
wxString FormatBoardStatisticsMinimum(int aValue, const UNITS_PROVIDER &aUnitsProvider)
Format a minimum distance, or "unknown" when no qualifying measurement was found.
void InitializeBoardStatisticsData(BOARD_STATISTICS_DATA &aData)
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:410
Declarations of types for tracks and vias.
std::vector< BOARD_STATISTICS_INFO_ENTRY< PAD_ATTRIB > > padEntries
std::vector< BOARD_STATISTICS_FP_ENTRY > footprintEntries
std::vector< BOARD_STATISTICS_INFO_ENTRY< VIATYPE > > viaEntries
std::vector< BOARD_STATISTICS_INFO_ENTRY< PAD_PROP > > padPropertyEntries
std::vector< DRILL_LINE_ITEM > drillEntries
int attributeMask
int attributeValue
int backCount
BOARD_STATISTICS_FP_ENTRY(int aMask, int aValue, const wxString &aTitle, const std::string &aJsonKey)
int frontCount
std::string jsonKey
wxString title
std::string jsonKey
int quantity
BOARD_STATISTICS_INFO_ENTRY(T aAttribute, const wxString &aTitle, const std::string &aJsonKey)
wxString title
T attribute