Post-holes-work cleanup.
This commit is contained in:
parent
2f198bdcb2
commit
ab0dbeb523
|
@ -37,6 +37,7 @@ HOLE::~HOLE()
|
|||
delete m_holeShape;
|
||||
}
|
||||
|
||||
|
||||
HOLE* HOLE::Clone() const
|
||||
{
|
||||
HOLE* h = new HOLE( nullptr, m_holeShape->Clone() );
|
||||
|
@ -53,6 +54,7 @@ HOLE* HOLE::Clone() const
|
|||
return h;
|
||||
}
|
||||
|
||||
|
||||
const SHAPE_LINE_CHAIN HOLE::Hull( int aClearance, int aWalkaroundThickness, int aLayer ) const
|
||||
{
|
||||
if( !m_holeShape )
|
||||
|
@ -98,10 +100,6 @@ const SHAPE_LINE_CHAIN HOLE::Hull( int aClearance, int aWalkaroundThickness, int
|
|||
}
|
||||
}
|
||||
|
||||
bool HOLE::IsCircular() const
|
||||
{
|
||||
return m_holeShape->Type() == SH_CIRCLE;
|
||||
}
|
||||
|
||||
int HOLE::Radius() const
|
||||
{
|
||||
|
@ -110,10 +108,6 @@ int HOLE::Radius() const
|
|||
return static_cast<const SHAPE_CIRCLE*>( m_holeShape )->GetRadius();
|
||||
}
|
||||
|
||||
const VECTOR2I HOLE::Pos() const
|
||||
{
|
||||
return VECTOR2I( 0, 0 ); // fixme holes
|
||||
}
|
||||
|
||||
void HOLE::SetCenter( const VECTOR2I& aCenter )
|
||||
{
|
||||
|
@ -121,28 +115,27 @@ void HOLE::SetCenter( const VECTOR2I& aCenter )
|
|||
static_cast<SHAPE_CIRCLE*>( m_holeShape )->SetCenter( aCenter );
|
||||
}
|
||||
|
||||
|
||||
void HOLE::SetRadius( int aRadius )
|
||||
{
|
||||
assert( m_holeShape->Type() == SH_CIRCLE );
|
||||
static_cast<SHAPE_CIRCLE*>( m_holeShape )->SetRadius( aRadius );
|
||||
}
|
||||
|
||||
|
||||
void HOLE::Move( const VECTOR2I& delta )
|
||||
{
|
||||
m_holeShape->Move( delta );
|
||||
}
|
||||
|
||||
|
||||
HOLE* HOLE::MakeCircularHole( const VECTOR2I& pos, int radius )
|
||||
{
|
||||
auto circle = new SHAPE_CIRCLE( pos, radius );
|
||||
auto hole = new HOLE( nullptr, circle );
|
||||
SHAPE_CIRCLE* circle = new SHAPE_CIRCLE( pos, radius );
|
||||
HOLE* hole = new HOLE( nullptr, circle );
|
||||
|
||||
hole->SetLayers( LAYER_RANGE( F_Cu, B_Cu ) );
|
||||
return hole;
|
||||
}
|
||||
|
||||
/*bool HOLE::collideSimple( const ITEM* aHead, const NODE* aNode,
|
||||
COLLISION_SEARCH_CONTEXT* aCtx ) const
|
||||
{
|
||||
}*/
|
||||
|
||||
}; // namespace PNS
|
|
@ -52,10 +52,7 @@ public:
|
|||
virtual const SHAPE_LINE_CHAIN Hull( int aClearance = 0, int aWalkaroundThickness = 0,
|
||||
int aLayer = -1 ) const override;
|
||||
|
||||
bool IsCircular() const;
|
||||
|
||||
const VECTOR2I Pos() const;
|
||||
int Radius() const;
|
||||
int Radius() const;
|
||||
|
||||
const SHAPE* Shape() const override { return m_holeShape; }
|
||||
|
||||
|
|
|
@ -59,7 +59,6 @@ NODE::NODE()
|
|||
m_maxClearance = 800000; // fixme: depends on how thick traces are.
|
||||
m_ruleResolver = nullptr;
|
||||
m_index = new INDEX;
|
||||
m_collisionQueryScope = CQS_ALL_RULES;
|
||||
|
||||
#ifdef DEBUG
|
||||
allocNodes.insert( this );
|
||||
|
@ -115,7 +114,6 @@ int NODE::GetClearance( const ITEM* aA, const ITEM* aB, bool aUseClearanceEpsilo
|
|||
if( !m_ruleResolver )
|
||||
return 100000;
|
||||
|
||||
|
||||
if( aA->IsVirtual() || aB->IsVirtual() )
|
||||
return 0;
|
||||
|
||||
|
@ -136,7 +134,6 @@ NODE* NODE::Branch()
|
|||
child->m_ruleResolver = m_ruleResolver;
|
||||
child->m_root = isRoot() ? this : m_root;
|
||||
child->m_maxClearance = m_maxClearance;
|
||||
child->m_collisionQueryScope = m_collisionQueryScope;
|
||||
|
||||
// Immediate offspring of the root branch needs not copy anything. For the rest, deep-copy
|
||||
// joints, overridden item maps and pointers to stored items.
|
||||
|
@ -365,7 +362,7 @@ NODE::OPT_OBSTACLE NODE::CheckColliding( const ITEM_SET& aSet, int aKindMask )
|
|||
OPT_OBSTACLE obs = CheckColliding( item, aKindMask );
|
||||
|
||||
if( obs )
|
||||
return obs;
|
||||
return obs;
|
||||
}
|
||||
|
||||
return OPT_OBSTACLE();
|
||||
|
@ -522,6 +519,7 @@ void NODE::Add( std::unique_ptr< VIA >&& aVia )
|
|||
addVia( aVia.release() );
|
||||
}
|
||||
|
||||
|
||||
void NODE::add( ITEM* aItem, bool aAllowRedundant )
|
||||
{
|
||||
switch( aItem->Kind() )
|
||||
|
@ -1347,8 +1345,8 @@ void NODE::GetUpdatedItems( ITEM_VECTOR& aRemoved, ITEM_VECTOR& aAdded )
|
|||
for( ITEM* item : m_override )
|
||||
aRemoved.push_back( item );
|
||||
|
||||
for( INDEX::ITEM_SET::iterator i = m_index->begin(); i != m_index->end(); ++i )
|
||||
aAdded.push_back( *i );
|
||||
for( ITEM* item : *m_index )
|
||||
aAdded.push_back( item );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* KiRouter - a push-and-(sometimes-)shove PCB router
|
||||
*
|
||||
* Copyright (C) 2013-2014 CERN
|
||||
* Copyright (C) 2016-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2016-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||
*
|
||||
|
@ -448,16 +448,6 @@ public:
|
|||
|
||||
void FixupVirtualVias();
|
||||
|
||||
void SetCollisionQueryScope( COLLISION_QUERY_SCOPE aScope )
|
||||
{
|
||||
m_collisionQueryScope = aScope;
|
||||
}
|
||||
|
||||
COLLISION_QUERY_SCOPE GetCollisionQueryScope() const
|
||||
{
|
||||
return m_collisionQueryScope;
|
||||
}
|
||||
|
||||
void AddRaw( ITEM* aItem, bool aAllowRedundant = false )
|
||||
{
|
||||
add( aItem, aAllowRedundant );
|
||||
|
@ -538,8 +528,6 @@ private:
|
|||
std::vector< std::unique_ptr<SHAPE> > m_edgeExclusions;
|
||||
|
||||
std::unordered_set<ITEM*> m_garbageItems;
|
||||
|
||||
COLLISION_QUERY_SCOPE m_collisionQueryScope;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -176,15 +176,6 @@ bool ROUTER::StartDragging( const VECTOR2I& aP, ITEM_SET aStartItems, int aDragM
|
|||
if( aStartItems.Empty() )
|
||||
return false;
|
||||
|
||||
if( Settings().Mode() == RM_MarkObstacles )
|
||||
{
|
||||
m_world->SetCollisionQueryScope( NODE::CQS_ALL_RULES );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_world->SetCollisionQueryScope( NODE::CQS_IGNORE_HOLE_CLEARANCE );
|
||||
}
|
||||
|
||||
GetRuleResolver()->ClearCaches();
|
||||
|
||||
if( aStartItems.Count( ITEM::SOLID_T ) == aStartItems.Size() )
|
||||
|
@ -213,9 +204,7 @@ bool ROUTER::StartDragging( const VECTOR2I& aP, ITEM_SET aStartItems, int aDragM
|
|||
m_logger->Clear();
|
||||
|
||||
if( m_logger && aStartItems.Size() )
|
||||
{
|
||||
m_logger->Log( LOGGER::EVT_START_DRAG, aP, aStartItems[0] );
|
||||
}
|
||||
|
||||
if( m_dragger->Start( aP, aStartItems ) )
|
||||
{
|
||||
|
@ -404,15 +393,6 @@ bool ROUTER::isStartingPointRoutable( const VECTOR2I& aWhere, ITEM* aStartItem,
|
|||
|
||||
bool ROUTER::StartRouting( const VECTOR2I& aP, ITEM* aStartItem, int aLayer )
|
||||
{
|
||||
if( Settings().Mode() == RM_MarkObstacles )
|
||||
{
|
||||
m_world->SetCollisionQueryScope( NODE::CQS_ALL_RULES );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_world->SetCollisionQueryScope( NODE::CQS_IGNORE_HOLE_CLEARANCE );
|
||||
}
|
||||
|
||||
GetRuleResolver()->ClearCaches();
|
||||
|
||||
if( !isStartingPointRoutable( aP, aStartItem, aLayer ) )
|
||||
|
@ -515,8 +495,10 @@ bool ROUTER::getNearestRatnestAnchor( VECTOR2I& aOtherEnd, LAYER_RANGE& aOtherEn
|
|||
|
||||
// If the user has drawn a line, get the anchor nearest to the line end
|
||||
if( trace->SegmentCount() > 0 )
|
||||
{
|
||||
return topo.NearestUnconnectedAnchorPoint( trace, aOtherEnd, aOtherEndLayers,
|
||||
aOtherEndItem );
|
||||
}
|
||||
|
||||
// Otherwise, find the closest anchor to our start point
|
||||
|
||||
|
@ -558,7 +540,6 @@ bool ROUTER::Finish()
|
|||
return false;
|
||||
|
||||
// Get our current line and position and nearest ratsnest to them if it exists
|
||||
VECTOR2I currentEnd = placer->CurrentEnd();
|
||||
VECTOR2I otherEnd;
|
||||
LAYER_RANGE otherEndLayers;
|
||||
ITEM* otherEndItem = nullptr;
|
||||
|
@ -573,16 +554,14 @@ bool ROUTER::Finish()
|
|||
|
||||
do
|
||||
{
|
||||
moveResultPoint = Placer()->CurrentEnd();
|
||||
moveResultPoint = placer->CurrentEnd();
|
||||
Move( otherEnd, otherEndItem );
|
||||
triesLeft--;
|
||||
} while( Placer()->CurrentEnd() != moveResultPoint && triesLeft );
|
||||
} while( placer->CurrentEnd() != moveResultPoint && triesLeft );
|
||||
|
||||
// If we've made it, fix the route and we're done
|
||||
if( moveResultPoint == otherEnd && otherEndLayers.Overlaps( GetCurrentLayer() ) )
|
||||
{
|
||||
return FixRoute( otherEnd, otherEndItem, false );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -652,29 +631,11 @@ void ROUTER::markViolations( NODE* aNode, ITEM_SET& aCurrent, NODE::ITEM_VECTOR&
|
|||
if( itemToMark->Layers().IsMultilayer() && !currentItem->Layers().IsMultilayer() )
|
||||
tmp->SetLayer( currentItem->Layer() );
|
||||
|
||||
if( itemToMark->Kind() == ITEM::SOLID_T )
|
||||
if( itemToMark->IsCompoundShapePrimitive() )
|
||||
{
|
||||
#if 0 // fixme holes
|
||||
if( holeOnly || !m_iface->IsFlashedOnLayer( itemToMark, currentItem->Layer() ) )
|
||||
{
|
||||
SOLID* solid = static_cast<SOLID*>( tmp.get() );
|
||||
|
||||
if( solid->Hole() )
|
||||
{
|
||||
solid->SetShape( solid->Hole()->Clone() );
|
||||
|
||||
// Leave the pad flashing around the highlighted hole
|
||||
removeOriginal = false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if( itemToMark->IsCompoundShapePrimitive() )
|
||||
{
|
||||
// We're only highlighting one (or more) of several primitives so we
|
||||
// don't want all the other parts of the object to disappear
|
||||
removeOriginal = false;
|
||||
}
|
||||
// We're only highlighting one (or more) of several primitives so we don't
|
||||
// want all the other parts of the object to disappear
|
||||
removeOriginal = false;
|
||||
}
|
||||
|
||||
m_iface->DisplayItem( tmp.get(), clearance );
|
||||
|
@ -758,9 +719,7 @@ void ROUTER::UpdateSizes( const SIZES_SETTINGS& aSizes )
|
|||
|
||||
// Change track/via size settings
|
||||
if( m_state == ROUTE_TRACK )
|
||||
{
|
||||
m_placer->UpdateSizes( m_sizes );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -784,13 +743,19 @@ bool ROUTER::movePlacing( const VECTOR2I& aP, ITEM* aEndItem )
|
|||
if( l->EndsWithVia() )
|
||||
{
|
||||
const VIA& via = l->Via();
|
||||
int viaClearance = GetRuleResolver()->Clearance( &via, nullptr );
|
||||
int holeClearance = 0; // GetRuleResolver()->HoleClearance( &via, nullptr ); // fixme holes
|
||||
clearance = GetRuleResolver()->Clearance( &via, nullptr );
|
||||
|
||||
if( holeClearance + via.Drill() / 2 > viaClearance + via.Diameter() / 2 )
|
||||
viaClearance = holeClearance + via.Drill() / 2 - via.Diameter() / 2;
|
||||
if( via.HasHole() )
|
||||
{
|
||||
int holeClearance = GetRuleResolver()->Clearance( via.Hole(), nullptr );
|
||||
int annularWidth = std::max( 0, via.Diameter() - via.Drill() ) / 2;
|
||||
int excessHoleClearance = holeClearance - annularWidth;
|
||||
|
||||
m_iface->DisplayItem( &l->Via(), viaClearance, false, true );
|
||||
if( excessHoleClearance > clearance )
|
||||
clearance = excessHoleClearance;
|
||||
}
|
||||
|
||||
m_iface->DisplayItem( &l->Via(), clearance, false, true );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -870,17 +835,13 @@ void ROUTER::CommitRouting( NODE* aNode )
|
|||
for( ITEM* item : added )
|
||||
{
|
||||
if( !item->IsVirtual() )
|
||||
{
|
||||
m_iface->AddItem( item );
|
||||
}
|
||||
}
|
||||
|
||||
for( ITEM* item : changed )
|
||||
{
|
||||
if( !item->IsVirtual() )
|
||||
{
|
||||
m_iface->UpdateItem( item );
|
||||
}
|
||||
}
|
||||
|
||||
m_iface->Commit();
|
||||
|
@ -993,9 +954,7 @@ void ROUTER::ToggleViaPlacement()
|
|||
m_placer->ToggleVia( toggle );
|
||||
|
||||
if( m_logger )
|
||||
{
|
||||
m_logger->Log( LOGGER::EVT_TOGGLE_VIA, VECTOR2I(), nullptr, &m_sizes );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1073,6 +1032,7 @@ void ROUTER::SetInterface( ROUTER_IFACE *aIface )
|
|||
m_iface = aIface;
|
||||
}
|
||||
|
||||
|
||||
void ROUTER::BreakSegment( ITEM *aItem, const VECTOR2I& aP )
|
||||
{
|
||||
NODE *node = m_world->Branch();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* KiRouter - a push-and-(sometimes-)shove PCB router
|
||||
*
|
||||
* Copyright (C) 2013-2014 CERN
|
||||
* Copyright (C) 2016-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2016-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
|
@ -23,9 +23,7 @@
|
|||
|
||||
#include <geometry/shape.h>
|
||||
#include <geometry/shape_line_chain.h>
|
||||
#include <geometry/shape_rect.h>
|
||||
#include <geometry/shape_circle.h>
|
||||
#include <geometry/shape_simple.h>
|
||||
#include <geometry/shape_compound.h>
|
||||
#include <geometry/shape_poly_set.h>
|
||||
|
||||
|
@ -40,11 +38,6 @@ namespace PNS {
|
|||
|
||||
const SHAPE_LINE_CHAIN SOLID::Hull( int aClearance, int aWalkaroundThickness, int aLayer ) const
|
||||
{
|
||||
//if( !ROUTER::GetInstance()->GetInterface()->IsFlashedOnLayer( this, aLayer ) )
|
||||
// return HoleHull( aClearance, aWalkaroundThickness, aLayer );
|
||||
|
||||
// fixme holes
|
||||
|
||||
if( !m_shape )
|
||||
return SHAPE_LINE_CHAIN();
|
||||
|
||||
|
|
|
@ -100,9 +100,7 @@ public:
|
|||
virtual ~VIA()
|
||||
{
|
||||
if ( m_hole && m_hole->BelongsTo( this ) )
|
||||
{
|
||||
delete m_hole;
|
||||
}
|
||||
}
|
||||
|
||||
static inline bool ClassOf( const ITEM* aItem )
|
||||
|
@ -116,6 +114,7 @@ public:
|
|||
{
|
||||
m_pos = aPos;
|
||||
m_shape.SetCenter( aPos );
|
||||
|
||||
if( m_hole )
|
||||
m_hole->SetCenter( aPos );
|
||||
}
|
||||
|
@ -136,6 +135,7 @@ public:
|
|||
void SetDrill( int aDrill )
|
||||
{
|
||||
m_drill = aDrill;
|
||||
|
||||
if( m_hole )
|
||||
m_hole->SetRadius( m_drill / 2 );
|
||||
}
|
||||
|
@ -172,18 +172,14 @@ public:
|
|||
virtual void SetHole( HOLE* aHole ) override
|
||||
{
|
||||
if( m_hole && m_hole->Owner() == this )
|
||||
{
|
||||
delete m_hole;
|
||||
}
|
||||
|
||||
m_hole = aHole;
|
||||
m_hole->SetNet( Net() );
|
||||
m_hole->SetOwner( this );
|
||||
|
||||
if( m_hole )
|
||||
{
|
||||
m_hole->SetLayers( m_layers ); // fixme: backdrill vias can have hole layer set different than copper layer set
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool HasHole() const override { return true; }
|
||||
|
|
Loading…
Reference in New Issue