Browse Source

Include both text shapes and border shapes in textbox.

Fixes https://gitlab.com/kicad/code/kicad/issues/11806
7.0
Jeff Young 3 years ago
parent
commit
032708860b
  1. 19
      libs/kimath/include/geometry/shape_compound.h
  2. 7
      pcbnew/fp_textbox.cpp
  3. 8
      pcbnew/pcb_textbox.cpp

19
libs/kimath/include/geometry/shape_compound.h

@ -98,6 +98,25 @@ public:
m_dirty = true;
}
void AddShape( std::shared_ptr<SHAPE> aShape )
{
// Don't make clients deal with nested SHAPE_COMPOUNDs
if( aShape->HasIndexableSubshapes() )
{
std::vector<const SHAPE*> subshapes;
aShape->GetIndexableSubshapes( subshapes );
for( const SHAPE* subshape : subshapes )
m_shapes.push_back( subshape->Clone() );
}
else
{
m_shapes.push_back( aShape->Clone() );
}
m_dirty = true;
}
bool Empty() const
{
return m_shapes.empty();

7
pcbnew/fp_textbox.cpp

@ -435,7 +435,12 @@ wxString FP_TEXTBOX::GetShownText( int aDepth ) const
std::shared_ptr<SHAPE> FP_TEXTBOX::GetEffectiveShape( PCB_LAYER_ID aLayer, FLASHING aFlash ) const
{
return GetEffectiveTextShape();
std::shared_ptr<SHAPE_COMPOUND> shape = GetEffectiveTextShape();
if( PCB_SHAPE::GetStroke().GetWidth() >= 0 )
shape->AddShape( PCB_SHAPE::GetEffectiveShape( aLayer, aFlash ) );
return shape;
}

8
pcbnew/pcb_textbox.cpp

@ -428,10 +428,12 @@ void PCB_TEXTBOX::SwapData( BOARD_ITEM* aImage )
std::shared_ptr<SHAPE> PCB_TEXTBOX::GetEffectiveShape( PCB_LAYER_ID aLayer, FLASHING aFlash ) const
{
std::shared_ptr<SHAPE_COMPOUND> shape = GetEffectiveTextShape();
if( PCB_SHAPE::GetStroke().GetWidth() >= 0 )
return PCB_SHAPE::GetEffectiveShape( aLayer, aFlash );
else
return GetEffectiveTextShape();
shape->AddShape( PCB_SHAPE::GetEffectiveShape( aLayer, aFlash ) );
return shape;
}

Loading…
Cancel
Save