2017-09-17 22:44:30 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2021-07-16 20:13:26 +00:00
|
|
|
* Copyright (C) 2017-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
2017-09-17 22:44:30 +00:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
* Free Software Foundation, either version 3 of the License, or (at your
|
|
|
|
* option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "gerber_collectors.h"
|
|
|
|
|
|
|
|
const KICAD_T GERBER_COLLECTOR::AllItems[] = {
|
2019-12-30 13:23:33 +00:00
|
|
|
GERBER_LAYOUT_T,
|
2017-09-17 22:44:30 +00:00
|
|
|
GERBER_IMAGE_T,
|
|
|
|
GERBER_DRAW_ITEM_T,
|
|
|
|
EOT
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2021-07-16 20:13:26 +00:00
|
|
|
* The examining function within the INSPECTOR which is passed to the iterate function.
|
2017-09-17 22:44:30 +00:00
|
|
|
*
|
2021-07-16 20:13:26 +00:00
|
|
|
* @param testItem is an EDA_ITEM to examine.
|
|
|
|
* @param testData is not used here.
|
|
|
|
* @return SEARCH_QUIT if the iterator is to stop the scan, else SCAN_CONTINUE.
|
2017-09-17 22:44:30 +00:00
|
|
|
*/
|
|
|
|
SEARCH_RESULT GERBER_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
|
|
|
|
{
|
2020-10-02 20:25:14 +00:00
|
|
|
if( testItem->HitTest( m_refPos ) )
|
2017-09-17 22:44:30 +00:00
|
|
|
Append( testItem );
|
|
|
|
|
2019-12-28 00:55:11 +00:00
|
|
|
return SEARCH_RESULT::CONTINUE;
|
2017-09-17 22:44:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GERBER_COLLECTOR::Collect( EDA_ITEM* aItem, const KICAD_T aScanList[],
|
2022-01-04 01:00:40 +00:00
|
|
|
const VECTOR2I& aRefPos /*, const COLLECTORS_GUIDE& aGuide*/ )
|
2017-09-17 22:44:30 +00:00
|
|
|
{
|
|
|
|
Empty(); // empty the collection, primary criteria list
|
|
|
|
|
|
|
|
// remember guide, pass it to Inspect()
|
|
|
|
//SetGuide( &aGuide );
|
|
|
|
|
|
|
|
SetScanTypes( aScanList );
|
|
|
|
|
|
|
|
// remember where the snapshot was taken from and pass refPos to
|
|
|
|
// the Inspect() function.
|
|
|
|
SetRefPos( aRefPos );
|
|
|
|
|
2021-07-16 20:13:26 +00:00
|
|
|
aItem->Visit( m_inspector, nullptr, m_scanTypes );
|
2017-09-17 22:44:30 +00:00
|
|
|
|
|
|
|
// record the length of the primary list before concatenating on to it.
|
2020-10-02 20:25:14 +00:00
|
|
|
m_PrimaryLength = m_list.size();
|
2017-09-17 22:44:30 +00:00
|
|
|
}
|