KiCad PCB EDA Suite
drc_marker_factory.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) 2018 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 
25 #ifndef DRC_DRC_MARKER_FACTORY__H
26 #define DRC_DRC_MARKER_FACTORY__H
27 
28 
29 #include <class_marker_pcb.h>
30 #include <common.h> // for EDA_UNITS_T
31 
32 
33 class ZONE_CONTAINER;
34 class TRACK;
35 class D_PAD;
36 class SEG;
37 
43 {
44 public:
45  using UNITS_PROVIDER = std::function<EDA_UNITS_T()>;
46 
48 
54  void SetUnitsProvider( UNITS_PROVIDER aUnitsProvider );
55 
60  void SetUnits( EDA_UNITS_T aUnits );
61 
70  MARKER_PCB* NewMarker( TRACK* aTrack, BOARD_ITEM* aConflitItem, const SEG& aConflictSeg,
71  int aErrorCode ) const;
72 
73  MARKER_PCB* NewMarker( TRACK* aTrack, ZONE_CONTAINER* aConflictZone, int aErrorCode ) const;
74 
75  MARKER_PCB* NewMarker( D_PAD* aPad, BOARD_ITEM* aConflictItem, int aErrorCode ) const;
76 
84  MARKER_PCB* NewMarker( const wxPoint& aPos, BOARD_ITEM* aItem, int aErrorCode ) const;
85 
86  MARKER_PCB* NewMarker( const wxPoint& aPos, BOARD_ITEM* aItem, BOARD_ITEM* bItem,
87  int aErrorCode ) const;
88 
93  MARKER_PCB* NewMarker( int aErrorCode, const wxString& aMessage ) const;
94 
95 private:
97  {
98  return m_units_provider();
99  }
100 
102 };
103 
104 #endif // DRC_DRC_MARKER_FACTORY__H
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:60
UNITS_PROVIDER m_units_provider
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
void SetUnits(EDA_UNITS_T aUnits)
Set the units provider to a function returning a constant value.
Markers used to show a drc problem on boards.
Class that constructs DRC markers of various kinds with messages according to items and error code.
MARKER_PCB * NewMarker(TRACK *aTrack, BOARD_ITEM *aConflitItem, const SEG &aConflictSeg, int aErrorCode) const
Creates a marker on a track, via or pad.
Definition: seg.h:36
The common library.
std::function< EDA_UNITS_T()> UNITS_PROVIDER
void SetUnitsProvider(UNITS_PROVIDER aUnitsProvider)
Set the provider for the units (this will be called for each new marker constructed)
EDA_UNITS_T getCurrentUnits() const
EDA_UNITS_T
Definition: common.h:133