KiCad PCB EDA Suite
gerber_collectors.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) 2017-2021 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 along
17  * with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef GERBER_COLLECTORS_H
21 #define GERBER_COLLECTORS_H
22 
23 #include <collector.h>
24 
29 {
30 public:
34  static const KICAD_T AllItems[];
35 
37  {
38  m_PrimaryLength = 0;
40  }
41 
42  void Empty2nd()
43  {
44  m_List2nd.clear();
45  }
46 
53  EDA_ITEM* operator[]( int ndx ) const override
54  {
55  if( (unsigned)ndx < (unsigned)GetCount() )
56  return (EDA_ITEM*) m_list[ ndx ];
57 
58  return nullptr;
59  }
60 
64  int GetPrimaryCount() { return m_PrimaryLength; }
65 
73  SEARCH_RESULT Inspect( EDA_ITEM* testItem, void* testData ) override;
74 
85  void Collect( EDA_ITEM* aItem, const KICAD_T aScanList[],
86  const wxPoint& aRefPos /*, const COLLECTORS_GUIDE& aGuide */ );
87 
88 protected:
95  std::vector<EDA_ITEM*> m_List2nd;
96 
102 };
103 
104 #endif
void SetScanTypes(const KICAD_T *scanTypes)
Record the list of KICAD_T types to consider for collection by the Inspect() function.
Definition: collector.h:213
Use when the right click button is pressed or when the select tool is in effect.
std::vector< EDA_ITEM * > m_list
Definition: collector.h:247
int m_PrimaryLength
The number of items that were originally in the primary list before the m_List2nd was concatenated on...
std::vector< EDA_ITEM * > m_List2nd
A place to hold collected objects which don't match precisely the search criteria,...
static const KICAD_T AllItems[]
A scan list for all selectable gerber items.
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
int GetCount() const
Return the number of objects in the list.
Definition: collector.h:82
void Collect(EDA_ITEM *aItem, const KICAD_T aScanList[], const wxPoint &aRefPos)
Scan an EDA_ITEM using this class's Inspector method, which does the collection.
SEARCH_RESULT Inspect(EDA_ITEM *testItem, void *testData) override
The examining function within the INSPECTOR which is passed to the Iterate function.
EDA_ITEM * operator[](int ndx) const override
Overload the [](int) operator to return a EDA_ITEM* instead of an EDA_ITEM* type.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:100
An abstract class that will find and hold all the objects according to an inspection done by the Insp...
Definition: collector.h:48
SEARCH_RESULT
Definition: eda_item.h:41