KiCad PCB EDA Suite
drc_tool.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) 2020 KiCad Developers, see change_log.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 DRC_TOOL_H
25 #define DRC_TOOL_H
26 
27 #include <board_commit.h>
28 #include <class_board.h>
29 #include <class_track.h>
30 #include <class_marker_pcb.h>
31 #include <geometry/seg.h>
33 #include <memory>
34 #include <vector>
35 #include <tools/pcb_tool_base.h>
36 
37 
38 class PCB_EDIT_FRAME;
39 class DIALOG_DRC;
40 class DRC_ITEM;
42 class DRC_ENGINE;
43 
44 
45 class DRC_TOOL : public PCB_TOOL_BASE
46 {
47 public:
48  DRC_TOOL();
49  ~DRC_TOOL();
50 
52  void Reset( RESET_REASON aReason ) override;
53 
54 private:
55  PCB_EDIT_FRAME* m_editFrame; // The pcb frame editor which owns the board
59 
60  std::shared_ptr<DRC_ENGINE> m_drcEngine;
61 
62  std::vector<std::shared_ptr<DRC_ITEM>> m_unconnected; // list of unconnected pads
63  std::vector<std::shared_ptr<DRC_ITEM>> m_footprints; // list of footprint warnings
64 
65 private:
67  void setTransitions() override;
68 
72  void updatePointers();
73 
75 
76 public:
90  void ShowDRCDialog( wxWindow* aParent );
91 
92  int ShowDRCDialog( const TOOL_EVENT& aEvent );
93 
99  bool IsDRCDialogShown();
100 
106  bool IsDRCRunning() const { return m_drcRunning; }
107 
111  void DestroyDRCDialog();
112 
113  std::shared_ptr<DRC_ENGINE> GetDRCEngine() { return m_drcEngine; }
114 
118  void RunTests( PROGRESS_REPORTER* aProgressReporter, bool aTestTracksAgainstZones,
119  bool aRefillZones, bool aReportAllTrackErrors, bool aTestFootprints );
120 };
121 
122 
123 #endif // DRC_TOOL_H
Design Rule Checker object that performs all the DRC tests.
Definition: drc_engine.h:84
A progress reporter for use in multi-threaded environments.
DRC_TOOL()
Definition: drc_tool.cpp:38
PCB_EDIT_FRAME * m_editFrame
Definition: drc_tool.h:55
BOARD * m_pcb
Definition: drc_tool.h:56
std::shared_ptr< DRC_ENGINE > m_drcEngine
Definition: drc_tool.h:60
bool m_drcRunning
Definition: drc_tool.h:58
void ShowDRCDialog(wxWindow *aParent)
Open a dialog and prompts the user, then if a test run button is clicked, runs the test(s) and create...
Definition: drc_tool.cpp:81
void setTransitions() override
Sets up handlers for various events.
Definition: drc_tool.cpp:249
A single base class (TRACK) represents both tracks and vias, with subclasses for curved tracks (ARC) ...
void Reset(RESET_REASON aReason) override
Function Reset() Brings the tool to a known, initial state.
Definition: drc_tool.cpp:53
Markers used to show a drc problem on boards.
Multi-thread safe progress reporter dialog, intended for use of tasks that paralleize reporting back ...
TOOL_EVENT.
Definition: tool_event.h:171
void updatePointers()
Update needed pointers from the one pointer which is known not to change.
Definition: drc_tool.cpp:231
std::shared_ptr< DRC_ENGINE > GetDRCEngine()
Definition: drc_tool.h:113
DIALOG_DRC * m_drcDialog
Definition: drc_tool.h:57
bool IsDRCRunning() const
Check to see if the DRC engine is running the tests.
Definition: drc_tool.h:106
bool IsDRCDialogShown()
Check to see if the DRC_TOOL dialog is currently shown.
Definition: drc_tool.cpp:123
EDA_UNITS
Definition: eda_units.h:38
Information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:186
std::vector< std::shared_ptr< DRC_ITEM > > m_footprints
Definition: drc_tool.h:63
PCB_EDIT_FRAME is the main frame for Pcbnew.
RESET_REASON
Determines the reason of reset for a tool
Definition: tool_base.h:79
void RunTests(PROGRESS_REPORTER *aProgressReporter, bool aTestTracksAgainstZones, bool aRefillZones, bool aReportAllTrackErrors, bool aTestFootprints)
Run the DRC tests.
Definition: drc_tool.cpp:142
EDA_UNITS userUnits() const
Definition: drc_tool.h:74
void DestroyDRCDialog()
Closes and frees the DRC dialog.
Definition: drc_tool.cpp:132
std::vector< std::shared_ptr< DRC_ITEM > > m_unconnected
Definition: drc_tool.h:62
~DRC_TOOL()
Definition: drc_tool.cpp:48
EDA_UNITS GetUserUnits() const
Return the user units currently in use.