57#include <api/board/board_types.pb.h>
61#include <magic_enum.hpp>
145 pad.set_locked(
IsLocked() ? kiapi::common::types::LockedState::LS_LOCKED
146 : kiapi::common::types::LockedState::LS_UNLOCKED );
147 pad.mutable_net()->mutable_code()->set_value(
GetNetCode() );
152 google::protobuf::Any padStackMsg;
154 padStackMsg.UnpackTo(
pad.mutable_pad_stack() );
159 aContainer.PackFrom(
pad );
165 kiapi::board::types::Pad
pad;
167 if( !aContainer.UnpackTo( &
pad ) )
173 SetLocked(
pad.locked() == kiapi::common::types::LockedState::LS_LOCKED );
177 google::protobuf::Any padStackWrapper;
178 padStackWrapper.PackFrom(
pad.pad_stack() );
183 if(
pad.has_copper_clearance_override() )
246 int thisNetTieGroup = padToNetTieGroupMap[
GetNumber() ];
247 int otherNetTieGroup = padToNetTieGroupMap[ aOther->
GetNumber() ];
249 return thisNetTieGroup >= 0 && thisNetTieGroup == otherNetTieGroup;
258 return m_pinType.Contains( wxT(
"no_connect" ) );
361 else if(
GetShape( layer ) == PAD_SHAPE::OVAL
388 && ( aLayer ==
F_Cu || aLayer ==
B_Cu ) )
404 else if( aOnlyCheckIfPermitted )
410 return board->GetConnectivity()->IsConnectedOnLayer(
this, aLayer, types );
434 if( aShape == PAD_DRILL_SHAPE::CIRCLE )
492 std::shared_ptr<SHAPE_COMPOUND> effective_compund = std::make_shared<SHAPE_COMPOUND>();
497 return effective_compund;
501 effective_compund->AddShape( std::make_shared<SHAPE_NULL>() );
502 return effective_compund;
509 std::shared_ptr<SHAPE_COMPOUND> effective_compund = std::make_shared<SHAPE_COMPOUND>();
511 if( flashPTHPads == FLASHING::NEVER_FLASHED )
513 else if( flashPTHPads == FLASHING::ALWAYS_FLASHED )
523 return effective_compund;
527 effective_compund->AddShape( std::make_shared<SHAPE_NULL>() );
528 return effective_compund;
539 wxT(
"Null shape in PAD::GetEffectiveShape!" ) );
585 int half_width = std::min( half_size.
x, half_size.
y );
586 VECTOR2I half_len( half_size.
x - half_width, half_size.
y - half_width );
606 auto add = [
this, aLayer](
SHAPE* aShape )
615 if( effectiveShape == PAD_SHAPE::CUSTOM )
618 switch( effectiveShape )
620 case PAD_SHAPE::CIRCLE:
624 case PAD_SHAPE::OVAL:
625 if( size.
x == size.
y )
632 int half_width = std::min( half_size.
x, half_size.
y );
633 VECTOR2I half_len( half_size.
x - half_width, half_size.
y - half_width );
635 add(
new SHAPE_SEGMENT( shapePos - half_len, shapePos + half_len, half_width * 2 ) );
640 case PAD_SHAPE::RECTANGLE:
641 case PAD_SHAPE::TRAPEZOID:
642 case PAD_SHAPE::ROUNDRECT:
656 if( half_size.
x < min_len && half_size.
y < min_len )
662 else if( effectiveShape == PAD_SHAPE::TRAPEZOID )
669 corners.
Append( -half_size.
x - trap_delta.
y, half_size.
y + trap_delta.
x );
670 corners.
Append( half_size.
x + trap_delta.
y, half_size.
y - trap_delta.
x );
671 corners.
Append( half_size.
x - trap_delta.
y, -half_size.
y + trap_delta.
x );
672 corners.
Append( -half_size.
x + trap_delta.
y, -half_size.
y - trap_delta.
x );
675 corners.
Move( shapePos );
715 case PAD_SHAPE::CHAMFERED_RECT:
730 wxFAIL_MSG( wxT(
"PAD::buildEffectiveShapes: Unsupported pad shape: PAD_SHAPE::" )
731 + wxString( std::string( magic_enum::enum_name( effectiveShape ) ) ) );
735 if(
GetShape( aLayer ) == PAD_SHAPE::CUSTOM )
739 if( !primitive->IsProxyItem() )
741 for(
SHAPE* shape : primitive->MakeEffectiveShapes() )
744 shape->Move( shapePos );
771 std::shared_ptr<SHAPE_POLY_SET>& effectivePolygon =
774 effectivePolygon = std::make_shared<SHAPE_POLY_SET>();
783 for(
int cnt = 0; cnt < effectivePolygon->OutlineCount(); ++cnt )
787 for(
int ii = 0; ii < poly.
PointCount(); ++ii )
821 case PAD_ATTRIB::PTH:
826 case PAD_ATTRIB::SMD:
827 case PAD_ATTRIB::CONN:
832 if( copperLayers.count() > 1 )
834 layerMask &=
~LSET::AllCuMask();
836 if( copperLayers.test(
B_Cu ) )
839 layerMask.
set( copperLayers.
Seq().front() );
847 case PAD_ATTRIB::NPTH:
905 auto mirrorBitFlags = [](
int& aBitfield,
int a,
int b )
907 bool temp = aBitfield & a;
923 if( aFlipDirection == FLIP_DIRECTION::LEFT_RIGHT )
964 primitive->SetParent(this);
965 primitive->Flip( VECTOR2I( 0, 0 ), aFlipDirection );
977 if( loc_offset.
x == 0 && loc_offset.
y == 0 )
994 bool hasAnnularRing =
true;
1001 case PAD_SHAPE::CIRCLE:
1005 hasAnnularRing = false;
1010 case PAD_SHAPE::OVAL:
1015 hasAnnularRing = false;
1027 if( !hasAnnularRing )
1038 *aSource =
_(
"pad" );
1050 return parentFootprint->GetClearanceOverrides( aSource );
1052 return std::optional<int>();
1099 if( !margin.has_value() )
1102 margin = parentFootprint->GetLocalSolderMaskMargin();
1105 if( !margin.has_value() )
1108 margin = brd->GetDesignSettings().m_SolderMaskExpansion;
1111 int marginValue = margin.value_or( 0 );
1116 if( marginValue < 0 )
1120 if( marginValue < minsize )
1121 marginValue = minsize;
1146 if( !margin.has_value() )
1149 margin = parentFootprint->GetLocalSolderPasteMargin();
1152 if( !margin.has_value() )
1155 margin = board->GetDesignSettings().m_SolderPasteMargin;
1158 if( !mratio.has_value() )
1161 mratio = parentFootprint->GetLocalSolderPasteMarginRatio();
1164 if( !mratio.has_value() )
1167 mratio = board->GetDesignSettings().m_SolderPasteMarginRatio;
1174 pad_margin.
x = margin.value_or( 0 ) +
KiROUND( padSize.
x * mratio.value_or( 0 ) );
1175 pad_margin.
y = margin.value_or( 0 ) +
KiROUND( padSize.
y * mratio.value_or( 0 ) );
1180 if( pad_margin.
x < -padSize.
x / 2 )
1181 pad_margin.
x = -padSize.
x / 2;
1183 if( pad_margin.
y < -padSize.
y / 2 )
1184 pad_margin.
y = -padSize.
y / 2;
1195 if( connection != ZONE_CONNECTION::INHERITED )
1198 *aSource =
_(
"pad" );
1201 if( connection == ZONE_CONNECTION::INHERITED )
1204 connection = parentFootprint->GetZoneConnectionOverrides( aSource );
1214 *aSource =
_(
"pad" );
1223 *aSource =
_(
"pad" );
1236 if( parentFootprint )
1237 aList.emplace_back(
_(
"Footprint" ), parentFootprint->
GetReference() );
1240 aList.emplace_back(
_(
"Pad" ),
m_number );
1246 aList.emplace_back(
_(
"Pin Type" ),
GetPinType() );
1252 aList.emplace_back(
_(
"Resolved Netclass" ),
1256 aList.emplace_back(
_(
"Status" ),
_(
"Locked" ) );
1268 double area = poly->Area();
1282 case PAD_PROP::NONE:
break;
1283 case PAD_PROP::BGA: props +=
_(
"BGA" );
break;
1284 case PAD_PROP::FIDUCIAL_GLBL: props +=
_(
"Fiducial global" );
break;
1285 case PAD_PROP::FIDUCIAL_LOCAL: props +=
_(
"Fiducial local" );
break;
1286 case PAD_PROP::TESTPOINT: props +=
_(
"Test point" );
break;
1287 case PAD_PROP::HEATSINK: props +=
_(
"Heat sink" );
break;
1288 case PAD_PROP::CASTELLATED: props +=
_(
"Castellated" );
break;
1289 case PAD_PROP::MECHANICAL: props +=
_(
"Mechanical" );
break;
1298 if( ( padShape == PAD_SHAPE::CIRCLE || padShape == PAD_SHAPE::OVAL )
1299 && padSize.
x == padSize.
y )
1313 if( !fp_orient.
IsZero() )
1318 aList.emplace_back(
_(
"Rotation" ), msg );
1322 aList.emplace_back(
_(
"Length in Package" ),
1328 if( drill.
x > 0 || drill.
y > 0 )
1332 aList.emplace_back(
_(
"Hole" ),
1333 wxString::Format( wxT(
"%s" ),
1338 aList.emplace_back(
_(
"Hole X / Y" ),
1339 wxString::Format( wxT(
"%s / %s" ),
1348 if( !source.IsEmpty() )
1350 aList.emplace_back( wxString::Format(
_(
"Min Clearance: %s" ),
1352 wxString::Format(
_(
"(from %s)" ),
1370 bool contains =
false;
1388 BOX2I arect = aRect;
1413 const std::shared_ptr<SHAPE_POLY_SET>& poly =
1416 int count = poly->TotalVertices();
1418 for(
int ii = 0; ii < count; ii++ )
1420 VECTOR2I vertex = poly->CVertex( ii );
1421 VECTOR2I vertexNext = poly->CVertex( ( ii + 1 ) % count );
1448 if( ( diff =
static_cast<int>( aPadRef->
m_attribute ) -
1472 case PAD_SHAPE::CIRCLE:
return _(
"Circle" );
1473 case PAD_SHAPE::OVAL:
return _(
"Oval" );
1474 case PAD_SHAPE::RECTANGLE:
return _(
"Rect" );
1475 case PAD_SHAPE::TRAPEZOID:
return _(
"Trap" );
1476 case PAD_SHAPE::ROUNDRECT:
return _(
"Roundrect" );
1477 case PAD_SHAPE::CHAMFERED_RECT:
return _(
"Chamferedrect" );
1478 case PAD_SHAPE::CUSTOM:
return _(
"CustomShape" );
1479 default:
return wxT(
"???" );
1488 case PAD_ATTRIB::PTH:
return _(
"PTH" );
1489 case PAD_ATTRIB::SMD:
return _(
"SMD" );
1490 case PAD_ATTRIB::CONN:
return _(
"Conn" );
1491 case PAD_ATTRIB::NPTH:
return _(
"NPTH" );
1492 default:
return wxT(
"???" );
1511 return wxString::Format(
_(
"NPTH pad of %s" ),
1516 return _(
"NPTH pad" );
1525 return wxString::Format(
_(
"Pad %s of %s on %s" ),
1532 return wxString::Format(
_(
"Pad on %s" ),
1540 return wxString::Format(
_(
"PTH pad %s of %s" ),
1546 return _(
"PTH pad" );
1556 return wxString::Format(
_(
"Pad %s %s of %s on %s" ),
1564 return wxString::Format(
_(
"Pad %s on %s" ),
1573 return wxString::Format(
_(
"PTH pad %s %s of %s" ),
1580 return wxString::Format(
_(
"PTH pad %s" ),
1590 return BITMAPS::pad;
1596 PAD* cloned =
new PAD( *
this );
1604 primitive->SetParent( cloned );
1614 std::vector<int> layers;
1615 layers.reserve( 64 );
1631 cuLayers &= board->GetEnabledLayers();
1633 if( cuLayers.count() > 1 )
1637 layers.push_back( layer );
1643 layers.push_back(
F_Cu );
1654 layers.push_back(
B_Cu );
1672 layers.push_back( each_layer );
1681 constexpr double HIDE = std::numeric_limits<double>::max();
1736 int64_t minSide = std::min( padSize.
x, padSize.
y );
1748 int solderMaskMargin = 0;
1754 solderMaskMargin = std::max( solderMaskMargin,
1757 solderPasteMargin.
x = std::max( solderPasteMargin.
x, layerMargin.
x );
1758 solderPasteMargin.
y = std::max( solderPasteMargin.
y, layerMargin.
y );
1767 if( cfg && cfg->m_Display.m_PadClearance &&
GetBoard() )
1772 int xMargin = std::max( solderMaskMargin, solderPasteMargin.
x ) + clearance;
1773 int yMargin = std::max( solderMaskMargin, solderPasteMargin.
y ) + clearance;
1815 if( aMasterPad.
GetShape( aLayer ) == PAD_SHAPE::CIRCLE )
1822 case PAD_ATTRIB::SMD:
1823 case PAD_ATTRIB::CONN:
1855 std::swap( *
this, *
static_cast<PAD*
>( aImage ) );
1864 if( !drillsize.
x || !drillsize.
y )
1870 slot->GetWidth() + aClearance * 2, aError, aErrorLoc );
1877 int aMaxError,
ERROR_LOC aErrorLoc,
bool ignoreLineWidth )
const
1879 wxASSERT_MSG( !ignoreLineWidth, wxT(
"IgnoreLineWidth has no meaning for pads." ) );
1881 wxT(
"UNDEFINED_LAYER is no longer allowed for PAD::TransformShapeToPolygon" ) );
1886 const int pad_min_seg_per_circle_count = 16;
1895 case PAD_SHAPE::CIRCLE:
1896 case PAD_SHAPE::OVAL:
1898 if( dx == dy || ( shape == PAD_SHAPE::CIRCLE ) )
1901 pad_min_seg_per_circle_count );
1905 int half_width = std::min( dx, dy );
1911 ( half_width + aClearance ) * 2, aMaxError, aErrorLoc,
1912 pad_min_seg_per_circle_count );
1917 case PAD_SHAPE::TRAPEZOID:
1918 case PAD_SHAPE::RECTANGLE:
1921 int ddx = shape == PAD_SHAPE::TRAPEZOID ? trapDelta.
x / 2 : 0;
1922 int ddy = shape == PAD_SHAPE::TRAPEZOID ? trapDelta.
y / 2 : 0;
1927 aBuffer.
Append( outline );
1931 case PAD_SHAPE::CHAMFERED_RECT:
1932 case PAD_SHAPE::ROUNDRECT:
1934 bool doChamfer = shape == PAD_SHAPE::CHAMFERED_RECT;
1941 aClearance, aMaxError, aErrorLoc );
1942 aBuffer.
Append( outline );
1946 case PAD_SHAPE::CUSTOM:
1956 aClearance += aMaxError;
1958 outline.
Inflate( aClearance, CORNER_STRATEGY::ROUND_ALL_CORNERS, aMaxError );
1961 else if( aClearance < 0 )
1967 outline.
Inflate( aClearance, CORNER_STRATEGY::ALLOW_ACUTE_CORNERS, aMaxError );
1971 aBuffer.
Append( outline );
1976 wxFAIL_MSG( wxT(
"PAD::TransformShapeToPolygon no implementation for " )
1977 + wxString( std::string( magic_enum::enum_name( shape ) ) ) );
2021 [&](
PCB_SHAPE* aShape ) -> std::vector<PCB_SHAPE*>
2023 std::vector<PCB_SHAPE*> matching;
2033 && aShape->Compare( other ) == 0 )
2035 matching.push_back( other );
2043 std::vector<PCB_SHAPE*> mergedShapes;
2056 if( !aIsDryRun &&
findNext( layer ) && origShape != PAD_SHAPE::CUSTOM )
2058 if( origShape == PAD_SHAPE::CIRCLE || origShape == PAD_SHAPE::RECTANGLE )
2062 SetShape( layer, PAD_SHAPE::CUSTOM );
2070 int minExtent = std::min(
GetSize( layer ).x,
GetSize( layer ).y );
2073 SetShape( layer, PAD_SHAPE::CUSTOM );
2089 mergedShapes.push_back( fpShape );
2104 for(
PCB_SHAPE* other : findMatching( fpShape ) )
2107 mergedShapes.push_back( other );
2117 return mergedShapes;
2122 const std::function<
void(
int aErrorCode,
2123 const wxString& aMsg )>& aErrorHandler )
const
2127 doCheckPad( aLayer, aUnitsProvider, aErrorHandler );
2133 if( padlayers_mask.none() )
2137 aErrorHandler(
DRCE_PADSTACK,
_(
"(PTH pad has no copper layers)" ) );
2139 if( !padlayers_mask[
F_Cu] && !padlayers_mask[
B_Cu] )
2141 if( ( drill_size.
x || drill_size.
y ) &&
GetAttribute() != PAD_ATTRIB::NPTH )
2143 aErrorHandler(
DRCE_PADSTACK,
_(
"(plated through holes normally have a copper pad on "
2144 "at least one layer)" ) );
2151 aErrorHandler(
DRCE_PADSTACK,
_(
"('fiducial' property makes no sense on NPTH pads)" ) );
2155 aErrorHandler(
DRCE_PADSTACK,
_(
"('testpoint' property makes no sense on NPTH pads)" ) );
2158 aErrorHandler(
DRCE_PADSTACK,
_(
"('heatsink' property makes no sense of NPTH pads)" ) );
2161 aErrorHandler(
DRCE_PADSTACK,
_(
"('castellated' property is for PTH pads)" ) );
2164 aErrorHandler(
DRCE_PADSTACK,
_(
"('BGA' property is for SMD pads)" ) );
2167 aErrorHandler(
DRCE_PADSTACK,
_(
"('mechanical' property is for PTH pads)" ) );
2171 case PAD_ATTRIB::NPTH:
2172 case PAD_ATTRIB::PTH:
2173 if( drill_size.
x <= 0
2174 || ( drill_size.
y <= 0 &&
GetDrillShape() == PAD_DRILL_SHAPE::OBLONG ) )
2180 case PAD_ATTRIB::CONN:
2183 aErrorHandler(
DRCE_PADSTACK,
_(
"(connector pads normally have no solder paste; use a "
2184 "SMD pad instead)" ) );
2188 case PAD_ATTRIB::SMD:
2190 if( drill_size.
x > 0 || drill_size.
y > 0 )
2197 aErrorHandler(
DRCE_PADSTACK,
_(
"(SMD pad has copper on both sides of the board)" ) );
2203 aErrorHandler(
DRCE_PADSTACK,
_(
"(SMD pad has copper and mask layers on different "
2204 "sides of the board)" ) );
2208 aErrorHandler(
DRCE_PADSTACK,
_(
"(SMD pad has copper and paste layers on different "
2209 "sides of the board)" ) );
2216 aErrorHandler(
DRCE_PADSTACK,
_(
"(SMD pad has copper and mask layers on different "
2217 "sides of the board)" ) );
2221 aErrorHandler(
DRCE_PADSTACK,
_(
"(SMD pad has copper and paste layers on different "
2222 "sides of the board)" ) );
2225 else if( innerlayers_mask.count() != 0 )
2227 aErrorHandler(
DRCE_PADSTACK,
_(
"(SMD pad has no outer layers)" ) );
2237 const std::function<
void(
int aErrorCode,
2238 const wxString& aMsg )>& aErrorHandler )
const
2244 if(
GetShape( aLayer ) == PAD_SHAPE::CUSTOM )
2246 else if( pad_size.
x <= 0 || ( pad_size.
y <= 0 &&
GetShape( aLayer ) != PAD_SHAPE::CIRCLE ) )
2254 const int min_drill_size = 4;
2258 msg.Printf(
_(
"(PTH pad hole size must be larger than %s)" ),
2282 aErrorHandler(
DRCE_PADSTACK,
_(
"(PTH pad hole leaves no copper)" ) );
2290 aErrorHandler(
DRCE_PADSTACK,
_(
"(PTH pad hole non fully inside copper)" ) );
2297 aErrorHandler(
DRCE_PADSTACK,
_(
"(pad hole not inside pad shape)" ) );
2302 aErrorHandler(
DRCE_PADSTACK,
_(
"(negative local clearance values have no effect)" ) );
2309 if( solderMaskMargin.has_value() && solderMaskMargin.value() < 0 )
2311 int absMargin = abs( solderMaskMargin.value() );
2313 if(
GetShape( aLayer ) == PAD_SHAPE::CUSTOM )
2315 for(
const std::shared_ptr<PCB_SHAPE>& shape :
GetPrimitives( aLayer ) )
2317 BOX2I shapeBBox = shape->GetBoundingBox();
2321 aErrorHandler(
DRCE_PADSTACK,
_(
"(negative solder mask clearance is larger "
2322 "than some shape primitives; results may be "
2329 else if( absMargin > pad_size.
x || absMargin > pad_size.
y )
2331 aErrorHandler(
DRCE_PADSTACK,
_(
"(negative solder mask clearance is larger than pad; "
2332 "no solder mask will be generated)" ) );
2345 paste_size.x = pad_size.
x + paste_margin +
KiROUND( pad_size.
x * paste_ratio );
2346 paste_size.y = pad_size.
y + paste_margin +
KiROUND( pad_size.
y * paste_ratio );
2348 if( paste_size.x <= 0 || paste_size.y <= 0 )
2350 aErrorHandler(
DRCE_PADSTACK,
_(
"(negative solder paste margin is larger than pad; "
2351 "no solder paste mask will be generated)" ) );
2354 if(
GetShape( aLayer ) == PAD_SHAPE::ROUNDRECT )
2359 aErrorHandler(
DRCE_PADSTACK,
_(
"(corner size will make pad circular)" ) );
2361 else if(
GetShape( aLayer ) == PAD_SHAPE::CHAMFERED_RECT )
2368 else if(
GetShape( aLayer ) == PAD_SHAPE::TRAPEZOID )
2379 if(
GetShape( aLayer ) == PAD_SHAPE::CUSTOM )
2398 const PAD& other =
static_cast<const PAD&
>( aBoardItem );
2400 return *
this == other;
2427 const PAD& other =
static_cast<const PAD&
>( aOther );
2429 double similarity = 1.0;
2448 .Map( PAD_ATTRIB::PTH,
_HKI(
"Through-hole" ) )
2449 .Map( PAD_ATTRIB::SMD,
_HKI(
"SMD" ) )
2450 .Map( PAD_ATTRIB::CONN,
_HKI(
"Edge connector" ) )
2451 .Map( PAD_ATTRIB::NPTH,
_HKI(
"NPTH, mechanical" ) );
2454 .Map( PAD_SHAPE::CIRCLE,
_HKI(
"Circle" ) )
2455 .Map( PAD_SHAPE::RECTANGLE,
_HKI(
"Rectangle" ) )
2456 .Map( PAD_SHAPE::OVAL,
_HKI(
"Oval" ) )
2457 .Map( PAD_SHAPE::TRAPEZOID,
_HKI(
"Trapezoid" ) )
2458 .Map( PAD_SHAPE::ROUNDRECT,
_HKI(
"Rounded rectangle" ) )
2459 .Map( PAD_SHAPE::CHAMFERED_RECT,
_HKI(
"Chamfered rectangle" ) )
2460 .Map( PAD_SHAPE::CUSTOM,
_HKI(
"Custom" ) );
2463 .Map( PAD_PROP::NONE,
_HKI(
"None" ) )
2464 .Map( PAD_PROP::BGA,
_HKI(
"BGA pad" ) )
2465 .Map( PAD_PROP::FIDUCIAL_GLBL,
_HKI(
"Fiducial, global to board" ) )
2466 .Map( PAD_PROP::FIDUCIAL_LOCAL,
_HKI(
"Fiducial, local to footprint" ) )
2467 .Map( PAD_PROP::TESTPOINT,
_HKI(
"Test point pad" ) )
2468 .Map( PAD_PROP::HEATSINK,
_HKI(
"Heatsink pad" ) )
2469 .Map( PAD_PROP::CASTELLATED,
_HKI(
"Castellated pad" ) )
2470 .Map( PAD_PROP::MECHANICAL,
_HKI(
"Mechanical pad" ) );
2473 .Map( PAD_DRILL_SHAPE::CIRCLE,
_HKI(
"Round" ) )
2474 .Map( PAD_DRILL_SHAPE::OBLONG,
_HKI(
"Oblong" ) );
2478 if( zcMap.
Choices().GetCount() == 0 )
2480 zcMap.
Undefined( ZONE_CONNECTION::INHERITED );
2481 zcMap.
Map( ZONE_CONNECTION::INHERITED,
_HKI(
"Inherited" ) )
2482 .
Map( ZONE_CONNECTION::NONE,
_HKI(
"None" ) )
2483 .
Map( ZONE_CONNECTION::THERMAL,
_HKI(
"Thermal reliefs" ) )
2484 .
Map( ZONE_CONNECTION::FULL,
_HKI(
"Solid" ) )
2485 .
Map( ZONE_CONNECTION::THT_THERMAL,
_HKI(
"Thermal reliefs for PTH" ) );
2492 _HKI(
"Front, back and connected layers" ) );
2503 PROPERTY_DISPLAY::PT_DEGREE ) );
2508 if(
PAD*
pad =
dynamic_cast<PAD*
>( aItem ) )
2509 return pad->GetAttribute() != PAD_ATTRIB::NPTH;
2514 auto padCanHaveHole =
2517 if(
PAD*
pad =
dynamic_cast<PAD*
>( aItem ) )
2519 return pad->GetAttribute() == PAD_ATTRIB::PTH
2520 ||
pad->GetAttribute() == PAD_ATTRIB::NPTH;
2526 auto hasNormalPadstack =
2529 if(
PAD*
pad =
dynamic_cast<PAD*
>( aItem ) )
2536 _HKI(
"Net" ), isCopperPad );
2538 _HKI(
"Net Class" ), isCopperPad );
2540 const wxString groupPad =
_HKI(
"Pad Properties" );
2553 padNumber->SetAvailableFunc( isCopperPad );
2565 PROPERTY_DISPLAY::PT_SIZE ), groupPad )
2569 PROPERTY_DISPLAY::PT_SIZE ), groupPad )
2573 if(
PAD*
pad =
dynamic_cast<PAD*
>( aItem ) )
2588 roundRadiusRatio->SetAvailableFunc(
2591 if(
PAD*
pad =
dynamic_cast<PAD*
>( aItem ) )
2597 return pad->GetShape(
F_Cu ) == PAD_SHAPE::ROUNDRECT;
2602 propMgr.
AddProperty( roundRadiusRatio, groupPad );
2610 PROPERTY_DISPLAY::PT_SIZE ), groupPad )
2616 PROPERTY_DISPLAY::PT_SIZE ), groupPad )
2623 if(
PAD*
pad =
dynamic_cast<PAD*
>( aItem ) )
2624 return pad->GetDrillShape() != PAD_DRILL_SHAPE::CIRCLE;
2633 _HKI(
"Copper Layers" ),
2639 PROPERTY_DISPLAY::PT_SIZE );
2640 padToDie->SetAvailableFunc( isCopperPad );
2643 const wxString groupOverrides =
_HKI(
"Overrides" );
2646 _HKI(
"Clearance Override" ),
2648 PROPERTY_DISPLAY::PT_SIZE ), groupOverrides );
2651 _HKI(
"Soldermask Margin Override" ),
2653 PROPERTY_DISPLAY::PT_SIZE ), groupOverrides );
2656 _HKI(
"Solderpaste Margin Override" ),
2658 PROPERTY_DISPLAY::PT_SIZE ), groupOverrides );
2661 _HKI(
"Solderpaste Margin Ratio Override" ),
2663 PROPERTY_DISPLAY::PT_RATIO ),
2667 _HKI(
"Zone Connection Style" ),
2674 PROPERTY_DISPLAY::PT_SIZE ), groupOverrides )
2675 .
SetValidator( PROPERTY_VALIDATORS::RangeIntValidator<minZoneWidth, INT_MAX> );
2679 PROPERTY_DISPLAY::PT_DEGREE ), groupOverrides );
2683 PROPERTY_DISPLAY::PT_SIZE ), groupOverrides )
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
constexpr int ARC_HIGH_DEF
constexpr EDA_IU_SCALE pcbIUScale
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
BITMAPS
A list of all bitmap identifiers.
ZONE_LAYER_OVERRIDE
Conditionally flashed vias and pads that interact with zones of different priority can be very squirr...
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
BASE_SET & set(size_t pos)
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
wxString GetNetnameMsg() const
virtual NETCLASS * GetEffectiveNetClass() const
Return the NETCLASS for this item.
bool SetNetCode(int aNetCode, bool aNoAssert)
Set net using a net code.
wxString GetNetname() const
TEARDROP_PARAMETERS m_teardropParams
Not all BOARD_CONNECTED_ITEMs support teardrops, but we want those that do to share a single section ...
const wxString & GetShortNetname() const
Container for design settings for a BOARD object.
std::shared_ptr< DRC_ENGINE > m_DRCEngine
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
virtual void SetLocked(bool aLocked)
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
FOOTPRINT * GetParentFootprint() const
virtual bool IsLocked() const
BOARD_ITEM_CONTAINER * GetParent() const
virtual int BoardCopperLayerCount() const
Return the total number of copper layers for the board that this item resides on.
virtual wxString layerMaskDescribe() const
Return a string (to be shown to the user) describing a layer mask.
Information pertinent to a Pcbnew printed circuit board.
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
LSET GetVisibleLayers() const
A proxy function that calls the correspondent function in m_BoardSettings.
int GetMaxClearanceValue() const
Returns the maximum clearance value for any object on the board.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
constexpr BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
constexpr size_type GetWidth() const
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
constexpr size_type GetHeight() const
constexpr bool Contains(const Vec &aPoint) const
constexpr const Vec & GetOrigin() const
constexpr const SizeVec & GetSize() const
constexpr bool Intersects(const BOX2< Vec > &aRect) const
MINOPTMAX< int > & Value()
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
virtual VECTOR2I GetPosition() const
EDA_ITEM & operator=(const EDA_ITEM &aItem)
Assign the members of aItem to another object.
KICAD_T Type() const
Returns the type of object.
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
virtual void SetParent(EDA_ITEM *aParent)
EDA_ITEM * m_parent
Linked list: Link (parent struct)
EDA_ITEM_FLAGS GetFlags() const
void SetPolyShape(const SHAPE_POLY_SET &aShape)
virtual void SetFilled(bool aFlag)
ENUM_MAP & Map(T aValue, const wxString &aName)
static ENUM_MAP< T > & Instance()
ENUM_MAP & Undefined(T aValue)
Class that other classes need to inherit from, in order to be inspectable.
Contains methods for drawing PCB-specific items.
virtual PCB_RENDER_SETTINGS * GetSettings() override
Return a pointer to current settings that are going to be used when drawing items.
PCB specific render settings.
PCB_LAYER_ID GetPrimaryHighContrastLayer() const
Return the board layer which is in high-contrast mode.
bool GetHighContrast() const
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
bool IsLayerVisible(int aLayer) const
Return information about visibility of a particular layer.
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
wxString AsString() const
std::string AsStdString() const
LSET is a set of PCB_LAYER_IDs.
LSET & Flip(int aCopperLayersCount=0)
Flip the layers in this set.
LSEQ UIOrder() const
Returns the copper, technical and user layers in the order shown in layer widget.
static LSET FrontBoardTechMask()
Return a mask holding technical layers used in a board fabrication (no CU layer) on front side.
static LSET InternalCuMask()
Return a complete set of internal copper layers which is all Cu layers except F_Cu and B_Cu.
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
static LSET PhysicalLayersMask()
Return a mask holding all layers which are physically realized.
LSEQ Seq(const LSEQ &aSequence) const
Return an LSEQ from the union of this LSET and a desired sequence.
static LSET BackBoardTechMask()
Return a mask holding technical layers used in a board fabrication (no CU layer) on Back side.
static const int UNCONNECTED
Constant that holds the "unconnected net" number (typically 0) all items "connected" to this net are ...
std::optional< int > & Clearance(PCB_LAYER_ID aLayer=F_Cu)
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
double Similarity(const PADSTACK &aOther) const
Return a measure of how likely the other object is to represent the same object.
int RoundRectRadius(PCB_LAYER_ID aLayer) const
std::optional< double > & SolderPasteMarginRatio(PCB_LAYER_ID aLayer=F_Cu)
void ForEachUniqueLayer(const std::function< void(PCB_LAYER_ID)> &aMethod) const
Runs the given callable for each active unique copper layer in this padstack, meaning F_Cu for MODE::...
void SetRoundRectRadiusRatio(double aRatio, PCB_LAYER_ID aLayer)
std::optional< int > & ThermalSpokeWidth(PCB_LAYER_ID aLayer=F_Cu)
std::optional< int > & SolderPasteMargin(PCB_LAYER_ID aLayer=F_Cu)
void SetOrientation(EDA_ANGLE aAngle)
std::optional< int > & SolderMaskMargin(PCB_LAYER_ID aLayer=F_Cu)
void SetChamferRatio(double aRatio, PCB_LAYER_ID aLayer)
const LSET & LayerSet() const
PCB_LAYER_ID EffectiveLayerFor(PCB_LAYER_ID aLayer) const
Determines which geometry layer should be used for the given input layer.
VECTOR2I & TrapezoidDeltaSize(PCB_LAYER_ID aLayer)
VECTOR2I & Offset(PCB_LAYER_ID aLayer)
void FlipLayers(int aCopperLayerCount)
Flips the padstack layers in the case that the pad's parent footprint is flipped to the other side of...
void SetChamferPositions(int aPositions, PCB_LAYER_ID aLayer)
void SetRoundRectRadius(double aRadius, PCB_LAYER_ID aLayer)
UNCONNECTED_LAYER_MODE UnconnectedLayerMode() const
std::optional< int > & ThermalGap(PCB_LAYER_ID aLayer=F_Cu)
PAD_SHAPE Shape(PCB_LAYER_ID aLayer) const
static int Compare(const PADSTACK *aPadstackRef, const PADSTACK *aPadstackCmp)
Compare two padstacks and return 0 if they are equal.
int & ChamferPositions(PCB_LAYER_ID aLayer)
const VECTOR2I & Size(PCB_LAYER_ID aLayer) const
@ NORMAL
Shape is the same on all layers.
UNCONNECTED_LAYER_MODE
! Whether or not to remove the copper shape for unconnected layers
@ REMOVE_EXCEPT_START_AND_END
PCB_LAYER_ID StartLayer() const
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
void SetSize(const VECTOR2I &aSize, PCB_LAYER_ID aLayer)
static constexpr PCB_LAYER_ID ALL_LAYERS
! Temporary layer identifier to identify code that is not padstack-aware
EDA_ANGLE GetOrientation() const
void SetLayerSet(const LSET &aSet)
std::optional< ZONE_CONNECTION > & ZoneConnection(PCB_LAYER_ID aLayer=F_Cu)
std::vector< std::shared_ptr< PCB_SHAPE > > & Primitives(PCB_LAYER_ID aLayer)
void SetAnchorPadShape(PCB_LAYER_ID aLayer, PAD_SHAPE aShape)
Set the shape of the anchor pad for custom shaped pads.
bool IsAperturePad() const
void SetAttribute(PAD_ATTRIB aAttribute)
int GetOwnClearance(PCB_LAYER_ID aLayer, wxString *aSource=nullptr) const override
Return the pad's "own" clearance in internal units.
virtual void swapData(BOARD_ITEM *aImage) override
PAD_PROP GetProperty() const
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
double GetFrontRoundRectRadiusRatio() const
std::optional< int > GetClearanceOverrides(wxString *aSource) const override
Return any clearance overrides set in the "classic" (ie: pre-rule) system.
void SetPinType(const wxString &aType)
Set the pad electrical type.
LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
const std::vector< std::shared_ptr< PCB_SHAPE > > & GetPrimitives(PCB_LAYER_ID aLayer) const
Accessor to the basic shape list for custom-shaped pads.
const ZONE_LAYER_OVERRIDE & GetZoneLayerOverride(PCB_LAYER_ID aLayer) const
void MergePrimitivesAsPolygon(PCB_LAYER_ID aLayer, SHAPE_POLY_SET *aMergedPolygon, ERROR_LOC aErrorLoc=ERROR_INSIDE) const
Merge all basic shapes to a SHAPE_POLY_SET.
int GetRoundRectCornerRadius(PCB_LAYER_ID aLayer) const
bool FlashLayer(int aLayer, bool aOnlyCheckIfPermitted=false) const
Check to see whether the pad should be flashed on the specific layer.
virtual std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer, FLASHING flashPTHPads=FLASHING::DEFAULT) const override
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
const BOX2I GetBoundingBox() const override
The bounding box is cached, so this will be efficient most of the time.
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
int GetDrillSizeY() const
std::optional< double > GetLocalSolderPasteMarginRatio() const
void SetFrontShape(PAD_SHAPE aShape)
const wxString & GetPinType() const
void SetZoneLayerOverride(PCB_LAYER_ID aLayer, ZONE_LAYER_OVERRIDE aOverride)
const VECTOR2I & GetDrillSize() const
PAD_ATTRIB GetAttribute() const
static LSET PTHMask()
layer set for a through hole pad
static int Compare(const PAD *aPadRef, const PAD *aPadCmp)
Compare two pads and return 0 if they are equal.
void SetUnconnectedLayerMode(PADSTACK::UNCONNECTED_LAYER_MODE aMode)
const wxString & GetPinFunction() const
std::mutex m_shapesBuildingLock
void SetThermalGap(int aGap)
bool CanHaveNumber() const
Indicates whether or not the pad can have a number.
void SetThermalSpokeAngle(const EDA_ANGLE &aAngle)
The orientation of the thermal spokes.
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
const wxString & GetNumber() const
const VECTOR2I & GetDelta(PCB_LAYER_ID aLayer) const
void SetFrontRoundRectRadiusRatio(double aRadiusScale)
void BuildEffectiveShapes() const
Rebuild the effective shape cache (and bounding box and radius) for the pad and clears the dirty bit.
PAD_SHAPE GetFrontShape() const
void SetLocalSolderPasteMarginRatio(std::optional< double > aRatio)
PAD & operator=(const PAD &aOther)
void SetShape(PCB_LAYER_ID aLayer, PAD_SHAPE aShape)
Set the new shape of this pad.
std::shared_ptr< SHAPE_SEGMENT > m_effectiveHoleShape
bool IsLocked() const override
VECTOR2I GetPosition() const override
void SetProperty(PAD_PROP aProperty)
void SetThermalSpokeAngleDegrees(double aAngle)
EDA_ANGLE GetThermalSpokeAngle() const
std::map< PCB_LAYER_ID, ZONE_LAYER_OVERRIDE > m_zoneLayerOverrides
void Flip(const VECTOR2I &VECTOR2I, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
std::vector< PCB_SHAPE * > Recombine(bool aIsDryRun, int aMaxError)
Recombines the pad with other graphical shapes in the footprint.
PCB_LAYER_ID GetPrincipalLayer() const
static LSET UnplatedHoleMask()
layer set for a mechanical unplated through hole pad
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
double GetOrientationDegrees() const
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
void FlipPrimitives(FLIP_DIRECTION aFlipDirection)
Flip (mirror) the primitives left to right or top to bottom, around the anchor position in custom pad...
LAYER_SHAPE_MAP m_effectiveShapes
bool IsNoConnectPad() const
int GetDrillSizeX() const
double GetRoundRectRadiusRatio(PCB_LAYER_ID aLayer) const
PAD_SHAPE GetShape(PCB_LAYER_ID aLayer) const
void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aMaxError, ERROR_LOC aErrorLoc=ERROR_INSIDE, bool ignoreLineWidth=false) const override
Convert the pad shape to a closed polygon.
void SetNumber(const wxString &aNumber)
Set the pad number (note that it can be alphanumeric, such as the array reference "AA12").
int GetLocalThermalGapOverride(wxString *aSource=nullptr) const
wxString ShowPadAttr() const
void AddPrimitive(PCB_LAYER_ID aLayer, PCB_SHAPE *aPrimitive)
Add item to the custom shape primitives list.
void SetDrillShape(PAD_DRILL_SHAPE aShape)
int m_effectiveBoundingRadius
void SetLocalSolderMaskMargin(std::optional< int > aMargin)
void SetLocalZoneConnection(ZONE_CONNECTION aType)
void SetChamferRectRatio(PCB_LAYER_ID aLayer, double aChamferScale)
Has meaning only for chamfered rectangular pads.
int GetSolderMaskExpansion(PCB_LAYER_ID aLayer) const
std::optional< int > GetLocalClearance() const override
Return any local clearances set in the "classic" (ie: pre-rule) system.
void ImportSettingsFrom(const PAD &aMasterPad)
Import the pad settings from aMasterPad.
double Similarity(const BOARD_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
bool IsOnCopperLayer() const override
void SetDrillSizeX(const int aX)
void SetPadstack(const PADSTACK &aPadstack)
void SetPosition(const VECTOR2I &aPos) override
const SHAPE_COMPOUND & buildEffectiveShape(PCB_LAYER_ID aLayer) const
const PADSTACK & Padstack() const
const VECTOR2I & GetOffset(PCB_LAYER_ID aLayer) const
void BuildEffectivePolygon(ERROR_LOC aErrorLoc=ERROR_INSIDE) const
static LSET ConnSMDMask()
layer set for a SMD pad on Front layer used for edge board connectors
void SetDrillSize(const VECTOR2I &aSize)
EDA_ANGLE GetOrientation() const
Return the rotation angle of the pad.
void SetSize(PCB_LAYER_ID aLayer, const VECTOR2I &aSize)
PADSTACK::CUSTOM_SHAPE_ZONE_MODE GetCustomShapeInZoneOpt() const
PAD_DRILL_SHAPE GetDrillShape() const
int GetChamferPositions(PCB_LAYER_ID aLayer) const
static LSET ApertureMask()
layer set for an aperture pad
virtual const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
std::mutex m_polyBuildingLock
void SetRoundRectCornerRadius(PCB_LAYER_ID aLayer, double aRadius)
Has meaning only for rounded rectangle pads.
static LSET SMDMask()
layer set for a SMD pad on Front layer
std::optional< int > GetLocalSolderPasteMargin() const
void CheckPad(UNITS_PROVIDER *aUnitsProvider, const std::function< void(int aErrorCode, const wxString &aMsg)> &aErrorHandler) const
const std::shared_ptr< SHAPE_POLY_SET > & GetEffectivePolygon(PCB_LAYER_ID aLayer, ERROR_LOC aErrorLoc=ERROR_INSIDE) const
std::optional< int > GetLocalSolderMaskMargin() const
void SetLocalSolderPasteMargin(std::optional< int > aMargin)
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
void doCheckPad(PCB_LAYER_ID aLayer, UNITS_PROVIDER *aUnitsProvider, const std::function< void(int aErrorCode, const wxString &aMsg)> &aErrorHandler) const
int GetThermalSpokeWidth() const
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
void SetPinFunction(const wxString &aName)
Set the pad function (pin name in schematic)
EDA_ANGLE GetFPRelativeOrientation() const
double GetChamferRectRatio(PCB_LAYER_ID aLayer) const
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
void SetFPRelativeOrientation(const EDA_ANGLE &aAngle)
void SetCustomShapeInZoneOpt(PADSTACK::CUSTOM_SHAPE_ZONE_MODE aOption)
Set the option for the custom pad shape to use as clearance area in copper zones.
int GetBoundingRadius() const
Return the radius of a minimum sized circle which fully encloses this pad.
void ClearZoneLayerOverrides()
void SetOrientation(const EDA_ANGLE &aAngle)
Set the rotation angle of the pad.
std::mutex m_zoneLayerOverridesMutex
PADSTACK::UNCONNECTED_LAYER_MODE GetUnconnectedLayerMode() const
VECTOR2I GetSolderPasteMargin(PCB_LAYER_ID aLayer) const
Usually < 0 (mask shape smaller than pad)because the margin can be dependent on the pad size,...
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
LAYER_POLYGON_MAP m_effectivePolygons
void SetLocalClearance(std::optional< int > aClearance)
int GetSubRatsnest() const
void SetSizeX(const int aX)
ZONE_CONNECTION GetLocalZoneConnection() const
void SetThermalSpokeWidth(int aWidth)
Set the width of the thermal spokes connecting the pad to a zone.
void SetDrillSizeY(const int aY)
double GetThermalSpokeAngleDegrees() const
int GetThermalGap() const
VECTOR2I ShapePos(PCB_LAYER_ID aLayer) const
std::shared_ptr< SHAPE_SEGMENT > GetEffectiveHoleShape() const override
Return a SHAPE_SEGMENT object representing the pad's hole.
void SetOrientationDegrees(double aOrientation)
ZONE_CONNECTION GetZoneConnectionOverrides(wxString *aSource=nullptr) const
void SetLayerSet(const LSET &aLayers) override
bool SharesNetTieGroup(const PAD *aOther) const
PAD_SHAPE GetAnchorPadShape(PCB_LAYER_ID aLayer) const
void SetRoundRectRadiusRatio(PCB_LAYER_ID aLayer, double aRadiusScale)
Has meaning only for rounded rectangle pads.
double ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
void SetSubRatsnest(int aSubRatsnest)
int GetLocalSpokeWidthOverride(wxString *aSource=nullptr) const
bool TransformHoleToPolygon(SHAPE_POLY_SET &aBuffer, int aClearance, int aError, ERROR_LOC aErrorLoc=ERROR_INSIDE) const
Build the corner list of the polygonal drill shape in the board coordinate system.
void SetPadToDieLength(int aLength)
bool operator==(const PAD &aOther) const
wxString ShowPadShape(PCB_LAYER_ID aLayer) const
void SetSizeY(const int aY)
int GetPadToDieLength() const
BOX2I m_effectiveBoundingBox
const VECTOR2I & GetSize(PCB_LAYER_ID aLayer) const
virtual std::vector< int > ViewGetLayers() const override
Return the all the layers within the VIEW the object is painted on.
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
bool IsProxyItem() const override
void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const override
Convert the shape to a closed polygon.
void Move(const VECTOR2I &aMoveVector) override
Move this object.
void SetStroke(const STROKE_PARAMS &aStroke) override
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
PROPERTY_BASE & SetAvailableFunc(std::function< bool(INSPECTABLE *)> aFunc)
Set a callback function to determine whether an object provides this property.
PROPERTY_BASE & SetWriteableFunc(std::function< bool(INSPECTABLE *)> aFunc)
PROPERTY_BASE & SetValidator(PROPERTY_VALIDATOR_FN &&aValidator)
PROPERTY_BASE & SetIsHiddenFromLibraryEditors(bool aIsHidden=true)
Provide class metadata.Helper macro to map type hashes to names.
void InheritsAfter(TYPE_ID aDerived, TYPE_ID aBase)
Declare an inheritance relationship between types.
void Mask(TYPE_ID aDerived, TYPE_ID aBase, const wxString &aName)
Sets a base class property as masked in a derived class.
static PROPERTY_MANAGER & Instance()
PROPERTY_BASE & AddProperty(PROPERTY_BASE *aProperty, const wxString &aGroup=wxEmptyString)
Register a property.
void OverrideAvailability(TYPE_ID aDerived, TYPE_ID aBase, const wxString &aName, std::function< bool(INSPECTABLE *)> aFunc)
Sets an override availability functor for a base class property of a given derived class.
static VALIDATOR_RESULT PositiveIntValidator(const wxAny &&aValue, EDA_ITEM *aItem)
static SEG::ecoord Square(int a)
const BOX2I BBox(int aClearance=0) const override
Compute a bounding box of the shape, with a margin of aClearance a collision.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
void Move(const VECTOR2I &aVector) override
int PointCount() const
Return the number of points (vertices) in this line chain.
void Append(int aX, int aY, bool aAllowDuplication=false)
Append a new point at the end of the line chain.
void Rotate(const EDA_ANGLE &aAngle, const VECTOR2I &aCenter={ 0, 0 }) override
Rotate all vertices by a given angle.
const VECTOR2I & CPoint(int aIndex) const
Return a reference to a given point in the line chain.
Represent a set of closed polygons.
void Rotate(const EDA_ANGLE &aAngle, const VECTOR2I &aCenter={ 0, 0 }) override
Rotate all vertices by a given angle.
bool IsEmpty() const
Return true if the set is empty (no polygons at all)
void Fracture()
Convert a set of polygons with holes to a single outline with "slits"/"fractures" connecting the oute...
bool Collide(const SHAPE *aShape, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const override
Check if the boundary of shape (this) lies closer to the shape aShape than aClearance,...
void Inflate(int aAmount, CORNER_STRATEGY aCornerStrategy, int aMaxError, bool aSimplify=false)
Perform outline inflation/deflation.
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Appends a vertex at the end of the given outline/hole (default: the last outline)
void BooleanIntersection(const SHAPE_POLY_SET &b)
Perform boolean polyset intersection.
int OutlineCount() const
Return the number of outlines in the set.
void Move(const VECTOR2I &aVector) override
void BooleanSubtract(const SHAPE_POLY_SET &b)
Perform boolean polyset difference.
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
Represent a simple polygon consisting of a zero-thickness closed chain of connected line segments.
An abstract shape on 2D plane.
Simple container to manage line stroke parameters.
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
A lower-precision version of StringFromValue().
wxString StringFromValue(double aValue, bool aAddUnitLabel=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
Converts aValue in internal units into a united string.
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.
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 a rectangle with rounded corners and/or chamfered corners to a polygon.
void TransformOvalToPolygon(SHAPE_POLY_SET &aBuffer, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc, int aMinSegCount=0)
Convert a oblong shape to a polygon, using multiple segments.
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)
Convert a rectangle or trapezoid to a polygon.
@ RECT_CHAMFER_BOTTOM_RIGHT
@ RECT_CHAMFER_BOTTOM_LEFT
static PCB_SHAPE * findNext(PCB_SHAPE *aShape, const VECTOR2I &aPoint, const std::vector< PCB_SHAPE * > &aList, unsigned aLimit)
Search for a PCB_SHAPE matching a given end point or start point in a list.
@ DRCE_PAD_TH_WITH_NO_HOLE
@ HOLE_CLEARANCE_CONSTRAINT
static constexpr EDA_ANGLE ANGLE_0
#define FOOTPRINT_EDIT_FRAME_NAME
#define PCB_EDIT_FRAME_NAME
#define ENTERED
indicates a group has been entered
#define SKIP_STRUCT
flag indicating that the structure should be ignored
Some functions to handle hotkeys in KiCad.
@ LAYER_PAD_FR_NETNAMES
Additional netnames layers (not associated with a PCB layer)
bool IsFrontLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a front layer.
FLASHING
Enum used during connectivity building to ensure we do not query connectivity while building the data...
bool IsBackLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a back layer.
bool IsCopperLayer(int aLayerId)
Tests whether a layer is a copper layer.
@ LAYER_FOOTPRINTS_FR
show footprints on front
@ LAYER_NON_PLATEDHOLES
handle color for not plated holes (holes, not pads)
@ LAYER_PADS
Meta control for all pads opacity/visibility (color ignored)
@ LAYER_PAD_PLATEDHOLES
to draw pad holes (plated)
@ LAYER_FOOTPRINTS_BK
show footprints on back
bool IsNetnameLayer(int aLayer)
Test whether a layer is a netname layer.
bool IsHoleLayer(int aLayer)
PCB_LAYER_ID
A quick note on layer IDs:
This file contains miscellaneous commonly used macros and functions.
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
constexpr void MIRROR(T &aPoint, const T &aMirrorRef)
Updates aPoint with the mirror of aPoint relative to the aMirrorRef.
Message panel definition file.
constexpr int Mils2IU(const EDA_IU_SCALE &aIuScale, int mils)
KICOMMON_API VECTOR2I UnpackVector2(const types::Vector2 &aInput)
KICOMMON_API void PackVector2(types::Vector2 &aOutput, const VECTOR2I &aInput)
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
static struct PAD_DESC _PAD_DESC
PAD_DRILL_SHAPE
The set of pad drill shapes, used with PAD::{Set,Get}DrillShape()
PAD_ATTRIB
The set of pad shapes, used with PAD::{Set,Get}Attribute().
PAD_SHAPE
The set of pad shapes, used with PAD::{Set,Get}Shape()
PAD_PROP
The set of pad properties used in Gerber files (Draw files, and P&P files) to define some properties ...
#define NO_SETTER(owner, type)
#define ENUM_TO_WXANY(type)
Macro to define read-only fields (no setter method available)
wxString UnescapeString(const wxString &aSource)
constexpr int mmToIU(double mm) const
VECTOR2I size
Drill diameter (x == y) or slot dimensions (x != y)
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
@ PCB_PAD_T
class PAD, a pad in a footprint
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
VECTOR2< int32_t > VECTOR2I
VECTOR2< int64_t > VECTOR2L
ZONE_CONNECTION
How pads are covered by copper in zone.
#define ZONE_THICKNESS_MIN_VALUE_MM