Name shortening and line-break reduction.

This commit is contained in:
Jeff Young 2022-10-21 13:48:45 +01:00
parent 209ff933e7
commit d16b23d16e
57 changed files with 555 additions and 706 deletions

View File

@ -2,7 +2,7 @@
* 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) 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
* 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 );
// Helper functions to create poly contours
void buildPadOutlineAsPolygon( const PAD* aPad, SHAPE_POLY_SET& aCornerBuffer,
int aWidth) const;
void buildPadOutlineAsPolygon( const PAD* aPad, SHAPE_POLY_SET& aBuffer, int aWidth) const;
void transformFPShapesToPolygon( const FOOTPRINT* aFootprint, PCB_LAYER_ID aLayer,
SHAPE_POLY_SET& aCornerBuffer ) const;
void transformFPShapesToPolySet( const FOOTPRINT* aFootprint, PCB_LAYER_ID aLayer,
SHAPE_POLY_SET& aBuffer ) const;
public:
static CUSTOM_COLORS_LIST g_SilkscreenColors;

View File

@ -94,7 +94,7 @@ void BOARD_ADAPTER::addText( const EDA_TEXT* aText, CONTAINER_2D_BASE* aContaine
int margin = attrs.m_StrokeWidth * 1.5 +
GetKnockoutTextMargin( attrs.m_Size, attrs.m_StrokeWidth );
aText->TransformBoundingBoxWithClearanceToPolygon( &finalPoly, margin );
aText->TransformBoundingBoxToPolygon( &finalPoly, margin );
finalPoly.BooleanSubtract( knockouts, 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 );
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 };
}
else
@ -622,8 +622,8 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aConta
{
SHAPE_POLY_SET polyList;
aShape->TransformShapeWithClearanceToPolygon( polyList, UNDEFINED_LAYER, 0,
ARC_HIGH_DEF, ERROR_INSIDE );
aShape->TransformShapeToPolygon( polyList, UNDEFINED_LAYER, 0, ARC_HIGH_DEF,
ERROR_INSIDE );
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;
aShape->TransformShapeWithClearanceToPolygon( polyList, UNDEFINED_LAYER, 0,
ARC_HIGH_DEF, ERROR_INSIDE );
aShape->TransformShapeToPolygon( polyList, UNDEFINED_LAYER, 0, ARC_HIGH_DEF,
ERROR_INSIDE );
if( polyList.IsEmpty() ) // Just for caution
break;
@ -682,7 +682,7 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aConta
break;
default:
wxFAIL_MSG( wxT( "BOARD_ADAPTER::addShapeWithClearance no implementation for " )
wxFAIL_MSG( wxT( "BOARD_ADAPTER::addShape no implementation for " )
+ aShape->SHAPE_T_asString() );
break;
}

View File

@ -153,6 +153,8 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
trackList.clear();
trackList.reserve( m_board->Tracks().size() );
int maxError = m_board->GetDesignSettings().m_MaxError;
for( PCB_TRACK* track : m_board->Tracks() )
{
if( !Is3dLayerEnabled( track->GetLayer() ) ) // Skip non enabled layers
@ -183,30 +185,30 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
m_averageViaHoleDiameter /= (float)m_viaCount;
// Prepare copper layers index and containers
std::vector<PCB_LAYER_ID> layer_id;
layer_id.clear();
layer_id.reserve( m_copperLayersCount );
std::vector<PCB_LAYER_ID> layer_ids;
layer_ids.clear();
layer_ids.reserve( m_copperLayersCount );
for( unsigned i = 0; i < arrayDim( cu_seq ); ++i )
cu_seq[i] = ToLAYER_ID( B_Cu - i );
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;
layer_id.push_back( curr_layer_id );
layer_ids.push_back( layer );
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
&& m_Cfg->m_Render.engine == RENDER_ENGINE::OPENGL )
{
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" ) );
// 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
unsigned int nTracks = trackList.size();
for( unsigned int trackIdx = 0; trackIdx < nTracks; ++trackIdx )
for( const PCB_TRACK* track : trackList )
{
const PCB_TRACK *track = trackList[trackIdx];
// NOTE: Vias can be on multiple layers
if( !track->IsOnLayer( curr_layer_id ) )
if( !track->IsOnLayer( layer ) )
continue;
// Skip vias annulus when not connected on this layer (if removing is enabled)
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;
// 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
for( PCB_LAYER_ID curr_layer_id : layer_id )
for( PCB_LAYER_ID layer : layer_ids )
{
// ADD TRACKS
unsigned int nTracks = trackList.size();
@ -262,7 +259,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
{
const PCB_TRACK *track = trackList[trackIdx];
if( !track->IsOnLayer( curr_layer_id ) )
if( !track->IsOnLayer( layer ) )
continue;
// ADD VIAS and THT
@ -287,16 +284,16 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
BVH_CONTAINER_2D *layerHoleContainer = nullptr;
// 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
layerHoleContainer = new BVH_CONTAINER_2D;
m_layerHoleMap[curr_layer_id] = layerHoleContainer;
m_layerHoleMap[layer] = layerHoleContainer;
}
else
{
// found
layerHoleContainer = m_layerHoleMap[curr_layer_id];
layerHoleContainer = m_layerHoleMap[layer];
}
// Add a hole for this layer
@ -304,7 +301,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
hole_inner_radius + thickness,
*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
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
for( PCB_LAYER_ID curr_layer_id : layer_id )
for( PCB_LAYER_ID layer : layer_ids )
{
// ADD TRACKS
const unsigned int nTracks = trackList.size();
@ -338,7 +335,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
{
const PCB_TRACK *track = trackList[trackIdx];
if( !track->IsOnLayer( curr_layer_id ) )
if( !track->IsOnLayer( layer ) )
continue;
// ADD VIAS and THT
@ -356,40 +353,37 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
SHAPE_POLY_SET *layerInnerHolesPoly = nullptr;
// Check if the layer is already created
if( m_layerHoleOdPolys.find( curr_layer_id ) ==
m_layerHoleOdPolys.end() )
if( m_layerHoleOdPolys.find( layer ) == m_layerHoleOdPolys.end() )
{
// not found, create a new container
layerOuterHolesPoly = new SHAPE_POLY_SET;
m_layerHoleOdPolys[curr_layer_id] = layerOuterHolesPoly;
m_layerHoleOdPolys[layer] = layerOuterHolesPoly;
wxASSERT( m_layerHoleIdPolys.find( curr_layer_id ) ==
m_layerHoleIdPolys.end() );
wxASSERT( m_layerHoleIdPolys.find( layer ) == m_layerHoleIdPolys.end() );
layerInnerHolesPoly = new SHAPE_POLY_SET;
m_layerHoleIdPolys[curr_layer_id] = layerInnerHolesPoly;
m_layerHoleIdPolys[layer] = layerInnerHolesPoly;
}
else
{
// found
layerOuterHolesPoly = m_layerHoleOdPolys[curr_layer_id];
layerOuterHolesPoly = m_layerHoleOdPolys[layer];
wxASSERT( m_layerHoleIdPolys.find( curr_layer_id ) !=
m_layerHoleIdPolys.end() );
wxASSERT( m_layerHoleIdPolys.find( layer ) != m_layerHoleIdPolys.end() );
layerInnerHolesPoly = m_layerHoleIdPolys[curr_layer_id];
layerInnerHolesPoly = m_layerHoleIdPolys[layer];
}
const int holediameter = via->GetDrillValue();
const int hole_outer_radius = (holediameter / 2) + GetHolePlatingThickness();
TransformCircleToPolygon( *layerOuterHolesPoly, via->GetStart(),
hole_outer_radius, ARC_HIGH_DEF, ERROR_INSIDE );
hole_outer_radius, maxError, ERROR_INSIDE );
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 hole_outer_radius = (holediameter / 2) + GetHolePlatingThickness();
@ -397,17 +391,16 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
// Add through hole contours
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
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 )
{
TransformCircleToPolygon( m_throughHoleAnnularRingPolys, via->GetStart(),
hole_outer_ring_radius, ARC_HIGH_DEF,
ERROR_INSIDE );
hole_outer_ring_radius, maxError, 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
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
unsigned int nTracks = trackList.size();
@ -430,18 +423,17 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
{
const PCB_TRACK *track = trackList[trackIdx];
if( !track->IsOnLayer( curr_layer_id ) )
if( !track->IsOnLayer( layer ) )
continue;
// Skip vias annulus when not connected on this layer (if removing is enabled)
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;
// Add the track/via contour
track->TransformShapeWithClearanceToPolygon( *layerPoly, curr_layer_id, 0,
ARC_HIGH_DEF, ERROR_INSIDE );
track->TransformShapeToPolygon( *layerPoly, layer, 0, maxError, 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 )
{
pad->TransformHoleWithClearanceToPolygon( m_throughHoleAnnularRingPolys,
inflate, ARC_HIGH_DEF, ERROR_INSIDE );
pad->TransformHoleToPolygon( m_throughHoleAnnularRingPolys, inflate, maxError,
ERROR_INSIDE );
}
pad->TransformHoleWithClearanceToPolygon( m_throughHoleOdPolys, inflate,
ARC_HIGH_DEF, ERROR_INSIDE );
pad->TransformHoleToPolygon( m_throughHoleOdPolys, inflate, maxError,
ERROR_INSIDE );
}
else
{
// If not plated, no copper.
if( m_Cfg->m_Render.clip_silk_on_via_annulus && m_Cfg->m_Render.realistic )
{
pad->TransformHoleWithClearanceToPolygon( m_throughHoleAnnularRingPolys, 0,
ARC_HIGH_DEF, ERROR_INSIDE );
pad->TransformHoleToPolygon( m_throughHoleAnnularRingPolys, 0, maxError,
ERROR_INSIDE );
}
pad->TransformHoleWithClearanceToPolygon( m_nonPlatedThroughHoleOdPolys, 0,
ARC_HIGH_DEF, ERROR_INSIDE );
pad->TransformHoleToPolygon( m_nonPlatedThroughHoleOdPolys, 0, maxError,
ERROR_INSIDE );
}
}
}
@ -519,22 +511,21 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
&& m_Cfg->m_Render.realistic;
// 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
for( FOOTPRINT* footprint : m_board->Footprints() )
{
// Note: NPTH pads are not drawn on copper layers when the pad has the same shape
// as its hole
addPads( footprint, layerContainer, curr_layer_id, true, renderPlatedPadsAsPlated,
false );
addPads( footprint, layerContainer, layer, true, renderPlatedPadsAsPlated, false );
// 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)
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
for( FOOTPRINT* footprint : m_board->Footprints() )
{
// Note: NPTH pads are not drawn on copper layers when the pad has same shape as
// its hole
footprint->TransformPadsWithClearanceToPolygon( *layerPoly, curr_layer_id,
0, ARC_HIGH_DEF, ERROR_INSIDE,
true, renderPlatedPadsAsPlated,
false );
footprint->TransformPadsToPolySet( *layerPoly, layer, 0, maxError, ERROR_INSIDE,
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
for( FOOTPRINT* footprint : m_board->Footprints() )
{
footprint->TransformPadsWithClearanceToPolygon( *m_frontPlatedPadPolys, F_Cu,
0, ARC_HIGH_DEF, ERROR_INSIDE,
true, false, true );
footprint->TransformPadsToPolySet( *m_frontPlatedPadPolys, F_Cu, 0, maxError,
ERROR_INSIDE, true, false, true );
footprint->TransformPadsWithClearanceToPolygon( *m_backPlatedPadPolys, B_Cu,
0, ARC_HIGH_DEF, ERROR_INSIDE,
true, false, true );
footprint->TransformPadsToPolySet( *m_backPlatedPadPolys, B_Cu, 0, maxError,
ERROR_INSIDE, true, false, true );
}
}
}
// 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)
for( BOARD_ITEM* item : m_board->Drawings() )
{
if( !item->IsOnLayer( curr_layer_id ) )
if( !item->IsOnLayer( layer ) )
continue;
switch( item->Type() )
@ -637,31 +624,29 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
// 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 )
{
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 )
for( BOARD_ITEM* item : m_board->Drawings() )
{
if( !item->IsOnLayer( cur_layer_id ) )
if( !item->IsOnLayer( layer ) )
continue;
switch( item->Type() )
{
case PCB_SHAPE_T:
item->TransformShapeWithClearanceToPolygon( *layerPoly, cur_layer_id, 0,
ARC_HIGH_DEF, ERROR_INSIDE );
item->TransformShapeToPolygon( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
break;
case PCB_TEXT_T:
{
PCB_TEXT* text = static_cast<PCB_TEXT*>( item );
text->TransformTextShapeWithClearanceToPolygon( *layerPoly, cur_layer_id, 0,
ARC_HIGH_DEF, ERROR_INSIDE );
text->TransformTextToPolySet( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
break;
}
@ -669,8 +654,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
{
PCB_TEXTBOX* textbox = static_cast<PCB_TEXTBOX*>( item );
textbox->TransformTextShapeWithClearanceToPolygon( *layerPoly, cur_layer_id, 0,
ARC_HIGH_DEF, ERROR_INSIDE );
textbox->TransformTextToPolySet( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
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;
if( renderPlatedPadsAsPlated )
{
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 ) )
layer_id_without_F_and_B.push_back( layer_id[i] );
if( layer != F_Cu && layer != B_Cu )
layer_id_without_F_and_B.push_back( layer );
}
selected_layer_id = layer_id_without_F_and_B;
@ -845,7 +829,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
if( aStatusReporter )
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() )
{
@ -881,7 +865,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
bool buildVerticalWallsForTechLayers = m_Cfg->m_Render.opengl_copper_thickness
&& m_Cfg->m_Render.engine == RENDER_ENGINE::OPENGL;
static const PCB_LAYER_ID teckLayerList[] = {
static const PCB_LAYER_ID techLayerList[] = {
B_Adhes,
F_Adhes,
B_Paste,
@ -901,31 +885,28 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
};
// 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 )
{
const PCB_LAYER_ID curr_layer_id = *seq;
const PCB_LAYER_ID layer = *seq;
if( !Is3dLayerEnabled( curr_layer_id ) )
if( !Is3dLayerEnabled( layer ) )
continue;
if( aStatusReporter )
{
aStatusReporter->Report( wxString::Format( _( "Build Tech layer %d" ),
(int) curr_layer_id ) );
}
aStatusReporter->Report( wxString::Format( _( "Build Tech layer %d" ), (int) layer ) );
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;
m_layers_poly[curr_layer_id] = layerPoly;
m_layers_poly[layer] = layerPoly;
// Add drawing objects
for( BOARD_ITEM* item : m_board->Drawings() )
{
if( !item->IsOnLayer( curr_layer_id ) )
if( !item->IsOnLayer( layer ) )
continue;
switch( item->Type() )
@ -961,22 +942,20 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
{
for( BOARD_ITEM* item : m_board->Drawings() )
{
if( !item->IsOnLayer( curr_layer_id ) )
if( !item->IsOnLayer( layer ) )
continue;
switch( item->Type() )
{
case PCB_SHAPE_T:
item->TransformShapeWithClearanceToPolygon( *layerPoly, curr_layer_id, 0,
ARC_HIGH_DEF, ERROR_INSIDE );
item->TransformShapeToPolygon( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
break;
case PCB_TEXT_T:
{
PCB_TEXT* text = static_cast<PCB_TEXT*>( item );
text->TransformTextShapeWithClearanceToPolygon( *layerPoly, curr_layer_id, 0,
ARC_HIGH_DEF, ERROR_INSIDE );
text->TransformTextToPolySet( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
break;
}
@ -984,8 +963,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
{
PCB_TEXTBOX* textbox = static_cast<PCB_TEXTBOX*>( item );
textbox->TransformTextShapeWithClearanceToPolygon( *layerPoly, curr_layer_id, 0,
ARC_HIGH_DEF, ERROR_INSIDE );
textbox->TransformTextToPolySet( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
break;
}
@ -998,13 +976,13 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
// Add footprints tech layers - objects
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 ];
for( PAD* pad : footprint->Pads() )
{
if( !pad->IsOnLayer( curr_layer_id ) )
if( !pad->IsOnLayer( layer ) )
continue;
buildPadOutlineAsSegments( pad, layerContainer, linewidth );
@ -1012,10 +990,10 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
}
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() )
{
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 ];
for( PAD* pad : footprint->Pads() )
{
if( !pad->IsOnLayer( curr_layer_id ) )
if( !pad->IsOnLayer( layer ) )
continue;
buildPadOutlineAsPolygon( pad, *layerPoly, linewidth );
@ -1038,16 +1016,14 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
}
else
{
footprint->TransformPadsWithClearanceToPolygon( *layerPoly, curr_layer_id, 0,
ARC_HIGH_DEF, ERROR_INSIDE );
footprint->TransformPadsToPolySet( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
}
// On tech layers, use a poor circle approximation, only for texts (stroke font)
footprint->TransformFPTextWithClearanceToPolygonSet( *layerPoly, curr_layer_id, 0,
ARC_HIGH_DEF, ERROR_INSIDE );
footprint->TransformFPTextToPolySet( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
// 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() )
{
if( zone->IsOnLayer( curr_layer_id ) )
addSolidAreasShapes( zone, layerContainer, curr_layer_id );
if( zone->IsOnLayer( layer ) )
addSolidAreasShapes( zone, layerContainer, layer );
}
if( buildVerticalWallsForTechLayers )
@ -1065,8 +1041,8 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
for( ZONE* zone : m_board->Zones() )
{
if( zone->IsOnLayer( curr_layer_id ) )
zone->TransformSolidAreasShapesToPolygon( curr_layer_id, *layerPoly );
if( zone->IsOnLayer( layer ) )
zone->TransformSolidAreasShapesToPolygon( layer, *layerPoly );
}
}
}

View File

@ -2,7 +2,7 @@
* 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) 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
* modify it under the terms of the GNU General Public License
@ -29,6 +29,7 @@
*/
#include "board_adapter.h"
#include <board_design_settings.h>
#include <convert_basic_shapes_to_polygon.h>
#include <fp_shape.h>
#include <footprint.h>
@ -37,13 +38,15 @@
/*
* 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 maxError = m_board->GetDesignSettings().m_MaxError;
if( aPad->GetShape() == PAD_SHAPE::CIRCLE ) // Draw a ring
{
TransformRingToPolygon( aCornerBuffer, aPad->ShapePos(), aPad->GetSize().x / 2, aWidth,
ARC_HIGH_DEF, ERROR_INSIDE );
TransformRingToPolygon( aBuffer, aPad->ShapePos(), aPad->GetSize().x / 2, aWidth, maxError,
ERROR_INSIDE );
return;
}
@ -56,14 +59,16 @@ void BOARD_ADAPTER::buildPadOutlineAsPolygon( const PAD* aPad, SHAPE_POLY_SET& a
const VECTOR2I& a = path.CPoint( ii );
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,
SHAPE_POLY_SET& aCornerBuffer ) const
void BOARD_ADAPTER::transformFPShapesToPolySet( const FOOTPRINT* aFootprint, PCB_LAYER_ID aLayer,
SHAPE_POLY_SET& aBuffer ) const
{
int maxError = m_board->GetDesignSettings().m_MaxError;
for( BOARD_ITEM* item : aFootprint->GraphicalItems() )
{
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 );
if( shape->GetLayer() == aLayer )
{
shape->TransformShapeWithClearanceToPolygon( aCornerBuffer, aLayer, 0,
ARC_HIGH_DEF, ERROR_INSIDE );
}
shape->TransformShapeToPolygon( aBuffer, aLayer, 0, maxError, ERROR_INSIDE );
}
else if( BaseType( item->Type() ) == PCB_DIMENSION_T )
{
PCB_DIMENSION_BASE* dimension = static_cast<PCB_DIMENSION_BASE*>( item );
if( dimension->GetLayer() == aLayer )
{
dimension->TransformShapeWithClearanceToPolygon( aCornerBuffer, aLayer, 0,
ARC_HIGH_DEF, ERROR_INSIDE );
}
dimension->TransformShapeToPolygon( aBuffer, aLayer, 0, maxError, ERROR_INSIDE );
}
}
}

View File

@ -825,11 +825,10 @@ void RENDER_3D_OPENGL::generateViasAndPads()
if( !hasHole )
continue;
pad->TransformHoleWithClearanceToPolygon( tht_outer_holes_poly,
platingThickness,
ARC_HIGH_DEF, ERROR_INSIDE );
pad->TransformHoleWithClearanceToPolygon( tht_inner_holes_poly, 0,
pad->TransformHoleToPolygon( tht_outer_holes_poly, platingThickness,
ARC_HIGH_DEF, ERROR_INSIDE );
pad->TransformHoleToPolygon( tht_inner_holes_poly, 0, ARC_HIGH_DEF,
ERROR_INSIDE );
}
}
}

View File

@ -1491,30 +1491,26 @@ int EDA_SHAPE::Compare( const EDA_SHAPE* aOther ) const
}
void EDA_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
int aClearanceValue,
int aError, ERROR_LOC aErrorLoc,
bool ignoreLineWidth ) const
void EDA_SHAPE::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, int aClearance, int aError,
ERROR_LOC aErrorLoc, bool ignoreLineWidth ) const
{
int width = ignoreLineWidth ? 0 : GetWidth();
width += 2 * aClearanceValue;
width += 2 * aClearance;
switch( m_shape )
{
case SHAPE_T::CIRCLE:
{
int r = GetRadius();
if( IsFilled() )
{
TransformCircleToPolygon( aCornerBuffer, getCenter(), GetRadius() + width / 2, aError,
aErrorLoc );
}
TransformCircleToPolygon( aBuffer, getCenter(), r + width / 2, aError, aErrorLoc );
else
{
TransformRingToPolygon( aCornerBuffer, getCenter(), GetRadius(), width, aError,
aErrorLoc );
}
TransformRingToPolygon( aBuffer, getCenter(), r, width, aError, aErrorLoc );
break;
}
case SHAPE_T::RECT:
{
@ -1522,31 +1518,30 @@ void EDA_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf
if( IsFilled() || IsAnnotationProxy() )
{
aCornerBuffer.NewOutline();
aBuffer.NewOutline();
for( const VECTOR2I& pt : pts )
aCornerBuffer.Append( pt );
aBuffer.Append( pt );
}
if( width > 0 || !IsFilled() )
{
// Add in segments
TransformOvalToPolygon( aCornerBuffer, pts[0], pts[1], width, aError, aErrorLoc );
TransformOvalToPolygon( aCornerBuffer, pts[1], pts[2], width, aError, aErrorLoc );
TransformOvalToPolygon( aCornerBuffer, pts[2], pts[3], width, aError, aErrorLoc );
TransformOvalToPolygon( aCornerBuffer, pts[3], pts[0], width, aError, aErrorLoc );
TransformOvalToPolygon( aBuffer, pts[0], pts[1], width, aError, aErrorLoc );
TransformOvalToPolygon( aBuffer, pts[1], pts[2], width, aError, aErrorLoc );
TransformOvalToPolygon( aBuffer, pts[2], pts[3], width, aError, aErrorLoc );
TransformOvalToPolygon( aBuffer, pts[3], pts[0], width, aError, aErrorLoc );
}
break;
}
case SHAPE_T::ARC:
TransformArcToPolygon( aCornerBuffer, GetStart(), GetArcMid(), GetEnd(), width, aError,
aErrorLoc );
TransformArcToPolygon( aBuffer, GetStart(), GetArcMid(), GetEnd(), width, aError, aErrorLoc );
break;
case SHAPE_T::SEGMENT:
TransformOvalToPolygon( aCornerBuffer, GetStart(), GetEnd(), width, aError, aErrorLoc );
TransformOvalToPolygon( aBuffer, GetStart(), GetEnd(), width, aError, aErrorLoc );
break;
case SHAPE_T::POLY:
@ -1570,10 +1565,10 @@ void EDA_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf
if( IsFilled() )
{
aCornerBuffer.NewOutline();
aBuffer.NewOutline();
for( const VECTOR2I& point : poly )
aCornerBuffer.Append( point.x, point.y );
aBuffer.Append( point.x, point.y );
}
if( width > 0 || !IsFilled() )
@ -1583,7 +1578,7 @@ void EDA_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf
for( const VECTOR2I& pt2 : poly )
{
if( pt2 != pt1 )
TransformOvalToPolygon( aCornerBuffer, pt1, pt2, width, aError, aErrorLoc );
TransformOvalToPolygon( aBuffer, pt1, pt2, width, aError, aErrorLoc );
pt1 = pt2;
}
@ -1600,10 +1595,7 @@ void EDA_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf
converter.GetPoly( poly, GetWidth() );
for( unsigned ii = 1; ii < poly.size(); ii++ )
{
TransformOvalToPolygon( aCornerBuffer, poly[ii - 1], poly[ii], width, aError,
aErrorLoc );
}
TransformOvalToPolygon( aBuffer, poly[ii - 1], poly[ii], width, aError, aErrorLoc );
break;
}

View File

@ -936,14 +936,12 @@ int EDA_TEXT::Compare( const EDA_TEXT* aOther ) const
}
void EDA_TEXT::TransformBoundingBoxWithClearanceToPolygon( SHAPE_POLY_SET* aCornerBuffer,
int aClearanceValue ) const
void EDA_TEXT::TransformBoundingBoxToPolygon( SHAPE_POLY_SET* aBuffer, int aClearance ) const
{
if( GetText().Length() == 0 )
return;
VECTOR2I corners[4]; // Buffer of polygon corners
BOX2I rect = GetTextBox();
// TrueType bounding boxes aren't guaranteed to include all descenders, diacriticals, etc.
@ -951,7 +949,7 @@ void EDA_TEXT::TransformBoundingBoxWithClearanceToPolygon( SHAPE_POLY_SET* aCorn
if( GetDrawFont()->IsOutline() )
rect = GetEffectiveTextShape( false, false )->BBox();
rect.Inflate( aClearanceValue );
rect.Inflate( aClearance );
corners[0].x = rect.GetOrigin().x;
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].x = corners[0].x;
aCornerBuffer->NewOutline();
aBuffer->NewOutline();
for( VECTOR2I& corner : corners )
{
RotatePoint( corner, GetDrawPos(), GetDrawRotation() );
aCornerBuffer->Append( corner.x, corner.y );
aBuffer->Append( corner.x, corner.y );
}
}

View File

@ -297,20 +297,17 @@ public:
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 aCornerBuffer a buffer to store the polygon.
* @param aClearanceValue the clearance around the pad.
* @param aBuffer a buffer to store the polygon.
* @param aClearance the clearance around the pad.
* @param aError the maximum deviation from true circle.
* @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
* for visualization.
*/
virtual void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
PCB_LAYER_ID aLayer, int aClearanceValue,
int aError, ERROR_LOC aErrorLoc,
virtual void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer,
int aClearance, int aError, ERROR_LOC aErrorLoc,
bool ignoreLineWidth = false ) const;
struct ptr_cmp

View File

@ -297,20 +297,17 @@ public:
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 aCornerBuffer is a buffer to store the polygon.
* @param aClearanceValue is the clearance around the pad.
* @param aBuffer is a buffer to store the polygon.
* @param aClearance is the clearance around the pad.
* @param aError is the maximum deviation from a true arc.
* @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
* for visualization
* @param ignoreLineWidth is used for edge cut items where the line width is only for
* visualization
*/
void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, int aClearanceValue,
int aError, ERROR_LOC aErrorLoc,
bool ignoreLineWidth ) const;
void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, int aClearance, int aError,
ERROR_LOC aErrorLoc, bool ignoreLineWidth = false ) const;
int Compare( const EDA_SHAPE* aOther ) const;

View File

@ -225,12 +225,11 @@ public:
* Used in filling zones calculations
* Circles and arcs are approximated by segments
*
* @param aCornerBuffer a buffer to store the polygon.
* @param aClearanceValue the clearance around the text bounding box
* @param aBuffer a buffer to store the polygon.
* @param aClearance the clearance around the text bounding box
* to the real clearance value (usually near from 1.0).
*/
void TransformBoundingBoxWithClearanceToPolygon( SHAPE_POLY_SET* aCornerBuffer,
int aClearanceValue ) const;
void TransformBoundingBoxToPolygon( SHAPE_POLY_SET* aBuffer, int aClearance ) const;
/**
* build a list of segments (SHAPE_SEGMENT) to describe a text shape.

View File

@ -66,7 +66,7 @@ int ConvertArcToPolyline( SHAPE_LINE_CHAIN& aPolyline, VECTOR2I aCenter, int aRa
/**
* 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 aRadius is the radius of the circle.
* @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.
* Default = 0 to do not force a min count.
*/
void TransformCircleToPolygon( SHAPE_LINE_CHAIN& aCornerBuffer, const VECTOR2I& aCenter,
int aRadius, int aError, ERROR_LOC aErrorLoc, int aMinSegCount = 0 );
void TransformCircleToPolygon( SHAPE_LINE_CHAIN& aBuffer, const VECTOR2I& aCenter, int aRadius,
int aError, ERROR_LOC aErrorLoc, int aMinSegCount = 0 );
/**
* 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 aRadius is the radius of the circle.
* @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.
* 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 );
@ -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
* 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 aEnd is the second point 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.
* Default = 0 to do not force a min count.
*/
void TransformOvalToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aStart,
const VECTOR2I& aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc,
int aMinSegCount = 0 );
void TransformOvalToPolygon( SHAPE_POLY_SET& aBuffer, const VECTOR2I& aStart, const VECTOR2I& aEnd,
int aWidth, int aError, ERROR_LOC aErrorLoc, int aMinSegCount = 0 );
/**
* Convert a rectangle or trapezoid to a polygon.
*
* 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 aSize is the size of the rectangle.
* @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 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,
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
* 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 aSize is the size of the rectangle.
* @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 aErrorLoc determines if the approximation error be placed outside or inside the polygon.
*/
void TransformRoundChamferedRectToPolygon( SHAPE_POLY_SET& aCornerBuffer,
const VECTOR2I& aPosition, const VECTOR2I& aSize,
const EDA_ANGLE& aRotation, int aCornerRadius,
double aChamferRatio, int aChamferCorners, int aInflate,
int aError, ERROR_LOC aErrorLoc );
void TransformRoundChamferedRectToPolygon( SHAPE_POLY_SET& aBuffer, const VECTOR2I& aPosition,
const VECTOR2I& aSize, const EDA_ANGLE& aRotation,
int aCornerRadius, double aChamferRatio,
int aChamferCorners, int aInflate, int aError,
ERROR_LOC aErrorLoc );
/**
* 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 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.
@ -171,21 +170,20 @@ void TransformRoundChamferedRectToPolygon( SHAPE_POLY_SET& aCornerBuffer,
* @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.
*/
void TransformArcToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aStart,
const VECTOR2I& aMid, const VECTOR2I& aEnd, int aWidth, int aError,
ERROR_LOC aErrorLoc );
void TransformArcToPolygon( SHAPE_POLY_SET& aBuffer, const VECTOR2I& aStart, const VECTOR2I& aMid,
const VECTOR2I& aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc );
/**
* 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 aRadius is the radius of the circle.
* @param aWidth is the width (thickness) of the ring.
* @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.
*/
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 );
#endif // CONVERT_BASIC_SHAPES_TO_POLYGON_H

View File

@ -35,46 +35,7 @@
#include <trigo.h>
void TransformCircleToPolygon( SHAPE_LINE_CHAIN& aCornerBuffer, const VECTOR2I& aCenter,
int aRadius, int aError, ERROR_LOC aErrorLoc, int aMinSegCount )
{
VECTOR2I corner_position;
int numSegs = GetArcToSegmentCount( aRadius, aError, FULL_CIRCLE );
numSegs = std::max( aMinSegCount, numSegs );
// The shape will be built with a even number of segs. Reason: the horizontal
// diameter begins and ends to points on the actual circle, or circle
// expanded by aError if aErrorLoc == ERROR_OUTSIDE.
// This is used by Arc to Polygon shape convert.
if( numSegs & 1 )
numSegs++;
EDA_ANGLE delta = ANGLE_360 / numSegs;
int radius = aRadius;
if( aErrorLoc == ERROR_OUTSIDE )
{
// The outer radius should be radius+aError
// Recalculate the actual approx error, as it can be smaller than aError
// because numSegs is clamped to a minimal value
int actual_delta_radius = CircleToEndSegmentDeltaRadius( radius, numSegs );
radius += GetCircleToPolyCorrection( actual_delta_radius );
}
for( EDA_ANGLE angle = ANGLE_0; angle < ANGLE_360; angle += delta )
{
corner_position.x = radius;
corner_position.y = 0;
RotatePoint( corner_position, angle );
corner_position += aCenter;
aCornerBuffer.Append( corner_position.x, corner_position.y );
}
aCornerBuffer.SetClosed( true );
}
void TransformCircleToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aCenter, int aRadius,
void TransformCircleToPolygon( SHAPE_LINE_CHAIN& aBuffer, const VECTOR2I& aCenter, int aRadius,
int aError, ERROR_LOC aErrorLoc, int aMinSegCount )
{
VECTOR2I corner_position;
@ -100,7 +61,46 @@ void TransformCircleToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aC
radius += GetCircleToPolyCorrection( actual_delta_radius );
}
aCornerBuffer.NewOutline();
for( EDA_ANGLE angle = ANGLE_0; angle < ANGLE_360; angle += delta )
{
corner_position.x = radius;
corner_position.y = 0;
RotatePoint( corner_position, angle );
corner_position += aCenter;
aBuffer.Append( corner_position.x, corner_position.y );
}
aBuffer.SetClosed( true );
}
void TransformCircleToPolygon( SHAPE_POLY_SET& aBuffer, const VECTOR2I& aCenter, int aRadius,
int aError, ERROR_LOC aErrorLoc, int aMinSegCount )
{
VECTOR2I corner_position;
int numSegs = GetArcToSegmentCount( aRadius, aError, FULL_CIRCLE );
numSegs = std::max( aMinSegCount, numSegs );
// The shape will be built with a even number of segs. Reason: the horizontal
// diameter begins and ends to points on the actual circle, or circle
// expanded by aError if aErrorLoc == ERROR_OUTSIDE.
// This is used by Arc to Polygon shape convert.
if( numSegs & 1 )
numSegs++;
EDA_ANGLE delta = ANGLE_360 / numSegs;
int radius = aRadius;
if( aErrorLoc == ERROR_OUTSIDE )
{
// The outer radius should be radius+aError
// Recalculate the actual approx error, as it can be smaller than aError
// because numSegs is clamped to a minimal value
int actual_delta_radius = CircleToEndSegmentDeltaRadius( radius, numSegs );
radius += GetCircleToPolyCorrection( actual_delta_radius );
}
aBuffer.NewOutline();
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;
RotatePoint( corner_position, angle );
corner_position += aCenter;
aCornerBuffer.Append( corner_position.x, corner_position.y );
aBuffer.Append( corner_position.x, corner_position.y );
}
// Finish circle
corner_position.x = radius;
corner_position.y = 0;
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,
const VECTOR2I& aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc,
int aMinSegCount )
void TransformOvalToPolygon( SHAPE_POLY_SET& aBuffer, const VECTOR2I& aStart, const VECTOR2I& aEnd,
int aWidth, int aError, ERROR_LOC aErrorLoc, int aMinSegCount )
{
// To build the polygonal shape outside the actual shape, we use a bigger
// radius to build rounded ends.
@ -219,7 +218,7 @@ void TransformOvalToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aSta
polyshape.Rotate( -delta_angle );
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,
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.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,
int aCornerRadius, double aChamferRatio,
int aChamferCorners, int aInflate, int aError,
@ -509,7 +508,7 @@ void TransformRoundChamferedRectToPolygon( SHAPE_POLY_SET& aCornerBuffer, const
outline.Rotate( aRotation );
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,
const VECTOR2I& aMid, const VECTOR2I& aEnd, int aWidth,
int aError, ERROR_LOC aErrorLoc )
void TransformArcToPolygon( SHAPE_POLY_SET& aBuffer, const VECTOR2I& aStart, const VECTOR2I& aMid,
const VECTOR2I& aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc )
{
SEG startToEnd( aStart, aEnd );
int distanceToMid = startToEnd.Distance( aMid );
@ -584,8 +582,7 @@ void TransformArcToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aStar
if( distanceToMid <= 1 )
{
// Not an arc but essentially a straight line with a small error
TransformOvalToPolygon( aCornerBuffer, aStart, aEnd, aWidth + distanceToMid, aError,
aErrorLoc );
TransformOvalToPolygon( aBuffer, aStart, aEnd, aWidth + distanceToMid, aError, aErrorLoc );
return;
}
@ -635,11 +632,11 @@ void TransformArcToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aStar
-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 inner_radius = aRadius - ( aWidth / 2 );
@ -648,8 +645,7 @@ void TransformRingToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aCen
if( inner_radius <= 0 )
{
//In this case, the ring is just a circle (no hole inside)
TransformCircleToPolygon( aCornerBuffer, aCentre, aRadius + ( aWidth / 2 ), aError,
aErrorLoc );
TransformCircleToPolygon( aBuffer, aCentre, aRadius + ( aWidth / 2 ), aError, aErrorLoc );
return;
}
@ -665,5 +661,5 @@ void TransformRingToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aCen
aError, inner_err_loc );
buffer.Fracture( SHAPE_POLY_SET::PM_FAST );
aCornerBuffer.Append( buffer );
aBuffer.Append( buffer );
}

View File

@ -2202,19 +2202,16 @@ void BOARD::ConvertBrdLayerToPolygonalContours( PCB_LAYER_ID aLayer,
if( !track->IsOnLayer( aLayer ) )
continue;
track->TransformShapeWithClearanceToPolygon( aOutlines, aLayer, 0, maxError,
ERROR_INSIDE );
track->TransformShapeToPolygon( aOutlines, aLayer, 0, maxError, ERROR_INSIDE );
}
// convert pads and other copper items in footprints
for( const FOOTPRINT* footprint : m_footprints )
{
footprint->TransformPadsWithClearanceToPolygon( aOutlines, aLayer, 0, maxError,
ERROR_INSIDE );
footprint->TransformPadsToPolySet( aOutlines, aLayer, 0, maxError, ERROR_INSIDE );
// Microwave footprints may have items on copper layers
footprint->TransformFPShapesWithClearanceToPolygon( aOutlines, aLayer, 0, maxError,
ERROR_INSIDE,
footprint->TransformFPShapesToPolySet( aOutlines, aLayer, 0, maxError, ERROR_INSIDE,
true, /* include text */
true, /* include shapes */
false /* include private items */ );
@ -2244,16 +2241,14 @@ void BOARD::ConvertBrdLayerToPolygonalContours( PCB_LAYER_ID aLayer,
case PCB_SHAPE_T:
{
const PCB_SHAPE* shape = static_cast<const PCB_SHAPE*>( item );
shape->TransformShapeWithClearanceToPolygon( aOutlines, aLayer, 0, maxError,
ERROR_INSIDE );
shape->TransformShapeToPolygon( aOutlines, aLayer, 0, maxError, ERROR_INSIDE );
break;
}
case PCB_TEXT_T:
{
const PCB_TEXT* text = static_cast<const PCB_TEXT*>( item );
text->TransformTextShapeWithClearanceToPolygon( aOutlines, aLayer, 0, maxError,
ERROR_INSIDE );
text->TransformTextToPolySet( aOutlines, aLayer, 0, maxError, ERROR_INSIDE );
break;
}
@ -2262,11 +2257,10 @@ void BOARD::ConvertBrdLayerToPolygonalContours( PCB_LAYER_ID aLayer,
const PCB_TEXTBOX* textbox = static_cast<const PCB_TEXTBOX*>( item );
// plot border
textbox->PCB_SHAPE::TransformShapeWithClearanceToPolygon( aOutlines, aLayer, 0,
maxError, ERROR_INSIDE );
// plot text
textbox->TransformTextShapeWithClearanceToPolygon( aOutlines, aLayer, 0, maxError,
textbox->PCB_SHAPE::TransformShapeToPolygon( aOutlines, aLayer, 0, maxError,
ERROR_INSIDE );
// plot text
textbox->TransformTextToPolySet( aOutlines, aLayer, 0, maxError, ERROR_INSIDE );
break;
}

View File

@ -169,13 +169,11 @@ BOARD_ITEM* BOARD_ITEM::Duplicate() const
}
void BOARD_ITEM::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
PCB_LAYER_ID aLayer, int aClearanceValue,
int aError, ERROR_LOC aErrorLoc,
void BOARD_ITEM::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer,
int aClearance, int aError, ERROR_LOC aErrorLoc,
bool ignoreLineWidth ) const
{
wxASSERT_MSG( false, wxT( "Called TransformShapeWithClearanceToPolygon() on unsupported "
"BOARD_ITEM." ) );
wxASSERT_MSG( false, wxT( "Called TransformShapeToPolygon() on unsupported BOARD_ITEM." ) );
};

View File

@ -1269,8 +1269,8 @@ bool DIALOG_PAD_PROPERTIES::padValuesOK()
int maxError = m_board->GetDesignSettings().m_MaxError;
SHAPE_POLY_SET padOutline;
m_dummyPad->TransformShapeWithClearanceToPolygon( padOutline, UNDEFINED_LAYER, 0,
maxError, ERROR_INSIDE );
m_dummyPad->TransformShapeToPolygon( padOutline, UNDEFINED_LAYER, 0, maxError,
ERROR_INSIDE );
if( !padOutline.Collide( m_dummyPad->GetPosition() ) )
{

View File

@ -188,8 +188,8 @@ bool DRC_TEST_PROVIDER_ANNULAR_WIDTH::Run()
// Slow (but general purpose) method.
SHAPE_POLY_SET padOutline;
pad->TransformShapeWithClearanceToPolygon( padOutline, UNDEFINED_LAYER, 0,
maxError, ERROR_INSIDE );
pad->TransformShapeToPolygon( padOutline, UNDEFINED_LAYER, 0, maxError,
ERROR_INSIDE );
if( !padOutline.Collide( pad->GetPosition() ) )
{

View File

@ -679,8 +679,8 @@ bool DRC_TEST_PROVIDER_CONNECTION_WIDTH::Run()
for( BOARD_ITEM* item : itemsPoly.Items )
{
item->TransformShapeWithClearanceToPolygon( itemsPoly.Poly, aLayer, 0,
ARC_HIGH_DEF, ERROR_OUTSIDE );
item->TransformShapeToPolygon( itemsPoly.Poly, aLayer, 0, ARC_HIGH_DEF,
ERROR_OUTSIDE );
}
itemsPoly.Poly.Fracture( SHAPE_POLY_SET::PM_FAST );

View File

@ -144,8 +144,7 @@ bool DRC_TEST_PROVIDER_SLIVER_CHECKER::Run()
}
else
{
item->TransformShapeWithClearanceToPolygon( poly, layer, 0,
ARC_LOW_DEF,
item->TransformShapeToPolygon( poly, layer, 0, ARC_LOW_DEF,
ERROR_OUTSIDE );
}

View File

@ -135,8 +135,8 @@ void DRC_TEST_PROVIDER_SOLDER_MASK::addItemToRTrees( BOARD_ITEM* aItem )
PAD* pad = static_cast<PAD*>( aItem );
int clearance = ( m_webWidth / 2 ) + pad->GetSolderMaskExpansion();
aItem->TransformShapeWithClearanceToPolygon( *solderMask->GetFill( layer ), layer,
clearance, m_maxError, ERROR_OUTSIDE );
aItem->TransformShapeToPolygon( *solderMask->GetFill( layer ), layer, clearance,
m_maxError, ERROR_OUTSIDE );
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 );
int clearance = ( m_webWidth / 2 ) + via->GetSolderMaskExpansion();
via->TransformShapeWithClearanceToPolygon( *solderMask->GetFill( layer ), layer,
clearance, m_maxError, ERROR_OUTSIDE );
via->TransformShapeToPolygon( *solderMask->GetFill( layer ), layer, clearance,
m_maxError, ERROR_OUTSIDE );
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 ) )
{
aItem->TransformShapeWithClearanceToPolygon( *solderMask->GetFill( layer ),
layer, m_webWidth / 2, m_maxError,
ERROR_OUTSIDE );
aItem->TransformShapeToPolygon( *solderMask->GetFill( layer ), layer,
m_webWidth / 2, m_maxError, ERROR_OUTSIDE );
m_itemTree->Insert( aItem, layer, m_largestClearance );
}

View File

@ -125,8 +125,7 @@ void DRC_TEST_PROVIDER_ZONE_CONNECTIONS::testZoneLayer( ZONE* aZone, PCB_LAYER_I
continue;
SHAPE_POLY_SET padPoly;
pad->TransformShapeWithClearanceToPolygon( padPoly, aLayer, 0, ARC_LOW_DEF,
ERROR_OUTSIDE );
pad->TransformShapeToPolygon( padPoly, aLayer, 0, ARC_LOW_DEF, ERROR_OUTSIDE );
SHAPE_LINE_CHAIN& padOutline = padPoly.Outline( 0 );
BOX2I padBBox( item_bbox );

View File

@ -934,7 +934,7 @@ SHAPE_POLY_SET FOOTPRINT::GetBoundingHull() const
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 );
}
@ -943,10 +943,9 @@ SHAPE_POLY_SET FOOTPRINT::GetBoundingHull() const
for( PAD* pad : m_pads )
{
pad->TransformShapeWithClearanceToPolygon( rawPolys, UNDEFINED_LAYER, 0, ARC_LOW_DEF,
ERROR_OUTSIDE );
pad->TransformShapeToPolygon( rawPolys, UNDEFINED_LAYER, 0, ARC_LOW_DEF, ERROR_OUTSIDE );
// 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 )
@ -2023,15 +2022,13 @@ double FOOTPRINT::GetCoverageArea( const BOARD_ITEM* aItem, const GENERAL_COLLEC
{
const FP_TEXT* text = static_cast<const FP_TEXT*>( aItem );
text->TransformTextShapeWithClearanceToPolygon( poly, UNDEFINED_LAYER, textMargin,
ARC_LOW_DEF, ERROR_OUTSIDE );
text->TransformTextToPolySet( poly, UNDEFINED_LAYER, textMargin, ARC_LOW_DEF, ERROR_OUTSIDE );
}
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,
ARC_LOW_DEF, ERROR_OUTSIDE );
tb->TransformTextToPolySet( poly, UNDEFINED_LAYER, textMargin, ARC_LOW_DEF, ERROR_OUTSIDE );
}
else if( aItem->Type() == PCB_SHAPE_T )
{
@ -2059,8 +2056,7 @@ double FOOTPRINT::GetCoverageArea( const BOARD_ITEM* aItem, const GENERAL_COLLEC
}
default:
shape->TransformShapeWithClearanceToPolygon( poly, UNDEFINED_LAYER, 0,
ARC_LOW_DEF, ERROR_OUTSIDE );
shape->TransformShapeToPolygon( poly, UNDEFINED_LAYER, 0, ARC_LOW_DEF, ERROR_OUTSIDE );
}
}
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
{
aItem->TransformShapeWithClearanceToPolygon( poly, UNDEFINED_LAYER, 0,
ARC_LOW_DEF, ERROR_OUTSIDE );
aItem->TransformShapeToPolygon( poly, UNDEFINED_LAYER, 0, ARC_LOW_DEF, ERROR_OUTSIDE );
}
return polygonArea( poly );
@ -2085,11 +2080,10 @@ double FOOTPRINT::CoverageRatio( const GENERAL_COLLECTOR& aCollector ) const
SHAPE_POLY_SET footprintRegion( GetBoundingHull() );
SHAPE_POLY_SET coveredRegion;
TransformPadsWithClearanceToPolygon( coveredRegion, UNDEFINED_LAYER, 0, ARC_LOW_DEF,
ERROR_OUTSIDE );
TransformPadsToPolySet( coveredRegion, UNDEFINED_LAYER, 0, ARC_LOW_DEF, ERROR_OUTSIDE );
TransformFPShapesWithClearanceToPolygon( coveredRegion, UNDEFINED_LAYER, textMargin,
ARC_LOW_DEF, ERROR_OUTSIDE,
TransformFPShapesToPolySet( coveredRegion, UNDEFINED_LAYER, textMargin, ARC_LOW_DEF,
ERROR_OUTSIDE,
true, /* include text */
false, /* include shapes */
false /* include private items */ );
@ -2105,8 +2099,8 @@ double FOOTPRINT::CoverageRatio( const GENERAL_COLLECTOR& aCollector ) const
case PCB_FP_SHAPE_T:
if( item->GetParent() != this )
{
item->TransformShapeWithClearanceToPolygon( coveredRegion, UNDEFINED_LAYER, 0,
ARC_LOW_DEF, ERROR_OUTSIDE );
item->TransformShapeToPolygon( coveredRegion, UNDEFINED_LAYER, 0, ARC_LOW_DEF,
ERROR_OUTSIDE );
}
break;
@ -2116,8 +2110,8 @@ double FOOTPRINT::CoverageRatio( const GENERAL_COLLECTOR& aCollector ) const
case PCB_TRACE_T:
case PCB_ARC_T:
case PCB_VIA_T:
item->TransformShapeWithClearanceToPolygon( coveredRegion, UNDEFINED_LAYER, 0,
ARC_LOW_DEF, ERROR_OUTSIDE );
item->TransformShapeToPolygon( coveredRegion, UNDEFINED_LAYER, 0, ARC_LOW_DEF,
ERROR_OUTSIDE );
break;
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 );
SHAPE_POLY_SET padOutline;
pad->TransformShapeWithClearanceToPolygon( padOutline, layer, 0, ARC_HIGH_DEF,
ERROR_LOC::ERROR_INSIDE );
pad->TransformShapeToPolygon( padOutline, layer, 0, ARC_HIGH_DEF, ERROR_INSIDE );
std::shared_ptr<SHAPE_SEGMENT> hole = pad->GetEffectiveHoleShape();
SHAPE_POLY_SET holeOutline;
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 );
@ -2490,8 +2483,8 @@ void FOOTPRINT::CheckNetTies( const std::function<void( const BOARD_ITEM* aItem,
{
if( item->IsOnLayer( layer ) )
{
item->TransformShapeWithClearanceToPolygon( copperOutlines, layer, 0,
ARC_HIGH_DEF, ERROR_OUTSIDE );
item->TransformShapeToPolygon( copperOutlines, layer, 0, ARC_HIGH_DEF,
ERROR_OUTSIDE );
}
}
@ -2679,11 +2672,9 @@ bool FOOTPRINT::cmp_zones::operator()( const FP_ZONE* aFirst, const FP_ZONE* aSe
#undef TEST
void FOOTPRINT::TransformPadsWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
PCB_LAYER_ID aLayer, int aClearance,
int aMaxError, ERROR_LOC aErrorLoc,
bool aSkipNPTHPadsWihNoCopper,
bool aSkipPlatedPads,
void FOOTPRINT::TransformPadsToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer,
int aClearance, int aMaxError, ERROR_LOC aErrorLoc,
bool aSkipNPTHPadsWihNoCopper, bool aSkipPlatedPads,
bool aSkipNonPlatedPads ) const
{
for( const PAD* pad : m_pads )
@ -2728,10 +2719,9 @@ void FOOTPRINT::TransformPadsWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuff
break;
}
// Our standard TransformShapeWithClearanceToPolygon() routines can't handle differing
// x:y clearance values (which get generated when a relative paste margin is used with
// an oblong pad). So we apply this huge hack and fake a larger pad to run the transform
// on.
// Our standard TransformShapeToPolygon() routines can't handle differing x:y clearance
// values (which get generated when a relative paste margin is used with an oblong pad).
// So we apply this huge hack and fake a larger pad to run the transform on.
// 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.
@ -2745,23 +2735,19 @@ void FOOTPRINT::TransformPadsWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuff
PAD dummy( *pad );
dummy.SetSize( dummySize );
dummy.TransformShapeWithClearanceToPolygon( aCornerBuffer, aLayer, 0,
aMaxError, aErrorLoc );
dummy.TransformShapeToPolygon( aBuffer, aLayer, 0, aMaxError, aErrorLoc );
}
else
{
pad->TransformShapeWithClearanceToPolygon( aCornerBuffer, aLayer, clearance.x,
aMaxError, aErrorLoc );
pad->TransformShapeToPolygon( aBuffer, aLayer, clearance.x, aMaxError, aErrorLoc );
}
}
}
void FOOTPRINT::TransformFPShapesWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
PCB_LAYER_ID aLayer, int aClearance,
int aError, ERROR_LOC aErrorLoc,
bool aIncludeText,
bool aIncludeShapes,
void FOOTPRINT::TransformFPShapesToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer,
int aClearance, int aError, ERROR_LOC aErrorLoc,
bool aIncludeText, bool aIncludeShapes,
bool aIncludePrivateItems ) const
{
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 );
if( aLayer != UNDEFINED_LAYER && textbox->GetLayer() == aLayer && textbox->IsVisible() )
{
textbox->TransformShapeWithClearanceToPolygon( aCornerBuffer, aLayer, 0,
aError, aErrorLoc, false );
}
textbox->TransformShapeToPolygon( aBuffer, aLayer, 0, aError, aErrorLoc );
}
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 );
if( aLayer != UNDEFINED_LAYER && outline->GetLayer() == aLayer )
{
outline->TransformShapeWithClearanceToPolygon( aCornerBuffer, aLayer, 0,
aError, aErrorLoc );
}
outline->TransformShapeToPolygon( aBuffer, aLayer, 0, aError, aErrorLoc );
}
}
@ -2812,10 +2792,7 @@ void FOOTPRINT::TransformFPShapesWithClearanceToPolygon( SHAPE_POLY_SET& aCorner
}
for( const FP_TEXT* text : texts )
{
text->TransformTextShapeWithClearanceToPolygon( aCornerBuffer, aLayer, aClearance,
aError, aErrorLoc );
}
text->TransformTextToPolySet( aBuffer, aLayer, aClearance, aError, aErrorLoc );
}

View File

@ -425,13 +425,13 @@ public:
/**
* 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,
* when a full polygonal approach is needed.
*
* @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 aMaxError is the maximum deviation from true for arcs.
* @param aSkipNPTHPadsWihNoCopper if true, do not add a NPTH pad shape, if the shape has
@ -443,8 +443,7 @@ public:
* @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.
*/
void TransformPadsWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
PCB_LAYER_ID aLayer, int aClearance,
void TransformPadsToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
int aMaxError, ERROR_LOC aErrorLoc,
bool aSkipNPTHPadsWihNoCopper = false,
bool aSkipPlatedPads = false,
@ -452,35 +451,31 @@ public:
/**
* 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,
* when a full polygonal approach is needed.
*
* @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 aError is the maximum error between true arc and polygon approximation.
* @param aIncludeText set to true to transform text shapes.
* @param aIncludeShapes set to true to transform footprint shapes.
*/
void TransformFPShapesWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
PCB_LAYER_ID aLayer, int aClearance,
void TransformFPShapesToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
int aError, ERROR_LOC aErrorLoc,
bool aIncludeText = true,
bool aIncludeShapes = true,
bool aIncludePrivateItems = false ) const;
/**
* This function is the same as TransformGraphicShapesWithClearanceToPolygonSet
* but only generate text.
* This function is the same as TransformFPShapesToPolySet but only generates text.
*/
void TransformFPTextWithClearanceToPolygonSet( SHAPE_POLY_SET& aCornerBuffer,
PCB_LAYER_ID aLayer, int aClearance,
void TransformFPTextToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
int aError, ERROR_LOC aErrorLoc ) const
{
TransformFPShapesWithClearanceToPolygon( aCornerBuffer, aLayer, aClearance, aError,
aErrorLoc, true, false );
TransformFPShapesToPolySet( aBuffer, aLayer, aClearance, aError, aErrorLoc, true, false );
}
/**

View File

@ -450,8 +450,7 @@ std::shared_ptr<SHAPE> FP_TEXT::GetEffectiveShape( PCB_LAYER_ID aLayer, FLASHING
}
void FP_TEXT::TransformTextShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
PCB_LAYER_ID aLayer, int aClearance,
void FP_TEXT::TransformTextToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
int aError, ERROR_LOC aErrorLoc ) const
{
KIGFX::GAL_DISPLAY_OPTIONS empty_opts;
@ -469,8 +468,8 @@ void FP_TEXT::TransformTextShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerB
// Stroke callback
[&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2 )
{
TransformOvalToPolygon( buffer, aPt1, aPt2, penWidth+ ( 2 * aClearance ),
aError, ERROR_INSIDE );
TransformOvalToPolygon( buffer, aPt1, aPt2, penWidth + ( 2 * aClearance ), aError,
ERROR_INSIDE );
},
// Triangulation callback
[&]( 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 );
buffer.Simplify( SHAPE_POLY_SET::PM_FAST );
aCornerBuffer.Append( buffer );
aBuffer.Append( buffer );
}
void FP_TEXT::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
PCB_LAYER_ID aLayer, int aClearance,
int aError, ERROR_LOC aErrorLoc,
bool aIgnoreLineWidth ) const
void FP_TEXT::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
int aError, ERROR_LOC aErrorLoc, bool aIgnoreLineWidth ) const
{
SHAPE_POLY_SET buffer;
EDA_TEXT::TransformBoundingBoxWithClearanceToPolygon( &buffer, aClearance );
aCornerBuffer.Append( buffer );
EDA_TEXT::TransformBoundingBoxToPolygon( &buffer, aClearance );
aBuffer.Append( buffer );
}

View File

@ -155,12 +155,11 @@ public:
return TextHitTest( aRect, aContained, aAccuracy );
}
void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, PCB_LAYER_ID aLayer,
int aClearance, int aError, ERROR_LOC aErrorLoc,
void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
int aError, ERROR_LOC aErrorLoc,
bool aIgnoreLineWidth ) const override;
void TransformTextShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
PCB_LAYER_ID aLayer, int aClearanceValue,
void TransformTextToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
int aError, ERROR_LOC aErrorLoc ) const;
// @copydoc BOARD_ITEM::GetEffectiveShape

View File

@ -440,9 +440,8 @@ std::shared_ptr<SHAPE> FP_TEXTBOX::GetEffectiveShape( PCB_LAYER_ID aLayer, FLASH
}
void FP_TEXTBOX::TransformTextShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
PCB_LAYER_ID aLayer, int aClearance,
int aError, ERROR_LOC aErrorLoc ) const
void FP_TEXTBOX::TransformTextToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer,
int aClearance, int aError, ERROR_LOC aErrorLoc ) const
{
KIGFX::GAL_DISPLAY_OPTIONS empty_opts;
KIFONT::FONT* font = GetDrawFont();
@ -459,8 +458,8 @@ void FP_TEXTBOX::TransformTextShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCorn
// Stroke callback
[&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2 )
{
TransformOvalToPolygon( buffer, aPt1, aPt2, penWidth + ( 2 * aClearance ),
aError, ERROR_INSIDE );
TransformOvalToPolygon( buffer, aPt1, aPt2, penWidth + ( 2 * aClearance ), aError,
ERROR_INSIDE );
},
// Triangulation callback
[&]( 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 );
buffer.Simplify( SHAPE_POLY_SET::PM_FAST );
aCornerBuffer.Append( buffer );
aBuffer.Append( buffer );
}
void FP_TEXTBOX::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
PCB_LAYER_ID aLayer, int aClearance,
int aError, ERROR_LOC aErrorLoc,
void FP_TEXTBOX::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer,
int aClearance, int aError, ERROR_LOC aErrorLoc,
bool aIgnoreLineWidth ) const
{
// Don't use FP_SHAPE::TransformShapeWithClearanceToPolygon. We want to treat the
// textbox as filled even if there's no background colour.
// Don't use FP_SHAPE::TransformShapeToPolygon. We want to treat the textbox as filled even
// if there's no background colour.
std::vector<VECTOR2I> pts = GetRectCorners();
aCornerBuffer.NewOutline();
aBuffer.NewOutline();
for( const VECTOR2I& pt : pts )
aCornerBuffer.Append( pt );
aBuffer.Append( pt );
int width = GetWidth() + ( 2 * aClearance );
if( width > 0 )
{
// Add in segments
TransformOvalToPolygon( aCornerBuffer, pts[0], pts[1], width, aError, aErrorLoc );
TransformOvalToPolygon( aCornerBuffer, pts[1], pts[2], width, aError, aErrorLoc );
TransformOvalToPolygon( aCornerBuffer, pts[2], pts[3], width, aError, aErrorLoc );
TransformOvalToPolygon( aCornerBuffer, pts[3], pts[0], width, aError, aErrorLoc );
TransformOvalToPolygon( aBuffer, pts[0], pts[1], width, aError, aErrorLoc );
TransformOvalToPolygon( aBuffer, pts[1], pts[2], width, aError, aErrorLoc );
TransformOvalToPolygon( aBuffer, pts[2], pts[3], width, aError, aErrorLoc );
TransformOvalToPolygon( aBuffer, pts[3], pts[0], width, aError, aErrorLoc );
}
}

View File

@ -106,12 +106,11 @@ public:
bool HitTest( const VECTOR2I& aPosition, int aAccuracy ) const override;
bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, PCB_LAYER_ID aLayer,
int aClearance, int aError, ERROR_LOC aErrorLoc,
bool aIgnoreLineWidth ) const override;
void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
int aError, ERROR_LOC aErrorLoc,
bool aIgnoreLineWidth = false ) const override;
void TransformTextShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
PCB_LAYER_ID aLayer, int aClearanceValue,
void TransformTextToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
int aError, ERROR_LOC aErrorLoc ) const;
// @copydoc BOARD_ITEM::GetEffectiveShape

View File

@ -593,8 +593,7 @@ void PAD::BuildEffectivePolygon() const
// Polygon
m_effectivePolygon = std::make_shared<SHAPE_POLY_SET>();
TransformShapeWithClearanceToPolygon( *m_effectivePolygon, UNDEFINED_LAYER, 0, maxError,
ERROR_INSIDE );
TransformShapeToPolygon( *m_effectivePolygon, UNDEFINED_LAYER, 0, maxError, ERROR_INSIDE );
// Bounding radius
//
@ -1550,8 +1549,8 @@ void PAD::SwapData( BOARD_ITEM* aImage )
}
bool PAD::TransformHoleWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, int aInflateValue,
int aError, ERROR_LOC aErrorLoc ) const
bool PAD::TransformHoleToPolygon( SHAPE_POLY_SET& aBuffer, int aClearance, int aError,
ERROR_LOC aErrorLoc ) const
{
VECTOR2I drillsize = GetDrillSize();
@ -1560,17 +1559,15 @@ bool PAD::TransformHoleWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, in
std::shared_ptr<SHAPE_SEGMENT> slot = GetEffectiveHoleShape();
TransformOvalToPolygon( aCornerBuffer, slot->GetSeg().A, slot->GetSeg().B,
slot->GetWidth() + aInflateValue * 2, aError, aErrorLoc );
TransformOvalToPolygon( aBuffer, slot->GetSeg().A, slot->GetSeg().B,
slot->GetWidth() + aClearance * 2, aError, aErrorLoc );
return true;
}
void PAD::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
PCB_LAYER_ID aLayer, int aClearanceValue,
int aError, ERROR_LOC aErrorLoc,
bool ignoreLineWidth ) const
void PAD::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth ) const
{
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 dy = m_size.y / 2;
VECTOR2I padShapePos = ShapePos(); // Note: for pad having a shape offset,
// the pad position is NOT the shape position
VECTOR2I padShapePos = ShapePos(); // Note: for pad having a shape offset, the pad
// position is NOT the shape position
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
if( dx == dy || ( GetShape() == PAD_SHAPE::CIRCLE ) )
{
TransformCircleToPolygon( aCornerBuffer, padShapePos, dx + aClearanceValue, aError,
aErrorLoc, pad_min_seg_per_circle_count );
TransformCircleToPolygon( aBuffer, padShapePos, dx + aClearance, aError, aErrorLoc,
pad_min_seg_per_circle_count );
}
else
{
@ -1601,8 +1598,8 @@ void PAD::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
RotatePoint( delta, m_orient );
TransformOvalToPolygon( aCornerBuffer, padShapePos - delta, padShapePos + delta,
( half_width + aClearanceValue ) * 2, aError, aErrorLoc,
TransformOvalToPolygon( aBuffer, padShapePos - delta, padShapePos + delta,
( half_width + aClearance ) * 2, aError, aErrorLoc,
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;
SHAPE_POLY_SET outline;
TransformTrapezoidToPolygon( outline, padShapePos, m_size, m_orient, ddx, ddy,
aClearanceValue, aError, aErrorLoc );
aCornerBuffer.Append( outline );
TransformTrapezoidToPolygon( outline, padShapePos, m_size, m_orient, ddx, ddy, aClearance,
aError, aErrorLoc );
aBuffer.Append( outline );
break;
}
@ -1631,8 +1628,8 @@ void PAD::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
GetRoundRectCornerRadius(),
doChamfer ? GetChamferRectRatio() : 0,
doChamfer ? GetChamferPositions() : 0,
aClearanceValue, aError, aErrorLoc );
aCornerBuffer.Append( outline );
aClearance, aError, aErrorLoc );
aBuffer.Append( outline );
break;
}
@ -1643,11 +1640,11 @@ void PAD::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
outline.Rotate( m_orient );
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 );
int clearance = aClearanceValue;
int clearance = aClearance;
if( aErrorLoc == ERROR_OUTSIDE )
{
@ -1660,12 +1657,12 @@ void PAD::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
outline.Fracture( SHAPE_POLY_SET::PM_FAST );
}
aCornerBuffer.Append( outline );
aBuffer.Append( outline );
break;
}
default:
wxFAIL_MSG( wxT( "PAD::TransformShapeWithClearanceToPolygon no implementation for " )
wxFAIL_MSG( wxT( "PAD::TransformShapeToPolygon no implementation for " )
+ PAD_SHAPE_T_asString( GetShape() ) );
break;
}

View File

@ -425,28 +425,27 @@ public:
/**
* Convert the pad shape to a closed polygon. Circles and arcs are approximated by segments.
*
* @param aCornerBuffer a buffer to store the polygon.
* @param aClearanceValue the clearance around the pad.
* @param aBuffer a buffer to store the polygon.
* @param aClearance the clearance around the pad.
* @param aMaxError maximum error from true when converting arcs.
* @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.
*/
void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
PCB_LAYER_ID aLayer, int aClearanceValue,
void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
int aMaxError, ERROR_LOC aErrorLoc,
bool ignoreLineWidth = false ) const override;
/**
* Build the corner list of the polygonal drill shape in the board coordinate system.
*
* @param aCornerBuffer a buffer to fill.
* @param aInflateValue the clearance or margin value.
* @param aBuffer a buffer to fill.
* @param aClearance the clearance or margin value.
* @param aError maximum deviation of an arc from the polygon approximation.
* @param aErrorLoc = should the approximation error be placed outside or inside the polygon?
* @return false if the pad has no hole, true otherwise.
*/
bool TransformHoleWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, int aInflateValue,
int aError, ERROR_LOC aErrorLoc ) const;
bool TransformHoleToPolygon( SHAPE_POLY_SET& aBuffer, int aClearance, int aError,
ERROR_LOC aErrorLoc ) const;
/**
* Some pad shapes can be complex (rounded/chamfered rectangle), even without considering

View File

@ -210,10 +210,7 @@ void PAD::addPadPrimitivesToPolygon( SHAPE_POLY_SET* aMergedPolygon, int aError,
for( const std::shared_ptr<PCB_SHAPE>& primitive : m_editPrimitives )
{
if( !primitive->IsAnnotationProxy() )
{
primitive->TransformShapeWithClearanceToPolygon( polyset, UNDEFINED_LAYER, 0, aError,
aErrorLoc );
}
primitive->TransformShapeToPolygon( polyset, UNDEFINED_LAYER, 0, aError, aErrorLoc );
}
polyset.Simplify( SHAPE_POLY_SET::PM_FAST );

View File

@ -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_RADIAL_T:
case PCB_FP_DIM_ORTHOGONAL_T:
item->TransformShapeWithClearanceToPolygon( itemPoly, aLayer, 0,
pcbIUScale.mmToIU( 0.1 ), ERROR_INSIDE );
item->TransformShapeToPolygon( itemPoly, aLayer, 0, pcbIUScale.mmToIU( 0.1 ),
ERROR_INSIDE );
break;
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
// 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.
zone->TransformShapeWithClearanceToPolygon( itemPoly, aLayer, 0,
pcbIUScale.FromMillimeter( 0.1 ), ERROR_INSIDE );
zone->TransformShapeToPolygon( itemPoly, aLayer, 0, pcbIUScale.mmToIU( 0.1 ),
ERROR_INSIDE );
if( itemPoly.IsEmpty() )
itemPoly = *zone->Outline();

View File

@ -514,9 +514,8 @@ OPT_VECTOR2I PCB_DIMENSION_BASE::segCircleIntersection( CIRCLE& aCircle, SEG& aS
}
void PCB_DIMENSION_BASE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
PCB_LAYER_ID aLayer, int aClearance,
int aError, ERROR_LOC aErrorLoc,
void PCB_DIMENSION_BASE::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer,
int aClearance, int aError, ERROR_LOC aErrorLoc,
bool aIgnoreLineWidth ) const
{
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 )
{
TransformCircleToPolygon( aCornerBuffer, circle->GetCenter(),
TransformCircleToPolygon( aBuffer, circle->GetCenter(),
circle->GetRadius() + m_lineThickness / 2 + aClearance,
aError, aErrorLoc );
}
else if( seg )
{
TransformOvalToPolygon( aCornerBuffer, seg->GetSeg().A,
seg->GetSeg().B, m_lineThickness + 2 * aClearance,
aError, aErrorLoc );
TransformOvalToPolygon( aBuffer, seg->GetSeg().A, seg->GetSeg().B,
m_lineThickness + 2 * aClearance, aError, aErrorLoc );
}
else
{
wxFAIL_MSG( wxT( "PCB_DIMENSION_BASE::TransformShapeWithClearanceToPolygon unexpected "
"shape type." ) );
wxFAIL_MSG( wxT( "PCB_DIMENSION_BASE::TransformShapeToPolygon unknown shape type." ) );
}
}
}

View File

@ -249,8 +249,8 @@ public:
const BOX2I ViewBBox() const override;
void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, PCB_LAYER_ID aLayer,
int aClearance, int aError, ERROR_LOC aErrorLoc,
void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
int aError, ERROR_LOC aErrorLoc,
bool aIgnoreLineWidth = false ) const override;
#if defined(DEBUG)

View File

@ -712,8 +712,8 @@ static void enclosedByAreaFunc( LIBEVAL::CONTEXT* aCtx, void* self )
SHAPE_POLY_SET itemShape;
bool enclosedByArea;
item->TransformShapeWithClearanceToPolygon( itemShape, layer, 0,
maxError, ERROR_OUTSIDE );
item->TransformShapeToPolygon( itemShape, layer, 0, maxError,
ERROR_OUTSIDE );
if( itemShape.IsEmpty() )
{

View File

@ -1453,8 +1453,8 @@ void PCB_PAINTER::draw( const PAD* aPad, int aLayer )
{
// This is expensive. Avoid if possible.
SHAPE_POLY_SET polySet;
aPad->TransformShapeWithClearanceToPolygon( polySet, ToLAYER_ID( aLayer ), margin.x,
m_maxError, ERROR_INSIDE );
aPad->TransformShapeToPolygon( polySet, ToLAYER_ID( aLayer ), margin.x, m_maxError,
ERROR_INSIDE );
m_gal->DrawPolygon( polySet );
}
}
@ -1509,8 +1509,8 @@ void PCB_PAINTER::draw( const PAD* aPad, int aLayer )
SHAPE_POLY_SET polySet;
// Use ERROR_INSIDE because it avoids Clipper and is therefore much faster.
aPad->TransformShapeWithClearanceToPolygon( polySet, ToLAYER_ID( aLayer ),
clearance, m_maxError, ERROR_INSIDE );
aPad->TransformShapeToPolygon( polySet, ToLAYER_ID( aLayer ), clearance,
m_maxError, ERROR_INSIDE );
if( polySet.Outline( 0 ).PointCount() > 2 ) // Careful of empty pads
m_gal->DrawPolygon( polySet );
@ -1845,8 +1845,7 @@ void PCB_PAINTER::draw( const PCB_TEXT* aText, int aLayer )
m_gal->SetLineWidth( m_lockedShadowMargin );
SHAPE_POLY_SET poly;
aText->TransformShapeWithClearanceToPolygon( poly, aText->GetLayer(), 0, m_maxError,
ERROR_OUTSIDE );
aText->TransformShapeToPolygon( poly, aText->GetLayer(), 0, m_maxError, ERROR_OUTSIDE );
m_gal->DrawPolygon( poly );
return;
@ -1884,7 +1883,7 @@ void PCB_PAINTER::draw( const PCB_TEXT* aText, int aLayer )
int margin = attrs.m_StrokeWidth * 1.5
+ GetKnockoutTextMargin( attrs.m_Size, attrs.m_StrokeWidth );
aText->TransformBoundingBoxWithClearanceToPolygon( &finalPoly, margin );
aText->TransformBoundingBoxToPolygon( &finalPoly, margin );
finalPoly.BooleanSubtract( knockouts, 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
+ GetKnockoutTextMargin( attrs.m_Size, attrs.m_StrokeWidth );
aText->TransformBoundingBoxWithClearanceToPolygon( &finalPoly, margin );
aText->TransformBoundingBoxToPolygon( &finalPoly, margin );
finalPoly.BooleanSubtract( knockouts, SHAPE_POLY_SET::PM_FAST );
finalPoly.Fracture( SHAPE_POLY_SET::PM_FAST );

View File

@ -380,13 +380,11 @@ bool PCB_SHAPE::cmp_drawings::operator()( const BOARD_ITEM* aFirst,
}
void PCB_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
PCB_LAYER_ID aLayer, int aClearanceValue,
int aError, ERROR_LOC aErrorLoc,
void PCB_SHAPE::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer,
int aClearance, int aError, ERROR_LOC aErrorLoc,
bool ignoreLineWidth ) const
{
EDA_SHAPE::TransformShapeWithClearanceToPolygon( aCornerBuffer, aClearanceValue, aError,
aErrorLoc, ignoreLineWidth );
EDA_SHAPE::TransformShapeToPolygon( aBuffer, aClearance, aError, aErrorLoc, ignoreLineWidth );
}

View File

@ -121,19 +121,16 @@ public:
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 aCornerBuffer is a buffer to store the polygon.
* @param aClearanceValue is the clearance around the pad.
* @param aBuffer is a buffer to store the polygon.
* @param aClearance is the clearance around the pad.
* @param aError is the maximum deviation from a true arc.
* @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
* for visualization
* @param ignoreLineWidth is used for edge cut items where the line width is only for
* visualization
*/
void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
PCB_LAYER_ID aLayer, int aClearanceValue,
void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
int aError, ERROR_LOC aErrorLoc,
bool ignoreLineWidth = false ) const override;

View File

@ -158,9 +158,8 @@ void PCB_TARGET::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_
}
void PCB_TARGET::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
PCB_LAYER_ID aLayer, int aClearanceValue,
int aError, ERROR_LOC aErrorLoc,
void PCB_TARGET::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer,
int aClearance, int aError, ERROR_LOC aErrorLoc,
bool ignoreLineWidth ) const
{
int size = GetShape() ? GetSize() / 1.5 : GetSize() / 2.0;
@ -184,8 +183,8 @@ void PCB_TARGET::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBu
{
item->SetWidth( GetWidth() );
item->Move( GetPosition() );
item->TransformShapeWithClearanceToPolygon( aCornerBuffer, aLayer, aClearanceValue,
aError, aErrorLoc, ignoreLineWidth );
item->TransformShapeToPolygon( aBuffer, aLayer, aClearance, aError, aErrorLoc,
ignoreLineWidth );
}
}

View File

@ -101,15 +101,14 @@ public:
*
* Used in filling zones calculations. Circles and arcs are approximated by segments.
*
* @param aCornerBuffer is a buffer to store the polygon.
* @param aClearanceValue is the clearance around the pad.
* @param aBuffer is a buffer to store the polygon.
* @param aClearance is the clearance around the pad.
* @param aError is the maximum deviation from a true arc.
* @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
* for visualization
* @param ignoreLineWidth is used for edge cut items where the line width is only for
* visualization
*/
void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
PCB_LAYER_ID aLayer, int aClearanceValue,
void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
int aError, ERROR_LOC aErrorLoc,
bool ignoreLineWidth = false ) const override;

View File

@ -175,7 +175,7 @@ bool PCB_TEXT::TextHitTest( const VECTOR2I& aPoint, int aAccuracy ) const
{
SHAPE_POLY_SET poly;
TransformBoundingBoxWithClearanceToPolygon( &poly, getKnockoutMargin() );
TransformBoundingBoxToPolygon( &poly, getKnockoutMargin());
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,
PCB_LAYER_ID aLayer, int aClearance,
int aError, ERROR_LOC aErrorLoc ) const
void PCB_TEXT::TransformTextToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer,
int aClearance, int aError, ERROR_LOC aErrorLoc ) const
{
KIGFX::GAL_DISPLAY_OPTIONS empty_opts;
KIFONT::FONT* font = GetDrawFont();
@ -303,7 +302,7 @@ void PCB_TEXT::TransformTextShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCorner
// Stroke callback
[&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2 )
{
TransformOvalToPolygon( aCornerBuffer, aPt1, aPt2, penWidth+ ( 2 * aClearance ),
TransformOvalToPolygon( aBuffer, aPt1, aPt2, penWidth + ( 2 * aClearance ),
aError, ERROR_INSIDE );
},
// Triangulation callback
@ -318,16 +317,15 @@ void PCB_TEXT::TransformTextShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCorner
font->Draw( &callback_gal, GetShownText(), GetTextPos(), GetAttributes() );
buffer.Simplify( SHAPE_POLY_SET::PM_FAST );
aCornerBuffer.Append( buffer );
aBuffer.Append( buffer );
}
void PCB_TEXT::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
PCB_LAYER_ID aLayer, int aClearance,
int aError, ERROR_LOC aErrorLoc,
void PCB_TEXT::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer,
int aClearance, int aError, ERROR_LOC aErrorLoc,
bool aIgnoreLineWidth ) const
{
EDA_TEXT::TransformBoundingBoxWithClearanceToPolygon( &aCornerBuffer, aClearance );
EDA_TEXT::TransformBoundingBoxToPolygon( &aBuffer, aClearance );
}

View File

@ -115,24 +115,24 @@ public:
}
/**
* Function TransformTextShapeWithClearanceToPolygon
* Function TransformTextToPolySet
* Convert the text to a polygonSet describing the actual character strokes (one per segment).
* Used in 3D viewer
* Circles and arcs are approximated by segments
* @aCornerBuffer = SHAPE_POLY_SET to store the polygon corners
* @aClearanceValue = the clearance around the text
* @aBuffer = SHAPE_POLY_SET to store the polygon corners
* @aClearance = the clearance around the text
* @aError = the maximum error to allow when approximating curves
*/
void TransformTextShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
PCB_LAYER_ID aLayer, int aClearanceValue,
void TransformTextToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
int aError, ERROR_LOC aErrorLoc ) const;
void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, PCB_LAYER_ID aLayer,
int aClearanceValue, int aError, ERROR_LOC aErrorLoc,
void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
int aError, ERROR_LOC aErrorLoc,
bool aIgnoreLineWidth = false ) const override;
// @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,
FLASHING aFlash = FLASHING::DEFAULT ) const override;
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;

View File

@ -447,9 +447,8 @@ std::shared_ptr<SHAPE> PCB_TEXTBOX::GetEffectiveShape( PCB_LAYER_ID aLayer, FLAS
}
void PCB_TEXTBOX::TransformTextShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
PCB_LAYER_ID aLayer, int aClearance,
int aError, ERROR_LOC aErrorLoc ) const
void PCB_TEXTBOX::TransformTextToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer,
int aClearance, int aError, ERROR_LOC aErrorLoc ) const
{
KIGFX::GAL_DISPLAY_OPTIONS empty_opts;
KIFONT::FONT* font = GetDrawFont();
@ -466,8 +465,8 @@ void PCB_TEXTBOX::TransformTextShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCor
// Stroke callback
[&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2 )
{
TransformOvalToPolygon( buffer, aPt1, aPt2, penWidth+ ( 2 * aClearance ),
aError, ERROR_INSIDE );
TransformOvalToPolygon( buffer, aPt1, aPt2, penWidth + ( 2 * aClearance ), aError,
ERROR_INSIDE );
},
// Triangulation callback
[&]( 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() );
buffer.Simplify( SHAPE_POLY_SET::PM_FAST );
aCornerBuffer.Append( buffer );
aBuffer.Append( buffer );
}
void PCB_TEXTBOX::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
PCB_LAYER_ID aLayer, int aClearance,
int aError, ERROR_LOC aErrorLoc,
void PCB_TEXTBOX::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer,
int aClearance, int aError, ERROR_LOC aErrorLoc,
bool aIgnoreLineWidth ) const
{
// Don't use PCB_SHAPE::TransformShapeWithClearanceToPolygon. We want to treat the
// textbox as filled even if there's no background colour.
// Don't use PCB_SHAPE::TransformShapeToPolygon. We want to treat the textbox as filled even
// if there's no background colour.
std::vector<VECTOR2I> pts = GetRectCorners();
aCornerBuffer.NewOutline();
aBuffer.NewOutline();
for( const VECTOR2I& pt : pts )
aCornerBuffer.Append( pt );
aBuffer.Append( pt );
int width = GetWidth() + ( 2 * aClearance );
if( width > 0 )
{
// Add in segments
TransformOvalToPolygon( aCornerBuffer, pts[0], pts[1], width, aError, aErrorLoc );
TransformOvalToPolygon( aCornerBuffer, pts[1], pts[2], width, aError, aErrorLoc );
TransformOvalToPolygon( aCornerBuffer, pts[2], pts[3], width, aError, aErrorLoc );
TransformOvalToPolygon( aCornerBuffer, pts[3], pts[0], width, aError, aErrorLoc );
TransformOvalToPolygon( aBuffer, pts[0], pts[1], width, aError, aErrorLoc );
TransformOvalToPolygon( aBuffer, pts[1], pts[2], width, aError, aErrorLoc );
TransformOvalToPolygon( aBuffer, pts[2], pts[3], width, aError, aErrorLoc );
TransformOvalToPolygon( aBuffer, pts[3], pts[0], width, aError, aErrorLoc );
}
}

View File

@ -107,24 +107,24 @@ public:
}
/**
* Function TransformTextShapeWithClearanceToPolygon
* Function TransformTextToPolySet
* Convert the text to a polygonSet describing the actual character strokes (one per segment).
* Used in 3D viewer
* Circles and arcs are approximated by segments
* @aCornerBuffer = SHAPE_POLY_SET to store the polygon corners
* @aClearanceValue = the clearance around the text
* @aBuffer = SHAPE_POLY_SET to store the polygon corners
* @aClearance = the clearance around the text
* @aError = the maximum error to allow when approximating curves
*/
void TransformTextShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
PCB_LAYER_ID aLayer, int aClearanceValue,
void TransformTextToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
int aError, ERROR_LOC aErrorLoc ) const;
void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, PCB_LAYER_ID aLayer,
int aClearanceValue, int aError, ERROR_LOC aErrorLoc,
void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
int aError, ERROR_LOC aErrorLoc,
bool aIgnoreLineWidth = false ) const override;
// @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,
FLASHING aFlash = FLASHING::DEFAULT ) const override;
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;

View File

@ -1167,9 +1167,8 @@ std::shared_ptr<SHAPE> PCB_ARC::GetEffectiveShape( PCB_LAYER_ID aLayer, FLASHING
}
void PCB_TRACK::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
PCB_LAYER_ID aLayer, int aClearanceValue,
int aError, ERROR_LOC aErrorLoc,
void PCB_TRACK::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer,
int aClearance, int aError, ERROR_LOC aErrorLoc,
bool ignoreLineWidth ) const
{
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:
{
int radius = ( m_Width / 2 ) + aClearanceValue;
TransformCircleToPolygon( aCornerBuffer, m_Start, radius, aError, aErrorLoc );
int radius = ( m_Width / 2 ) + aClearance;
TransformCircleToPolygon( aBuffer, m_Start, radius, aError, aErrorLoc );
break;
}
case PCB_ARC_T:
{
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(),
arc->GetEnd(), width, aError, aErrorLoc );
TransformArcToPolygon( aBuffer, arc->GetStart(), arc->GetMid(), arc->GetEnd(), width,
aError, aErrorLoc );
break;
}
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;
}
}

View File

@ -137,18 +137,17 @@ public:
virtual double GetLength() const;
/**
* Function TransformShapeWithClearanceToPolygon
* Function TransformShapeToPolygon
* Convert the track shape to a closed polygon
* Used in filling zones calculations
* Circles (vias) and arcs (ends of tracks) are approximated by segments
* @param aCornerBuffer = a buffer to store the polygon
* @param aClearanceValue = the clearance around the pad
* @param aBuffer = a buffer to store the polygon
* @param aClearance = the clearance around the pad
* @param aError = the maximum deviation from true circle
* @param ignoreLineWidth = used for edge cut items where the line width is only
* for visualization
* @param ignoreLineWidth = used for edge cut items where the line width is only for
* visualization
*/
void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
PCB_LAYER_ID aLayer, int aClearanceValue,
void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
int aError, ERROR_LOC aErrorLoc,
bool ignoreLineWidth = false ) const override;

View File

@ -466,8 +466,8 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask,
SHAPE_POLY_SET outline;
int maxError = aBoard->GetDesignSettings().m_MaxError;
int numSegs = GetArcToSegmentCount( mask_clearance, maxError, FULL_CIRCLE );
dummy.TransformShapeWithClearanceToPolygon( outline, UNDEFINED_LAYER, 0,
maxError, ERROR_INSIDE );
dummy.TransformShapeToPolygon( outline, UNDEFINED_LAYER, 0, maxError,
ERROR_INSIDE );
outline.InflateWithLinkedHoles( mask_clearance, numSegs,
SHAPE_POLY_SET::PM_FAST );
@ -846,23 +846,19 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
for( const FOOTPRINT* footprint : aBoard->Footprints() )
{
// add shapes with their exact mask layer size in initialPolys
footprint->TransformPadsWithClearanceToPolygon( initialPolys, layer, 0, maxError,
ERROR_OUTSIDE );
footprint->TransformPadsToPolySet( initialPolys, layer, 0, maxError, ERROR_OUTSIDE );
// add shapes inflated by aMinThickness/2 in areas
footprint->TransformPadsWithClearanceToPolygon( areas, layer, inflate, maxError,
ERROR_OUTSIDE );
footprint->TransformPadsToPolySet( areas, layer, inflate, maxError, ERROR_OUTSIDE );
for( const BOARD_ITEM* item : footprint->GraphicalItems() )
{
if( item->Type() == PCB_FP_SHAPE_T && item->IsOnLayer( layer ) )
{
// add shapes with their exact mask layer size in initialPolys
item->TransformShapeWithClearanceToPolygon( initialPolys, layer, 0, maxError,
ERROR_OUTSIDE );
item->TransformShapeToPolygon( initialPolys, layer, 0, maxError, ERROR_OUTSIDE );
// add shapes inflated by aMinThickness/2 in areas
item->TransformShapeWithClearanceToPolygon( areas, layer, inflate, maxError,
ERROR_OUTSIDE );
item->TransformShapeToPolygon( areas, layer, inflate, maxError, ERROR_OUTSIDE );
}
else if( item->Type() == PCB_FP_SHAPE_T && item->IsOnLayer( Edge_Cuts ) )
{
@ -883,12 +879,11 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
int clearance = via->GetSolderMaskExpansion();
// add shapes with their exact mask layer size in initialPolys
via->TransformShapeWithClearanceToPolygon( initialPolys, layer, clearance, maxError,
ERROR_OUTSIDE );
via->TransformShapeToPolygon( initialPolys, layer, clearance, maxError, ERROR_OUTSIDE );
// add shapes inflated by aMinThickness/2 in areas
via->TransformShapeWithClearanceToPolygon( areas, layer, clearance + inflate, maxError,
ERROR_OUTSIDE );
clearance += inflate;
via->TransformShapeToPolygon( areas, layer, clearance, maxError, ERROR_OUTSIDE );
}
// Add filled zone areas.
@ -903,11 +898,9 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
if( item->IsOnLayer( layer ) )
{
// add shapes with their exact mask layer size in initialPolys
item->TransformShapeWithClearanceToPolygon( initialPolys, layer, 0, maxError,
ERROR_OUTSIDE );
item->TransformShapeToPolygon( initialPolys, layer, 0, maxError, ERROR_OUTSIDE );
// add shapes inflated by aMinThickness/2 in areas
item->TransformShapeWithClearanceToPolygon( areas, layer, inflate, maxError,
ERROR_OUTSIDE );
item->TransformShapeToPolygon( areas, layer, inflate, maxError, ERROR_OUTSIDE );
}
else if( item->IsOnLayer( Edge_Cuts ) )
{

View File

@ -827,7 +827,7 @@ void BRDITEMS_PLOTTER::PlotPcbText( const EDA_TEXT* aText, PCB_LAYER_ID aLayer,
int margin = attrs.m_StrokeWidth * 1.5
+ GetKnockoutTextMargin( attrs.m_Size, attrs.m_StrokeWidth );
aText->TransformBoundingBoxWithClearanceToPolygon( &finalPoly, margin );
aText->TransformBoundingBoxToPolygon( &finalPoly, margin );
finalPoly.BooleanSubtract( knockouts, SHAPE_POLY_SET::PM_FAST );
finalPoly.Fracture( SHAPE_POLY_SET::PM_FAST );

View File

@ -3459,8 +3459,7 @@ void ALTIUM_PCB::HelperPcpShapeAsBoardKeepoutRegion( const PCB_SHAPE& aShape,
HelperSetZoneLayers( zone, aAltiumLayer );
HelperSetZoneKeepoutRestrictions( zone, aKeepoutRestrictions );
aShape.EDA_SHAPE::TransformShapeWithClearanceToPolygon( *zone->Outline(), 0, ARC_HIGH_DEF,
ERROR_INSIDE, false );
aShape.EDA_SHAPE::TransformShapeToPolygon( *zone->Outline(), 0, ARC_HIGH_DEF, ERROR_INSIDE );
zone->SetBorderDisplayStyle( ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE,
ZONE::GetDefaultHatchPitch(), true );
@ -3481,8 +3480,7 @@ void ALTIUM_PCB::HelperPcpShapeAsFootprintKeepoutRegion( FOOTPRINT* aFoo
HelperSetZoneLayers( zone, aAltiumLayer );
HelperSetZoneKeepoutRestrictions( zone, aKeepoutRestrictions );
aShape.EDA_SHAPE::TransformShapeWithClearanceToPolygon( *zone->Outline(), 0, ARC_HIGH_DEF,
ERROR_INSIDE, false );
aShape.EDA_SHAPE::TransformShapeToPolygon( *zone->Outline(), 0, ARC_HIGH_DEF, ERROR_INSIDE );
zone->SetBorderDisplayStyle( ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE,
ZONE::GetDefaultHatchPitch(), true );

View File

@ -1174,8 +1174,7 @@ PAD* CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad( const COMPONENT_PAD& aCadstarPad,
pad->SetPosition( { 0, 0 } );
pad->SetPos0( { 0, 0 } );
pad->TransformShapeWithClearanceToPolygon( padOutline, layer, 0, maxError,
ERROR_LOC::ERROR_INSIDE );
pad->TransformShapeToPolygon( padOutline, layer, 0, maxError, ERROR_INSIDE );
PCB_SHAPE* padShape = new PCB_SHAPE;
padShape->SetShape( SHAPE_T::POLY );

View File

@ -1180,7 +1180,7 @@ bool PNS_KICAD_IFACE_BASE::syncTextItem( PNS::NODE* aWorld, EDA_TEXT* aText, PCB
SHAPE_POLY_SET outline;
SHAPE_SIMPLE* shape = new SHAPE_SIMPLE();
aText->TransformBoundingBoxWithClearanceToPolygon( &outline, 0 );
aText->TransformBoundingBoxToPolygon( &outline, 0 );
for( auto iter = outline.CIterate( 0 ); iter; iter++ )
shape->Append( *iter );

View File

@ -438,8 +438,7 @@ bool TEARDROP_MANAGER::ComputePointsOnPadVia( TEARDROP_PARAMETERS* aCurrParams,
force_clip_shape = true;
preferred_height = aViaPad.m_Width * aCurrParams->m_HeightRatio;
pad->TransformShapeWithClearanceToPolygon( c_buffer, aTrack->GetLayer(), 0,
ARC_LOW_DEF, ERROR_INSIDE );
pad->TransformShapeToPolygon( c_buffer, aTrack->GetLayer(), 0, ARC_LOW_DEF, ERROR_INSIDE );
}
// Clip the pad/via shape to match the m_TdMaxHeight constraint, and for
@ -619,7 +618,7 @@ bool TEARDROP_MANAGER::findAnchorPointsOnTrack( TEARDROP_PARAMETERS* aCurrParams
else
{
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 );
}

View File

@ -559,8 +559,7 @@ SHAPE_POLY_SET CONVERT_TOOL::makePolysFromGraphics( const std::deque<EDA_ITEM*>&
if( aIgnoreLineWidths )
temp->SetFilled( true );
temp->TransformShapeWithClearanceToPolygon( poly, UNDEFINED_LAYER, 0,
bds.m_MaxError, ERROR_INSIDE,
temp->TransformShapeToPolygon( poly, UNDEFINED_LAYER, 0, bds.m_MaxError, ERROR_INSIDE,
aIgnoreLineWidths );
item->SetFlags( SKIP_STRUCT );
break;

View File

@ -718,8 +718,7 @@ std::vector<FP_SHAPE*> PAD_TOOL::RecombinePad( PAD* aPad, bool aIsDryRun, BOARD_
[&]( PCB_LAYER_ID aLayer ) -> FP_SHAPE*
{
SHAPE_POLY_SET padPoly;
aPad->TransformShapeWithClearanceToPolygon( padPoly, aLayer, 0, maxError,
ERROR_INSIDE );
aPad->TransformShapeToPolygon( padPoly, aLayer, 0, maxError, ERROR_INSIDE );
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;
SHAPE_POLY_SET drawPoly;
shape->TransformShapeWithClearanceToPolygon( drawPoly, aLayer, 0, maxError,
ERROR_INSIDE );
shape->TransformShapeToPolygon( drawPoly, aLayer, 0, maxError, ERROR_INSIDE );
drawPoly.BooleanIntersection( padPoly, SHAPE_POLY_SET::PM_FAST );
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
// to a polygon primitive
SHAPE_POLY_SET existingOutline;
aPad->TransformShapeWithClearanceToPolygon( existingOutline, layer, 0, maxError,
ERROR_INSIDE );
aPad->TransformShapeToPolygon( existingOutline, layer, 0, maxError, ERROR_INSIDE );
aPad->SetAnchorPadShape( PAD_SHAPE::CIRCLE );
if( aPad->GetSizeX() > aPad->GetSizeY() )
aPad->SetSizeX( aPad->GetSizeY() );

View File

@ -325,8 +325,8 @@ void TRACKS_CLEANER::deleteTracksInPads()
if( pad->HitTest( track->GetStart() ) && pad->HitTest( track->GetEnd() ) )
{
SHAPE_POLY_SET poly;
track->TransformShapeWithClearanceToPolygon( poly, track->GetLayer(), 0,
ARC_HIGH_DEF, ERROR_INSIDE );
track->TransformShapeToPolygon( poly, track->GetLayer(), 0, ARC_HIGH_DEF,
ERROR_INSIDE );
poly.BooleanSubtract( *pad->GetEffectivePolygon(), SHAPE_POLY_SET::PM_FAST );

View File

@ -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,
SHAPE_POLY_SET* aBoardOutline ) const
{
@ -1209,7 +1209,7 @@ void ZONE::TransformSmoothedOutlineToPolygon( SHAPE_POLY_SET& aCornerBuffer, int
}
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,
PCB_LAYER_ID aLayer, int aClearance, int aError,
ERROR_LOC aErrorLoc, bool aIgnoreLineWidth ) const
void ZONE::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
int aError, ERROR_LOC aErrorLoc, bool aIgnoreLineWidth ) const
{
wxASSERT_MSG( !aIgnoreLineWidth, wxT( "IgnoreLineWidth has no meaning for zones." ) );
@ -1286,7 +1285,7 @@ void ZONE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
if( !aClearance )
{
aCornerBuffer.Append( *m_FilledPolysList.at( aLayer ) );
aBuffer.Append( *m_FilledPolysList.at( aLayer ) );
return;
}
@ -1300,15 +1299,14 @@ void ZONE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
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,
int aError ) const
void ZONE::TransformSolidAreasShapesToPolygon( PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aBuffer ) const
{
if( m_FilledPolysList.count( aLayer ) && !m_FilledPolysList.at( aLayer )->IsEmpty() )
aCornerBuffer.Append( *m_FilledPolysList.at( aLayer ) );
aBuffer.Append( *m_FilledPolysList.at( aLayer ) );
}

View File

@ -361,11 +361,10 @@ public:
* Arcs (ends of segments) are approximated by segments
*
* @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
*/
void TransformSolidAreasShapesToPolygon( PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aCornerBuffer,
int aError = ARC_HIGH_DEF ) const;
void TransformSolidAreasShapesToPolygon( PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aBuffer ) const;
/**
* Convert the outlines shape to a polygon with no holes
@ -374,11 +373,11 @@ public:
* Used in filling zones calculations
* 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 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,
SHAPE_POLY_SET* aBoardOutline ) const;
@ -388,15 +387,14 @@ public:
* Circles and arcs are approximated by segments
*
* @param aLayer is the layer of the filled zone to retrieve
* @param aCornerBuffer is a buffer to store the polygon
* @param aClearanceValue is the clearance around the pad
* @param aBuffer is a buffer to store the polygon
* @param aClearance is the clearance around the pad
* @param aError is the maximum deviation from true circle
* @param ignoreLineWidth is used for edge cut items where the line width is only
* for visualization
* @param ignoreLineWidth is used for edge cut items where the line width is only for
* visualization
*/
void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
PCB_LAYER_ID aLayer, int aClearanceValue,
int aError, ERROR_LOC aErrorLoc,
void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer,
int aClearance, int aError, ERROR_LOC aErrorLoc,
bool ignoreLineWidth = false ) const override;
/**

View File

@ -583,8 +583,7 @@ void ZONE_FILLER::addKnockout( PAD* aPad, PCB_LAYER_ID aLayer, int aGap, SHAPE_P
if( aPad->GetShape() == PAD_SHAPE::CUSTOM )
{
SHAPE_POLY_SET poly;
aPad->TransformShapeWithClearanceToPolygon( poly, aLayer, aGap, m_maxError,
ERROR_OUTSIDE );
aPad->TransformShapeToPolygon( poly, aLayer, aGap, m_maxError, ERROR_OUTSIDE );
// the pad shape in zone can be its convex hull or the shape itself
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
{
aPad->TransformShapeWithClearanceToPolygon( aHoles, aLayer, aGap, m_maxError,
ERROR_OUTSIDE );
aPad->TransformShapeToPolygon( aHoles, aLayer, aGap, m_maxError, 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 )
{
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_SHAPE_T:
case PCB_TARGET_T:
aItem->TransformShapeWithClearanceToPolygon( aHoles, aLayer, aGap, m_maxError,
ERROR_OUTSIDE, aIgnoreLineWidth );
aItem->TransformShapeToPolygon( aHoles, aLayer, aGap, m_maxError, ERROR_OUTSIDE,
aIgnoreLineWidth );
break;
case PCB_FP_TEXT_T:
if( text->IsVisible() )
{
aItem->TransformShapeWithClearanceToPolygon( aHoles, aLayer, aGap, m_maxError,
ERROR_OUTSIDE, aIgnoreLineWidth );
aItem->TransformShapeToPolygon( aHoles, aLayer, aGap, m_maxError, ERROR_OUTSIDE,
aIgnoreLineWidth );
}
break;
@ -746,14 +744,9 @@ void ZONE_FILLER::knockoutThermalReliefs( const ZONE* aZone, PCB_LAYER_ID aLayer
}
if( pad->FlashLayer( aLayer ) )
{
addKnockout( pad, aLayer, padClearance, holes );
}
else if( pad->GetDrillSize().x > 0 )
{
pad->TransformHoleWithClearanceToPolygon( holes, holeClearance, m_maxError,
ERROR_OUTSIDE );
}
pad->TransformHoleToPolygon( holes, holeClearance, m_maxError, ERROR_OUTSIDE );
}
}
@ -869,8 +862,7 @@ void ZONE_FILLER::buildCopperItemClearances( const ZONE* aZone, PCB_LAYER_ID aLa
if( via->FlashLayer( aLayer ) && gap > 0 )
{
via->TransformShapeWithClearanceToPolygon( aHoles, aLayer,
gap + extra_margin,
via->TransformShapeToPolygon( aHoles, aLayer, gap + extra_margin,
m_maxError, ERROR_OUTSIDE );
}
@ -896,10 +888,8 @@ void ZONE_FILLER::buildCopperItemClearances( const ZONE* aZone, PCB_LAYER_ID aLa
{
if( gap > 0 )
{
aTrack->TransformShapeWithClearanceToPolygon( aHoles, aLayer,
gap + extra_margin,
m_maxError,
ERROR_OUTSIDE );
aTrack->TransformShapeToPolygon( aHoles, aLayer, gap + extra_margin,
m_maxError, ERROR_OUTSIDE );
}
}
}
@ -1048,10 +1038,8 @@ void ZONE_FILLER::buildCopperItemClearances( const ZONE* aZone, PCB_LAYER_ID aLa
aKnockout, aLayer ) );
SHAPE_POLY_SET poly;
aKnockout->TransformShapeWithClearanceToPolygon( poly, aLayer,
gap + extra_margin,
m_maxError,
ERROR_OUTSIDE );
aKnockout->TransformShapeToPolygon( poly, aLayer, gap + extra_margin,
m_maxError, ERROR_OUTSIDE );
aHoles.Append( poly );
}
}
@ -1896,8 +1884,8 @@ bool ZONE_FILLER::addHatchFillTypeOnZone( const ZONE* aZone, PCB_LAYER_ID aLayer
outline_margin - min_annular_ring_width );
clearance = std::max( 0, clearance - linethickness / 2 );
pad->TransformShapeWithClearanceToPolygon( aprons, aLayer, clearance,
ARC_HIGH_DEF, ERROR_OUTSIDE );
pad->TransformShapeToPolygon( aprons, aLayer, clearance, ARC_HIGH_DEF,
ERROR_OUTSIDE );
}
}
}

View File

@ -45,8 +45,7 @@ void process( const BOARD_CONNECTED_ITEM* item, int net )
SHAPE_POLY_SET pset;
item->TransformShapeWithClearanceToPolygon( pset, UNDEFINED_LAYER, 1, ARC_HIGH_DEF,
ERROR_OUTSIDE );
item->TransformShapeToPolygon( pset, UNDEFINED_LAYER, 1, ARC_HIGH_DEF, ERROR_OUTSIDE );
SHAPE_FILE_IO shapeIo; // default = stdout
shapeIo.Write( &pset );