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.

71 lines
2.3 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_IMAGE_LIST_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. Searches and collects all the objects that the old
  30. * function PcbGeneralLocateAndDisplay() would find, except that it keeps all
  31. * that it finds and does not do any displaying.
  32. *
  33. * @param testItem An EDA_ITEM to examine.
  34. * @param testData not used here.
  35. * @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
  36. * else SCAN_CONTINUE;
  37. */
  38. SEARCH_RESULT GERBER_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
  39. {
  40. if( testItem->HitTest( m_RefPos ) )
  41. Append( testItem );
  42. return SEARCH_CONTINUE;
  43. }
  44. void GERBER_COLLECTOR::Collect( EDA_ITEM* aItem, const KICAD_T aScanList[],
  45. const wxPoint& aRefPos/*, const COLLECTORS_GUIDE& aGuide*/ )
  46. {
  47. Empty(); // empty the collection, primary criteria list
  48. // remember guide, pass it to Inspect()
  49. //SetGuide( &aGuide );
  50. SetScanTypes( aScanList );
  51. // remember where the snapshot was taken from and pass refPos to
  52. // the Inspect() function.
  53. SetRefPos( aRefPos );
  54. aItem->Visit( m_inspector, NULL, m_ScanTypes );
  55. SetTimeNow(); // when snapshot was taken
  56. // record the length of the primary list before concatenating on to it.
  57. m_PrimaryLength = m_List.size();
  58. }