mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-11 15:40:10 +00:00
Don't render thickness walls of text we're not going to draw.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20200
This commit is contained in:
parent
b6743653f3
commit
f00947266f
@ -188,23 +188,23 @@ void BOARD_ADAPTER::addShape( const PCB_DIMENSION_BASE* aDimension, CONTAINER_2D
|
||||
|
||||
void BOARD_ADAPTER::addFootprintShapes( const FOOTPRINT* aFootprint, CONTAINER_2D_BASE* aContainer,
|
||||
PCB_LAYER_ID aLayerId,
|
||||
const std::bitset<LAYER_3D_END>& aVisibilityFlags )
|
||||
const std::bitset<LAYER_3D_END>& aFlags )
|
||||
{
|
||||
KIGFX::GAL_DISPLAY_OPTIONS empty_opts;
|
||||
|
||||
for( PCB_FIELD* field : aFootprint->GetFields() )
|
||||
{
|
||||
if( field->GetLayer() == aLayerId && field->IsVisible() )
|
||||
{
|
||||
if( !aVisibilityFlags.test( LAYER_FP_TEXT ) )
|
||||
continue;
|
||||
else if( field->IsReference() && !aVisibilityFlags.test( LAYER_FP_REFERENCES ) )
|
||||
continue;
|
||||
else if( field->IsValue() && !aVisibilityFlags.test( LAYER_FP_VALUES ) )
|
||||
continue;
|
||||
if( !aFlags.test( LAYER_FP_TEXT ) )
|
||||
continue;
|
||||
|
||||
if( field->IsReference() && !aFlags.test( LAYER_FP_REFERENCES ) )
|
||||
continue;
|
||||
|
||||
if( field->IsValue() && !aFlags.test( LAYER_FP_VALUES ) )
|
||||
continue;
|
||||
|
||||
if( field->GetLayer() == aLayerId && field->IsVisible() )
|
||||
addText( field, aContainer, field );
|
||||
}
|
||||
}
|
||||
|
||||
for( BOARD_ITEM* item : aFootprint->GraphicalItems() )
|
||||
@ -215,19 +215,17 @@ void BOARD_ADAPTER::addFootprintShapes( const FOOTPRINT* aFootprint, CONTAINER_2
|
||||
{
|
||||
PCB_TEXT* text = static_cast<PCB_TEXT*>( item );
|
||||
|
||||
if( text->GetLayer() == aLayerId )
|
||||
{
|
||||
if( !aVisibilityFlags.test( LAYER_FP_TEXT ) )
|
||||
continue;
|
||||
else if( text->GetText() == wxT( "${REFERENCE}" )
|
||||
&& !aVisibilityFlags.test( LAYER_FP_REFERENCES ) )
|
||||
continue;
|
||||
else if( text->GetText() == wxT( "${VALUE}" )
|
||||
&& !aVisibilityFlags.test( LAYER_FP_VALUES ) )
|
||||
continue;
|
||||
if( !aFlags.test( LAYER_FP_TEXT ) )
|
||||
continue;
|
||||
|
||||
if( text->GetText() == wxT( "${REFERENCE}" ) && !aFlags.test( LAYER_FP_REFERENCES ) )
|
||||
continue;
|
||||
|
||||
if( text->GetText() == wxT( "${VALUE}" ) && !aFlags.test( LAYER_FP_VALUES ) )
|
||||
continue;
|
||||
|
||||
if( text->GetLayer() == aLayerId )
|
||||
addText( text, aContainer, text );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@ -283,7 +281,7 @@ void BOARD_ADAPTER::addFootprintShapes( const FOOTPRINT* aFootprint, CONTAINER_2
|
||||
}
|
||||
|
||||
|
||||
void BOARD_ADAPTER::createTrackWithMargin( const PCB_TRACK* aTrack,
|
||||
void BOARD_ADAPTER::createTrackWithMargin( const PCB_TRACK* aTrack,
|
||||
CONTAINER_2D_BASE* aDstContainer, PCB_LAYER_ID aLayer,
|
||||
int aMargin )
|
||||
{
|
||||
|
@ -103,6 +103,68 @@ void transformFPShapesToPolySet( const FOOTPRINT* aFootprint, PCB_LAYER_ID aLaye
|
||||
}
|
||||
|
||||
|
||||
void transformFPTextToPolySet( const FOOTPRINT* aFootprint, PCB_LAYER_ID aLayer,
|
||||
const std::bitset<LAYER_3D_END>& aFlags, SHAPE_POLY_SET& aBuffer,
|
||||
int aMaxError, ERROR_LOC aErrorLoc )
|
||||
{
|
||||
for( BOARD_ITEM* item : aFootprint->GraphicalItems() )
|
||||
{
|
||||
if( item->GetLayer() != aLayer )
|
||||
continue;
|
||||
|
||||
if( item->Type() == PCB_TEXT_T )
|
||||
{
|
||||
PCB_TEXT* text = static_cast<PCB_TEXT*>( item );
|
||||
|
||||
if( !aFlags.test( LAYER_FP_TEXT ) )
|
||||
continue;
|
||||
|
||||
if( text->GetText() == wxT( "${REFERENCE}" ) && !aFlags.test( LAYER_FP_REFERENCES ) )
|
||||
continue;
|
||||
|
||||
if( text->GetText() == wxT( "${VALUE}" ) && !aFlags.test( LAYER_FP_VALUES ) )
|
||||
continue;
|
||||
|
||||
if( aLayer != UNDEFINED_LAYER && text->GetLayer() == aLayer )
|
||||
text->TransformTextToPolySet( aBuffer, 0, aMaxError, aErrorLoc );
|
||||
}
|
||||
|
||||
if( item->Type() == PCB_TEXTBOX_T )
|
||||
{
|
||||
PCB_TEXTBOX* textbox = static_cast<PCB_TEXTBOX*>( item );
|
||||
|
||||
if( aLayer != UNDEFINED_LAYER && textbox->GetLayer() == aLayer )
|
||||
{
|
||||
// border
|
||||
if( textbox->IsBorderEnabled() )
|
||||
{
|
||||
textbox->PCB_SHAPE::TransformShapeToPolygon( aBuffer, aLayer, 0, aMaxError,
|
||||
aErrorLoc );
|
||||
}
|
||||
|
||||
// text
|
||||
textbox->TransformTextToPolySet( aBuffer, 0, aMaxError, aErrorLoc );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for( const PCB_FIELD* field : aFootprint->GetFields() )
|
||||
{
|
||||
if( !aFlags.test( LAYER_FP_TEXT ) )
|
||||
continue;
|
||||
|
||||
if( field->IsReference() && !aFlags.test( LAYER_FP_REFERENCES ) )
|
||||
continue;
|
||||
|
||||
if( field->IsValue() && !aFlags.test( LAYER_FP_VALUES ) )
|
||||
continue;
|
||||
|
||||
if( field->GetLayer() == aLayer && field->IsVisible() )
|
||||
field->TransformTextToPolySet( aBuffer, 0, aMaxError, aErrorLoc );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BOARD_ADAPTER::destroyLayers()
|
||||
{
|
||||
#define DELETE_AND_FREE( ptr ) \
|
||||
@ -1027,14 +1089,14 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
}
|
||||
else
|
||||
{
|
||||
footprint->TransformPadsToPolySet( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
|
||||
footprint->TransformPadsToPolySet( *layerPoly, layer, 0, maxError,
|
||||
ERROR_INSIDE );
|
||||
}
|
||||
|
||||
// On tech layers, use a poor circle approximation, only for texts (stroke font)
|
||||
footprint->TransformFPTextToPolySet( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
|
||||
|
||||
// Add the remaining things with dynamic seg count for circles
|
||||
transformFPShapesToPolySet( footprint, layer, *layerPoly, maxError, ERROR_INSIDE );
|
||||
transformFPTextToPolySet( footprint, layer, visibilityFlags, *layerPoly, maxError,
|
||||
ERROR_INSIDE );
|
||||
transformFPShapesToPolySet( footprint, layer, *layerPoly, maxError,
|
||||
ERROR_INSIDE );
|
||||
}
|
||||
|
||||
if( cfg.show_zones || layer == F_Mask || layer == B_Mask )
|
||||
|
@ -3911,8 +3911,6 @@ void FOOTPRINT::TransformFPShapesToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_I
|
||||
bool aIncludeText, bool aIncludeShapes,
|
||||
bool aIncludePrivateItems ) const
|
||||
{
|
||||
std::vector<const PCB_TEXT*> texts; // List of PCB_TEXTs to convert
|
||||
|
||||
for( BOARD_ITEM* item : GraphicalItems() )
|
||||
{
|
||||
if( GetPrivateLayers().test( item->GetLayer() ) && !aIncludePrivateItems )
|
||||
@ -3923,7 +3921,7 @@ void FOOTPRINT::TransformFPShapesToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_I
|
||||
PCB_TEXT* text = static_cast<PCB_TEXT*>( item );
|
||||
|
||||
if( aLayer != UNDEFINED_LAYER && text->GetLayer() == aLayer )
|
||||
texts.push_back( text );
|
||||
text->TransformTextToPolySet( aBuffer, aClearance, aError, aErrorLoc );
|
||||
}
|
||||
|
||||
if( item->Type() == PCB_TEXTBOX_T && aIncludeText )
|
||||
@ -3934,7 +3932,11 @@ void FOOTPRINT::TransformFPShapesToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_I
|
||||
{
|
||||
// border
|
||||
if( textbox->IsBorderEnabled() )
|
||||
textbox->PCB_SHAPE::TransformShapeToPolygon( aBuffer, aLayer, 0, aError, aErrorLoc );
|
||||
{
|
||||
textbox->PCB_SHAPE::TransformShapeToPolygon( aBuffer, aLayer, 0, aError,
|
||||
aErrorLoc );
|
||||
}
|
||||
|
||||
// text
|
||||
textbox->TransformTextToPolySet( aBuffer, 0, aError, aErrorLoc );
|
||||
}
|
||||
@ -3954,12 +3956,9 @@ void FOOTPRINT::TransformFPShapesToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_I
|
||||
for( const PCB_FIELD* field : m_fields )
|
||||
{
|
||||
if( field->GetLayer() == aLayer && field->IsVisible() )
|
||||
texts.push_back( field );
|
||||
field->TransformTextToPolySet( aBuffer, aClearance, aError, aErrorLoc );
|
||||
}
|
||||
}
|
||||
|
||||
for( const PCB_TEXT* text : texts )
|
||||
text->TransformTextToPolySet( aBuffer, aClearance, aError, aErrorLoc );
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user