Name shortening and line-break reduction.
This commit is contained in:
parent
209ff933e7
commit
d16b23d16e
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||||
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -367,11 +367,10 @@ private:
|
||||||
void buildPadOutlineAsSegments( const PAD* aPad, CONTAINER_2D_BASE* aDstContainer, int aWidth );
|
void buildPadOutlineAsSegments( const PAD* aPad, CONTAINER_2D_BASE* aDstContainer, int aWidth );
|
||||||
|
|
||||||
// Helper functions to create poly contours
|
// Helper functions to create poly contours
|
||||||
void buildPadOutlineAsPolygon( const PAD* aPad, SHAPE_POLY_SET& aCornerBuffer,
|
void buildPadOutlineAsPolygon( const PAD* aPad, SHAPE_POLY_SET& aBuffer, int aWidth) const;
|
||||||
int aWidth) const;
|
|
||||||
|
|
||||||
void transformFPShapesToPolygon( const FOOTPRINT* aFootprint, PCB_LAYER_ID aLayer,
|
void transformFPShapesToPolySet( const FOOTPRINT* aFootprint, PCB_LAYER_ID aLayer,
|
||||||
SHAPE_POLY_SET& aCornerBuffer ) const;
|
SHAPE_POLY_SET& aBuffer ) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static CUSTOM_COLORS_LIST g_SilkscreenColors;
|
static CUSTOM_COLORS_LIST g_SilkscreenColors;
|
||||||
|
|
|
@ -94,7 +94,7 @@ void BOARD_ADAPTER::addText( const EDA_TEXT* aText, CONTAINER_2D_BASE* aContaine
|
||||||
int margin = attrs.m_StrokeWidth * 1.5 +
|
int margin = attrs.m_StrokeWidth * 1.5 +
|
||||||
GetKnockoutTextMargin( attrs.m_Size, attrs.m_StrokeWidth );
|
GetKnockoutTextMargin( attrs.m_Size, attrs.m_StrokeWidth );
|
||||||
|
|
||||||
aText->TransformBoundingBoxWithClearanceToPolygon( &finalPoly, margin );
|
aText->TransformBoundingBoxToPolygon( &finalPoly, margin );
|
||||||
finalPoly.BooleanSubtract( knockouts, SHAPE_POLY_SET::PM_FAST );
|
finalPoly.BooleanSubtract( knockouts, SHAPE_POLY_SET::PM_FAST );
|
||||||
finalPoly.Fracture( SHAPE_POLY_SET::PM_FAST );
|
finalPoly.Fracture( SHAPE_POLY_SET::PM_FAST );
|
||||||
|
|
||||||
|
@ -328,7 +328,7 @@ void BOARD_ADAPTER::createPadWithMargin( const PAD* aPad, CONTAINER_2D_BASE* aCo
|
||||||
|
|
||||||
PAD dummy( *aPad );
|
PAD dummy( *aPad );
|
||||||
dummy.SetSize( wxSize( dummySize.x, dummySize.y ) );
|
dummy.SetSize( wxSize( dummySize.x, dummySize.y ) );
|
||||||
dummy.TransformShapeWithClearanceToPolygon( poly, aLayer, 0, maxError, ERROR_INSIDE );
|
dummy.TransformShapeToPolygon( poly, aLayer, 0, maxError, ERROR_INSIDE );
|
||||||
clearance = { 0, 0 };
|
clearance = { 0, 0 };
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -622,8 +622,8 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aConta
|
||||||
{
|
{
|
||||||
SHAPE_POLY_SET polyList;
|
SHAPE_POLY_SET polyList;
|
||||||
|
|
||||||
aShape->TransformShapeWithClearanceToPolygon( polyList, UNDEFINED_LAYER, 0,
|
aShape->TransformShapeToPolygon( polyList, UNDEFINED_LAYER, 0, ARC_HIGH_DEF,
|
||||||
ARC_HIGH_DEF, ERROR_INSIDE );
|
ERROR_INSIDE );
|
||||||
|
|
||||||
polyList.Simplify( SHAPE_POLY_SET::PM_FAST );
|
polyList.Simplify( SHAPE_POLY_SET::PM_FAST );
|
||||||
|
|
||||||
|
@ -671,8 +671,8 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aConta
|
||||||
{
|
{
|
||||||
SHAPE_POLY_SET polyList;
|
SHAPE_POLY_SET polyList;
|
||||||
|
|
||||||
aShape->TransformShapeWithClearanceToPolygon( polyList, UNDEFINED_LAYER, 0,
|
aShape->TransformShapeToPolygon( polyList, UNDEFINED_LAYER, 0, ARC_HIGH_DEF,
|
||||||
ARC_HIGH_DEF, ERROR_INSIDE );
|
ERROR_INSIDE );
|
||||||
|
|
||||||
if( polyList.IsEmpty() ) // Just for caution
|
if( polyList.IsEmpty() ) // Just for caution
|
||||||
break;
|
break;
|
||||||
|
@ -682,7 +682,7 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aConta
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
wxFAIL_MSG( wxT( "BOARD_ADAPTER::addShapeWithClearance no implementation for " )
|
wxFAIL_MSG( wxT( "BOARD_ADAPTER::addShape no implementation for " )
|
||||||
+ aShape->SHAPE_T_asString() );
|
+ aShape->SHAPE_T_asString() );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,6 +153,8 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||||
trackList.clear();
|
trackList.clear();
|
||||||
trackList.reserve( m_board->Tracks().size() );
|
trackList.reserve( m_board->Tracks().size() );
|
||||||
|
|
||||||
|
int maxError = m_board->GetDesignSettings().m_MaxError;
|
||||||
|
|
||||||
for( PCB_TRACK* track : m_board->Tracks() )
|
for( PCB_TRACK* track : m_board->Tracks() )
|
||||||
{
|
{
|
||||||
if( !Is3dLayerEnabled( track->GetLayer() ) ) // Skip non enabled layers
|
if( !Is3dLayerEnabled( track->GetLayer() ) ) // Skip non enabled layers
|
||||||
|
@ -183,30 +185,30 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||||
m_averageViaHoleDiameter /= (float)m_viaCount;
|
m_averageViaHoleDiameter /= (float)m_viaCount;
|
||||||
|
|
||||||
// Prepare copper layers index and containers
|
// Prepare copper layers index and containers
|
||||||
std::vector<PCB_LAYER_ID> layer_id;
|
std::vector<PCB_LAYER_ID> layer_ids;
|
||||||
layer_id.clear();
|
layer_ids.clear();
|
||||||
layer_id.reserve( m_copperLayersCount );
|
layer_ids.reserve( m_copperLayersCount );
|
||||||
|
|
||||||
for( unsigned i = 0; i < arrayDim( cu_seq ); ++i )
|
for( unsigned i = 0; i < arrayDim( cu_seq ); ++i )
|
||||||
cu_seq[i] = ToLAYER_ID( B_Cu - i );
|
cu_seq[i] = ToLAYER_ID( B_Cu - i );
|
||||||
|
|
||||||
for( LSEQ cu = cu_set.Seq( cu_seq, arrayDim( cu_seq ) ); cu; ++cu )
|
for( LSEQ cu = cu_set.Seq( cu_seq, arrayDim( cu_seq ) ); cu; ++cu )
|
||||||
{
|
{
|
||||||
const PCB_LAYER_ID curr_layer_id = *cu;
|
const PCB_LAYER_ID layer = *cu;
|
||||||
|
|
||||||
if( !Is3dLayerEnabled( curr_layer_id ) ) // Skip non enabled layers
|
if( !Is3dLayerEnabled( layer ) ) // Skip non enabled layers
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
layer_id.push_back( curr_layer_id );
|
layer_ids.push_back( layer );
|
||||||
|
|
||||||
BVH_CONTAINER_2D *layerContainer = new BVH_CONTAINER_2D;
|
BVH_CONTAINER_2D *layerContainer = new BVH_CONTAINER_2D;
|
||||||
m_layerMap[curr_layer_id] = layerContainer;
|
m_layerMap[layer] = layerContainer;
|
||||||
|
|
||||||
if( m_Cfg->m_Render.opengl_copper_thickness
|
if( m_Cfg->m_Render.opengl_copper_thickness
|
||||||
&& m_Cfg->m_Render.engine == RENDER_ENGINE::OPENGL )
|
&& m_Cfg->m_Render.engine == RENDER_ENGINE::OPENGL )
|
||||||
{
|
{
|
||||||
SHAPE_POLY_SET* layerPoly = new SHAPE_POLY_SET;
|
SHAPE_POLY_SET* layerPoly = new SHAPE_POLY_SET;
|
||||||
m_layers_poly[curr_layer_id] = layerPoly;
|
m_layers_poly[layer] = layerPoly;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,27 +226,22 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||||
aStatusReporter->Report( _( "Create tracks and vias" ) );
|
aStatusReporter->Report( _( "Create tracks and vias" ) );
|
||||||
|
|
||||||
// Create tracks as objects and add it to container
|
// Create tracks as objects and add it to container
|
||||||
for( PCB_LAYER_ID curr_layer_id : layer_id )
|
for( PCB_LAYER_ID layer : layer_ids )
|
||||||
{
|
{
|
||||||
wxASSERT( m_layerMap.find( curr_layer_id ) != m_layerMap.end() );
|
wxASSERT( m_layerMap.find( layer ) != m_layerMap.end() );
|
||||||
|
|
||||||
BVH_CONTAINER_2D *layerContainer = m_layerMap[curr_layer_id];
|
BVH_CONTAINER_2D *layerContainer = m_layerMap[layer];
|
||||||
|
|
||||||
// Add track segments shapes and via annulus shapes
|
for( const PCB_TRACK* track : trackList )
|
||||||
unsigned int nTracks = trackList.size();
|
|
||||||
|
|
||||||
for( unsigned int trackIdx = 0; trackIdx < nTracks; ++trackIdx )
|
|
||||||
{
|
{
|
||||||
const PCB_TRACK *track = trackList[trackIdx];
|
|
||||||
|
|
||||||
// NOTE: Vias can be on multiple layers
|
// NOTE: Vias can be on multiple layers
|
||||||
if( !track->IsOnLayer( curr_layer_id ) )
|
if( !track->IsOnLayer( layer ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Skip vias annulus when not connected on this layer (if removing is enabled)
|
// Skip vias annulus when not connected on this layer (if removing is enabled)
|
||||||
const PCB_VIA *via = dyn_cast< const PCB_VIA*>( track );
|
const PCB_VIA *via = dyn_cast< const PCB_VIA*>( track );
|
||||||
|
|
||||||
if( via && !via->FlashLayer( curr_layer_id ) && IsCopperLayer( curr_layer_id ) )
|
if( via && IsCopperLayer( layer ) && !via->FlashLayer( layer ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Add object item to layer container
|
// Add object item to layer container
|
||||||
|
@ -253,7 +250,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create VIAS and THTs objects and add it to holes containers
|
// Create VIAS and THTs objects and add it to holes containers
|
||||||
for( PCB_LAYER_ID curr_layer_id : layer_id )
|
for( PCB_LAYER_ID layer : layer_ids )
|
||||||
{
|
{
|
||||||
// ADD TRACKS
|
// ADD TRACKS
|
||||||
unsigned int nTracks = trackList.size();
|
unsigned int nTracks = trackList.size();
|
||||||
|
@ -262,7 +259,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||||
{
|
{
|
||||||
const PCB_TRACK *track = trackList[trackIdx];
|
const PCB_TRACK *track = trackList[trackIdx];
|
||||||
|
|
||||||
if( !track->IsOnLayer( curr_layer_id ) )
|
if( !track->IsOnLayer( layer ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// ADD VIAS and THT
|
// ADD VIAS and THT
|
||||||
|
@ -287,16 +284,16 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||||
BVH_CONTAINER_2D *layerHoleContainer = nullptr;
|
BVH_CONTAINER_2D *layerHoleContainer = nullptr;
|
||||||
|
|
||||||
// Check if the layer is already created
|
// Check if the layer is already created
|
||||||
if( m_layerHoleMap.find( curr_layer_id ) == m_layerHoleMap.end() )
|
if( m_layerHoleMap.find( layer ) == m_layerHoleMap.end() )
|
||||||
{
|
{
|
||||||
// not found, create a new container
|
// not found, create a new container
|
||||||
layerHoleContainer = new BVH_CONTAINER_2D;
|
layerHoleContainer = new BVH_CONTAINER_2D;
|
||||||
m_layerHoleMap[curr_layer_id] = layerHoleContainer;
|
m_layerHoleMap[layer] = layerHoleContainer;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// found
|
// found
|
||||||
layerHoleContainer = m_layerHoleMap[curr_layer_id];
|
layerHoleContainer = m_layerHoleMap[layer];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add a hole for this layer
|
// Add a hole for this layer
|
||||||
|
@ -304,7 +301,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||||
hole_inner_radius + thickness,
|
hole_inner_radius + thickness,
|
||||||
*track ) );
|
*track ) );
|
||||||
}
|
}
|
||||||
else if( curr_layer_id == layer_id[0] ) // it only adds once the THT holes
|
else if( layer == layer_ids[0] ) // it only adds once the THT holes
|
||||||
{
|
{
|
||||||
// Add through hole object
|
// Add through hole object
|
||||||
m_throughHoleOds.Add( new FILLED_CIRCLE_2D( via_center,
|
m_throughHoleOds.Add( new FILLED_CIRCLE_2D( via_center,
|
||||||
|
@ -329,7 +326,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create VIAS and THTs objects and add it to holes containers
|
// Create VIAS and THTs objects and add it to holes containers
|
||||||
for( PCB_LAYER_ID curr_layer_id : layer_id )
|
for( PCB_LAYER_ID layer : layer_ids )
|
||||||
{
|
{
|
||||||
// ADD TRACKS
|
// ADD TRACKS
|
||||||
const unsigned int nTracks = trackList.size();
|
const unsigned int nTracks = trackList.size();
|
||||||
|
@ -338,7 +335,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||||
{
|
{
|
||||||
const PCB_TRACK *track = trackList[trackIdx];
|
const PCB_TRACK *track = trackList[trackIdx];
|
||||||
|
|
||||||
if( !track->IsOnLayer( curr_layer_id ) )
|
if( !track->IsOnLayer( layer ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// ADD VIAS and THT
|
// ADD VIAS and THT
|
||||||
|
@ -356,40 +353,37 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||||
SHAPE_POLY_SET *layerInnerHolesPoly = nullptr;
|
SHAPE_POLY_SET *layerInnerHolesPoly = nullptr;
|
||||||
|
|
||||||
// Check if the layer is already created
|
// Check if the layer is already created
|
||||||
if( m_layerHoleOdPolys.find( curr_layer_id ) ==
|
if( m_layerHoleOdPolys.find( layer ) == m_layerHoleOdPolys.end() )
|
||||||
m_layerHoleOdPolys.end() )
|
|
||||||
{
|
{
|
||||||
// not found, create a new container
|
// not found, create a new container
|
||||||
layerOuterHolesPoly = new SHAPE_POLY_SET;
|
layerOuterHolesPoly = new SHAPE_POLY_SET;
|
||||||
m_layerHoleOdPolys[curr_layer_id] = layerOuterHolesPoly;
|
m_layerHoleOdPolys[layer] = layerOuterHolesPoly;
|
||||||
|
|
||||||
wxASSERT( m_layerHoleIdPolys.find( curr_layer_id ) ==
|
wxASSERT( m_layerHoleIdPolys.find( layer ) == m_layerHoleIdPolys.end() );
|
||||||
m_layerHoleIdPolys.end() );
|
|
||||||
|
|
||||||
layerInnerHolesPoly = new SHAPE_POLY_SET;
|
layerInnerHolesPoly = new SHAPE_POLY_SET;
|
||||||
m_layerHoleIdPolys[curr_layer_id] = layerInnerHolesPoly;
|
m_layerHoleIdPolys[layer] = layerInnerHolesPoly;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// found
|
// found
|
||||||
layerOuterHolesPoly = m_layerHoleOdPolys[curr_layer_id];
|
layerOuterHolesPoly = m_layerHoleOdPolys[layer];
|
||||||
|
|
||||||
wxASSERT( m_layerHoleIdPolys.find( curr_layer_id ) !=
|
wxASSERT( m_layerHoleIdPolys.find( layer ) != m_layerHoleIdPolys.end() );
|
||||||
m_layerHoleIdPolys.end() );
|
|
||||||
|
|
||||||
layerInnerHolesPoly = m_layerHoleIdPolys[curr_layer_id];
|
layerInnerHolesPoly = m_layerHoleIdPolys[layer];
|
||||||
}
|
}
|
||||||
|
|
||||||
const int holediameter = via->GetDrillValue();
|
const int holediameter = via->GetDrillValue();
|
||||||
const int hole_outer_radius = (holediameter / 2) + GetHolePlatingThickness();
|
const int hole_outer_radius = (holediameter / 2) + GetHolePlatingThickness();
|
||||||
|
|
||||||
TransformCircleToPolygon( *layerOuterHolesPoly, via->GetStart(),
|
TransformCircleToPolygon( *layerOuterHolesPoly, via->GetStart(),
|
||||||
hole_outer_radius, ARC_HIGH_DEF, ERROR_INSIDE );
|
hole_outer_radius, maxError, ERROR_INSIDE );
|
||||||
|
|
||||||
TransformCircleToPolygon( *layerInnerHolesPoly, via->GetStart(),
|
TransformCircleToPolygon( *layerInnerHolesPoly, via->GetStart(),
|
||||||
holediameter / 2, ARC_HIGH_DEF, ERROR_INSIDE );
|
holediameter / 2, maxError, ERROR_INSIDE );
|
||||||
}
|
}
|
||||||
else if( curr_layer_id == layer_id[0] ) // it only adds once the THT holes
|
else if( layer == layer_ids[0] ) // it only adds once the THT holes
|
||||||
{
|
{
|
||||||
const int holediameter = via->GetDrillValue();
|
const int holediameter = via->GetDrillValue();
|
||||||
const int hole_outer_radius = (holediameter / 2) + GetHolePlatingThickness();
|
const int hole_outer_radius = (holediameter / 2) + GetHolePlatingThickness();
|
||||||
|
@ -397,17 +391,16 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||||
|
|
||||||
// Add through hole contours
|
// Add through hole contours
|
||||||
TransformCircleToPolygon( m_throughHoleOdPolys, via->GetStart(),
|
TransformCircleToPolygon( m_throughHoleOdPolys, via->GetStart(),
|
||||||
hole_outer_radius, ARC_HIGH_DEF, ERROR_INSIDE );
|
hole_outer_radius, maxError, ERROR_INSIDE );
|
||||||
|
|
||||||
// Add same thing for vias only
|
// Add same thing for vias only
|
||||||
TransformCircleToPolygon( m_throughHoleViaOdPolys, via->GetStart(),
|
TransformCircleToPolygon( m_throughHoleViaOdPolys, via->GetStart(),
|
||||||
hole_outer_radius, ARC_HIGH_DEF, ERROR_INSIDE );
|
hole_outer_radius, maxError, ERROR_INSIDE );
|
||||||
|
|
||||||
if( m_Cfg->m_Render.clip_silk_on_via_annulus && m_Cfg->m_Render.realistic )
|
if( m_Cfg->m_Render.clip_silk_on_via_annulus && m_Cfg->m_Render.realistic )
|
||||||
{
|
{
|
||||||
TransformCircleToPolygon( m_throughHoleAnnularRingPolys, via->GetStart(),
|
TransformCircleToPolygon( m_throughHoleAnnularRingPolys, via->GetStart(),
|
||||||
hole_outer_ring_radius, ARC_HIGH_DEF,
|
hole_outer_ring_radius, maxError, ERROR_INSIDE );
|
||||||
ERROR_INSIDE );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -417,11 +410,11 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||||
// Creates vertical outline contours of the tracks and add it to the poly of the layer
|
// Creates vertical outline contours of the tracks and add it to the poly of the layer
|
||||||
if( m_Cfg->m_Render.opengl_copper_thickness && m_Cfg->m_Render.engine == RENDER_ENGINE::OPENGL )
|
if( m_Cfg->m_Render.opengl_copper_thickness && m_Cfg->m_Render.engine == RENDER_ENGINE::OPENGL )
|
||||||
{
|
{
|
||||||
for( PCB_LAYER_ID curr_layer_id : layer_id )
|
for( PCB_LAYER_ID layer : layer_ids )
|
||||||
{
|
{
|
||||||
wxASSERT( m_layers_poly.find( curr_layer_id ) != m_layers_poly.end() );
|
wxASSERT( m_layers_poly.find( layer ) != m_layers_poly.end() );
|
||||||
|
|
||||||
SHAPE_POLY_SET *layerPoly = m_layers_poly[curr_layer_id];
|
SHAPE_POLY_SET *layerPoly = m_layers_poly[layer];
|
||||||
|
|
||||||
// ADD TRACKS
|
// ADD TRACKS
|
||||||
unsigned int nTracks = trackList.size();
|
unsigned int nTracks = trackList.size();
|
||||||
|
@ -430,18 +423,17 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||||
{
|
{
|
||||||
const PCB_TRACK *track = trackList[trackIdx];
|
const PCB_TRACK *track = trackList[trackIdx];
|
||||||
|
|
||||||
if( !track->IsOnLayer( curr_layer_id ) )
|
if( !track->IsOnLayer( layer ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Skip vias annulus when not connected on this layer (if removing is enabled)
|
// Skip vias annulus when not connected on this layer (if removing is enabled)
|
||||||
const PCB_VIA *via = dyn_cast<const PCB_VIA*>( track );
|
const PCB_VIA *via = dyn_cast<const PCB_VIA*>( track );
|
||||||
|
|
||||||
if( via && !via->FlashLayer( curr_layer_id ) && IsCopperLayer( curr_layer_id ) )
|
if( via && !via->FlashLayer( layer ) && IsCopperLayer( layer ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Add the track/via contour
|
// Add the track/via contour
|
||||||
track->TransformShapeWithClearanceToPolygon( *layerPoly, curr_layer_id, 0,
|
track->TransformShapeToPolygon( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
|
||||||
ARC_HIGH_DEF, ERROR_INSIDE );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -493,24 +485,24 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||||
{
|
{
|
||||||
if( m_Cfg->m_Render.clip_silk_on_via_annulus && m_Cfg->m_Render.realistic )
|
if( m_Cfg->m_Render.clip_silk_on_via_annulus && m_Cfg->m_Render.realistic )
|
||||||
{
|
{
|
||||||
pad->TransformHoleWithClearanceToPolygon( m_throughHoleAnnularRingPolys,
|
pad->TransformHoleToPolygon( m_throughHoleAnnularRingPolys, inflate, maxError,
|
||||||
inflate, ARC_HIGH_DEF, ERROR_INSIDE );
|
ERROR_INSIDE );
|
||||||
}
|
}
|
||||||
|
|
||||||
pad->TransformHoleWithClearanceToPolygon( m_throughHoleOdPolys, inflate,
|
pad->TransformHoleToPolygon( m_throughHoleOdPolys, inflate, maxError,
|
||||||
ARC_HIGH_DEF, ERROR_INSIDE );
|
ERROR_INSIDE );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// If not plated, no copper.
|
// If not plated, no copper.
|
||||||
if( m_Cfg->m_Render.clip_silk_on_via_annulus && m_Cfg->m_Render.realistic )
|
if( m_Cfg->m_Render.clip_silk_on_via_annulus && m_Cfg->m_Render.realistic )
|
||||||
{
|
{
|
||||||
pad->TransformHoleWithClearanceToPolygon( m_throughHoleAnnularRingPolys, 0,
|
pad->TransformHoleToPolygon( m_throughHoleAnnularRingPolys, 0, maxError,
|
||||||
ARC_HIGH_DEF, ERROR_INSIDE );
|
ERROR_INSIDE );
|
||||||
}
|
}
|
||||||
|
|
||||||
pad->TransformHoleWithClearanceToPolygon( m_nonPlatedThroughHoleOdPolys, 0,
|
pad->TransformHoleToPolygon( m_nonPlatedThroughHoleOdPolys, 0, maxError,
|
||||||
ARC_HIGH_DEF, ERROR_INSIDE );
|
ERROR_INSIDE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -519,22 +511,21 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||||
&& m_Cfg->m_Render.realistic;
|
&& m_Cfg->m_Render.realistic;
|
||||||
|
|
||||||
// Add footprints PADs objects to containers
|
// Add footprints PADs objects to containers
|
||||||
for( PCB_LAYER_ID curr_layer_id : layer_id )
|
for( PCB_LAYER_ID layer : layer_ids )
|
||||||
{
|
{
|
||||||
wxASSERT( m_layerMap.find( curr_layer_id ) != m_layerMap.end() );
|
wxASSERT( m_layerMap.find( layer ) != m_layerMap.end() );
|
||||||
|
|
||||||
BVH_CONTAINER_2D *layerContainer = m_layerMap[curr_layer_id];
|
BVH_CONTAINER_2D *layerContainer = m_layerMap[layer];
|
||||||
|
|
||||||
// ADD PADS
|
// ADD PADS
|
||||||
for( FOOTPRINT* footprint : m_board->Footprints() )
|
for( FOOTPRINT* footprint : m_board->Footprints() )
|
||||||
{
|
{
|
||||||
// Note: NPTH pads are not drawn on copper layers when the pad has the same shape
|
// Note: NPTH pads are not drawn on copper layers when the pad has the same shape
|
||||||
// as its hole
|
// as its hole
|
||||||
addPads( footprint, layerContainer, curr_layer_id, true, renderPlatedPadsAsPlated,
|
addPads( footprint, layerContainer, layer, true, renderPlatedPadsAsPlated, false );
|
||||||
false );
|
|
||||||
|
|
||||||
// Micro-wave footprints may have items on copper layers
|
// Micro-wave footprints may have items on copper layers
|
||||||
addFootprintShapes( footprint, layerContainer, curr_layer_id );
|
addFootprintShapes( footprint, layerContainer, layer );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -554,23 +545,21 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||||
// Add footprints PADs poly contours (vertical outlines)
|
// Add footprints PADs poly contours (vertical outlines)
|
||||||
if( m_Cfg->m_Render.opengl_copper_thickness && m_Cfg->m_Render.engine == RENDER_ENGINE::OPENGL )
|
if( m_Cfg->m_Render.opengl_copper_thickness && m_Cfg->m_Render.engine == RENDER_ENGINE::OPENGL )
|
||||||
{
|
{
|
||||||
for( PCB_LAYER_ID curr_layer_id : layer_id )
|
for( PCB_LAYER_ID layer : layer_ids )
|
||||||
{
|
{
|
||||||
wxASSERT( m_layers_poly.find( curr_layer_id ) != m_layers_poly.end() );
|
wxASSERT( m_layers_poly.find( layer ) != m_layers_poly.end() );
|
||||||
|
|
||||||
SHAPE_POLY_SET *layerPoly = m_layers_poly[curr_layer_id];
|
SHAPE_POLY_SET *layerPoly = m_layers_poly[layer];
|
||||||
|
|
||||||
// Add pads to polygon list
|
// Add pads to polygon list
|
||||||
for( FOOTPRINT* footprint : m_board->Footprints() )
|
for( FOOTPRINT* footprint : m_board->Footprints() )
|
||||||
{
|
{
|
||||||
// Note: NPTH pads are not drawn on copper layers when the pad has same shape as
|
// Note: NPTH pads are not drawn on copper layers when the pad has same shape as
|
||||||
// its hole
|
// its hole
|
||||||
footprint->TransformPadsWithClearanceToPolygon( *layerPoly, curr_layer_id,
|
footprint->TransformPadsToPolySet( *layerPoly, layer, 0, maxError, ERROR_INSIDE,
|
||||||
0, ARC_HIGH_DEF, ERROR_INSIDE,
|
true, renderPlatedPadsAsPlated, false );
|
||||||
true, renderPlatedPadsAsPlated,
|
|
||||||
false );
|
|
||||||
|
|
||||||
transformFPShapesToPolygon( footprint, curr_layer_id, *layerPoly );
|
transformFPShapesToPolySet( footprint, layer, *layerPoly );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -579,28 +568,26 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||||
// ADD PLATED PADS contours
|
// ADD PLATED PADS contours
|
||||||
for( FOOTPRINT* footprint : m_board->Footprints() )
|
for( FOOTPRINT* footprint : m_board->Footprints() )
|
||||||
{
|
{
|
||||||
footprint->TransformPadsWithClearanceToPolygon( *m_frontPlatedPadPolys, F_Cu,
|
footprint->TransformPadsToPolySet( *m_frontPlatedPadPolys, F_Cu, 0, maxError,
|
||||||
0, ARC_HIGH_DEF, ERROR_INSIDE,
|
ERROR_INSIDE, true, false, true );
|
||||||
true, false, true );
|
|
||||||
|
|
||||||
footprint->TransformPadsWithClearanceToPolygon( *m_backPlatedPadPolys, B_Cu,
|
footprint->TransformPadsToPolySet( *m_backPlatedPadPolys, B_Cu, 0, maxError,
|
||||||
0, ARC_HIGH_DEF, ERROR_INSIDE,
|
ERROR_INSIDE, true, false, true );
|
||||||
true, false, true );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add graphic item on copper layers to object containers
|
// Add graphic item on copper layers to object containers
|
||||||
for( PCB_LAYER_ID curr_layer_id : layer_id )
|
for( PCB_LAYER_ID layer : layer_ids )
|
||||||
{
|
{
|
||||||
wxASSERT( m_layerMap.find( curr_layer_id ) != m_layerMap.end() );
|
wxASSERT( m_layerMap.find( layer ) != m_layerMap.end() );
|
||||||
|
|
||||||
BVH_CONTAINER_2D *layerContainer = m_layerMap[curr_layer_id];
|
BVH_CONTAINER_2D *layerContainer = m_layerMap[layer];
|
||||||
|
|
||||||
// Add graphic items on copper layers (texts and other graphics)
|
// Add graphic items on copper layers (texts and other graphics)
|
||||||
for( BOARD_ITEM* item : m_board->Drawings() )
|
for( BOARD_ITEM* item : m_board->Drawings() )
|
||||||
{
|
{
|
||||||
if( !item->IsOnLayer( curr_layer_id ) )
|
if( !item->IsOnLayer( layer ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
switch( item->Type() )
|
switch( item->Type() )
|
||||||
|
@ -637,31 +624,29 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||||
// Add graphic item on copper layers to poly contours (vertical outlines)
|
// Add graphic item on copper layers to poly contours (vertical outlines)
|
||||||
if( m_Cfg->m_Render.opengl_copper_thickness && m_Cfg->m_Render.engine == RENDER_ENGINE::OPENGL )
|
if( m_Cfg->m_Render.opengl_copper_thickness && m_Cfg->m_Render.engine == RENDER_ENGINE::OPENGL )
|
||||||
{
|
{
|
||||||
for( PCB_LAYER_ID cur_layer_id : layer_id )
|
for( PCB_LAYER_ID layer : layer_ids )
|
||||||
{
|
{
|
||||||
wxASSERT( m_layers_poly.find( cur_layer_id ) != m_layers_poly.end() );
|
wxASSERT( m_layers_poly.find( layer ) != m_layers_poly.end() );
|
||||||
|
|
||||||
SHAPE_POLY_SET *layerPoly = m_layers_poly[cur_layer_id];
|
SHAPE_POLY_SET *layerPoly = m_layers_poly[layer];
|
||||||
|
|
||||||
// Add graphic items on copper layers (texts and other )
|
// Add graphic items on copper layers (texts and other )
|
||||||
for( BOARD_ITEM* item : m_board->Drawings() )
|
for( BOARD_ITEM* item : m_board->Drawings() )
|
||||||
{
|
{
|
||||||
if( !item->IsOnLayer( cur_layer_id ) )
|
if( !item->IsOnLayer( layer ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
switch( item->Type() )
|
switch( item->Type() )
|
||||||
{
|
{
|
||||||
case PCB_SHAPE_T:
|
case PCB_SHAPE_T:
|
||||||
item->TransformShapeWithClearanceToPolygon( *layerPoly, cur_layer_id, 0,
|
item->TransformShapeToPolygon( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
|
||||||
ARC_HIGH_DEF, ERROR_INSIDE );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCB_TEXT_T:
|
case PCB_TEXT_T:
|
||||||
{
|
{
|
||||||
PCB_TEXT* text = static_cast<PCB_TEXT*>( item );
|
PCB_TEXT* text = static_cast<PCB_TEXT*>( item );
|
||||||
|
|
||||||
text->TransformTextShapeWithClearanceToPolygon( *layerPoly, cur_layer_id, 0,
|
text->TransformTextToPolySet( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
|
||||||
ARC_HIGH_DEF, ERROR_INSIDE );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -669,8 +654,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||||
{
|
{
|
||||||
PCB_TEXTBOX* textbox = static_cast<PCB_TEXTBOX*>( item );
|
PCB_TEXTBOX* textbox = static_cast<PCB_TEXTBOX*>( item );
|
||||||
|
|
||||||
textbox->TransformTextShapeWithClearanceToPolygon( *layerPoly, cur_layer_id, 0,
|
textbox->TransformTextToPolySet( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
|
||||||
ARC_HIGH_DEF, ERROR_INSIDE );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -782,18 +766,18 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector< PCB_LAYER_ID > &selected_layer_id = layer_id;
|
std::vector<PCB_LAYER_ID> &selected_layer_id = layer_ids;
|
||||||
std::vector< PCB_LAYER_ID > layer_id_without_F_and_B;
|
std::vector<PCB_LAYER_ID> layer_id_without_F_and_B;
|
||||||
|
|
||||||
if( renderPlatedPadsAsPlated )
|
if( renderPlatedPadsAsPlated )
|
||||||
{
|
{
|
||||||
layer_id_without_F_and_B.clear();
|
layer_id_without_F_and_B.clear();
|
||||||
layer_id_without_F_and_B.reserve( layer_id.size() );
|
layer_id_without_F_and_B.reserve( layer_ids.size() );
|
||||||
|
|
||||||
for( size_t i = 0; i < layer_id.size(); ++i )
|
for( PCB_LAYER_ID layer: layer_ids )
|
||||||
{
|
{
|
||||||
if( ( layer_id[i] != F_Cu ) && ( layer_id[i] != B_Cu ) )
|
if( layer != F_Cu && layer != B_Cu )
|
||||||
layer_id_without_F_and_B.push_back( layer_id[i] );
|
layer_id_without_F_and_B.push_back( layer );
|
||||||
}
|
}
|
||||||
|
|
||||||
selected_layer_id = layer_id_without_F_and_B;
|
selected_layer_id = layer_id_without_F_and_B;
|
||||||
|
@ -845,7 +829,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||||
if( aStatusReporter )
|
if( aStatusReporter )
|
||||||
aStatusReporter->Report( _( "Simplify holes contours" ) );
|
aStatusReporter->Report( _( "Simplify holes contours" ) );
|
||||||
|
|
||||||
for( PCB_LAYER_ID layer : layer_id )
|
for( PCB_LAYER_ID layer : layer_ids )
|
||||||
{
|
{
|
||||||
if( m_layerHoleOdPolys.find( layer ) != m_layerHoleOdPolys.end() )
|
if( m_layerHoleOdPolys.find( layer ) != m_layerHoleOdPolys.end() )
|
||||||
{
|
{
|
||||||
|
@ -881,7 +865,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||||
bool buildVerticalWallsForTechLayers = m_Cfg->m_Render.opengl_copper_thickness
|
bool buildVerticalWallsForTechLayers = m_Cfg->m_Render.opengl_copper_thickness
|
||||||
&& m_Cfg->m_Render.engine == RENDER_ENGINE::OPENGL;
|
&& m_Cfg->m_Render.engine == RENDER_ENGINE::OPENGL;
|
||||||
|
|
||||||
static const PCB_LAYER_ID teckLayerList[] = {
|
static const PCB_LAYER_ID techLayerList[] = {
|
||||||
B_Adhes,
|
B_Adhes,
|
||||||
F_Adhes,
|
F_Adhes,
|
||||||
B_Paste,
|
B_Paste,
|
||||||
|
@ -901,31 +885,28 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||||
};
|
};
|
||||||
|
|
||||||
// User layers are not drawn here, only technical layers
|
// User layers are not drawn here, only technical layers
|
||||||
for( LSEQ seq = LSET::AllNonCuMask().Seq( teckLayerList, arrayDim( teckLayerList ) );
|
for( LSEQ seq = LSET::AllNonCuMask().Seq( techLayerList, arrayDim( techLayerList ) );
|
||||||
seq;
|
seq;
|
||||||
++seq )
|
++seq )
|
||||||
{
|
{
|
||||||
const PCB_LAYER_ID curr_layer_id = *seq;
|
const PCB_LAYER_ID layer = *seq;
|
||||||
|
|
||||||
if( !Is3dLayerEnabled( curr_layer_id ) )
|
if( !Is3dLayerEnabled( layer ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( aStatusReporter )
|
if( aStatusReporter )
|
||||||
{
|
aStatusReporter->Report( wxString::Format( _( "Build Tech layer %d" ), (int) layer ) );
|
||||||
aStatusReporter->Report( wxString::Format( _( "Build Tech layer %d" ),
|
|
||||||
(int) curr_layer_id ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
BVH_CONTAINER_2D *layerContainer = new BVH_CONTAINER_2D;
|
BVH_CONTAINER_2D *layerContainer = new BVH_CONTAINER_2D;
|
||||||
m_layerMap[curr_layer_id] = layerContainer;
|
m_layerMap[layer] = layerContainer;
|
||||||
|
|
||||||
SHAPE_POLY_SET *layerPoly = new SHAPE_POLY_SET;
|
SHAPE_POLY_SET *layerPoly = new SHAPE_POLY_SET;
|
||||||
m_layers_poly[curr_layer_id] = layerPoly;
|
m_layers_poly[layer] = layerPoly;
|
||||||
|
|
||||||
// Add drawing objects
|
// Add drawing objects
|
||||||
for( BOARD_ITEM* item : m_board->Drawings() )
|
for( BOARD_ITEM* item : m_board->Drawings() )
|
||||||
{
|
{
|
||||||
if( !item->IsOnLayer( curr_layer_id ) )
|
if( !item->IsOnLayer( layer ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
switch( item->Type() )
|
switch( item->Type() )
|
||||||
|
@ -961,22 +942,20 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||||
{
|
{
|
||||||
for( BOARD_ITEM* item : m_board->Drawings() )
|
for( BOARD_ITEM* item : m_board->Drawings() )
|
||||||
{
|
{
|
||||||
if( !item->IsOnLayer( curr_layer_id ) )
|
if( !item->IsOnLayer( layer ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
switch( item->Type() )
|
switch( item->Type() )
|
||||||
{
|
{
|
||||||
case PCB_SHAPE_T:
|
case PCB_SHAPE_T:
|
||||||
item->TransformShapeWithClearanceToPolygon( *layerPoly, curr_layer_id, 0,
|
item->TransformShapeToPolygon( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
|
||||||
ARC_HIGH_DEF, ERROR_INSIDE );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCB_TEXT_T:
|
case PCB_TEXT_T:
|
||||||
{
|
{
|
||||||
PCB_TEXT* text = static_cast<PCB_TEXT*>( item );
|
PCB_TEXT* text = static_cast<PCB_TEXT*>( item );
|
||||||
|
|
||||||
text->TransformTextShapeWithClearanceToPolygon( *layerPoly, curr_layer_id, 0,
|
text->TransformTextToPolySet( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
|
||||||
ARC_HIGH_DEF, ERROR_INSIDE );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -984,8 +963,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||||
{
|
{
|
||||||
PCB_TEXTBOX* textbox = static_cast<PCB_TEXTBOX*>( item );
|
PCB_TEXTBOX* textbox = static_cast<PCB_TEXTBOX*>( item );
|
||||||
|
|
||||||
textbox->TransformTextShapeWithClearanceToPolygon( *layerPoly, curr_layer_id, 0,
|
textbox->TransformTextToPolySet( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
|
||||||
ARC_HIGH_DEF, ERROR_INSIDE );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -998,13 +976,13 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||||
// Add footprints tech layers - objects
|
// Add footprints tech layers - objects
|
||||||
for( FOOTPRINT* footprint : m_board->Footprints() )
|
for( FOOTPRINT* footprint : m_board->Footprints() )
|
||||||
{
|
{
|
||||||
if( ( curr_layer_id == F_SilkS ) || ( curr_layer_id == B_SilkS ) )
|
if( layer == F_SilkS || layer == B_SilkS )
|
||||||
{
|
{
|
||||||
int linewidth = m_board->GetDesignSettings().m_LineThickness[ LAYER_CLASS_SILK ];
|
int linewidth = m_board->GetDesignSettings().m_LineThickness[ LAYER_CLASS_SILK ];
|
||||||
|
|
||||||
for( PAD* pad : footprint->Pads() )
|
for( PAD* pad : footprint->Pads() )
|
||||||
{
|
{
|
||||||
if( !pad->IsOnLayer( curr_layer_id ) )
|
if( !pad->IsOnLayer( layer ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
buildPadOutlineAsSegments( pad, layerContainer, linewidth );
|
buildPadOutlineAsSegments( pad, layerContainer, linewidth );
|
||||||
|
@ -1012,10 +990,10 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
addPads( footprint, layerContainer, curr_layer_id, false, false, false );
|
addPads( footprint, layerContainer, layer, false, false, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
addFootprintShapes( footprint, layerContainer, curr_layer_id );
|
addFootprintShapes( footprint, layerContainer, layer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1024,13 +1002,13 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||||
{
|
{
|
||||||
for( FOOTPRINT* footprint : m_board->Footprints() )
|
for( FOOTPRINT* footprint : m_board->Footprints() )
|
||||||
{
|
{
|
||||||
if( ( curr_layer_id == F_SilkS ) || ( curr_layer_id == B_SilkS ) )
|
if( layer == F_SilkS || layer == B_SilkS )
|
||||||
{
|
{
|
||||||
int linewidth = m_board->GetDesignSettings().m_LineThickness[ LAYER_CLASS_SILK ];
|
int linewidth = m_board->GetDesignSettings().m_LineThickness[ LAYER_CLASS_SILK ];
|
||||||
|
|
||||||
for( PAD* pad : footprint->Pads() )
|
for( PAD* pad : footprint->Pads() )
|
||||||
{
|
{
|
||||||
if( !pad->IsOnLayer( curr_layer_id ) )
|
if( !pad->IsOnLayer( layer ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
buildPadOutlineAsPolygon( pad, *layerPoly, linewidth );
|
buildPadOutlineAsPolygon( pad, *layerPoly, linewidth );
|
||||||
|
@ -1038,16 +1016,14 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
footprint->TransformPadsWithClearanceToPolygon( *layerPoly, curr_layer_id, 0,
|
footprint->TransformPadsToPolySet( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
|
||||||
ARC_HIGH_DEF, ERROR_INSIDE );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// On tech layers, use a poor circle approximation, only for texts (stroke font)
|
// On tech layers, use a poor circle approximation, only for texts (stroke font)
|
||||||
footprint->TransformFPTextWithClearanceToPolygonSet( *layerPoly, curr_layer_id, 0,
|
footprint->TransformFPTextToPolySet( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
|
||||||
ARC_HIGH_DEF, ERROR_INSIDE );
|
|
||||||
|
|
||||||
// Add the remaining things with dynamic seg count for circles
|
// Add the remaining things with dynamic seg count for circles
|
||||||
transformFPShapesToPolygon( footprint, curr_layer_id, *layerPoly );
|
transformFPShapesToPolySet( footprint, layer, *layerPoly );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1056,8 +1032,8 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||||
{
|
{
|
||||||
for( ZONE* zone : m_board->Zones() )
|
for( ZONE* zone : m_board->Zones() )
|
||||||
{
|
{
|
||||||
if( zone->IsOnLayer( curr_layer_id ) )
|
if( zone->IsOnLayer( layer ) )
|
||||||
addSolidAreasShapes( zone, layerContainer, curr_layer_id );
|
addSolidAreasShapes( zone, layerContainer, layer );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( buildVerticalWallsForTechLayers )
|
if( buildVerticalWallsForTechLayers )
|
||||||
|
@ -1065,8 +1041,8 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||||
for( ZONE* zone : m_board->Zones() )
|
for( ZONE* zone : m_board->Zones() )
|
||||||
{
|
{
|
||||||
|
|
||||||
if( zone->IsOnLayer( curr_layer_id ) )
|
if( zone->IsOnLayer( layer ) )
|
||||||
zone->TransformSolidAreasShapesToPolygon( curr_layer_id, *layerPoly );
|
zone->TransformSolidAreasShapesToPolygon( layer, *layerPoly );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||||
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -29,6 +29,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "board_adapter.h"
|
#include "board_adapter.h"
|
||||||
|
#include <board_design_settings.h>
|
||||||
#include <convert_basic_shapes_to_polygon.h>
|
#include <convert_basic_shapes_to_polygon.h>
|
||||||
#include <fp_shape.h>
|
#include <fp_shape.h>
|
||||||
#include <footprint.h>
|
#include <footprint.h>
|
||||||
|
@ -37,13 +38,15 @@
|
||||||
/*
|
/*
|
||||||
* This is used to draw pad outlines on silk layers.
|
* This is used to draw pad outlines on silk layers.
|
||||||
*/
|
*/
|
||||||
void BOARD_ADAPTER::buildPadOutlineAsPolygon( const PAD* aPad, SHAPE_POLY_SET& aCornerBuffer,
|
void BOARD_ADAPTER::buildPadOutlineAsPolygon( const PAD* aPad, SHAPE_POLY_SET& aBuffer,
|
||||||
int aWidth ) const
|
int aWidth ) const
|
||||||
{
|
{
|
||||||
|
int maxError = m_board->GetDesignSettings().m_MaxError;
|
||||||
|
|
||||||
if( aPad->GetShape() == PAD_SHAPE::CIRCLE ) // Draw a ring
|
if( aPad->GetShape() == PAD_SHAPE::CIRCLE ) // Draw a ring
|
||||||
{
|
{
|
||||||
TransformRingToPolygon( aCornerBuffer, aPad->ShapePos(), aPad->GetSize().x / 2, aWidth,
|
TransformRingToPolygon( aBuffer, aPad->ShapePos(), aPad->GetSize().x / 2, aWidth, maxError,
|
||||||
ARC_HIGH_DEF, ERROR_INSIDE );
|
ERROR_INSIDE );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,14 +59,16 @@ void BOARD_ADAPTER::buildPadOutlineAsPolygon( const PAD* aPad, SHAPE_POLY_SET& a
|
||||||
const VECTOR2I& a = path.CPoint( ii );
|
const VECTOR2I& a = path.CPoint( ii );
|
||||||
const VECTOR2I& b = path.CPoint( ii + 1 );
|
const VECTOR2I& b = path.CPoint( ii + 1 );
|
||||||
|
|
||||||
TransformOvalToPolygon( aCornerBuffer, a, b, aWidth, ARC_HIGH_DEF, ERROR_INSIDE );
|
TransformOvalToPolygon( aBuffer, a, b, aWidth, maxError, ERROR_INSIDE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BOARD_ADAPTER::transformFPShapesToPolygon( const FOOTPRINT* aFootprint, PCB_LAYER_ID aLayer,
|
void BOARD_ADAPTER::transformFPShapesToPolySet( const FOOTPRINT* aFootprint, PCB_LAYER_ID aLayer,
|
||||||
SHAPE_POLY_SET& aCornerBuffer ) const
|
SHAPE_POLY_SET& aBuffer ) const
|
||||||
{
|
{
|
||||||
|
int maxError = m_board->GetDesignSettings().m_MaxError;
|
||||||
|
|
||||||
for( BOARD_ITEM* item : aFootprint->GraphicalItems() )
|
for( BOARD_ITEM* item : aFootprint->GraphicalItems() )
|
||||||
{
|
{
|
||||||
if( item->Type() == PCB_FP_SHAPE_T )
|
if( item->Type() == PCB_FP_SHAPE_T )
|
||||||
|
@ -71,20 +76,14 @@ void BOARD_ADAPTER::transformFPShapesToPolygon( const FOOTPRINT* aFootprint, PCB
|
||||||
FP_SHAPE* shape = static_cast<FP_SHAPE*>( item );
|
FP_SHAPE* shape = static_cast<FP_SHAPE*>( item );
|
||||||
|
|
||||||
if( shape->GetLayer() == aLayer )
|
if( shape->GetLayer() == aLayer )
|
||||||
{
|
shape->TransformShapeToPolygon( aBuffer, aLayer, 0, maxError, ERROR_INSIDE );
|
||||||
shape->TransformShapeWithClearanceToPolygon( aCornerBuffer, aLayer, 0,
|
|
||||||
ARC_HIGH_DEF, ERROR_INSIDE );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if( BaseType( item->Type() ) == PCB_DIMENSION_T )
|
else if( BaseType( item->Type() ) == PCB_DIMENSION_T )
|
||||||
{
|
{
|
||||||
PCB_DIMENSION_BASE* dimension = static_cast<PCB_DIMENSION_BASE*>( item );
|
PCB_DIMENSION_BASE* dimension = static_cast<PCB_DIMENSION_BASE*>( item );
|
||||||
|
|
||||||
if( dimension->GetLayer() == aLayer )
|
if( dimension->GetLayer() == aLayer )
|
||||||
{
|
dimension->TransformShapeToPolygon( aBuffer, aLayer, 0, maxError, ERROR_INSIDE );
|
||||||
dimension->TransformShapeWithClearanceToPolygon( aCornerBuffer, aLayer, 0,
|
|
||||||
ARC_HIGH_DEF, ERROR_INSIDE );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -825,11 +825,10 @@ void RENDER_3D_OPENGL::generateViasAndPads()
|
||||||
if( !hasHole )
|
if( !hasHole )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
pad->TransformHoleWithClearanceToPolygon( tht_outer_holes_poly,
|
pad->TransformHoleToPolygon( tht_outer_holes_poly, platingThickness,
|
||||||
platingThickness,
|
ARC_HIGH_DEF, ERROR_INSIDE );
|
||||||
ARC_HIGH_DEF, ERROR_INSIDE );
|
pad->TransformHoleToPolygon( tht_inner_holes_poly, 0, ARC_HIGH_DEF,
|
||||||
pad->TransformHoleWithClearanceToPolygon( tht_inner_holes_poly, 0,
|
ERROR_INSIDE );
|
||||||
ARC_HIGH_DEF, ERROR_INSIDE );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1491,30 +1491,26 @@ int EDA_SHAPE::Compare( const EDA_SHAPE* aOther ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
void EDA_SHAPE::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, int aClearance, int aError,
|
||||||
int aClearanceValue,
|
ERROR_LOC aErrorLoc, bool ignoreLineWidth ) const
|
||||||
int aError, ERROR_LOC aErrorLoc,
|
|
||||||
bool ignoreLineWidth ) const
|
|
||||||
{
|
{
|
||||||
int width = ignoreLineWidth ? 0 : GetWidth();
|
int width = ignoreLineWidth ? 0 : GetWidth();
|
||||||
|
|
||||||
width += 2 * aClearanceValue;
|
width += 2 * aClearance;
|
||||||
|
|
||||||
switch( m_shape )
|
switch( m_shape )
|
||||||
{
|
{
|
||||||
case SHAPE_T::CIRCLE:
|
case SHAPE_T::CIRCLE:
|
||||||
|
{
|
||||||
|
int r = GetRadius();
|
||||||
|
|
||||||
if( IsFilled() )
|
if( IsFilled() )
|
||||||
{
|
TransformCircleToPolygon( aBuffer, getCenter(), r + width / 2, aError, aErrorLoc );
|
||||||
TransformCircleToPolygon( aCornerBuffer, getCenter(), GetRadius() + width / 2, aError,
|
|
||||||
aErrorLoc );
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
TransformRingToPolygon( aBuffer, getCenter(), r, width, aError, aErrorLoc );
|
||||||
TransformRingToPolygon( aCornerBuffer, getCenter(), GetRadius(), width, aError,
|
|
||||||
aErrorLoc );
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case SHAPE_T::RECT:
|
case SHAPE_T::RECT:
|
||||||
{
|
{
|
||||||
|
@ -1522,31 +1518,30 @@ void EDA_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf
|
||||||
|
|
||||||
if( IsFilled() || IsAnnotationProxy() )
|
if( IsFilled() || IsAnnotationProxy() )
|
||||||
{
|
{
|
||||||
aCornerBuffer.NewOutline();
|
aBuffer.NewOutline();
|
||||||
|
|
||||||
for( const VECTOR2I& pt : pts )
|
for( const VECTOR2I& pt : pts )
|
||||||
aCornerBuffer.Append( pt );
|
aBuffer.Append( pt );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( width > 0 || !IsFilled() )
|
if( width > 0 || !IsFilled() )
|
||||||
{
|
{
|
||||||
// Add in segments
|
// Add in segments
|
||||||
TransformOvalToPolygon( aCornerBuffer, pts[0], pts[1], width, aError, aErrorLoc );
|
TransformOvalToPolygon( aBuffer, pts[0], pts[1], width, aError, aErrorLoc );
|
||||||
TransformOvalToPolygon( aCornerBuffer, pts[1], pts[2], width, aError, aErrorLoc );
|
TransformOvalToPolygon( aBuffer, pts[1], pts[2], width, aError, aErrorLoc );
|
||||||
TransformOvalToPolygon( aCornerBuffer, pts[2], pts[3], width, aError, aErrorLoc );
|
TransformOvalToPolygon( aBuffer, pts[2], pts[3], width, aError, aErrorLoc );
|
||||||
TransformOvalToPolygon( aCornerBuffer, pts[3], pts[0], width, aError, aErrorLoc );
|
TransformOvalToPolygon( aBuffer, pts[3], pts[0], width, aError, aErrorLoc );
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case SHAPE_T::ARC:
|
case SHAPE_T::ARC:
|
||||||
TransformArcToPolygon( aCornerBuffer, GetStart(), GetArcMid(), GetEnd(), width, aError,
|
TransformArcToPolygon( aBuffer, GetStart(), GetArcMid(), GetEnd(), width, aError, aErrorLoc );
|
||||||
aErrorLoc );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SHAPE_T::SEGMENT:
|
case SHAPE_T::SEGMENT:
|
||||||
TransformOvalToPolygon( aCornerBuffer, GetStart(), GetEnd(), width, aError, aErrorLoc );
|
TransformOvalToPolygon( aBuffer, GetStart(), GetEnd(), width, aError, aErrorLoc );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SHAPE_T::POLY:
|
case SHAPE_T::POLY:
|
||||||
|
@ -1570,10 +1565,10 @@ void EDA_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf
|
||||||
|
|
||||||
if( IsFilled() )
|
if( IsFilled() )
|
||||||
{
|
{
|
||||||
aCornerBuffer.NewOutline();
|
aBuffer.NewOutline();
|
||||||
|
|
||||||
for( const VECTOR2I& point : poly )
|
for( const VECTOR2I& point : poly )
|
||||||
aCornerBuffer.Append( point.x, point.y );
|
aBuffer.Append( point.x, point.y );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( width > 0 || !IsFilled() )
|
if( width > 0 || !IsFilled() )
|
||||||
|
@ -1583,7 +1578,7 @@ void EDA_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf
|
||||||
for( const VECTOR2I& pt2 : poly )
|
for( const VECTOR2I& pt2 : poly )
|
||||||
{
|
{
|
||||||
if( pt2 != pt1 )
|
if( pt2 != pt1 )
|
||||||
TransformOvalToPolygon( aCornerBuffer, pt1, pt2, width, aError, aErrorLoc );
|
TransformOvalToPolygon( aBuffer, pt1, pt2, width, aError, aErrorLoc );
|
||||||
|
|
||||||
pt1 = pt2;
|
pt1 = pt2;
|
||||||
}
|
}
|
||||||
|
@ -1600,10 +1595,7 @@ void EDA_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf
|
||||||
converter.GetPoly( poly, GetWidth() );
|
converter.GetPoly( poly, GetWidth() );
|
||||||
|
|
||||||
for( unsigned ii = 1; ii < poly.size(); ii++ )
|
for( unsigned ii = 1; ii < poly.size(); ii++ )
|
||||||
{
|
TransformOvalToPolygon( aBuffer, poly[ii - 1], poly[ii], width, aError, aErrorLoc );
|
||||||
TransformOvalToPolygon( aCornerBuffer, poly[ii - 1], poly[ii], width, aError,
|
|
||||||
aErrorLoc );
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -936,22 +936,20 @@ int EDA_TEXT::Compare( const EDA_TEXT* aOther ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_TEXT::TransformBoundingBoxWithClearanceToPolygon( SHAPE_POLY_SET* aCornerBuffer,
|
void EDA_TEXT::TransformBoundingBoxToPolygon( SHAPE_POLY_SET* aBuffer, int aClearance ) const
|
||||||
int aClearanceValue ) const
|
|
||||||
{
|
{
|
||||||
if( GetText().Length() == 0 )
|
if( GetText().Length() == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
VECTOR2I corners[4]; // Buffer of polygon corners
|
VECTOR2I corners[4]; // Buffer of polygon corners
|
||||||
|
BOX2I rect = GetTextBox();
|
||||||
BOX2I rect = GetTextBox();
|
|
||||||
|
|
||||||
// TrueType bounding boxes aren't guaranteed to include all descenders, diacriticals, etc.
|
// TrueType bounding boxes aren't guaranteed to include all descenders, diacriticals, etc.
|
||||||
// Since we use this for zone knockouts and DRC, we need something more accurate.
|
// Since we use this for zone knockouts and DRC, we need something more accurate.
|
||||||
if( GetDrawFont()->IsOutline() )
|
if( GetDrawFont()->IsOutline() )
|
||||||
rect = GetEffectiveTextShape( false, false )->BBox();
|
rect = GetEffectiveTextShape( false, false )->BBox();
|
||||||
|
|
||||||
rect.Inflate( aClearanceValue );
|
rect.Inflate( aClearance );
|
||||||
|
|
||||||
corners[0].x = rect.GetOrigin().x;
|
corners[0].x = rect.GetOrigin().x;
|
||||||
corners[0].y = rect.GetOrigin().y;
|
corners[0].y = rect.GetOrigin().y;
|
||||||
|
@ -962,13 +960,13 @@ void EDA_TEXT::TransformBoundingBoxWithClearanceToPolygon( SHAPE_POLY_SET* aCorn
|
||||||
corners[3].y = corners[2].y;
|
corners[3].y = corners[2].y;
|
||||||
corners[3].x = corners[0].x;
|
corners[3].x = corners[0].x;
|
||||||
|
|
||||||
aCornerBuffer->NewOutline();
|
aBuffer->NewOutline();
|
||||||
|
|
||||||
for( VECTOR2I& corner : corners )
|
for( VECTOR2I& corner : corners )
|
||||||
{
|
{
|
||||||
RotatePoint( corner, GetDrawPos(), GetDrawRotation() );
|
RotatePoint( corner, GetDrawPos(), GetDrawRotation() );
|
||||||
|
|
||||||
aCornerBuffer->Append( corner.x, corner.y );
|
aBuffer->Append( corner.x, corner.y );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -297,21 +297,18 @@ public:
|
||||||
virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert the item shape to a closed polygon.
|
* Convert the item shape to a closed polygon. Circles and arcs are approximated by segments.
|
||||||
*
|
*
|
||||||
* Used in filling zones calculations. Circles and arcs are approximated by segments.
|
* @param aBuffer a buffer to store the polygon.
|
||||||
*
|
* @param aClearance the clearance around the pad.
|
||||||
* @param aCornerBuffer a buffer to store the polygon.
|
|
||||||
* @param aClearanceValue the clearance around the pad.
|
|
||||||
* @param aError the maximum deviation from true circle.
|
* @param aError the maximum deviation from true circle.
|
||||||
* @param aErrorLoc should the approximation error be placed outside or inside the polygon?
|
* @param aErrorLoc should the approximation error be placed outside or inside the polygon?
|
||||||
* @param ignoreLineWidth used for edge cut items where the line width is only
|
* @param ignoreLineWidth used for edge cut items where the line width is only
|
||||||
* for visualization.
|
* for visualization.
|
||||||
*/
|
*/
|
||||||
virtual void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
virtual void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer,
|
||||||
PCB_LAYER_ID aLayer, int aClearanceValue,
|
int aClearance, int aError, ERROR_LOC aErrorLoc,
|
||||||
int aError, ERROR_LOC aErrorLoc,
|
bool ignoreLineWidth = false ) const;
|
||||||
bool ignoreLineWidth = false ) const;
|
|
||||||
|
|
||||||
struct ptr_cmp
|
struct ptr_cmp
|
||||||
{
|
{
|
||||||
|
|
|
@ -297,20 +297,17 @@ public:
|
||||||
double GetLength() const;
|
double GetLength() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert the shape to a closed polygon.
|
* Convert the shape to a closed polygon. Circles and arcs are approximated by segments.
|
||||||
*
|
*
|
||||||
* Used in filling zones calculations. Circles and arcs are approximated by segments.
|
* @param aBuffer is a buffer to store the polygon.
|
||||||
*
|
* @param aClearance is the clearance around the pad.
|
||||||
* @param aCornerBuffer is a buffer to store the polygon.
|
|
||||||
* @param aClearanceValue is the clearance around the pad.
|
|
||||||
* @param aError is the maximum deviation from a true arc.
|
* @param aError is the maximum deviation from a true arc.
|
||||||
* @param aErrorLoc whether any approximation error shoule be placed inside or outside
|
* @param aErrorLoc whether any approximation error shoule be placed inside or outside
|
||||||
* @param ignoreLineWidth is used for edge cut items where the line width is only
|
* @param ignoreLineWidth is used for edge cut items where the line width is only for
|
||||||
* for visualization
|
* visualization
|
||||||
*/
|
*/
|
||||||
void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, int aClearanceValue,
|
void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, int aClearance, int aError,
|
||||||
int aError, ERROR_LOC aErrorLoc,
|
ERROR_LOC aErrorLoc, bool ignoreLineWidth = false ) const;
|
||||||
bool ignoreLineWidth ) const;
|
|
||||||
|
|
||||||
int Compare( const EDA_SHAPE* aOther ) const;
|
int Compare( const EDA_SHAPE* aOther ) const;
|
||||||
|
|
||||||
|
|
|
@ -225,12 +225,11 @@ public:
|
||||||
* Used in filling zones calculations
|
* Used in filling zones calculations
|
||||||
* Circles and arcs are approximated by segments
|
* Circles and arcs are approximated by segments
|
||||||
*
|
*
|
||||||
* @param aCornerBuffer a buffer to store the polygon.
|
* @param aBuffer a buffer to store the polygon.
|
||||||
* @param aClearanceValue the clearance around the text bounding box
|
* @param aClearance the clearance around the text bounding box
|
||||||
* to the real clearance value (usually near from 1.0).
|
* to the real clearance value (usually near from 1.0).
|
||||||
*/
|
*/
|
||||||
void TransformBoundingBoxWithClearanceToPolygon( SHAPE_POLY_SET* aCornerBuffer,
|
void TransformBoundingBoxToPolygon( SHAPE_POLY_SET* aBuffer, int aClearance ) const;
|
||||||
int aClearanceValue ) const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* build a list of segments (SHAPE_SEGMENT) to describe a text shape.
|
* build a list of segments (SHAPE_SEGMENT) to describe a text shape.
|
||||||
|
|
|
@ -66,7 +66,7 @@ int ConvertArcToPolyline( SHAPE_LINE_CHAIN& aPolyline, VECTOR2I aCenter, int aRa
|
||||||
/**
|
/**
|
||||||
* Convert a circle to a polygon, using multiple straight lines.
|
* Convert a circle to a polygon, using multiple straight lines.
|
||||||
*
|
*
|
||||||
* @param aCornerBuffer is a buffer to store the polygon.
|
* @param aBuffer is a buffer to store the polygon.
|
||||||
* @param aCenter is the center of the circle.
|
* @param aCenter is the center of the circle.
|
||||||
* @param aRadius is the radius of the circle.
|
* @param aRadius is the radius of the circle.
|
||||||
* @param aError is the internal units allowed for error approximation.
|
* @param aError is the internal units allowed for error approximation.
|
||||||
|
@ -74,13 +74,13 @@ int ConvertArcToPolyline( SHAPE_LINE_CHAIN& aPolyline, VECTOR2I aCenter, int aRa
|
||||||
* @param aMinSegCount is the min count of segments to approximate.
|
* @param aMinSegCount is the min count of segments to approximate.
|
||||||
* Default = 0 to do not force a min count.
|
* Default = 0 to do not force a min count.
|
||||||
*/
|
*/
|
||||||
void TransformCircleToPolygon( SHAPE_LINE_CHAIN& aCornerBuffer, const VECTOR2I& aCenter,
|
void TransformCircleToPolygon( SHAPE_LINE_CHAIN& aBuffer, const VECTOR2I& aCenter, int aRadius,
|
||||||
int aRadius, int aError, ERROR_LOC aErrorLoc, int aMinSegCount = 0 );
|
int aError, ERROR_LOC aErrorLoc, int aMinSegCount = 0 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a circle to a polygon, using multiple straight lines.
|
* Convert a circle to a polygon, using multiple straight lines.
|
||||||
*
|
*
|
||||||
* @param aCornerBuffer is a buffer to store the polygon.
|
* @param aBuffer is a buffer to store the polygon.
|
||||||
* @param aCenter is the center of the circle.
|
* @param aCenter is the center of the circle.
|
||||||
* @param aRadius is the radius of the circle.
|
* @param aRadius is the radius of the circle.
|
||||||
* @param aError is the internal units allowed for error in approximation.
|
* @param aError is the internal units allowed for error in approximation.
|
||||||
|
@ -88,7 +88,7 @@ void TransformCircleToPolygon( SHAPE_LINE_CHAIN& aCornerBuffer, const VECTOR2I&
|
||||||
* @param aMinSegCount is the min count of segments to approximate.
|
* @param aMinSegCount is the min count of segments to approximate.
|
||||||
* Default = 0 to do not force a min count.
|
* Default = 0 to do not force a min count.
|
||||||
*/
|
*/
|
||||||
void TransformCircleToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aCenter, int aRadius,
|
void TransformCircleToPolygon( SHAPE_POLY_SET& aBuffer, const VECTOR2I& aCenter, int aRadius,
|
||||||
int aError, ERROR_LOC aErrorLoc, int aMinSegCount = 0 );
|
int aError, ERROR_LOC aErrorLoc, int aMinSegCount = 0 );
|
||||||
|
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ void TransformCircleToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aC
|
||||||
* because multiple segments create a smaller area than the circle. The radius of the circle to
|
* because multiple segments create a smaller area than the circle. The radius of the circle to
|
||||||
* approximate must be bigger ( radius*aCorrectionFactor) to create segments outside the circle.
|
* approximate must be bigger ( radius*aCorrectionFactor) to create segments outside the circle.
|
||||||
*
|
*
|
||||||
* @param aCornerBuffer is a buffer to store the polygon.
|
* @param aBuffer is a buffer to store the polygon.
|
||||||
* @param aStart is the first point of the segment.
|
* @param aStart is the first point of the segment.
|
||||||
* @param aEnd is the second point of the segment.
|
* @param aEnd is the second point of the segment.
|
||||||
* @param aWidth is the width of the segment.
|
* @param aWidth is the width of the segment.
|
||||||
|
@ -109,16 +109,15 @@ void TransformCircleToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aC
|
||||||
* @param aMinSegCount is the min count of segments to approximate.
|
* @param aMinSegCount is the min count of segments to approximate.
|
||||||
* Default = 0 to do not force a min count.
|
* Default = 0 to do not force a min count.
|
||||||
*/
|
*/
|
||||||
void TransformOvalToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aStart,
|
void TransformOvalToPolygon( SHAPE_POLY_SET& aBuffer, const VECTOR2I& aStart, const VECTOR2I& aEnd,
|
||||||
const VECTOR2I& aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc,
|
int aWidth, int aError, ERROR_LOC aErrorLoc, int aMinSegCount = 0 );
|
||||||
int aMinSegCount = 0 );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a rectangle or trapezoid to a polygon.
|
* Convert a rectangle or trapezoid to a polygon.
|
||||||
*
|
*
|
||||||
* This will generate at least 16 segments per circle (when using inflate).
|
* This will generate at least 16 segments per circle (when using inflate).
|
||||||
*
|
*
|
||||||
* @param aCornerBuffer is a buffer to store the polygon.
|
* @param aBuffer is a buffer to store the polygon.
|
||||||
* @param aPosition is the coordinate of the center of the rectangle.
|
* @param aPosition is the coordinate of the center of the rectangle.
|
||||||
* @param aSize is the size of the rectangle.
|
* @param aSize is the size of the rectangle.
|
||||||
* @param aDeltaX is the delta for trapezoids in X direction
|
* @param aDeltaX is the delta for trapezoids in X direction
|
||||||
|
@ -127,7 +126,7 @@ void TransformOvalToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aSta
|
||||||
* @param aError is the IU allowed for error in approximation.
|
* @param aError is the IU allowed for error in approximation.
|
||||||
* @param aErrorLoc determines if the approximation error be placed outside or inside the polygon.
|
* @param aErrorLoc determines if the approximation error be placed outside or inside the polygon.
|
||||||
*/
|
*/
|
||||||
void TransformTrapezoidToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aPosition,
|
void TransformTrapezoidToPolygon( SHAPE_POLY_SET& aBuffer, const VECTOR2I& aPosition,
|
||||||
const VECTOR2I& aSize, const EDA_ANGLE& aRotation, int aDeltaX,
|
const VECTOR2I& aSize, const EDA_ANGLE& aRotation, int aDeltaX,
|
||||||
int aDeltaY, int aInflate, int aError, ERROR_LOC aErrorLoc );
|
int aDeltaY, int aInflate, int aError, ERROR_LOC aErrorLoc );
|
||||||
|
|
||||||
|
@ -137,7 +136,7 @@ void TransformTrapezoidToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I&
|
||||||
* Convert rounded corners arcs to multiple straight lines. This will generate at least
|
* Convert rounded corners arcs to multiple straight lines. This will generate at least
|
||||||
* 16 segments per circle.
|
* 16 segments per circle.
|
||||||
*
|
*
|
||||||
* @param aCornerBuffer is a buffer to store the polygon.
|
* @param aBuffer is a buffer to store the polygon.
|
||||||
* @param aPosition is the coordinate of the center of the rectangle.
|
* @param aPosition is the coordinate of the center of the rectangle.
|
||||||
* @param aSize is the size of the rectangle.
|
* @param aSize is the size of the rectangle.
|
||||||
* @param aCornerRadius is the radius of rounded corners (can be 0).
|
* @param aCornerRadius is the radius of rounded corners (can be 0).
|
||||||
|
@ -154,16 +153,16 @@ void TransformTrapezoidToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I&
|
||||||
* @param aError is the IU allowed for error in approximation.
|
* @param aError is the IU allowed for error in approximation.
|
||||||
* @param aErrorLoc determines if the approximation error be placed outside or inside the polygon.
|
* @param aErrorLoc determines if the approximation error be placed outside or inside the polygon.
|
||||||
*/
|
*/
|
||||||
void TransformRoundChamferedRectToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
void TransformRoundChamferedRectToPolygon( SHAPE_POLY_SET& aBuffer, const VECTOR2I& aPosition,
|
||||||
const VECTOR2I& aPosition, const VECTOR2I& aSize,
|
const VECTOR2I& aSize, const EDA_ANGLE& aRotation,
|
||||||
const EDA_ANGLE& aRotation, int aCornerRadius,
|
int aCornerRadius, double aChamferRatio,
|
||||||
double aChamferRatio, int aChamferCorners, int aInflate,
|
int aChamferCorners, int aInflate, int aError,
|
||||||
int aError, ERROR_LOC aErrorLoc );
|
ERROR_LOC aErrorLoc );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert arc to multiple straight segments.
|
* Convert arc to multiple straight segments.
|
||||||
*
|
*
|
||||||
* @param aCornerBuffer is a buffer to store the polygon.
|
* @param aBuffer is a buffer to store the polygon.
|
||||||
* @param aCentre is the center of the arc or circle.
|
* @param aCentre is the center of the arc or circle.
|
||||||
* @param aStart is the start point of the arc or a point on the circle.
|
* @param aStart is the start point of the arc or a point on the circle.
|
||||||
* @param aArcAngle is the arc angle in 0.1 degrees. For a circle, aArcAngle = 3600.
|
* @param aArcAngle is the arc angle in 0.1 degrees. For a circle, aArcAngle = 3600.
|
||||||
|
@ -171,21 +170,20 @@ void TransformRoundChamferedRectToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
||||||
* @param aError is the internal units allowed for error in approximation.
|
* @param aError is the internal units allowed for error in approximation.
|
||||||
* @param aErrorLoc determines if the approximation error be placed outside or inside the polygon.
|
* @param aErrorLoc determines if the approximation error be placed outside or inside the polygon.
|
||||||
*/
|
*/
|
||||||
void TransformArcToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aStart,
|
void TransformArcToPolygon( SHAPE_POLY_SET& aBuffer, const VECTOR2I& aStart, const VECTOR2I& aMid,
|
||||||
const VECTOR2I& aMid, const VECTOR2I& aEnd, int aWidth, int aError,
|
const VECTOR2I& aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc );
|
||||||
ERROR_LOC aErrorLoc );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert arcs to multiple straight segments.
|
* Convert arcs to multiple straight segments.
|
||||||
*
|
*
|
||||||
* @param aCornerBuffer is a buffer to store the polygon.
|
* @param aBuffer is a buffer to store the polygon.
|
||||||
* @param aCentre is the center of the arc or circle.
|
* @param aCentre is the center of the arc or circle.
|
||||||
* @param aRadius is the radius of the circle.
|
* @param aRadius is the radius of the circle.
|
||||||
* @param aWidth is the width (thickness) of the ring.
|
* @param aWidth is the width (thickness) of the ring.
|
||||||
* @param aError is the internal units allowed for error in approximation.
|
* @param aError is the internal units allowed for error in approximation.
|
||||||
* @param aErrorLoc determines if the approximation error be placed outside or inside the polygon.
|
* @param aErrorLoc determines if the approximation error be placed outside or inside the polygon.
|
||||||
*/
|
*/
|
||||||
void TransformRingToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aCentre, int aRadius,
|
void TransformRingToPolygon( SHAPE_POLY_SET& aBuffer, const VECTOR2I& aCentre, int aRadius,
|
||||||
int aWidth, int aError, ERROR_LOC aErrorLoc );
|
int aWidth, int aError, ERROR_LOC aErrorLoc );
|
||||||
|
|
||||||
#endif // CONVERT_BASIC_SHAPES_TO_POLYGON_H
|
#endif // CONVERT_BASIC_SHAPES_TO_POLYGON_H
|
||||||
|
|
|
@ -35,8 +35,8 @@
|
||||||
#include <trigo.h>
|
#include <trigo.h>
|
||||||
|
|
||||||
|
|
||||||
void TransformCircleToPolygon( SHAPE_LINE_CHAIN& aCornerBuffer, const VECTOR2I& aCenter,
|
void TransformCircleToPolygon( SHAPE_LINE_CHAIN& aBuffer, const VECTOR2I& aCenter, int aRadius,
|
||||||
int aRadius, int aError, ERROR_LOC aErrorLoc, int aMinSegCount )
|
int aError, ERROR_LOC aErrorLoc, int aMinSegCount )
|
||||||
{
|
{
|
||||||
VECTOR2I corner_position;
|
VECTOR2I corner_position;
|
||||||
int numSegs = GetArcToSegmentCount( aRadius, aError, FULL_CIRCLE );
|
int numSegs = GetArcToSegmentCount( aRadius, aError, FULL_CIRCLE );
|
||||||
|
@ -67,14 +67,14 @@ void TransformCircleToPolygon( SHAPE_LINE_CHAIN& aCornerBuffer, const VECTOR2I&
|
||||||
corner_position.y = 0;
|
corner_position.y = 0;
|
||||||
RotatePoint( corner_position, angle );
|
RotatePoint( corner_position, angle );
|
||||||
corner_position += aCenter;
|
corner_position += aCenter;
|
||||||
aCornerBuffer.Append( corner_position.x, corner_position.y );
|
aBuffer.Append( corner_position.x, corner_position.y );
|
||||||
}
|
}
|
||||||
|
|
||||||
aCornerBuffer.SetClosed( true );
|
aBuffer.SetClosed( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TransformCircleToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aCenter, int aRadius,
|
void TransformCircleToPolygon( SHAPE_POLY_SET& aBuffer, const VECTOR2I& aCenter, int aRadius,
|
||||||
int aError, ERROR_LOC aErrorLoc, int aMinSegCount )
|
int aError, ERROR_LOC aErrorLoc, int aMinSegCount )
|
||||||
{
|
{
|
||||||
VECTOR2I corner_position;
|
VECTOR2I corner_position;
|
||||||
|
@ -100,7 +100,7 @@ void TransformCircleToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aC
|
||||||
radius += GetCircleToPolyCorrection( actual_delta_radius );
|
radius += GetCircleToPolyCorrection( actual_delta_radius );
|
||||||
}
|
}
|
||||||
|
|
||||||
aCornerBuffer.NewOutline();
|
aBuffer.NewOutline();
|
||||||
|
|
||||||
for( EDA_ANGLE angle = ANGLE_0; angle < ANGLE_360; angle += delta )
|
for( EDA_ANGLE angle = ANGLE_0; angle < ANGLE_360; angle += delta )
|
||||||
{
|
{
|
||||||
|
@ -108,20 +108,19 @@ void TransformCircleToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aC
|
||||||
corner_position.y = 0;
|
corner_position.y = 0;
|
||||||
RotatePoint( corner_position, angle );
|
RotatePoint( corner_position, angle );
|
||||||
corner_position += aCenter;
|
corner_position += aCenter;
|
||||||
aCornerBuffer.Append( corner_position.x, corner_position.y );
|
aBuffer.Append( corner_position.x, corner_position.y );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Finish circle
|
// Finish circle
|
||||||
corner_position.x = radius;
|
corner_position.x = radius;
|
||||||
corner_position.y = 0;
|
corner_position.y = 0;
|
||||||
corner_position += aCenter;
|
corner_position += aCenter;
|
||||||
aCornerBuffer.Append( corner_position.x, corner_position.y );
|
aBuffer.Append( corner_position.x, corner_position.y );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TransformOvalToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aStart,
|
void TransformOvalToPolygon( SHAPE_POLY_SET& aBuffer, const VECTOR2I& aStart, const VECTOR2I& aEnd,
|
||||||
const VECTOR2I& aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc,
|
int aWidth, int aError, ERROR_LOC aErrorLoc, int aMinSegCount )
|
||||||
int aMinSegCount )
|
|
||||||
{
|
{
|
||||||
// To build the polygonal shape outside the actual shape, we use a bigger
|
// To build the polygonal shape outside the actual shape, we use a bigger
|
||||||
// radius to build rounded ends.
|
// radius to build rounded ends.
|
||||||
|
@ -219,7 +218,7 @@ void TransformOvalToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aSta
|
||||||
polyshape.Rotate( -delta_angle );
|
polyshape.Rotate( -delta_angle );
|
||||||
polyshape.Move( startp );
|
polyshape.Move( startp );
|
||||||
|
|
||||||
aCornerBuffer.Append( polyshape);
|
aBuffer.Append( polyshape);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -373,7 +372,7 @@ void CornerListRemoveDuplicates( std::vector<ROUNDED_CORNER>& aCorners )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TransformTrapezoidToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aPosition,
|
void TransformTrapezoidToPolygon( SHAPE_POLY_SET& aBuffer, const VECTOR2I& aPosition,
|
||||||
const VECTOR2I& aSize, const EDA_ANGLE& aRotation, int aDeltaX,
|
const VECTOR2I& aSize, const EDA_ANGLE& aRotation, int aDeltaX,
|
||||||
int aDeltaY, int aInflate, int aError, ERROR_LOC aErrorLoc )
|
int aDeltaY, int aInflate, int aError, ERROR_LOC aErrorLoc )
|
||||||
{
|
{
|
||||||
|
@ -442,11 +441,11 @@ void TransformTrapezoidToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I&
|
||||||
outline.Rotate( aRotation );
|
outline.Rotate( aRotation );
|
||||||
|
|
||||||
outline.Move( VECTOR2I( aPosition ) );
|
outline.Move( VECTOR2I( aPosition ) );
|
||||||
aCornerBuffer.Append( outline );
|
aBuffer.Append( outline );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TransformRoundChamferedRectToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aPosition,
|
void TransformRoundChamferedRectToPolygon( SHAPE_POLY_SET& aBuffer, const VECTOR2I& aPosition,
|
||||||
const VECTOR2I& aSize, const EDA_ANGLE& aRotation,
|
const VECTOR2I& aSize, const EDA_ANGLE& aRotation,
|
||||||
int aCornerRadius, double aChamferRatio,
|
int aCornerRadius, double aChamferRatio,
|
||||||
int aChamferCorners, int aInflate, int aError,
|
int aChamferCorners, int aInflate, int aError,
|
||||||
|
@ -509,7 +508,7 @@ void TransformRoundChamferedRectToPolygon( SHAPE_POLY_SET& aCornerBuffer, const
|
||||||
outline.Rotate( aRotation );
|
outline.Rotate( aRotation );
|
||||||
|
|
||||||
outline.Move( aPosition );
|
outline.Move( aPosition );
|
||||||
aCornerBuffer.Append( outline );
|
aBuffer.Append( outline );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -574,9 +573,8 @@ int ConvertArcToPolyline( SHAPE_LINE_CHAIN& aPolyline, VECTOR2I aCenter, int aRa
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TransformArcToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aStart,
|
void TransformArcToPolygon( SHAPE_POLY_SET& aBuffer, const VECTOR2I& aStart, const VECTOR2I& aMid,
|
||||||
const VECTOR2I& aMid, const VECTOR2I& aEnd, int aWidth,
|
const VECTOR2I& aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc )
|
||||||
int aError, ERROR_LOC aErrorLoc )
|
|
||||||
{
|
{
|
||||||
SEG startToEnd( aStart, aEnd );
|
SEG startToEnd( aStart, aEnd );
|
||||||
int distanceToMid = startToEnd.Distance( aMid );
|
int distanceToMid = startToEnd.Distance( aMid );
|
||||||
|
@ -584,8 +582,7 @@ void TransformArcToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aStar
|
||||||
if( distanceToMid <= 1 )
|
if( distanceToMid <= 1 )
|
||||||
{
|
{
|
||||||
// Not an arc but essentially a straight line with a small error
|
// Not an arc but essentially a straight line with a small error
|
||||||
TransformOvalToPolygon( aCornerBuffer, aStart, aEnd, aWidth + distanceToMid, aError,
|
TransformOvalToPolygon( aBuffer, aStart, aEnd, aWidth + distanceToMid, aError, aErrorLoc );
|
||||||
aErrorLoc );
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -635,11 +632,11 @@ void TransformArcToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aStar
|
||||||
-arc_angle, aError, errorLocInner );
|
-arc_angle, aError, errorLocInner );
|
||||||
}
|
}
|
||||||
|
|
||||||
aCornerBuffer.Append( polyshape );
|
aBuffer.Append( polyshape );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TransformRingToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aCentre, int aRadius,
|
void TransformRingToPolygon( SHAPE_POLY_SET& aBuffer, const VECTOR2I& aCentre, int aRadius,
|
||||||
int aWidth, int aError, ERROR_LOC aErrorLoc )
|
int aWidth, int aError, ERROR_LOC aErrorLoc )
|
||||||
{
|
{
|
||||||
int inner_radius = aRadius - ( aWidth / 2 );
|
int inner_radius = aRadius - ( aWidth / 2 );
|
||||||
|
@ -648,8 +645,7 @@ void TransformRingToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aCen
|
||||||
if( inner_radius <= 0 )
|
if( inner_radius <= 0 )
|
||||||
{
|
{
|
||||||
//In this case, the ring is just a circle (no hole inside)
|
//In this case, the ring is just a circle (no hole inside)
|
||||||
TransformCircleToPolygon( aCornerBuffer, aCentre, aRadius + ( aWidth / 2 ), aError,
|
TransformCircleToPolygon( aBuffer, aCentre, aRadius + ( aWidth / 2 ), aError, aErrorLoc );
|
||||||
aErrorLoc );
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -665,5 +661,5 @@ void TransformRingToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aCen
|
||||||
aError, inner_err_loc );
|
aError, inner_err_loc );
|
||||||
|
|
||||||
buffer.Fracture( SHAPE_POLY_SET::PM_FAST );
|
buffer.Fracture( SHAPE_POLY_SET::PM_FAST );
|
||||||
aCornerBuffer.Append( buffer );
|
aBuffer.Append( buffer );
|
||||||
}
|
}
|
||||||
|
|
|
@ -2202,22 +2202,19 @@ void BOARD::ConvertBrdLayerToPolygonalContours( PCB_LAYER_ID aLayer,
|
||||||
if( !track->IsOnLayer( aLayer ) )
|
if( !track->IsOnLayer( aLayer ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
track->TransformShapeWithClearanceToPolygon( aOutlines, aLayer, 0, maxError,
|
track->TransformShapeToPolygon( aOutlines, aLayer, 0, maxError, ERROR_INSIDE );
|
||||||
ERROR_INSIDE );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert pads and other copper items in footprints
|
// convert pads and other copper items in footprints
|
||||||
for( const FOOTPRINT* footprint : m_footprints )
|
for( const FOOTPRINT* footprint : m_footprints )
|
||||||
{
|
{
|
||||||
footprint->TransformPadsWithClearanceToPolygon( aOutlines, aLayer, 0, maxError,
|
footprint->TransformPadsToPolySet( aOutlines, aLayer, 0, maxError, ERROR_INSIDE );
|
||||||
ERROR_INSIDE );
|
|
||||||
|
|
||||||
// Microwave footprints may have items on copper layers
|
// Microwave footprints may have items on copper layers
|
||||||
footprint->TransformFPShapesWithClearanceToPolygon( aOutlines, aLayer, 0, maxError,
|
footprint->TransformFPShapesToPolySet( aOutlines, aLayer, 0, maxError, ERROR_INSIDE,
|
||||||
ERROR_INSIDE,
|
true, /* include text */
|
||||||
true, /* include text */
|
true, /* include shapes */
|
||||||
true, /* include shapes */
|
false /* include private items */ );
|
||||||
false /* include private items */ );
|
|
||||||
|
|
||||||
for( const ZONE* zone : footprint->Zones() )
|
for( const ZONE* zone : footprint->Zones() )
|
||||||
{
|
{
|
||||||
|
@ -2244,16 +2241,14 @@ void BOARD::ConvertBrdLayerToPolygonalContours( PCB_LAYER_ID aLayer,
|
||||||
case PCB_SHAPE_T:
|
case PCB_SHAPE_T:
|
||||||
{
|
{
|
||||||
const PCB_SHAPE* shape = static_cast<const PCB_SHAPE*>( item );
|
const PCB_SHAPE* shape = static_cast<const PCB_SHAPE*>( item );
|
||||||
shape->TransformShapeWithClearanceToPolygon( aOutlines, aLayer, 0, maxError,
|
shape->TransformShapeToPolygon( aOutlines, aLayer, 0, maxError, ERROR_INSIDE );
|
||||||
ERROR_INSIDE );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case PCB_TEXT_T:
|
case PCB_TEXT_T:
|
||||||
{
|
{
|
||||||
const PCB_TEXT* text = static_cast<const PCB_TEXT*>( item );
|
const PCB_TEXT* text = static_cast<const PCB_TEXT*>( item );
|
||||||
text->TransformTextShapeWithClearanceToPolygon( aOutlines, aLayer, 0, maxError,
|
text->TransformTextToPolySet( aOutlines, aLayer, 0, maxError, ERROR_INSIDE );
|
||||||
ERROR_INSIDE );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2262,11 +2257,10 @@ void BOARD::ConvertBrdLayerToPolygonalContours( PCB_LAYER_ID aLayer,
|
||||||
const PCB_TEXTBOX* textbox = static_cast<const PCB_TEXTBOX*>( item );
|
const PCB_TEXTBOX* textbox = static_cast<const PCB_TEXTBOX*>( item );
|
||||||
|
|
||||||
// plot border
|
// plot border
|
||||||
textbox->PCB_SHAPE::TransformShapeWithClearanceToPolygon( aOutlines, aLayer, 0,
|
textbox->PCB_SHAPE::TransformShapeToPolygon( aOutlines, aLayer, 0, maxError,
|
||||||
maxError, ERROR_INSIDE );
|
ERROR_INSIDE );
|
||||||
// plot text
|
// plot text
|
||||||
textbox->TransformTextShapeWithClearanceToPolygon( aOutlines, aLayer, 0, maxError,
|
textbox->TransformTextToPolySet( aOutlines, aLayer, 0, maxError, ERROR_INSIDE );
|
||||||
ERROR_INSIDE );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -169,13 +169,11 @@ BOARD_ITEM* BOARD_ITEM::Duplicate() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BOARD_ITEM::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
void BOARD_ITEM::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer,
|
||||||
PCB_LAYER_ID aLayer, int aClearanceValue,
|
int aClearance, int aError, ERROR_LOC aErrorLoc,
|
||||||
int aError, ERROR_LOC aErrorLoc,
|
bool ignoreLineWidth ) const
|
||||||
bool ignoreLineWidth ) const
|
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( false, wxT( "Called TransformShapeWithClearanceToPolygon() on unsupported "
|
wxASSERT_MSG( false, wxT( "Called TransformShapeToPolygon() on unsupported BOARD_ITEM." ) );
|
||||||
"BOARD_ITEM." ) );
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1269,8 +1269,8 @@ bool DIALOG_PAD_PROPERTIES::padValuesOK()
|
||||||
int maxError = m_board->GetDesignSettings().m_MaxError;
|
int maxError = m_board->GetDesignSettings().m_MaxError;
|
||||||
SHAPE_POLY_SET padOutline;
|
SHAPE_POLY_SET padOutline;
|
||||||
|
|
||||||
m_dummyPad->TransformShapeWithClearanceToPolygon( padOutline, UNDEFINED_LAYER, 0,
|
m_dummyPad->TransformShapeToPolygon( padOutline, UNDEFINED_LAYER, 0, maxError,
|
||||||
maxError, ERROR_INSIDE );
|
ERROR_INSIDE );
|
||||||
|
|
||||||
if( !padOutline.Collide( m_dummyPad->GetPosition() ) )
|
if( !padOutline.Collide( m_dummyPad->GetPosition() ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -188,8 +188,8 @@ bool DRC_TEST_PROVIDER_ANNULAR_WIDTH::Run()
|
||||||
// Slow (but general purpose) method.
|
// Slow (but general purpose) method.
|
||||||
SHAPE_POLY_SET padOutline;
|
SHAPE_POLY_SET padOutline;
|
||||||
|
|
||||||
pad->TransformShapeWithClearanceToPolygon( padOutline, UNDEFINED_LAYER, 0,
|
pad->TransformShapeToPolygon( padOutline, UNDEFINED_LAYER, 0, maxError,
|
||||||
maxError, ERROR_INSIDE );
|
ERROR_INSIDE );
|
||||||
|
|
||||||
if( !padOutline.Collide( pad->GetPosition() ) )
|
if( !padOutline.Collide( pad->GetPosition() ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -679,8 +679,8 @@ bool DRC_TEST_PROVIDER_CONNECTION_WIDTH::Run()
|
||||||
|
|
||||||
for( BOARD_ITEM* item : itemsPoly.Items )
|
for( BOARD_ITEM* item : itemsPoly.Items )
|
||||||
{
|
{
|
||||||
item->TransformShapeWithClearanceToPolygon( itemsPoly.Poly, aLayer, 0,
|
item->TransformShapeToPolygon( itemsPoly.Poly, aLayer, 0, ARC_HIGH_DEF,
|
||||||
ARC_HIGH_DEF, ERROR_OUTSIDE );
|
ERROR_OUTSIDE );
|
||||||
}
|
}
|
||||||
|
|
||||||
itemsPoly.Poly.Fracture( SHAPE_POLY_SET::PM_FAST );
|
itemsPoly.Poly.Fracture( SHAPE_POLY_SET::PM_FAST );
|
||||||
|
|
|
@ -144,9 +144,8 @@ bool DRC_TEST_PROVIDER_SLIVER_CHECKER::Run()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
item->TransformShapeWithClearanceToPolygon( poly, layer, 0,
|
item->TransformShapeToPolygon( poly, layer, 0, ARC_LOW_DEF,
|
||||||
ARC_LOW_DEF,
|
ERROR_OUTSIDE );
|
||||||
ERROR_OUTSIDE );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_drcEngine->IsCancelled() )
|
if( m_drcEngine->IsCancelled() )
|
||||||
|
|
|
@ -135,8 +135,8 @@ void DRC_TEST_PROVIDER_SOLDER_MASK::addItemToRTrees( BOARD_ITEM* aItem )
|
||||||
PAD* pad = static_cast<PAD*>( aItem );
|
PAD* pad = static_cast<PAD*>( aItem );
|
||||||
int clearance = ( m_webWidth / 2 ) + pad->GetSolderMaskExpansion();
|
int clearance = ( m_webWidth / 2 ) + pad->GetSolderMaskExpansion();
|
||||||
|
|
||||||
aItem->TransformShapeWithClearanceToPolygon( *solderMask->GetFill( layer ), layer,
|
aItem->TransformShapeToPolygon( *solderMask->GetFill( layer ), layer, clearance,
|
||||||
clearance, m_maxError, ERROR_OUTSIDE );
|
m_maxError, ERROR_OUTSIDE );
|
||||||
|
|
||||||
m_itemTree->Insert( aItem, layer, m_largestClearance );
|
m_itemTree->Insert( aItem, layer, m_largestClearance );
|
||||||
}
|
}
|
||||||
|
@ -151,8 +151,8 @@ void DRC_TEST_PROVIDER_SOLDER_MASK::addItemToRTrees( BOARD_ITEM* aItem )
|
||||||
PCB_VIA* via = static_cast<PCB_VIA*>( aItem );
|
PCB_VIA* via = static_cast<PCB_VIA*>( aItem );
|
||||||
int clearance = ( m_webWidth / 2 ) + via->GetSolderMaskExpansion();
|
int clearance = ( m_webWidth / 2 ) + via->GetSolderMaskExpansion();
|
||||||
|
|
||||||
via->TransformShapeWithClearanceToPolygon( *solderMask->GetFill( layer ), layer,
|
via->TransformShapeToPolygon( *solderMask->GetFill( layer ), layer, clearance,
|
||||||
clearance, m_maxError, ERROR_OUTSIDE );
|
m_maxError, ERROR_OUTSIDE );
|
||||||
|
|
||||||
m_itemTree->Insert( aItem, layer, m_largestClearance );
|
m_itemTree->Insert( aItem, layer, m_largestClearance );
|
||||||
}
|
}
|
||||||
|
@ -164,9 +164,8 @@ void DRC_TEST_PROVIDER_SOLDER_MASK::addItemToRTrees( BOARD_ITEM* aItem )
|
||||||
{
|
{
|
||||||
if( aItem->IsOnLayer( layer ) )
|
if( aItem->IsOnLayer( layer ) )
|
||||||
{
|
{
|
||||||
aItem->TransformShapeWithClearanceToPolygon( *solderMask->GetFill( layer ),
|
aItem->TransformShapeToPolygon( *solderMask->GetFill( layer ), layer,
|
||||||
layer, m_webWidth / 2, m_maxError,
|
m_webWidth / 2, m_maxError, ERROR_OUTSIDE );
|
||||||
ERROR_OUTSIDE );
|
|
||||||
|
|
||||||
m_itemTree->Insert( aItem, layer, m_largestClearance );
|
m_itemTree->Insert( aItem, layer, m_largestClearance );
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,8 +125,7 @@ void DRC_TEST_PROVIDER_ZONE_CONNECTIONS::testZoneLayer( ZONE* aZone, PCB_LAYER_I
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
SHAPE_POLY_SET padPoly;
|
SHAPE_POLY_SET padPoly;
|
||||||
pad->TransformShapeWithClearanceToPolygon( padPoly, aLayer, 0, ARC_LOW_DEF,
|
pad->TransformShapeToPolygon( padPoly, aLayer, 0, ARC_LOW_DEF, ERROR_OUTSIDE );
|
||||||
ERROR_OUTSIDE );
|
|
||||||
|
|
||||||
SHAPE_LINE_CHAIN& padOutline = padPoly.Outline( 0 );
|
SHAPE_LINE_CHAIN& padOutline = padPoly.Outline( 0 );
|
||||||
BOX2I padBBox( item_bbox );
|
BOX2I padBBox( item_bbox );
|
||||||
|
|
|
@ -934,8 +934,8 @@ SHAPE_POLY_SET FOOTPRINT::GetBoundingHull() const
|
||||||
|
|
||||||
if( item->Type() != PCB_FP_TEXT_T && item->Type() != PCB_BITMAP_T )
|
if( item->Type() != PCB_FP_TEXT_T && item->Type() != PCB_BITMAP_T )
|
||||||
{
|
{
|
||||||
item->TransformShapeWithClearanceToPolygon( rawPolys, UNDEFINED_LAYER, 0, ARC_LOW_DEF,
|
item->TransformShapeToPolygon( rawPolys, UNDEFINED_LAYER, 0, ARC_LOW_DEF,
|
||||||
ERROR_OUTSIDE );
|
ERROR_OUTSIDE );
|
||||||
}
|
}
|
||||||
|
|
||||||
// We intentionally exclude footprint text from the bounding hull.
|
// We intentionally exclude footprint text from the bounding hull.
|
||||||
|
@ -943,10 +943,9 @@ SHAPE_POLY_SET FOOTPRINT::GetBoundingHull() const
|
||||||
|
|
||||||
for( PAD* pad : m_pads )
|
for( PAD* pad : m_pads )
|
||||||
{
|
{
|
||||||
pad->TransformShapeWithClearanceToPolygon( rawPolys, UNDEFINED_LAYER, 0, ARC_LOW_DEF,
|
pad->TransformShapeToPolygon( rawPolys, UNDEFINED_LAYER, 0, ARC_LOW_DEF, ERROR_OUTSIDE );
|
||||||
ERROR_OUTSIDE );
|
|
||||||
// In case hole is larger than pad
|
// In case hole is larger than pad
|
||||||
pad->TransformHoleWithClearanceToPolygon( rawPolys, 0, ARC_LOW_DEF, ERROR_OUTSIDE );
|
pad->TransformHoleToPolygon( rawPolys, 0, ARC_LOW_DEF, ERROR_OUTSIDE );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( FP_ZONE* zone : m_fp_zones )
|
for( FP_ZONE* zone : m_fp_zones )
|
||||||
|
@ -2023,15 +2022,13 @@ double FOOTPRINT::GetCoverageArea( const BOARD_ITEM* aItem, const GENERAL_COLLEC
|
||||||
{
|
{
|
||||||
const FP_TEXT* text = static_cast<const FP_TEXT*>( aItem );
|
const FP_TEXT* text = static_cast<const FP_TEXT*>( aItem );
|
||||||
|
|
||||||
text->TransformTextShapeWithClearanceToPolygon( poly, UNDEFINED_LAYER, textMargin,
|
text->TransformTextToPolySet( poly, UNDEFINED_LAYER, textMargin, ARC_LOW_DEF, ERROR_OUTSIDE );
|
||||||
ARC_LOW_DEF, ERROR_OUTSIDE );
|
|
||||||
}
|
}
|
||||||
else if( aItem->Type() == PCB_FP_TEXTBOX_T )
|
else if( aItem->Type() == PCB_FP_TEXTBOX_T )
|
||||||
{
|
{
|
||||||
const FP_TEXTBOX* textbox = static_cast<const FP_TEXTBOX*>( aItem );
|
const FP_TEXTBOX* tb = static_cast<const FP_TEXTBOX*>( aItem );
|
||||||
|
|
||||||
textbox->TransformTextShapeWithClearanceToPolygon( poly, UNDEFINED_LAYER, textMargin,
|
tb->TransformTextToPolySet( poly, UNDEFINED_LAYER, textMargin, ARC_LOW_DEF, ERROR_OUTSIDE );
|
||||||
ARC_LOW_DEF, ERROR_OUTSIDE );
|
|
||||||
}
|
}
|
||||||
else if( aItem->Type() == PCB_SHAPE_T )
|
else if( aItem->Type() == PCB_SHAPE_T )
|
||||||
{
|
{
|
||||||
|
@ -2059,8 +2056,7 @@ double FOOTPRINT::GetCoverageArea( const BOARD_ITEM* aItem, const GENERAL_COLLEC
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
shape->TransformShapeWithClearanceToPolygon( poly, UNDEFINED_LAYER, 0,
|
shape->TransformShapeToPolygon( poly, UNDEFINED_LAYER, 0, ARC_LOW_DEF, ERROR_OUTSIDE );
|
||||||
ARC_LOW_DEF, ERROR_OUTSIDE );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( aItem->Type() == PCB_TRACE_T || aItem->Type() == PCB_ARC_T )
|
else if( aItem->Type() == PCB_TRACE_T || aItem->Type() == PCB_ARC_T )
|
||||||
|
@ -2070,8 +2066,7 @@ double FOOTPRINT::GetCoverageArea( const BOARD_ITEM* aItem, const GENERAL_COLLEC
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
aItem->TransformShapeWithClearanceToPolygon( poly, UNDEFINED_LAYER, 0,
|
aItem->TransformShapeToPolygon( poly, UNDEFINED_LAYER, 0, ARC_LOW_DEF, ERROR_OUTSIDE );
|
||||||
ARC_LOW_DEF, ERROR_OUTSIDE );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return polygonArea( poly );
|
return polygonArea( poly );
|
||||||
|
@ -2085,14 +2080,13 @@ double FOOTPRINT::CoverageRatio( const GENERAL_COLLECTOR& aCollector ) const
|
||||||
SHAPE_POLY_SET footprintRegion( GetBoundingHull() );
|
SHAPE_POLY_SET footprintRegion( GetBoundingHull() );
|
||||||
SHAPE_POLY_SET coveredRegion;
|
SHAPE_POLY_SET coveredRegion;
|
||||||
|
|
||||||
TransformPadsWithClearanceToPolygon( coveredRegion, UNDEFINED_LAYER, 0, ARC_LOW_DEF,
|
TransformPadsToPolySet( coveredRegion, UNDEFINED_LAYER, 0, ARC_LOW_DEF, ERROR_OUTSIDE );
|
||||||
ERROR_OUTSIDE );
|
|
||||||
|
|
||||||
TransformFPShapesWithClearanceToPolygon( coveredRegion, UNDEFINED_LAYER, textMargin,
|
TransformFPShapesToPolySet( coveredRegion, UNDEFINED_LAYER, textMargin, ARC_LOW_DEF,
|
||||||
ARC_LOW_DEF, ERROR_OUTSIDE,
|
ERROR_OUTSIDE,
|
||||||
true, /* include text */
|
true, /* include text */
|
||||||
false, /* include shapes */
|
false, /* include shapes */
|
||||||
false /* include private items */ );
|
false /* include private items */ );
|
||||||
|
|
||||||
for( int i = 0; i < aCollector.GetCount(); ++i )
|
for( int i = 0; i < aCollector.GetCount(); ++i )
|
||||||
{
|
{
|
||||||
|
@ -2105,8 +2099,8 @@ double FOOTPRINT::CoverageRatio( const GENERAL_COLLECTOR& aCollector ) const
|
||||||
case PCB_FP_SHAPE_T:
|
case PCB_FP_SHAPE_T:
|
||||||
if( item->GetParent() != this )
|
if( item->GetParent() != this )
|
||||||
{
|
{
|
||||||
item->TransformShapeWithClearanceToPolygon( coveredRegion, UNDEFINED_LAYER, 0,
|
item->TransformShapeToPolygon( coveredRegion, UNDEFINED_LAYER, 0, ARC_LOW_DEF,
|
||||||
ARC_LOW_DEF, ERROR_OUTSIDE );
|
ERROR_OUTSIDE );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -2116,8 +2110,8 @@ double FOOTPRINT::CoverageRatio( const GENERAL_COLLECTOR& aCollector ) const
|
||||||
case PCB_TRACE_T:
|
case PCB_TRACE_T:
|
||||||
case PCB_ARC_T:
|
case PCB_ARC_T:
|
||||||
case PCB_VIA_T:
|
case PCB_VIA_T:
|
||||||
item->TransformShapeWithClearanceToPolygon( coveredRegion, UNDEFINED_LAYER, 0,
|
item->TransformShapeToPolygon( coveredRegion, UNDEFINED_LAYER, 0, ARC_LOW_DEF,
|
||||||
ARC_LOW_DEF, ERROR_OUTSIDE );
|
ERROR_OUTSIDE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCB_FOOTPRINT_T:
|
case PCB_FOOTPRINT_T:
|
||||||
|
@ -2345,14 +2339,13 @@ void FOOTPRINT::CheckPads( const std::function<void( const PAD*, int,
|
||||||
PCB_LAYER_ID layer = lset.Seq().at( 0 );
|
PCB_LAYER_ID layer = lset.Seq().at( 0 );
|
||||||
SHAPE_POLY_SET padOutline;
|
SHAPE_POLY_SET padOutline;
|
||||||
|
|
||||||
pad->TransformShapeWithClearanceToPolygon( padOutline, layer, 0, ARC_HIGH_DEF,
|
pad->TransformShapeToPolygon( padOutline, layer, 0, ARC_HIGH_DEF, ERROR_INSIDE );
|
||||||
ERROR_LOC::ERROR_INSIDE );
|
|
||||||
|
|
||||||
std::shared_ptr<SHAPE_SEGMENT> hole = pad->GetEffectiveHoleShape();
|
std::shared_ptr<SHAPE_SEGMENT> hole = pad->GetEffectiveHoleShape();
|
||||||
SHAPE_POLY_SET holeOutline;
|
SHAPE_POLY_SET holeOutline;
|
||||||
|
|
||||||
TransformOvalToPolygon( holeOutline, hole->GetSeg().A, hole->GetSeg().B,
|
TransformOvalToPolygon( holeOutline, hole->GetSeg().A, hole->GetSeg().B,
|
||||||
hole->GetWidth(), ARC_HIGH_DEF, ERROR_LOC::ERROR_INSIDE );
|
hole->GetWidth(), ARC_HIGH_DEF, ERROR_INSIDE );
|
||||||
|
|
||||||
padOutline.BooleanSubtract( holeOutline, SHAPE_POLY_SET::POLYGON_MODE::PM_FAST );
|
padOutline.BooleanSubtract( holeOutline, SHAPE_POLY_SET::POLYGON_MODE::PM_FAST );
|
||||||
|
|
||||||
|
@ -2490,8 +2483,8 @@ void FOOTPRINT::CheckNetTies( const std::function<void( const BOARD_ITEM* aItem,
|
||||||
{
|
{
|
||||||
if( item->IsOnLayer( layer ) )
|
if( item->IsOnLayer( layer ) )
|
||||||
{
|
{
|
||||||
item->TransformShapeWithClearanceToPolygon( copperOutlines, layer, 0,
|
item->TransformShapeToPolygon( copperOutlines, layer, 0, ARC_HIGH_DEF,
|
||||||
ARC_HIGH_DEF, ERROR_OUTSIDE );
|
ERROR_OUTSIDE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2679,12 +2672,10 @@ bool FOOTPRINT::cmp_zones::operator()( const FP_ZONE* aFirst, const FP_ZONE* aSe
|
||||||
#undef TEST
|
#undef TEST
|
||||||
|
|
||||||
|
|
||||||
void FOOTPRINT::TransformPadsWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
void FOOTPRINT::TransformPadsToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer,
|
||||||
PCB_LAYER_ID aLayer, int aClearance,
|
int aClearance, int aMaxError, ERROR_LOC aErrorLoc,
|
||||||
int aMaxError, ERROR_LOC aErrorLoc,
|
bool aSkipNPTHPadsWihNoCopper, bool aSkipPlatedPads,
|
||||||
bool aSkipNPTHPadsWihNoCopper,
|
bool aSkipNonPlatedPads ) const
|
||||||
bool aSkipPlatedPads,
|
|
||||||
bool aSkipNonPlatedPads ) const
|
|
||||||
{
|
{
|
||||||
for( const PAD* pad : m_pads )
|
for( const PAD* pad : m_pads )
|
||||||
{
|
{
|
||||||
|
@ -2728,10 +2719,9 @@ void FOOTPRINT::TransformPadsWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuff
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Our standard TransformShapeWithClearanceToPolygon() routines can't handle differing
|
// Our standard TransformShapeToPolygon() routines can't handle differing x:y clearance
|
||||||
// x:y clearance values (which get generated when a relative paste margin is used with
|
// values (which get generated when a relative paste margin is used with an oblong pad).
|
||||||
// an oblong pad). So we apply this huge hack and fake a larger pad to run the transform
|
// So we apply this huge hack and fake a larger pad to run the transform on.
|
||||||
// on.
|
|
||||||
// Of course being a hack it falls down when dealing with custom shape pads (where the
|
// Of course being a hack it falls down when dealing with custom shape pads (where the
|
||||||
// size is only the size of the anchor), so for those we punt and just use clearance.x.
|
// size is only the size of the anchor), so for those we punt and just use clearance.x.
|
||||||
|
|
||||||
|
@ -2745,24 +2735,20 @@ void FOOTPRINT::TransformPadsWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuff
|
||||||
|
|
||||||
PAD dummy( *pad );
|
PAD dummy( *pad );
|
||||||
dummy.SetSize( dummySize );
|
dummy.SetSize( dummySize );
|
||||||
dummy.TransformShapeWithClearanceToPolygon( aCornerBuffer, aLayer, 0,
|
dummy.TransformShapeToPolygon( aBuffer, aLayer, 0, aMaxError, aErrorLoc );
|
||||||
aMaxError, aErrorLoc );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pad->TransformShapeWithClearanceToPolygon( aCornerBuffer, aLayer, clearance.x,
|
pad->TransformShapeToPolygon( aBuffer, aLayer, clearance.x, aMaxError, aErrorLoc );
|
||||||
aMaxError, aErrorLoc );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FOOTPRINT::TransformFPShapesWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
void FOOTPRINT::TransformFPShapesToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer,
|
||||||
PCB_LAYER_ID aLayer, int aClearance,
|
int aClearance, int aError, ERROR_LOC aErrorLoc,
|
||||||
int aError, ERROR_LOC aErrorLoc,
|
bool aIncludeText, bool aIncludeShapes,
|
||||||
bool aIncludeText,
|
bool aIncludePrivateItems ) const
|
||||||
bool aIncludeShapes,
|
|
||||||
bool aIncludePrivateItems ) const
|
|
||||||
{
|
{
|
||||||
std::vector<FP_TEXT*> texts; // List of FP_TEXT to convert
|
std::vector<FP_TEXT*> texts; // List of FP_TEXT to convert
|
||||||
|
|
||||||
|
@ -2784,10 +2770,7 @@ void FOOTPRINT::TransformFPShapesWithClearanceToPolygon( SHAPE_POLY_SET& aCorner
|
||||||
FP_TEXTBOX* textbox = static_cast<FP_TEXTBOX*>( item );
|
FP_TEXTBOX* textbox = static_cast<FP_TEXTBOX*>( item );
|
||||||
|
|
||||||
if( aLayer != UNDEFINED_LAYER && textbox->GetLayer() == aLayer && textbox->IsVisible() )
|
if( aLayer != UNDEFINED_LAYER && textbox->GetLayer() == aLayer && textbox->IsVisible() )
|
||||||
{
|
textbox->TransformShapeToPolygon( aBuffer, aLayer, 0, aError, aErrorLoc );
|
||||||
textbox->TransformShapeWithClearanceToPolygon( aCornerBuffer, aLayer, 0,
|
|
||||||
aError, aErrorLoc, false );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( item->Type() == PCB_FP_SHAPE_T && aIncludeShapes )
|
if( item->Type() == PCB_FP_SHAPE_T && aIncludeShapes )
|
||||||
|
@ -2795,10 +2778,7 @@ void FOOTPRINT::TransformFPShapesWithClearanceToPolygon( SHAPE_POLY_SET& aCorner
|
||||||
const FP_SHAPE* outline = static_cast<FP_SHAPE*>( item );
|
const FP_SHAPE* outline = static_cast<FP_SHAPE*>( item );
|
||||||
|
|
||||||
if( aLayer != UNDEFINED_LAYER && outline->GetLayer() == aLayer )
|
if( aLayer != UNDEFINED_LAYER && outline->GetLayer() == aLayer )
|
||||||
{
|
outline->TransformShapeToPolygon( aBuffer, aLayer, 0, aError, aErrorLoc );
|
||||||
outline->TransformShapeWithClearanceToPolygon( aCornerBuffer, aLayer, 0,
|
|
||||||
aError, aErrorLoc );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2812,10 +2792,7 @@ void FOOTPRINT::TransformFPShapesWithClearanceToPolygon( SHAPE_POLY_SET& aCorner
|
||||||
}
|
}
|
||||||
|
|
||||||
for( const FP_TEXT* text : texts )
|
for( const FP_TEXT* text : texts )
|
||||||
{
|
text->TransformTextToPolySet( aBuffer, aLayer, aClearance, aError, aErrorLoc );
|
||||||
text->TransformTextShapeWithClearanceToPolygon( aCornerBuffer, aLayer, aClearance,
|
|
||||||
aError, aErrorLoc );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -425,13 +425,13 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate pads shapes on layer \a aLayer as polygons and adds these polygons to
|
* Generate pads shapes on layer \a aLayer as polygons and adds these polygons to
|
||||||
* \a aCornerBuffer.
|
* \a aBuffer.
|
||||||
*
|
*
|
||||||
* Useful to generate a polygonal representation of a footprint in 3D view and plot functions,
|
* Useful to generate a polygonal representation of a footprint in 3D view and plot functions,
|
||||||
* when a full polygonal approach is needed.
|
* when a full polygonal approach is needed.
|
||||||
*
|
*
|
||||||
* @param aLayer is the layer to consider, or #UNDEFINED_LAYER to consider all layers.
|
* @param aLayer is the layer to consider, or #UNDEFINED_LAYER to consider all layers.
|
||||||
* @param aCornerBuffer i the buffer to store polygons.
|
* @param aBuffer i the buffer to store polygons.
|
||||||
* @param aClearance is an additional size to add to pad shapes.
|
* @param aClearance is an additional size to add to pad shapes.
|
||||||
* @param aMaxError is the maximum deviation from true for arcs.
|
* @param aMaxError is the maximum deviation from true for arcs.
|
||||||
* @param aSkipNPTHPadsWihNoCopper if true, do not add a NPTH pad shape, if the shape has
|
* @param aSkipNPTHPadsWihNoCopper if true, do not add a NPTH pad shape, if the shape has
|
||||||
|
@ -443,44 +443,39 @@ public:
|
||||||
* @param aSkipPlatedPads is used on 3D-Viewer to extract plated and non-plated pads.
|
* @param aSkipPlatedPads is used on 3D-Viewer to extract plated and non-plated pads.
|
||||||
* @param aSkipNonPlatedPads is used on 3D-Viewer to extract plated and plated pads.
|
* @param aSkipNonPlatedPads is used on 3D-Viewer to extract plated and plated pads.
|
||||||
*/
|
*/
|
||||||
void TransformPadsWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
void TransformPadsToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
|
||||||
PCB_LAYER_ID aLayer, int aClearance,
|
int aMaxError, ERROR_LOC aErrorLoc,
|
||||||
int aMaxError, ERROR_LOC aErrorLoc,
|
bool aSkipNPTHPadsWihNoCopper = false,
|
||||||
bool aSkipNPTHPadsWihNoCopper = false,
|
bool aSkipPlatedPads = false,
|
||||||
bool aSkipPlatedPads = false,
|
bool aSkipNonPlatedPads = false ) const;
|
||||||
bool aSkipNonPlatedPads = false ) const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate shapes of graphic items (outlines) on layer \a aLayer as polygons and adds these
|
* Generate shapes of graphic items (outlines) on layer \a aLayer as polygons and adds these
|
||||||
* polygons to \a aCornerBuffer.
|
* polygons to \a aBuffer.
|
||||||
*
|
*
|
||||||
* Useful to generate a polygonal representation of a footprint in 3D view and plot functions,
|
* Useful to generate a polygonal representation of a footprint in 3D view and plot functions,
|
||||||
* when a full polygonal approach is needed.
|
* when a full polygonal approach is needed.
|
||||||
*
|
*
|
||||||
* @param aLayer is the layer to consider, or #UNDEFINED_LAYER to consider all.
|
* @param aLayer is the layer to consider, or #UNDEFINED_LAYER to consider all.
|
||||||
* @param aCornerBuffer is the buffer to store polygons.
|
* @param aBuffer is the buffer to store polygons.
|
||||||
* @param aClearance is a value to inflate shapes.
|
* @param aClearance is a value to inflate shapes.
|
||||||
* @param aError is the maximum error between true arc and polygon approximation.
|
* @param aError is the maximum error between true arc and polygon approximation.
|
||||||
* @param aIncludeText set to true to transform text shapes.
|
* @param aIncludeText set to true to transform text shapes.
|
||||||
* @param aIncludeShapes set to true to transform footprint shapes.
|
* @param aIncludeShapes set to true to transform footprint shapes.
|
||||||
*/
|
*/
|
||||||
void TransformFPShapesWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
void TransformFPShapesToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
|
||||||
PCB_LAYER_ID aLayer, int aClearance,
|
int aError, ERROR_LOC aErrorLoc,
|
||||||
int aError, ERROR_LOC aErrorLoc,
|
bool aIncludeText = true,
|
||||||
bool aIncludeText = true,
|
bool aIncludeShapes = true,
|
||||||
bool aIncludeShapes = true,
|
bool aIncludePrivateItems = false ) const;
|
||||||
bool aIncludePrivateItems = false ) const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function is the same as TransformGraphicShapesWithClearanceToPolygonSet
|
* This function is the same as TransformFPShapesToPolySet but only generates text.
|
||||||
* but only generate text.
|
|
||||||
*/
|
*/
|
||||||
void TransformFPTextWithClearanceToPolygonSet( SHAPE_POLY_SET& aCornerBuffer,
|
void TransformFPTextToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
|
||||||
PCB_LAYER_ID aLayer, int aClearance,
|
int aError, ERROR_LOC aErrorLoc ) const
|
||||||
int aError, ERROR_LOC aErrorLoc ) const
|
|
||||||
{
|
{
|
||||||
TransformFPShapesWithClearanceToPolygon( aCornerBuffer, aLayer, aClearance, aError,
|
TransformFPShapesToPolySet( aBuffer, aLayer, aClearance, aError, aErrorLoc, true, false );
|
||||||
aErrorLoc, true, false );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -450,9 +450,8 @@ std::shared_ptr<SHAPE> FP_TEXT::GetEffectiveShape( PCB_LAYER_ID aLayer, FLASHING
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FP_TEXT::TransformTextShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
void FP_TEXT::TransformTextToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
|
||||||
PCB_LAYER_ID aLayer, int aClearance,
|
int aError, ERROR_LOC aErrorLoc ) const
|
||||||
int aError, ERROR_LOC aErrorLoc ) const
|
|
||||||
{
|
{
|
||||||
KIGFX::GAL_DISPLAY_OPTIONS empty_opts;
|
KIGFX::GAL_DISPLAY_OPTIONS empty_opts;
|
||||||
KIFONT::FONT* font = GetDrawFont();
|
KIFONT::FONT* font = GetDrawFont();
|
||||||
|
@ -469,8 +468,8 @@ void FP_TEXT::TransformTextShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerB
|
||||||
// Stroke callback
|
// Stroke callback
|
||||||
[&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2 )
|
[&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2 )
|
||||||
{
|
{
|
||||||
TransformOvalToPolygon( buffer, aPt1, aPt2, penWidth+ ( 2 * aClearance ),
|
TransformOvalToPolygon( buffer, aPt1, aPt2, penWidth + ( 2 * aClearance ), aError,
|
||||||
aError, ERROR_INSIDE );
|
ERROR_INSIDE );
|
||||||
},
|
},
|
||||||
// Triangulation callback
|
// Triangulation callback
|
||||||
[&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2, const VECTOR2I& aPt3 )
|
[&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2, const VECTOR2I& aPt3 )
|
||||||
|
@ -487,19 +486,17 @@ void FP_TEXT::TransformTextShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerB
|
||||||
font->Draw( &callback_gal, GetShownText(), GetTextPos(), attrs );
|
font->Draw( &callback_gal, GetShownText(), GetTextPos(), attrs );
|
||||||
|
|
||||||
buffer.Simplify( SHAPE_POLY_SET::PM_FAST );
|
buffer.Simplify( SHAPE_POLY_SET::PM_FAST );
|
||||||
aCornerBuffer.Append( buffer );
|
aBuffer.Append( buffer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FP_TEXT::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
void FP_TEXT::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
|
||||||
PCB_LAYER_ID aLayer, int aClearance,
|
int aError, ERROR_LOC aErrorLoc, bool aIgnoreLineWidth ) const
|
||||||
int aError, ERROR_LOC aErrorLoc,
|
|
||||||
bool aIgnoreLineWidth ) const
|
|
||||||
{
|
{
|
||||||
SHAPE_POLY_SET buffer;
|
SHAPE_POLY_SET buffer;
|
||||||
|
|
||||||
EDA_TEXT::TransformBoundingBoxWithClearanceToPolygon( &buffer, aClearance );
|
EDA_TEXT::TransformBoundingBoxToPolygon( &buffer, aClearance );
|
||||||
aCornerBuffer.Append( buffer );
|
aBuffer.Append( buffer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -155,13 +155,12 @@ public:
|
||||||
return TextHitTest( aRect, aContained, aAccuracy );
|
return TextHitTest( aRect, aContained, aAccuracy );
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, PCB_LAYER_ID aLayer,
|
void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
|
||||||
int aClearance, int aError, ERROR_LOC aErrorLoc,
|
int aError, ERROR_LOC aErrorLoc,
|
||||||
bool aIgnoreLineWidth ) const override;
|
bool aIgnoreLineWidth ) const override;
|
||||||
|
|
||||||
void TransformTextShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
void TransformTextToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
|
||||||
PCB_LAYER_ID aLayer, int aClearanceValue,
|
int aError, ERROR_LOC aErrorLoc ) const;
|
||||||
int aError, ERROR_LOC aErrorLoc ) const;
|
|
||||||
|
|
||||||
// @copydoc BOARD_ITEM::GetEffectiveShape
|
// @copydoc BOARD_ITEM::GetEffectiveShape
|
||||||
std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
|
std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
|
||||||
|
|
|
@ -440,9 +440,8 @@ std::shared_ptr<SHAPE> FP_TEXTBOX::GetEffectiveShape( PCB_LAYER_ID aLayer, FLASH
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FP_TEXTBOX::TransformTextShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
void FP_TEXTBOX::TransformTextToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer,
|
||||||
PCB_LAYER_ID aLayer, int aClearance,
|
int aClearance, int aError, ERROR_LOC aErrorLoc ) const
|
||||||
int aError, ERROR_LOC aErrorLoc ) const
|
|
||||||
{
|
{
|
||||||
KIGFX::GAL_DISPLAY_OPTIONS empty_opts;
|
KIGFX::GAL_DISPLAY_OPTIONS empty_opts;
|
||||||
KIFONT::FONT* font = GetDrawFont();
|
KIFONT::FONT* font = GetDrawFont();
|
||||||
|
@ -459,8 +458,8 @@ void FP_TEXTBOX::TransformTextShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCorn
|
||||||
// Stroke callback
|
// Stroke callback
|
||||||
[&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2 )
|
[&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2 )
|
||||||
{
|
{
|
||||||
TransformOvalToPolygon( buffer, aPt1, aPt2, penWidth + ( 2 * aClearance ),
|
TransformOvalToPolygon( buffer, aPt1, aPt2, penWidth + ( 2 * aClearance ), aError,
|
||||||
aError, ERROR_INSIDE );
|
ERROR_INSIDE );
|
||||||
},
|
},
|
||||||
// Triangulation callback
|
// Triangulation callback
|
||||||
[&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2, const VECTOR2I& aPt3 )
|
[&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2, const VECTOR2I& aPt3 )
|
||||||
|
@ -477,34 +476,33 @@ void FP_TEXTBOX::TransformTextShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCorn
|
||||||
font->Draw( &callback_gal, GetShownText(), GetDrawPos(), attrs );
|
font->Draw( &callback_gal, GetShownText(), GetDrawPos(), attrs );
|
||||||
|
|
||||||
buffer.Simplify( SHAPE_POLY_SET::PM_FAST );
|
buffer.Simplify( SHAPE_POLY_SET::PM_FAST );
|
||||||
aCornerBuffer.Append( buffer );
|
aBuffer.Append( buffer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FP_TEXTBOX::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
void FP_TEXTBOX::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer,
|
||||||
PCB_LAYER_ID aLayer, int aClearance,
|
int aClearance, int aError, ERROR_LOC aErrorLoc,
|
||||||
int aError, ERROR_LOC aErrorLoc,
|
bool aIgnoreLineWidth ) const
|
||||||
bool aIgnoreLineWidth ) const
|
|
||||||
{
|
{
|
||||||
// Don't use FP_SHAPE::TransformShapeWithClearanceToPolygon. We want to treat the
|
// Don't use FP_SHAPE::TransformShapeToPolygon. We want to treat the textbox as filled even
|
||||||
// textbox as filled even if there's no background colour.
|
// if there's no background colour.
|
||||||
|
|
||||||
std::vector<VECTOR2I> pts = GetRectCorners();
|
std::vector<VECTOR2I> pts = GetRectCorners();
|
||||||
|
|
||||||
aCornerBuffer.NewOutline();
|
aBuffer.NewOutline();
|
||||||
|
|
||||||
for( const VECTOR2I& pt : pts )
|
for( const VECTOR2I& pt : pts )
|
||||||
aCornerBuffer.Append( pt );
|
aBuffer.Append( pt );
|
||||||
|
|
||||||
int width = GetWidth() + ( 2 * aClearance );
|
int width = GetWidth() + ( 2 * aClearance );
|
||||||
|
|
||||||
if( width > 0 )
|
if( width > 0 )
|
||||||
{
|
{
|
||||||
// Add in segments
|
// Add in segments
|
||||||
TransformOvalToPolygon( aCornerBuffer, pts[0], pts[1], width, aError, aErrorLoc );
|
TransformOvalToPolygon( aBuffer, pts[0], pts[1], width, aError, aErrorLoc );
|
||||||
TransformOvalToPolygon( aCornerBuffer, pts[1], pts[2], width, aError, aErrorLoc );
|
TransformOvalToPolygon( aBuffer, pts[1], pts[2], width, aError, aErrorLoc );
|
||||||
TransformOvalToPolygon( aCornerBuffer, pts[2], pts[3], width, aError, aErrorLoc );
|
TransformOvalToPolygon( aBuffer, pts[2], pts[3], width, aError, aErrorLoc );
|
||||||
TransformOvalToPolygon( aCornerBuffer, pts[3], pts[0], width, aError, aErrorLoc );
|
TransformOvalToPolygon( aBuffer, pts[3], pts[0], width, aError, aErrorLoc );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -106,13 +106,12 @@ public:
|
||||||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy ) const override;
|
bool HitTest( const VECTOR2I& aPosition, int aAccuracy ) const override;
|
||||||
bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||||
|
|
||||||
void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, PCB_LAYER_ID aLayer,
|
void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
|
||||||
int aClearance, int aError, ERROR_LOC aErrorLoc,
|
int aError, ERROR_LOC aErrorLoc,
|
||||||
bool aIgnoreLineWidth ) const override;
|
bool aIgnoreLineWidth = false ) const override;
|
||||||
|
|
||||||
void TransformTextShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
void TransformTextToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
|
||||||
PCB_LAYER_ID aLayer, int aClearanceValue,
|
int aError, ERROR_LOC aErrorLoc ) const;
|
||||||
int aError, ERROR_LOC aErrorLoc ) const;
|
|
||||||
|
|
||||||
// @copydoc BOARD_ITEM::GetEffectiveShape
|
// @copydoc BOARD_ITEM::GetEffectiveShape
|
||||||
std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
|
std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
|
||||||
|
|
|
@ -593,8 +593,7 @@ void PAD::BuildEffectivePolygon() const
|
||||||
|
|
||||||
// Polygon
|
// Polygon
|
||||||
m_effectivePolygon = std::make_shared<SHAPE_POLY_SET>();
|
m_effectivePolygon = std::make_shared<SHAPE_POLY_SET>();
|
||||||
TransformShapeWithClearanceToPolygon( *m_effectivePolygon, UNDEFINED_LAYER, 0, maxError,
|
TransformShapeToPolygon( *m_effectivePolygon, UNDEFINED_LAYER, 0, maxError, ERROR_INSIDE );
|
||||||
ERROR_INSIDE );
|
|
||||||
|
|
||||||
// Bounding radius
|
// Bounding radius
|
||||||
//
|
//
|
||||||
|
@ -1550,8 +1549,8 @@ void PAD::SwapData( BOARD_ITEM* aImage )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool PAD::TransformHoleWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, int aInflateValue,
|
bool PAD::TransformHoleToPolygon( SHAPE_POLY_SET& aBuffer, int aClearance, int aError,
|
||||||
int aError, ERROR_LOC aErrorLoc ) const
|
ERROR_LOC aErrorLoc ) const
|
||||||
{
|
{
|
||||||
VECTOR2I drillsize = GetDrillSize();
|
VECTOR2I drillsize = GetDrillSize();
|
||||||
|
|
||||||
|
@ -1560,17 +1559,15 @@ bool PAD::TransformHoleWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, in
|
||||||
|
|
||||||
std::shared_ptr<SHAPE_SEGMENT> slot = GetEffectiveHoleShape();
|
std::shared_ptr<SHAPE_SEGMENT> slot = GetEffectiveHoleShape();
|
||||||
|
|
||||||
TransformOvalToPolygon( aCornerBuffer, slot->GetSeg().A, slot->GetSeg().B,
|
TransformOvalToPolygon( aBuffer, slot->GetSeg().A, slot->GetSeg().B,
|
||||||
slot->GetWidth() + aInflateValue * 2, aError, aErrorLoc );
|
slot->GetWidth() + aClearance * 2, aError, aErrorLoc );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PAD::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
void PAD::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
|
||||||
PCB_LAYER_ID aLayer, int aClearanceValue,
|
int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth ) const
|
||||||
int aError, ERROR_LOC aErrorLoc,
|
|
||||||
bool ignoreLineWidth ) const
|
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( !ignoreLineWidth, wxT( "IgnoreLineWidth has no meaning for pads." ) );
|
wxASSERT_MSG( !ignoreLineWidth, wxT( "IgnoreLineWidth has no meaning for pads." ) );
|
||||||
|
|
||||||
|
@ -1581,8 +1578,8 @@ void PAD::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
||||||
int dx = m_size.x / 2;
|
int dx = m_size.x / 2;
|
||||||
int dy = m_size.y / 2;
|
int dy = m_size.y / 2;
|
||||||
|
|
||||||
VECTOR2I padShapePos = ShapePos(); // Note: for pad having a shape offset,
|
VECTOR2I padShapePos = ShapePos(); // Note: for pad having a shape offset, the pad
|
||||||
// the pad position is NOT the shape position
|
// position is NOT the shape position
|
||||||
|
|
||||||
switch( GetShape() )
|
switch( GetShape() )
|
||||||
{
|
{
|
||||||
|
@ -1591,8 +1588,8 @@ void PAD::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
||||||
// Note: dx == dy is not guaranteed for circle pads in legacy boards
|
// Note: dx == dy is not guaranteed for circle pads in legacy boards
|
||||||
if( dx == dy || ( GetShape() == PAD_SHAPE::CIRCLE ) )
|
if( dx == dy || ( GetShape() == PAD_SHAPE::CIRCLE ) )
|
||||||
{
|
{
|
||||||
TransformCircleToPolygon( aCornerBuffer, padShapePos, dx + aClearanceValue, aError,
|
TransformCircleToPolygon( aBuffer, padShapePos, dx + aClearance, aError, aErrorLoc,
|
||||||
aErrorLoc, pad_min_seg_per_circle_count );
|
pad_min_seg_per_circle_count );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1601,8 +1598,8 @@ void PAD::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
||||||
|
|
||||||
RotatePoint( delta, m_orient );
|
RotatePoint( delta, m_orient );
|
||||||
|
|
||||||
TransformOvalToPolygon( aCornerBuffer, padShapePos - delta, padShapePos + delta,
|
TransformOvalToPolygon( aBuffer, padShapePos - delta, padShapePos + delta,
|
||||||
( half_width + aClearanceValue ) * 2, aError, aErrorLoc,
|
( half_width + aClearance ) * 2, aError, aErrorLoc,
|
||||||
pad_min_seg_per_circle_count );
|
pad_min_seg_per_circle_count );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1615,9 +1612,9 @@ void PAD::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
||||||
int ddy = GetShape() == PAD_SHAPE::TRAPEZOID ? m_deltaSize.y / 2 : 0;
|
int ddy = GetShape() == PAD_SHAPE::TRAPEZOID ? m_deltaSize.y / 2 : 0;
|
||||||
|
|
||||||
SHAPE_POLY_SET outline;
|
SHAPE_POLY_SET outline;
|
||||||
TransformTrapezoidToPolygon( outline, padShapePos, m_size, m_orient, ddx, ddy,
|
TransformTrapezoidToPolygon( outline, padShapePos, m_size, m_orient, ddx, ddy, aClearance,
|
||||||
aClearanceValue, aError, aErrorLoc );
|
aError, aErrorLoc );
|
||||||
aCornerBuffer.Append( outline );
|
aBuffer.Append( outline );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1631,8 +1628,8 @@ void PAD::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
||||||
GetRoundRectCornerRadius(),
|
GetRoundRectCornerRadius(),
|
||||||
doChamfer ? GetChamferRectRatio() : 0,
|
doChamfer ? GetChamferRectRatio() : 0,
|
||||||
doChamfer ? GetChamferPositions() : 0,
|
doChamfer ? GetChamferPositions() : 0,
|
||||||
aClearanceValue, aError, aErrorLoc );
|
aClearance, aError, aErrorLoc );
|
||||||
aCornerBuffer.Append( outline );
|
aBuffer.Append( outline );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1643,11 +1640,11 @@ void PAD::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
||||||
outline.Rotate( m_orient );
|
outline.Rotate( m_orient );
|
||||||
outline.Move( VECTOR2I( m_pos ) );
|
outline.Move( VECTOR2I( m_pos ) );
|
||||||
|
|
||||||
if( aClearanceValue )
|
if( aClearance )
|
||||||
{
|
{
|
||||||
int numSegs = std::max( GetArcToSegmentCount( aClearanceValue, aError, FULL_CIRCLE ),
|
int numSegs = std::max( GetArcToSegmentCount( aClearance, aError, FULL_CIRCLE ),
|
||||||
pad_min_seg_per_circle_count );
|
pad_min_seg_per_circle_count );
|
||||||
int clearance = aClearanceValue;
|
int clearance = aClearance;
|
||||||
|
|
||||||
if( aErrorLoc == ERROR_OUTSIDE )
|
if( aErrorLoc == ERROR_OUTSIDE )
|
||||||
{
|
{
|
||||||
|
@ -1660,12 +1657,12 @@ void PAD::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
||||||
outline.Fracture( SHAPE_POLY_SET::PM_FAST );
|
outline.Fracture( SHAPE_POLY_SET::PM_FAST );
|
||||||
}
|
}
|
||||||
|
|
||||||
aCornerBuffer.Append( outline );
|
aBuffer.Append( outline );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
wxFAIL_MSG( wxT( "PAD::TransformShapeWithClearanceToPolygon no implementation for " )
|
wxFAIL_MSG( wxT( "PAD::TransformShapeToPolygon no implementation for " )
|
||||||
+ PAD_SHAPE_T_asString( GetShape() ) );
|
+ PAD_SHAPE_T_asString( GetShape() ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
19
pcbnew/pad.h
19
pcbnew/pad.h
|
@ -425,28 +425,27 @@ public:
|
||||||
/**
|
/**
|
||||||
* Convert the pad shape to a closed polygon. Circles and arcs are approximated by segments.
|
* Convert the pad shape to a closed polygon. Circles and arcs are approximated by segments.
|
||||||
*
|
*
|
||||||
* @param aCornerBuffer a buffer to store the polygon.
|
* @param aBuffer a buffer to store the polygon.
|
||||||
* @param aClearanceValue the clearance around the pad.
|
* @param aClearance the clearance around the pad.
|
||||||
* @param aMaxError maximum error from true when converting arcs.
|
* @param aMaxError maximum error from true when converting arcs.
|
||||||
* @param aErrorLoc should the approximation error be placed outside or inside the polygon?
|
* @param aErrorLoc should the approximation error be placed outside or inside the polygon?
|
||||||
* @param ignoreLineWidth used for edge cuts where the line width is only for visualization.
|
* @param ignoreLineWidth used for edge cuts where the line width is only for visualization.
|
||||||
*/
|
*/
|
||||||
void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
|
||||||
PCB_LAYER_ID aLayer, int aClearanceValue,
|
int aMaxError, ERROR_LOC aErrorLoc,
|
||||||
int aMaxError, ERROR_LOC aErrorLoc,
|
bool ignoreLineWidth = false ) const override;
|
||||||
bool ignoreLineWidth = false ) const override;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build the corner list of the polygonal drill shape in the board coordinate system.
|
* Build the corner list of the polygonal drill shape in the board coordinate system.
|
||||||
*
|
*
|
||||||
* @param aCornerBuffer a buffer to fill.
|
* @param aBuffer a buffer to fill.
|
||||||
* @param aInflateValue the clearance or margin value.
|
* @param aClearance the clearance or margin value.
|
||||||
* @param aError maximum deviation of an arc from the polygon approximation.
|
* @param aError maximum deviation of an arc from the polygon approximation.
|
||||||
* @param aErrorLoc = should the approximation error be placed outside or inside the polygon?
|
* @param aErrorLoc = should the approximation error be placed outside or inside the polygon?
|
||||||
* @return false if the pad has no hole, true otherwise.
|
* @return false if the pad has no hole, true otherwise.
|
||||||
*/
|
*/
|
||||||
bool TransformHoleWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, int aInflateValue,
|
bool TransformHoleToPolygon( SHAPE_POLY_SET& aBuffer, int aClearance, int aError,
|
||||||
int aError, ERROR_LOC aErrorLoc ) const;
|
ERROR_LOC aErrorLoc ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Some pad shapes can be complex (rounded/chamfered rectangle), even without considering
|
* Some pad shapes can be complex (rounded/chamfered rectangle), even without considering
|
||||||
|
|
|
@ -210,10 +210,7 @@ void PAD::addPadPrimitivesToPolygon( SHAPE_POLY_SET* aMergedPolygon, int aError,
|
||||||
for( const std::shared_ptr<PCB_SHAPE>& primitive : m_editPrimitives )
|
for( const std::shared_ptr<PCB_SHAPE>& primitive : m_editPrimitives )
|
||||||
{
|
{
|
||||||
if( !primitive->IsAnnotationProxy() )
|
if( !primitive->IsAnnotationProxy() )
|
||||||
{
|
primitive->TransformShapeToPolygon( polyset, UNDEFINED_LAYER, 0, aError, aErrorLoc );
|
||||||
primitive->TransformShapeWithClearanceToPolygon( polyset, UNDEFINED_LAYER, 0, aError,
|
|
||||||
aErrorLoc );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
polyset.Simplify( SHAPE_POLY_SET::PM_FAST );
|
polyset.Simplify( SHAPE_POLY_SET::PM_FAST );
|
||||||
|
|
|
@ -417,8 +417,8 @@ void PCB_BASE_FRAME::FocusOnItems( std::vector<BOARD_ITEM*> aItems, PCB_LAYER_ID
|
||||||
case PCB_FP_DIM_CENTER_T:
|
case PCB_FP_DIM_CENTER_T:
|
||||||
case PCB_FP_DIM_RADIAL_T:
|
case PCB_FP_DIM_RADIAL_T:
|
||||||
case PCB_FP_DIM_ORTHOGONAL_T:
|
case PCB_FP_DIM_ORTHOGONAL_T:
|
||||||
item->TransformShapeWithClearanceToPolygon( itemPoly, aLayer, 0,
|
item->TransformShapeToPolygon( itemPoly, aLayer, 0, pcbIUScale.mmToIU( 0.1 ),
|
||||||
pcbIUScale.mmToIU( 0.1 ), ERROR_INSIDE );
|
ERROR_INSIDE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCB_ZONE_T:
|
case PCB_ZONE_T:
|
||||||
|
@ -429,8 +429,8 @@ void PCB_BASE_FRAME::FocusOnItems( std::vector<BOARD_ITEM*> aItems, PCB_LAYER_ID
|
||||||
// unfortunately the calculations are highly time consuming, even for not very
|
// unfortunately the calculations are highly time consuming, even for not very
|
||||||
// large areas (can be easily a few minutes for large areas).
|
// large areas (can be easily a few minutes for large areas).
|
||||||
// so we used only the zone outline that usually do not have too many vertices.
|
// so we used only the zone outline that usually do not have too many vertices.
|
||||||
zone->TransformShapeWithClearanceToPolygon( itemPoly, aLayer, 0,
|
zone->TransformShapeToPolygon( itemPoly, aLayer, 0, pcbIUScale.mmToIU( 0.1 ),
|
||||||
pcbIUScale.FromMillimeter( 0.1 ), ERROR_INSIDE );
|
ERROR_INSIDE );
|
||||||
|
|
||||||
if( itemPoly.IsEmpty() )
|
if( itemPoly.IsEmpty() )
|
||||||
itemPoly = *zone->Outline();
|
itemPoly = *zone->Outline();
|
||||||
|
|
|
@ -514,10 +514,9 @@ OPT_VECTOR2I PCB_DIMENSION_BASE::segCircleIntersection( CIRCLE& aCircle, SEG& aS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_DIMENSION_BASE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
void PCB_DIMENSION_BASE::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer,
|
||||||
PCB_LAYER_ID aLayer, int aClearance,
|
int aClearance, int aError, ERROR_LOC aErrorLoc,
|
||||||
int aError, ERROR_LOC aErrorLoc,
|
bool aIgnoreLineWidth ) const
|
||||||
bool aIgnoreLineWidth ) const
|
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( !aIgnoreLineWidth, wxT( "IgnoreLineWidth has no meaning for dimensions." ) );
|
wxASSERT_MSG( !aIgnoreLineWidth, wxT( "IgnoreLineWidth has no meaning for dimensions." ) );
|
||||||
|
|
||||||
|
@ -528,20 +527,18 @@ void PCB_DIMENSION_BASE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& a
|
||||||
|
|
||||||
if( circle )
|
if( circle )
|
||||||
{
|
{
|
||||||
TransformCircleToPolygon( aCornerBuffer, circle->GetCenter(),
|
TransformCircleToPolygon( aBuffer, circle->GetCenter(),
|
||||||
circle->GetRadius() + m_lineThickness / 2 + aClearance,
|
circle->GetRadius() + m_lineThickness / 2 + aClearance,
|
||||||
aError, aErrorLoc );
|
aError, aErrorLoc );
|
||||||
}
|
}
|
||||||
else if( seg )
|
else if( seg )
|
||||||
{
|
{
|
||||||
TransformOvalToPolygon( aCornerBuffer, seg->GetSeg().A,
|
TransformOvalToPolygon( aBuffer, seg->GetSeg().A, seg->GetSeg().B,
|
||||||
seg->GetSeg().B, m_lineThickness + 2 * aClearance,
|
m_lineThickness + 2 * aClearance, aError, aErrorLoc );
|
||||||
aError, aErrorLoc );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxFAIL_MSG( wxT( "PCB_DIMENSION_BASE::TransformShapeWithClearanceToPolygon unexpected "
|
wxFAIL_MSG( wxT( "PCB_DIMENSION_BASE::TransformShapeToPolygon unknown shape type." ) );
|
||||||
"shape type." ) );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -249,9 +249,9 @@ public:
|
||||||
|
|
||||||
const BOX2I ViewBBox() const override;
|
const BOX2I ViewBBox() const override;
|
||||||
|
|
||||||
void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, PCB_LAYER_ID aLayer,
|
void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
|
||||||
int aClearance, int aError, ERROR_LOC aErrorLoc,
|
int aError, ERROR_LOC aErrorLoc,
|
||||||
bool aIgnoreLineWidth = false ) const override;
|
bool aIgnoreLineWidth = false ) const override;
|
||||||
|
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
|
virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
|
||||||
|
|
|
@ -712,8 +712,8 @@ static void enclosedByAreaFunc( LIBEVAL::CONTEXT* aCtx, void* self )
|
||||||
SHAPE_POLY_SET itemShape;
|
SHAPE_POLY_SET itemShape;
|
||||||
bool enclosedByArea;
|
bool enclosedByArea;
|
||||||
|
|
||||||
item->TransformShapeWithClearanceToPolygon( itemShape, layer, 0,
|
item->TransformShapeToPolygon( itemShape, layer, 0, maxError,
|
||||||
maxError, ERROR_OUTSIDE );
|
ERROR_OUTSIDE );
|
||||||
|
|
||||||
if( itemShape.IsEmpty() )
|
if( itemShape.IsEmpty() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1453,8 +1453,8 @@ void PCB_PAINTER::draw( const PAD* aPad, int aLayer )
|
||||||
{
|
{
|
||||||
// This is expensive. Avoid if possible.
|
// This is expensive. Avoid if possible.
|
||||||
SHAPE_POLY_SET polySet;
|
SHAPE_POLY_SET polySet;
|
||||||
aPad->TransformShapeWithClearanceToPolygon( polySet, ToLAYER_ID( aLayer ), margin.x,
|
aPad->TransformShapeToPolygon( polySet, ToLAYER_ID( aLayer ), margin.x, m_maxError,
|
||||||
m_maxError, ERROR_INSIDE );
|
ERROR_INSIDE );
|
||||||
m_gal->DrawPolygon( polySet );
|
m_gal->DrawPolygon( polySet );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1509,8 +1509,8 @@ void PCB_PAINTER::draw( const PAD* aPad, int aLayer )
|
||||||
SHAPE_POLY_SET polySet;
|
SHAPE_POLY_SET polySet;
|
||||||
|
|
||||||
// Use ERROR_INSIDE because it avoids Clipper and is therefore much faster.
|
// Use ERROR_INSIDE because it avoids Clipper and is therefore much faster.
|
||||||
aPad->TransformShapeWithClearanceToPolygon( polySet, ToLAYER_ID( aLayer ),
|
aPad->TransformShapeToPolygon( polySet, ToLAYER_ID( aLayer ), clearance,
|
||||||
clearance, m_maxError, ERROR_INSIDE );
|
m_maxError, ERROR_INSIDE );
|
||||||
|
|
||||||
if( polySet.Outline( 0 ).PointCount() > 2 ) // Careful of empty pads
|
if( polySet.Outline( 0 ).PointCount() > 2 ) // Careful of empty pads
|
||||||
m_gal->DrawPolygon( polySet );
|
m_gal->DrawPolygon( polySet );
|
||||||
|
@ -1845,8 +1845,7 @@ void PCB_PAINTER::draw( const PCB_TEXT* aText, int aLayer )
|
||||||
m_gal->SetLineWidth( m_lockedShadowMargin );
|
m_gal->SetLineWidth( m_lockedShadowMargin );
|
||||||
|
|
||||||
SHAPE_POLY_SET poly;
|
SHAPE_POLY_SET poly;
|
||||||
aText->TransformShapeWithClearanceToPolygon( poly, aText->GetLayer(), 0, m_maxError,
|
aText->TransformShapeToPolygon( poly, aText->GetLayer(), 0, m_maxError, ERROR_OUTSIDE );
|
||||||
ERROR_OUTSIDE );
|
|
||||||
m_gal->DrawPolygon( poly );
|
m_gal->DrawPolygon( poly );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -1884,7 +1883,7 @@ void PCB_PAINTER::draw( const PCB_TEXT* aText, int aLayer )
|
||||||
int margin = attrs.m_StrokeWidth * 1.5
|
int margin = attrs.m_StrokeWidth * 1.5
|
||||||
+ GetKnockoutTextMargin( attrs.m_Size, attrs.m_StrokeWidth );
|
+ GetKnockoutTextMargin( attrs.m_Size, attrs.m_StrokeWidth );
|
||||||
|
|
||||||
aText->TransformBoundingBoxWithClearanceToPolygon( &finalPoly, margin );
|
aText->TransformBoundingBoxToPolygon( &finalPoly, margin );
|
||||||
finalPoly.BooleanSubtract( knockouts, SHAPE_POLY_SET::PM_FAST );
|
finalPoly.BooleanSubtract( knockouts, SHAPE_POLY_SET::PM_FAST );
|
||||||
finalPoly.Fracture( SHAPE_POLY_SET::PM_FAST );
|
finalPoly.Fracture( SHAPE_POLY_SET::PM_FAST );
|
||||||
|
|
||||||
|
@ -2049,7 +2048,7 @@ void PCB_PAINTER::draw( const FP_TEXT* aText, int aLayer )
|
||||||
int margin = attrs.m_StrokeWidth * 1.5
|
int margin = attrs.m_StrokeWidth * 1.5
|
||||||
+ GetKnockoutTextMargin( attrs.m_Size, attrs.m_StrokeWidth );
|
+ GetKnockoutTextMargin( attrs.m_Size, attrs.m_StrokeWidth );
|
||||||
|
|
||||||
aText->TransformBoundingBoxWithClearanceToPolygon( &finalPoly, margin );
|
aText->TransformBoundingBoxToPolygon( &finalPoly, margin );
|
||||||
finalPoly.BooleanSubtract( knockouts, SHAPE_POLY_SET::PM_FAST );
|
finalPoly.BooleanSubtract( knockouts, SHAPE_POLY_SET::PM_FAST );
|
||||||
finalPoly.Fracture( SHAPE_POLY_SET::PM_FAST );
|
finalPoly.Fracture( SHAPE_POLY_SET::PM_FAST );
|
||||||
|
|
||||||
|
|
|
@ -380,13 +380,11 @@ bool PCB_SHAPE::cmp_drawings::operator()( const BOARD_ITEM* aFirst,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
void PCB_SHAPE::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer,
|
||||||
PCB_LAYER_ID aLayer, int aClearanceValue,
|
int aClearance, int aError, ERROR_LOC aErrorLoc,
|
||||||
int aError, ERROR_LOC aErrorLoc,
|
bool ignoreLineWidth ) const
|
||||||
bool ignoreLineWidth ) const
|
|
||||||
{
|
{
|
||||||
EDA_SHAPE::TransformShapeWithClearanceToPolygon( aCornerBuffer, aClearanceValue, aError,
|
EDA_SHAPE::TransformShapeToPolygon( aBuffer, aClearance, aError, aErrorLoc, ignoreLineWidth );
|
||||||
aErrorLoc, ignoreLineWidth );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -121,21 +121,18 @@ public:
|
||||||
void Scale( double aScale );
|
void Scale( double aScale );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert the shape to a closed polygon.
|
* Convert the shape to a closed polygon. Circles and arcs are approximated by segments.
|
||||||
*
|
*
|
||||||
* Used in filling zones calculations. Circles and arcs are approximated by segments.
|
* @param aBuffer is a buffer to store the polygon.
|
||||||
*
|
* @param aClearance is the clearance around the pad.
|
||||||
* @param aCornerBuffer is a buffer to store the polygon.
|
|
||||||
* @param aClearanceValue is the clearance around the pad.
|
|
||||||
* @param aError is the maximum deviation from a true arc.
|
* @param aError is the maximum deviation from a true arc.
|
||||||
* @param aErrorLoc whether any approximation error should be placed inside or outside
|
* @param aErrorLoc whether any approximation error should be placed inside or outside
|
||||||
* @param ignoreLineWidth is used for edge cut items where the line width is only
|
* @param ignoreLineWidth is used for edge cut items where the line width is only for
|
||||||
* for visualization
|
* visualization
|
||||||
*/
|
*/
|
||||||
void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
|
||||||
PCB_LAYER_ID aLayer, int aClearanceValue,
|
int aError, ERROR_LOC aErrorLoc,
|
||||||
int aError, ERROR_LOC aErrorLoc,
|
bool ignoreLineWidth = false ) const override;
|
||||||
bool ignoreLineWidth = false ) const override;
|
|
||||||
|
|
||||||
virtual wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
|
virtual wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||||
|
|
||||||
|
|
|
@ -158,10 +158,9 @@ void PCB_TARGET::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_TARGET::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
void PCB_TARGET::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer,
|
||||||
PCB_LAYER_ID aLayer, int aClearanceValue,
|
int aClearance, int aError, ERROR_LOC aErrorLoc,
|
||||||
int aError, ERROR_LOC aErrorLoc,
|
bool ignoreLineWidth ) const
|
||||||
bool ignoreLineWidth ) const
|
|
||||||
{
|
{
|
||||||
int size = GetShape() ? GetSize() / 1.5 : GetSize() / 2.0;
|
int size = GetShape() ? GetSize() / 1.5 : GetSize() / 2.0;
|
||||||
int radius = GetShape() ? GetSize() / 2.0 : GetSize() / 3.0;
|
int radius = GetShape() ? GetSize() / 2.0 : GetSize() / 3.0;
|
||||||
|
@ -184,8 +183,8 @@ void PCB_TARGET::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBu
|
||||||
{
|
{
|
||||||
item->SetWidth( GetWidth() );
|
item->SetWidth( GetWidth() );
|
||||||
item->Move( GetPosition() );
|
item->Move( GetPosition() );
|
||||||
item->TransformShapeWithClearanceToPolygon( aCornerBuffer, aLayer, aClearanceValue,
|
item->TransformShapeToPolygon( aBuffer, aLayer, aClearance, aError, aErrorLoc,
|
||||||
aError, aErrorLoc, ignoreLineWidth );
|
ignoreLineWidth );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,17 +101,16 @@ public:
|
||||||
*
|
*
|
||||||
* Used in filling zones calculations. Circles and arcs are approximated by segments.
|
* Used in filling zones calculations. Circles and arcs are approximated by segments.
|
||||||
*
|
*
|
||||||
* @param aCornerBuffer is a buffer to store the polygon.
|
* @param aBuffer is a buffer to store the polygon.
|
||||||
* @param aClearanceValue is the clearance around the pad.
|
* @param aClearance is the clearance around the pad.
|
||||||
* @param aError is the maximum deviation from a true arc.
|
* @param aError is the maximum deviation from a true arc.
|
||||||
* @param aErrorLoc whether any approximation error should be placed inside or outside
|
* @param aErrorLoc whether any approximation error should be placed inside or outside
|
||||||
* @param ignoreLineWidth is used for edge cut items where the line width is only
|
* @param ignoreLineWidth is used for edge cut items where the line width is only for
|
||||||
* for visualization
|
* visualization
|
||||||
*/
|
*/
|
||||||
void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
|
||||||
PCB_LAYER_ID aLayer, int aClearanceValue,
|
int aError, ERROR_LOC aErrorLoc,
|
||||||
int aError, ERROR_LOC aErrorLoc,
|
bool ignoreLineWidth = false ) const override;
|
||||||
bool ignoreLineWidth = false ) const override;
|
|
||||||
|
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
|
void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
|
||||||
|
|
|
@ -175,7 +175,7 @@ bool PCB_TEXT::TextHitTest( const VECTOR2I& aPoint, int aAccuracy ) const
|
||||||
{
|
{
|
||||||
SHAPE_POLY_SET poly;
|
SHAPE_POLY_SET poly;
|
||||||
|
|
||||||
TransformBoundingBoxWithClearanceToPolygon( &poly, getKnockoutMargin() );
|
TransformBoundingBoxToPolygon( &poly, getKnockoutMargin());
|
||||||
|
|
||||||
return poly.Collide( aPoint, aAccuracy );
|
return poly.Collide( aPoint, aAccuracy );
|
||||||
}
|
}
|
||||||
|
@ -284,9 +284,8 @@ std::shared_ptr<SHAPE> PCB_TEXT::GetEffectiveShape( PCB_LAYER_ID aLayer, FLASHIN
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_TEXT::TransformTextShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
void PCB_TEXT::TransformTextToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer,
|
||||||
PCB_LAYER_ID aLayer, int aClearance,
|
int aClearance, int aError, ERROR_LOC aErrorLoc ) const
|
||||||
int aError, ERROR_LOC aErrorLoc ) const
|
|
||||||
{
|
{
|
||||||
KIGFX::GAL_DISPLAY_OPTIONS empty_opts;
|
KIGFX::GAL_DISPLAY_OPTIONS empty_opts;
|
||||||
KIFONT::FONT* font = GetDrawFont();
|
KIFONT::FONT* font = GetDrawFont();
|
||||||
|
@ -303,7 +302,7 @@ void PCB_TEXT::TransformTextShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCorner
|
||||||
// Stroke callback
|
// Stroke callback
|
||||||
[&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2 )
|
[&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2 )
|
||||||
{
|
{
|
||||||
TransformOvalToPolygon( aCornerBuffer, aPt1, aPt2, penWidth+ ( 2 * aClearance ),
|
TransformOvalToPolygon( aBuffer, aPt1, aPt2, penWidth + ( 2 * aClearance ),
|
||||||
aError, ERROR_INSIDE );
|
aError, ERROR_INSIDE );
|
||||||
},
|
},
|
||||||
// Triangulation callback
|
// Triangulation callback
|
||||||
|
@ -318,16 +317,15 @@ void PCB_TEXT::TransformTextShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCorner
|
||||||
font->Draw( &callback_gal, GetShownText(), GetTextPos(), GetAttributes() );
|
font->Draw( &callback_gal, GetShownText(), GetTextPos(), GetAttributes() );
|
||||||
|
|
||||||
buffer.Simplify( SHAPE_POLY_SET::PM_FAST );
|
buffer.Simplify( SHAPE_POLY_SET::PM_FAST );
|
||||||
aCornerBuffer.Append( buffer );
|
aBuffer.Append( buffer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_TEXT::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
void PCB_TEXT::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer,
|
||||||
PCB_LAYER_ID aLayer, int aClearance,
|
int aClearance, int aError, ERROR_LOC aErrorLoc,
|
||||||
int aError, ERROR_LOC aErrorLoc,
|
bool aIgnoreLineWidth ) const
|
||||||
bool aIgnoreLineWidth ) const
|
|
||||||
{
|
{
|
||||||
EDA_TEXT::TransformBoundingBoxWithClearanceToPolygon( &aCornerBuffer, aClearance );
|
EDA_TEXT::TransformBoundingBoxToPolygon( &aBuffer, aClearance );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -115,25 +115,25 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function TransformTextShapeWithClearanceToPolygon
|
* Function TransformTextToPolySet
|
||||||
* Convert the text to a polygonSet describing the actual character strokes (one per segment).
|
* Convert the text to a polygonSet describing the actual character strokes (one per segment).
|
||||||
* Used in 3D viewer
|
* Used in 3D viewer
|
||||||
* Circles and arcs are approximated by segments
|
* Circles and arcs are approximated by segments
|
||||||
* @aCornerBuffer = SHAPE_POLY_SET to store the polygon corners
|
* @aBuffer = SHAPE_POLY_SET to store the polygon corners
|
||||||
* @aClearanceValue = the clearance around the text
|
* @aClearance = the clearance around the text
|
||||||
* @aError = the maximum error to allow when approximating curves
|
* @aError = the maximum error to allow when approximating curves
|
||||||
*/
|
*/
|
||||||
void TransformTextShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
void TransformTextToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
|
||||||
PCB_LAYER_ID aLayer, int aClearanceValue,
|
int aError, ERROR_LOC aErrorLoc ) const;
|
||||||
int aError, ERROR_LOC aErrorLoc ) const;
|
|
||||||
|
|
||||||
void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, PCB_LAYER_ID aLayer,
|
void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
|
||||||
int aClearanceValue, int aError, ERROR_LOC aErrorLoc,
|
int aError, ERROR_LOC aErrorLoc,
|
||||||
bool aIgnoreLineWidth = false ) const override;
|
bool aIgnoreLineWidth = false ) const override;
|
||||||
|
|
||||||
// @copydoc BOARD_ITEM::GetEffectiveShape
|
// @copydoc BOARD_ITEM::GetEffectiveShape
|
||||||
virtual std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
|
virtual std::shared_ptr<SHAPE>
|
||||||
FLASHING aFlash = FLASHING::DEFAULT ) const override;
|
GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
|
||||||
|
FLASHING aFlash = FLASHING::DEFAULT ) const override;
|
||||||
|
|
||||||
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
|
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||||
|
|
||||||
|
|
|
@ -447,9 +447,8 @@ std::shared_ptr<SHAPE> PCB_TEXTBOX::GetEffectiveShape( PCB_LAYER_ID aLayer, FLAS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_TEXTBOX::TransformTextShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
void PCB_TEXTBOX::TransformTextToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer,
|
||||||
PCB_LAYER_ID aLayer, int aClearance,
|
int aClearance, int aError, ERROR_LOC aErrorLoc ) const
|
||||||
int aError, ERROR_LOC aErrorLoc ) const
|
|
||||||
{
|
{
|
||||||
KIGFX::GAL_DISPLAY_OPTIONS empty_opts;
|
KIGFX::GAL_DISPLAY_OPTIONS empty_opts;
|
||||||
KIFONT::FONT* font = GetDrawFont();
|
KIFONT::FONT* font = GetDrawFont();
|
||||||
|
@ -466,8 +465,8 @@ void PCB_TEXTBOX::TransformTextShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCor
|
||||||
// Stroke callback
|
// Stroke callback
|
||||||
[&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2 )
|
[&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2 )
|
||||||
{
|
{
|
||||||
TransformOvalToPolygon( buffer, aPt1, aPt2, penWidth+ ( 2 * aClearance ),
|
TransformOvalToPolygon( buffer, aPt1, aPt2, penWidth + ( 2 * aClearance ), aError,
|
||||||
aError, ERROR_INSIDE );
|
ERROR_INSIDE );
|
||||||
},
|
},
|
||||||
// Triangulation callback
|
// Triangulation callback
|
||||||
[&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2, const VECTOR2I& aPt3 )
|
[&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2, const VECTOR2I& aPt3 )
|
||||||
|
@ -481,34 +480,33 @@ void PCB_TEXTBOX::TransformTextShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCor
|
||||||
font->Draw( &callback_gal, GetShownText(), GetDrawPos(), GetAttributes() );
|
font->Draw( &callback_gal, GetShownText(), GetDrawPos(), GetAttributes() );
|
||||||
|
|
||||||
buffer.Simplify( SHAPE_POLY_SET::PM_FAST );
|
buffer.Simplify( SHAPE_POLY_SET::PM_FAST );
|
||||||
aCornerBuffer.Append( buffer );
|
aBuffer.Append( buffer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_TEXTBOX::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
void PCB_TEXTBOX::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer,
|
||||||
PCB_LAYER_ID aLayer, int aClearance,
|
int aClearance, int aError, ERROR_LOC aErrorLoc,
|
||||||
int aError, ERROR_LOC aErrorLoc,
|
bool aIgnoreLineWidth ) const
|
||||||
bool aIgnoreLineWidth ) const
|
|
||||||
{
|
{
|
||||||
// Don't use PCB_SHAPE::TransformShapeWithClearanceToPolygon. We want to treat the
|
// Don't use PCB_SHAPE::TransformShapeToPolygon. We want to treat the textbox as filled even
|
||||||
// textbox as filled even if there's no background colour.
|
// if there's no background colour.
|
||||||
|
|
||||||
std::vector<VECTOR2I> pts = GetRectCorners();
|
std::vector<VECTOR2I> pts = GetRectCorners();
|
||||||
|
|
||||||
aCornerBuffer.NewOutline();
|
aBuffer.NewOutline();
|
||||||
|
|
||||||
for( const VECTOR2I& pt : pts )
|
for( const VECTOR2I& pt : pts )
|
||||||
aCornerBuffer.Append( pt );
|
aBuffer.Append( pt );
|
||||||
|
|
||||||
int width = GetWidth() + ( 2 * aClearance );
|
int width = GetWidth() + ( 2 * aClearance );
|
||||||
|
|
||||||
if( width > 0 )
|
if( width > 0 )
|
||||||
{
|
{
|
||||||
// Add in segments
|
// Add in segments
|
||||||
TransformOvalToPolygon( aCornerBuffer, pts[0], pts[1], width, aError, aErrorLoc );
|
TransformOvalToPolygon( aBuffer, pts[0], pts[1], width, aError, aErrorLoc );
|
||||||
TransformOvalToPolygon( aCornerBuffer, pts[1], pts[2], width, aError, aErrorLoc );
|
TransformOvalToPolygon( aBuffer, pts[1], pts[2], width, aError, aErrorLoc );
|
||||||
TransformOvalToPolygon( aCornerBuffer, pts[2], pts[3], width, aError, aErrorLoc );
|
TransformOvalToPolygon( aBuffer, pts[2], pts[3], width, aError, aErrorLoc );
|
||||||
TransformOvalToPolygon( aCornerBuffer, pts[3], pts[0], width, aError, aErrorLoc );
|
TransformOvalToPolygon( aBuffer, pts[3], pts[0], width, aError, aErrorLoc );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -107,25 +107,25 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function TransformTextShapeWithClearanceToPolygon
|
* Function TransformTextToPolySet
|
||||||
* Convert the text to a polygonSet describing the actual character strokes (one per segment).
|
* Convert the text to a polygonSet describing the actual character strokes (one per segment).
|
||||||
* Used in 3D viewer
|
* Used in 3D viewer
|
||||||
* Circles and arcs are approximated by segments
|
* Circles and arcs are approximated by segments
|
||||||
* @aCornerBuffer = SHAPE_POLY_SET to store the polygon corners
|
* @aBuffer = SHAPE_POLY_SET to store the polygon corners
|
||||||
* @aClearanceValue = the clearance around the text
|
* @aClearance = the clearance around the text
|
||||||
* @aError = the maximum error to allow when approximating curves
|
* @aError = the maximum error to allow when approximating curves
|
||||||
*/
|
*/
|
||||||
void TransformTextShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
void TransformTextToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
|
||||||
PCB_LAYER_ID aLayer, int aClearanceValue,
|
int aError, ERROR_LOC aErrorLoc ) const;
|
||||||
int aError, ERROR_LOC aErrorLoc ) const;
|
|
||||||
|
|
||||||
void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, PCB_LAYER_ID aLayer,
|
void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
|
||||||
int aClearanceValue, int aError, ERROR_LOC aErrorLoc,
|
int aError, ERROR_LOC aErrorLoc,
|
||||||
bool aIgnoreLineWidth = false ) const override;
|
bool aIgnoreLineWidth = false ) const override;
|
||||||
|
|
||||||
// @copydoc BOARD_ITEM::GetEffectiveShape
|
// @copydoc BOARD_ITEM::GetEffectiveShape
|
||||||
virtual std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
|
virtual std::shared_ptr<SHAPE>
|
||||||
FLASHING aFlash = FLASHING::DEFAULT ) const override;
|
GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
|
||||||
|
FLASHING aFlash = FLASHING::DEFAULT ) const override;
|
||||||
|
|
||||||
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
|
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||||
|
|
||||||
|
|
|
@ -1167,10 +1167,9 @@ std::shared_ptr<SHAPE> PCB_ARC::GetEffectiveShape( PCB_LAYER_ID aLayer, FLASHING
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_TRACK::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
void PCB_TRACK::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer,
|
||||||
PCB_LAYER_ID aLayer, int aClearanceValue,
|
int aClearance, int aError, ERROR_LOC aErrorLoc,
|
||||||
int aError, ERROR_LOC aErrorLoc,
|
bool ignoreLineWidth ) const
|
||||||
bool ignoreLineWidth ) const
|
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( !ignoreLineWidth, wxT( "IgnoreLineWidth has no meaning for tracks." ) );
|
wxASSERT_MSG( !ignoreLineWidth, wxT( "IgnoreLineWidth has no meaning for tracks." ) );
|
||||||
|
|
||||||
|
@ -1179,26 +1178,26 @@ void PCB_TRACK::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf
|
||||||
{
|
{
|
||||||
case PCB_VIA_T:
|
case PCB_VIA_T:
|
||||||
{
|
{
|
||||||
int radius = ( m_Width / 2 ) + aClearanceValue;
|
int radius = ( m_Width / 2 ) + aClearance;
|
||||||
TransformCircleToPolygon( aCornerBuffer, m_Start, radius, aError, aErrorLoc );
|
TransformCircleToPolygon( aBuffer, m_Start, radius, aError, aErrorLoc );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case PCB_ARC_T:
|
case PCB_ARC_T:
|
||||||
{
|
{
|
||||||
const PCB_ARC* arc = static_cast<const PCB_ARC*>( this );
|
const PCB_ARC* arc = static_cast<const PCB_ARC*>( this );
|
||||||
int width = m_Width + ( 2 * aClearanceValue );
|
int width = m_Width + ( 2 * aClearance );
|
||||||
|
|
||||||
TransformArcToPolygon( aCornerBuffer, arc->GetStart(), arc->GetMid(),
|
TransformArcToPolygon( aBuffer, arc->GetStart(), arc->GetMid(), arc->GetEnd(), width,
|
||||||
arc->GetEnd(), width, aError, aErrorLoc );
|
aError, aErrorLoc );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
int width = m_Width + ( 2 * aClearanceValue );
|
int width = m_Width + ( 2 * aClearance );
|
||||||
|
|
||||||
TransformOvalToPolygon( aCornerBuffer, m_Start, m_End, width, aError, aErrorLoc );
|
TransformOvalToPolygon( aBuffer, m_Start, m_End, width, aError, aErrorLoc );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,20 +137,19 @@ public:
|
||||||
virtual double GetLength() const;
|
virtual double GetLength() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function TransformShapeWithClearanceToPolygon
|
* Function TransformShapeToPolygon
|
||||||
* Convert the track shape to a closed polygon
|
* Convert the track shape to a closed polygon
|
||||||
* Used in filling zones calculations
|
* Used in filling zones calculations
|
||||||
* Circles (vias) and arcs (ends of tracks) are approximated by segments
|
* Circles (vias) and arcs (ends of tracks) are approximated by segments
|
||||||
* @param aCornerBuffer = a buffer to store the polygon
|
* @param aBuffer = a buffer to store the polygon
|
||||||
* @param aClearanceValue = the clearance around the pad
|
* @param aClearance = the clearance around the pad
|
||||||
* @param aError = the maximum deviation from true circle
|
* @param aError = the maximum deviation from true circle
|
||||||
* @param ignoreLineWidth = used for edge cut items where the line width is only
|
* @param ignoreLineWidth = used for edge cut items where the line width is only for
|
||||||
* for visualization
|
* visualization
|
||||||
*/
|
*/
|
||||||
void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
|
||||||
PCB_LAYER_ID aLayer, int aClearanceValue,
|
int aError, ERROR_LOC aErrorLoc,
|
||||||
int aError, ERROR_LOC aErrorLoc,
|
bool ignoreLineWidth = false ) const override;
|
||||||
bool ignoreLineWidth = false ) const override;
|
|
||||||
|
|
||||||
// @copydoc BOARD_ITEM::GetEffectiveShape
|
// @copydoc BOARD_ITEM::GetEffectiveShape
|
||||||
virtual std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
|
virtual std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
|
||||||
|
|
|
@ -466,8 +466,8 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask,
|
||||||
SHAPE_POLY_SET outline;
|
SHAPE_POLY_SET outline;
|
||||||
int maxError = aBoard->GetDesignSettings().m_MaxError;
|
int maxError = aBoard->GetDesignSettings().m_MaxError;
|
||||||
int numSegs = GetArcToSegmentCount( mask_clearance, maxError, FULL_CIRCLE );
|
int numSegs = GetArcToSegmentCount( mask_clearance, maxError, FULL_CIRCLE );
|
||||||
dummy.TransformShapeWithClearanceToPolygon( outline, UNDEFINED_LAYER, 0,
|
dummy.TransformShapeToPolygon( outline, UNDEFINED_LAYER, 0, maxError,
|
||||||
maxError, ERROR_INSIDE );
|
ERROR_INSIDE );
|
||||||
outline.InflateWithLinkedHoles( mask_clearance, numSegs,
|
outline.InflateWithLinkedHoles( mask_clearance, numSegs,
|
||||||
SHAPE_POLY_SET::PM_FAST );
|
SHAPE_POLY_SET::PM_FAST );
|
||||||
|
|
||||||
|
@ -846,23 +846,19 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
|
||||||
for( const FOOTPRINT* footprint : aBoard->Footprints() )
|
for( const FOOTPRINT* footprint : aBoard->Footprints() )
|
||||||
{
|
{
|
||||||
// add shapes with their exact mask layer size in initialPolys
|
// add shapes with their exact mask layer size in initialPolys
|
||||||
footprint->TransformPadsWithClearanceToPolygon( initialPolys, layer, 0, maxError,
|
footprint->TransformPadsToPolySet( initialPolys, layer, 0, maxError, ERROR_OUTSIDE );
|
||||||
ERROR_OUTSIDE );
|
|
||||||
// add shapes inflated by aMinThickness/2 in areas
|
// add shapes inflated by aMinThickness/2 in areas
|
||||||
footprint->TransformPadsWithClearanceToPolygon( areas, layer, inflate, maxError,
|
footprint->TransformPadsToPolySet( areas, layer, inflate, maxError, ERROR_OUTSIDE );
|
||||||
ERROR_OUTSIDE );
|
|
||||||
|
|
||||||
for( const BOARD_ITEM* item : footprint->GraphicalItems() )
|
for( const BOARD_ITEM* item : footprint->GraphicalItems() )
|
||||||
{
|
{
|
||||||
if( item->Type() == PCB_FP_SHAPE_T && item->IsOnLayer( layer ) )
|
if( item->Type() == PCB_FP_SHAPE_T && item->IsOnLayer( layer ) )
|
||||||
{
|
{
|
||||||
// add shapes with their exact mask layer size in initialPolys
|
// add shapes with their exact mask layer size in initialPolys
|
||||||
item->TransformShapeWithClearanceToPolygon( initialPolys, layer, 0, maxError,
|
item->TransformShapeToPolygon( initialPolys, layer, 0, maxError, ERROR_OUTSIDE );
|
||||||
ERROR_OUTSIDE );
|
|
||||||
|
|
||||||
// add shapes inflated by aMinThickness/2 in areas
|
// add shapes inflated by aMinThickness/2 in areas
|
||||||
item->TransformShapeWithClearanceToPolygon( areas, layer, inflate, maxError,
|
item->TransformShapeToPolygon( areas, layer, inflate, maxError, ERROR_OUTSIDE );
|
||||||
ERROR_OUTSIDE );
|
|
||||||
}
|
}
|
||||||
else if( item->Type() == PCB_FP_SHAPE_T && item->IsOnLayer( Edge_Cuts ) )
|
else if( item->Type() == PCB_FP_SHAPE_T && item->IsOnLayer( Edge_Cuts ) )
|
||||||
{
|
{
|
||||||
|
@ -880,15 +876,14 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
|
||||||
if( !via || !via->IsOnLayer( layer ) )
|
if( !via || !via->IsOnLayer( layer ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int clearance = via->GetSolderMaskExpansion();
|
int clearance = via->GetSolderMaskExpansion();
|
||||||
|
|
||||||
// add shapes with their exact mask layer size in initialPolys
|
// add shapes with their exact mask layer size in initialPolys
|
||||||
via->TransformShapeWithClearanceToPolygon( initialPolys, layer, clearance, maxError,
|
via->TransformShapeToPolygon( initialPolys, layer, clearance, maxError, ERROR_OUTSIDE );
|
||||||
ERROR_OUTSIDE );
|
|
||||||
|
|
||||||
// add shapes inflated by aMinThickness/2 in areas
|
// add shapes inflated by aMinThickness/2 in areas
|
||||||
via->TransformShapeWithClearanceToPolygon( areas, layer, clearance + inflate, maxError,
|
clearance += inflate;
|
||||||
ERROR_OUTSIDE );
|
via->TransformShapeToPolygon( areas, layer, clearance, maxError, ERROR_OUTSIDE );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add filled zone areas.
|
// Add filled zone areas.
|
||||||
|
@ -903,11 +898,9 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
|
||||||
if( item->IsOnLayer( layer ) )
|
if( item->IsOnLayer( layer ) )
|
||||||
{
|
{
|
||||||
// add shapes with their exact mask layer size in initialPolys
|
// add shapes with their exact mask layer size in initialPolys
|
||||||
item->TransformShapeWithClearanceToPolygon( initialPolys, layer, 0, maxError,
|
item->TransformShapeToPolygon( initialPolys, layer, 0, maxError, ERROR_OUTSIDE );
|
||||||
ERROR_OUTSIDE );
|
|
||||||
// add shapes inflated by aMinThickness/2 in areas
|
// add shapes inflated by aMinThickness/2 in areas
|
||||||
item->TransformShapeWithClearanceToPolygon( areas, layer, inflate, maxError,
|
item->TransformShapeToPolygon( areas, layer, inflate, maxError, ERROR_OUTSIDE );
|
||||||
ERROR_OUTSIDE );
|
|
||||||
}
|
}
|
||||||
else if( item->IsOnLayer( Edge_Cuts ) )
|
else if( item->IsOnLayer( Edge_Cuts ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -827,7 +827,7 @@ void BRDITEMS_PLOTTER::PlotPcbText( const EDA_TEXT* aText, PCB_LAYER_ID aLayer,
|
||||||
int margin = attrs.m_StrokeWidth * 1.5
|
int margin = attrs.m_StrokeWidth * 1.5
|
||||||
+ GetKnockoutTextMargin( attrs.m_Size, attrs.m_StrokeWidth );
|
+ GetKnockoutTextMargin( attrs.m_Size, attrs.m_StrokeWidth );
|
||||||
|
|
||||||
aText->TransformBoundingBoxWithClearanceToPolygon( &finalPoly, margin );
|
aText->TransformBoundingBoxToPolygon( &finalPoly, margin );
|
||||||
finalPoly.BooleanSubtract( knockouts, SHAPE_POLY_SET::PM_FAST );
|
finalPoly.BooleanSubtract( knockouts, SHAPE_POLY_SET::PM_FAST );
|
||||||
finalPoly.Fracture( SHAPE_POLY_SET::PM_FAST );
|
finalPoly.Fracture( SHAPE_POLY_SET::PM_FAST );
|
||||||
|
|
||||||
|
|
|
@ -3459,8 +3459,7 @@ void ALTIUM_PCB::HelperPcpShapeAsBoardKeepoutRegion( const PCB_SHAPE& aShape,
|
||||||
HelperSetZoneLayers( zone, aAltiumLayer );
|
HelperSetZoneLayers( zone, aAltiumLayer );
|
||||||
HelperSetZoneKeepoutRestrictions( zone, aKeepoutRestrictions );
|
HelperSetZoneKeepoutRestrictions( zone, aKeepoutRestrictions );
|
||||||
|
|
||||||
aShape.EDA_SHAPE::TransformShapeWithClearanceToPolygon( *zone->Outline(), 0, ARC_HIGH_DEF,
|
aShape.EDA_SHAPE::TransformShapeToPolygon( *zone->Outline(), 0, ARC_HIGH_DEF, ERROR_INSIDE );
|
||||||
ERROR_INSIDE, false );
|
|
||||||
|
|
||||||
zone->SetBorderDisplayStyle( ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE,
|
zone->SetBorderDisplayStyle( ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE,
|
||||||
ZONE::GetDefaultHatchPitch(), true );
|
ZONE::GetDefaultHatchPitch(), true );
|
||||||
|
@ -3481,8 +3480,7 @@ void ALTIUM_PCB::HelperPcpShapeAsFootprintKeepoutRegion( FOOTPRINT* aFoo
|
||||||
HelperSetZoneLayers( zone, aAltiumLayer );
|
HelperSetZoneLayers( zone, aAltiumLayer );
|
||||||
HelperSetZoneKeepoutRestrictions( zone, aKeepoutRestrictions );
|
HelperSetZoneKeepoutRestrictions( zone, aKeepoutRestrictions );
|
||||||
|
|
||||||
aShape.EDA_SHAPE::TransformShapeWithClearanceToPolygon( *zone->Outline(), 0, ARC_HIGH_DEF,
|
aShape.EDA_SHAPE::TransformShapeToPolygon( *zone->Outline(), 0, ARC_HIGH_DEF, ERROR_INSIDE );
|
||||||
ERROR_INSIDE, false );
|
|
||||||
|
|
||||||
zone->SetBorderDisplayStyle( ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE,
|
zone->SetBorderDisplayStyle( ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE,
|
||||||
ZONE::GetDefaultHatchPitch(), true );
|
ZONE::GetDefaultHatchPitch(), true );
|
||||||
|
|
|
@ -1174,8 +1174,7 @@ PAD* CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad( const COMPONENT_PAD& aCadstarPad,
|
||||||
|
|
||||||
pad->SetPosition( { 0, 0 } );
|
pad->SetPosition( { 0, 0 } );
|
||||||
pad->SetPos0( { 0, 0 } );
|
pad->SetPos0( { 0, 0 } );
|
||||||
pad->TransformShapeWithClearanceToPolygon( padOutline, layer, 0, maxError,
|
pad->TransformShapeToPolygon( padOutline, layer, 0, maxError, ERROR_INSIDE );
|
||||||
ERROR_LOC::ERROR_INSIDE );
|
|
||||||
|
|
||||||
PCB_SHAPE* padShape = new PCB_SHAPE;
|
PCB_SHAPE* padShape = new PCB_SHAPE;
|
||||||
padShape->SetShape( SHAPE_T::POLY );
|
padShape->SetShape( SHAPE_T::POLY );
|
||||||
|
|
|
@ -1180,7 +1180,7 @@ bool PNS_KICAD_IFACE_BASE::syncTextItem( PNS::NODE* aWorld, EDA_TEXT* aText, PCB
|
||||||
SHAPE_POLY_SET outline;
|
SHAPE_POLY_SET outline;
|
||||||
SHAPE_SIMPLE* shape = new SHAPE_SIMPLE();
|
SHAPE_SIMPLE* shape = new SHAPE_SIMPLE();
|
||||||
|
|
||||||
aText->TransformBoundingBoxWithClearanceToPolygon( &outline, 0 );
|
aText->TransformBoundingBoxToPolygon( &outline, 0 );
|
||||||
|
|
||||||
for( auto iter = outline.CIterate( 0 ); iter; iter++ )
|
for( auto iter = outline.CIterate( 0 ); iter; iter++ )
|
||||||
shape->Append( *iter );
|
shape->Append( *iter );
|
||||||
|
|
|
@ -438,8 +438,7 @@ bool TEARDROP_MANAGER::ComputePointsOnPadVia( TEARDROP_PARAMETERS* aCurrParams,
|
||||||
force_clip_shape = true;
|
force_clip_shape = true;
|
||||||
|
|
||||||
preferred_height = aViaPad.m_Width * aCurrParams->m_HeightRatio;
|
preferred_height = aViaPad.m_Width * aCurrParams->m_HeightRatio;
|
||||||
pad->TransformShapeWithClearanceToPolygon( c_buffer, aTrack->GetLayer(), 0,
|
pad->TransformShapeToPolygon( c_buffer, aTrack->GetLayer(), 0, ARC_LOW_DEF, ERROR_INSIDE );
|
||||||
ARC_LOW_DEF, ERROR_INSIDE );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clip the pad/via shape to match the m_TdMaxHeight constraint, and for
|
// Clip the pad/via shape to match the m_TdMaxHeight constraint, and for
|
||||||
|
@ -619,8 +618,8 @@ bool TEARDROP_MANAGER::findAnchorPointsOnTrack( TEARDROP_PARAMETERS* aCurrParams
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PAD* pad = static_cast<PAD*>( aViaPad.m_Parent );
|
PAD* pad = static_cast<PAD*>( aViaPad.m_Parent );
|
||||||
pad->TransformShapeWithClearanceToPolygon( shapebuffer, aTrack->GetLayer(), 0,
|
pad->TransformShapeToPolygon( shapebuffer, aTrack->GetLayer(), 0,
|
||||||
ARC_LOW_DEF, ERROR_INSIDE );
|
ARC_LOW_DEF, ERROR_INSIDE );
|
||||||
}
|
}
|
||||||
|
|
||||||
SHAPE_LINE_CHAIN& outline = shapebuffer.Outline(0);
|
SHAPE_LINE_CHAIN& outline = shapebuffer.Outline(0);
|
||||||
|
|
|
@ -559,9 +559,8 @@ SHAPE_POLY_SET CONVERT_TOOL::makePolysFromGraphics( const std::deque<EDA_ITEM*>&
|
||||||
if( aIgnoreLineWidths )
|
if( aIgnoreLineWidths )
|
||||||
temp->SetFilled( true );
|
temp->SetFilled( true );
|
||||||
|
|
||||||
temp->TransformShapeWithClearanceToPolygon( poly, UNDEFINED_LAYER, 0,
|
temp->TransformShapeToPolygon( poly, UNDEFINED_LAYER, 0, bds.m_MaxError, ERROR_INSIDE,
|
||||||
bds.m_MaxError, ERROR_INSIDE,
|
aIgnoreLineWidths );
|
||||||
aIgnoreLineWidths );
|
|
||||||
item->SetFlags( SKIP_STRUCT );
|
item->SetFlags( SKIP_STRUCT );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -718,8 +718,7 @@ std::vector<FP_SHAPE*> PAD_TOOL::RecombinePad( PAD* aPad, bool aIsDryRun, BOARD_
|
||||||
[&]( PCB_LAYER_ID aLayer ) -> FP_SHAPE*
|
[&]( PCB_LAYER_ID aLayer ) -> FP_SHAPE*
|
||||||
{
|
{
|
||||||
SHAPE_POLY_SET padPoly;
|
SHAPE_POLY_SET padPoly;
|
||||||
aPad->TransformShapeWithClearanceToPolygon( padPoly, aLayer, 0, maxError,
|
aPad->TransformShapeToPolygon( padPoly, aLayer, 0, maxError, ERROR_INSIDE );
|
||||||
ERROR_INSIDE );
|
|
||||||
|
|
||||||
for( BOARD_ITEM* item : footprint->GraphicalItems() )
|
for( BOARD_ITEM* item : footprint->GraphicalItems() )
|
||||||
{
|
{
|
||||||
|
@ -735,8 +734,7 @@ std::vector<FP_SHAPE*> PAD_TOOL::RecombinePad( PAD* aPad, bool aIsDryRun, BOARD_
|
||||||
return (FP_SHAPE*) item;
|
return (FP_SHAPE*) item;
|
||||||
|
|
||||||
SHAPE_POLY_SET drawPoly;
|
SHAPE_POLY_SET drawPoly;
|
||||||
shape->TransformShapeWithClearanceToPolygon( drawPoly, aLayer, 0, maxError,
|
shape->TransformShapeToPolygon( drawPoly, aLayer, 0, maxError, ERROR_INSIDE );
|
||||||
ERROR_INSIDE );
|
|
||||||
drawPoly.BooleanIntersection( padPoly, SHAPE_POLY_SET::PM_FAST );
|
drawPoly.BooleanIntersection( padPoly, SHAPE_POLY_SET::PM_FAST );
|
||||||
|
|
||||||
if( !drawPoly.IsEmpty() )
|
if( !drawPoly.IsEmpty() )
|
||||||
|
@ -799,10 +797,10 @@ std::vector<FP_SHAPE*> PAD_TOOL::RecombinePad( PAD* aPad, bool aIsDryRun, BOARD_
|
||||||
// Create a new minimally-sized circular anchor and convert existing pad
|
// Create a new minimally-sized circular anchor and convert existing pad
|
||||||
// to a polygon primitive
|
// to a polygon primitive
|
||||||
SHAPE_POLY_SET existingOutline;
|
SHAPE_POLY_SET existingOutline;
|
||||||
aPad->TransformShapeWithClearanceToPolygon( existingOutline, layer, 0, maxError,
|
aPad->TransformShapeToPolygon( existingOutline, layer, 0, maxError, ERROR_INSIDE );
|
||||||
ERROR_INSIDE );
|
|
||||||
|
|
||||||
aPad->SetAnchorPadShape( PAD_SHAPE::CIRCLE );
|
aPad->SetAnchorPadShape( PAD_SHAPE::CIRCLE );
|
||||||
|
|
||||||
if( aPad->GetSizeX() > aPad->GetSizeY() )
|
if( aPad->GetSizeX() > aPad->GetSizeY() )
|
||||||
aPad->SetSizeX( aPad->GetSizeY() );
|
aPad->SetSizeX( aPad->GetSizeY() );
|
||||||
|
|
||||||
|
|
|
@ -325,8 +325,8 @@ void TRACKS_CLEANER::deleteTracksInPads()
|
||||||
if( pad->HitTest( track->GetStart() ) && pad->HitTest( track->GetEnd() ) )
|
if( pad->HitTest( track->GetStart() ) && pad->HitTest( track->GetEnd() ) )
|
||||||
{
|
{
|
||||||
SHAPE_POLY_SET poly;
|
SHAPE_POLY_SET poly;
|
||||||
track->TransformShapeWithClearanceToPolygon( poly, track->GetLayer(), 0,
|
track->TransformShapeToPolygon( poly, track->GetLayer(), 0, ARC_HIGH_DEF,
|
||||||
ARC_HIGH_DEF, ERROR_INSIDE );
|
ERROR_INSIDE );
|
||||||
|
|
||||||
poly.BooleanSubtract( *pad->GetEffectivePolygon(), SHAPE_POLY_SET::PM_FAST );
|
poly.BooleanSubtract( *pad->GetEffectivePolygon(), SHAPE_POLY_SET::PM_FAST );
|
||||||
|
|
||||||
|
|
|
@ -1180,7 +1180,7 @@ double ZONE::CalculateOutlineArea()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ZONE::TransformSmoothedOutlineToPolygon( SHAPE_POLY_SET& aCornerBuffer, int aClearance,
|
void ZONE::TransformSmoothedOutlineToPolygon( SHAPE_POLY_SET& aBuffer, int aClearance,
|
||||||
int aMaxError, ERROR_LOC aErrorLoc,
|
int aMaxError, ERROR_LOC aErrorLoc,
|
||||||
SHAPE_POLY_SET* aBoardOutline ) const
|
SHAPE_POLY_SET* aBoardOutline ) const
|
||||||
{
|
{
|
||||||
|
@ -1209,7 +1209,7 @@ void ZONE::TransformSmoothedOutlineToPolygon( SHAPE_POLY_SET& aCornerBuffer, int
|
||||||
}
|
}
|
||||||
|
|
||||||
polybuffer.Fracture( SHAPE_POLY_SET::PM_FAST );
|
polybuffer.Fracture( SHAPE_POLY_SET::PM_FAST );
|
||||||
aCornerBuffer.Append( polybuffer );
|
aBuffer.Append( polybuffer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1275,9 +1275,8 @@ std::shared_ptr<SHAPE> ZONE::GetEffectiveShape( PCB_LAYER_ID aLayer, FLASHING aF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ZONE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
void ZONE::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
|
||||||
PCB_LAYER_ID aLayer, int aClearance, int aError,
|
int aError, ERROR_LOC aErrorLoc, bool aIgnoreLineWidth ) const
|
||||||
ERROR_LOC aErrorLoc, bool aIgnoreLineWidth ) const
|
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( !aIgnoreLineWidth, wxT( "IgnoreLineWidth has no meaning for zones." ) );
|
wxASSERT_MSG( !aIgnoreLineWidth, wxT( "IgnoreLineWidth has no meaning for zones." ) );
|
||||||
|
|
||||||
|
@ -1286,7 +1285,7 @@ void ZONE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
||||||
|
|
||||||
if( !aClearance )
|
if( !aClearance )
|
||||||
{
|
{
|
||||||
aCornerBuffer.Append( *m_FilledPolysList.at( aLayer ) );
|
aBuffer.Append( *m_FilledPolysList.at( aLayer ) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1300,15 +1299,14 @@ void ZONE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
||||||
|
|
||||||
temp_buf.InflateWithLinkedHoles( aClearance, numSegs, SHAPE_POLY_SET::PM_FAST );
|
temp_buf.InflateWithLinkedHoles( aClearance, numSegs, SHAPE_POLY_SET::PM_FAST );
|
||||||
|
|
||||||
aCornerBuffer.Append( temp_buf );
|
aBuffer.Append( temp_buf );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ZONE::TransformSolidAreasShapesToPolygon( PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aCornerBuffer,
|
void ZONE::TransformSolidAreasShapesToPolygon( PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aBuffer ) const
|
||||||
int aError ) const
|
|
||||||
{
|
{
|
||||||
if( m_FilledPolysList.count( aLayer ) && !m_FilledPolysList.at( aLayer )->IsEmpty() )
|
if( m_FilledPolysList.count( aLayer ) && !m_FilledPolysList.at( aLayer )->IsEmpty() )
|
||||||
aCornerBuffer.Append( *m_FilledPolysList.at( aLayer ) );
|
aBuffer.Append( *m_FilledPolysList.at( aLayer ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -361,11 +361,10 @@ public:
|
||||||
* Arcs (ends of segments) are approximated by segments
|
* Arcs (ends of segments) are approximated by segments
|
||||||
*
|
*
|
||||||
* @param aLayer is the layer of the zone to retrieve
|
* @param aLayer is the layer of the zone to retrieve
|
||||||
* @param aCornerBuffer = a buffer to store the polygons
|
* @param aBuffer = a buffer to store the polygons
|
||||||
* @param aError = Maximum error allowed between true arc and polygon approx
|
* @param aError = Maximum error allowed between true arc and polygon approx
|
||||||
*/
|
*/
|
||||||
void TransformSolidAreasShapesToPolygon( PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aCornerBuffer,
|
void TransformSolidAreasShapesToPolygon( PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aBuffer ) const;
|
||||||
int aError = ARC_HIGH_DEF ) const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert the outlines shape to a polygon with no holes
|
* Convert the outlines shape to a polygon with no holes
|
||||||
|
@ -374,11 +373,11 @@ public:
|
||||||
* Used in filling zones calculations
|
* Used in filling zones calculations
|
||||||
* Circles (vias) and arcs (ends of tracks) are approximated by segments.
|
* Circles (vias) and arcs (ends of tracks) are approximated by segments.
|
||||||
*
|
*
|
||||||
* @param aCornerBuffer is a buffer to store the polygon
|
* @param aBuffer is a buffer to store the polygon
|
||||||
* @param aClearance is the min clearance around outlines
|
* @param aClearance is the min clearance around outlines
|
||||||
* @param aBoardOutline is the board outline (if a valid one exists; nullptr otherwise)
|
* @param aBoardOutline is the board outline (if a valid one exists; nullptr otherwise)
|
||||||
*/
|
*/
|
||||||
void TransformSmoothedOutlineToPolygon( SHAPE_POLY_SET& aCornerBuffer, int aClearance,
|
void TransformSmoothedOutlineToPolygon( SHAPE_POLY_SET& aBuffer, int aClearance,
|
||||||
int aError, ERROR_LOC aErrorLoc,
|
int aError, ERROR_LOC aErrorLoc,
|
||||||
SHAPE_POLY_SET* aBoardOutline ) const;
|
SHAPE_POLY_SET* aBoardOutline ) const;
|
||||||
|
|
||||||
|
@ -388,16 +387,15 @@ public:
|
||||||
* Circles and arcs are approximated by segments
|
* Circles and arcs are approximated by segments
|
||||||
*
|
*
|
||||||
* @param aLayer is the layer of the filled zone to retrieve
|
* @param aLayer is the layer of the filled zone to retrieve
|
||||||
* @param aCornerBuffer is a buffer to store the polygon
|
* @param aBuffer is a buffer to store the polygon
|
||||||
* @param aClearanceValue is the clearance around the pad
|
* @param aClearance is the clearance around the pad
|
||||||
* @param aError is the maximum deviation from true circle
|
* @param aError is the maximum deviation from true circle
|
||||||
* @param ignoreLineWidth is used for edge cut items where the line width is only
|
* @param ignoreLineWidth is used for edge cut items where the line width is only for
|
||||||
* for visualization
|
* visualization
|
||||||
*/
|
*/
|
||||||
void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer,
|
||||||
PCB_LAYER_ID aLayer, int aClearanceValue,
|
int aClearance, int aError, ERROR_LOC aErrorLoc,
|
||||||
int aError, ERROR_LOC aErrorLoc,
|
bool ignoreLineWidth = false ) const override;
|
||||||
bool ignoreLineWidth = false ) const override;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test if the given VECTOR2I is near a corner.
|
* Test if the given VECTOR2I is near a corner.
|
||||||
|
|
|
@ -583,8 +583,7 @@ void ZONE_FILLER::addKnockout( PAD* aPad, PCB_LAYER_ID aLayer, int aGap, SHAPE_P
|
||||||
if( aPad->GetShape() == PAD_SHAPE::CUSTOM )
|
if( aPad->GetShape() == PAD_SHAPE::CUSTOM )
|
||||||
{
|
{
|
||||||
SHAPE_POLY_SET poly;
|
SHAPE_POLY_SET poly;
|
||||||
aPad->TransformShapeWithClearanceToPolygon( poly, aLayer, aGap, m_maxError,
|
aPad->TransformShapeToPolygon( poly, aLayer, aGap, m_maxError, ERROR_OUTSIDE );
|
||||||
ERROR_OUTSIDE );
|
|
||||||
|
|
||||||
// the pad shape in zone can be its convex hull or the shape itself
|
// the pad shape in zone can be its convex hull or the shape itself
|
||||||
if( aPad->GetCustomShapeInZoneOpt() == CUST_PAD_SHAPE_IN_ZONE_CONVEXHULL )
|
if( aPad->GetCustomShapeInZoneOpt() == CUST_PAD_SHAPE_IN_ZONE_CONVEXHULL )
|
||||||
|
@ -602,8 +601,7 @@ void ZONE_FILLER::addKnockout( PAD* aPad, PCB_LAYER_ID aLayer, int aGap, SHAPE_P
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
aPad->TransformShapeWithClearanceToPolygon( aHoles, aLayer, aGap, m_maxError,
|
aPad->TransformShapeToPolygon( aHoles, aLayer, aGap, m_maxError, ERROR_OUTSIDE );
|
||||||
ERROR_OUTSIDE );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -613,7 +611,7 @@ void ZONE_FILLER::addKnockout( PAD* aPad, PCB_LAYER_ID aLayer, int aGap, SHAPE_P
|
||||||
*/
|
*/
|
||||||
void ZONE_FILLER::addHoleKnockout( PAD* aPad, int aGap, SHAPE_POLY_SET& aHoles )
|
void ZONE_FILLER::addHoleKnockout( PAD* aPad, int aGap, SHAPE_POLY_SET& aHoles )
|
||||||
{
|
{
|
||||||
aPad->TransformHoleWithClearanceToPolygon( aHoles, aGap, m_maxError, ERROR_OUTSIDE );
|
aPad->TransformHoleToPolygon( aHoles, aGap, m_maxError, ERROR_OUTSIDE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -646,15 +644,15 @@ void ZONE_FILLER::addKnockout( BOARD_ITEM* aItem, PCB_LAYER_ID aLayer, int aGap,
|
||||||
case PCB_FP_TEXTBOX_T:
|
case PCB_FP_TEXTBOX_T:
|
||||||
case PCB_FP_SHAPE_T:
|
case PCB_FP_SHAPE_T:
|
||||||
case PCB_TARGET_T:
|
case PCB_TARGET_T:
|
||||||
aItem->TransformShapeWithClearanceToPolygon( aHoles, aLayer, aGap, m_maxError,
|
aItem->TransformShapeToPolygon( aHoles, aLayer, aGap, m_maxError, ERROR_OUTSIDE,
|
||||||
ERROR_OUTSIDE, aIgnoreLineWidth );
|
aIgnoreLineWidth );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCB_FP_TEXT_T:
|
case PCB_FP_TEXT_T:
|
||||||
if( text->IsVisible() )
|
if( text->IsVisible() )
|
||||||
{
|
{
|
||||||
aItem->TransformShapeWithClearanceToPolygon( aHoles, aLayer, aGap, m_maxError,
|
aItem->TransformShapeToPolygon( aHoles, aLayer, aGap, m_maxError, ERROR_OUTSIDE,
|
||||||
ERROR_OUTSIDE, aIgnoreLineWidth );
|
aIgnoreLineWidth );
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -746,14 +744,9 @@ void ZONE_FILLER::knockoutThermalReliefs( const ZONE* aZone, PCB_LAYER_ID aLayer
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pad->FlashLayer( aLayer ) )
|
if( pad->FlashLayer( aLayer ) )
|
||||||
{
|
|
||||||
addKnockout( pad, aLayer, padClearance, holes );
|
addKnockout( pad, aLayer, padClearance, holes );
|
||||||
}
|
|
||||||
else if( pad->GetDrillSize().x > 0 )
|
else if( pad->GetDrillSize().x > 0 )
|
||||||
{
|
pad->TransformHoleToPolygon( holes, holeClearance, m_maxError, ERROR_OUTSIDE );
|
||||||
pad->TransformHoleWithClearanceToPolygon( holes, holeClearance, m_maxError,
|
|
||||||
ERROR_OUTSIDE );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -869,9 +862,8 @@ void ZONE_FILLER::buildCopperItemClearances( const ZONE* aZone, PCB_LAYER_ID aLa
|
||||||
|
|
||||||
if( via->FlashLayer( aLayer ) && gap > 0 )
|
if( via->FlashLayer( aLayer ) && gap > 0 )
|
||||||
{
|
{
|
||||||
via->TransformShapeWithClearanceToPolygon( aHoles, aLayer,
|
via->TransformShapeToPolygon( aHoles, aLayer, gap + extra_margin,
|
||||||
gap + extra_margin,
|
m_maxError, ERROR_OUTSIDE );
|
||||||
m_maxError, ERROR_OUTSIDE );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gap = std::max( gap, evalRulesForItems( PHYSICAL_HOLE_CLEARANCE_CONSTRAINT,
|
gap = std::max( gap, evalRulesForItems( PHYSICAL_HOLE_CLEARANCE_CONSTRAINT,
|
||||||
|
@ -896,10 +888,8 @@ void ZONE_FILLER::buildCopperItemClearances( const ZONE* aZone, PCB_LAYER_ID aLa
|
||||||
{
|
{
|
||||||
if( gap > 0 )
|
if( gap > 0 )
|
||||||
{
|
{
|
||||||
aTrack->TransformShapeWithClearanceToPolygon( aHoles, aLayer,
|
aTrack->TransformShapeToPolygon( aHoles, aLayer, gap + extra_margin,
|
||||||
gap + extra_margin,
|
m_maxError, ERROR_OUTSIDE );
|
||||||
m_maxError,
|
|
||||||
ERROR_OUTSIDE );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1048,10 +1038,8 @@ void ZONE_FILLER::buildCopperItemClearances( const ZONE* aZone, PCB_LAYER_ID aLa
|
||||||
aKnockout, aLayer ) );
|
aKnockout, aLayer ) );
|
||||||
|
|
||||||
SHAPE_POLY_SET poly;
|
SHAPE_POLY_SET poly;
|
||||||
aKnockout->TransformShapeWithClearanceToPolygon( poly, aLayer,
|
aKnockout->TransformShapeToPolygon( poly, aLayer, gap + extra_margin,
|
||||||
gap + extra_margin,
|
m_maxError, ERROR_OUTSIDE );
|
||||||
m_maxError,
|
|
||||||
ERROR_OUTSIDE );
|
|
||||||
aHoles.Append( poly );
|
aHoles.Append( poly );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1896,8 +1884,8 @@ bool ZONE_FILLER::addHatchFillTypeOnZone( const ZONE* aZone, PCB_LAYER_ID aLayer
|
||||||
outline_margin - min_annular_ring_width );
|
outline_margin - min_annular_ring_width );
|
||||||
|
|
||||||
clearance = std::max( 0, clearance - linethickness / 2 );
|
clearance = std::max( 0, clearance - linethickness / 2 );
|
||||||
pad->TransformShapeWithClearanceToPolygon( aprons, aLayer, clearance,
|
pad->TransformShapeToPolygon( aprons, aLayer, clearance, ARC_HIGH_DEF,
|
||||||
ARC_HIGH_DEF, ERROR_OUTSIDE );
|
ERROR_OUTSIDE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,8 +45,7 @@ void process( const BOARD_CONNECTED_ITEM* item, int net )
|
||||||
|
|
||||||
SHAPE_POLY_SET pset;
|
SHAPE_POLY_SET pset;
|
||||||
|
|
||||||
item->TransformShapeWithClearanceToPolygon( pset, UNDEFINED_LAYER, 1, ARC_HIGH_DEF,
|
item->TransformShapeToPolygon( pset, UNDEFINED_LAYER, 1, ARC_HIGH_DEF, ERROR_OUTSIDE );
|
||||||
ERROR_OUTSIDE );
|
|
||||||
|
|
||||||
SHAPE_FILE_IO shapeIo; // default = stdout
|
SHAPE_FILE_IO shapeIo; // default = stdout
|
||||||
shapeIo.Write( &pset );
|
shapeIo.Write( &pset );
|
||||||
|
|
Loading…
Reference in New Issue