Zone keepout exclusion now works on multiple layers!
Bug fixes for keepout layers - Changed LSET::size() -> LSET::count() - Save/load functions no longer depend on zone being a keepout
This commit is contained in:
parent
363fc598c0
commit
c977c88a10
|
@ -197,9 +197,9 @@ bool ZONE_CONTAINER::IsOnCopperLayer() const
|
|||
|
||||
bool ZONE_CONTAINER::CommonLayerExists( const LSET aLayerSet ) const
|
||||
{
|
||||
auto common = GetLayerSet() & aLayerSet;
|
||||
LSET common = GetLayerSet() & aLayerSet;
|
||||
|
||||
return common.size() > 0;
|
||||
return common.count() > 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -221,9 +221,11 @@ void ZONE_CONTAINER::SetLayerSet( LSET aLayerSet )
|
|||
if( GetIsKeepout() )
|
||||
{
|
||||
// Keepouts can only exist on copper layers
|
||||
m_layerSet = aLayerSet & LSET::AllCuMask();
|
||||
aLayerSet &= LSET::AllCuMask();
|
||||
}
|
||||
|
||||
m_layerSet = aLayerSet;
|
||||
|
||||
// Set the single layer to the first selected layer
|
||||
m_Layer = aLayerSet.Seq()[0];
|
||||
}
|
||||
|
@ -231,6 +233,8 @@ void ZONE_CONTAINER::SetLayerSet( LSET aLayerSet )
|
|||
|
||||
LSET ZONE_CONTAINER::GetLayerSet() const
|
||||
{
|
||||
// TODO - Enable multi-layer zones for all zone types
|
||||
// not just keepout zones
|
||||
if( GetIsKeepout() )
|
||||
{
|
||||
return m_layerSet;
|
||||
|
@ -312,9 +316,6 @@ void ZONE_CONTAINER::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE aDrawMod
|
|||
// At least one layer must be provided!
|
||||
assert( GetLayerSet().count() > 0 );
|
||||
|
||||
// If none of the keepout layers are actually visible, return
|
||||
LSET layers = GetLayerSet() & brd->GetVisibleLayers();
|
||||
|
||||
// Not on any visible layer?
|
||||
if( layers.count() == 0 && !( aDrawMode & GR_HIGHLIGHT ) )
|
||||
{
|
||||
|
|
|
@ -594,6 +594,9 @@ public:
|
|||
* returns a reference to the list of filled polygons.
|
||||
* @return Reference to the list of filled polygons.
|
||||
*/
|
||||
|
||||
//TODO - This should be called for each layer on which the zone exists
|
||||
|
||||
const SHAPE_POLY_SET& GetFilledPolysList() const
|
||||
{
|
||||
return m_FilledPolysList;
|
||||
|
|
|
@ -1609,8 +1609,8 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const
|
|||
aZone->GetIsKeepout() ? 0 : m_mapping->Translate( aZone->GetNetCode() ),
|
||||
m_out->Quotew( aZone->GetIsKeepout() ? wxT("") : aZone->GetNetname() ).c_str() );
|
||||
|
||||
// Keepout zones can exist on multiple layers
|
||||
if( aZone->GetIsKeepout() && aZone->GetLayerSet().count() > 1 )
|
||||
// If a zone exists on multiple layers, format accordingly
|
||||
if( aZone->GetLayerSet().count() > 1 )
|
||||
{
|
||||
formatLayers( aZone->GetLayerSet() );
|
||||
}
|
||||
|
|
|
@ -2826,8 +2826,6 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER()
|
|||
break;
|
||||
|
||||
case T_layers:
|
||||
// If multiple layers are specified, it is a keepout zone
|
||||
zone->SetIsKeepout( true );
|
||||
zone->SetLayerSet( parseBoardItemLayersAsMask() );
|
||||
break;
|
||||
|
||||
|
|
|
@ -912,11 +912,20 @@ int PCB_EDITOR_CONTROL::ZoneDuplicate( const TOOL_EVENT& aEvent )
|
|||
|
||||
// If the new zone is on the same layer as the the initial zone,
|
||||
// do nothing
|
||||
if( success && ( oldZone->GetLayer() == zoneSettings.m_CurrentZone_Layer ) )
|
||||
if( success )
|
||||
{
|
||||
DisplayError( m_frame,
|
||||
_( "The duplicated zone cannot be on the same layer as the original zone." ) );
|
||||
success = false;
|
||||
if( oldZone->GetIsKeepout() && ( oldZone->GetLayerSet() == zoneSettings.m_Layers ) )
|
||||
{
|
||||
DisplayError(
|
||||
m_frame, _( "The duplicated keepout zone cannot be on the same layers as the original zone." ) );
|
||||
success = false;
|
||||
}
|
||||
else if( !oldZone->GetIsKeepout() && ( oldZone->GetLayer() == zoneSettings.m_CurrentZone_Layer ) )
|
||||
{
|
||||
DisplayError(
|
||||
m_frame, _( "The duplicated zone cannot be on the same layer as the original zone." ) );
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
|
||||
// duplicate the zone
|
||||
|
|
|
@ -160,6 +160,8 @@ int PCB_EDIT_FRAME::Fill_All_Zones( wxWindow * aActiveWindow, bool aVerbose )
|
|||
for( ii = 0; ii < areaCount; ii++ )
|
||||
{
|
||||
ZONE_CONTAINER* zoneContainer = GetBoard()->GetArea( ii );
|
||||
|
||||
// Keepout zones are not filled
|
||||
if( zoneContainer->GetIsKeepout() )
|
||||
continue;
|
||||
|
||||
|
|
|
@ -363,7 +363,8 @@ void ZONE_CONTAINER::buildFeatureHoleList( BOARD* aPcb, SHAPE_POLY_SET& aFeature
|
|||
{
|
||||
ZONE_CONTAINER* zone = GetBoard()->GetArea( ii );
|
||||
|
||||
if( zone->GetLayer() != GetLayer() )
|
||||
// If the zones share no common layers
|
||||
if( !CommonLayerExists( zone->GetLayerSet() ) )
|
||||
continue;
|
||||
|
||||
if( !zone->GetIsKeepout() && zone->GetPriority() <= GetPriority() )
|
||||
|
|
Loading…
Reference in New Issue