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