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-2022 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
22
31{
32 if( testItem->HitTest( m_refPos ) )
33 Append( testItem );
34
36}
37
38
39void GERBER_COLLECTOR::Collect( EDA_ITEM* aItem, const std::vector<KICAD_T>& aScanTypes,
40 const VECTOR2I& aRefPos )
41{
42 Empty(); // empty the collection, primary criteria list
43
44 SetScanTypes( aScanTypes );
45
46 // remember where the snapshot was taken from and pass refPos to
47 // the Inspect() function.
48 SetRefPos( aRefPos );
49
50 aItem->Visit( m_inspector, nullptr, m_scanTypes );
51}
INSPECTOR_FUNC m_inspector
Definition: collector.h:244
void Empty()
Clear the list.
Definition: collector.h:89
VECTOR2I m_refPos
Definition: collector.h:246
void SetScanTypes(const std::vector< KICAD_T > &aTypes)
Record the list of KICAD_T types to consider for collection by the Inspect() function.
Definition: collector.h:211
void SetRefPos(const VECTOR2I &aRefPos)
Definition: collector.h:213
std::vector< KICAD_T > m_scanTypes
Definition: collector.h:243
void Append(EDA_ITEM *item)
Add an item to the end of the list.
Definition: collector.h:99
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
virtual INSPECT_RESULT Visit(INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &aScanTypes)
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: eda_item.cpp:91
virtual bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const
Test if aPosition is inside or on the boundary of this item.
Definition: eda_item.h:222
INSPECT_RESULT Inspect(EDA_ITEM *testItem, void *testData) override
The examining function within the INSPECTOR which is passed to the Iterate function.
void Collect(EDA_ITEM *aItem, const std::vector< KICAD_T > &aScanTypes, const VECTOR2I &aRefPos)
Scan an EDA_ITEM using this class's Inspector method, which does the collection.
INSPECT_RESULT
Definition: eda_item.h:42