2017-03-22 13:43:10 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KICAD, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2017 CERN
|
2023-01-09 13:28:06 +00:00
|
|
|
* Copyright (C) 2018-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
2017-03-22 13:43:10 +00:00
|
|
|
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
2018-09-20 02:10:12 +00:00
|
|
|
|
2017-03-22 13:43:10 +00:00
|
|
|
#ifdef PROFILE
|
2023-09-07 11:22:10 +00:00
|
|
|
#include <core/profile.h>
|
2017-03-22 13:43:10 +00:00
|
|
|
#endif
|
|
|
|
|
2018-10-12 12:54:21 +00:00
|
|
|
#include <algorithm>
|
2018-10-25 11:20:12 +00:00
|
|
|
#include <future>
|
2022-03-03 23:49:05 +00:00
|
|
|
#include <initializer_list>
|
2018-09-20 02:10:12 +00:00
|
|
|
|
2018-10-12 06:17:15 +00:00
|
|
|
#include <connectivity/connectivity_data.h>
|
|
|
|
#include <connectivity/connectivity_algo.h>
|
2020-09-25 18:26:58 +00:00
|
|
|
#include <connectivity/from_to_cache.h>
|
2022-08-14 11:03:18 +00:00
|
|
|
#include <project/net_settings.h>
|
|
|
|
#include <board_design_settings.h>
|
2022-02-20 23:49:02 +00:00
|
|
|
#include <geometry/shape_segment.h>
|
|
|
|
#include <geometry/shape_circle.h>
|
2020-06-16 18:15:14 +00:00
|
|
|
#include <ratsnest/ratsnest_data.h>
|
2021-12-30 14:16:19 +00:00
|
|
|
#include <progress_reporter.h>
|
2023-09-06 21:19:38 +00:00
|
|
|
#include <core/thread_pool.h>
|
2021-08-02 21:41:59 +00:00
|
|
|
#include <trigo.h>
|
2022-06-18 18:47:11 +00:00
|
|
|
#include <drc/drc_rtree.h>
|
2017-03-22 13:43:10 +00:00
|
|
|
|
2023-11-01 12:47:42 +00:00
|
|
|
CONNECTIVITY_DATA::CONNECTIVITY_DATA() :
|
|
|
|
m_skipRatsnestUpdate( false )
|
2017-03-22 13:43:10 +00:00
|
|
|
{
|
2023-11-01 13:53:30 +00:00
|
|
|
m_connAlgo.reset( new CN_CONNECTIVITY_ALGO( this ) );
|
2018-01-06 05:02:28 +00:00
|
|
|
m_progressReporter = nullptr;
|
2020-09-25 18:26:58 +00:00
|
|
|
m_fromToCache.reset( new FROM_TO_CACHE );
|
2017-03-22 13:43:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-11-01 12:47:42 +00:00
|
|
|
CONNECTIVITY_DATA::CONNECTIVITY_DATA( std::shared_ptr<CONNECTIVITY_DATA> aGlobalConnectivity,
|
|
|
|
const std::vector<BOARD_ITEM*>& aLocalItems,
|
|
|
|
bool aSkipRatsnestUpdate ) :
|
|
|
|
m_skipRatsnestUpdate( aSkipRatsnestUpdate )
|
2018-10-24 14:40:59 +00:00
|
|
|
{
|
2023-11-01 12:47:42 +00:00
|
|
|
Build( aGlobalConnectivity, aLocalItems );
|
2018-10-24 14:40:59 +00:00
|
|
|
m_progressReporter = nullptr;
|
2020-09-25 18:26:58 +00:00
|
|
|
m_fromToCache.reset( new FROM_TO_CACHE );
|
2018-10-24 14:40:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-03-22 13:43:10 +00:00
|
|
|
CONNECTIVITY_DATA::~CONNECTIVITY_DATA()
|
|
|
|
{
|
2022-11-30 12:18:58 +00:00
|
|
|
for( RN_NET* net : m_nets )
|
|
|
|
delete net;
|
|
|
|
|
|
|
|
m_nets.clear();
|
2017-03-22 13:43:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool CONNECTIVITY_DATA::Add( BOARD_ITEM* aItem )
|
|
|
|
{
|
|
|
|
m_connAlgo->Add( aItem );
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool CONNECTIVITY_DATA::Remove( BOARD_ITEM* aItem )
|
|
|
|
{
|
|
|
|
m_connAlgo->Remove( aItem );
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool CONNECTIVITY_DATA::Update( BOARD_ITEM* aItem )
|
|
|
|
{
|
|
|
|
m_connAlgo->Remove( aItem );
|
|
|
|
m_connAlgo->Add( aItem );
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-01-23 23:55:29 +00:00
|
|
|
bool CONNECTIVITY_DATA::Build( BOARD* aBoard, PROGRESS_REPORTER* aReporter )
|
2017-03-22 13:43:10 +00:00
|
|
|
{
|
2022-02-15 12:17:31 +00:00
|
|
|
aBoard->CacheTriangulation( aReporter );
|
|
|
|
|
2021-12-12 15:19:56 +00:00
|
|
|
std::unique_lock<KISPINLOCK> lock( m_lock, std::try_to_lock );
|
|
|
|
|
|
|
|
if( !lock )
|
2023-01-23 23:55:29 +00:00
|
|
|
return false;
|
2021-12-11 23:09:53 +00:00
|
|
|
|
2022-02-15 12:17:31 +00:00
|
|
|
if( aReporter )
|
2022-02-15 13:41:13 +00:00
|
|
|
{
|
2022-02-15 12:17:31 +00:00
|
|
|
aReporter->Report( _( "Updating nets..." ) );
|
2022-02-15 13:41:13 +00:00
|
|
|
aReporter->KeepRefreshing( false );
|
|
|
|
}
|
2022-02-15 12:17:31 +00:00
|
|
|
|
2022-08-14 11:03:18 +00:00
|
|
|
std::shared_ptr<NET_SETTINGS>& netSettings = aBoard->GetDesignSettings().m_NetSettings;
|
|
|
|
|
2023-11-01 13:53:30 +00:00
|
|
|
m_connAlgo.reset( new CN_CONNECTIVITY_ALGO( this ) );
|
2020-09-23 10:46:41 +00:00
|
|
|
m_connAlgo->Build( aBoard, aReporter );
|
2020-07-11 17:42:00 +00:00
|
|
|
|
|
|
|
m_netclassMap.clear();
|
|
|
|
|
|
|
|
for( NETINFO_ITEM* net : aBoard->GetNetInfo() )
|
2022-02-14 17:19:28 +00:00
|
|
|
{
|
2022-08-14 11:03:18 +00:00
|
|
|
net->SetNetClass( netSettings->GetEffectiveNetClass( net->GetNetname() ) );
|
|
|
|
|
2020-07-11 17:42:00 +00:00
|
|
|
if( net->GetNetClass()->GetName() != NETCLASS::Default )
|
2020-12-08 13:02:08 +00:00
|
|
|
m_netclassMap[ net->GetNetCode() ] = net->GetNetClass()->GetName();
|
2022-02-14 17:19:28 +00:00
|
|
|
}
|
2020-07-11 17:42:00 +00:00
|
|
|
|
2021-12-30 14:16:19 +00:00
|
|
|
if( aReporter )
|
|
|
|
{
|
|
|
|
aReporter->SetCurrentProgress( 0.75 );
|
|
|
|
aReporter->KeepRefreshing( false );
|
|
|
|
}
|
|
|
|
|
2023-02-03 14:22:36 +00:00
|
|
|
internalRecalculateRatsnest();
|
2021-12-30 14:16:19 +00:00
|
|
|
|
|
|
|
if( aReporter )
|
|
|
|
{
|
|
|
|
aReporter->SetCurrentProgress( 1.0 );
|
|
|
|
aReporter->KeepRefreshing( false );
|
|
|
|
}
|
2023-01-23 23:55:29 +00:00
|
|
|
|
|
|
|
return true;
|
2017-03-22 13:43:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-11-01 12:47:42 +00:00
|
|
|
void CONNECTIVITY_DATA::Build( std::shared_ptr<CONNECTIVITY_DATA>& aGlobalConnectivity,
|
|
|
|
const std::vector<BOARD_ITEM*>& aLocalItems )
|
2017-03-22 13:43:10 +00:00
|
|
|
{
|
2021-12-12 15:19:56 +00:00
|
|
|
std::unique_lock<KISPINLOCK> lock( m_lock, std::try_to_lock );
|
|
|
|
|
|
|
|
if( !lock )
|
|
|
|
return;
|
2021-12-11 23:09:53 +00:00
|
|
|
|
2023-11-01 13:53:30 +00:00
|
|
|
m_connAlgo.reset( new CN_CONNECTIVITY_ALGO( this ) );
|
|
|
|
m_connAlgo->LocalBuild( aGlobalConnectivity, aLocalItems );
|
2017-03-22 13:43:10 +00:00
|
|
|
|
2023-02-03 14:22:36 +00:00
|
|
|
internalRecalculateRatsnest();
|
2017-03-22 13:43:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-08-15 00:33:27 +00:00
|
|
|
void CONNECTIVITY_DATA::Move( const VECTOR2I& aDelta )
|
|
|
|
{
|
2020-12-08 13:02:08 +00:00
|
|
|
m_connAlgo->ForEachAnchor( [&aDelta]( CN_ANCHOR& anchor )
|
|
|
|
{
|
|
|
|
anchor.Move( aDelta );
|
|
|
|
} );
|
2020-08-15 00:33:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-03-22 13:43:10 +00:00
|
|
|
void CONNECTIVITY_DATA::updateRatsnest()
|
|
|
|
{
|
2021-11-30 14:19:39 +00:00
|
|
|
#ifdef PROFILE
|
2022-09-17 18:43:46 +00:00
|
|
|
PROF_TIMER rnUpdate( "update-ratsnest" );
|
2021-11-30 14:19:39 +00:00
|
|
|
#endif
|
|
|
|
|
2018-10-18 00:05:30 +00:00
|
|
|
std::vector<RN_NET*> dirty_nets;
|
2017-03-22 13:43:10 +00:00
|
|
|
|
2018-10-21 14:31:07 +00:00
|
|
|
// Start with net 1 as net 0 is reserved for not-connected
|
2018-10-25 11:20:12 +00:00
|
|
|
// Nets without nodes are also ignored
|
2018-10-18 00:05:30 +00:00
|
|
|
std::copy_if( m_nets.begin() + 1, m_nets.end(), std::back_inserter( dirty_nets ),
|
2021-11-30 14:19:39 +00:00
|
|
|
[] ( RN_NET* aNet )
|
|
|
|
{
|
|
|
|
return aNet->IsDirty() && aNet->GetNodeCount() > 0;
|
|
|
|
} );
|
2018-10-25 11:20:12 +00:00
|
|
|
|
2022-12-02 20:01:34 +00:00
|
|
|
thread_pool& tp = GetKiCadThreadPool();
|
|
|
|
|
|
|
|
tp.push_loop( dirty_nets.size(),
|
2023-04-16 14:35:58 +00:00
|
|
|
[&]( const int a, const int b )
|
2021-11-30 14:19:39 +00:00
|
|
|
{
|
2022-06-15 00:41:10 +00:00
|
|
|
for( int ii = a; ii < b; ++ii )
|
2022-11-21 21:51:28 +00:00
|
|
|
dirty_nets[ii]->UpdateNet();
|
2022-12-02 20:01:34 +00:00
|
|
|
} );
|
|
|
|
tp.wait_for_tasks();
|
2017-06-23 11:56:28 +00:00
|
|
|
|
2023-04-16 14:35:58 +00:00
|
|
|
tp.push_loop( dirty_nets.size(),
|
|
|
|
[&]( const int a, const int b )
|
|
|
|
{
|
|
|
|
for( int ii = a; ii < b; ++ii )
|
|
|
|
dirty_nets[ii]->OptimizeRNEdges();
|
|
|
|
} );
|
|
|
|
tp.wait_for_tasks();
|
|
|
|
|
2021-11-30 14:19:39 +00:00
|
|
|
#ifdef PROFILE
|
2017-03-22 13:43:10 +00:00
|
|
|
rnUpdate.Show();
|
2021-11-30 14:19:39 +00:00
|
|
|
#endif
|
2017-03-22 13:43:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-09-23 09:20:10 +00:00
|
|
|
void CONNECTIVITY_DATA::addRatsnestCluster( const std::shared_ptr<CN_CLUSTER>& aCluster )
|
2017-03-22 13:43:10 +00:00
|
|
|
{
|
2021-11-30 14:19:39 +00:00
|
|
|
RN_NET* rnNet = m_nets[ aCluster->OriginNet() ];
|
2017-03-22 13:43:10 +00:00
|
|
|
|
|
|
|
rnNet->AddCluster( aCluster );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-05-25 01:55:40 +00:00
|
|
|
void CONNECTIVITY_DATA::RecalculateRatsnest( BOARD_COMMIT* aCommit )
|
2017-03-22 13:43:10 +00:00
|
|
|
{
|
2023-01-27 01:30:34 +00:00
|
|
|
|
|
|
|
// We can take over the lock here if called in the same thread
|
|
|
|
// This is to prevent redraw during a RecalculateRatsnets process
|
2023-02-03 14:22:36 +00:00
|
|
|
std::unique_lock<KISPINLOCK> lock( m_lock );
|
2023-01-27 01:30:34 +00:00
|
|
|
|
2023-02-03 14:22:36 +00:00
|
|
|
internalRecalculateRatsnest( aCommit );
|
2023-01-27 01:30:34 +00:00
|
|
|
|
2023-02-03 14:22:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CONNECTIVITY_DATA::internalRecalculateRatsnest( BOARD_COMMIT* aCommit )
|
|
|
|
{
|
2019-05-25 01:55:40 +00:00
|
|
|
m_connAlgo->PropagateNets( aCommit );
|
2017-04-18 15:32:05 +00:00
|
|
|
|
2017-03-22 13:43:10 +00:00
|
|
|
int lastNet = m_connAlgo->NetCount();
|
|
|
|
|
|
|
|
if( lastNet >= (int) m_nets.size() )
|
|
|
|
{
|
|
|
|
unsigned int prevSize = m_nets.size();
|
|
|
|
m_nets.resize( lastNet + 1 );
|
|
|
|
|
|
|
|
for( unsigned int i = prevSize; i < m_nets.size(); i++ )
|
|
|
|
m_nets[i] = new RN_NET;
|
|
|
|
}
|
2022-10-03 16:32:29 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
for( size_t ii = lastNet; ii < m_nets.size(); ++ii )
|
|
|
|
m_nets[ii]->Clear();
|
|
|
|
}
|
2017-03-22 13:43:10 +00:00
|
|
|
|
2022-02-13 11:54:41 +00:00
|
|
|
const std::vector<std::shared_ptr<CN_CLUSTER>>& clusters = m_connAlgo->GetClusters();
|
2017-03-22 13:43:10 +00:00
|
|
|
|
|
|
|
for( int net = 0; net < lastNet; net++ )
|
2017-06-30 11:40:20 +00:00
|
|
|
{
|
2017-03-22 13:43:10 +00:00
|
|
|
if( m_connAlgo->IsNetDirty( net ) )
|
|
|
|
{
|
|
|
|
m_nets[net]->Clear();
|
|
|
|
}
|
2017-06-30 11:40:20 +00:00
|
|
|
}
|
2017-03-22 13:51:07 +00:00
|
|
|
|
2022-02-13 11:54:41 +00:00
|
|
|
for( const std::shared_ptr<CN_CLUSTER>& c : clusters )
|
2017-03-22 13:43:10 +00:00
|
|
|
{
|
|
|
|
int net = c->OriginNet();
|
|
|
|
|
2020-06-26 02:19:51 +00:00
|
|
|
// Don't add intentionally-kept zone islands to the ratsnest
|
|
|
|
if( c->IsOrphaned() && c->Size() == 1 )
|
|
|
|
{
|
2020-09-23 19:02:21 +00:00
|
|
|
if( dynamic_cast<CN_ZONE_LAYER*>( *c->begin() ) )
|
2020-06-26 02:19:51 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2017-03-22 13:43:10 +00:00
|
|
|
if( m_connAlgo->IsNetDirty( net ) )
|
|
|
|
addRatsnestCluster( c );
|
|
|
|
}
|
|
|
|
|
|
|
|
m_connAlgo->ClearDirtyFlags();
|
|
|
|
|
2023-11-01 12:47:42 +00:00
|
|
|
if( !m_skipRatsnestUpdate )
|
2020-06-23 03:35:34 +00:00
|
|
|
updateRatsnest();
|
2017-03-22 13:43:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-03-22 13:51:07 +00:00
|
|
|
void CONNECTIVITY_DATA::BlockRatsnestItems( const std::vector<BOARD_ITEM*>& aItems )
|
2017-03-22 13:43:10 +00:00
|
|
|
{
|
|
|
|
std::vector<BOARD_CONNECTED_ITEM*> citems;
|
|
|
|
|
2021-11-30 14:19:39 +00:00
|
|
|
for( BOARD_ITEM* item : aItems )
|
2017-03-22 13:43:10 +00:00
|
|
|
{
|
2020-11-13 12:21:02 +00:00
|
|
|
if( item->Type() == PCB_FOOTPRINT_T )
|
2017-03-22 13:43:10 +00:00
|
|
|
{
|
2020-11-13 15:15:52 +00:00
|
|
|
for( PAD* pad : static_cast<FOOTPRINT*>(item)->Pads() )
|
2017-03-22 13:43:10 +00:00
|
|
|
citems.push_back( pad );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-11-30 14:19:39 +00:00
|
|
|
if( BOARD_CONNECTED_ITEM* citem = dynamic_cast<BOARD_CONNECTED_ITEM*>( item ) )
|
2020-08-07 20:37:00 +00:00
|
|
|
citems.push_back( citem );
|
2017-03-22 13:43:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-30 14:19:39 +00:00
|
|
|
for( const BOARD_CONNECTED_ITEM* item : citems )
|
2017-03-22 13:43:10 +00:00
|
|
|
{
|
2017-09-28 16:38:54 +00:00
|
|
|
if ( m_connAlgo->ItemExists( item ) )
|
2017-03-22 13:43:10 +00:00
|
|
|
{
|
2021-11-30 14:19:39 +00:00
|
|
|
CN_CONNECTIVITY_ALGO::ITEM_MAP_ENTRY& entry = m_connAlgo->ItemEntry( item );
|
2017-09-28 16:38:54 +00:00
|
|
|
|
2021-11-30 14:19:39 +00:00
|
|
|
for( CN_ITEM* cnItem : entry.GetItems() )
|
2017-09-28 16:38:54 +00:00
|
|
|
{
|
2021-11-30 14:19:39 +00:00
|
|
|
for( const std::shared_ptr<CN_ANCHOR>& anchor : cnItem->Anchors() )
|
2017-09-28 16:38:54 +00:00
|
|
|
anchor->SetNoLine( true );
|
|
|
|
}
|
2017-03-22 13:43:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int CONNECTIVITY_DATA::GetNetCount() const
|
|
|
|
{
|
|
|
|
return m_connAlgo->NetCount();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-03-25 10:44:46 +00:00
|
|
|
void CONNECTIVITY_DATA::FillIsolatedIslandsMap( std::map<ZONE*, std::map<PCB_LAYER_ID, ISOLATED_ISLANDS>>& aMap,
|
|
|
|
bool aConnectivityAlreadyRebuilt )
|
2017-03-22 13:43:10 +00:00
|
|
|
{
|
2023-03-25 10:44:46 +00:00
|
|
|
m_connAlgo->FillIsolatedIslandsMap( aMap, aConnectivityAlreadyRebuilt );
|
2017-11-23 16:20:27 +00:00
|
|
|
}
|
2017-03-22 13:43:10 +00:00
|
|
|
|
2018-06-25 14:29:20 +00:00
|
|
|
|
2022-09-03 18:29:02 +00:00
|
|
|
void CONNECTIVITY_DATA::ComputeLocalRatsnest( const std::vector<BOARD_ITEM*>& aItems,
|
|
|
|
const CONNECTIVITY_DATA* aDynamicData,
|
|
|
|
VECTOR2I aInternalOffset )
|
2017-03-22 13:43:10 +00:00
|
|
|
{
|
2020-08-15 00:33:27 +00:00
|
|
|
if( !aDynamicData )
|
|
|
|
return;
|
2018-10-24 14:40:59 +00:00
|
|
|
|
2020-08-15 00:33:27 +00:00
|
|
|
m_dynamicRatsnest.clear();
|
2022-10-05 00:00:08 +00:00
|
|
|
std::mutex dynamic_ratsnest_mutex;
|
2017-03-22 13:43:10 +00:00
|
|
|
|
2020-08-15 00:33:27 +00:00
|
|
|
// This gets connections between the stationary board and the
|
|
|
|
// moving selection
|
2022-10-05 00:00:08 +00:00
|
|
|
|
|
|
|
auto update_lambda = [&]( int nc )
|
2017-03-22 13:43:10 +00:00
|
|
|
{
|
2022-10-01 20:43:57 +00:00
|
|
|
RN_NET* dynamicNet = aDynamicData->m_nets[nc];
|
|
|
|
RN_NET* staticNet = m_nets[nc];
|
|
|
|
|
|
|
|
/// We don't need to compute the dynamic ratsnest in two cases:
|
|
|
|
/// 1) We are not moving any net elements
|
|
|
|
/// 2) We are moving all net elements
|
|
|
|
if( dynamicNet->GetNodeCount() != 0
|
|
|
|
&& dynamicNet->GetNodeCount() != staticNet->GetNodeCount() )
|
2017-03-22 13:43:10 +00:00
|
|
|
{
|
2022-02-13 11:54:41 +00:00
|
|
|
VECTOR2I pos1, pos2;
|
2017-03-22 13:43:10 +00:00
|
|
|
|
2022-10-05 00:00:08 +00:00
|
|
|
if( staticNet->NearestBicoloredPair( dynamicNet, pos1, pos2 ) )
|
2017-03-22 13:43:10 +00:00
|
|
|
{
|
|
|
|
RN_DYNAMIC_LINE l;
|
2022-02-13 11:54:41 +00:00
|
|
|
l.a = pos1;
|
|
|
|
l.b = pos2;
|
2017-03-22 13:43:10 +00:00
|
|
|
l.netCode = nc;
|
|
|
|
|
2022-10-05 00:00:08 +00:00
|
|
|
std::lock_guard<std::mutex> lock( dynamic_ratsnest_mutex );
|
2017-03-22 13:43:10 +00:00
|
|
|
m_dynamicRatsnest.push_back( l );
|
|
|
|
}
|
|
|
|
}
|
2022-10-05 00:00:08 +00:00
|
|
|
};
|
|
|
|
|
2022-12-02 20:01:34 +00:00
|
|
|
thread_pool& tp = GetKiCadThreadPool();
|
2023-02-10 20:49:23 +00:00
|
|
|
size_t num_nets = std::min( m_nets.size(), aDynamicData->m_nets.size() );
|
2022-12-02 20:01:34 +00:00
|
|
|
|
2023-02-10 20:49:23 +00:00
|
|
|
tp.push_loop( 1, num_nets,
|
2022-10-05 00:00:08 +00:00
|
|
|
[&]( const int a, const int b)
|
|
|
|
{
|
|
|
|
for( int ii = a; ii < b; ++ii )
|
|
|
|
update_lambda( ii );
|
2022-12-02 20:01:34 +00:00
|
|
|
});
|
|
|
|
tp.wait_for_tasks();
|
2017-03-22 13:43:10 +00:00
|
|
|
|
2020-08-15 00:33:27 +00:00
|
|
|
// This gets the ratsnest for internal connections in the moving set
|
2021-11-25 14:35:01 +00:00
|
|
|
const std::vector<CN_EDGE>& edges = GetRatsnestForItems( aItems );
|
2017-03-22 13:43:10 +00:00
|
|
|
|
2021-11-25 14:35:01 +00:00
|
|
|
for( const CN_EDGE& edge : edges )
|
2020-06-23 03:35:34 +00:00
|
|
|
{
|
2022-11-22 12:19:22 +00:00
|
|
|
const std::shared_ptr<const CN_ANCHOR>& nodeA = edge.GetSourceNode();
|
|
|
|
const std::shared_ptr<const CN_ANCHOR>& nodeB = edge.GetTargetNode();
|
2023-11-01 17:08:51 +00:00
|
|
|
|
|
|
|
if( !nodeA || nodeA->Dirty() || !nodeB || nodeB->Dirty() )
|
|
|
|
continue;
|
|
|
|
|
2022-11-22 12:19:22 +00:00
|
|
|
RN_DYNAMIC_LINE l;
|
2020-06-23 03:35:34 +00:00
|
|
|
|
|
|
|
// Use the parents' positions
|
2022-01-04 01:00:40 +00:00
|
|
|
l.a = nodeA->Parent()->GetPosition() + aInternalOffset;
|
|
|
|
l.b = nodeB->Parent()->GetPosition() + aInternalOffset;
|
2020-06-23 03:35:34 +00:00
|
|
|
l.netCode = 0;
|
|
|
|
m_dynamicRatsnest.push_back( l );
|
2017-03-22 13:43:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-09-03 18:29:02 +00:00
|
|
|
void CONNECTIVITY_DATA::ClearLocalRatsnest()
|
2017-03-22 13:43:10 +00:00
|
|
|
{
|
2020-08-24 12:17:58 +00:00
|
|
|
m_connAlgo->ForEachAnchor( []( CN_ANCHOR& anchor )
|
|
|
|
{
|
|
|
|
anchor.SetNoLine( false );
|
|
|
|
} );
|
2022-09-03 18:29:02 +00:00
|
|
|
HideLocalRatsnest();
|
2017-08-01 13:20:40 +00:00
|
|
|
}
|
|
|
|
|
2017-03-28 16:30:49 +00:00
|
|
|
|
2022-09-03 18:29:02 +00:00
|
|
|
void CONNECTIVITY_DATA::HideLocalRatsnest()
|
2017-08-01 13:20:40 +00:00
|
|
|
{
|
2017-03-22 13:43:10 +00:00
|
|
|
m_dynamicRatsnest.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-01-23 16:23:43 +00:00
|
|
|
void CONNECTIVITY_DATA::PropagateNets( BOARD_COMMIT* aCommit )
|
2017-03-22 13:43:10 +00:00
|
|
|
{
|
2023-01-23 16:23:43 +00:00
|
|
|
m_connAlgo->PropagateNets( aCommit );
|
2017-03-22 13:43:10 +00:00
|
|
|
}
|
|
|
|
|
2021-03-23 21:42:56 +00:00
|
|
|
|
2020-07-27 19:41:50 +00:00
|
|
|
bool CONNECTIVITY_DATA::IsConnectedOnLayer( const BOARD_CONNECTED_ITEM *aItem, int aLayer,
|
2022-10-18 12:00:37 +00:00
|
|
|
const std::initializer_list<KICAD_T>& aTypes ) const
|
2020-07-27 19:41:50 +00:00
|
|
|
{
|
|
|
|
CN_CONNECTIVITY_ALGO::ITEM_MAP_ENTRY &entry = m_connAlgo->ItemEntry( aItem );
|
|
|
|
|
2021-11-25 14:35:01 +00:00
|
|
|
auto matchType =
|
|
|
|
[&]( KICAD_T aItemType )
|
|
|
|
{
|
2022-03-03 23:49:05 +00:00
|
|
|
if( aTypes.size() == 0 )
|
2021-11-25 14:35:01 +00:00
|
|
|
return true;
|
2020-10-05 19:54:12 +00:00
|
|
|
|
2022-03-03 23:49:05 +00:00
|
|
|
return alg::contains( aTypes, aItemType);
|
2021-11-25 14:35:01 +00:00
|
|
|
};
|
2020-10-05 19:54:12 +00:00
|
|
|
|
|
|
|
for( CN_ITEM* citem : entry.GetItems() )
|
|
|
|
{
|
|
|
|
for( CN_ITEM* connected : citem->ConnectedItems() )
|
2020-07-27 19:41:50 +00:00
|
|
|
{
|
2022-05-22 21:14:39 +00:00
|
|
|
CN_ZONE_LAYER* zoneLayer = dynamic_cast<CN_ZONE_LAYER*>( connected );
|
|
|
|
|
2020-10-05 19:54:12 +00:00
|
|
|
if( connected->Valid()
|
|
|
|
&& connected->Layers().Overlaps( aLayer )
|
2022-05-22 21:14:39 +00:00
|
|
|
&& matchType( connected->Parent()->Type() )
|
|
|
|
&& connected->Net() == aItem->GetNetCode() )
|
2020-10-05 19:54:12 +00:00
|
|
|
{
|
2022-05-22 21:14:39 +00:00
|
|
|
if( aItem->Type() == PCB_PAD_T && zoneLayer )
|
2022-02-20 23:49:02 +00:00
|
|
|
{
|
|
|
|
const PAD* pad = static_cast<const PAD*>( aItem );
|
2022-05-22 21:14:39 +00:00
|
|
|
ZONE* zone = static_cast<ZONE*>( zoneLayer->Parent() );
|
|
|
|
int islandIdx = zoneLayer->SubpolyIndex();
|
2022-02-20 23:49:02 +00:00
|
|
|
|
2022-05-22 21:14:39 +00:00
|
|
|
if( zone->IsFilled() )
|
2022-03-05 15:18:24 +00:00
|
|
|
{
|
2022-07-22 22:05:25 +00:00
|
|
|
const SHAPE_POLY_SET* zoneFill = zone->GetFill( ToLAYER_ID( aLayer ) );
|
2023-10-13 11:25:52 +00:00
|
|
|
const SHAPE_LINE_CHAIN& padHull = pad->GetEffectivePolygon( ERROR_INSIDE )->Outline( 0 );
|
2022-03-05 15:18:24 +00:00
|
|
|
|
2022-05-22 21:14:39 +00:00
|
|
|
for( const VECTOR2I& pt : zoneFill->COutline( islandIdx ).CPoints() )
|
2022-03-05 15:18:24 +00:00
|
|
|
{
|
2022-05-22 21:14:39 +00:00
|
|
|
// If the entire island is inside the pad's flashing then the pad
|
|
|
|
// won't actually connect to anything else, so only return true if
|
|
|
|
// part of the island is *outside* the pad's flashing.
|
2022-03-05 15:18:24 +00:00
|
|
|
|
2022-05-22 21:14:39 +00:00
|
|
|
if( !padHull.PointInside( pt ) )
|
|
|
|
return true;
|
|
|
|
}
|
2022-03-05 15:18:24 +00:00
|
|
|
}
|
2022-05-22 21:14:39 +00:00
|
|
|
|
|
|
|
continue;
|
2022-02-20 23:49:02 +00:00
|
|
|
}
|
2022-05-22 21:14:39 +00:00
|
|
|
else if( aItem->Type() == PCB_VIA_T && zoneLayer )
|
2022-02-20 23:49:02 +00:00
|
|
|
{
|
|
|
|
const PCB_VIA* via = static_cast<const PCB_VIA*>( aItem );
|
2022-05-22 21:14:39 +00:00
|
|
|
ZONE* zone = static_cast<ZONE*>( zoneLayer->Parent() );
|
|
|
|
int islandIdx = zoneLayer->SubpolyIndex();
|
2022-02-20 23:49:02 +00:00
|
|
|
|
2022-05-22 21:14:39 +00:00
|
|
|
if( zone->IsFilled() )
|
2022-03-05 15:18:24 +00:00
|
|
|
{
|
2022-07-22 22:05:25 +00:00
|
|
|
const SHAPE_POLY_SET* zoneFill = zone->GetFill( ToLAYER_ID( aLayer ) );
|
2022-05-22 21:14:39 +00:00
|
|
|
SHAPE_CIRCLE viaHull( via->GetCenter(), via->GetWidth() / 2 );
|
2022-03-05 15:18:24 +00:00
|
|
|
|
2022-05-22 21:14:39 +00:00
|
|
|
for( const VECTOR2I& pt : zoneFill->COutline( islandIdx ).CPoints() )
|
2022-03-05 15:18:24 +00:00
|
|
|
{
|
2022-05-22 21:14:39 +00:00
|
|
|
// If the entire island is inside the via's flashing then the via
|
|
|
|
// won't actually connect to anything else, so only return true if
|
|
|
|
// part of the island is *outside* the via's flashing.
|
2022-03-05 15:18:24 +00:00
|
|
|
|
2022-05-22 21:14:39 +00:00
|
|
|
if( !viaHull.SHAPE::Collide( pt ) )
|
|
|
|
return true;
|
|
|
|
}
|
2022-03-05 15:18:24 +00:00
|
|
|
}
|
2022-05-22 21:14:39 +00:00
|
|
|
|
|
|
|
continue;
|
2022-02-20 23:49:02 +00:00
|
|
|
}
|
2022-03-05 15:18:24 +00:00
|
|
|
|
2022-05-22 21:14:39 +00:00
|
|
|
return true;
|
2020-10-05 19:54:12 +00:00
|
|
|
}
|
2020-07-27 19:41:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2017-03-22 13:43:10 +00:00
|
|
|
|
2022-09-29 16:07:42 +00:00
|
|
|
unsigned int CONNECTIVITY_DATA::GetUnconnectedCount( bool aVisibleOnly ) const
|
2017-03-22 13:43:10 +00:00
|
|
|
{
|
|
|
|
unsigned int unconnected = 0;
|
|
|
|
|
2021-11-25 14:35:01 +00:00
|
|
|
for( RN_NET* net : m_nets )
|
2017-03-22 13:43:10 +00:00
|
|
|
{
|
|
|
|
if( !net )
|
|
|
|
continue;
|
|
|
|
|
2021-12-01 14:42:44 +00:00
|
|
|
for( const CN_EDGE& edge : net->GetEdges() )
|
|
|
|
{
|
2022-09-29 16:07:42 +00:00
|
|
|
if( edge.IsVisible() || !aVisibleOnly )
|
2021-12-01 14:42:44 +00:00
|
|
|
++unconnected;
|
|
|
|
}
|
2017-03-22 13:43:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return unconnected;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-11-30 12:18:58 +00:00
|
|
|
void CONNECTIVITY_DATA::ClearRatsnest()
|
2017-03-22 13:43:10 +00:00
|
|
|
{
|
2021-11-25 14:35:01 +00:00
|
|
|
for( RN_NET* net : m_nets )
|
2022-11-30 12:18:58 +00:00
|
|
|
net->Clear();
|
2017-03-22 13:43:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-02-06 17:26:30 +00:00
|
|
|
const std::vector<BOARD_CONNECTED_ITEM*>
|
2022-03-03 23:49:05 +00:00
|
|
|
CONNECTIVITY_DATA::GetConnectedItems( const BOARD_CONNECTED_ITEM *aItem,
|
2022-08-20 09:27:35 +00:00
|
|
|
const std::initializer_list<KICAD_T>& aTypes,
|
|
|
|
bool aIgnoreNetcodes ) const
|
2017-03-22 13:43:10 +00:00
|
|
|
{
|
2017-11-15 17:33:06 +00:00
|
|
|
std::vector<BOARD_CONNECTED_ITEM*> rv;
|
2022-02-06 17:26:30 +00:00
|
|
|
CN_CONNECTIVITY_ALGO::CLUSTER_SEARCH_MODE searchMode;
|
|
|
|
|
|
|
|
if( aIgnoreNetcodes )
|
|
|
|
searchMode = CN_CONNECTIVITY_ALGO::CSM_PROPAGATE;
|
|
|
|
else
|
|
|
|
searchMode = CN_CONNECTIVITY_ALGO::CSM_CONNECTIVITY_CHECK;
|
|
|
|
|
2022-03-03 23:49:05 +00:00
|
|
|
const auto clusters = m_connAlgo->SearchClusters( searchMode, aTypes,
|
2022-02-06 17:26:30 +00:00
|
|
|
aIgnoreNetcodes ? -1 : aItem->GetNetCode() );
|
2017-03-22 13:43:10 +00:00
|
|
|
|
2022-02-06 17:26:30 +00:00
|
|
|
for( const std::shared_ptr<CN_CLUSTER>& cl : clusters )
|
2017-06-23 11:56:28 +00:00
|
|
|
{
|
2017-03-22 13:51:07 +00:00
|
|
|
if( cl->Contains( aItem ) )
|
2017-03-22 13:43:10 +00:00
|
|
|
{
|
2022-02-06 17:26:30 +00:00
|
|
|
for( const CN_ITEM* item : *cl )
|
2017-07-21 09:40:26 +00:00
|
|
|
{
|
|
|
|
if( item->Valid() )
|
|
|
|
rv.push_back( item->Parent() );
|
|
|
|
}
|
2017-03-22 13:43:10 +00:00
|
|
|
}
|
2017-06-23 11:56:28 +00:00
|
|
|
}
|
2017-03-22 13:51:07 +00:00
|
|
|
|
2017-03-22 13:43:10 +00:00
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-08-20 09:27:35 +00:00
|
|
|
const std::vector<BOARD_CONNECTED_ITEM*>
|
|
|
|
CONNECTIVITY_DATA::GetNetItems( int aNetCode, const std::initializer_list<KICAD_T>& aTypes ) const
|
2017-03-22 13:43:10 +00:00
|
|
|
{
|
2020-04-12 18:59:13 +00:00
|
|
|
std::vector<BOARD_CONNECTED_ITEM*> items;
|
|
|
|
items.reserve( 32 );
|
2017-05-04 22:43:43 +00:00
|
|
|
|
2020-04-12 18:59:13 +00:00
|
|
|
std::bitset<MAX_STRUCT_TYPE_ID> type_bits;
|
2017-07-17 08:19:36 +00:00
|
|
|
|
2022-08-20 09:27:35 +00:00
|
|
|
for( KICAD_T scanType : aTypes )
|
2020-04-12 18:59:13 +00:00
|
|
|
{
|
2022-08-20 09:27:35 +00:00
|
|
|
wxASSERT( scanType < MAX_STRUCT_TYPE_ID );
|
|
|
|
type_bits.set( scanType );
|
2020-04-12 18:59:13 +00:00
|
|
|
}
|
2017-07-17 08:19:36 +00:00
|
|
|
|
2022-08-20 09:27:35 +00:00
|
|
|
m_connAlgo->ForEachItem(
|
|
|
|
[&]( CN_ITEM& aItem )
|
|
|
|
{
|
|
|
|
if( aItem.Valid() && ( aItem.Net() == aNetCode ) && type_bits[aItem.Parent()->Type()] )
|
|
|
|
items.push_back( aItem.Parent() );
|
|
|
|
} );
|
2017-03-22 13:59:30 +00:00
|
|
|
|
2020-04-12 18:59:13 +00:00
|
|
|
std::sort( items.begin(), items.end() );
|
|
|
|
items.erase( std::unique( items.begin(), items.end() ), items.end() );
|
|
|
|
return items;
|
2017-03-22 13:43:10 +00:00
|
|
|
}
|
|
|
|
|
2017-03-22 13:51:07 +00:00
|
|
|
|
2022-08-20 09:27:35 +00:00
|
|
|
const std::vector<PCB_TRACK*>
|
|
|
|
CONNECTIVITY_DATA::GetConnectedTracks( const BOARD_CONNECTED_ITEM* aItem ) const
|
2017-03-22 13:51:07 +00:00
|
|
|
{
|
2022-09-29 16:07:42 +00:00
|
|
|
CN_CONNECTIVITY_ALGO::ITEM_MAP_ENTRY& entry = m_connAlgo->ItemEntry( aItem );
|
2017-03-22 13:51:07 +00:00
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
std::set<PCB_TRACK*> tracks;
|
|
|
|
std::vector<PCB_TRACK*> rv;
|
2017-03-22 13:51:07 +00:00
|
|
|
|
2021-06-11 21:07:02 +00:00
|
|
|
for( CN_ITEM* citem : entry.GetItems() )
|
2017-03-22 13:51:07 +00:00
|
|
|
{
|
2021-06-11 21:07:02 +00:00
|
|
|
for( CN_ITEM* connected : citem->ConnectedItems() )
|
2017-03-22 13:51:07 +00:00
|
|
|
{
|
2019-05-17 00:13:21 +00:00
|
|
|
if( connected->Valid() &&
|
|
|
|
( connected->Parent()->Type() == PCB_TRACE_T ||
|
|
|
|
connected->Parent()->Type() == PCB_VIA_T ||
|
|
|
|
connected->Parent()->Type() == PCB_ARC_T ) )
|
2022-08-20 09:27:35 +00:00
|
|
|
{
|
2021-06-11 21:07:02 +00:00
|
|
|
tracks.insert( static_cast<PCB_TRACK*> ( connected->Parent() ) );
|
2022-08-20 09:27:35 +00:00
|
|
|
}
|
2017-03-22 13:51:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
std::copy( tracks.begin(), tracks.end(), std::back_inserter( rv ) );
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-07-02 18:43:18 +00:00
|
|
|
void CONNECTIVITY_DATA::GetConnectedPads( const BOARD_CONNECTED_ITEM* aItem,
|
2020-11-12 22:30:02 +00:00
|
|
|
std::set<PAD*>* pads ) const
|
2017-03-22 13:51:07 +00:00
|
|
|
{
|
2020-11-12 22:30:02 +00:00
|
|
|
for( CN_ITEM* citem : m_connAlgo->ItemEntry( aItem ).GetItems() )
|
2017-03-22 13:51:07 +00:00
|
|
|
{
|
2020-11-12 22:30:02 +00:00
|
|
|
for( CN_ITEM* connected : citem->ConnectedItems() )
|
2017-03-22 13:51:07 +00:00
|
|
|
{
|
2017-06-22 14:24:07 +00:00
|
|
|
if( connected->Valid() && connected->Parent()->Type() == PCB_PAD_T )
|
2020-11-12 22:30:02 +00:00
|
|
|
pads->insert( static_cast<PAD*> ( connected->Parent() ) );
|
2017-03-22 13:51:07 +00:00
|
|
|
}
|
|
|
|
}
|
2018-08-19 16:11:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-12 22:30:02 +00:00
|
|
|
const std::vector<PAD*> CONNECTIVITY_DATA::GetConnectedPads( const BOARD_CONNECTED_ITEM* aItem )
|
2018-08-19 16:11:58 +00:00
|
|
|
const
|
|
|
|
{
|
2020-11-12 22:30:02 +00:00
|
|
|
std::set<PAD*> pads;
|
|
|
|
std::vector<PAD*> rv;
|
2018-08-19 16:11:58 +00:00
|
|
|
|
|
|
|
GetConnectedPads( aItem, &pads );
|
2017-03-22 13:51:07 +00:00
|
|
|
|
|
|
|
std::copy( pads.begin(), pads.end(), std::back_inserter( rv ) );
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-12 21:03:54 +00:00
|
|
|
void CONNECTIVITY_DATA::GetConnectedPadsAndVias( const BOARD_CONNECTED_ITEM* aItem,
|
|
|
|
std::vector<PAD*>* pads,
|
|
|
|
std::vector<PCB_VIA*>* vias )
|
|
|
|
{
|
|
|
|
for( CN_ITEM* citem : m_connAlgo->ItemEntry( aItem ).GetItems() )
|
|
|
|
{
|
|
|
|
for( CN_ITEM* connected : citem->ConnectedItems() )
|
|
|
|
{
|
|
|
|
if( connected->Valid() )
|
|
|
|
{
|
|
|
|
BOARD_CONNECTED_ITEM* parent = connected->Parent();
|
|
|
|
|
|
|
|
if( parent->Type() == PCB_PAD_T )
|
|
|
|
pads->push_back( static_cast<PAD*>( parent ) );
|
|
|
|
else if( parent->Type() == PCB_VIA_T )
|
|
|
|
vias->push_back( static_cast<PCB_VIA*>( parent ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-03-22 13:51:07 +00:00
|
|
|
unsigned int CONNECTIVITY_DATA::GetNodeCount( int aNet ) const
|
|
|
|
{
|
2017-06-23 12:41:51 +00:00
|
|
|
int sum = 0;
|
|
|
|
|
2017-06-30 11:40:20 +00:00
|
|
|
if( aNet < 0 ) // Node count for all nets
|
2017-06-23 12:41:51 +00:00
|
|
|
{
|
2020-09-23 10:46:41 +00:00
|
|
|
for( const RN_NET* net : m_nets )
|
2017-06-23 12:41:51 +00:00
|
|
|
sum += net->GetNodeCount();
|
|
|
|
}
|
2017-06-23 17:22:44 +00:00
|
|
|
else if( aNet < (int) m_nets.size() )
|
2017-06-23 12:41:51 +00:00
|
|
|
{
|
|
|
|
sum = m_nets[aNet]->GetNodeCount();
|
|
|
|
}
|
|
|
|
|
|
|
|
return sum;
|
2017-03-22 13:51:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
unsigned int CONNECTIVITY_DATA::GetPadCount( int aNet ) const
|
|
|
|
{
|
2017-04-18 15:32:05 +00:00
|
|
|
int n = 0;
|
|
|
|
|
2020-09-23 10:46:41 +00:00
|
|
|
for( CN_ITEM* pad : m_connAlgo->ItemList() )
|
2017-04-18 15:32:05 +00:00
|
|
|
{
|
2018-05-21 00:06:01 +00:00
|
|
|
if( !pad->Valid() || pad->Parent()->Type() != PCB_PAD_T)
|
2017-07-21 09:40:26 +00:00
|
|
|
continue;
|
|
|
|
|
2020-11-12 22:30:02 +00:00
|
|
|
PAD* dpad = static_cast<PAD*>( pad->Parent() );
|
2017-06-23 11:56:28 +00:00
|
|
|
|
|
|
|
if( aNet < 0 || aNet == dpad->GetNetCode() )
|
2017-04-18 15:32:05 +00:00
|
|
|
n++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return n;
|
2017-03-22 13:51:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-09-29 16:07:42 +00:00
|
|
|
void CONNECTIVITY_DATA::RunOnUnconnectedEdges( std::function<bool( CN_EDGE& )> aFunc )
|
2017-03-22 15:47:15 +00:00
|
|
|
{
|
2022-09-29 16:07:42 +00:00
|
|
|
for( RN_NET* rnNet : m_nets )
|
2017-03-22 15:47:15 +00:00
|
|
|
{
|
2017-06-23 11:56:28 +00:00
|
|
|
if( rnNet )
|
2017-03-22 15:47:15 +00:00
|
|
|
{
|
2022-09-29 16:07:42 +00:00
|
|
|
for( CN_EDGE& edge : rnNet->GetEdges() )
|
|
|
|
{
|
|
|
|
if( !aFunc( edge ) )
|
|
|
|
return;
|
|
|
|
}
|
2017-03-22 15:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-06-22 14:24:07 +00:00
|
|
|
|
2017-06-23 11:56:28 +00:00
|
|
|
|
2022-01-01 06:04:08 +00:00
|
|
|
static int getMinDist( BOARD_CONNECTED_ITEM* aItem, const VECTOR2I& aPoint )
|
2021-08-02 21:41:59 +00:00
|
|
|
{
|
|
|
|
switch( aItem->Type() )
|
|
|
|
{
|
|
|
|
case PCB_TRACE_T:
|
|
|
|
case PCB_ARC_T:
|
|
|
|
{
|
|
|
|
PCB_TRACK* track = static_cast<PCB_TRACK*>( aItem );
|
|
|
|
|
2024-05-31 19:22:16 +00:00
|
|
|
return std::min( track->GetStart().Distance(aPoint ),
|
|
|
|
track->GetEnd().Distance( aPoint ) );
|
2021-08-02 21:41:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
2024-05-31 19:22:16 +00:00
|
|
|
return aItem->GetPosition().Distance( aPoint );
|
2021-08-02 21:41:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-06-17 21:56:57 +00:00
|
|
|
bool CONNECTIVITY_DATA::TestTrackEndpointDangling( PCB_TRACK* aTrack, bool aIgnoreTracksInPads,
|
|
|
|
VECTOR2I* aPos ) const
|
2020-05-14 19:24:10 +00:00
|
|
|
{
|
2022-12-16 18:47:01 +00:00
|
|
|
const std::list<CN_ITEM*>& items = GetConnectivityAlgo()->ItemEntry( aTrack ).GetItems();
|
2020-05-14 19:24:10 +00:00
|
|
|
|
|
|
|
// Not in the connectivity system. This is a bug!
|
|
|
|
if( items.empty() )
|
|
|
|
{
|
2022-02-04 22:44:59 +00:00
|
|
|
wxFAIL_MSG( wxT( "track not in connectivity system" ) );
|
2020-05-14 19:24:10 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
CN_ITEM* citem = items.front();
|
|
|
|
|
|
|
|
if( !citem->Valid() )
|
|
|
|
return false;
|
|
|
|
|
2021-08-01 14:48:12 +00:00
|
|
|
if( aTrack->Type() == PCB_TRACE_T || aTrack->Type() == PCB_ARC_T )
|
2020-05-14 19:24:10 +00:00
|
|
|
{
|
2021-08-01 14:48:12 +00:00
|
|
|
// Test if a segment is connected on each end.
|
|
|
|
//
|
|
|
|
// NB: be wary of short segments which can be connected to the *same* other item on
|
|
|
|
// each end. If that's their only connection then they're still dangling.
|
|
|
|
|
|
|
|
PCB_LAYER_ID layer = aTrack->GetLayer();
|
|
|
|
int accuracy = KiROUND( aTrack->GetWidth() / 2 );
|
|
|
|
int start_count = 0;
|
|
|
|
int end_count = 0;
|
|
|
|
|
|
|
|
for( CN_ITEM* connected : citem->ConnectedItems() )
|
2020-05-14 19:24:10 +00:00
|
|
|
{
|
2021-08-01 14:48:12 +00:00
|
|
|
BOARD_CONNECTED_ITEM* item = connected->Parent();
|
2022-06-18 18:47:11 +00:00
|
|
|
ZONE* zone = dynamic_cast<ZONE*>( item );
|
|
|
|
DRC_RTREE* rtree = nullptr;
|
|
|
|
bool hitStart = false;
|
|
|
|
bool hitEnd = false;
|
2020-08-05 20:15:27 +00:00
|
|
|
|
2021-08-01 14:48:12 +00:00
|
|
|
if( item->GetFlags() & IS_DELETED )
|
|
|
|
continue;
|
|
|
|
|
2022-06-18 18:47:11 +00:00
|
|
|
if( zone )
|
|
|
|
rtree = zone->GetBoard()->m_CopperZoneRTreeCache[ zone ].get();
|
2021-08-01 14:48:12 +00:00
|
|
|
|
2022-06-18 18:47:11 +00:00
|
|
|
if( rtree )
|
|
|
|
{
|
|
|
|
SHAPE_CIRCLE start( aTrack->GetStart(), accuracy );
|
|
|
|
SHAPE_CIRCLE end( aTrack->GetEnd(), accuracy );
|
|
|
|
|
|
|
|
hitStart = rtree->QueryColliding( start.BBox(), &start, layer );
|
|
|
|
hitEnd = rtree->QueryColliding( end.BBox(), &end, layer );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
std::shared_ptr<SHAPE> shape = item->GetEffectiveShape( layer );
|
|
|
|
|
|
|
|
hitStart = shape->Collide( aTrack->GetStart(), accuracy );
|
|
|
|
hitEnd = shape->Collide( aTrack->GetEnd(), accuracy );
|
|
|
|
}
|
2021-08-01 14:48:12 +00:00
|
|
|
|
|
|
|
if( hitStart && hitEnd )
|
|
|
|
{
|
2023-06-17 21:56:57 +00:00
|
|
|
if( zone )
|
2023-01-09 13:28:06 +00:00
|
|
|
{
|
2023-06-17 21:56:57 +00:00
|
|
|
// Both start and end in a zone: track may be redundant, but it's not dangling
|
2023-01-09 13:28:06 +00:00
|
|
|
return false;
|
|
|
|
}
|
2023-06-17 21:56:57 +00:00
|
|
|
else if( item->Type() == PCB_PAD_T || item->Type() == PCB_VIA_T )
|
|
|
|
{
|
|
|
|
// Both start and end are under a pad: see what the caller wants us to do
|
|
|
|
if( aIgnoreTracksInPads )
|
|
|
|
return false;
|
|
|
|
}
|
2023-01-09 13:28:06 +00:00
|
|
|
|
2021-08-02 21:41:59 +00:00
|
|
|
if( getMinDist( item, aTrack->GetStart() ) < getMinDist( item, aTrack->GetEnd() ) )
|
2021-08-01 14:48:12 +00:00
|
|
|
start_count++;
|
|
|
|
else
|
|
|
|
end_count++;
|
|
|
|
}
|
|
|
|
else if( hitStart )
|
|
|
|
{
|
|
|
|
start_count++;
|
|
|
|
}
|
|
|
|
else if( hitEnd )
|
|
|
|
{
|
|
|
|
end_count++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( start_count > 0 && end_count > 0 )
|
|
|
|
return false;
|
2020-05-14 19:24:10 +00:00
|
|
|
}
|
|
|
|
|
2021-08-01 14:48:12 +00:00
|
|
|
if( aPos )
|
|
|
|
*aPos = (start_count == 0 ) ? aTrack->GetStart() : aTrack->GetEnd();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if( aTrack->Type() == PCB_VIA_T )
|
2021-01-08 17:38:51 +00:00
|
|
|
{
|
2021-08-01 14:48:12 +00:00
|
|
|
// Test if a via is only connected on one layer
|
|
|
|
|
|
|
|
const std::vector<CN_ITEM*>& connected = citem->ConnectedItems();
|
2021-01-08 17:38:51 +00:00
|
|
|
|
|
|
|
if( connected.empty() )
|
2021-01-10 09:21:24 +00:00
|
|
|
{
|
|
|
|
if( aPos )
|
|
|
|
*aPos = aTrack->GetPosition();
|
|
|
|
|
2021-01-08 17:38:51 +00:00
|
|
|
return true;
|
2021-01-10 09:21:24 +00:00
|
|
|
}
|
2021-01-08 17:38:51 +00:00
|
|
|
|
|
|
|
// Here, we check if the via is connected only to items on a single layer
|
2021-08-01 14:48:12 +00:00
|
|
|
int first_layer = UNDEFINED_LAYER;
|
2021-01-08 17:38:51 +00:00
|
|
|
|
2021-08-01 14:48:12 +00:00
|
|
|
for( CN_ITEM* item : connected )
|
2021-01-08 17:38:51 +00:00
|
|
|
{
|
2021-08-01 14:48:12 +00:00
|
|
|
if( item->Parent()->GetFlags() & IS_DELETED )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if( first_layer == UNDEFINED_LAYER )
|
|
|
|
first_layer = item->Layer();
|
|
|
|
else if( item->Layer() != first_layer )
|
2021-01-08 17:38:51 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-01-10 09:21:24 +00:00
|
|
|
if( aPos )
|
|
|
|
*aPos = aTrack->GetPosition();
|
|
|
|
|
2021-01-08 17:38:51 +00:00
|
|
|
return true;
|
|
|
|
}
|
2021-08-01 14:48:12 +00:00
|
|
|
else
|
|
|
|
{
|
2022-02-04 22:44:59 +00:00
|
|
|
wxFAIL_MSG( wxT( "CONNECTIVITY_DATA::TestTrackEndpointDangling: unknown track type" ) );
|
2021-08-01 14:48:12 +00:00
|
|
|
}
|
2021-01-08 17:38:51 +00:00
|
|
|
|
2020-05-14 19:24:10 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-08-20 09:27:35 +00:00
|
|
|
const std::vector<BOARD_CONNECTED_ITEM*>
|
|
|
|
CONNECTIVITY_DATA::GetConnectedItemsAtAnchor( const BOARD_CONNECTED_ITEM* aItem,
|
|
|
|
const VECTOR2I& aAnchor,
|
|
|
|
const std::initializer_list<KICAD_T>& aTypes,
|
|
|
|
const int& aMaxError ) const
|
2017-06-22 14:24:07 +00:00
|
|
|
{
|
2022-08-20 09:27:35 +00:00
|
|
|
CN_CONNECTIVITY_ALGO::ITEM_MAP_ENTRY& entry = m_connAlgo->ItemEntry( aItem );
|
|
|
|
std::vector<BOARD_CONNECTED_ITEM*> rv;
|
|
|
|
SEG::ecoord maxError_sq = (SEG::ecoord) aMaxError * aMaxError;
|
2017-06-22 14:24:07 +00:00
|
|
|
|
2022-08-15 17:47:23 +00:00
|
|
|
for( CN_ITEM* cnItem : entry.GetItems() )
|
2017-06-22 14:24:07 +00:00
|
|
|
{
|
2022-08-15 17:47:23 +00:00
|
|
|
for( CN_ITEM* connected : cnItem->ConnectedItems() )
|
2017-06-22 14:24:07 +00:00
|
|
|
{
|
2022-08-20 09:27:35 +00:00
|
|
|
for( const std::shared_ptr<CN_ANCHOR>& anchor : connected->Anchors() )
|
2017-06-22 14:24:07 +00:00
|
|
|
{
|
2022-08-20 09:27:35 +00:00
|
|
|
if( ( anchor->Pos() - aAnchor ).SquaredEuclideanNorm() <= maxError_sq )
|
2017-06-22 14:24:07 +00:00
|
|
|
{
|
2022-08-20 09:27:35 +00:00
|
|
|
for( KICAD_T type : aTypes )
|
2017-06-22 14:24:07 +00:00
|
|
|
{
|
2022-08-20 09:27:35 +00:00
|
|
|
if( connected->Valid() && connected->Parent()->Type() == type )
|
2020-11-08 22:43:31 +00:00
|
|
|
{
|
|
|
|
rv.push_back( connected->Parent() );
|
|
|
|
break;
|
|
|
|
}
|
2017-06-22 14:24:07 +00:00
|
|
|
}
|
2020-11-08 22:43:31 +00:00
|
|
|
|
|
|
|
break;
|
2017-06-22 14:24:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
2017-06-29 22:45:50 +00:00
|
|
|
|
2017-07-17 08:21:36 +00:00
|
|
|
|
2017-06-29 22:45:50 +00:00
|
|
|
RN_NET* CONNECTIVITY_DATA::GetRatsnestForNet( int aNet )
|
|
|
|
{
|
2017-07-17 08:21:36 +00:00
|
|
|
if ( aNet < 0 || aNet >= (int) m_nets.size() )
|
2017-06-29 22:45:50 +00:00
|
|
|
return nullptr;
|
2017-07-17 08:21:36 +00:00
|
|
|
|
2017-06-29 22:45:50 +00:00
|
|
|
return m_nets[ aNet ];
|
|
|
|
}
|
2017-07-02 00:05:42 +00:00
|
|
|
|
2017-07-17 08:21:36 +00:00
|
|
|
|
2017-07-02 00:05:42 +00:00
|
|
|
void CONNECTIVITY_DATA::MarkItemNetAsDirty( BOARD_ITEM *aItem )
|
|
|
|
{
|
2020-11-13 12:21:02 +00:00
|
|
|
if ( aItem->Type() == PCB_FOOTPRINT_T)
|
2017-07-02 00:05:42 +00:00
|
|
|
{
|
2020-11-13 15:15:52 +00:00
|
|
|
for( PAD* pad : static_cast<FOOTPRINT*>( aItem )->Pads() )
|
2017-07-02 00:05:42 +00:00
|
|
|
m_connAlgo->MarkNetAsDirty( pad->GetNetCode() );
|
|
|
|
}
|
2023-06-24 18:54:50 +00:00
|
|
|
|
2017-07-02 00:05:42 +00:00
|
|
|
if (aItem->IsConnected() )
|
|
|
|
m_connAlgo->MarkNetAsDirty( static_cast<BOARD_CONNECTED_ITEM*>( aItem )->GetNetCode() );
|
|
|
|
}
|
2017-11-23 16:20:27 +00:00
|
|
|
|
2018-08-24 10:54:45 +00:00
|
|
|
|
2023-11-01 13:53:30 +00:00
|
|
|
void CONNECTIVITY_DATA::RemoveInvalidRefs()
|
|
|
|
{
|
|
|
|
m_connAlgo->RemoveInvalidRefs();
|
|
|
|
|
|
|
|
for( RN_NET* rnNet : m_nets )
|
|
|
|
rnNet->RemoveInvalidRefs();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-11-23 16:20:27 +00:00
|
|
|
void CONNECTIVITY_DATA::SetProgressReporter( PROGRESS_REPORTER* aReporter )
|
|
|
|
{
|
|
|
|
m_progressReporter = aReporter;
|
|
|
|
m_connAlgo->SetProgressReporter( m_progressReporter );
|
|
|
|
}
|
2018-08-24 10:54:45 +00:00
|
|
|
|
|
|
|
|
2023-06-24 18:54:50 +00:00
|
|
|
const std::vector<CN_EDGE>
|
|
|
|
CONNECTIVITY_DATA::GetRatsnestForItems( const std::vector<BOARD_ITEM*>& aItems )
|
2020-06-23 03:35:34 +00:00
|
|
|
{
|
|
|
|
std::set<int> nets;
|
|
|
|
std::vector<CN_EDGE> edges;
|
2020-06-24 21:22:01 +00:00
|
|
|
std::set<BOARD_CONNECTED_ITEM*> item_set;
|
2020-06-23 03:35:34 +00:00
|
|
|
|
2021-10-25 20:35:19 +00:00
|
|
|
for( BOARD_ITEM* item : aItems )
|
2020-06-23 03:35:34 +00:00
|
|
|
{
|
2020-11-13 12:21:02 +00:00
|
|
|
if( item->Type() == PCB_FOOTPRINT_T )
|
2020-06-23 03:35:34 +00:00
|
|
|
{
|
2020-11-13 15:15:52 +00:00
|
|
|
FOOTPRINT* footprint = static_cast<FOOTPRINT*>( item );
|
2020-06-23 03:35:34 +00:00
|
|
|
|
2020-11-13 15:15:52 +00:00
|
|
|
for( PAD* pad : footprint->Pads() )
|
2020-06-23 03:35:34 +00:00
|
|
|
{
|
|
|
|
nets.insert( pad->GetNetCode() );
|
|
|
|
item_set.insert( pad );
|
|
|
|
}
|
|
|
|
}
|
2023-06-24 18:54:50 +00:00
|
|
|
else if( item->IsConnected() )
|
2020-06-23 03:35:34 +00:00
|
|
|
{
|
2023-06-24 18:54:50 +00:00
|
|
|
BOARD_CONNECTED_ITEM* conn_item = static_cast<BOARD_CONNECTED_ITEM*>( item );
|
|
|
|
|
2020-06-24 21:22:01 +00:00
|
|
|
item_set.insert( conn_item );
|
2020-06-23 03:35:34 +00:00
|
|
|
nets.insert( conn_item->GetNetCode() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-30 14:19:39 +00:00
|
|
|
for( int netcode : nets )
|
2020-06-23 03:35:34 +00:00
|
|
|
{
|
2021-10-25 20:35:19 +00:00
|
|
|
RN_NET* net = GetRatsnestForNet( netcode );
|
2020-06-23 03:35:34 +00:00
|
|
|
|
2023-08-24 14:51:34 +00:00
|
|
|
if( !net )
|
|
|
|
continue;
|
|
|
|
|
2021-10-25 20:35:19 +00:00
|
|
|
for( const CN_EDGE& edge : net->GetEdges() )
|
2020-06-23 03:35:34 +00:00
|
|
|
{
|
2022-11-22 12:19:22 +00:00
|
|
|
std::shared_ptr<const CN_ANCHOR> srcNode = edge.GetSourceNode();
|
|
|
|
std::shared_ptr<const CN_ANCHOR> dstNode = edge.GetTargetNode();
|
2020-06-23 03:35:34 +00:00
|
|
|
|
2023-11-01 17:08:51 +00:00
|
|
|
if( !srcNode || srcNode->Dirty() || !dstNode || dstNode->Dirty() )
|
|
|
|
continue;
|
|
|
|
|
2021-10-25 20:35:19 +00:00
|
|
|
BOARD_CONNECTED_ITEM* srcParent = srcNode->Parent();
|
|
|
|
BOARD_CONNECTED_ITEM* dstParent = dstNode->Parent();
|
2020-06-23 03:35:34 +00:00
|
|
|
|
2021-10-25 20:35:19 +00:00
|
|
|
bool srcFound = ( item_set.find( srcParent ) != item_set.end() );
|
|
|
|
bool dstFound = ( item_set.find( dstParent ) != item_set.end() );
|
2020-06-23 03:35:34 +00:00
|
|
|
|
|
|
|
if ( srcFound && dstFound )
|
|
|
|
edges.push_back( edge );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return edges;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-10-25 20:35:19 +00:00
|
|
|
const std::vector<CN_EDGE> CONNECTIVITY_DATA::GetRatsnestForPad( const PAD* aPad )
|
|
|
|
{
|
|
|
|
std::vector<CN_EDGE> edges;
|
|
|
|
RN_NET* net = GetRatsnestForNet( aPad->GetNetCode() );
|
|
|
|
|
2023-08-24 14:51:34 +00:00
|
|
|
if( !net )
|
|
|
|
return edges;
|
|
|
|
|
2021-10-25 20:35:19 +00:00
|
|
|
for( const CN_EDGE& edge : net->GetEdges() )
|
|
|
|
{
|
2023-11-01 17:08:51 +00:00
|
|
|
if( !edge.GetSourceNode() || edge.GetSourceNode()->Dirty() )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if( !edge.GetTargetNode() || edge.GetTargetNode()->Dirty() )
|
|
|
|
continue;
|
|
|
|
|
2021-10-25 20:35:19 +00:00
|
|
|
if( edge.GetSourceNode()->Parent() == aPad || edge.GetTargetNode()->Parent() == aPad )
|
|
|
|
edges.push_back( edge );
|
|
|
|
}
|
|
|
|
|
|
|
|
return edges;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-06-24 18:54:50 +00:00
|
|
|
const std::vector<CN_EDGE> CONNECTIVITY_DATA::GetRatsnestForComponent( FOOTPRINT* aComponent,
|
|
|
|
bool aSkipInternalConnections )
|
2018-08-24 10:54:45 +00:00
|
|
|
{
|
|
|
|
std::set<int> nets;
|
2020-11-12 22:30:02 +00:00
|
|
|
std::set<const PAD*> pads;
|
2018-08-24 10:54:45 +00:00
|
|
|
std::vector<CN_EDGE> edges;
|
|
|
|
|
2022-08-15 17:47:23 +00:00
|
|
|
for( PAD* pad : aComponent->Pads() )
|
2018-08-24 10:54:45 +00:00
|
|
|
{
|
|
|
|
nets.insert( pad->GetNetCode() );
|
|
|
|
pads.insert( pad );
|
|
|
|
}
|
|
|
|
|
2023-06-24 18:54:50 +00:00
|
|
|
for( int netcode : nets )
|
2018-08-24 10:54:45 +00:00
|
|
|
{
|
2023-08-24 14:51:34 +00:00
|
|
|
RN_NET* net = GetRatsnestForNet( netcode );
|
|
|
|
|
|
|
|
if( !net )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
for( const CN_EDGE& edge : net->GetEdges() )
|
2018-08-24 10:54:45 +00:00
|
|
|
{
|
2023-06-24 18:54:50 +00:00
|
|
|
const std::shared_ptr<const CN_ANCHOR>& srcNode = edge.GetSourceNode();
|
|
|
|
const std::shared_ptr<const CN_ANCHOR>& dstNode = edge.GetTargetNode();
|
2018-08-24 10:54:45 +00:00
|
|
|
|
2023-11-01 17:08:51 +00:00
|
|
|
if( !srcNode || srcNode->Dirty() || !dstNode || dstNode->Dirty() )
|
|
|
|
continue;
|
|
|
|
|
2020-11-12 22:30:02 +00:00
|
|
|
const PAD* srcParent = static_cast<const PAD*>( srcNode->Parent() );
|
|
|
|
const PAD* dstParent = static_cast<const PAD*>( dstNode->Parent() );
|
2018-08-24 10:54:45 +00:00
|
|
|
|
|
|
|
bool srcFound = ( pads.find(srcParent) != pads.end() );
|
|
|
|
bool dstFound = ( pads.find(dstParent) != pads.end() );
|
|
|
|
|
|
|
|
if ( srcFound && dstFound && !aSkipInternalConnections )
|
|
|
|
edges.push_back( edge );
|
|
|
|
else if ( srcFound || dstFound )
|
|
|
|
edges.push_back( edge );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return edges;
|
|
|
|
}
|
2020-05-14 19:24:10 +00:00
|
|
|
|
|
|
|
|