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.

147 lines
4.3 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2012-2014 Jean-Pierre Charras jp.charras at wanadoo.fr
  5. * Copyright (C) 1992-2014 KiCad Developers, see change_log.txt for contributors.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version 2
  10. * of the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, you may find one here:
  19. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  20. * or you may search the http://www.gnu.org website for the version 2 license,
  21. * or you may write to the Free Software Foundation, Inc.,
  22. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  23. */
  24. /**
  25. * @file gbr_layout.h
  26. * @brief Class CLASS_GBR_LAYOUT to handle info to draw loaded Gerber images
  27. * and page frame reference
  28. */
  29. #ifndef GBR_LAYOUT_H
  30. #define GBR_LAYOUT_H
  31. #include <dlist.h>
  32. #include <colors_design_settings.h>
  33. #include <common.h> // PAGE_INFO
  34. #include <gerbview.h> // GERBER_DRAWLAYERS_COUNT
  35. #include <title_block.h>
  36. #include <gerber_draw_item.h>
  37. #include <gbr_display_options.h>
  38. #include <gr_basic.h>
  39. #include <eda_rect.h>
  40. class GERBER_FILE_IMAGE_LIST;
  41. /**
  42. * Class GBR_LAYOUT
  43. * holds list of GERBER_DRAW_ITEM currently loaded.
  44. */
  45. class GBR_LAYOUT : public EDA_ITEM
  46. {
  47. private:
  48. mutable EDA_RECT m_BoundingBox;
  49. TITLE_BLOCK m_titles;
  50. wxPoint m_originAxisPosition;
  51. public:
  52. GBR_LAYOUT();
  53. ~GBR_LAYOUT();
  54. wxString GetClass() const override
  55. {
  56. return wxT( "GBR_LAYOUT" );
  57. }
  58. // Accessor to the GERBER_FILE_IMAGE_LIST,
  59. // which handles the list of gerber files (and drill files) images loaded
  60. GERBER_FILE_IMAGE_LIST* GetImagesList() const;
  61. const wxPoint& GetAuxOrigin() const
  62. {
  63. return m_originAxisPosition;
  64. }
  65. void SetAuxOrigin( const wxPoint& aPosition )
  66. {
  67. m_originAxisPosition = aPosition;
  68. }
  69. TITLE_BLOCK& GetTitleBlock()
  70. {
  71. return m_titles;
  72. }
  73. void SetTitleBlock( const TITLE_BLOCK& aTitleBlock )
  74. {
  75. m_titles = aTitleBlock;
  76. }
  77. /**
  78. * Function ComputeBoundingBox
  79. * calculates the bounding box containing all Gerber items.
  80. * @return EDA_RECT - the full item list bounding box
  81. */
  82. EDA_RECT ComputeBoundingBox() const;
  83. /**
  84. * Function GetBoundingBox
  85. */
  86. const EDA_RECT GetBoundingBox() const override
  87. {
  88. return ComputeBoundingBox();
  89. }
  90. void SetBoundingBox( const EDA_RECT& aBox ) { m_BoundingBox = aBox; }
  91. /**
  92. * Function Draw.
  93. * Redraw the CLASS_GBR_LAYOUT items but not cursors, axis or grid.
  94. * @param aPanel = the draw canvas
  95. * @param aDC = the current device context
  96. * @param aDrawMode = GR_COPY, GR_OR ... (not always used)
  97. * @param aOffset = an draw offset value
  98. * @param aDisplayOptions = a GBR_DISPLAY_OPTIONS for draw display opts
  99. */
  100. void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
  101. GR_DRAWMODE aDrawMode, const wxPoint& aOffset,
  102. GBR_DISPLAY_OPTIONS* aDisplayOptions );
  103. /**
  104. * Function DrawItemsDCodeID
  105. * Draw the DCode value (if exists) corresponding to gerber item
  106. * (polygons do not have a DCode)
  107. * @param aPanel = the draw canvas
  108. * @param aDC = the current device context
  109. * @param aDrawMode = GR_COPY, GR_OR ...
  110. * @param aDrawColor = the color of dcode texts
  111. */
  112. void DrawItemsDCodeID( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
  113. GR_DRAWMODE aDrawMode, COLOR4D aDrawColor );
  114. ///> @copydoc EDA_ITEM::Visit()
  115. SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override;
  116. #if defined(DEBUG)
  117. void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
  118. #endif
  119. };
  120. #endif // #ifndef GBR_LAYOUT_H