enum class PAD_SHAPE_T

This commit is contained in:
Marek Roszko 2021-05-01 08:22:35 -04:00
parent 21fde9b629
commit b243c2280d
36 changed files with 315 additions and 314 deletions

View File

@ -334,7 +334,7 @@ void BOARD_ADAPTER::createPadWithClearance( const PAD* aPad, CONTAINER_2D_BASE*
// is only the size of the anchor), so for those we punt and just use aClearanceValue.x.
if( ( aClearanceValue.x < 0 || aClearanceValue.x != aClearanceValue.y )
&& aPad->GetShape() != PAD_SHAPE_CUSTOM )
&& aPad->GetShape() != PAD_SHAPE::CUSTOM )
{
PAD dummy( *aPad );
dummy.SetSize( aPad->GetSize() + aClearanceValue + aClearanceValue );
@ -517,12 +517,12 @@ void BOARD_ADAPTER::addPadsWithClearance( const FOOTPRINT* aFootprint,
{
switch( pad->GetShape() )
{
case PAD_SHAPE_CIRCLE:
case PAD_SHAPE::CIRCLE:
if( pad->GetDrillShape() == PAD_DRILL_SHAPE_CIRCLE )
continue;
break;
case PAD_SHAPE_OVAL:
case PAD_SHAPE::OVAL:
if( pad->GetDrillShape() != PAD_DRILL_SHAPE_CIRCLE )
continue;
break;
@ -833,7 +833,7 @@ void BOARD_ADAPTER::addSolidAreasShapes( const ZONE* aZoneContainer,
void BOARD_ADAPTER::buildPadOutlineAsSegments( const PAD* aPad, CONTAINER_2D_BASE* aDstContainer,
int aWidth )
{
if( aPad->GetShape() == PAD_SHAPE_CIRCLE ) // Draw a ring
if( aPad->GetShape() == PAD_SHAPE::CIRCLE ) // Draw a ring
{
const SFVEC2F center3DU( aPad->ShapePos().x * m_biuTo3Dunits,
-aPad->ShapePos().y * m_biuTo3Dunits );

View File

@ -37,7 +37,7 @@
void BOARD_ADAPTER::buildPadOutlineAsPolygon( const PAD* aPad, SHAPE_POLY_SET& aCornerBuffer,
int aWidth ) const
{
if( aPad->GetShape() == PAD_SHAPE_CIRCLE ) // Draw a ring
if( aPad->GetShape() == PAD_SHAPE::CIRCLE ) // Draw a ring
{
TransformRingToPolygon( aCornerBuffer, aPad->ShapePos(), aPad->GetSize().x / 2,
aWidth, ARC_HIGH_DEF, ERROR_INSIDE );

View File

@ -76,7 +76,7 @@ size_t hash_fp_item( const EDA_ITEM* aItem, int aFlags )
{
const PAD* pad = static_cast<const PAD*>( aItem );
ret = hash<int>{}( pad->GetShape() << 16 );
ret = hash<int>{}( static_cast<int>( pad->GetShape() ) << 16 );
hash_combine( ret, pad->GetDrillShape() << 18 );
hash_combine( ret, pad->GetSize().x << 8 );
hash_combine( ret, pad->GetSize().y << 9 );

View File

@ -28,32 +28,33 @@
/**
* The set of pad shapes, used with PAD::{Set,Get}Shape()
* DO NOT REORDER, legacy_plugin is dependent on the integer values
*/
enum PAD_SHAPE_T
enum class PAD_SHAPE : int
{
PAD_SHAPE_CIRCLE,
PAD_SHAPE_RECT,
PAD_SHAPE_OVAL,
PAD_SHAPE_TRAPEZOID,
PAD_SHAPE_ROUNDRECT,
CIRCLE,
RECT,
OVAL,
TRAPEZOID,
ROUNDRECT,
// Rectangle with a chamfered corner ( and with rounded other corners).
PAD_SHAPE_CHAMFERED_RECT,
PAD_SHAPE_CUSTOM // A shape defined by user, using a set of basic shapes
// (thick segments, circles, arcs, polygons.
CHAMFERED_RECT,
CUSTOM // A shape defined by user, using a set of basic shapes
// (thick segments, circles, arcs, polygons.
};
static inline std::string PAD_SHAPE_T_asString( PAD_SHAPE_T a )
static inline std::string PAD_SHAPE_T_asString( PAD_SHAPE a )
{
switch( a )
{
case PAD_SHAPE_CIRCLE: return "PAD_SHAPE_CIRCLE";
case PAD_SHAPE_RECT: return "PAD_SHAPE_RECT";
case PAD_SHAPE_OVAL: return "PAD_SHAPE_OVAL";
case PAD_SHAPE_TRAPEZOID: return "PAD_SHAPE_TRAPEZOID";
case PAD_SHAPE_ROUNDRECT: return "PAD_SHAPE_ROUNDRECT";
case PAD_SHAPE_CHAMFERED_RECT: return "PAD_SHAPE_CHAMFERED_RECT";
case PAD_SHAPE_CUSTOM: return "PAD_SHAPE_CUSTOM";
case PAD_SHAPE::CIRCLE: return "PAD_SHAPE::CIRCLE";
case PAD_SHAPE::RECT: return "PAD_SHAPE::RECT";
case PAD_SHAPE::OVAL: return "PAD_SHAPE::OVAL";
case PAD_SHAPE::TRAPEZOID: return "PAD_SHAPE::TRAPEZOID";
case PAD_SHAPE::ROUNDRECT: return "PAD_SHAPE::ROUNDRECT";
case PAD_SHAPE::CHAMFERED_RECT: return "PAD_SHAPE::CHAMFERED_RECT";
case PAD_SHAPE::CUSTOM: return "PAD_SHAPE::CUSTOM";
}
return ""; // Just to quiet GCC.

View File

@ -918,7 +918,7 @@ void AR_MATRIX::PlacePad( PAD* aPad, int color, int marge, AR_MATRIX::CELL_OP op
dx = aPad->GetSize().x / 2;
dx += marge;
if( aPad->GetShape() == PAD_SHAPE_CIRCLE )
if( aPad->GetShape() == PAD_SHAPE::CIRCLE )
{
traceFilledCircle( shape_pos.x, shape_pos.y, dx, aPad->GetLayerSet(), color, op_logic );
return;
@ -927,7 +927,7 @@ void AR_MATRIX::PlacePad( PAD* aPad, int color, int marge, AR_MATRIX::CELL_OP op
dy = aPad->GetSize().y / 2;
dy += marge;
if( aPad->GetShape() == PAD_SHAPE_TRAPEZOID )
if( aPad->GetShape() == PAD_SHAPE::TRAPEZOID )
{
dx += abs( aPad->GetDelta().y ) / 2;
dy += abs( aPad->GetDelta().x ) / 2;

View File

@ -160,12 +160,12 @@ void FOOTPRINT::TransformPadsWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuff
{
switch( pad->GetShape() )
{
case PAD_SHAPE_CIRCLE:
case PAD_SHAPE::CIRCLE:
if( pad->GetDrillShape() == PAD_DRILL_SHAPE_CIRCLE )
continue;
break;
case PAD_SHAPE_OVAL:
case PAD_SHAPE::OVAL:
if( pad->GetDrillShape() != PAD_DRILL_SHAPE_CIRCLE )
continue;
break;
@ -212,7 +212,7 @@ void FOOTPRINT::TransformPadsWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuff
// size is only the size of the anchor), so for those we punt and just use clearance.x.
if( ( clearance.x < 0 || clearance.x != clearance.y )
&& pad->GetShape() != PAD_SHAPE_CUSTOM )
&& pad->GetShape() != PAD_SHAPE::CUSTOM )
{
PAD dummy( *pad );
dummy.SetSize( pad->GetSize() + clearance + clearance );
@ -618,8 +618,8 @@ void PAD::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
switch( GetShape() )
{
case PAD_SHAPE_CIRCLE:
case PAD_SHAPE_OVAL:
case PAD_SHAPE::CIRCLE:
case PAD_SHAPE::OVAL:
if( dx == dy )
{
TransformCircleToPolygon( aCornerBuffer, padShapePos, dx + aClearanceValue, aError,
@ -638,11 +638,11 @@ void PAD::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
break;
case PAD_SHAPE_TRAPEZOID:
case PAD_SHAPE_RECT:
case PAD_SHAPE::TRAPEZOID:
case PAD_SHAPE::RECT:
{
int ddx = GetShape() == PAD_SHAPE_TRAPEZOID ? m_deltaSize.x / 2 : 0;
int ddy = GetShape() == PAD_SHAPE_TRAPEZOID ? m_deltaSize.y / 2 : 0;
int ddx = GetShape() == PAD_SHAPE::TRAPEZOID ? m_deltaSize.x / 2 : 0;
int ddy = GetShape() == PAD_SHAPE::TRAPEZOID ? m_deltaSize.y / 2 : 0;
wxPoint corners[4];
corners[0] = wxPoint( -dx - ddy, dy + ddx );
@ -676,12 +676,12 @@ void PAD::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
}
break;
case PAD_SHAPE_CHAMFERED_RECT:
case PAD_SHAPE_ROUNDRECT:
case PAD_SHAPE::CHAMFERED_RECT:
case PAD_SHAPE::ROUNDRECT:
{
int radius = GetRoundRectCornerRadius();
wxSize shapesize( m_size );
bool doChamfer = GetShape() == PAD_SHAPE_CHAMFERED_RECT;
bool doChamfer = GetShape() == PAD_SHAPE::CHAMFERED_RECT;
double chamferRatio = doChamfer ? GetChamferRectRatio() : 0.0;
@ -728,7 +728,7 @@ void PAD::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
}
break;
case PAD_SHAPE_CUSTOM:
case PAD_SHAPE::CUSTOM:
{
SHAPE_POLY_SET outline;
MergePrimitivesAsPolygon( &outline, aLayer, aErrorLoc );

View File

@ -69,17 +69,17 @@ const VECTOR2I CN_ITEM::GetAnchor( int n ) const
switch( pad->GetShape() )
{
case PAD_SHAPE_TRAPEZOID:
case PAD_SHAPE::TRAPEZOID:
// Because the trap delta is applied as +1/2 at one end and -1/2 at the other,
// the midpoint is actually unchanged. Therefore all the cardinal points are
// the same as for a rectangle.
KI_FALLTHROUGH;
case PAD_SHAPE_RECT:
case PAD_SHAPE_CIRCLE:
case PAD_SHAPE_OVAL:
case PAD_SHAPE_ROUNDRECT:
case PAD_SHAPE_CHAMFERED_RECT:
case PAD_SHAPE::RECT:
case PAD_SHAPE::CIRCLE:
case PAD_SHAPE::OVAL:
case PAD_SHAPE::ROUNDRECT:
case PAD_SHAPE::CHAMFERED_RECT:
switch( n )
{
case 1: pt1.y -= pad->GetSize().y / 2; break; // North
@ -93,12 +93,12 @@ const VECTOR2I CN_ITEM::GetAnchor( int n ) const
RotatePoint( pt1, pad->ShapePos(), pad->GetOrientation() );
// Thermal spokes on circular pads form an 'X' instead of a '+'
if( pad->GetShape() == PAD_SHAPE_CIRCLE )
if( pad->GetShape() == PAD_SHAPE::CIRCLE )
RotatePoint( pt1, pad->ShapePos(), 450 );
return pt1;
case PAD_SHAPE_CUSTOM:
case PAD_SHAPE::CUSTOM:
{
switch( n )
{

View File

@ -50,17 +50,17 @@
// list of pad shapes, ordered like the pad shape wxChoice in dialog.
static PAD_SHAPE_T code_shape[] =
static PAD_SHAPE code_shape[] =
{
PAD_SHAPE_CIRCLE,
PAD_SHAPE_OVAL,
PAD_SHAPE_RECT,
PAD_SHAPE_TRAPEZOID,
PAD_SHAPE_ROUNDRECT,
PAD_SHAPE_CHAMFERED_RECT,
PAD_SHAPE_CHAMFERED_RECT, // choice = CHOICE_SHAPE_CHAMFERED_ROUNDED_RECT
PAD_SHAPE_CUSTOM, // choice = CHOICE_SHAPE_CUSTOM_CIRC_ANCHOR
PAD_SHAPE_CUSTOM // choice = PAD_SHAPE_CUSTOM_RECT_ANCHOR
PAD_SHAPE::CIRCLE,
PAD_SHAPE::OVAL,
PAD_SHAPE::RECT,
PAD_SHAPE::TRAPEZOID,
PAD_SHAPE::ROUNDRECT,
PAD_SHAPE::CHAMFERED_RECT,
PAD_SHAPE::CHAMFERED_RECT, // choice = CHOICE_SHAPE_CHAMFERED_ROUNDED_RECT
PAD_SHAPE::CUSTOM, // choice = CHOICE_SHAPE_CUSTOM_CIRC_ANCHOR
PAD_SHAPE::CUSTOM // choice = PAD_SHAPE::CUSTOM_RECT_ANCHOR
};
// the ordered index of the pad shape wxChoice in dialog.
@ -333,8 +333,8 @@ void DIALOG_PAD_PROPERTIES::updateRoundRectCornerValues()
void DIALOG_PAD_PROPERTIES::onCornerRadiusChange( wxCommandEvent& event )
{
if( m_dummyPad->GetShape() != PAD_SHAPE_ROUNDRECT &&
m_dummyPad->GetShape() != PAD_SHAPE_CHAMFERED_RECT )
if( m_dummyPad->GetShape() != PAD_SHAPE::ROUNDRECT &&
m_dummyPad->GetShape() != PAD_SHAPE::CHAMFERED_RECT )
return;
double rrRadius = m_cornerRadius.GetValue();
@ -358,8 +358,8 @@ void DIALOG_PAD_PROPERTIES::onCornerRadiusChange( wxCommandEvent& event )
void DIALOG_PAD_PROPERTIES::onCornerSizePercentChange( wxCommandEvent& event )
{
if( m_dummyPad->GetShape() != PAD_SHAPE_ROUNDRECT &&
m_dummyPad->GetShape() != PAD_SHAPE_CHAMFERED_RECT )
if( m_dummyPad->GetShape() != PAD_SHAPE::ROUNDRECT &&
m_dummyPad->GetShape() != PAD_SHAPE::CHAMFERED_RECT )
{
return;
}
@ -575,21 +575,21 @@ void DIALOG_PAD_PROPERTIES::initValues()
switch( m_dummyPad->GetShape() )
{
default:
case PAD_SHAPE_CIRCLE: m_PadShapeSelector->SetSelection( CHOICE_SHAPE_CIRCLE ); break;
case PAD_SHAPE_OVAL: m_PadShapeSelector->SetSelection( CHOICE_SHAPE_OVAL ); break;
case PAD_SHAPE_RECT: m_PadShapeSelector->SetSelection( CHOICE_SHAPE_RECT ); break;
case PAD_SHAPE_TRAPEZOID: m_PadShapeSelector->SetSelection( CHOICE_SHAPE_TRAPEZOID ); break;
case PAD_SHAPE_ROUNDRECT: m_PadShapeSelector->SetSelection( CHOICE_SHAPE_ROUNDRECT ); break;
case PAD_SHAPE::CIRCLE: m_PadShapeSelector->SetSelection( CHOICE_SHAPE_CIRCLE ); break;
case PAD_SHAPE::OVAL: m_PadShapeSelector->SetSelection( CHOICE_SHAPE_OVAL ); break;
case PAD_SHAPE::RECT: m_PadShapeSelector->SetSelection( CHOICE_SHAPE_RECT ); break;
case PAD_SHAPE::TRAPEZOID: m_PadShapeSelector->SetSelection( CHOICE_SHAPE_TRAPEZOID ); break;
case PAD_SHAPE::ROUNDRECT: m_PadShapeSelector->SetSelection( CHOICE_SHAPE_ROUNDRECT ); break;
case PAD_SHAPE_CHAMFERED_RECT:
case PAD_SHAPE::CHAMFERED_RECT:
if( m_dummyPad->GetRoundRectRadiusRatio() > 0.0 )
m_PadShapeSelector->SetSelection( CHOICE_SHAPE_CHAMFERED_ROUNDED_RECT );
else
m_PadShapeSelector->SetSelection( CHOICE_SHAPE_CHAMFERED_RECT );
break;
case PAD_SHAPE_CUSTOM:
if( m_dummyPad->GetAnchorPadShape() == PAD_SHAPE_RECT )
case PAD_SHAPE::CUSTOM:
if( m_dummyPad->GetAnchorPadShape() == PAD_SHAPE::RECT )
m_PadShapeSelector->SetSelection( CHOICE_SHAPE_CUSTOM_RECT_ANCHOR );
else
m_PadShapeSelector->SetSelection( CHOICE_SHAPE_CUSTOM_CIRC_ANCHOR );
@ -607,7 +607,7 @@ void DIALOG_PAD_PROPERTIES::initValues()
updateRoundRectCornerValues();
enablePrimitivePage( PAD_SHAPE_CUSTOM == m_dummyPad->GetShape() );
enablePrimitivePage( PAD_SHAPE::CUSTOM == m_dummyPad->GetShape() );
// Type of pad selection
bool aperture = m_dummyPad->GetAttribute() == PAD_ATTRIB_SMD && m_dummyPad->IsAperturePad();
@ -842,8 +842,8 @@ void DIALOG_PAD_PROPERTIES::OnPadShapeSelection( wxCommandEvent& event )
m_dummyPad->GetRoundRectRadiusRatio() * 100 ) );
break;
case CHOICE_SHAPE_CUSTOM_CIRC_ANCHOR: // PAD_SHAPE_CUSTOM, circular anchor
case CHOICE_SHAPE_CUSTOM_RECT_ANCHOR: // PAD_SHAPE_CUSTOM, rect anchor
case CHOICE_SHAPE_CUSTOM_CIRC_ANCHOR: // PAD_SHAPE::CUSTOM, circular anchor
case CHOICE_SHAPE_CUSTOM_RECT_ANCHOR: // PAD_SHAPE::CUSTOM, rect anchor
m_shapePropsBook->SetSelection( 0 );
break;
}
@ -1207,11 +1207,11 @@ bool DIALOG_PAD_PROPERTIES::padValuesOK()
wxSize pad_size = m_dummyPad->GetSize();
wxSize drill_size = m_dummyPad->GetDrillSize();
if( m_dummyPad->GetShape() == PAD_SHAPE_CUSTOM )
if( m_dummyPad->GetShape() == PAD_SHAPE::CUSTOM )
{
// allow 0-sized anchor pads
}
else if( m_dummyPad->GetShape() == PAD_SHAPE_CIRCLE )
else if( m_dummyPad->GetShape() == PAD_SHAPE::CIRCLE )
{
if( pad_size.x <= 0 )
warning_msgs.Add( _( "Warning: Pad size is less than zero." ) );
@ -1257,7 +1257,7 @@ bool DIALOG_PAD_PROPERTIES::padValuesOK()
// Therefore test for minimal acceptable negative value
// Hovewer, a negative value can give strange result with custom shapes, so it is not
// allowed for custom pad shape
if( m_dummyPad->GetLocalSolderMaskMargin() < 0 && m_dummyPad->GetShape() == PAD_SHAPE_CUSTOM )
if( m_dummyPad->GetLocalSolderMaskMargin() < 0 && m_dummyPad->GetShape() == PAD_SHAPE::CUSTOM )
{
warning_msgs.Add( _( "Warning: Negative solder mask clearances are not supported for "
"custom pad shapes." ) );
@ -1372,8 +1372,8 @@ bool DIALOG_PAD_PROPERTIES::padValuesOK()
warning_msgs.Add( _( "Warning: BGA property is for SMD pads." ) );
}
if( m_dummyPad->GetShape() == PAD_SHAPE_ROUNDRECT ||
m_dummyPad->GetShape() == PAD_SHAPE_CHAMFERED_RECT )
if( m_dummyPad->GetShape() == PAD_SHAPE::ROUNDRECT ||
m_dummyPad->GetShape() == PAD_SHAPE::CHAMFERED_RECT )
{
wxASSERT( m_tcCornerSizeRatio->GetValue() == m_tcMixedCornerSizeRatio->GetValue() );
wxString value = m_tcCornerSizeRatio->GetValue();
@ -1393,7 +1393,7 @@ bool DIALOG_PAD_PROPERTIES::padValuesOK()
}
// PADSTACKS TODO: this will need to check each layer in the pad...
if( m_dummyPad->GetShape() == PAD_SHAPE_CUSTOM )
if( m_dummyPad->GetShape() == PAD_SHAPE::CUSTOM )
{
SHAPE_POLY_SET mergedPolygon;
m_dummyPad->MergePrimitivesAsPolygon( &mergedPolygon, UNDEFINED_LAYER );
@ -1567,7 +1567,7 @@ bool DIALOG_PAD_PROPERTIES::TransferDataFromWindow()
m_currentPad->SetPadToDieLength( m_padMaster->GetPadToDieLength() );
if( m_padMaster->GetShape() != PAD_SHAPE_CUSTOM )
if( m_padMaster->GetShape() != PAD_SHAPE::CUSTOM )
m_padMaster->DeletePrimitivesList();
@ -1600,10 +1600,10 @@ bool DIALOG_PAD_PROPERTIES::TransferDataFromWindow()
// rounded rect pads with radius ratio = 0 are in fact rect pads.
// So set the right shape (and perhaps issues with a radius = 0)
if( m_currentPad->GetShape() == PAD_SHAPE_ROUNDRECT &&
if( m_currentPad->GetShape() == PAD_SHAPE::ROUNDRECT &&
m_currentPad->GetRoundRectRadiusRatio() == 0.0 )
{
m_currentPad->SetShape( PAD_SHAPE_RECT );
m_currentPad->SetShape( PAD_SHAPE::RECT );
}
// Set the fabrication property:
@ -1680,11 +1680,11 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( PAD* aPad )
aPad->SetShape( code_shape[m_PadShapeSelector->GetSelection()] );
if( m_PadShapeSelector->GetSelection() == CHOICE_SHAPE_CUSTOM_RECT_ANCHOR )
aPad->SetAnchorPadShape( PAD_SHAPE_RECT );
aPad->SetAnchorPadShape( PAD_SHAPE::RECT );
else
aPad->SetAnchorPadShape( PAD_SHAPE_CIRCLE );
aPad->SetAnchorPadShape( PAD_SHAPE::CIRCLE );
if( aPad->GetShape() == PAD_SHAPE_CUSTOM )
if( aPad->GetShape() == PAD_SHAPE::CUSTOM )
aPad->ReplacePrimitives( m_primitives );
// Read pad clearances values:
@ -1721,7 +1721,7 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( PAD* aPad )
aPad->SetDrillSize( wxSize( m_holeX.GetValue(), m_holeY.GetValue() ) );
}
if( aPad->GetShape() == PAD_SHAPE_CIRCLE )
if( aPad->GetShape() == PAD_SHAPE::CIRCLE )
aPad->SetSize( wxSize( m_sizeX.GetValue(), m_sizeX.GetValue() ) );
else
aPad->SetSize( wxSize( m_sizeX.GetValue(), m_sizeY.GetValue() ) );
@ -1731,7 +1731,7 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( PAD* aPad )
bool error = false;
wxSize delta( 0, 0 );
if( aPad->GetShape() == PAD_SHAPE_TRAPEZOID )
if( aPad->GetShape() == PAD_SHAPE::TRAPEZOID )
{
// For a trapezoid, only one of delta.x or delta.y is not 0, depending on axis.
if( m_trapAxisCtrl->GetSelection() == 0 )
@ -1813,13 +1813,13 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( PAD* aPad )
}
aPad->SetChamferPositions( chamfers );
if( aPad->GetShape() == PAD_SHAPE_CUSTOM )
if( aPad->GetShape() == PAD_SHAPE::CUSTOM )
{
// The pad custom has a "anchor pad" (a basic shape: round or rect pad)
// that is the minimal area of this pad, and is usefull to ensure a hole
// diameter is acceptable, and is used in Gerber files as flashed area
// reference
if( aPad->GetAnchorPadShape() == PAD_SHAPE_CIRCLE )
if( aPad->GetAnchorPadShape() == PAD_SHAPE::CIRCLE )
aPad->SetSize( wxSize( m_sizeX.GetValue(), m_sizeX.GetValue() ) );
// define the way the clearance area is defined in zones
@ -1856,7 +1856,7 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( PAD* aPad )
break;
}
if( aPad->GetShape() == PAD_SHAPE_ROUNDRECT )
if( aPad->GetShape() == PAD_SHAPE::ROUNDRECT )
{
double ratioPercent;
@ -1864,7 +1864,7 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( PAD* aPad )
aPad->SetRoundRectRadiusRatio( ratioPercent / 100.0 );
}
if( aPad->GetShape() == PAD_SHAPE_CHAMFERED_RECT )
if( aPad->GetShape() == PAD_SHAPE::CHAMFERED_RECT )
{
if( m_PadShapeSelector->GetSelection() == CHOICE_SHAPE_CHAMFERED_ROUNDED_RECT )
{

View File

@ -118,7 +118,7 @@ static void build_pad_testpoints( BOARD *aPcb, std::vector <D356_RECORD>& aRecor
rk.x_size = pad->GetSize().x;
// Rule: round pads have y = 0
if( pad->GetShape() == PAD_SHAPE_CIRCLE )
if( pad->GetShape() == PAD_SHAPE::CIRCLE )
rk.y_size = 0;
else
rk.y_size = pad->GetSize().y;

View File

@ -436,7 +436,7 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb )
wxASSERT_MSG( false, "Pad type not implemented" );
KI_FALLTHROUGH;
case PAD_SHAPE_CIRCLE:
case PAD_SHAPE::CIRCLE:
fprintf( aFile, " ROUND %g\n",
pad->GetDrillSize().x / SCALE_FACTOR );
/* Circle is center, radius */
@ -446,7 +446,7 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb )
pad->GetSize().x / (SCALE_FACTOR * 2) );
break;
case PAD_SHAPE_RECT:
case PAD_SHAPE::RECT:
fprintf( aFile, " RECTANGULAR %g\n",
pad->GetDrillSize().x / SCALE_FACTOR );
@ -457,13 +457,13 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb )
dx / (SCALE_FACTOR / 2), dy / (SCALE_FACTOR / 2) );
break;
case PAD_SHAPE_ROUNDRECT:
case PAD_SHAPE_OVAL:
case PAD_SHAPE::ROUNDRECT:
case PAD_SHAPE::OVAL:
{
const wxSize& size = pad->GetSize();
int radius;
if( pad->GetShape() == PAD_SHAPE_ROUNDRECT )
if( pad->GetShape() == PAD_SHAPE::ROUNDRECT )
radius = pad->GetRoundRectCornerRadius();
else
radius = std::min( size.x, size.y ) / 2;
@ -545,7 +545,7 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb )
}
break;
case PAD_SHAPE_TRAPEZOID:
case PAD_SHAPE::TRAPEZOID:
{
fprintf( aFile, " POLYGON %g\n", pad->GetDrillSize().x / SCALE_FACTOR );
@ -570,7 +570,7 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb )
}
break;
case PAD_SHAPE_CUSTOM:
case PAD_SHAPE::CUSTOM:
{
fprintf( aFile, " POLYGON %g\n", pad->GetDrillSize().x / SCALE_FACTOR );

View File

@ -114,10 +114,10 @@ public:
{
switch( m_shape )
{
case PAD_SHAPE_CIRCLE:
case PAD_SHAPE_OVAL:
case PAD_SHAPE_ROUNDRECT:
case PAD_SHAPE_RECT: return true;
case PAD_SHAPE::CIRCLE:
case PAD_SHAPE::OVAL:
case PAD_SHAPE::ROUNDRECT:
case PAD_SHAPE::RECT: return true;
default: return false;
}
}
@ -134,7 +134,7 @@ private:
BOARD* m_board;
int m_id;
int m_drill;
PAD_SHAPE_T m_shape;
PAD_SHAPE m_shape;
int m_sx, m_sy;
double m_angle;
LSET m_layers;
@ -175,10 +175,10 @@ private:
switch( aStack.m_shape )
{
case PAD_SHAPE_CIRCLE:
case PAD_SHAPE_OVAL: shapeId = 0; break;
case PAD_SHAPE_ROUNDRECT: shapeId = 2; break;
case PAD_SHAPE_RECT: shapeId = 1; break;
case PAD_SHAPE::CIRCLE:
case PAD_SHAPE::OVAL: shapeId = 0; break;
case PAD_SHAPE::ROUNDRECT: shapeId = 2; break;
case PAD_SHAPE::RECT: shapeId = 1; break;
default:
shapeId = 0;
@ -251,7 +251,7 @@ HYPERLYNX_PAD_STACK::HYPERLYNX_PAD_STACK( BOARD* aBoard, const VIA* aVia )
m_angle = 0;
m_layers = LSET::AllCuMask();
m_drill = aVia->GetDrillValue();
m_shape = PAD_SHAPE_CIRCLE;
m_shape = PAD_SHAPE::CIRCLE;
m_type = PAD_ATTRIB_PTH;
m_id = 0;
}

View File

@ -140,8 +140,8 @@ FOOTPRINT* MICROWAVE_TOOL::createFootprint( MICROWAVE_FOOTPRINT_SHAPE aFootprint
case MICROWAVE_FOOTPRINT_SHAPE::STUB_ARC: // Arc Stub created by a polygonal approach:
{
pad->SetShape( PAD_SHAPE_CUSTOM );
pad->SetAnchorPadShape( PAD_SHAPE_RECT );
pad->SetShape( PAD_SHAPE::CUSTOM );
pad->SetAnchorPadShape( PAD_SHAPE::RECT );
int numPoints = (angle / 50) + 3; // Note: angles are in 0.1 degrees
std::vector<wxPoint> polyPoints;
@ -211,7 +211,7 @@ FOOTPRINT* MICROWAVE_TOOL::createBaseFootprint( const wxString& aValue,
pad->SetSize( wxSize( tw, tw ) );
pad->SetPosition( footprint->GetPosition() );
pad->SetShape( PAD_SHAPE_RECT );
pad->SetShape( PAD_SHAPE::RECT );
pad->SetAttribute( PAD_ATTRIB_SMD );
pad->SetLayerSet( F_Cu );

View File

@ -450,7 +450,7 @@ FOOTPRINT* MICROWAVE_TOOL::createMicrowaveInductor( MICROWAVE_INDUCTOR_PATTERN&
pad->SetLayerSet( LSET( footprint->GetLayer() ) );
pad->SetAttribute( PAD_ATTRIB_SMD );
pad->SetShape( PAD_SHAPE_CIRCLE );
pad->SetShape( PAD_SHAPE::CIRCLE );
PAD* newpad = new PAD( *pad );
const_cast<KIID&>( newpad->m_Uuid ) = KIID();

View File

@ -63,8 +63,8 @@ PAD::PAD( FOOTPRINT* parent ) :
m_pos = GetParent()->GetPosition();
}
SetShape( PAD_SHAPE_CIRCLE ); // Default pad shape is PAD_CIRCLE.
SetAnchorPadShape( PAD_SHAPE_CIRCLE ); // Default shape for custom shaped pads
SetShape( PAD_SHAPE::CIRCLE ); // Default pad shape is PAD_CIRCLE.
SetAnchorPadShape( PAD_SHAPE::CIRCLE ); // Default shape for custom shaped pads
// is PAD_CIRCLE.
SetDrillShape( PAD_DRILL_SHAPE_CIRCLE ); // Default pad drill shape is a circle.
m_attribute = PAD_ATTRIB_PTH; // Default pad type is plated through hole
@ -321,18 +321,18 @@ void PAD::BuildEffectiveShapes( PCB_LAYER_ID aLayer ) const
};
wxPoint shapePos = ShapePos(); // Fetch only once; rotation involves trig
PAD_SHAPE_T effectiveShape = GetShape();
PAD_SHAPE effectiveShape = GetShape();
if( GetShape() == PAD_SHAPE_CUSTOM )
if( GetShape() == PAD_SHAPE::CUSTOM )
effectiveShape = GetAnchorPadShape();
switch( effectiveShape )
{
case PAD_SHAPE_CIRCLE:
case PAD_SHAPE::CIRCLE:
add( new SHAPE_CIRCLE( shapePos, m_size.x / 2 ) );
break;
case PAD_SHAPE_OVAL:
case PAD_SHAPE::OVAL:
if( m_size.x == m_size.y ) // the oval pad is in fact a circle
add( new SHAPE_CIRCLE( shapePos, m_size.x / 2 ) );
else
@ -345,11 +345,11 @@ void PAD::BuildEffectiveShapes( PCB_LAYER_ID aLayer ) const
}
break;
case PAD_SHAPE_RECT:
case PAD_SHAPE_TRAPEZOID:
case PAD_SHAPE_ROUNDRECT:
case PAD_SHAPE::RECT:
case PAD_SHAPE::TRAPEZOID:
case PAD_SHAPE::ROUNDRECT:
{
int r = ( effectiveShape == PAD_SHAPE_ROUNDRECT ) ? GetRoundRectCornerRadius() : 0;
int r = ( effectiveShape == PAD_SHAPE::ROUNDRECT ) ? GetRoundRectCornerRadius() : 0;
wxPoint half_size( m_size.x / 2, m_size.y / 2 );
wxSize trap_delta( 0, 0 );
@ -367,7 +367,7 @@ void PAD::BuildEffectiveShapes( PCB_LAYER_ID aLayer ) const
break;
}
}
else if( effectiveShape == PAD_SHAPE_TRAPEZOID )
else if( effectiveShape == PAD_SHAPE::TRAPEZOID )
{
trap_delta = m_deltaSize / 2;
}
@ -420,7 +420,7 @@ void PAD::BuildEffectiveShapes( PCB_LAYER_ID aLayer ) const
}
break;
case PAD_SHAPE_CHAMFERED_RECT:
case PAD_SHAPE::CHAMFERED_RECT:
{
SHAPE_POLY_SET outline;
@ -438,7 +438,7 @@ void PAD::BuildEffectiveShapes( PCB_LAYER_ID aLayer ) const
break;
}
if( GetShape() == PAD_SHAPE_CUSTOM )
if( GetShape() == PAD_SHAPE::CUSTOM )
{
for( const std::shared_ptr<PCB_SHAPE>& primitive : m_editPrimitives )
{
@ -893,7 +893,7 @@ void PAD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>&
aList.emplace_back( ShowPadShape(), props );
if( ( GetShape() == PAD_SHAPE_CIRCLE || GetShape() == PAD_SHAPE_OVAL ) && m_size.x == m_size.y )
if( ( GetShape() == PAD_SHAPE::CIRCLE || GetShape() == PAD_SHAPE::OVAL ) && m_size.x == m_size.y )
{
aList.emplace_back( _( "Diameter" ), MessageTextFromValue( units, m_size.x ) );
}
@ -1005,7 +1005,7 @@ int PAD::Compare( const PAD* padref, const PAD* padcmp )
{
int diff;
if( ( diff = padref->GetShape() - padcmp->GetShape() ) != 0 )
if( ( diff = static_cast<int>( padref->GetShape() ) - static_cast<int>( padcmp->GetShape() ) ) != 0 )
return diff;
if( ( diff = padref->GetDrillShape() - padcmp->GetDrillShape() ) != 0)
@ -1073,13 +1073,13 @@ wxString PAD::ShowPadShape() const
{
switch( GetShape() )
{
case PAD_SHAPE_CIRCLE: return _( "Circle" );
case PAD_SHAPE_OVAL: return _( "Oval" );
case PAD_SHAPE_RECT: return _( "Rect" );
case PAD_SHAPE_TRAPEZOID: return _( "Trap" );
case PAD_SHAPE_ROUNDRECT: return _( "Roundrect" );
case PAD_SHAPE_CHAMFERED_RECT: return _( "Chamferedrect" );
case PAD_SHAPE_CUSTOM: return _( "CustomShape" );
case PAD_SHAPE::CIRCLE: return _( "Circle" );
case PAD_SHAPE::OVAL: return _( "Oval" );
case PAD_SHAPE::RECT: return _( "Rect" );
case PAD_SHAPE::TRAPEZOID: return _( "Trap" );
case PAD_SHAPE::ROUNDRECT: return _( "Roundrect" );
case PAD_SHAPE::CHAMFERED_RECT: return _( "Chamferedrect" );
case PAD_SHAPE::CUSTOM: return _( "CustomShape" );
default: return wxT( "???" );
}
}
@ -1295,7 +1295,7 @@ double PAD::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
}
if( aLayer == LAYER_PADS_TH
&& GetShape() != PAD_SHAPE_CUSTOM
&& GetShape() != PAD_SHAPE::CUSTOM
&& GetSizeX() <= GetDrillSizeX()
&& GetSizeY() <= GetDrillSizeY() )
{
@ -1375,11 +1375,11 @@ void PAD::ImportSettingsFrom( const PAD& aMasterPad )
switch( aMasterPad.GetShape() )
{
case PAD_SHAPE_TRAPEZOID:
case PAD_SHAPE::TRAPEZOID:
SetDelta( aMasterPad.GetDelta() );
break;
case PAD_SHAPE_CIRCLE:
case PAD_SHAPE::CIRCLE:
// ensure size.y == size.x
SetSize( wxSize( GetSize().x, GetSize().x ) );
break;
@ -1439,14 +1439,14 @@ static struct PAD_DESC
.Map( PAD_ATTRIB_CONN, _HKI( "Edge connector" ) )
.Map( PAD_ATTRIB_NPTH, _HKI( "NPTH, mechanical" ) );
ENUM_MAP<PAD_SHAPE_T>::Instance()
.Map( PAD_SHAPE_CIRCLE, _HKI( "Circle" ) )
.Map( PAD_SHAPE_RECT, _HKI( "Rectangle" ) )
.Map( PAD_SHAPE_OVAL, _HKI( "Oval" ) )
.Map( PAD_SHAPE_TRAPEZOID, _HKI( "Trapezoid" ) )
.Map( PAD_SHAPE_ROUNDRECT, _HKI( "Rounded rectangle" ) )
.Map( PAD_SHAPE_CHAMFERED_RECT, _HKI( "Chamfered rectangle" ) )
.Map( PAD_SHAPE_CUSTOM, _HKI( "Custom" ) );
ENUM_MAP<PAD_SHAPE>::Instance()
.Map( PAD_SHAPE::CIRCLE, _HKI( "Circle" ) )
.Map( PAD_SHAPE::RECT, _HKI( "Rectangle" ) )
.Map( PAD_SHAPE::OVAL, _HKI( "Oval" ) )
.Map( PAD_SHAPE::TRAPEZOID, _HKI( "Trapezoid" ) )
.Map( PAD_SHAPE::ROUNDRECT, _HKI( "Rounded rectangle" ) )
.Map( PAD_SHAPE::CHAMFERED_RECT, _HKI( "Chamfered rectangle" ) )
.Map( PAD_SHAPE::CUSTOM, _HKI( "Custom" ) );
ENUM_MAP<PAD_PROP_T>::Instance()
.Map( PAD_PROP_NONE, _HKI( "None" ) )
@ -1465,7 +1465,7 @@ static struct PAD_DESC
&PAD::SetAttribute, &PAD::GetAttribute );
propMgr.AddProperty( padType );
auto shape = new PROPERTY_ENUM<PAD, PAD_SHAPE_T>( _HKI( "Shape" ),
auto shape = new PROPERTY_ENUM<PAD, PAD_SHAPE>( _HKI( "Shape" ),
&PAD::SetShape, &PAD::GetShape );
propMgr.AddProperty( shape );
@ -1515,7 +1515,7 @@ static struct PAD_DESC
roundRadiusRatio->SetAvailableFunc(
[=]( INSPECTABLE* aItem ) -> bool
{
return aItem->Get( shape ) == PAD_SHAPE_ROUNDRECT;
return aItem->Get( shape ) == static_cast<int>( PAD_SHAPE::ROUNDRECT );
} );
propMgr.AddProperty( roundRadiusRatio );
@ -1530,5 +1530,5 @@ static struct PAD_DESC
} _PAD_DESC;
ENUM_TO_WXANY( PAD_ATTR_T );
ENUM_TO_WXANY( PAD_SHAPE_T );
ENUM_TO_WXANY( PAD_SHAPE );
ENUM_TO_WXANY( PAD_PROP_T );

View File

@ -157,7 +157,7 @@ public:
/**
* Set the new shape of this pad.
*/
void SetShape( PAD_SHAPE_T aShape )
void SetShape( PAD_SHAPE aShape )
{
m_padShape = aShape;
SetDirty();
@ -166,7 +166,7 @@ public:
/**
* @return the shape of this pad.
*/
PAD_SHAPE_T GetShape() const { return m_padShape; }
PAD_SHAPE GetShape() const { return m_padShape; }
void SetPosition( const wxPoint& aPos ) override
{
@ -179,7 +179,7 @@ public:
/**
* @return the shape of the anchor pad shape, for custom shaped pads.
*/
PAD_SHAPE_T GetAnchorPadShape() const { return m_anchorPadShape; }
PAD_SHAPE GetAnchorPadShape() const { return m_anchorPadShape; }
/**
* @return the option for the custom pad shape to use as clearance area in copper zones.
@ -202,12 +202,12 @@ public:
/**
* Set the shape of the anchor pad for custom shaped pads.
*
* @param aShape is the shape of the anchor pad shape( currently, only #PAD_SHAPE_RECT or
* #PAD_SHAPE_CIRCLE.
* @param aShape is the shape of the anchor pad shape( currently, only #PAD_SHAPE::RECT or
* #PAD_SHAPE::CIRCLE.
*/
void SetAnchorPadShape( PAD_SHAPE_T aShape )
void SetAnchorPadShape( PAD_SHAPE aShape )
{
m_anchorPadShape = ( aShape == PAD_SHAPE_RECT ) ? PAD_SHAPE_RECT : PAD_SHAPE_CIRCLE;
m_anchorPadShape = ( aShape == PAD_SHAPE::RECT ) ? PAD_SHAPE::RECT : PAD_SHAPE::CIRCLE;
SetDirty();
}
@ -680,9 +680,9 @@ private:
wxPoint m_pos; // Pad Position on board
PAD_SHAPE_T m_padShape; // Shape: PAD_SHAPE_CIRCLE, PAD_SHAPE_RECT,
// PAD_SHAPE_OVAL, PAD_SHAPE_TRAPEZOID,
// PAD_SHAPE_ROUNDRECT, PAD_SHAPE_POLYGON
PAD_SHAPE m_padShape; // Shape: PAD_SHAPE::CIRCLE, PAD_SHAPE::RECT,
// PAD_SHAPE::OVAL, PAD_SHAPE::TRAPEZOID,
// PAD_SHAPE::ROUNDRECT, PAD_SHAPE_POLYGON
/*
* Editing definitions of primitives for custom pad shapes. In local coordinates relative
* to m_Pos (NOT shapePos) at orient 0.
@ -722,8 +722,8 @@ private:
// size, default 0.25
int m_chamferPositions; // The positions of the chamfers (at orient 0)
PAD_SHAPE_T m_anchorPadShape; // For custom shaped pads: shape of pad anchor,
// PAD_SHAPE_RECT, PAD_SHAPE_CIRCLE
PAD_SHAPE m_anchorPadShape; // For custom shaped pads: shape of pad anchor,
// PAD_SHAPE::RECT, PAD_SHAPE::CIRCLE
/*
* Most of the time the hole is the center of the shape (m_Offset = 0). But some designers
@ -737,7 +737,7 @@ private:
LSET m_layerMask; // Bitwise layer: 1 = copper layer, 15 = cmp,
// 2..14 = internal layers, 16..31 = technical layers
wxSize m_deltaSize; // Delta for PAD_SHAPE_TRAPEZOID; half the delta squeezes
wxSize m_deltaSize; // Delta for PAD_SHAPE::TRAPEZOID; half the delta squeezes
// one end and half expands the other. It is only valid
// to have a single axis be non-0.

View File

@ -212,7 +212,7 @@ void PAD::MergePrimitivesAsPolygon( SHAPE_POLY_SET* aMergedPolygon, PCB_LAYER_ID
// The anchor pad is always at 0,0
switch( GetAnchorPadShape() )
{
case PAD_SHAPE_RECT:
case PAD_SHAPE::RECT:
{
SHAPE_RECT rect( -GetSize().x / 2, -GetSize().y / 2, GetSize().x, GetSize().y );
aMergedPolygon->AddOutline( rect.Outline() );
@ -220,7 +220,7 @@ void PAD::MergePrimitivesAsPolygon( SHAPE_POLY_SET* aMergedPolygon, PCB_LAYER_ID
break;
default:
case PAD_SHAPE_CIRCLE:
case PAD_SHAPE::CIRCLE:
TransformCircleToPolygon( *aMergedPolygon, wxPoint( 0, 0 ), GetSize().x / 2, maxError,
ERROR_INSIDE );
break;
@ -264,7 +264,7 @@ bool PAD::GetBestAnchorPosition( VECTOR2I& aPos )
int64_t minDist = std::numeric_limits<int64_t>::max();
int64_t minDistEdge;
if( GetAnchorPadShape() == PAD_SHAPE_CIRCLE )
if( GetAnchorPadShape() == PAD_SHAPE::CIRCLE )
{
minDistEdge = GetSize().x;
}

View File

@ -853,7 +853,7 @@ void PCB_PAINTER::draw( const PAD* aPad, int aLayer )
VECTOR2D position = padBBox.Centre();
VECTOR2D padsize = VECTOR2D( padBBox.GetSize() );
if( aPad->GetShape() != PAD_SHAPE_CUSTOM )
if( aPad->GetShape() != PAD_SHAPE::CUSTOM )
{
// Don't allow a 45º rotation to bloat a pad's bounding box unnecessarily
double limit = std::min( aPad->GetSize().x, aPad->GetSize().y ) * 1.1;
@ -1019,7 +1019,7 @@ void PCB_PAINTER::draw( const PAD* aPad, int aLayer )
std::shared_ptr<SHAPE_COMPOUND> shapes;
bool simpleShapes = true;
if( margin.x != margin.y && aPad->GetShape() != PAD_SHAPE_CUSTOM )
if( margin.x != margin.y && aPad->GetShape() != PAD_SHAPE::CUSTOM )
{
// Our algorithms below (polygon inflation in particular) can't handle differential
// inflation along separate axes. So for those cases we build a dummy pad instead,

View File

@ -287,7 +287,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
wxSize padPlotsSize = pad->GetSize() + margin * 2 + wxSize( width_adj, width_adj );
// Store these parameters that can be modified to plot inflated/deflated pads shape
PAD_SHAPE_T padShape = pad->GetShape();
PAD_SHAPE padShape = pad->GetShape();
wxSize padSize = pad->GetSize();
wxSize padDelta = pad->GetDelta(); // has meaning only for trapezoidal pads
double padCornerRadius = pad->GetRoundRectCornerRadius();
@ -298,8 +298,8 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
switch( pad->GetShape() )
{
case PAD_SHAPE_CIRCLE:
case PAD_SHAPE_OVAL:
case PAD_SHAPE::CIRCLE:
case PAD_SHAPE::OVAL:
pad->SetSize( padPlotsSize );
if( aPlotOpt.GetSkipPlotNPTH_Pads() &&
@ -311,19 +311,19 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
itemplotter.PlotPad( pad, color, padPlotMode );
break;
case PAD_SHAPE_RECT:
case PAD_SHAPE::RECT:
pad->SetSize( padPlotsSize );
if( mask_clearance > 0 )
{
pad->SetShape( PAD_SHAPE_ROUNDRECT );
pad->SetShape( PAD_SHAPE::ROUNDRECT );
pad->SetRoundRectCornerRadius( mask_clearance );
}
itemplotter.PlotPad( pad, color, padPlotMode );
break;
case PAD_SHAPE_TRAPEZOID:
case PAD_SHAPE::TRAPEZOID:
// inflate/deflate a trapezoid is a bit complex.
// so if the margin is not null, build a similar polygonal pad shape,
// and inflate/deflate the polygonal shape
@ -334,8 +334,8 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
else
{
PAD dummy( *pad );
dummy.SetAnchorPadShape( PAD_SHAPE_CIRCLE );
dummy.SetShape( PAD_SHAPE_CUSTOM );
dummy.SetAnchorPadShape( PAD_SHAPE::CIRCLE );
dummy.SetShape( PAD_SHAPE::CUSTOM );
SHAPE_POLY_SET outline;
outline.NewOutline();
int dx = padSize.x / 2;
@ -366,14 +366,14 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
break;
case PAD_SHAPE_ROUNDRECT:
case PAD_SHAPE_CHAMFERED_RECT:
case PAD_SHAPE::ROUNDRECT:
case PAD_SHAPE::CHAMFERED_RECT:
// Chamfer and rounding are stored as a percent and so don't need scaling
pad->SetSize( padPlotsSize );
itemplotter.PlotPad( pad, color, padPlotMode );
break;
case PAD_SHAPE_CUSTOM:
case PAD_SHAPE::CUSTOM:
{
// inflate/deflate a custom shape is a bit complex.
// so build a similar pad shape, and inflate/deflate the polygonal shape

View File

@ -218,26 +218,26 @@ void BRDITEMS_PLOTTER::PlotPad( const PAD* aPad, COLOR4D aColor, OUTLINE_MODE aP
switch( aPad->GetShape() )
{
case PAD_SHAPE_CIRCLE:
case PAD_SHAPE::CIRCLE:
m_plotter->FlashPadCircle( shape_pos, aPad->GetSize().x, aPlotMode, &gbr_metadata );
break;
case PAD_SHAPE_OVAL:
case PAD_SHAPE::OVAL:
m_plotter->FlashPadOval( shape_pos, aPad->GetSize(), aPad->GetOrientation(), aPlotMode,
&gbr_metadata );
break;
case PAD_SHAPE_RECT:
case PAD_SHAPE::RECT:
m_plotter->FlashPadRect( shape_pos, aPad->GetSize(), aPad->GetOrientation(), aPlotMode,
&gbr_metadata );
break;
case PAD_SHAPE_ROUNDRECT:
case PAD_SHAPE::ROUNDRECT:
m_plotter->FlashPadRoundRect( shape_pos, aPad->GetSize(), aPad->GetRoundRectCornerRadius(),
aPad->GetOrientation(), aPlotMode, &gbr_metadata );
break;
case PAD_SHAPE_TRAPEZOID:
case PAD_SHAPE::TRAPEZOID:
{
// Build the pad polygon in coordinates relative to the pad
// (i.e. for a pad at pos 0,0, rot 0.0). Needed to use aperture macros,
@ -257,7 +257,7 @@ void BRDITEMS_PLOTTER::PlotPad( const PAD* aPad, COLOR4D aColor, OUTLINE_MODE aP
}
break;
case PAD_SHAPE_CHAMFERED_RECT:
case PAD_SHAPE::CHAMFERED_RECT:
if( m_plotter->GetPlotterType() == PLOT_FORMAT::GERBER )
{
static_cast<GERBER_PLOTTER*>( m_plotter )->FlashPadChamferRoundRect(
@ -271,7 +271,7 @@ void BRDITEMS_PLOTTER::PlotPad( const PAD* aPad, COLOR4D aColor, OUTLINE_MODE aP
KI_FALLTHROUGH;
default:
case PAD_SHAPE_CUSTOM:
case PAD_SHAPE::CUSTOM:
{
const std::shared_ptr<SHAPE_POLY_SET>& polygons = aPad->GetEffectivePolygon();

View File

@ -1886,27 +1886,27 @@ void ALTIUM_PCB::ParsePads6Data( const CFB::CompoundFileReader& aReader,
switch( elem.topshape )
{
case ALTIUM_PAD_SHAPE::RECT:
pad->SetShape( PAD_SHAPE_T::PAD_SHAPE_RECT );
pad->SetShape( PAD_SHAPE::RECT );
break;
case ALTIUM_PAD_SHAPE::CIRCLE:
if( elem.sizeAndShape
&& elem.sizeAndShape->alt_shape[0] == ALTIUM_PAD_SHAPE_ALT::ROUNDRECT )
{
pad->SetShape( PAD_SHAPE_T::PAD_SHAPE_ROUNDRECT ); // 100 = round, 0 = rectangular
pad->SetShape( PAD_SHAPE::ROUNDRECT ); // 100 = round, 0 = rectangular
double ratio = elem.sizeAndShape->cornerradius[0] / 200.;
pad->SetRoundRectRadiusRatio( ratio );
}
else if( elem.topsize.x == elem.topsize.y )
{
pad->SetShape( PAD_SHAPE_T::PAD_SHAPE_CIRCLE );
pad->SetShape( PAD_SHAPE::CIRCLE );
}
else
{
pad->SetShape( PAD_SHAPE_T::PAD_SHAPE_OVAL );
pad->SetShape( PAD_SHAPE::OVAL );
}
break;
case ALTIUM_PAD_SHAPE::OCTAGONAL:
pad->SetShape( PAD_SHAPE_T::PAD_SHAPE_CHAMFERED_RECT );
pad->SetShape( PAD_SHAPE::CHAMFERED_RECT );
pad->SetChamferPositions( RECT_CHAMFER_ALL );
pad->SetChamferRectRatio( 0.25 );
break;

View File

@ -740,8 +740,8 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryCoppers( const SYMDEF_PCB& aComponen
int anchorSize = getKiCadLength( anchorpadcode.Shape.Size );
wxPoint anchorPos = getKiCadPoint( anchorPad.Position );
pad->SetShape( PAD_SHAPE_T::PAD_SHAPE_CUSTOM );
pad->SetAnchorPadShape( PAD_SHAPE_CIRCLE );
pad->SetShape( PAD_SHAPE::CUSTOM );
pad->SetAnchorPadShape( PAD_SHAPE::CIRCLE );
pad->SetSize( { anchorSize, anchorSize } );
pad->SetPosition( anchorPos );
pad->SetLocalCoord();
@ -893,7 +893,7 @@ PAD* CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad( const COMPONENT_PAD& aCadstarPad,
for( auto& reassign : csPadcode.Reassigns )
{
PCB_LAYER_ID kiLayer = getKiCadLayer( reassign.first );
PAD_SHAPE shape = reassign.second;
CADSTAR_PAD_SHAPE shape = reassign.second;
if( shape.Size == 0 )
{
@ -962,13 +962,13 @@ PAD* CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad( const COMPONENT_PAD& aCadstarPad,
{
case PAD_SHAPE_TYPE::ANNULUS:
//todo fix: use custom shape instead (Donught shape, i.e. a circle with a hole)
pad->SetShape( PAD_SHAPE_T::PAD_SHAPE_CIRCLE );
pad->SetShape( PAD_SHAPE::CIRCLE );
pad->SetSize( { getKiCadLength( csPadcode.Shape.Size ),
getKiCadLength( csPadcode.Shape.Size ) } );
break;
case PAD_SHAPE_TYPE::BULLET:
pad->SetShape( PAD_SHAPE_T::PAD_SHAPE_CHAMFERED_RECT );
pad->SetShape( PAD_SHAPE::CHAMFERED_RECT );
pad->SetSize( { getKiCadLength( (long long) csPadcode.Shape.Size
+ (long long) csPadcode.Shape.LeftLength
+ (long long) csPadcode.Shape.RightLength ),
@ -983,7 +983,7 @@ PAD* CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad( const COMPONENT_PAD& aCadstarPad,
break;
case PAD_SHAPE_TYPE::CIRCLE:
pad->SetShape( PAD_SHAPE_T::PAD_SHAPE_CIRCLE );
pad->SetShape( PAD_SHAPE::CIRCLE );
pad->SetSize( { getKiCadLength( csPadcode.Shape.Size ),
getKiCadLength( csPadcode.Shape.Size ) } );
break;
@ -993,7 +993,7 @@ PAD* CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad( const COMPONENT_PAD& aCadstarPad,
// Cadstar diamond shape is a square rotated 45 degrees
// We convert it in KiCad to a square with chamfered edges
int sizeOfSquare = (double) getKiCadLength( csPadcode.Shape.Size ) * sqrt(2.0);
pad->SetShape( PAD_SHAPE_T::PAD_SHAPE_RECT );
pad->SetShape( PAD_SHAPE::RECT );
pad->SetChamferRectRatio( 0.5 );
pad->SetSize( { sizeOfSquare, sizeOfSquare } );
@ -1003,7 +1003,7 @@ PAD* CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad( const COMPONENT_PAD& aCadstarPad,
break;
case PAD_SHAPE_TYPE::FINGER:
pad->SetShape( PAD_SHAPE_T::PAD_SHAPE_OVAL );
pad->SetShape( PAD_SHAPE::OVAL );
pad->SetSize( { getKiCadLength( (long long) csPadcode.Shape.Size
+ (long long) csPadcode.Shape.LeftLength
+ (long long) csPadcode.Shape.RightLength ),
@ -1014,7 +1014,7 @@ PAD* CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad( const COMPONENT_PAD& aCadstarPad,
break;
case PAD_SHAPE_TYPE::OCTAGON:
pad->SetShape( PAD_SHAPE_CHAMFERED_RECT );
pad->SetShape( PAD_SHAPE::CHAMFERED_RECT );
pad->SetChamferPositions( RECT_CHAMFER_POSITIONS::RECT_CHAMFER_ALL );
pad->SetChamferRectRatio( 0.25 );
pad->SetSize( { getKiCadLength( csPadcode.Shape.Size ),
@ -1022,7 +1022,7 @@ PAD* CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad( const COMPONENT_PAD& aCadstarPad,
break;
case PAD_SHAPE_TYPE::RECTANGLE:
pad->SetShape( PAD_SHAPE_T::PAD_SHAPE_RECT );
pad->SetShape( PAD_SHAPE::RECT );
pad->SetSize( { getKiCadLength( (long long) csPadcode.Shape.Size
+ (long long) csPadcode.Shape.LeftLength
+ (long long) csPadcode.Shape.RightLength ),
@ -1033,7 +1033,7 @@ PAD* CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad( const COMPONENT_PAD& aCadstarPad,
break;
case PAD_SHAPE_TYPE::ROUNDED_RECT:
pad->SetShape( PAD_SHAPE_T::PAD_SHAPE_RECT );
pad->SetShape( PAD_SHAPE::RECT );
pad->SetRoundRectCornerRadius( getKiCadLength( csPadcode.Shape.InternalFeature ) );
pad->SetSize( { getKiCadLength( (long long) csPadcode.Shape.Size
+ (long long) csPadcode.Shape.LeftLength
@ -1046,7 +1046,7 @@ PAD* CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad( const COMPONENT_PAD& aCadstarPad,
case PAD_SHAPE_TYPE::SQUARE:
pad->SetShape( PAD_SHAPE_T::PAD_SHAPE_RECT );
pad->SetShape( PAD_SHAPE::RECT );
pad->SetSize( { getKiCadLength( csPadcode.Shape.Size ),
getKiCadLength( csPadcode.Shape.Size ) } );
break;
@ -1116,9 +1116,9 @@ PAD* CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad( const COMPONENT_PAD& aCadstarPad,
if( editedPadOutline.Contains( { 0, 0 } ) )
{
pad->SetAnchorPadShape( PAD_SHAPE_T::PAD_SHAPE_RECT );
pad->SetAnchorPadShape( PAD_SHAPE::RECT );
pad->SetSize( wxSize( { 4, 4 } ) );
pad->SetShape( PAD_SHAPE_T::PAD_SHAPE_CUSTOM );
pad->SetShape( PAD_SHAPE::CUSTOM );
pad->AddPrimitive( padShape );
padOffset = { 0, 0 };
}

View File

@ -630,7 +630,7 @@ void CADSTAR_PCB_ARCHIVE_PARSER::SPACINGCODE::Parse( XNODE* aNode, PARSER_CONTEX
}
bool CADSTAR_PCB_ARCHIVE_PARSER::PAD_SHAPE::IsPadShape( XNODE* aNode )
bool CADSTAR_PCB_ARCHIVE_PARSER::CADSTAR_PAD_SHAPE::IsPadShape( XNODE* aNode )
{
wxString aNodeName = aNode->GetName();
@ -648,7 +648,7 @@ bool CADSTAR_PCB_ARCHIVE_PARSER::PAD_SHAPE::IsPadShape( XNODE* aNode )
}
void CADSTAR_PCB_ARCHIVE_PARSER::PAD_SHAPE::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
void CADSTAR_PCB_ARCHIVE_PARSER::CADSTAR_PAD_SHAPE::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
{
wxASSERT( IsPadShape( aNode ) );
@ -725,7 +725,7 @@ void CADSTAR_PCB_ARCHIVE_PARSER::PADREASSIGN::Parse( XNODE* aNode, PARSER_CONTEX
LayerID = GetXmlAttributeIDString( aNode, 0 );
if( PAD_SHAPE::IsPadShape( aNode->GetChildren() ) )
if( CADSTAR_PAD_SHAPE::IsPadShape( aNode->GetChildren() ) )
Shape.Parse( aNode->GetChildren(), aContext );
else
THROW_UNKNOWN_NODE_IO_ERROR( aNode->GetChildren()->GetName(), aNode->GetName() );
@ -748,7 +748,7 @@ void CADSTAR_PCB_ARCHIVE_PARSER::PADCODE::Parse( XNODE* aNode, PARSER_CONTEXT* a
{
wxString cNodeName = cNode->GetName();
if( PAD_SHAPE::IsPadShape( cNode ) )
if( CADSTAR_PAD_SHAPE::IsPadShape( cNode ) )
{
Shape.Parse( cNode, aContext );
}
@ -813,7 +813,7 @@ void CADSTAR_PCB_ARCHIVE_PARSER::VIAREASSIGN::Parse( XNODE* aNode, PARSER_CONTEX
LayerID = GetXmlAttributeIDString( aNode, 0 );
if( PAD_SHAPE::IsPadShape( aNode->GetChildren() ) )
if( CADSTAR_PAD_SHAPE::IsPadShape( aNode->GetChildren() ) )
Shape.Parse( aNode->GetChildren(), aContext );
else
THROW_UNKNOWN_NODE_IO_ERROR( aNode->GetChildren()->GetName(), aNode->GetName() );
@ -836,7 +836,7 @@ void CADSTAR_PCB_ARCHIVE_PARSER::VIACODE::Parse( XNODE* aNode, PARSER_CONTEXT* a
{
wxString cNodeName = cNode->GetName();
if( PAD_SHAPE::IsPadShape( cNode ) )
if( CADSTAR_PAD_SHAPE::IsPadShape( cNode ) )
{
Shape.Parse( cNode, aContext );
}

View File

@ -270,7 +270,7 @@ public:
};
struct PAD_SHAPE : PARSER
struct CADSTAR_PAD_SHAPE : PARSER
{
PAD_SHAPE_TYPE ShapeType;
long Size = UNDEFINED_VALUE;
@ -287,7 +287,7 @@ public:
struct PADREASSIGN : PARSER
{
LAYER_ID LayerID;
PAD_SHAPE Shape;
CADSTAR_PAD_SHAPE Shape;
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
@ -297,7 +297,7 @@ public:
{
PADCODE_ID ID;
wxString Name;
PAD_SHAPE Shape;
CADSTAR_PAD_SHAPE Shape;
long ReliefClearance = UNDEFINED_VALUE; ///< if undefined inherits from design
long ReliefWidth = UNDEFINED_VALUE; ///< if undefined inherits from design
bool Plated = true;
@ -308,7 +308,7 @@ public:
long DrillXoffset = 0;
long DrillYoffset = 0;
std::map<LAYER_ID, PAD_SHAPE> Reassigns;
std::map<LAYER_ID, CADSTAR_PAD_SHAPE> Reassigns;
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
@ -317,7 +317,7 @@ public:
struct VIAREASSIGN : PARSER
{
LAYER_ID LayerID;
PAD_SHAPE Shape;
CADSTAR_PAD_SHAPE Shape;
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
@ -327,13 +327,13 @@ public:
{
VIACODE_ID ID;
wxString Name;
PAD_SHAPE Shape;
CADSTAR_PAD_SHAPE Shape;
long ReliefClearance = UNDEFINED_VALUE; ///< if undefined inherits from design
long ReliefWidth = UNDEFINED_VALUE; ///< if undefined inherits from design
long DrillDiameter = UNDEFINED_VALUE;
long DrillOversize = UNDEFINED_VALUE;
std::map<LAYER_ID, PAD_SHAPE> Reassigns;
std::map<LAYER_ID, CADSTAR_PAD_SHAPE> Reassigns;
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};

View File

@ -1706,28 +1706,28 @@ void EAGLE_PLUGIN::packagePad( FOOTPRINT* aFootprint, wxXmlNode* aTree )
switch( *e.shape )
{
case EPAD::ROUND:
pad->SetShape( PAD_SHAPE_CIRCLE );
pad->SetShape( PAD_SHAPE::CIRCLE );
break;
case EPAD::OCTAGON:
// no KiCad octagonal pad shape, use PAD_CIRCLE for now.
// pad->SetShape( PAD_OCTAGON );
wxASSERT( pad->GetShape() == PAD_SHAPE_CIRCLE ); // verify set in PAD constructor
pad->SetShape( PAD_SHAPE_CHAMFERED_RECT );
wxASSERT( pad->GetShape() == PAD_SHAPE::CIRCLE ); // verify set in PAD constructor
pad->SetShape( PAD_SHAPE::CHAMFERED_RECT );
pad->SetChamferPositions( RECT_CHAMFER_ALL );
pad->SetChamferRectRatio( 0.25 );
break;
case EPAD::LONG:
pad->SetShape( PAD_SHAPE_OVAL );
pad->SetShape( PAD_SHAPE::OVAL );
break;
case EPAD::SQUARE:
pad->SetShape( PAD_SHAPE_RECT );
pad->SetShape( PAD_SHAPE::RECT );
break;
case EPAD::OFFSET:
pad->SetShape( PAD_SHAPE_OVAL );
pad->SetShape( PAD_SHAPE::OVAL );
break;
}
}
@ -1750,7 +1750,7 @@ void EAGLE_PLUGIN::packagePad( FOOTPRINT* aFootprint, wxXmlNode* aTree )
pad->SetSize( wxSize( KiROUND( diameter ), KiROUND( diameter ) ) );
}
if( pad->GetShape() == PAD_SHAPE_OVAL )
if( pad->GetShape() == PAD_SHAPE::OVAL )
{
// The Eagle "long" pad is wider than it is tall,
// m_elongation is percent elongation
@ -2146,7 +2146,7 @@ void EAGLE_PLUGIN::packageHole( FOOTPRINT* aFootprint, wxXmlNode* aTree, bool aC
PAD* pad = new PAD( aFootprint );
aFootprint->Add( pad );
pad->SetShape( PAD_SHAPE_CIRCLE );
pad->SetShape( PAD_SHAPE::CIRCLE );
pad->SetAttribute( PAD_ATTRIB_NPTH );
// Mechanical purpose only:
@ -2189,7 +2189,7 @@ void EAGLE_PLUGIN::packageSMD( FOOTPRINT* aFootprint, wxXmlNode* aTree ) const
aFootprint->Add( pad );
transferPad( e, pad );
pad->SetShape( PAD_SHAPE_RECT );
pad->SetShape( PAD_SHAPE::RECT );
pad->SetAttribute( PAD_ATTRIB_SMD );
wxSize padSize( e.dx.ToPcbUnits(), e.dy.ToPcbUnits() );
@ -2218,7 +2218,7 @@ void EAGLE_PLUGIN::packageSMD( FOOTPRINT* aFootprint, wxXmlNode* aTree ) const
if( e.roundness )
roundRatio = std::fmax( *e.roundness / 200.0, roundRatio );
pad->SetShape( PAD_SHAPE_ROUNDRECT );
pad->SetShape( PAD_SHAPE::ROUNDRECT );
pad->SetRoundRectRadiusRatio( roundRatio );
}

View File

@ -581,31 +581,31 @@ size_t FABMASTER::processPadStacks( size_t aRow )
if( pad_shape == "CIRCLE" )
{
pad->height = pad->width;
pad->shape = PAD_SHAPE_CIRCLE;
pad->shape = PAD_SHAPE::CIRCLE;
}
else if( pad_shape == "RECTANGLE" )
{
pad->shape = PAD_SHAPE_RECT;
pad->shape = PAD_SHAPE::RECT;
}
else if( pad_shape == "ROUNDED_RECT" )
{
pad->shape = PAD_SHAPE_ROUNDRECT;
pad->shape = PAD_SHAPE::ROUNDRECT;
}
else if( pad_shape == "SQUARE" )
{
pad->shape = PAD_SHAPE_RECT;
pad->shape = PAD_SHAPE::RECT;
pad->height = pad->width;
}
else if( pad_shape == "OBLONG" || pad_shape == "OBLONG_X" || pad_shape == "OBLONG_Y" )
pad->shape = PAD_SHAPE_OVAL;
pad->shape = PAD_SHAPE::OVAL;
else if( pad_shape == "OCTAGON" )
{
pad->shape = PAD_SHAPE_RECT;
pad->shape = PAD_SHAPE::RECT;
pad->is_octogon = true;
}
else if( pad_shape == "SHAPE" )
{
pad->shape = PAD_SHAPE_CUSTOM;
pad->shape = PAD_SHAPE::CUSTOM;
pad->custom_name = pad_shapename;
}
else
@ -932,7 +932,7 @@ size_t FABMASTER::processCustomPads( size_t aRow )
auto name = pad_shape_name.substr( prefix.length() );
name += "_" + pad_refdes + "_" + pad_pin_num;
auto ret = pad_shapes.emplace( name, PAD_SHAPE{} );
auto ret = pad_shapes.emplace( name, FABMASTER_PAD_SHAPE{} );
auto& custom_pad = ret.first->second;
@ -2188,7 +2188,7 @@ bool FABMASTER::loadFootprints( BOARD* aBoard )
newpad->SetShape( pad.shape );
if( pad.shape == PAD_SHAPE_CUSTOM )
if( pad.shape == PAD_SHAPE::CUSTOM )
{
// Choose the smaller dimension to ensure the base pad
// is fully hidden by the custom pad
@ -2252,7 +2252,7 @@ bool FABMASTER::loadFootprints( BOARD* aBoard )
wxLogError( wxString::Format(
_( "Invalid custom pad named '%s'. Replacing with circular pad." ),
custom_name.c_str() ) );
newpad->SetShape( PAD_SHAPE_CIRCLE );
newpad->SetShape( PAD_SHAPE::CIRCLE );
}
else
{
@ -2281,7 +2281,7 @@ bool FABMASTER::loadFootprints( BOARD* aBoard )
wxLogError( wxString::Format(
_( "Invalid custom pad named '%s'. Replacing with circular pad." ),
custom_name.c_str() ) );
newpad->SetShape( PAD_SHAPE_CIRCLE );
newpad->SetShape( PAD_SHAPE::CIRCLE );
}
}
else

View File

@ -96,7 +96,7 @@ private:
std::string name;
bool fixed;
bool via;
PAD_SHAPE_T shape;
PAD_SHAPE shape;
std::string custom_name;
bool top;
bool bottom;
@ -302,7 +302,7 @@ private:
* GRAPHIC_DATA_2!GRAPHIC_DATA_3!GRAPHIC_DATA_4!GRAPHIC_DATA_5!GRAPHIC_DATA_6!GRAPHIC_DATA_7!
* GRAPHIC_DATA_8!GRAPHIC_DATA_9!PAD_STACK_NAME!REFDES!PIN_NUMBER!
*/
struct PAD_SHAPE
struct FABMASTER_PAD_SHAPE
{
std::string name; ///<! PAD_SHAPE_NAME
std::string padstack; ///<! PAD_STACK_NAME
@ -312,14 +312,14 @@ private:
struct HASH
{
std::size_t operator()( const std::unique_ptr<PAD_SHAPE>& aPad ) const
std::size_t operator()( const std::unique_ptr<FABMASTER_PAD_SHAPE>& aPad ) const
{
return std::hash<std::string>{}( aPad->name );
}
};
};
std::unordered_map<std::string, PAD_SHAPE> pad_shapes;
std::unordered_map<std::string, FABMASTER_PAD_SHAPE> pad_shapes;
// * A!SYM_TYPE!SYM_NAME!REFDES!SYM_X!SYM_Y!SYM_ROTATE!SYM_MIRROR!NET_NAME!CLASS!SUBCLASS!RECORD_TAG!
// * GRAPHIC_DATA_NAME!GRAPHIC_DATA_NUMBER!GRAPHIC_DATA_1!GRAPHIC_DATA_2!GRAPHIC_DATA_3!GRAPHIC_DATA_4!

View File

@ -540,7 +540,7 @@ FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader )
static const LSET pad_front( 3, F_Cu, F_Mask, F_Paste );
static const LSET pad_back( 3, B_Cu, B_Mask, B_Paste );
pad->SetShape( PAD_SHAPE_RECT );
pad->SetShape( PAD_SHAPE::RECT );
pad->SetAttribute( PAD_ATTRIB_SMD );
pad->SetLayerSet( pad_front );
@ -599,9 +599,9 @@ FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader )
if( !testFlags( parameters[paramCnt-2], 0x0100, wxT( "square" ) ) )
{
if( pad->GetSize().x == pad->GetSize().y )
pad->SetShape( PAD_SHAPE_CIRCLE );
pad->SetShape( PAD_SHAPE::CIRCLE );
else
pad->SetShape( PAD_SHAPE_OVAL );
pad->SetShape( PAD_SHAPE::OVAL );
}
footprint->Add( pad );
@ -625,14 +625,14 @@ FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader )
PAD* pad = new PAD( footprint.get() );
pad->SetShape( PAD_SHAPE_CIRCLE );
pad->SetShape( PAD_SHAPE::CIRCLE );
static const LSET pad_set = LSET::AllCuMask() | LSET( 3, F_SilkS, F_Mask, B_Mask );
pad->SetLayerSet( pad_set );
if( testFlags( parameters[paramCnt-2], 0x0100, wxT( "square" ) ) )
pad->SetShape( PAD_SHAPE_RECT );
pad->SetShape( PAD_SHAPE::RECT );
// Set the pad name:
// Pcbnew pad name is used for electrical connection calculations.
@ -679,8 +679,8 @@ FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader )
padPos += footprint->GetPosition();
pad->SetPosition( padPos );
if( pad->GetShape() == PAD_SHAPE_CIRCLE && pad->GetSize().x != pad->GetSize().y )
pad->SetShape( PAD_SHAPE_OVAL );
if( pad->GetShape() == PAD_SHAPE::CIRCLE && pad->GetSize().x != pad->GetSize().y )
pad->SetShape( PAD_SHAPE::OVAL );
footprint->Add( pad );
continue;

View File

@ -1307,13 +1307,13 @@ void PCB_IO::format( const PAD* aPad, int aNestLevel ) const
switch( aPad->GetShape() )
{
case PAD_SHAPE_CIRCLE: shape = "circle"; break;
case PAD_SHAPE_RECT: shape = "rect"; break;
case PAD_SHAPE_OVAL: shape = "oval"; break;
case PAD_SHAPE_TRAPEZOID: shape = "trapezoid"; break;
case PAD_SHAPE_CHAMFERED_RECT:
case PAD_SHAPE_ROUNDRECT: shape = "roundrect"; break;
case PAD_SHAPE_CUSTOM: shape = "custom"; break;
case PAD_SHAPE::CIRCLE: shape = "circle"; break;
case PAD_SHAPE::RECT: shape = "rect"; break;
case PAD_SHAPE::OVAL: shape = "oval"; break;
case PAD_SHAPE::TRAPEZOID: shape = "trapezoid"; break;
case PAD_SHAPE::CHAMFERED_RECT:
case PAD_SHAPE::ROUNDRECT: shape = "roundrect"; break;
case PAD_SHAPE::CUSTOM: shape = "custom"; break;
default:
THROW_IO_ERROR( wxString::Format( _( "unknown pad type: %d"), aPad->GetShape() ) );
@ -1409,14 +1409,14 @@ void PCB_IO::format( const PAD* aPad, int aNestLevel ) const
}
// Output the radius ratio for rounded and chamfered rect pads
if( aPad->GetShape() == PAD_SHAPE_ROUNDRECT || aPad->GetShape() == PAD_SHAPE_CHAMFERED_RECT)
if( aPad->GetShape() == PAD_SHAPE::ROUNDRECT || aPad->GetShape() == PAD_SHAPE::CHAMFERED_RECT)
{
m_out->Print( 0, " (roundrect_rratio %s)",
Double2Str( aPad->GetRoundRectRadiusRatio() ).c_str() );
}
// Output the chamfer corners for chamfered rect pads
if( aPad->GetShape() == PAD_SHAPE_CHAMFERED_RECT)
if( aPad->GetShape() == PAD_SHAPE::CHAMFERED_RECT)
{
m_out->Print( 0, "\n" );
@ -1520,7 +1520,7 @@ void PCB_IO::format( const PAD* aPad, int aNestLevel ) const
m_out->Print( aNestLevel+1, "%s", output.c_str()+1 ); // +1 skips 1st space on 1st element
}
if( aPad->GetShape() == PAD_SHAPE_CUSTOM )
if( aPad->GetShape() == PAD_SHAPE::CUSTOM )
{
m_out->Print( 0, "\n");
m_out->Print( aNestLevel+1, "(options" );
@ -1533,7 +1533,7 @@ void PCB_IO::format( const PAD* aPad, int aNestLevel ) const
#endif
// Output the anchor pad shape (circle/rect)
if( aPad->GetAnchorPadShape() == PAD_SHAPE_RECT )
if( aPad->GetAnchorPadShape() == PAD_SHAPE::RECT )
shape = "rect";
else
shape = "circle";

View File

@ -3759,29 +3759,29 @@ PAD* PCB_PARSER::parsePAD( FOOTPRINT* aParent )
switch( token )
{
case T_circle:
pad->SetShape( PAD_SHAPE_CIRCLE );
pad->SetShape( PAD_SHAPE::CIRCLE );
break;
case T_rect:
pad->SetShape( PAD_SHAPE_RECT );
pad->SetShape( PAD_SHAPE::RECT );
break;
case T_oval:
pad->SetShape( PAD_SHAPE_OVAL );
pad->SetShape( PAD_SHAPE::OVAL );
break;
case T_trapezoid:
pad->SetShape( PAD_SHAPE_TRAPEZOID );
pad->SetShape( PAD_SHAPE::TRAPEZOID );
break;
case T_roundrect:
// Note: the shape can be PAD_SHAPE_ROUNDRECT or PAD_SHAPE_CHAMFERED_RECT
// Note: the shape can be PAD_SHAPE::ROUNDRECT or PAD_SHAPE::CHAMFERED_RECT
// (if chamfer parameters are found later in pad descr.)
pad->SetShape( PAD_SHAPE_ROUNDRECT );
pad->SetShape( PAD_SHAPE::ROUNDRECT );
break;
case T_custom:
pad->SetShape( PAD_SHAPE_CUSTOM );
pad->SetShape( PAD_SHAPE::CUSTOM );
break;
default:
@ -3996,7 +3996,7 @@ PAD* PCB_PARSER::parsePAD( FOOTPRINT* aParent )
pad->SetChamferRectRatio( parseDouble( "chamfer ratio" ) );
if( pad->GetChamferRectRatio() > 0 )
pad->SetShape( PAD_SHAPE_CHAMFERED_RECT );
pad->SetShape( PAD_SHAPE::CHAMFERED_RECT );
NeedRIGHT();
break;
@ -4038,7 +4038,7 @@ PAD* PCB_PARSER::parsePAD( FOOTPRINT* aParent )
}
if( pad->GetChamferPositions() != RECT_NO_CHAMFER )
pad->SetShape( PAD_SHAPE_CHAMFERED_RECT );
pad->SetShape( PAD_SHAPE::CHAMFERED_RECT );
}
break;
@ -4215,7 +4215,7 @@ bool PCB_PARSER::parsePAD_option( PAD* aPad )
break;
case T_rect:
aPad->SetAnchorPadShape( PAD_SHAPE_RECT );
aPad->SetAnchorPadShape( PAD_SHAPE::RECT );
break;
default:

View File

@ -1420,10 +1420,10 @@ void LEGACY_PLUGIN::loadPAD( FOOTPRINT* aFootprint )
switch( padchar )
{
case 'C': padshape = PAD_SHAPE_CIRCLE; break;
case 'R': padshape = PAD_SHAPE_RECT; break;
case 'O': padshape = PAD_SHAPE_OVAL; break;
case 'T': padshape = PAD_SHAPE_TRAPEZOID; break;
case 'C': padshape = static_cast<int>( PAD_SHAPE::CIRCLE ); break;
case 'R': padshape = static_cast<int>( PAD_SHAPE::RECT ); break;
case 'O': padshape = static_cast<int>( PAD_SHAPE::OVAL ); break;
case 'T': padshape = static_cast<int>( PAD_SHAPE::TRAPEZOID ); break;
default:
m_error.Printf( _( "Unknown padshape '%c=0x%02x' on line: %d of footprint: \"%s\"" ),
padchar,
@ -1455,7 +1455,7 @@ void LEGACY_PLUGIN::loadPAD( FOOTPRINT* aFootprint )
// chances are both were ASCII, but why take chances?
pad->SetName( padname );
pad->SetShape( PAD_SHAPE_T( padshape ) );
pad->SetShape( static_cast<PAD_SHAPE>( padshape ) );
pad->SetSize( wxSize( size_x, size_y ) );
pad->SetDelta( wxSize( delta_x, delta_y ) );
pad->SetOrientation( orient );

View File

@ -200,7 +200,7 @@ void PCB_PAD::AddToFootprint( FOOTPRINT* aFootprint, int aRotation, bool aEncaps
if( !m_IsHolePlated && m_Hole )
{
// mechanical hole
pad->SetShape( PAD_SHAPE_CIRCLE );
pad->SetShape( PAD_SHAPE::CIRCLE );
pad->SetAttribute( PAD_ATTRIB_NPTH );
pad->SetDrillShape( PAD_DRILL_SHAPE_CIRCLE );
@ -263,16 +263,16 @@ void PCB_PAD::AddToFootprint( FOOTPRINT* aFootprint, int aRotation, bool aEncaps
|| padShapeName == wxT( "MtHole" ) )
{
if( width != height )
pad->SetShape( PAD_SHAPE_OVAL );
pad->SetShape( PAD_SHAPE::OVAL );
else
pad->SetShape( PAD_SHAPE_CIRCLE );
pad->SetShape( PAD_SHAPE::CIRCLE );
}
else if( padShapeName == wxT( "Rect" ) )
pad->SetShape( PAD_SHAPE_RECT );
pad->SetShape( PAD_SHAPE::RECT );
else if( padShapeName == wxT( "RndRect" ) )
pad->SetShape( PAD_SHAPE_ROUNDRECT );
pad->SetShape( PAD_SHAPE::ROUNDRECT );
else if( padShapeName == wxT( "Polygon" ) )
pad->SetShape( PAD_SHAPE_RECT ); // approximation
pad->SetShape( PAD_SHAPE::RECT ); // approximation
pad->SetSize( wxSize( width, height ) );
pad->SetDelta( wxSize( 0, 0 ) );

View File

@ -199,7 +199,7 @@ static POINT mapPt( const wxPoint& pt )
*/
static bool isRoundKeepout( PAD* aPad )
{
if( aPad->GetShape() == PAD_SHAPE_CIRCLE )
if( aPad->GetShape() == PAD_SHAPE::CIRCLE )
{
if( aPad->GetDrillSize().x >= aPad->GetSize().x )
return true;
@ -291,7 +291,7 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, PAD* aPad )
switch( aPad->GetShape() )
{
case PAD_SHAPE_CIRCLE:
case PAD_SHAPE::CIRCLE:
{
double diameter = scale( aPad->GetSize().x );
@ -319,7 +319,7 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, PAD* aPad )
}
break;
case PAD_SHAPE_RECT:
case PAD_SHAPE::RECT:
{
double dx = scale( aPad->GetSize().x ) / 2.0;
double dy = scale( aPad->GetSize().y ) / 2.0;
@ -355,7 +355,7 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, PAD* aPad )
}
break;
case PAD_SHAPE_OVAL:
case PAD_SHAPE::OVAL:
{
double dx = scale( aPad->GetSize().x ) / 2.0;
double dy = scale( aPad->GetSize().y ) / 2.0;
@ -406,7 +406,7 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, PAD* aPad )
}
break;
case PAD_SHAPE_TRAPEZOID:
case PAD_SHAPE::TRAPEZOID:
{
double dx = scale( aPad->GetSize().x ) / 2.0;
double dy = scale( aPad->GetSize().y ) / 2.0;
@ -458,8 +458,8 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, PAD* aPad )
}
break;
case PAD_SHAPE_CHAMFERED_RECT:
case PAD_SHAPE_ROUNDRECT:
case PAD_SHAPE::CHAMFERED_RECT:
case PAD_SHAPE::ROUNDRECT:
{
// Export the shape as as polygon, round rect does not exist as primitive
const int circleToSegmentsCount = 36;
@ -479,7 +479,7 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, PAD* aPad )
psize.x += extra_clearance*2;
psize.y += extra_clearance*2;
rradius += extra_clearance;
bool doChamfer = aPad->GetShape() == PAD_SHAPE_CHAMFERED_RECT;
bool doChamfer = aPad->GetShape() == PAD_SHAPE::CHAMFERED_RECT;
TransformRoundChamferedRectToPolygon( cornerBuffer, wxPoint(0,0), psize,
0, rradius,
@ -531,7 +531,7 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, PAD* aPad )
}
break;
case PAD_SHAPE_CUSTOM:
case PAD_SHAPE::CUSTOM:
{
std::vector<wxPoint> polygonal_shape;
SHAPE_POLY_SET pad_shape;

View File

@ -1495,7 +1495,7 @@ static wxPoint mirrorPointX( const wxPoint& aPoint, const wxPoint& aMirrorPoint
*/
static void mirrorPadX( PAD& aPad, const wxPoint& aMirrorPoint )
{
if( aPad.GetShape() == PAD_SHAPE_CUSTOM )
if( aPad.GetShape() == PAD_SHAPE::CUSTOM )
aPad.FlipPrimitives( true ); // mirror primitives left to right
wxPoint tmpPt = mirrorPointX( aPad.GetPosition(), aMirrorPoint );

View File

@ -591,7 +591,7 @@ PCB_LAYER_ID PAD_TOOL::explodePad( PAD* aPad )
else
layer = *aPad->GetLayerSet().UIOrder();
if( aPad->GetShape() == PAD_SHAPE_CUSTOM )
if( aPad->GetShape() == PAD_SHAPE::CUSTOM )
{
commit.Modify( aPad );
@ -677,11 +677,11 @@ void PAD_TOOL::recombinePad( PAD* aPad )
// We've found an intersecting item. First convert the pad to a custom-shape
// pad (if it isn't already)
//
if( aPad->GetShape() == PAD_SHAPE_RECT || aPad->GetShape() == PAD_SHAPE_CIRCLE )
if( aPad->GetShape() == PAD_SHAPE::RECT || aPad->GetShape() == PAD_SHAPE::CIRCLE )
{
aPad->SetAnchorPadShape( aPad->GetShape() );
}
else if( aPad->GetShape() != PAD_SHAPE_CUSTOM )
else if( aPad->GetShape() != PAD_SHAPE::CUSTOM )
{
// Create a new minimally-sized circular anchor and convert existing pad
// to a polygon primitive
@ -689,7 +689,7 @@ void PAD_TOOL::recombinePad( PAD* aPad )
aPad->TransformShapeWithClearanceToPolygon( existingOutline, layer, 0, maxError,
ERROR_INSIDE );
aPad->SetAnchorPadShape( PAD_SHAPE_CIRCLE );
aPad->SetAnchorPadShape( PAD_SHAPE::CIRCLE );
wxSize minAnnulus( Millimeter2iu( 0.2 ), Millimeter2iu( 0.2 ) );
aPad->SetSize( aPad->GetDrillSize() + minAnnulus );
aPad->SetOffset( wxPoint( 0, 0 ) );
@ -704,7 +704,7 @@ void PAD_TOOL::recombinePad( PAD* aPad )
aPad->AddPrimitive( shape );
}
aPad->SetShape( PAD_SHAPE_CUSTOM );
aPad->SetShape( PAD_SHAPE::CUSTOM );
// Now add the new shape to the primitives list
//

View File

@ -249,16 +249,16 @@ std::shared_ptr<EDIT_POINTS> PCB_POINT_EDITOR::makePoints( EDA_ITEM* aItem )
switch( pad->GetShape() )
{
case PAD_SHAPE_CIRCLE:
case PAD_SHAPE::CIRCLE:
points->AddPoint( shapePos );
points->AddPoint( wxPoint( shapePos.x + halfSize.x, shapePos.y ) );
break;
case PAD_SHAPE_OVAL:
case PAD_SHAPE_TRAPEZOID:
case PAD_SHAPE_RECT:
case PAD_SHAPE_ROUNDRECT:
case PAD_SHAPE_CHAMFERED_RECT:
case PAD_SHAPE::OVAL:
case PAD_SHAPE::TRAPEZOID:
case PAD_SHAPE::RECT:
case PAD_SHAPE::ROUNDRECT:
case PAD_SHAPE::CHAMFERED_RECT:
{
if( (int) pad->GetOrientation() % 900 != 0 )
break;
@ -1183,7 +1183,7 @@ void PCB_POINT_EDITOR::updateItem() const
switch( pad->GetShape() )
{
case PAD_SHAPE_CIRCLE:
case PAD_SHAPE::CIRCLE:
{
wxPoint center = (wxPoint) m_editPoints->Point( CIRC_CENTER ).GetPosition();
wxPoint end = (wxPoint) m_editPoints->Point( CIRC_END ).GetPosition();
@ -1201,11 +1201,11 @@ void PCB_POINT_EDITOR::updateItem() const
}
break;
case PAD_SHAPE_OVAL:
case PAD_SHAPE_TRAPEZOID:
case PAD_SHAPE_RECT:
case PAD_SHAPE_ROUNDRECT:
case PAD_SHAPE_CHAMFERED_RECT:
case PAD_SHAPE::OVAL:
case PAD_SHAPE::TRAPEZOID:
case PAD_SHAPE::RECT:
case PAD_SHAPE::ROUNDRECT:
case PAD_SHAPE::CHAMFERED_RECT:
{
VECTOR2I topLeft = m_editPoints->Point( RECT_TOP_LEFT ).GetPosition();
VECTOR2I topRight = m_editPoints->Point( RECT_TOP_RIGHT ).GetPosition();
@ -1632,7 +1632,7 @@ void PCB_POINT_EDITOR::updatePoints()
switch( pad->GetShape() )
{
case PAD_SHAPE_CIRCLE:
case PAD_SHAPE::CIRCLE:
{
int target = locked ? 0 : 2;
@ -1659,11 +1659,11 @@ void PCB_POINT_EDITOR::updatePoints()
}
break;
case PAD_SHAPE_OVAL:
case PAD_SHAPE_TRAPEZOID:
case PAD_SHAPE_RECT:
case PAD_SHAPE_ROUNDRECT:
case PAD_SHAPE_CHAMFERED_RECT:
case PAD_SHAPE::OVAL:
case PAD_SHAPE::TRAPEZOID:
case PAD_SHAPE::RECT:
case PAD_SHAPE::ROUNDRECT:
case PAD_SHAPE::CHAMFERED_RECT:
{
// Careful; pad shape and orientation are mutable...
int target = locked || (int) pad->GetOrientation() % 900 > 0 ? 0 : 4;

View File

@ -539,7 +539,7 @@ bool hasThermalConnection( PAD* pad, const ZONE* aZone )
*/
void ZONE_FILLER::addKnockout( PAD* aPad, PCB_LAYER_ID aLayer, int aGap, SHAPE_POLY_SET& aHoles )
{
if( aPad->GetShape() == PAD_SHAPE_CUSTOM )
if( aPad->GetShape() == PAD_SHAPE::CUSTOM )
{
SHAPE_POLY_SET poly;
aPad->TransformShapeWithClearanceToPolygon( poly, aLayer, aGap, m_maxError,
@ -1314,7 +1314,7 @@ void ZONE_FILLER::buildThermalSpokes( const ZONE* aZone, PCB_LAYER_ID aLayer,
reliefBB.Inflate( thermalReliefGap + epsilon );
// For circle pads, the thermal spoke orientation is 45 deg
if( pad->GetShape() == PAD_SHAPE_CIRCLE )
if( pad->GetShape() == PAD_SHAPE::CIRCLE )
padAngle = s_RoundPadThermalSpokeAngle;
for( int i = 0; i < 4; i++ )