diff --git a/pcbnew/drc/drc_test_provider.cpp b/pcbnew/drc/drc_test_provider.cpp index ce54e7a540..f11364ce0f 100644 --- a/pcbnew/drc/drc_test_provider.cpp +++ b/pcbnew/drc/drc_test_provider.cpp @@ -21,6 +21,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "pcb_table.h" #include <drc/drc_item.h> #include <drc/drc_test_provider.h> #include <pcb_track.h> @@ -229,6 +230,27 @@ int DRC_TEST_PROVIDER::forEachGeometryItem( const std::vector<KICAD_T>& aTypes, n++; } + else if( item->Type() == PCB_TABLE_T ) + { + if( typeMask[ PCB_TABLE_T ] ) + { + if( !aFunc( item ) ) + return n; + + n++; + } + + if( typeMask[ PCB_TABLECELL_T ] ) + { + for( PCB_TABLECELL* cell : static_cast<PCB_TABLE*>( item )->GetCells() ) + { + if( !aFunc( cell ) ) + return n; + + n++; + } + } + } } } diff --git a/pcbnew/drc/drc_test_provider_disallow.cpp b/pcbnew/drc/drc_test_provider_disallow.cpp index 9a5b228c57..1006c5e9ae 100644 --- a/pcbnew/drc/drc_test_provider_disallow.cpp +++ b/pcbnew/drc/drc_test_provider_disallow.cpp @@ -87,21 +87,21 @@ bool DRC_TEST_PROVIDER_DISALLOW::Run() int totalCount = 0; std::unique_ptr<DRC_RTREE> antiTrackKeepouts = std::make_unique<DRC_RTREE>(); - forEachGeometryItem( {}, LSET::AllLayersMask(), + forEachGeometryItem( { PCB_ZONE_T }, LSET::AllLayersMask(), [&]( BOARD_ITEM* item ) -> bool { - ZONE* zone = dynamic_cast<ZONE*>( item ); + ZONE* zone = static_cast<ZONE*>( item ); - if( zone && zone->GetIsRuleArea() && zone->GetDoNotAllowCopperPour() ) + if( zone->GetIsRuleArea() && zone->GetDoNotAllowCopperPour() ) { antiCopperKeepouts.push_back( zone ); } - else if( zone && zone->GetIsRuleArea() && zone->GetDoNotAllowTracks() ) + else if( zone->GetIsRuleArea() && zone->GetDoNotAllowTracks() ) { for( PCB_LAYER_ID layer : zone->GetLayerSet() ) antiTrackKeepouts->Insert( zone, layer ); } - else if( zone && zone->IsOnCopperLayer() ) + else if( zone->IsOnCopperLayer() ) { copperZones.push_back( zone ); } diff --git a/pcbnew/drc/drc_test_provider_misc.cpp b/pcbnew/drc/drc_test_provider_misc.cpp index c8d75fa3c5..803bd802a9 100644 --- a/pcbnew/drc/drc_test_provider_misc.cpp +++ b/pcbnew/drc/drc_test_provider_misc.cpp @@ -296,8 +296,7 @@ void DRC_TEST_PROVIDER_MISC::testTextVars() static const std::vector<KICAD_T> itemTypes = { PCB_FIELD_T, - PCB_TEXT_T, - PCB_TEXTBOX_T, + PCB_TEXT_T, PCB_TEXTBOX_T, PCB_TABLECELL_T, PCB_DIMENSION_T }; diff --git a/pcbnew/drc/drc_test_provider_physical_clearance.cpp b/pcbnew/drc/drc_test_provider_physical_clearance.cpp index 3c2fb5f10d..8fc2a16dca 100644 --- a/pcbnew/drc/drc_test_provider_physical_clearance.cpp +++ b/pcbnew/drc/drc_test_provider_physical_clearance.cpp @@ -115,6 +115,7 @@ bool DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::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 }; diff --git a/pcbnew/drc/drc_test_provider_text_dims.cpp b/pcbnew/drc/drc_test_provider_text_dims.cpp index 534b920af0..33ca5ad599 100644 --- a/pcbnew/drc/drc_test_provider_text_dims.cpp +++ b/pcbnew/drc/drc_test_provider_text_dims.cpp @@ -30,6 +30,7 @@ #include <drc/drc_rule.h> #include <drc/drc_test_provider.h> #include <font/font.h> +#include <pcb_dimension.h> /* @@ -261,7 +262,11 @@ bool DRC_TEST_PROVIDER_TEXT_DIMS::Run() return true; }; - static const std::vector<KICAD_T> itemTypes = { PCB_FIELD_T, PCB_TEXT_T, PCB_TEXTBOX_T }; + static const std::vector<KICAD_T> itemTypes = { + PCB_FIELD_T, + PCB_TEXT_T, PCB_TEXTBOX_T, PCB_TABLECELL_T, + PCB_DIMENSION_T + }; forEachGeometryItem( itemTypes, LSET::AllLayersMask(), [&]( BOARD_ITEM* item ) -> bool @@ -276,33 +281,27 @@ bool DRC_TEST_PROVIDER_TEXT_DIMS::Run() if( !reportProgress( ii++, count, progressDelta ) ) return false; - EDA_TEXT* text = nullptr; - int strikes = 0; - - switch( item->Type() ) + if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( item ) ) { - case PCB_FIELD_T: text = static_cast<PCB_FIELD*>( item ); break; - case PCB_TEXT_T: text = static_cast<PCB_TEXT*>( item ); break; - case PCB_TEXTBOX_T: text = static_cast<PCB_TEXTBOX*>( item ); break; - default: UNIMPLEMENTED_FOR( item->GetClass() ); break; + int strikes = 0; + + if( !text->IsVisible() ) + return true; + + if( m_drcEngine->IsErrorLimitExceeded( DRCE_TEXT_THICKNESS ) ) + strikes++; + else + checkTextThickness( item, text ); + + if( m_drcEngine->IsErrorLimitExceeded( DRCE_TEXT_HEIGHT ) ) + strikes++; + else + checkTextHeight( item, text ); + + if( strikes >= 2 ) + return false; } - if( !text || !text->IsVisible() ) - return true; - - if( m_drcEngine->IsErrorLimitExceeded( DRCE_TEXT_THICKNESS ) ) - strikes++; - else - checkTextThickness( item, text ); - - if( m_drcEngine->IsErrorLimitExceeded( DRCE_TEXT_HEIGHT ) ) - strikes++; - else - checkTextHeight( item, text ); - - if( strikes >= 2 ) - return false; - return true; } ); diff --git a/pcbnew/drc/drc_test_provider_text_mirroring.cpp b/pcbnew/drc/drc_test_provider_text_mirroring.cpp index 3ef2c88936..b8676b848f 100644 --- a/pcbnew/drc/drc_test_provider_text_mirroring.cpp +++ b/pcbnew/drc/drc_test_provider_text_mirroring.cpp @@ -101,11 +101,15 @@ bool DRC_TEST_PROVIDER_TEXT_MIRRORING::Run() } }; - const int progressDelta = 500; - int count = 0; - int progressIndex = 0; - static const std::vector<KICAD_T> itemTypes = { PCB_FIELD_T, PCB_TEXT_T, PCB_TEXTBOX_T, - PCB_TABLECELL_T }; + const int progressDelta = 500; + int count = 0; + int progressIndex = 0; + + static const std::vector<KICAD_T> itemTypes = { + PCB_FIELD_T, + PCB_TEXT_T, PCB_TEXTBOX_T, PCB_TABLECELL_T, + PCB_DIMENSION_T + }; forEachGeometryItem( itemTypes, topLayers | bottomLayers, [&]( BOARD_ITEM* item ) -> bool @@ -120,26 +124,19 @@ bool DRC_TEST_PROVIDER_TEXT_MIRRORING::Run() if( !reportProgress( progressIndex++, count, progressDelta ) ) return false; - EDA_TEXT* text = nullptr; - - switch( item->Type() ) + if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( item ) ) { - case PCB_FIELD_T: text = static_cast<PCB_FIELD*>( item ); break; - case PCB_TEXT_T: text = static_cast<PCB_TEXT*>( item ); break; - case PCB_TEXTBOX_T: text = static_cast<PCB_TEXTBOX*>( item ); break; - case PCB_TABLECELL_T: text = static_cast<PCB_TABLECELL*>( item ); break; - default: UNIMPLEMENTED_FOR( item->GetClass() ); break; + if( !text->IsVisible() + || !m_drcEngine->GetBoard()->IsLayerEnabled( item->GetLayer() ) + || !m_drcEngine->GetBoard()->IsLayerVisible( item->GetLayer() ) ) + { + return true; + } + + checkTextMirroring( item, text, true, DRCE_MIRRORED_TEXT_ON_FRONT_LAYER ); + checkTextMirroring( item, text, false, DRCE_NONMIRRORED_TEXT_ON_BACK_LAYER ); } - if( !text || !text->IsVisible() - || !m_drcEngine->GetBoard()->IsLayerEnabled( item->GetLayer() ) - || !m_drcEngine->GetBoard()->IsLayerVisible( item->GetLayer() ) ) - { - return true; - } - - checkTextMirroring( item, text, true, DRCE_MIRRORED_TEXT_ON_FRONT_LAYER ); - checkTextMirroring( item, text, false, DRCE_NONMIRRORED_TEXT_ON_BACK_LAYER ); return true; } );