Performance enhancements for PNS.
This commit is contained in:
parent
43001cae38
commit
5e569e81e7
|
@ -87,21 +87,19 @@ public:
|
|||
virtual wxString NetName( int aNet ) override;
|
||||
|
||||
private:
|
||||
struct CLEARANCE_ENT
|
||||
{
|
||||
int coupledNet;
|
||||
int dpClearance;
|
||||
int clearance;
|
||||
};
|
||||
|
||||
int holeRadius( const PNS::ITEM* aItem ) const;
|
||||
int matchDpSuffix( const wxString& aNetName, wxString& aComplementNet, wxString& aBaseDpName );
|
||||
|
||||
private:
|
||||
PNS::ROUTER_IFACE* m_routerIface;
|
||||
BOARD* m_board;
|
||||
TRACK m_dummyTrack;
|
||||
ARC m_dummyArc;
|
||||
VIA m_dummyVia;
|
||||
|
||||
// NB: this clearance cache is never cleared. It DEPENDS on PNS_PCBNEW_RULE_RESOLVER
|
||||
// being created in syncWorld() before each routing session.
|
||||
std::map<std::pair<const PNS::ITEM*, const PNS::ITEM*>, int> m_clearanceCache;
|
||||
};
|
||||
|
||||
|
||||
|
@ -289,6 +287,15 @@ bool PNS_PCBNEW_RULE_RESOLVER::QueryConstraint( PNS::CONSTRAINT_TYPE aType,
|
|||
|
||||
int PNS_PCBNEW_RULE_RESOLVER::Clearance( const PNS::ITEM* aA, const PNS::ITEM* aB )
|
||||
{
|
||||
// NB: this clearance cache is never cleared. It DEPENDS on PNS_PCBNEW_RULE_RESOLVER
|
||||
// being created in syncWorld() before each routing session.
|
||||
|
||||
std::pair<const PNS::ITEM*, const PNS::ITEM*> key( aA, aB );
|
||||
auto it = m_clearanceCache.find( key );
|
||||
|
||||
if( it != m_clearanceCache.end() )
|
||||
return it->second;
|
||||
|
||||
PNS::CONSTRAINT constraint;
|
||||
bool ok = false;
|
||||
int rv = 0;
|
||||
|
@ -316,9 +323,9 @@ int PNS_PCBNEW_RULE_RESOLVER::Clearance( const PNS::ITEM* aA, const PNS::ITEM* a
|
|||
|
||||
// still no valid clearance rule? fall back to global minimum.
|
||||
if( !ok )
|
||||
{
|
||||
rv = m_board->GetDesignSettings().m_MinClearance;
|
||||
}
|
||||
|
||||
m_clearanceCache[ key ] = rv;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -46,14 +46,12 @@ namespace KIGFX
|
|||
class VIEW;
|
||||
}
|
||||
|
||||
class PNS_KICAD_IFACE_BASE : public PNS::ROUTER_IFACE {
|
||||
class PNS_KICAD_IFACE_BASE : public PNS::ROUTER_IFACE
|
||||
{
|
||||
public:
|
||||
PNS_KICAD_IFACE_BASE();
|
||||
~PNS_KICAD_IFACE_BASE();
|
||||
|
||||
void SetHostTool( PCB_TOOL_BASE* aTool );
|
||||
void SetDisplayOptions( const PCB_DISPLAY_OPTIONS* aDispOptions );
|
||||
|
||||
void EraseView() override {};
|
||||
void SetBoard( BOARD* aBoard );
|
||||
void SyncWorld( PNS::NODE* aWorld ) override;
|
||||
|
@ -61,7 +59,8 @@ public:
|
|||
bool IsOnLayer( const PNS::ITEM* aItem, int aLayer ) const override { return true; };
|
||||
bool IsItemVisible( const PNS::ITEM* aItem ) const override { return true; }
|
||||
void HideItem( PNS::ITEM* aItem ) override {}
|
||||
void DisplayItem( const PNS::ITEM* aItem, int aColor = 0, int aClearance = 0, bool aEdit = false ) override {}
|
||||
void DisplayItem( const PNS::ITEM* aItem, int aColor = 0, int aClearance = 0,
|
||||
bool aEdit = false ) override {}
|
||||
void DisplayRatline( const SHAPE_LINE_CHAIN& aRatline, int aColor = -1 ) override {}
|
||||
void AddItem( PNS::ITEM* aItem ) override;
|
||||
void RemoveItem( PNS::ITEM* aItem ) override;
|
||||
|
@ -98,12 +97,13 @@ protected:
|
|||
bool syncZone( PNS::NODE* aWorld, ZONE_CONTAINER* aZone, SHAPE_POLY_SET* aBoardOutline );
|
||||
bool inheritTrackWidth( PNS::ITEM* aItem, int* aInheritedWidth );
|
||||
|
||||
|
||||
protected:
|
||||
PNS::NODE* m_world;
|
||||
BOARD* m_board;
|
||||
};
|
||||
|
||||
class PNS_KICAD_IFACE : public PNS_KICAD_IFACE_BASE {
|
||||
class PNS_KICAD_IFACE : public PNS_KICAD_IFACE_BASE
|
||||
{
|
||||
public:
|
||||
PNS_KICAD_IFACE();
|
||||
~PNS_KICAD_IFACE();
|
||||
|
@ -117,7 +117,8 @@ public:
|
|||
bool IsItemVisible( const PNS::ITEM* aItem ) const override;
|
||||
bool IsOnLayer( const PNS::ITEM* aItem, int aLayer ) const override;
|
||||
void HideItem( PNS::ITEM* aItem ) override;
|
||||
void DisplayItem( const PNS::ITEM* aItem, int aColor = 0, int aClearance = 0, bool aEdit = false ) override;
|
||||
void DisplayItem( const PNS::ITEM* aItem, int aColor = 0, int aClearance = 0,
|
||||
bool aEdit = false ) override;
|
||||
void DisplayRatline( const SHAPE_LINE_CHAIN& aRatline, int aColor = -1 ) override;
|
||||
void Commit() override;
|
||||
void AddItem( PNS::ITEM* aItem ) override;
|
||||
|
|
Loading…
Reference in New Issue