2018-09-19 13:06:29 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2009 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
2023-03-13 11:25:30 +00:00
|
|
|
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
2018-09-19 13:06:29 +00:00
|
|
|
* Copyright (C) 2018 CERN
|
|
|
|
* Author: Maciej Suminski <maciej.suminski@cern.ch>
|
|
|
|
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "pcbnew_printout.h"
|
2020-11-12 20:19:22 +00:00
|
|
|
#include <board.h>
|
2020-01-07 17:12:59 +00:00
|
|
|
#include <math/util.h> // for KiROUND
|
2023-09-18 23:52:27 +00:00
|
|
|
#include <gal/graphics_abstraction_layer.h>
|
2018-09-19 13:06:29 +00:00
|
|
|
#include <pcb_painter.h>
|
2020-01-13 01:44:19 +00:00
|
|
|
#include <pcbnew_settings.h>
|
2018-09-28 08:10:08 +00:00
|
|
|
#include <view/view.h>
|
2018-10-05 14:41:17 +00:00
|
|
|
#include <pcbplot.h>
|
2022-11-12 14:23:46 +00:00
|
|
|
#include <geometry/shape_segment.h>
|
|
|
|
#include <pad.h>
|
|
|
|
|
2021-01-04 22:26:23 +00:00
|
|
|
#include <advanced_config.h>
|
2018-09-19 13:06:29 +00:00
|
|
|
|
2023-03-13 11:25:30 +00:00
|
|
|
PCBNEW_PRINTOUT_SETTINGS::PCBNEW_PRINTOUT_SETTINGS( const PAGE_INFO& aPageInfo ) :
|
|
|
|
BOARD_PRINTOUT_SETTINGS( aPageInfo )
|
2018-10-05 14:41:17 +00:00
|
|
|
{
|
2022-11-12 07:48:25 +00:00
|
|
|
m_DrillMarks = DRILL_MARKS::SMALL_DRILL_SHAPE;
|
2021-04-16 12:12:55 +00:00
|
|
|
m_Pagination = ALL_LAYERS;
|
|
|
|
m_PrintEdgeCutsOnAllPages = true;
|
|
|
|
m_AsItemCheckboxes = false;
|
2018-10-05 14:41:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
void PCBNEW_PRINTOUT_SETTINGS::Load( APP_SETTINGS_BASE* aConfig )
|
2018-10-05 14:41:17 +00:00
|
|
|
{
|
|
|
|
BOARD_PRINTOUT_SETTINGS::Load( aConfig );
|
2020-01-13 01:44:19 +00:00
|
|
|
|
2022-10-21 17:41:21 +00:00
|
|
|
if( PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aConfig ) )
|
2020-01-13 01:44:19 +00:00
|
|
|
{
|
2022-11-12 07:48:25 +00:00
|
|
|
m_DrillMarks = static_cast<DRILL_MARKS>( cfg->m_Plot.pads_drill_mode );
|
2021-04-16 12:12:55 +00:00
|
|
|
m_Pagination = static_cast<PAGINATION_T>( cfg->m_Plot.all_layers_on_one_page );
|
2021-12-19 15:43:02 +00:00
|
|
|
m_PrintEdgeCutsOnAllPages = cfg->m_Plot.edgecut_on_all_layers;
|
2023-11-05 16:22:20 +00:00
|
|
|
m_Mirror = cfg->m_Plot.mirror;
|
|
|
|
m_AsItemCheckboxes = cfg->m_Plot.as_item_checkboxes;
|
2020-01-13 01:44:19 +00:00
|
|
|
}
|
2018-10-05 14:41:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
void PCBNEW_PRINTOUT_SETTINGS::Save( APP_SETTINGS_BASE* aConfig )
|
2018-10-05 14:41:17 +00:00
|
|
|
{
|
|
|
|
BOARD_PRINTOUT_SETTINGS::Save( aConfig );
|
2020-01-13 01:44:19 +00:00
|
|
|
|
2022-10-21 17:41:21 +00:00
|
|
|
if( PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aConfig ) )
|
2020-01-13 01:44:19 +00:00
|
|
|
{
|
2022-11-12 07:48:25 +00:00
|
|
|
cfg->m_Plot.pads_drill_mode = (int)m_DrillMarks;
|
2021-04-16 12:12:55 +00:00
|
|
|
cfg->m_Plot.all_layers_on_one_page = m_Pagination;
|
2021-12-19 15:43:02 +00:00
|
|
|
cfg->m_Plot.edgecut_on_all_layers = m_PrintEdgeCutsOnAllPages;
|
2020-11-16 11:16:44 +00:00
|
|
|
cfg->m_Plot.mirror = m_Mirror;
|
2023-11-05 16:22:20 +00:00
|
|
|
cfg->m_Plot.as_item_checkboxes = m_AsItemCheckboxes;
|
2020-01-13 01:44:19 +00:00
|
|
|
}
|
2018-10-05 14:41:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
PCBNEW_PRINTOUT::PCBNEW_PRINTOUT( BOARD* aBoard, const PCBNEW_PRINTOUT_SETTINGS& aParams,
|
2022-10-21 17:41:21 +00:00
|
|
|
const KIGFX::VIEW* aView, const wxString& aTitle ) :
|
2023-03-13 11:25:30 +00:00
|
|
|
BOARD_PRINTOUT( aParams, aView, aTitle ), m_pcbnewSettings( aParams )
|
2018-09-19 13:06:29 +00:00
|
|
|
{
|
|
|
|
m_board = aBoard;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool PCBNEW_PRINTOUT::OnPrintPage( int aPage )
|
|
|
|
{
|
2020-04-20 16:00:00 +00:00
|
|
|
// Store the layerset, as it is going to be modified below and the original settings are
|
|
|
|
// needed.
|
2020-11-16 11:16:44 +00:00
|
|
|
LSET lset = m_settings.m_LayerSet;
|
2020-08-30 21:20:37 +00:00
|
|
|
int pageCount = lset.count();
|
|
|
|
wxString layerName;
|
2018-09-19 13:06:29 +00:00
|
|
|
PCB_LAYER_ID extractLayer;
|
|
|
|
|
|
|
|
// compute layer mask from page number if we want one page per layer
|
2021-04-16 12:12:55 +00:00
|
|
|
if( m_pcbnewSettings.m_Pagination == PCBNEW_PRINTOUT_SETTINGS::LAYER_PER_PAGE )
|
2018-09-19 13:06:29 +00:00
|
|
|
{
|
2020-04-20 16:00:00 +00:00
|
|
|
// This sequence is TBD, call a different sequencer if needed, such as Seq().
|
|
|
|
// Could not find documentation on page order.
|
2018-09-19 13:06:29 +00:00
|
|
|
LSEQ seq = lset.UIOrder();
|
|
|
|
|
|
|
|
// aPage starts at 1, not 0
|
|
|
|
if( unsigned( aPage - 1 ) < seq.size() )
|
2020-11-16 11:16:44 +00:00
|
|
|
m_settings.m_LayerSet = LSET( seq[ aPage - 1] );
|
2018-09-19 13:06:29 +00:00
|
|
|
}
|
|
|
|
|
2020-11-16 11:16:44 +00:00
|
|
|
if( !m_settings.m_LayerSet.any() )
|
2018-09-19 13:06:29 +00:00
|
|
|
return false;
|
|
|
|
|
2020-11-16 11:16:44 +00:00
|
|
|
extractLayer = m_settings.m_LayerSet.ExtractLayer();
|
2018-09-19 13:06:29 +00:00
|
|
|
|
|
|
|
if( extractLayer == UNDEFINED_LAYER )
|
2020-08-30 21:20:37 +00:00
|
|
|
layerName = _( "Multiple Layers" );
|
2018-09-19 13:06:29 +00:00
|
|
|
else
|
2022-06-10 13:09:22 +00:00
|
|
|
layerName = m_board->GetLayerName( extractLayer );
|
2018-09-19 13:06:29 +00:00
|
|
|
|
|
|
|
// In Pcbnew we can want the layer EDGE always printed
|
2021-04-16 12:12:55 +00:00
|
|
|
if( m_pcbnewSettings.m_PrintEdgeCutsOnAllPages )
|
2020-11-16 11:16:44 +00:00
|
|
|
m_settings.m_LayerSet.set( Edge_Cuts );
|
2018-09-19 13:06:29 +00:00
|
|
|
|
2020-08-30 21:20:37 +00:00
|
|
|
DrawPage( layerName, aPage, pageCount );
|
2018-09-19 13:06:29 +00:00
|
|
|
|
2018-09-28 08:10:08 +00:00
|
|
|
// Restore the original layer set, so the next page can be printed
|
2020-11-16 11:16:44 +00:00
|
|
|
m_settings.m_LayerSet = lset;
|
2018-09-19 13:06:29 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-10-06 16:51:46 +00:00
|
|
|
int PCBNEW_PRINTOUT::milsToIU( double aMils ) const
|
|
|
|
{
|
2022-09-16 23:25:07 +00:00
|
|
|
return KiROUND( pcbIUScale.IU_PER_MILS * aMils );
|
2018-10-06 16:51:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-01-17 11:56:07 +00:00
|
|
|
void PCBNEW_PRINTOUT::setupViewLayers( KIGFX::VIEW& aView, const LSET& aLayerSet )
|
2018-09-28 08:10:08 +00:00
|
|
|
{
|
|
|
|
BOARD_PRINTOUT::setupViewLayers( aView, aLayerSet );
|
|
|
|
|
2021-02-25 13:02:33 +00:00
|
|
|
for( PCB_LAYER_ID layer : m_settings.m_LayerSet.Seq() )
|
2020-08-30 21:20:37 +00:00
|
|
|
{
|
2021-02-25 13:02:33 +00:00
|
|
|
aView.SetLayerVisible( PCBNEW_LAYER_ID_START + layer, true );
|
2018-09-28 08:10:08 +00:00
|
|
|
|
2021-05-19 08:05:49 +00:00
|
|
|
// Enable the corresponding zone layer (copper layers and other layers)
|
|
|
|
aView.SetLayerVisible( LAYER_ZONE_START + layer, true );
|
2020-08-30 21:20:37 +00:00
|
|
|
}
|
|
|
|
|
2021-02-25 13:02:33 +00:00
|
|
|
RENDER_SETTINGS* renderSettings = aView.GetPainter()->GetSettings();
|
2021-08-24 08:27:53 +00:00
|
|
|
// A color to do not print objects on some layers, when the layer must be enabled
|
|
|
|
// to print some other objects
|
2022-03-01 17:26:41 +00:00
|
|
|
COLOR4D invisible_color = COLOR4D::UNSPECIFIED;
|
2021-02-25 13:02:33 +00:00
|
|
|
|
2021-04-16 12:12:55 +00:00
|
|
|
if( m_pcbnewSettings.m_AsItemCheckboxes )
|
2020-08-11 19:41:01 +00:00
|
|
|
{
|
2020-10-19 22:14:46 +00:00
|
|
|
auto setVisibility =
|
|
|
|
[&]( GAL_LAYER_ID aLayer )
|
|
|
|
{
|
|
|
|
if( m_board->IsElementVisible( aLayer ) )
|
2021-02-25 13:02:33 +00:00
|
|
|
aView.SetLayerVisible( aLayer, true );
|
|
|
|
else
|
2021-08-24 08:27:53 +00:00
|
|
|
renderSettings->SetLayerColor( aLayer, invisible_color );
|
2020-10-19 22:14:46 +00:00
|
|
|
};
|
2020-08-11 19:41:01 +00:00
|
|
|
|
2023-08-04 10:13:20 +00:00
|
|
|
setVisibility( LAYER_FOOTPRINTS_FR );
|
|
|
|
setVisibility( LAYER_FOOTPRINTS_BK );
|
|
|
|
setVisibility( LAYER_FP_VALUES );
|
|
|
|
setVisibility( LAYER_FP_REFERENCES );
|
|
|
|
setVisibility( LAYER_FP_TEXT );
|
|
|
|
setVisibility( LAYER_HIDDEN_TEXT );
|
2021-06-25 09:35:17 +00:00
|
|
|
setVisibility( LAYER_PADS );
|
2023-08-04 10:13:20 +00:00
|
|
|
setVisibility( LAYER_PADS_SMD_FR );
|
|
|
|
setVisibility( LAYER_PADS_SMD_BK );
|
2020-08-11 19:41:01 +00:00
|
|
|
setVisibility( LAYER_PADS_TH );
|
|
|
|
|
|
|
|
setVisibility( LAYER_TRACKS );
|
2020-08-24 12:59:58 +00:00
|
|
|
setVisibility( LAYER_VIAS );
|
2021-06-25 09:35:17 +00:00
|
|
|
setVisibility( LAYER_VIA_MICROVIA );
|
|
|
|
setVisibility( LAYER_VIA_BBLIND );
|
|
|
|
setVisibility( LAYER_VIA_THROUGH );
|
|
|
|
setVisibility( LAYER_ZONES );
|
2024-06-27 01:48:00 +00:00
|
|
|
setVisibility( LAYER_SHAPES );
|
2020-08-11 19:41:01 +00:00
|
|
|
|
|
|
|
setVisibility( LAYER_DRC_WARNING );
|
|
|
|
setVisibility( LAYER_DRC_ERROR );
|
|
|
|
setVisibility( LAYER_DRC_EXCLUSION );
|
|
|
|
setVisibility( LAYER_ANCHOR );
|
2021-02-22 16:37:43 +00:00
|
|
|
setVisibility( LAYER_DRAWINGSHEET );
|
2020-08-11 19:41:01 +00:00
|
|
|
setVisibility( LAYER_GRID );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-08-24 08:27:53 +00:00
|
|
|
// Draw layers that must be not visible on printing are set to an invisible layer
|
2023-08-04 10:13:20 +00:00
|
|
|
// LAYER_PADS_SMD_FR, LAYER_PADS_SMD_BK and LAYER_PADS_TH must be enabled to print pads on
|
2021-08-24 08:27:53 +00:00
|
|
|
// technical layers, but not the pad on copper layer(s) if they are not enabled
|
2018-09-28 08:10:08 +00:00
|
|
|
|
2021-08-24 08:27:53 +00:00
|
|
|
if( !aLayerSet.test( F_Cu ) )
|
2023-08-04 10:13:20 +00:00
|
|
|
renderSettings->SetLayerColor( LAYER_PADS_SMD_FR, invisible_color );
|
2021-08-24 08:27:53 +00:00
|
|
|
|
|
|
|
if( !aLayerSet.test( B_Cu ) )
|
2023-08-04 10:13:20 +00:00
|
|
|
renderSettings->SetLayerColor( LAYER_PADS_SMD_BK, invisible_color );
|
2018-09-28 08:10:08 +00:00
|
|
|
|
2021-02-25 13:02:33 +00:00
|
|
|
// Enable items on copper layers, but do not draw holes
|
2022-04-26 19:53:24 +00:00
|
|
|
for( GAL_LAYER_ID layer : { LAYER_PADS_TH, LAYER_VIA_THROUGH, LAYER_VIA_MICROVIA, LAYER_VIA_BBLIND } )
|
2018-09-28 21:45:48 +00:00
|
|
|
{
|
2021-02-25 13:02:33 +00:00
|
|
|
if( ( aLayerSet & LSET::AllCuMask() ).any() ) // Items visible on any copper layer
|
|
|
|
aView.SetLayerVisible( layer, true );
|
|
|
|
else
|
2021-08-24 08:27:53 +00:00
|
|
|
renderSettings->SetLayerColor( layer, invisible_color );
|
2018-09-28 21:45:48 +00:00
|
|
|
}
|
2018-09-28 08:10:08 +00:00
|
|
|
|
2020-08-11 19:41:01 +00:00
|
|
|
// Keep certain items always enabled/disabled and just rely on the layer visibility
|
2023-08-04 10:13:20 +00:00
|
|
|
// Note LAYER_PADS_SMD_FR, LAYER_PADS_SMD_BK, LAYER_PADS_TH are enabled here because paths must
|
2021-08-24 08:27:53 +00:00
|
|
|
// be drawn on some other (technical) layers.
|
2020-10-19 22:14:46 +00:00
|
|
|
const int alwaysEnabled[] =
|
|
|
|
{
|
2023-08-04 10:13:20 +00:00
|
|
|
LAYER_FP_TEXT, LAYER_FP_VALUES, LAYER_FP_REFERENCES,
|
|
|
|
LAYER_FOOTPRINTS_FR, LAYER_FOOTPRINTS_BK,
|
|
|
|
LAYER_TRACKS, LAYER_VIAS,
|
2024-06-27 01:48:00 +00:00
|
|
|
LAYER_ZONES, LAYER_SHAPES,
|
2023-08-04 10:13:20 +00:00
|
|
|
LAYER_PADS, LAYER_PADS_SMD_FR, LAYER_PADS_SMD_BK, LAYER_PADS_TH
|
2020-10-19 22:14:46 +00:00
|
|
|
};
|
2018-09-28 08:10:08 +00:00
|
|
|
|
2021-02-25 13:02:33 +00:00
|
|
|
for( int layer : alwaysEnabled )
|
|
|
|
aView.SetLayerVisible( layer, true );
|
2020-08-11 19:41:01 +00:00
|
|
|
}
|
2020-10-19 22:14:46 +00:00
|
|
|
|
2022-11-12 07:48:25 +00:00
|
|
|
if( m_pcbnewSettings.m_DrillMarks != DRILL_MARKS::NO_DRILL_SHAPE )
|
2020-10-19 22:14:46 +00:00
|
|
|
{
|
|
|
|
// Enable hole layers to draw drill marks
|
2021-02-25 13:02:33 +00:00
|
|
|
for( int layer : { LAYER_PAD_PLATEDHOLES, LAYER_NON_PLATEDHOLES, LAYER_VIA_HOLES } )
|
2020-10-19 22:14:46 +00:00
|
|
|
{
|
2021-02-25 13:02:33 +00:00
|
|
|
aView.SetLayerVisible( layer, true );
|
|
|
|
aView.SetTopLayer( layer, true );
|
2020-10-19 22:14:46 +00:00
|
|
|
}
|
2022-11-12 13:38:02 +00:00
|
|
|
|
|
|
|
if( m_pcbnewSettings.m_DrillMarks == DRILL_MARKS::FULL_DRILL_SHAPE
|
|
|
|
&& !m_settings.m_blackWhite )
|
|
|
|
{
|
|
|
|
for( int layer : { LAYER_PAD_HOLEWALLS, LAYER_VIA_HOLEWALLS } )
|
|
|
|
{
|
|
|
|
aView.SetLayerVisible( layer, true );
|
|
|
|
aView.SetTopLayer( layer, true );
|
|
|
|
}
|
|
|
|
}
|
2020-10-19 22:14:46 +00:00
|
|
|
}
|
2018-09-28 08:10:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-01-17 11:56:07 +00:00
|
|
|
void PCBNEW_PRINTOUT::setupPainter( KIGFX::PAINTER& aPainter )
|
2018-09-28 21:45:48 +00:00
|
|
|
{
|
|
|
|
BOARD_PRINTOUT::setupPainter( aPainter );
|
|
|
|
|
2020-01-17 11:56:07 +00:00
|
|
|
KIGFX::PCB_PRINT_PAINTER& painter = dynamic_cast<KIGFX::PCB_PRINT_PAINTER&>( aPainter );
|
2018-09-28 21:45:48 +00:00
|
|
|
|
2021-04-16 12:12:55 +00:00
|
|
|
switch( m_pcbnewSettings.m_DrillMarks )
|
2018-09-28 21:45:48 +00:00
|
|
|
{
|
2022-11-12 07:48:25 +00:00
|
|
|
case DRILL_MARKS::NO_DRILL_SHAPE:
|
2020-10-19 22:14:46 +00:00
|
|
|
painter.SetDrillMarks( false, 0 );
|
|
|
|
break;
|
2018-09-28 21:45:48 +00:00
|
|
|
|
2022-11-12 07:48:25 +00:00
|
|
|
case DRILL_MARKS::SMALL_DRILL_SHAPE:
|
2022-09-16 11:33:56 +00:00
|
|
|
painter.SetDrillMarks( false, pcbIUScale.mmToIU( ADVANCED_CFG::GetCfg().m_SmallDrillMarkSize ) );
|
2018-09-28 21:45:48 +00:00
|
|
|
|
2021-01-30 14:41:31 +00:00
|
|
|
painter.GetSettings()->SetLayerColor( LAYER_PAD_PLATEDHOLES, COLOR4D::BLACK );
|
2020-10-19 22:14:46 +00:00
|
|
|
painter.GetSettings()->SetLayerColor( LAYER_NON_PLATEDHOLES, COLOR4D::BLACK );
|
2021-01-30 14:41:31 +00:00
|
|
|
painter.GetSettings()->SetLayerColor( LAYER_VIA_HOLES, COLOR4D::BLACK );
|
2020-10-19 22:14:46 +00:00
|
|
|
break;
|
|
|
|
|
2022-11-12 07:48:25 +00:00
|
|
|
case DRILL_MARKS::FULL_DRILL_SHAPE:
|
2020-10-19 22:14:46 +00:00
|
|
|
painter.SetDrillMarks( true );
|
|
|
|
|
2021-01-30 14:41:31 +00:00
|
|
|
painter.GetSettings()->SetLayerColor( LAYER_PAD_PLATEDHOLES, COLOR4D::BLACK );
|
2020-10-19 22:14:46 +00:00
|
|
|
painter.GetSettings()->SetLayerColor( LAYER_NON_PLATEDHOLES, COLOR4D::BLACK );
|
2021-01-30 14:41:31 +00:00
|
|
|
painter.GetSettings()->SetLayerColor( LAYER_VIA_HOLES, COLOR4D::BLACK );
|
2020-10-19 22:14:46 +00:00
|
|
|
break;
|
2018-09-28 21:45:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-09-29 10:13:06 +00:00
|
|
|
void PCBNEW_PRINTOUT::setupGal( KIGFX::GAL* aGal )
|
|
|
|
{
|
2018-10-05 14:41:17 +00:00
|
|
|
BOARD_PRINTOUT::setupGal( aGal );
|
2022-09-17 00:45:14 +00:00
|
|
|
aGal->SetWorldUnitLength( 0.001/pcbIUScale.IU_PER_MM /* 1 nm */ / 0.0254 /* 1 inch in meters */ );
|
2018-09-29 10:13:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-08-30 23:28:18 +00:00
|
|
|
BOX2I PCBNEW_PRINTOUT::getBoundingBox()
|
2018-09-19 13:06:29 +00:00
|
|
|
{
|
2024-05-06 20:34:40 +00:00
|
|
|
bool showHiddenText = m_pcbnewSettings.m_AsItemCheckboxes
|
|
|
|
&& m_board->IsElementVisible( LAYER_HIDDEN_TEXT );
|
|
|
|
|
|
|
|
return m_board->ComputeBoundingBox( false, showHiddenText );
|
2018-09-19 13:06:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
std::unique_ptr<KIGFX::PAINTER> PCBNEW_PRINTOUT::getPainter( KIGFX::GAL* aGal )
|
|
|
|
{
|
2020-10-26 23:49:11 +00:00
|
|
|
return std::make_unique<KIGFX::PCB_PRINT_PAINTER>( aGal );
|
2018-09-28 21:45:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-24 00:38:33 +00:00
|
|
|
KIGFX::PCB_PRINT_PAINTER::PCB_PRINT_PAINTER( GAL* aGal ) :
|
2022-07-24 22:40:47 +00:00
|
|
|
PCB_PAINTER( aGal, FRAME_PCB_EDITOR ),
|
2020-12-24 00:38:33 +00:00
|
|
|
m_drillMarkReal( false ),
|
|
|
|
m_drillMarkSize( 0 )
|
2021-12-26 00:36:12 +00:00
|
|
|
{ }
|
2018-10-08 13:50:59 +00:00
|
|
|
|
|
|
|
|
2024-04-07 22:01:08 +00:00
|
|
|
PAD_DRILL_SHAPE KIGFX::PCB_PRINT_PAINTER::getDrillShape( const PAD* aPad ) const
|
2018-09-28 21:45:48 +00:00
|
|
|
{
|
2024-04-07 22:01:08 +00:00
|
|
|
return m_drillMarkReal ? KIGFX::PCB_PAINTER::getDrillShape( aPad ) : PAD_DRILL_SHAPE::CIRCLE;
|
2018-09-28 21:45:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-11-12 14:23:46 +00:00
|
|
|
SHAPE_SEGMENT KIGFX::PCB_PRINT_PAINTER::getPadHoleShape( const PAD* aPad ) const
|
2018-09-28 21:45:48 +00:00
|
|
|
{
|
2022-11-12 14:23:46 +00:00
|
|
|
if( m_drillMarkReal )
|
2023-03-13 11:25:30 +00:00
|
|
|
return KIGFX::PCB_PAINTER::getPadHoleShape( aPad );
|
2022-11-12 14:23:46 +00:00
|
|
|
else
|
2023-03-13 11:25:30 +00:00
|
|
|
return SHAPE_SEGMENT( aPad->GetPosition(), aPad->GetPosition(), m_drillMarkSize );
|
2018-09-28 21:45:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-11-12 14:23:46 +00:00
|
|
|
int KIGFX::PCB_PRINT_PAINTER::getViaDrillSize( const PCB_VIA* aVia ) const
|
2018-09-28 21:45:48 +00:00
|
|
|
{
|
2022-11-12 14:23:46 +00:00
|
|
|
return m_drillMarkReal ? KIGFX::PCB_PAINTER::getViaDrillSize( aVia ) : m_drillMarkSize;
|
2018-09-19 13:06:29 +00:00
|
|
|
}
|