Performance enhancements for PNS.
This commit is contained in:
parent
43001cae38
commit
5e569e81e7
|
@ -87,21 +87,19 @@ public:
|
||||||
virtual wxString NetName( int aNet ) override;
|
virtual wxString NetName( int aNet ) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct CLEARANCE_ENT
|
|
||||||
{
|
|
||||||
int coupledNet;
|
|
||||||
int dpClearance;
|
|
||||||
int clearance;
|
|
||||||
};
|
|
||||||
|
|
||||||
int holeRadius( const PNS::ITEM* aItem ) const;
|
int holeRadius( const PNS::ITEM* aItem ) const;
|
||||||
int matchDpSuffix( const wxString& aNetName, wxString& aComplementNet, wxString& aBaseDpName );
|
int matchDpSuffix( const wxString& aNetName, wxString& aComplementNet, wxString& aBaseDpName );
|
||||||
|
|
||||||
|
private:
|
||||||
PNS::ROUTER_IFACE* m_routerIface;
|
PNS::ROUTER_IFACE* m_routerIface;
|
||||||
BOARD* m_board;
|
BOARD* m_board;
|
||||||
TRACK m_dummyTrack;
|
TRACK m_dummyTrack;
|
||||||
ARC m_dummyArc;
|
ARC m_dummyArc;
|
||||||
VIA m_dummyVia;
|
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 )
|
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;
|
PNS::CONSTRAINT constraint;
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
int rv = 0;
|
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.
|
// still no valid clearance rule? fall back to global minimum.
|
||||||
if( !ok )
|
if( !ok )
|
||||||
{
|
|
||||||
rv = m_board->GetDesignSettings().m_MinClearance;
|
rv = m_board->GetDesignSettings().m_MinClearance;
|
||||||
}
|
|
||||||
|
m_clearanceCache[ key ] = rv;
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,14 +46,12 @@ namespace KIGFX
|
||||||
class VIEW;
|
class VIEW;
|
||||||
}
|
}
|
||||||
|
|
||||||
class PNS_KICAD_IFACE_BASE : public PNS::ROUTER_IFACE {
|
class PNS_KICAD_IFACE_BASE : public PNS::ROUTER_IFACE
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
PNS_KICAD_IFACE_BASE();
|
PNS_KICAD_IFACE_BASE();
|
||||||
~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 EraseView() override {};
|
||||||
void SetBoard( BOARD* aBoard );
|
void SetBoard( BOARD* aBoard );
|
||||||
void SyncWorld( PNS::NODE* aWorld ) override;
|
void SyncWorld( PNS::NODE* aWorld ) override;
|
||||||
|
@ -61,7 +59,8 @@ public:
|
||||||
bool IsOnLayer( const PNS::ITEM* aItem, int aLayer ) const override { return true; };
|
bool IsOnLayer( const PNS::ITEM* aItem, int aLayer ) const override { return true; };
|
||||||
bool IsItemVisible( const PNS::ITEM* aItem ) const override { return true; }
|
bool IsItemVisible( const PNS::ITEM* aItem ) const override { return true; }
|
||||||
void HideItem( PNS::ITEM* aItem ) 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 DisplayRatline( const SHAPE_LINE_CHAIN& aRatline, int aColor = -1 ) override {}
|
||||||
void AddItem( PNS::ITEM* aItem ) override;
|
void AddItem( PNS::ITEM* aItem ) override;
|
||||||
void RemoveItem( 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 syncZone( PNS::NODE* aWorld, ZONE_CONTAINER* aZone, SHAPE_POLY_SET* aBoardOutline );
|
||||||
bool inheritTrackWidth( PNS::ITEM* aItem, int* aInheritedWidth );
|
bool inheritTrackWidth( PNS::ITEM* aItem, int* aInheritedWidth );
|
||||||
|
|
||||||
|
protected:
|
||||||
PNS::NODE* m_world;
|
PNS::NODE* m_world;
|
||||||
BOARD* m_board;
|
BOARD* m_board;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PNS_KICAD_IFACE : public PNS_KICAD_IFACE_BASE {
|
class PNS_KICAD_IFACE : public PNS_KICAD_IFACE_BASE
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
PNS_KICAD_IFACE();
|
PNS_KICAD_IFACE();
|
||||||
~PNS_KICAD_IFACE();
|
~PNS_KICAD_IFACE();
|
||||||
|
@ -117,7 +117,8 @@ public:
|
||||||
bool IsItemVisible( const PNS::ITEM* aItem ) const override;
|
bool IsItemVisible( const PNS::ITEM* aItem ) const override;
|
||||||
bool IsOnLayer( const PNS::ITEM* aItem, int aLayer ) const override;
|
bool IsOnLayer( const PNS::ITEM* aItem, int aLayer ) const override;
|
||||||
void HideItem( PNS::ITEM* aItem ) 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 DisplayRatline( const SHAPE_LINE_CHAIN& aRatline, int aColor = -1 ) override;
|
||||||
void Commit() override;
|
void Commit() override;
|
||||||
void AddItem( PNS::ITEM* aItem ) override;
|
void AddItem( PNS::ITEM* aItem ) override;
|
||||||
|
|
Loading…
Reference in New Issue