2014-10-21 18:36:45 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2012-2014 Jean-Pierre Charras jp.charras at wanadoo.fr
|
|
|
|
* Copyright (C) 1992-2014 KiCad Developers, see change_log.txt for contributors.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2012-05-04 17:44:42 +00:00
|
|
|
/**
|
|
|
|
* @file class_gbr_layout.h
|
2014-11-22 11:52:57 +00:00
|
|
|
* @brief Class CLASS_GBR_LAYOUT to handle info to draw/print loaded Gerber images
|
|
|
|
* and page frame reference
|
2012-05-04 17:44:42 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef CLASS_GBR_LAYOUT_H
|
|
|
|
#define CLASS_GBR_LAYOUT_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <dlist.h>
|
|
|
|
|
|
|
|
#include <class_colors_design_settings.h>
|
|
|
|
#include <common.h> // PAGE_INFO
|
2014-06-27 17:07:42 +00:00
|
|
|
#include <gerbview.h> // GERBER_DRAWLAYERS_COUNT
|
2012-05-04 17:44:42 +00:00
|
|
|
#include <class_title_block.h>
|
|
|
|
#include <class_gerber_draw_item.h>
|
2016-06-02 09:30:39 +00:00
|
|
|
#include <class_gbr_display_options.h>
|
2012-05-04 17:44:42 +00:00
|
|
|
|
2013-03-30 17:24:04 +00:00
|
|
|
#include <gr_basic.h>
|
2017-02-22 16:54:01 +00:00
|
|
|
#include <class_eda_rect.h>
|
2012-05-04 17:44:42 +00:00
|
|
|
|
2016-06-17 18:00:29 +00:00
|
|
|
class GERBER_FILE_IMAGE_LIST;
|
|
|
|
|
2012-05-04 17:44:42 +00:00
|
|
|
/**
|
|
|
|
* Class GBR_LAYOUT
|
|
|
|
* holds list of GERBER_DRAW_ITEM currently loaded.
|
|
|
|
*/
|
|
|
|
class GBR_LAYOUT
|
|
|
|
{
|
|
|
|
private:
|
2014-06-27 17:07:42 +00:00
|
|
|
EDA_RECT m_BoundingBox;
|
|
|
|
TITLE_BLOCK m_titles;
|
|
|
|
wxPoint m_originAxisPosition;
|
2016-06-02 09:30:39 +00:00
|
|
|
std::vector<int> m_printLayersList; // When printing: the list of graphic layers Id to print
|
|
|
|
|
2012-05-04 17:44:42 +00:00
|
|
|
public:
|
|
|
|
|
|
|
|
GBR_LAYOUT();
|
|
|
|
~GBR_LAYOUT();
|
|
|
|
|
2016-06-17 18:00:29 +00:00
|
|
|
// Accessor to the GERBER_FILE_IMAGE_LIST,
|
|
|
|
// which handles the list of gerber files (and drill files) images loaded
|
|
|
|
GERBER_FILE_IMAGE_LIST* GetImagesList();
|
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
const wxPoint& GetAuxOrigin() const
|
2012-05-04 17:44:42 +00:00
|
|
|
{
|
|
|
|
return m_originAxisPosition;
|
|
|
|
}
|
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
void SetAuxOrigin( const wxPoint& aPosition )
|
2012-05-04 17:44:42 +00:00
|
|
|
{
|
|
|
|
m_originAxisPosition = aPosition;
|
|
|
|
}
|
|
|
|
|
|
|
|
TITLE_BLOCK& GetTitleBlock()
|
|
|
|
{
|
|
|
|
return m_titles;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock )
|
|
|
|
{
|
|
|
|
m_titles = aTitleBlock;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function ComputeBoundingBox
|
|
|
|
* calculates the bounding box containing all Gerber items.
|
|
|
|
* @return EDA_RECT - the full item list bounding box
|
|
|
|
*/
|
|
|
|
EDA_RECT ComputeBoundingBox();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetBoundingBox
|
|
|
|
* may be called soon after ComputeBoundingBox() to return the same EDA_RECT,
|
|
|
|
* as long as the CLASS_GBR_LAYOUT has not changed.
|
|
|
|
*/
|
|
|
|
EDA_RECT GetBoundingBox() const { return m_BoundingBox; } // override
|
|
|
|
|
|
|
|
void SetBoundingBox( const EDA_RECT& aBox ) { m_BoundingBox = aBox; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function Draw.
|
|
|
|
* Redraw the CLASS_GBR_LAYOUT items but not cursors, axis or grid.
|
2016-06-02 09:30:39 +00:00
|
|
|
* @param aPanel = the draw canvas
|
2012-05-04 17:44:42 +00:00
|
|
|
* @param aDC = the current device context
|
|
|
|
* @param aDrawMode = GR_COPY, GR_OR ... (not always used)
|
|
|
|
* @param aOffset = an draw offset value
|
2016-06-02 09:30:39 +00:00
|
|
|
* @param aDisplayOptions = a GBR_DISPLAY_OPTIONS for draw/print display opts
|
2012-05-04 17:44:42 +00:00
|
|
|
*/
|
2015-03-26 17:23:17 +00:00
|
|
|
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
|
|
|
|
GR_DRAWMODE aDrawMode, const wxPoint& aOffset,
|
2016-06-02 09:30:39 +00:00
|
|
|
GBR_DISPLAY_OPTIONS* aDisplayOptions );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function DrawItemsDCodeID
|
|
|
|
* Draw the DCode value (if exists) corresponding to gerber item
|
|
|
|
* (polygons do not have a DCode)
|
|
|
|
* @param aPanel = the draw canvas
|
|
|
|
* @param aDC = the current device context
|
|
|
|
* @param aDrawMode = GR_COPY, GR_OR ...
|
|
|
|
* @param aDrawColor = the color of dcode texts
|
|
|
|
*/
|
|
|
|
void DrawItemsDCodeID( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
|
2017-02-20 16:57:41 +00:00
|
|
|
GR_DRAWMODE aDrawMode, COLOR4D aDrawColor );
|
2016-06-02 09:30:39 +00:00
|
|
|
|
|
|
|
|
2012-05-04 17:44:42 +00:00
|
|
|
/**
|
2014-06-27 17:07:42 +00:00
|
|
|
* Function SetPrintableLayers
|
|
|
|
* changes the list of printable layers
|
|
|
|
* @param aLayerMask = The new bit-mask of printable layers
|
2012-05-04 17:44:42 +00:00
|
|
|
*/
|
2016-06-02 09:30:39 +00:00
|
|
|
void SetPrintableLayers( const std::vector<int>& aLayerList )
|
2012-05-04 17:44:42 +00:00
|
|
|
{
|
2016-06-02 09:30:39 +00:00
|
|
|
m_printLayersList = aLayerList;
|
2012-05-04 17:44:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-06-27 17:07:42 +00:00
|
|
|
* Function GetPrintableLayers
|
|
|
|
* @return the bit-mask of printable layers
|
|
|
|
*/
|
2016-06-02 09:30:39 +00:00
|
|
|
std::vector<int> GetPrintableLayers()
|
|
|
|
{
|
|
|
|
return m_printLayersList;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function ClearPrintableLayers
|
|
|
|
*/
|
|
|
|
void ClearPrintableLayers()
|
|
|
|
{
|
|
|
|
m_printLayersList.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function AddLayerToPrintableList
|
|
|
|
*/
|
|
|
|
void AddLayerToPrintableList( int aLayer)
|
2014-06-27 17:07:42 +00:00
|
|
|
{
|
2016-06-02 09:30:39 +00:00
|
|
|
m_printLayersList.push_back( aLayer );
|
2014-06-27 17:07:42 +00:00
|
|
|
}
|
|
|
|
|
2016-06-02 09:30:39 +00:00
|
|
|
|
2014-06-27 17:07:42 +00:00
|
|
|
/**
|
|
|
|
* Function IsLayerPrintable
|
2012-05-04 17:44:42 +00:00
|
|
|
* tests whether a given layer is visible
|
2013-04-09 16:00:46 +00:00
|
|
|
* @param aLayer = The layer to be tested
|
2016-06-02 09:30:39 +00:00
|
|
|
* @return bool - true if the layer is in print list.
|
2012-05-04 17:44:42 +00:00
|
|
|
*/
|
2016-06-02 09:30:39 +00:00
|
|
|
bool IsLayerPrintable( int aLayer ) const;
|
2012-05-04 17:44:42 +00:00
|
|
|
|
|
|
|
#if defined(DEBUG)
|
|
|
|
void Show( int nestLevel, std::ostream& os ) const; // overload
|
|
|
|
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // #ifndef CLASS_GBR_LAYOUT_H
|