KiCad PCB EDA Suite
gerber_collectors.cpp
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 #include "gerber_collectors.h"
21 
26  EOT
27 };
28 
29 
40 SEARCH_RESULT GERBER_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
41 {
42  if( testItem->HitTest( m_refPos ) )
43  Append( testItem );
44 
46 }
47 
48 
49 void GERBER_COLLECTOR::Collect( EDA_ITEM* aItem, const KICAD_T aScanList[],
50  const wxPoint& aRefPos/*, const COLLECTORS_GUIDE& aGuide*/ )
51 {
52  Empty(); // empty the collection, primary criteria list
53 
54  // remember guide, pass it to Inspect()
55  //SetGuide( &aGuide );
56 
57  SetScanTypes( aScanList );
58 
59  // remember where the snapshot was taken from and pass refPos to
60  // the Inspect() function.
61  SetRefPos( aRefPos );
62 
63  aItem->Visit( m_inspector, NULL, m_scanTypes );
64 
65  // record the length of the primary list before concatenating on to it.
66  m_PrimaryLength = m_list.size();
67 }
void Empty()
Clear the list.
Definition: collector.h:95
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: eda_item.cpp:107
void SetScanTypes(const KICAD_T *scanTypes)
Record the list of KICAD_T types to consider for collection by the Inspect() function.
Definition: collector.h:220
std::vector< EDA_ITEM * > m_list
Definition: collector.h:254
int m_PrimaryLength
Determines which items are to be collected by Inspect()
static const KICAD_T AllItems[]
A scan list for all selectable gerber items.
search types array terminator (End Of Types)
Definition: typeinfo.h:81
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
void Append(EDA_ITEM *item)
Add an item to the end of the list.
Definition: collector.h:105
virtual bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const
Test if aPosition is contained within or on the bounding box of an item.
Definition: eda_item.h:273
INSPECTOR_FUNC m_inspector
Definition: collector.h:258
#define NULL
void Collect(EDA_ITEM *aItem, const KICAD_T aScanList[], const wxPoint &aRefPos)
Function Collect scans an EDA_ITEM using this class's Inspector method, which does the collection.
void SetRefPos(const wxPoint &aRefPos)
Definition: collector.h:225
wxPoint m_refPos
Definition: collector.h:259
const KICAD_T * m_scanTypes
Definition: collector.h:257
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...
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:148
SEARCH_RESULT
Definition: eda_item.h:40