3D-Viewer: subtract pads poly to F_Cu and B_Cu poly layers
This commit is contained in:
parent
d7a95951e1
commit
e288218c4f
|
@ -758,41 +758,65 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
|||
if( GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS )
|
||||
&& ( m_render_engine == RENDER_ENGINE::OPENGL_LEGACY ) )
|
||||
{
|
||||
std::atomic<size_t> nextItem( 0 );
|
||||
std::atomic<size_t> threadsFinished( 0 );
|
||||
|
||||
size_t parallelThreadCount = std::min<size_t>(
|
||||
std::max<size_t>( std::thread::hardware_concurrency(), 2 ),
|
||||
layer_id.size() );
|
||||
for( size_t ii = 0; ii < parallelThreadCount; ++ii )
|
||||
if( m_F_Cu_PlatedPads_poly && ( m_layers_poly.find( F_Cu ) != m_layers_poly.end() ) )
|
||||
{
|
||||
std::thread t = std::thread( [&nextItem, &threadsFinished, &layer_id, this]()
|
||||
{
|
||||
for( size_t i = nextItem.fetch_add( 1 );
|
||||
i < layer_id.size();
|
||||
i = nextItem.fetch_add( 1 ) )
|
||||
{
|
||||
auto layerPoly = m_layers_poly.find( layer_id[i] );
|
||||
SHAPE_POLY_SET *layerPoly_F_Cu = m_layers_poly[F_Cu];
|
||||
layerPoly_F_Cu->BooleanSubtract( *m_F_Cu_PlatedPads_poly, SHAPE_POLY_SET::POLYGON_MODE::PM_FAST );
|
||||
|
||||
if( layerPoly != m_layers_poly.end() )
|
||||
// This will make a union of all added contours
|
||||
layerPoly->second->Simplify( SHAPE_POLY_SET::PM_FAST );
|
||||
}
|
||||
|
||||
threadsFinished++;
|
||||
} );
|
||||
|
||||
t.detach();
|
||||
m_F_Cu_PlatedPads_poly->Simplify( SHAPE_POLY_SET::PM_FAST );
|
||||
}
|
||||
|
||||
while( threadsFinished < parallelThreadCount )
|
||||
std::this_thread::sleep_for( std::chrono::milliseconds( 10 ) );
|
||||
if( m_B_Cu_PlatedPads_poly && ( m_layers_poly.find( B_Cu ) != m_layers_poly.end() ) )
|
||||
{
|
||||
SHAPE_POLY_SET *layerPoly_B_Cu = m_layers_poly[B_Cu];
|
||||
layerPoly_B_Cu->BooleanSubtract( *m_B_Cu_PlatedPads_poly, SHAPE_POLY_SET::POLYGON_MODE::PM_FAST );
|
||||
|
||||
if( m_F_Cu_PlatedPads_poly )
|
||||
m_F_Cu_PlatedPads_poly->Simplify( SHAPE_POLY_SET::PM_FAST );
|
||||
|
||||
if( m_B_Cu_PlatedPads_poly )
|
||||
m_B_Cu_PlatedPads_poly->Simplify( SHAPE_POLY_SET::PM_FAST );
|
||||
}
|
||||
|
||||
std::vector< PCB_LAYER_ID > layer_id_without_F_and_B;
|
||||
layer_id_without_F_and_B.clear();
|
||||
layer_id_without_F_and_B.reserve( layer_id.size() );
|
||||
|
||||
for( size_t i = 0; i < layer_id.size(); ++i )
|
||||
{
|
||||
if( ( layer_id[i] != F_Cu ) &&
|
||||
( layer_id[i] != B_Cu ) )
|
||||
layer_id_without_F_and_B.push_back( layer_id[i] );
|
||||
}
|
||||
|
||||
if( layer_id_without_F_and_B.size() > 0 )
|
||||
{
|
||||
std::atomic<size_t> nextItem( 0 );
|
||||
std::atomic<size_t> threadsFinished( 0 );
|
||||
|
||||
size_t parallelThreadCount = std::min<size_t>(
|
||||
std::max<size_t>( std::thread::hardware_concurrency(), 2 ),
|
||||
layer_id_without_F_and_B.size() );
|
||||
for( size_t ii = 0; ii < parallelThreadCount; ++ii )
|
||||
{
|
||||
std::thread t = std::thread( [&nextItem, &threadsFinished, &layer_id_without_F_and_B, this]()
|
||||
{
|
||||
for( size_t i = nextItem.fetch_add( 1 );
|
||||
i < layer_id_without_F_and_B.size();
|
||||
i = nextItem.fetch_add( 1 ) )
|
||||
{
|
||||
auto layerPoly = m_layers_poly.find( layer_id_without_F_and_B[i] );
|
||||
|
||||
if( layerPoly != m_layers_poly.end() )
|
||||
// This will make a union of all added contours
|
||||
layerPoly->second->Simplify( SHAPE_POLY_SET::PM_FAST );
|
||||
}
|
||||
|
||||
threadsFinished++;
|
||||
} );
|
||||
|
||||
t.detach();
|
||||
}
|
||||
|
||||
while( threadsFinished < parallelThreadCount )
|
||||
std::this_thread::sleep_for( std::chrono::milliseconds( 10 ) );
|
||||
}
|
||||
}
|
||||
|
||||
// Simplify holes polygon contours
|
||||
|
|
Loading…
Reference in New Issue