KiCad PCB EDA Suite
class_gbr_layout.h
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) 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 
31 #ifndef CLASS_GBR_LAYOUT_H
32 #define CLASS_GBR_LAYOUT_H
33 
34 
35 #include <dlist.h>
36 
38 #include <common.h> // PAGE_INFO
39 #include <gerbview.h> // GERBER_DRAWLAYERS_COUNT
40 #include <class_title_block.h>
41 #include <class_gerber_draw_item.h>
43 
44 #include <gr_basic.h>
45 #include <class_eda_rect.h>
46 
48 
53 class GBR_LAYOUT : public EDA_ITEM
54 {
55 private:
59  std::vector<int> m_printLayersList; // When printing: the list of graphic layers Id to print
60 
61 public:
62 
63  GBR_LAYOUT();
64  ~GBR_LAYOUT();
65 
66  wxString GetClass() const override
67  {
68  return wxT( "GBR_LAYOUT" );
69  }
70 
71  // Accessor to the GERBER_FILE_IMAGE_LIST,
72  // which handles the list of gerber files (and drill files) images loaded
74 
75  const wxPoint& GetAuxOrigin() const
76  {
77  return m_originAxisPosition;
78  }
79 
80  void SetAuxOrigin( const wxPoint& aPosition )
81  {
82  m_originAxisPosition = aPosition;
83  }
84 
86  {
87  return m_titles;
88  }
89 
90  void SetTitleBlock( const TITLE_BLOCK& aTitleBlock )
91  {
92  m_titles = aTitleBlock;
93  }
94 
101 
105  const EDA_RECT GetBoundingBox() const override
106  {
107  return ComputeBoundingBox();
108  }
109 
110  void SetBoundingBox( const EDA_RECT& aBox ) { m_BoundingBox = aBox; }
111 
121  void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
122  GR_DRAWMODE aDrawMode, const wxPoint& aOffset,
123  GBR_DISPLAY_OPTIONS* aDisplayOptions );
124 
134  void DrawItemsDCodeID( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
135  GR_DRAWMODE aDrawMode, COLOR4D aDrawColor );
136 
137 
143  void SetPrintableLayers( const std::vector<int>& aLayerList )
144  {
145  m_printLayersList = aLayerList;
146  }
147 
152  std::vector<int> GetPrintableLayers()
153  {
154  return m_printLayersList;
155  }
156 
162  {
163  m_printLayersList.clear();
164  }
165 
171  void AddLayerToPrintableList( int aLayer)
172  {
173  m_printLayersList.push_back( aLayer );
174  }
175 
176 
183  bool IsLayerPrintable( int aLayer ) const;
184 
186  SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override;
187 
188 
189 #if defined(DEBUG)
190 
191  void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
192 
193 #endif
194 };
195 
196 #endif // #ifndef CLASS_GBR_LAYOUT_H
Class GBR_LAYOUT holds list of GERBER_DRAW_ITEM currently loaded.
wxString GetClass() const override
Function GetClass returns the class name.
EDA_RECT m_BoundingBox
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox.
bool IsLayerPrintable(int aLayer) const
Function IsLayerPrintable tests whether a given layer is visible.
void AddLayerToPrintableList(int aLayer)
Function AddLayerToPrintableList Add a layer to the list of graphic layers to print.
const wxPoint & GetAuxOrigin() const
void SetPrintableLayers(const std::vector< int > &aLayerList)
Function SetPrintableLayers Set the list of printable graphic layers.
void SetAuxOrigin(const wxPoint &aPosition)
void SetBoundingBox(const EDA_RECT &aBox)
GERBER_FILE_IMAGE_LIST is a helper class to handle a list of GERBER_FILE_IMAGE files which are loaded...
Class TITLE_BLOCK holds the information shown in the lower right corner of a plot, printout, or editing view.
wxPoint m_originAxisPosition
std::vector< int > GetPrintableLayers()
Function GetPrintableLayers.
void DrawItemsDCodeID(EDA_DRAW_PANEL *aPanel, wxDC *aDC, GR_DRAWMODE aDrawMode, COLOR4D aDrawColor)
Function DrawItemsDCodeID Draw the DCode value (if exists) corresponding to gerber item (polygons do ...
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
EDA_RECT ComputeBoundingBox() const
Function ComputeBoundingBox calculates the bounding box containing all Gerber items.
const INSPECTOR_FUNC & INSPECTOR
Definition: base_struct.h:118
void ClearPrintableLayers()
Function ClearPrintableLayers Clear the list of graphic layers to print.
GR_DRAWMODE
Drawmode. Compositing mode plus a flag or two.
Definition: gr_basic.h:41
Class GBR_DISPLAY_OPTIONS is a helper class to handle display options (filling modes and afew other o...
std::vector< int > m_printLayersList
TITLE_BLOCK & GetTitleBlock()
GERBER_FILE_IMAGE_LIST * GetImagesList() const
Class EDA_RECT handles the component boundary box.
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:165
The common library.
SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[]) override
>
SEARCH_RESULT
Definition: base_struct.h:82
Handle colors used to draw all items or layers.
TITLE_BLOCK m_titles
void SetTitleBlock(const TITLE_BLOCK &aTitleBlock)
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
void Draw(EDA_DRAW_PANEL *aPanel, wxDC *aDC, GR_DRAWMODE aDrawMode, const wxPoint &aOffset, GBR_DISPLAY_OPTIONS *aDisplayOptions)
Function Draw.