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()
Function Empty sets the list to empty.
Definition: collector.h:109
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
Function Visit may be re-implemented for each derived class in order to handle all the types given by...
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:201
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:82
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
void Append(EDA_ITEM *item)
Function Append adds an item to the end of the list.
Definition: collector.h:119
virtual bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const
Function HitTest tests if aPosition is contained within or on the bounding box of an item.
Definition: base_struct.h:314
INSPECTOR_FUNC m_inspector
Definition: collector.h:61
#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:206
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...
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:163
wxPoint m_RefPos
Definition: collector.h:62
SEARCH_RESULT
Definition: base_struct.h:51
std::vector< EDA_ITEM * > m_List
Definition: collector.h:58
const KICAD_T * m_ScanTypes
Definition: collector.h:60