KiCad PCB EDA Suite
class_gerber_file_image_list.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) 2010-2016 Jean-Pierre Charras jp.charras at wanadoo.fr
5  * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.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 #ifndef CLASS_GERBER_FILE_IMAGE_LIST_H
26 #define CLASS_GERBER_FILE_IMAGE_LIST_H
27 
28 #include <vector>
29 #include <set>
30 
31 #include <class_gerber_draw_item.h>
32 #include <class_aperture_macro.h>
33 
34 /* gerber files have different parameters to define units and how items must be plotted.
35  * some are for the entire file, and other can change along a file.
36  * In Gerber world:
37  * an image is the entire gerber file and its "global" parameters
38  * a layer (that is very different from a board layer) is just a sub set of a file that
39  * have specific parameters
40  * if a Image parameter is set more than once, only the last value is used
41  * Some parameters can change along a file and are not layer specific: they are stored
42  * in GERBER_ITEM items, when instancied.
43  *
44  * In GerbView, to handle these parameters, there are 2 classes:
45  * GERBER_FILE_IMAGE : the main class containing most of parameters and data to plot a graphic layer
46  * Some of them can change along the file
47  * There is one GERBER_FILE_IMAGE per file and one graphic layer per file or GERBER_FILE_IMAGE
48  * GerbView does not read and merge 2 gerber file in one graphic layer:
49  * I believe this is not possible due to the constraints in Image parameters.
50  * GERBER_LAYER : containing the subset of parameters that is layer speficic
51  * A GERBER_FILE_IMAGE must include one GERBER_LAYER to define all parameters to plot a file.
52  * But a GERBER_FILE_IMAGE can use more than one GERBER_LAYER.
53  */
54 
55 class GERBER_FILE_IMAGE;
56 
63 {
64  // the list of loaded images (1 image = 1 gerber file)
65  std::vector<GERBER_FILE_IMAGE*> m_GERBER_List;
66 
67 public:
70 
71  wxString GetClass() const override
72  {
73  return wxT( "GERBER_FILE_IMAGE_LIST" );
74  }
75 
76  //Accessor
78  GERBER_FILE_IMAGE* GetGbrImage( int aIdx );
79 
80  unsigned ImagesMaxCount() { return m_GERBER_List.size(); }
81 
89  int AddGbrImage( GERBER_FILE_IMAGE* aGbrImage, int aIdx );
90 
91 
95  void DeleteAllImages();
96 
101  void DeleteImage( int aIdx );
102 
116  const wxString GetDisplayName( int aIdx, bool aNameOnly = false );
117 
122  void SortImagesByZOrder();
123 
124  #if defined(DEBUG)
125 
126  void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
127 
128  #endif
129 };
130 
131 #endif // ifndef CLASS_GERBER_FILE_IMAGE_LIST_H
void DeleteAllImages()
remove all loaded data in list, and delete all images.
const wxString GetDisplayName(int aIdx, bool aNameOnly=false)
void SortImagesByZOrder()
Sort loaded images by Z order priority, if they have the X2 FileFormat info (SortImagesByZOrder updat...
Class GERBER_FILE_IMAGE holds the Image data and parameters for one gerber file and layer parameters ...
int AddGbrImage(GERBER_FILE_IMAGE *aGbrImage, int aIdx)
Add a GERBER_FILE_IMAGE* at index aIdx or at the first free location if aIdx < 0. ...
GERBER_FILE_IMAGE_LIST is a helper class to handle a list of GERBER_FILE_IMAGE files which are loaded...
wxString GetClass() const override
Function GetClass returns the class name.
GERBER_FILE_IMAGE * GetGbrImage(int aIdx)
static GERBER_FILE_IMAGE_LIST & GetImagesList()
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:165
void DeleteImage(int aIdx)
delete the loaded data of image aIdx.
std::vector< GERBER_FILE_IMAGE * > m_GERBER_List