Back out zone layer misunderstanding and make types clearer.
This commit is contained in:
parent
1f284111b0
commit
4a0d469cec
|
@ -550,7 +550,7 @@ void CN_CONNECTIVITY_ALGO::FindIsolatedCopperIslands( ZONE_CONTAINER* aZone,
|
||||||
{
|
{
|
||||||
if( z->Parent() == aZone && z->Layer() == aLayer )
|
if( z->Parent() == aZone && z->Layer() == aLayer )
|
||||||
{
|
{
|
||||||
aIslands.push_back( static_cast<CN_ZONE*>(z)->SubpolyIndex() );
|
aIslands.push_back( static_cast<CN_ZONE_LAYER*>(z)->SubpolyIndex() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -585,7 +585,7 @@ void CN_CONNECTIVITY_ALGO::FindIsolatedCopperIslands( std::vector<CN_ZONE_ISOLAT
|
||||||
if( z->Parent() == zone.m_zone && z->Layer() == layer )
|
if( z->Parent() == zone.m_zone && z->Layer() == layer )
|
||||||
{
|
{
|
||||||
zone.m_islands[layer].push_back(
|
zone.m_islands[layer].push_back(
|
||||||
static_cast<CN_ZONE*>( z )->SubpolyIndex() );
|
static_cast<CN_ZONE_LAYER*>( z )->SubpolyIndex() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -624,85 +624,85 @@ void CN_CONNECTIVITY_ALGO::MarkNetAsDirty( int aNet )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CN_VISITOR::checkZoneItemConnection( CN_ZONE* aZone, CN_ITEM* aItem )
|
void CN_VISITOR::checkZoneItemConnection( CN_ZONE_LAYER* aZoneLayer, CN_ITEM* aItem )
|
||||||
{
|
{
|
||||||
if( aZone->Net() != aItem->Net() && !aItem->CanChangeNet() )
|
if( aZoneLayer->Net() != aItem->Net() && !aItem->CanChangeNet() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( !aZone->BBox().Intersects( aItem->BBox() ) )
|
if( !aZoneLayer->BBox().Intersects( aItem->BBox() ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CN_ZONE* zoneItem = static_cast<CN_ZONE*> ( aZone );
|
int accuracy = 0;
|
||||||
int accuracy = 0;
|
|
||||||
|
|
||||||
if( aItem->Parent()->Type() == PCB_VIA_T
|
if( aItem->Parent()->Type() == PCB_VIA_T
|
||||||
|| aItem->Parent()->Type() == PCB_TRACE_T
|
|| aItem->Parent()->Type() == PCB_TRACE_T
|
||||||
|| aItem->Parent()->Type() == PCB_ARC_T )
|
|| aItem->Parent()->Type() == PCB_ARC_T )
|
||||||
|
{
|
||||||
accuracy = ( static_cast<TRACK*>( aItem->Parent() )->GetWidth() + 1 ) / 2;
|
accuracy = ( static_cast<TRACK*>( aItem->Parent() )->GetWidth() + 1 ) / 2;
|
||||||
|
}
|
||||||
|
|
||||||
for( int i = 0; i < aItem->AnchorCount(); ++i )
|
for( int i = 0; i < aItem->AnchorCount(); ++i )
|
||||||
{
|
{
|
||||||
if( zoneItem->ContainsPoint( aItem->GetAnchor( i ), accuracy ) )
|
if( aZoneLayer->ContainsPoint( aItem->GetAnchor( i ), accuracy ) )
|
||||||
{
|
{
|
||||||
zoneItem->Connect( aItem );
|
aZoneLayer->Connect( aItem );
|
||||||
aItem->Connect( zoneItem );
|
aItem->Connect( aZoneLayer );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CN_VISITOR::checkZoneZoneConnection( CN_ZONE* aZoneA, CN_ZONE* aZoneB )
|
void CN_VISITOR::checkZoneZoneConnection( CN_ZONE_LAYER* aZoneLayerA, CN_ZONE_LAYER* aZoneLayerB )
|
||||||
{
|
{
|
||||||
const auto parentA = static_cast<const ZONE_CONTAINER*>( aZoneA->Parent() );
|
const auto zoneA = static_cast<const ZONE_CONTAINER*>( aZoneLayerA->Parent() );
|
||||||
const auto parentB = static_cast<const ZONE_CONTAINER*>( aZoneB->Parent() );
|
const auto zoneB = static_cast<const ZONE_CONTAINER*>( aZoneLayerB->Parent() );
|
||||||
|
|
||||||
if( aZoneB->Net() != aZoneA->Net() )
|
if( aZoneLayerB->Net() != aZoneLayerA->Net() )
|
||||||
return; // we only test zones belonging to the same net
|
return; // we only test zones belonging to the same net
|
||||||
|
|
||||||
const BOX2I& boxA = aZoneA->BBox();
|
const BOX2I& boxA = aZoneLayerA->BBox();
|
||||||
const BOX2I& boxB = aZoneB->BBox();
|
const BOX2I& boxB = aZoneLayerB->BBox();
|
||||||
|
|
||||||
int radiusA = 0;
|
int radiusA = 0;
|
||||||
int radiusB = 0;
|
int radiusB = 0;
|
||||||
|
|
||||||
if( parentA->GetFilledPolysUseThickness() )
|
if( zoneA->GetFilledPolysUseThickness() )
|
||||||
radiusA = ( parentA->GetMinThickness() + 1 ) / 2;
|
radiusA = ( zoneA->GetMinThickness() + 1 ) / 2;
|
||||||
|
|
||||||
if( parentB->GetFilledPolysUseThickness() )
|
if( zoneB->GetFilledPolysUseThickness() )
|
||||||
radiusB = ( parentB->GetMinThickness() + 1 ) / 2;
|
radiusB = ( zoneB->GetMinThickness() + 1 ) / 2;
|
||||||
|
|
||||||
for( PCB_LAYER_ID layer : LSET( parentA->GetLayerSet() & parentB->GetLayerSet() ).Seq() )
|
PCB_LAYER_ID layer = static_cast<PCB_LAYER_ID>( aZoneLayerA->Layer() );
|
||||||
|
|
||||||
|
const SHAPE_LINE_CHAIN& outline =
|
||||||
|
zoneA->GetFilledPolysList( layer ).COutline( aZoneLayerA->SubpolyIndex() );
|
||||||
|
|
||||||
|
for( int i = 0; i < outline.PointCount(); i++ )
|
||||||
{
|
{
|
||||||
const SHAPE_LINE_CHAIN& outline =
|
if( !boxB.Contains( outline.CPoint( i ) ) )
|
||||||
parentA->GetFilledPolysList( layer ).COutline( aZoneA->SubpolyIndex() );
|
continue;
|
||||||
|
|
||||||
for( int i = 0; i < outline.PointCount(); i++ )
|
if( aZoneLayerB->ContainsPoint( outline.CPoint( i ), radiusA ) )
|
||||||
{
|
{
|
||||||
if( !boxB.Contains( outline.CPoint( i ) ) )
|
aZoneLayerA->Connect( aZoneLayerB );
|
||||||
continue;
|
aZoneLayerB->Connect( aZoneLayerA );
|
||||||
|
return;
|
||||||
if( aZoneB->ContainsPoint( outline.CPoint( i ), radiusA ) )
|
|
||||||
{
|
|
||||||
aZoneA->Connect( aZoneB );
|
|
||||||
aZoneB->Connect( aZoneA );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const SHAPE_LINE_CHAIN& outline2 =
|
const SHAPE_LINE_CHAIN& outline2 =
|
||||||
parentB->GetFilledPolysList( layer ).COutline( aZoneB->SubpolyIndex() );
|
zoneB->GetFilledPolysList( layer ).COutline( aZoneLayerB->SubpolyIndex() );
|
||||||
|
|
||||||
for( int i = 0; i < outline2.PointCount(); i++ )
|
for( int i = 0; i < outline2.PointCount(); i++ )
|
||||||
|
{
|
||||||
|
if( !boxA.Contains( outline2.CPoint( i ) ) )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if( aZoneLayerA->ContainsPoint( outline2.CPoint( i ), radiusB ) )
|
||||||
{
|
{
|
||||||
if( !boxA.Contains( outline2.CPoint( i ) ) )
|
aZoneLayerA->Connect( aZoneLayerB );
|
||||||
continue;
|
aZoneLayerB->Connect( aZoneLayerA );
|
||||||
|
return;
|
||||||
if( aZoneA->ContainsPoint( outline2.CPoint( i ), radiusB ) )
|
|
||||||
{
|
|
||||||
aZoneA->Connect( aZoneB );
|
|
||||||
aZoneB->Connect( aZoneA );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -731,20 +731,20 @@ bool CN_VISITOR::operator()( CN_ITEM* aCandidate )
|
||||||
// We should handle zone-zone connection separately
|
// We should handle zone-zone connection separately
|
||||||
if ( parentA->Type() == PCB_ZONE_AREA_T && parentB->Type() == PCB_ZONE_AREA_T )
|
if ( parentA->Type() == PCB_ZONE_AREA_T && parentB->Type() == PCB_ZONE_AREA_T )
|
||||||
{
|
{
|
||||||
checkZoneZoneConnection( static_cast<CN_ZONE*>( m_item ),
|
checkZoneZoneConnection( static_cast<CN_ZONE_LAYER*>( m_item ),
|
||||||
static_cast<CN_ZONE*>( aCandidate ) );
|
static_cast<CN_ZONE_LAYER*>( aCandidate ) );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( parentA->Type() == PCB_ZONE_AREA_T )
|
if( parentA->Type() == PCB_ZONE_AREA_T )
|
||||||
{
|
{
|
||||||
checkZoneItemConnection( static_cast<CN_ZONE*>( aCandidate ), m_item );
|
checkZoneItemConnection( static_cast<CN_ZONE_LAYER*>( aCandidate ), m_item );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( parentB->Type() == PCB_ZONE_AREA_T )
|
if( parentB->Type() == PCB_ZONE_AREA_T )
|
||||||
{
|
{
|
||||||
checkZoneItemConnection( static_cast<CN_ZONE*>( m_item ), aCandidate );
|
checkZoneItemConnection( static_cast<CN_ZONE_LAYER*>( m_item ), aCandidate );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -296,9 +296,9 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
void checkZoneItemConnection( CN_ZONE* aZone, CN_ITEM* aItem );
|
void checkZoneItemConnection( CN_ZONE_LAYER* aZoneLayer, CN_ITEM* aItem );
|
||||||
|
|
||||||
void checkZoneZoneConnection( CN_ZONE* aZoneA, CN_ZONE* aZoneB );
|
void checkZoneZoneConnection( CN_ZONE_LAYER* aZoneLayerA, CN_ZONE_LAYER* aZoneLayerB );
|
||||||
|
|
||||||
///> the item we are looking for connections to
|
///> the item we are looking for connections to
|
||||||
CN_ITEM* m_item;
|
CN_ITEM* m_item;
|
||||||
|
|
|
@ -196,7 +196,7 @@ void CONNECTIVITY_DATA::RecalculateRatsnest( BOARD_COMMIT* aCommit )
|
||||||
// Don't add intentionally-kept zone islands to the ratsnest
|
// Don't add intentionally-kept zone islands to the ratsnest
|
||||||
if( c->IsOrphaned() && c->Size() == 1 )
|
if( c->IsOrphaned() && c->Size() == 1 )
|
||||||
{
|
{
|
||||||
if( dynamic_cast<CN_ZONE*>( *c->begin() ) )
|
if( dynamic_cast<CN_ZONE_LAYER*>( *c->begin() ) )
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -160,7 +160,7 @@ void CN_ITEM::Dump()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int CN_ZONE::AnchorCount() const
|
int CN_ZONE_LAYER::AnchorCount() const
|
||||||
{
|
{
|
||||||
if( !Valid() )
|
if( !Valid() )
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -172,7 +172,7 @@ int CN_ZONE::AnchorCount() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const VECTOR2I CN_ZONE::GetAnchor( int n ) const
|
const VECTOR2I CN_ZONE_LAYER::GetAnchor( int n ) const
|
||||||
{
|
{
|
||||||
if( !Valid() )
|
if( !Valid() )
|
||||||
return VECTOR2I();
|
return VECTOR2I();
|
||||||
|
@ -278,7 +278,7 @@ CN_ITEM* CN_LIST::Add( ARC* aArc )
|
||||||
|
|
||||||
for( int j = 0; j < polys.OutlineCount(); j++ )
|
for( int j = 0; j < polys.OutlineCount(); j++ )
|
||||||
{
|
{
|
||||||
CN_ZONE* zitem = new CN_ZONE( zone, aLayer, false, j );
|
CN_ZONE_LAYER* zitem = new CN_ZONE_LAYER( zone, aLayer, false, j );
|
||||||
const auto& outline = zone->GetFilledPolysList( aLayer ).COutline( j );
|
const auto& outline = zone->GetFilledPolysList( aLayer ).COutline( j );
|
||||||
|
|
||||||
for( int k = 0; k < outline.PointCount(); k++ )
|
for( int k = 0; k < outline.PointCount(); k++ )
|
||||||
|
|
|
@ -354,10 +354,11 @@ public:
|
||||||
|
|
||||||
typedef std::shared_ptr<CN_ITEM> CN_ITEM_PTR;
|
typedef std::shared_ptr<CN_ITEM> CN_ITEM_PTR;
|
||||||
|
|
||||||
class CN_ZONE : public CN_ITEM
|
class CN_ZONE_LAYER : public CN_ITEM
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CN_ZONE( ZONE_CONTAINER* aParent, PCB_LAYER_ID aLayer, bool aCanChangeNet, int aSubpolyIndex ) :
|
CN_ZONE_LAYER( ZONE_CONTAINER* aParent, PCB_LAYER_ID aLayer, bool aCanChangeNet,
|
||||||
|
int aSubpolyIndex ) :
|
||||||
CN_ITEM( aParent, aCanChangeNet ),
|
CN_ITEM( aParent, aCanChangeNet ),
|
||||||
m_subpolyIndex( aSubpolyIndex ),
|
m_subpolyIndex( aSubpolyIndex ),
|
||||||
m_layer( aLayer )
|
m_layer( aLayer )
|
||||||
|
|
|
@ -364,7 +364,7 @@ void RN_NET::AddCluster( CN_CLUSTER_PTR aCluster )
|
||||||
|
|
||||||
for( auto item : *aCluster )
|
for( auto item : *aCluster )
|
||||||
{
|
{
|
||||||
bool isZone = dynamic_cast<CN_ZONE*>(item) != nullptr;
|
bool isZone = dynamic_cast<CN_ZONE_LAYER*>(item) != nullptr;
|
||||||
auto& anchors = item->Anchors();
|
auto& anchors = item->Anchors();
|
||||||
unsigned int nAnchors = isZone ? 1 : anchors.size();
|
unsigned int nAnchors = isZone ? 1 : anchors.size();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue