diff --git a/pcbnew/plugins/altium/altium_pcb.cpp b/pcbnew/plugins/altium/altium_pcb.cpp index 3c8c35959f..ef54404968 100644 --- a/pcbnew/plugins/altium/altium_pcb.cpp +++ b/pcbnew/plugins/altium/altium_pcb.cpp @@ -1697,7 +1697,7 @@ void ALTIUM_PCB::ParsePolygons6Data( const ALTIUM_COMPOUND_FILE& aAltiumPcbF m_polygons.emplace_back( zone ); zone->SetNetCode( GetNetCode( elem.net ) ); - zone->SetLayer( klayer ); + zone->SetLayerSet( LSET( klayer ) ); zone->SetPosition( elem.vertices.at( 0 ).position ); zone->SetLocked( elem.locked ); zone->SetPriority( elem.pourindex > 0 ? elem.pourindex : 0 ); @@ -1907,7 +1907,6 @@ void ALTIUM_PCB::ConvertShapeBasedRegions6ToBoardItem( const AREGION6& aElem ) if( aElem.layer == ALTIUM_LAYER::MULTI_LAYER ) { - zone->SetLayer( F_Cu ); zone->SetLayerSet( LSET::AllCuMask() ); } else @@ -1921,7 +1920,7 @@ void ALTIUM_PCB::ConvertShapeBasedRegions6ToBoardItem( const AREGION6& aElem ) aElem.layer ); klayer = Eco1_User; } - zone->SetLayer( klayer ); + zone->SetLayerSet( LSET( klayer ) ); } zone->SetBorderDisplayStyle( ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE, @@ -1975,13 +1974,12 @@ void ALTIUM_PCB::ConvertShapeBasedRegions6ToFootprintItem( FOOTPRINT* aFoot if( aElem.layer == ALTIUM_LAYER::MULTI_LAYER ) { - zone->SetLayer( F_Cu ); zone->SetLayerSet( LSET::AllCuMask() ); } else { std::vector klayers = GetKicadLayersToIterate( aElem.layer ); - zone->SetLayer( klayers.at( 0 ) ); + zone->SetLayerSet( LSET( klayers.at( 0 ) ) ); } zone->SetBorderDisplayStyle( ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE, @@ -3270,13 +3268,12 @@ void ALTIUM_PCB::ConvertFills6ToBoardItemWithNet( const AFILL6& aElem ) zone->SetPriority( 1000 ); if( aElem.layer == ALTIUM_LAYER::MULTI_LAYER ) { - zone->SetLayer( F_Cu ); zone->SetLayerSet( LSET::AllCuMask() ); } else { std::vector klayers = GetKicadLayersToIterate( aElem.layer ); - zone->SetLayer( klayers.at( 0 ) ); + zone->SetLayerSet( LSET( klayers.at( 0 ) ) ); } VECTOR2I p11( aElem.pos1.x, aElem.pos1.y ); @@ -3374,13 +3371,12 @@ void ALTIUM_PCB::HelperPcpShapeAsBoardKeepoutRegion( const PCB_SHAPE& aShape, if( aAltiumLayer == ALTIUM_LAYER::MULTI_LAYER ) { - zone->SetLayer( F_Cu ); zone->SetLayerSet( LSET::AllCuMask() ); } else { std::vector klayers = GetKicadLayersToIterate( aAltiumLayer ); - zone->SetLayer( klayers.at( 0 ) ); + zone->SetLayerSet( LSET( klayers.at( 0 ) ) ); } aShape.EDA_SHAPE::TransformShapeWithClearanceToPolygon( *zone->Outline(), 0, ARC_HIGH_DEF, @@ -3407,13 +3403,12 @@ void ALTIUM_PCB::HelperPcpShapeAsFootprintKeepoutRegion( FOOTPRINT* aFootp if( aAltiumLayer == ALTIUM_LAYER::MULTI_LAYER ) { - zone->SetLayer( F_Cu ); zone->SetLayerSet( LSET::AllCuMask() ); } else { std::vector klayers = GetKicadLayersToIterate( aAltiumLayer ); - zone->SetLayer( klayers.at( 0 ) ); + zone->SetLayerSet( LSET( klayers.at( 0 ) ) ); } aShape.EDA_SHAPE::TransformShapeWithClearanceToPolygon( *zone->Outline(), 0, ARC_HIGH_DEF, diff --git a/qa/pcbnew/board_test_utils.cpp b/qa/pcbnew/board_test_utils.cpp index dae6870e71..acce796fe4 100644 --- a/qa/pcbnew/board_test_utils.cpp +++ b/qa/pcbnew/board_test_utils.cpp @@ -229,15 +229,14 @@ void CheckFootprint( const FOOTPRINT* expected, const FOOTPRINT* fp ) } } - /*std::set expectedZones( expected->Zones().begin(), + std::set expectedZones( expected->Zones().begin(), expected->Zones().end() ); - std::set fp2Zones( fp->Zones().begin(), - fp->Zones().end() ); - for( auto it1 = expectedZones.begin(), it2 = fp2Zones.begin(); - it1 != expectedZones.end() && it2 != fp2Zones.end(); it1++, it2++ ) + std::set fpZones( fp->Zones().begin(), fp->Zones().end() ); + for( auto itExpected = expectedZones.begin(), itFp = fpZones.begin(); + itExpected != expectedZones.end() && itFp != fpZones.end(); itExpected++, itFp++ ) { - // TODO: BOOST_CHECK( (*it1)->IsSame( **it2 ) ); - }*/ + CheckFpZone( *itExpected, *itFp ); + } // TODO: Groups } @@ -336,7 +335,7 @@ void CheckFpShape( const FP_SHAPE* expected, const FP_SHAPE* shape ) BOOST_CHECK_EQUAL( expected->GetBezierC1(), shape->GetBezierC1() ); BOOST_CHECK_EQUAL( expected->GetBezierC2(), shape->GetBezierC2() ); - // TODO: polyshape + CheckShapePolySet( &expected->GetPolyShape(), &shape->GetPolyShape() ); BOOST_CHECK_EQUAL( expected->GetLayer(), shape->GetLayer() ); BOOST_CHECK_EQUAL( expected->GetLayerSet(), shape->GetLayerSet() ); @@ -348,4 +347,59 @@ void CheckFpShape( const FP_SHAPE* expected, const FP_SHAPE* shape ) } +void CheckFpZone( const FP_ZONE* expected, const FP_ZONE* zone ) +{ + CHECK_ENUM_CLASS_EQUAL( expected->Type(), zone->Type() ); + + BOOST_CHECK_EQUAL( expected->IsLocked(), zone->IsLocked() ); + + BOOST_CHECK_EQUAL( expected->GetNetCode(), zone->GetNetCode() ); + BOOST_CHECK_EQUAL( expected->GetPriority(), zone->GetPriority() ); + CHECK_ENUM_CLASS_EQUAL( expected->GetPadConnection(), zone->GetPadConnection() ); + BOOST_CHECK_EQUAL( expected->GetLocalClearance(), zone->GetLocalClearance() ); + BOOST_CHECK_EQUAL( expected->GetMinThickness(), zone->GetMinThickness() ); + + BOOST_CHECK_EQUAL( expected->GetLayer(), zone->GetLayer() ); // this is not used for zones + BOOST_CHECK_EQUAL( expected->GetLayerSet(), zone->GetLayerSet() ); + + BOOST_CHECK_EQUAL( expected->IsFilled(), zone->IsFilled() ); + CHECK_ENUM_CLASS_EQUAL( expected->GetFillMode(), zone->GetFillMode() ); + BOOST_CHECK_EQUAL( expected->GetHatchThickness(), zone->GetHatchThickness() ); + BOOST_CHECK_EQUAL( expected->GetHatchGap(), zone->GetHatchGap() ); + BOOST_CHECK_EQUAL( expected->GetHatchOrientation(), zone->GetHatchOrientation() ); + BOOST_CHECK_EQUAL( expected->GetHatchSmoothingLevel(), zone->GetHatchSmoothingLevel() ); + BOOST_CHECK_EQUAL( expected->GetHatchSmoothingValue(), zone->GetHatchSmoothingValue() ); + BOOST_CHECK_EQUAL( expected->GetHatchBorderAlgorithm(), zone->GetHatchBorderAlgorithm() ); + BOOST_CHECK_EQUAL( expected->GetHatchHoleMinArea(), zone->GetHatchHoleMinArea() ); + BOOST_CHECK_EQUAL( expected->GetThermalReliefGap(), zone->GetThermalReliefGap() ); + BOOST_CHECK_EQUAL( expected->GetThermalReliefSpokeWidth(), zone->GetThermalReliefSpokeWidth() ); + BOOST_CHECK_EQUAL( expected->GetCornerSmoothingType(), zone->GetCornerSmoothingType() ); + BOOST_CHECK_EQUAL( expected->GetCornerRadius(), zone->GetCornerRadius() ); + CHECK_ENUM_CLASS_EQUAL( expected->GetIslandRemovalMode(), zone->GetIslandRemovalMode() ); + BOOST_CHECK_EQUAL( expected->GetMinIslandArea(), zone->GetMinIslandArea() ); + + BOOST_CHECK_EQUAL( expected->GetIsRuleArea(), zone->GetIsRuleArea() ); + BOOST_CHECK_EQUAL( expected->GetDoNotAllowCopperPour(), zone->GetDoNotAllowCopperPour() ); + BOOST_CHECK_EQUAL( expected->GetDoNotAllowVias(), zone->GetDoNotAllowVias() ); + BOOST_CHECK_EQUAL( expected->GetDoNotAllowTracks(), zone->GetDoNotAllowTracks() ); + BOOST_CHECK_EQUAL( expected->GetDoNotAllowPads(), zone->GetDoNotAllowPads() ); + BOOST_CHECK_EQUAL( expected->GetDoNotAllowFootprints(), zone->GetDoNotAllowFootprints() ); + + BOOST_CHECK_EQUAL( expected->GetZoneName(), zone->GetZoneName() ); + CHECK_ENUM_CLASS_EQUAL( expected->GetTeardropAreaType(), zone->GetTeardropAreaType() ); + BOOST_CHECK_EQUAL( expected->GetZoneName(), zone->GetZoneName() ); + + CheckShapePolySet( expected->Outline(), zone->Outline() ); + // TODO: filled zones +} + + +void CheckShapePolySet( const SHAPE_POLY_SET* expected, const SHAPE_POLY_SET* polyset ) +{ + BOOST_CHECK_EQUAL( expected->OutlineCount(), polyset->OutlineCount() ); + BOOST_CHECK_EQUAL( expected->TotalVertices(), polyset->TotalVertices() ); + + // TODO: check all outlines and holes +} + } // namespace KI_TEST diff --git a/qa/pcbnew/board_test_utils.h b/qa/pcbnew/board_test_utils.h index d5eba24501..71464af83b 100644 --- a/qa/pcbnew/board_test_utils.h +++ b/qa/pcbnew/board_test_utils.h @@ -34,7 +34,9 @@ class BOARD_ITEM; class FOOTPRINT; class FP_TEXT; class FP_SHAPE; +class FP_ZONE; class PAD; +class SHAPE_POLY_SET; class SETTINGS_MANAGER; @@ -79,6 +81,9 @@ void CheckFpText( const FP_TEXT* expected, const FP_TEXT* text ); void CheckFpShape( const FP_SHAPE* expected, const FP_SHAPE* shape ); +void CheckFpZone( const FP_ZONE* expected, const FP_ZONE* zone ); + +void CheckShapePolySet( const SHAPE_POLY_SET* expected, const SHAPE_POLY_SET* polyset ); } // namespace KI_TEST