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 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 
31 {
32 protected:
39  std::vector<EDA_ITEM*> m_List2nd;
40 
41 
45  //const COLLECTORS_GUIDE* m_Guide;
46 
47 
53 
54 
55 public:
56 
60  static const KICAD_T AllItems[];
61 
63  {
64  //m_Guide = NULL;
65  m_PrimaryLength = 0;
66  SetScanTypes( AllItems );
67  }
68 
69  void Empty2nd()
70  {
71  m_List2nd.clear();
72  }
73 
74  /*void Append2nd( BOARD_ITEM* item )
75  {
76  m_List2nd.push_back( item );
77  }*/
78 
79 
85  //void SetGuide( const COLLECTORS_GUIDE* aGuide ) { m_Guide = aGuide; }
86 
87 
95  EDA_ITEM* operator[]( int ndx ) const
96  {
97  if( (unsigned)ndx < (unsigned)GetCount() )
98  return (EDA_ITEM*) m_List[ ndx ];
99  return NULL;
100  }
101 
107 
118  SEARCH_RESULT Inspect( EDA_ITEM* testItem, void* testData ) override;
119 
130  void Collect( EDA_ITEM* aItem, const KICAD_T aScanList[],
131  const wxPoint& aRefPos/*, const COLLECTORS_GUIDE& aGuide */);
132 };
133 
134 #endif
int GetCount() const
Function GetCount returns the number of objects in the list.
Definition: collector.h:114
COLLECTOR class definition.
int GetPrimaryCount()
Function GetPrimaryCount.
void SetScanTypes(const KICAD_T *scanTypes)
Function SetScanTypes records the list of KICAD_T types to consider for collection by the Inspect() f...
Definition: collector.h:215
Class GERBER_COLLECTOR is intended for use when the right click button is pressed, or when the plain "arrow" tool is in effect.
int m_PrimaryLength
Determines which items are to be collected by Inspect()
std::vector< EDA_ITEM * > m_List2nd
A place to hold collected objects which don&#39;t match precisely the search criteria, but would be acceptable if nothing else is found.
static const KICAD_T AllItems[]
A scan list for all selectable gerber items.
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
void Collect(EDA_ITEM *aItem, const KICAD_T aScanList[], const wxPoint &aRefPos)
Function Collect scans an EDA_ITEM using this class&#39;s Inspector method, which does the collection...
EDA_ITEM * operator[](int ndx) const
Function SetGuide records which COLLECTORS_GUIDE to use.
SEARCH_RESULT Inspect(EDA_ITEM *testItem, void *testData) override
Function Inspect is the examining function within the INSPECTOR which is passed to the Iterate functi...
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:154
Class COLLECTOR is an abstract class that will find and hold all the objects according to an inspecti...
Definition: collector.h:55
SEARCH_RESULT
Definition: base_struct.h:66
std::vector< EDA_ITEM * > m_List
A place to hold collected objects without taking ownership of their memory.
Definition: collector.h:65