You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
2.1 KiB

  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. #include "gerber_collectors.h"
  20. const KICAD_T GERBER_COLLECTOR::AllItems[] = {
  21. GERBER_LAYOUT_T,
  22. GERBER_IMAGE_T,
  23. GERBER_DRAW_ITEM_T,
  24. EOT
  25. };
  26. /**
  27. * Function Inspect
  28. * is the examining function within the INSPECTOR which is passed to the
  29. * Iterate function.
  30. *
  31. * @param testItem An EDA_ITEM to examine.
  32. * @param testData not used here.
  33. * @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
  34. * else SCAN_CONTINUE;
  35. */
  36. SEARCH_RESULT GERBER_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
  37. {
  38. if( testItem->HitTest( m_RefPos ) )
  39. Append( testItem );
  40. return SEARCH_RESULT::CONTINUE;
  41. }
  42. void GERBER_COLLECTOR::Collect( EDA_ITEM* aItem, const KICAD_T aScanList[],
  43. const wxPoint& aRefPos/*, const COLLECTORS_GUIDE& aGuide*/ )
  44. {
  45. Empty(); // empty the collection, primary criteria list
  46. // remember guide, pass it to Inspect()
  47. //SetGuide( &aGuide );
  48. SetScanTypes( aScanList );
  49. // remember where the snapshot was taken from and pass refPos to
  50. // the Inspect() function.
  51. SetRefPos( aRefPos );
  52. aItem->Visit( m_inspector, NULL, m_ScanTypes );
  53. // record the length of the primary list before concatenating on to it.
  54. m_PrimaryLength = m_List.size();
  55. }