7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-20 12:01:41 +00:00

Tables support for router.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20295
This commit is contained in:
Jeff Young 2025-03-10 15:45:11 +00:00
parent 6ac64d290b
commit 567da3de91
3 changed files with 25 additions and 5 deletions

View File

@ -129,6 +129,7 @@ bool DRC_CACHE_GENERATOR::Run()
PCB_PAD_T,
PCB_SHAPE_T,
PCB_FIELD_T, PCB_TEXT_T, PCB_TEXTBOX_T,
PCB_TABLE_T, PCB_TABLECELL_T,
PCB_DIMENSION_T
};

View File

@ -31,6 +31,8 @@
#include <pcb_shape.h>
#include <pcb_generator.h>
#include <pcb_text.h>
#include <pcb_table.h>
#include <pcb_tablecell.h>
#include <board_commit.h>
#include <layer_ids.h>
#include <kidialog.h>
@ -1430,25 +1432,33 @@ bool PNS_KICAD_IFACE_BASE::syncZone( PNS::NODE* aWorld, ZONE* aZone, SHAPE_POLY_
}
bool PNS_KICAD_IFACE_BASE::syncTextItem( PNS::NODE* aWorld, PCB_TEXT* aText, PCB_LAYER_ID aLayer )
bool PNS_KICAD_IFACE_BASE::syncTextItem( PNS::NODE* aWorld, BOARD_ITEM* aItem, PCB_LAYER_ID aLayer )
{
if( !IsKicadCopperLayer( aLayer ) || !aText->IsVisible() )
if( !IsKicadCopperLayer( aLayer ) )
return false;
if( ( aItem->Type() == PCB_FIELD_T || aItem->Type() == PCB_TEXT_T )
&& !static_cast<PCB_TEXT*>( aItem )->IsVisible() )
{
return false;
}
std::unique_ptr<PNS::SOLID> solid = std::make_unique<PNS::SOLID>();
SHAPE_SIMPLE* shape = new SHAPE_SIMPLE;
solid->SetLayer( GetPNSLayerFromBoardLayer( aLayer ) );
solid->SetNet( nullptr );
solid->SetParent( aText );
solid->SetParent( aItem );
solid->SetShape( shape ); // takes ownership
solid->SetRoutable( false );
SHAPE_POLY_SET cornerBuffer;
aText->TransformShapeToPolygon( cornerBuffer, aText->GetLayer(), 0,
aItem->TransformShapeToPolygon( cornerBuffer, aItem->GetLayer(), 0,
m_board->GetDesignSettings().m_MaxError, ERROR_OUTSIDE );
cornerBuffer.Simplify();
if( !cornerBuffer.OutlineCount() )
return false;
@ -1481,6 +1491,7 @@ bool PNS_KICAD_IFACE_BASE::syncGraphicalItem( PNS::NODE* aWorld, PCB_SHAPE* aIte
else
{
solid->SetLayer( GetPNSLayerFromBoardLayer( aItem->GetLayer() ) );
solid->SetRoutable( aItem->Type() != PCB_TABLECELL_T );
}
if( aItem->GetLayer() == Edge_Cuts )
@ -1677,6 +1688,10 @@ void PNS_KICAD_IFACE_BASE::SyncWorld( PNS::NODE *aWorld )
{
syncTextItem( aWorld, static_cast<PCB_TEXT*>( gitem ), gitem->GetLayer() );
}
else if( gitem->Type() == PCB_TABLE_T )
{
syncTextItem( aWorld, static_cast<PCB_TABLE*>( gitem ), gitem->GetLayer() );
}
}
SHAPE_POLY_SET buffer;
@ -1731,6 +1746,10 @@ void PNS_KICAD_IFACE_BASE::SyncWorld( PNS::NODE *aWorld )
{
syncTextItem( aWorld, static_cast<PCB_TEXT*>( item ), item->GetLayer() );
}
else if( item->Type() == PCB_TABLE_T )
{
syncTextItem( aWorld, static_cast<PCB_TABLE*>( item ), item->GetLayer() );
}
}
}

View File

@ -108,7 +108,7 @@ protected:
std::unique_ptr<PNS::SEGMENT> syncTrack( PCB_TRACK* aTrack );
std::unique_ptr<PNS::ARC> syncArc( PCB_ARC* aArc );
std::unique_ptr<PNS::VIA> syncVia( PCB_VIA* aVia );
bool syncTextItem( PNS::NODE* aWorld, PCB_TEXT* aText, PCB_LAYER_ID aLayer );
bool syncTextItem( PNS::NODE* aWorld, BOARD_ITEM* aItem, PCB_LAYER_ID aLayer );
bool syncGraphicalItem( PNS::NODE* aWorld, PCB_SHAPE* aItem );
bool syncZone( PNS::NODE* aWorld, ZONE* aZone, SHAPE_POLY_SET* aBoardOutline );
bool inheritTrackWidth( PNS::ITEM* aItem, int* aInheritedWidth );