Ratsnest: Keep connectivity data local

The dynamic ratsnest did not need to have a smart pointer to the
temporary connectivity data.
This commit is contained in:
Seth Hillbrand 2018-10-24 07:40:59 -07:00
parent b9a9fe6c9e
commit a0e4e23c14
2 changed files with 16 additions and 13 deletions

View File

@ -40,6 +40,13 @@ CONNECTIVITY_DATA::CONNECTIVITY_DATA()
}
CONNECTIVITY_DATA::CONNECTIVITY_DATA( const std::vector<BOARD_ITEM*>& aItems )
{
Build( aItems );
m_progressReporter = nullptr;
}
CONNECTIVITY_DATA::~CONNECTIVITY_DATA()
{
Clear();
@ -241,25 +248,22 @@ void CONNECTIVITY_DATA::FindIsolatedCopperIslands( std::vector<CN_ZONE_ISOLATED_
void CONNECTIVITY_DATA::ComputeDynamicRatsnest( const std::vector<BOARD_ITEM*>& aItems )
{
m_dynamicRatsnest.clear();
if( std::none_of( aItems.begin(), aItems.end(), []( const BOARD_ITEM* aItem )
{ return( aItem->Type() == PCB_TRACE_T || aItem->Type() == PCB_PAD_T ||
aItem->Type() == PCB_ZONE_AREA_T || aItem->Type() == PCB_MODULE_T ||
aItem->Type() == PCB_VIA_T ); } ) )
aItem->Type() == PCB_ZONE_AREA_T || aItem->Type() == PCB_MODULE_T ||
aItem->Type() == PCB_VIA_T ); } ) )
{
m_dynamicRatsnest.clear();
return ;
}
m_dynamicConnectivity.reset( new CONNECTIVITY_DATA );
m_dynamicConnectivity->Build( aItems );
m_dynamicRatsnest.clear();
CONNECTIVITY_DATA connData( aItems );
BlockRatsnestItems( aItems );
for( unsigned int nc = 1; nc < m_dynamicConnectivity->m_nets.size(); nc++ )
for( unsigned int nc = 1; nc < connData.m_nets.size(); nc++ )
{
auto dynNet = m_dynamicConnectivity->m_nets[nc];
auto dynNet = connData.m_nets[nc];
if( dynNet->GetNodeCount() != 0 )
{
@ -278,7 +282,7 @@ void CONNECTIVITY_DATA::ComputeDynamicRatsnest( const std::vector<BOARD_ITEM*>&
}
}
for( auto net : m_dynamicConnectivity->m_nets )
for( auto net : connData.m_nets )
{
if( !net )
continue;
@ -312,7 +316,6 @@ void CONNECTIVITY_DATA::ClearDynamicRatsnest()
void CONNECTIVITY_DATA::HideDynamicRatsnest()
{
m_dynamicConnectivity.reset();
m_dynamicRatsnest.clear();
}

View File

@ -83,6 +83,7 @@ public:
CONNECTIVITY_DATA();
~CONNECTIVITY_DATA();
CONNECTIVITY_DATA( const std::vector<BOARD_ITEM*>& aItems );
/**
* Function Build()
@ -246,7 +247,6 @@ private:
void updateRatsnest();
void addRatsnestCluster( const std::shared_ptr<CN_CLUSTER>& aCluster );
std::unique_ptr<CONNECTIVITY_DATA> m_dynamicConnectivity;
std::shared_ptr<CN_CONNECTIVITY_ALGO> m_connAlgo;
std::vector<RN_DYNAMIC_LINE> m_dynamicRatsnest;