Explicit control over hidden text in bounding boxes.
In particular, don't consider hidden text when plotting, and only when AsItemCheckboxes is checked for printing. Fixes https://gitlab.com/kicad/code/kicad/-/issues/17958
This commit is contained in:
parent
24f02e72d0
commit
8184ed64e7
|
@ -344,7 +344,7 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
|
|||
BOX2I bbbox;
|
||||
|
||||
if( m_board )
|
||||
bbbox = m_board->ComputeBoundingBox( !m_board->IsFootprintHolder() && haveOutline );
|
||||
bbbox = m_board->ComputeBoundingBox( !m_board->IsFootprintHolder() && haveOutline, false );
|
||||
|
||||
// Gives a non null size to avoid issues in zoom / scale calculations
|
||||
if( ( bbbox.GetWidth() == 0 ) && ( bbbox.GetHeight() == 0 ) )
|
||||
|
|
|
@ -1552,17 +1552,13 @@ unsigned BOARD::GetNodesCount( int aNet ) const
|
|||
}
|
||||
|
||||
|
||||
BOX2I BOARD::ComputeBoundingBox( bool aBoardEdgesOnly ) const
|
||||
BOX2I BOARD::ComputeBoundingBox( bool aBoardEdgesOnly, bool aIncludeHiddenText ) const
|
||||
{
|
||||
BOX2I bbox;
|
||||
LSET visible = GetVisibleLayers();
|
||||
bool showHiddenText = IsElementVisible( LAYER_HIDDEN_TEXT );
|
||||
|
||||
if( PgmOrNull() && PgmOrNull()->m_Printing )
|
||||
showHiddenText = false;
|
||||
|
||||
// If the board is just showing a footprint, we want all footprint layers
|
||||
// included in the bounding box
|
||||
// If the board is just showing a footprint, we want all footprint layers included in the
|
||||
// bounding box
|
||||
if( IsFootprintHolder() )
|
||||
visible.set();
|
||||
|
||||
|
@ -1595,7 +1591,7 @@ BOX2I BOARD::ComputeBoundingBox( bool aBoardEdgesOnly ) const
|
|||
}
|
||||
else
|
||||
{
|
||||
bbox.Merge( footprint->GetBoundingBox( true, showHiddenText ) );
|
||||
bbox.Merge( footprint->GetBoundingBox( true, aIncludeHiddenText ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -892,11 +892,11 @@ public:
|
|||
* @param aBoardEdgesOnly is true if we are interested in board edge segments only.
|
||||
* @return the board's bounding box.
|
||||
*/
|
||||
BOX2I ComputeBoundingBox( bool aBoardEdgesOnly = false ) const;
|
||||
BOX2I ComputeBoundingBox( bool aBoardEdgesOnly, bool aIncludeHiddenText ) const;
|
||||
|
||||
const BOX2I GetBoundingBox() const override
|
||||
{
|
||||
return ComputeBoundingBox( false );
|
||||
return ComputeBoundingBox( false, IsElementVisible( LAYER_HIDDEN_TEXT ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -910,7 +910,7 @@ public:
|
|||
*/
|
||||
const BOX2I GetBoardEdgesBoundingBox() const
|
||||
{
|
||||
return ComputeBoundingBox( true );
|
||||
return ComputeBoundingBox( true, false );
|
||||
}
|
||||
|
||||
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
||||
|
|
|
@ -821,7 +821,7 @@ bool BuildBoardPolygonOutlines( BOARD* aBoard, SHAPE_POLY_SET& aOutlines, int aE
|
|||
|
||||
// If null area, uses the global bounding box.
|
||||
if( ( bbbox.GetWidth() ) == 0 || ( bbbox.GetHeight() == 0 ) )
|
||||
bbbox = aBoard->ComputeBoundingBox();
|
||||
bbbox = aBoard->ComputeBoundingBox( false, false );
|
||||
|
||||
// Ensure non null area. If happen, gives a minimal size.
|
||||
if( ( bbbox.GetWidth() ) == 0 || ( bbbox.GetHeight() == 0 ) )
|
||||
|
@ -881,7 +881,7 @@ void buildBoardBoundingBoxPoly( const BOARD* aBoard, SHAPE_POLY_SET& aOutline )
|
|||
|
||||
// If null area, uses the global bounding box.
|
||||
if( ( bbbox.GetWidth() ) == 0 || ( bbbox.GetHeight() == 0 ) )
|
||||
bbbox = aBoard->ComputeBoundingBox();
|
||||
bbbox = aBoard->ComputeBoundingBox( false, false );
|
||||
|
||||
// Ensure non null area. If happen, gives a minimal size.
|
||||
if( ( bbbox.GetWidth() ) == 0 || ( bbbox.GetHeight() == 0 ) )
|
||||
|
|
|
@ -560,7 +560,7 @@ void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent )
|
|||
|
||||
case STEP_ORIGIN_BOARD_CENTER:
|
||||
{
|
||||
BOX2I bbox = m_parent->GetBoard()->ComputeBoundingBox( true );
|
||||
BOX2I bbox = m_parent->GetBoard()->ComputeBoundingBox( true, false );
|
||||
double xOrg = pcbIUScale.IUTomm( bbox.GetCenter().x );
|
||||
double yOrg = pcbIUScale.IUTomm( bbox.GetCenter().y );
|
||||
LOCALE_IO dummy;
|
||||
|
|
|
@ -264,7 +264,7 @@ void PCB_EDIT_FRAME::OnExportVRML( wxCommandEvent& event )
|
|||
{
|
||||
// Origin = board center:
|
||||
BOARD* pcb = GetBoard();
|
||||
BOX2I bbox = pcb->ComputeBoundingBox( true );
|
||||
BOX2I bbox = pcb->ComputeBoundingBox( true, false );
|
||||
aXRef = pcbIUScale.IUTomm( bbox.GetCenter().x );
|
||||
aYRef = pcbIUScale.IUTomm( bbox.GetCenter().y );
|
||||
}
|
||||
|
|
|
@ -204,7 +204,7 @@ bool GENCAD_EXPORTER::WriteFile( wxString& aFullFileName )
|
|||
|
||||
BOARD* pcb = m_board;
|
||||
// Update some board data, to ensure a reliable gencad export
|
||||
pcb->ComputeBoundingBox();
|
||||
pcb->ComputeBoundingBox( false, false );
|
||||
|
||||
/* Temporary modification of footprints that are flipped (i.e. on bottom
|
||||
* layer) to convert them to non flipped footprints.
|
||||
|
|
|
@ -63,7 +63,7 @@ bool EXPORT_SVG::Plot( BOARD* aBoard, const PCB_PLOT_SVG_OPTIONS& aSvgPlotOption
|
|||
|
||||
if( aSvgPlotOptions.m_pageSizeMode == 2 ) // Page is board boundary size
|
||||
{
|
||||
BOX2I bbox = aBoard->ComputeBoundingBox();
|
||||
BOX2I bbox = aBoard->ComputeBoundingBox( false, false );
|
||||
PAGE_INFO currpageInfo = aBoard->GetPageSettings();
|
||||
|
||||
currpageInfo.SetWidthMils( bbox.GetWidth() / pcbIUScale.IU_PER_MILS );
|
||||
|
|
|
@ -309,7 +309,7 @@ std::string PLACE_FILE_EXPORTER::GenReportData()
|
|||
|
||||
buffer += "\n$BeginDESCRIPTION\n";
|
||||
|
||||
BOX2I bbbox = m_board->ComputeBoundingBox();
|
||||
BOX2I bbbox = m_board->ComputeBoundingBox( false, false );
|
||||
|
||||
buffer += "\n$BOARD\n";
|
||||
|
||||
|
|
|
@ -241,7 +241,7 @@ BOARD* PCB_IO_EASYEDA::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
|
|||
parser.ParseBoard( m_board, origin, m_loadedFootprints, doc.shape );
|
||||
|
||||
// Center the board
|
||||
BOX2I outlineBbox = m_board->ComputeBoundingBox( true );
|
||||
BOX2I outlineBbox = m_board->ComputeBoundingBox( true, false );
|
||||
PAGE_INFO pageInfo = m_board->GetPageSettings();
|
||||
|
||||
VECTOR2D pageCenter( pcbIUScale.MilsToIU( pageInfo.GetWidthMils() / 2 ),
|
||||
|
|
|
@ -1819,7 +1819,7 @@ void PCB_IO_EASYEDAPRO_PARSER::ParseBoard(
|
|||
aBoard->Add( ptr.release(), ADD_MODE::APPEND );
|
||||
|
||||
// Center the board
|
||||
BOX2I outlineBbox = aBoard->ComputeBoundingBox( true );
|
||||
BOX2I outlineBbox = aBoard->ComputeBoundingBox( true, false );
|
||||
PAGE_INFO pageInfo = aBoard->GetPageSettings();
|
||||
|
||||
VECTOR2D pageCenter( pcbIUScale.MilsToIU( pageInfo.GetWidthMils() / 2 ),
|
||||
|
|
|
@ -166,7 +166,7 @@ int PCBNEW_JOBS_HANDLER::JobExportStep( JOB* aJob )
|
|||
|
||||
if( !aStepJob->m_hasUserOrigin )
|
||||
{
|
||||
BOX2I bbox = brd->ComputeBoundingBox( true );
|
||||
BOX2I bbox = brd->ComputeBoundingBox( true, false );
|
||||
originX = pcbIUScale.IUTomm( bbox.GetCenter().x );
|
||||
originY = pcbIUScale.IUTomm( bbox.GetCenter().y );
|
||||
}
|
||||
|
|
|
@ -288,7 +288,10 @@ void PCBNEW_PRINTOUT::setupGal( KIGFX::GAL* aGal )
|
|||
|
||||
BOX2I PCBNEW_PRINTOUT::getBoundingBox()
|
||||
{
|
||||
return m_board->ComputeBoundingBox();
|
||||
bool showHiddenText = m_pcbnewSettings.m_AsItemCheckboxes
|
||||
&& m_board->IsElementVisible( LAYER_HIDDEN_TEXT );
|
||||
|
||||
return m_board->ComputeBoundingBox( false, showHiddenText );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1061,7 +1061,7 @@ static void initializePlotter( PLOTTER* aPlotter, const BOARD* aBoard,
|
|||
autocenter = (aPlotOpts->GetScale() != 1.0);
|
||||
}
|
||||
|
||||
BOX2I bbox = aBoard->ComputeBoundingBox();
|
||||
BOX2I bbox = aBoard->ComputeBoundingBox( false, false );
|
||||
VECTOR2I boardCenter = bbox.Centre();
|
||||
VECTOR2I boardSize = bbox.GetSize();
|
||||
|
||||
|
@ -1266,7 +1266,7 @@ PLOTTER* StartPlotBoard( BOARD *aBoard, const PCB_PLOT_PARAMS *aPlotOpts, int aL
|
|||
// done in the driver (if supported)
|
||||
if( aPlotOpts->GetNegative() )
|
||||
{
|
||||
BOX2I bbox = aBoard->ComputeBoundingBox();
|
||||
BOX2I bbox = aBoard->ComputeBoundingBox( false, false );
|
||||
FillNegativeKnockout( plotter, bbox );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue